Skip to content

Commit d130251

Browse files
Re-parent tool v2, window to easily re-parent children under nodes.
Issue #200
1 parent c224415 commit d130251

15 files changed

Lines changed: 1332 additions & 12 deletions

config/functions.json

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,23 +536,60 @@
536536
]
537537
},
538538
"reparent_under_node": {
539-
"name": "Reparent under Node",
539+
"name": "Reparent under Node (v1)",
540540
"name_shelf": "RePar",
541-
"tooltip": "Reparent the selection under the last selected node.",
541+
"tooltip": "Reparent the selection under the last selected node. (version 1)",
542542
"command": [
543543
"import mmSolver.tools.reparent.tool;",
544544
"mmSolver.tools.reparent.tool.reparent_under_node();"
545545
]
546546
},
547547
"unparent_to_world": {
548-
"name": "Unparent to World",
548+
"name": "Unparent to World (v1)",
549549
"name_shelf": "UnPar",
550-
"tooltip": "Unparent the selected nodes into world space.",
550+
"tooltip": "Unparent the selected nodes into world space. (version 1)",
551551
"command": [
552552
"import mmSolver.tools.reparent.tool;",
553553
"mmSolver.tools.reparent.tool.unparent_to_world();"
554554
]
555555
},
556+
"reparent2_ui": {
557+
"name": "Reparent...",
558+
"name_shelf": "RePar",
559+
"tooltip": "Open Reparent node.",
560+
"command": [
561+
"import mmSolver.tools.reparent2.tool;",
562+
"mmSolver.tools.reparent2.tool.open_window();"
563+
]
564+
},
565+
"reparent_under_node2": {
566+
"name": "Reparent under Node",
567+
"name_shelf": "RePar",
568+
"tooltip": "Reparent the selection under the last selected node.",
569+
"command": [
570+
"import mmSolver.tools.reparent2.tool;",
571+
"mmSolver.tools.reparent2.tool.reparent_under_node();"
572+
],
573+
"option_box": true,
574+
"command_option_box": [
575+
"import mmSolver.tools.reparent2.tool;",
576+
"mmSolver.tools.reparent2.tool.reparent_under_node_open_window();"
577+
]
578+
},
579+
"unparent_to_world2": {
580+
"name": "Unparent to World",
581+
"name_shelf": "UnPar",
582+
"tooltip": "Unparent the selected nodes into world space.",
583+
"command": [
584+
"import mmSolver.tools.reparent2.tool;",
585+
"mmSolver.tools.reparent2.tool.unparent_to_world();"
586+
],
587+
"option_box": true,
588+
"command_option_box": [
589+
"import mmSolver.tools.reparent2.tool;",
590+
"mmSolver.tools.reparent2.tool.unparent_to_world_open_window();"
591+
]
592+
},
556593
"create_controller": {
557594
"name": "Create Controller (v1)",
558595
"name_shelf": "CrCtrl",

config/menu.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
"general_tools/sort_nodes_in_outliner",
6666
"general_tools/remove_all_solver_nodes",
6767
"general_tools/---Parenting",
68-
"general_tools/reparent_under_node",
69-
"general_tools/unparent_to_world",
68+
"general_tools/reparent_under_node2",
69+
"general_tools/unparent_to_world2",
7070
"general_tools/---Controllers",
7171
"general_tools/create_controller2",
7272
"general_tools/remove_controller2",

config/shelf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
"general_tools/gen_tools_popup/sort_nodes_in_outliner",
6868
"general_tools/gen_tools_popup/remove_all_solver_nodes",
6969
"general_tools/gen_tools_popup/---Parenting",
70-
"general_tools/gen_tools_popup/reparent_under_node",
71-
"general_tools/gen_tools_popup/unparent_to_world",
70+
"general_tools/gen_tools_popup/reparent_under_node2",
71+
"general_tools/gen_tools_popup/unparent_to_world2",
7272
"general_tools/gen_tools_popup/---Controllers",
7373
"general_tools/gen_tools_popup/create_controller2",
7474
"general_tools/gen_tools_popup/remove_controller2",

config/shelf_minimal.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
"general_tools/gen_tools_popup/sort_nodes_in_outliner",
6464
"general_tools/gen_tools_popup/remove_all_solver_nodes",
6565
"general_tools/gen_tools_popup/---Parenting",
66-
"general_tools/gen_tools_popup/reparent_under_node",
67-
"general_tools/gen_tools_popup/unparent_to_world",
66+
"general_tools/gen_tools_popup/reparent_under_node2",
67+
"general_tools/gen_tools_popup/unparent_to_world2",
6868
"general_tools/gen_tools_popup/---Controllers",
6969
"general_tools/gen_tools_popup/create_controller2",
7070
"general_tools/gen_tools_popup/remove_controller2",

docs/source/mmSolver.tools.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ mmSolver.tools
3636
mmSolver.tools.removecontroller2
3737
mmSolver.tools.removesolvernodes
3838
mmSolver.tools.reparent
39+
mmSolver.tools.reparent2
3940
mmSolver.tools.reprojectbundle
4041
mmSolver.tools.screenspacemotiontrail
4142
mmSolver.tools.screenspacetransform

docs/source/tools_generaltools.rst

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ This is equivalent to Maya's *Parent* tool (`p` hotkey), except the
485485
tool will maintain the world-space position of the transform node for
486486
each keyframe applied to the node.
487487

488+
See the :ref:`Reparent UI <reparent-window-tool-ref>` for options.
489+
488490
Usage:
489491

490492
1) Select nodes to change parent, then select the new parent node.
@@ -503,7 +505,7 @@ To run the tool, use this Python command:
503505

504506
.. code:: python
505507
506-
import mmSolver.tools.reparent.tool as tool
508+
import mmSolver.tools.reparent2.tool as tool
507509
tool.reparent_under_node()
508510
509511
.. _unparent-to-world-tool-ref:
@@ -515,6 +517,8 @@ This is equalivent to Maya's *Unparent* tool (`Shift + p` hotkey), except the to
515517
maintain the world-space position of the transform node for each
516518
keyframe applied to the node.
517519

520+
See the :ref:`Reparent UI <reparent-window-tool-ref>` for options.
521+
518522
Usage:
519523

520524
1) Select Maya transform node(s).
@@ -531,9 +535,71 @@ To run the tool, use this Python command:
531535

532536
.. code:: python
533537
534-
import mmSolver.tools.reparent.tool as tool
538+
import mmSolver.tools.reparent2.tool as tool
535539
tool.unparent_to_world()
536540
541+
.. _reparent-window-tool-ref:
542+
543+
Reparent UI
544+
-----------
545+
546+
This window displays options for how to re-parent nodes.
547+
548+
*Reparent* is the underlying tool window used by both
549+
:ref:`Reparent Under Node <reparent-under-node-tool-ref>`
550+
and :ref:`Unparent to World <unparent-to-world-tool-ref>`.
551+
552+
.. figure:: images/tools_reparent_ui.png
553+
:alt: Reparent UI
554+
:align: center
555+
:width: 40%
556+
557+
.. list-table:: Reparent UI Options
558+
:widths: auto
559+
:header-rows: 1
560+
561+
* - Name
562+
- Values
563+
- Description
564+
565+
* - Children
566+
- *Node Names*
567+
- Description
568+
569+
* - Parent
570+
- *Node Name* or empty
571+
- The node to place children underneath.
572+
573+
* - Frame Range
574+
- *Timeline (Inner)*, *Timeline (Outer)* or *Custom*
575+
- The frame range to bake.
576+
577+
* - Bake Mode
578+
- *Full Bake* or *Smart Bake*
579+
- Method for how keyframes are baked.
580+
581+
* - Rotate Order
582+
- *Use Existing* or *XYZ*, *ZXY*, etc
583+
- Change the rotation order of children nodes when re-parenting.
584+
585+
* - Delete Static AnimCurves
586+
- *Yes* or *No*
587+
- Baked attributes that do not animate have all keys replaced
588+
with a static value.
589+
590+
This video tutorial explains how the re-parenting tool works.
591+
592+
.. raw:: html
593+
594+
<iframe width="720" height="405" src="https://www.youtube.com/embed/UmVu3oag_-k" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
595+
596+
To run the tool, use this Python command:
597+
598+
.. code:: python
599+
600+
import mmSolver.tools.reparent2.tool as tool
601+
tool.open_window()
602+
537603
.. _remove-solver-nodes-tool-ref:
538604

539605
Remove Solver Nodes

python/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ if (BUILD_QT_UI)
6363
${CMAKE_SOURCE_DIR}/python/mmSolver/tools/raycastmarker/ui/ui_raycastmarker_layout.py
6464
)
6565

66+
add_ui_compile("reparent2"
67+
${CMAKE_SOURCE_DIR}/python/mmSolver/tools/reparent2/ui/reparent2_layout.ui
68+
${CMAKE_SOURCE_DIR}/python/mmSolver/tools/reparent2/ui/ui_reparent2_layout.py
69+
)
70+
6671
add_ui_compile("removesolvernodes"
6772
${CMAKE_SOURCE_DIR}/python/mmSolver/tools/removesolvernodes/ui/removesolvernodes_layout.ui
6873
${CMAKE_SOURCE_DIR}/python/mmSolver/tools/removesolvernodes/ui/ui_removesolvernodes_layout.py
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (C) 2021 David Cattermole.
2+
#
3+
# This file is part of mmSolver.
4+
#
5+
# mmSolver is free software: you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License as
7+
# published by the Free Software Foundation, either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# mmSolver is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
17+
#
18+
"""
19+
Re-parent transform node to a new parent, across time.
20+
"""
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Copyright (C) 2021 David Cattermole.
2+
#
3+
# This file is part of mmSolver.
4+
#
5+
# mmSolver is free software: you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License as
7+
# published by the Free Software Foundation, either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# mmSolver is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
17+
#
18+
"""
19+
Reparent Transforms constants.
20+
"""
21+
22+
WINDOW_TITLE = 'Reparent'
23+
24+
# Constants for frame range mode.
25+
FRAME_RANGE_MODE_TIMELINE_INNER_VALUE = 'timeline_inner'
26+
FRAME_RANGE_MODE_TIMELINE_OUTER_VALUE = 'timeline_outer'
27+
FRAME_RANGE_MODE_CUSTOM_VALUE = 'custom'
28+
FRAME_RANGE_MODE_VALUES = [
29+
FRAME_RANGE_MODE_TIMELINE_INNER_VALUE,
30+
FRAME_RANGE_MODE_TIMELINE_OUTER_VALUE,
31+
FRAME_RANGE_MODE_CUSTOM_VALUE,
32+
]
33+
FRAME_RANGE_MODE_TIMELINE_INNER_LABEL = 'Timeline (Inner)'
34+
FRAME_RANGE_MODE_TIMELINE_OUTER_LABEL = 'Timeline (Outer)'
35+
FRAME_RANGE_MODE_CUSTOM_LABEL = 'Custom'
36+
FRAME_RANGE_MODE_LABELS = [
37+
FRAME_RANGE_MODE_TIMELINE_INNER_LABEL,
38+
FRAME_RANGE_MODE_TIMELINE_OUTER_LABEL,
39+
FRAME_RANGE_MODE_CUSTOM_LABEL,
40+
]
41+
42+
# Constants for bake mode.
43+
BAKE_MODE_FULL_BAKE_VALUE = 'full_bake'
44+
BAKE_MODE_SMART_BAKE_VALUE = 'smart_bake'
45+
BAKE_MODE_VALUES = [
46+
BAKE_MODE_FULL_BAKE_VALUE,
47+
BAKE_MODE_SMART_BAKE_VALUE,
48+
]
49+
BAKE_MODE_FULL_BAKE_LABEL = 'Full Bake'
50+
BAKE_MODE_SMART_BAKE_LABEL = 'Smart Bake'
51+
BAKE_MODE_LABELS = [
52+
BAKE_MODE_FULL_BAKE_LABEL,
53+
BAKE_MODE_SMART_BAKE_LABEL,
54+
]
55+
56+
# Constants for rotate order mode.
57+
ROTATE_ORDER_MODE_USE_EXISTING_VALUE = 'use_existing'
58+
ROTATE_ORDER_MODE_XYZ_VALUE = 'xyz'
59+
ROTATE_ORDER_MODE_YZX_VALUE = 'yzx'
60+
ROTATE_ORDER_MODE_ZXY_VALUE = 'zxy'
61+
ROTATE_ORDER_MODE_XZY_VALUE = 'xzy'
62+
ROTATE_ORDER_MODE_YXZ_VALUE = 'yxz'
63+
ROTATE_ORDER_MODE_ZYX_VALUE = 'zyx'
64+
ROTATE_ORDER_MODE_VALUES = [
65+
ROTATE_ORDER_MODE_USE_EXISTING_VALUE,
66+
ROTATE_ORDER_MODE_XYZ_VALUE,
67+
ROTATE_ORDER_MODE_YZX_VALUE,
68+
ROTATE_ORDER_MODE_ZXY_VALUE,
69+
ROTATE_ORDER_MODE_XZY_VALUE,
70+
ROTATE_ORDER_MODE_YXZ_VALUE,
71+
ROTATE_ORDER_MODE_ZYX_VALUE
72+
]
73+
ROTATE_ORDER_MODE_USE_EXISTING_LABEL = 'Use Existing'
74+
ROTATE_ORDER_MODE_XYZ_LABEL = 'XYZ'
75+
ROTATE_ORDER_MODE_YZX_LABEL = 'YZX'
76+
ROTATE_ORDER_MODE_ZXY_LABEL = 'ZXY'
77+
ROTATE_ORDER_MODE_XZY_LABEL = 'XZY'
78+
ROTATE_ORDER_MODE_YXZ_LABEL = 'YXZ'
79+
ROTATE_ORDER_MODE_ZYX_LABEL = 'ZYX'
80+
ROTATE_ORDER_MODE_LABELS = [
81+
ROTATE_ORDER_MODE_USE_EXISTING_LABEL,
82+
ROTATE_ORDER_MODE_XYZ_LABEL,
83+
ROTATE_ORDER_MODE_YZX_LABEL,
84+
ROTATE_ORDER_MODE_ZXY_LABEL,
85+
ROTATE_ORDER_MODE_XZY_LABEL,
86+
ROTATE_ORDER_MODE_YXZ_LABEL,
87+
ROTATE_ORDER_MODE_ZYX_LABEL,
88+
]
89+
90+
# Default Values
91+
DEFAULT_FRAME_RANGE_MODE = FRAME_RANGE_MODE_TIMELINE_INNER_VALUE
92+
DEFAULT_FRAME_START = 1001
93+
DEFAULT_FRAME_END = 1101
94+
DEFAULT_BAKE_MODE = BAKE_MODE_FULL_BAKE_VALUE
95+
DEFAULT_ROTATE_ORDER_MODE = ROTATE_ORDER_MODE_USE_EXISTING_VALUE
96+
DEFAULT_DELETE_STATIC_ANIM_CURVES = 1
97+
98+
# Config files
99+
CONFIG_FRAME_RANGE_MODE_KEY = 'mmSolver_reparent2_frameRangeMode'
100+
CONFIG_FRAME_START_KEY = 'mmSolver_reparent2_frameStart'
101+
CONFIG_FRAME_END_KEY = 'mmSolver_reparent2_frameEnd'
102+
CONFIG_BAKE_MODE_KEY = 'mmSolver_reparent2_bakeMode'
103+
CONFIG_ROTATE_ORDER_MODE_KEY = 'mmSolver_reparent2_rotateOrderMode'
104+
CONFIG_DELETE_STATIC_ANIM_CURVES_KEY = 'mmSolver_reparent2_deleteStaticAnimCurves'

0 commit comments

Comments
 (0)