Skip to content

Commit

Permalink
release <- dev (2.4.5)
Browse files Browse the repository at this point in the history
release <- dev (2.4.5)
  • Loading branch information
TrevisanGMW authored Oct 14, 2022
2 parents 828d8b8 + 6c03976 commit 52a256f
Show file tree
Hide file tree
Showing 10 changed files with 1,130 additions and 471 deletions.
2 changes: 1 addition & 1 deletion python-scripts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os

# Global Vars
PACKAGE_VERSION = "2.4.4"
PACKAGE_VERSION = "2.4.5"

# Initial Setup - Add path and initialize logger
if __name__ != '__main__':
Expand Down
7 changes: 5 additions & 2 deletions python-scripts/gt_attributes_to_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
Added save to shelf
Updated help
1.0.1 - 2022-10-06
Added triple quote to string attributes
TODO:
Add options
Expand Down Expand Up @@ -51,7 +54,7 @@
script_name = 'GT Attributes to Python'

# Version:
script_version = "1.0.0"
script_version = "1.0.1"

DIMENSIONS = ['x', 'y', 'z']
DEFAULT_CHANNELS = ['t', 'r', 's']
Expand Down Expand Up @@ -224,7 +227,7 @@ def user_attr_to_python(obj_list, printing=True):
if attr_type == 'double3':
pass
elif attr_type == 'string':
output += 'cmds.setAttr("' + obj + '.' + attr + '", "' + str(value) + '", typ="string")\n'
output += 'cmds.setAttr("' + obj + '.' + attr + '", """' + str(value) + '""", typ="string")\n'
else:
output += 'cmds.setAttr("' + obj + '.' + attr + '", ' + str(value) + ')\n'

Expand Down
8 changes: 3 additions & 5 deletions python-scripts/gt_maya_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@
logger = logging.getLogger("gt_utilities")
logger.setLevel(logging.INFO)

# Find FileBrowser Path
FILEBROWSER_PATH = os.path.join(os.getenv('WINDIR'), 'explorer.exe')

''' ____________________________ General Functions ____________________________'''


Expand All @@ -204,12 +201,13 @@ def open_dir(path):
""""""
if sys.platform == "win32": # Windows
# explorer needs forward slashes
filebrowser_path = os.path.join(os.getenv('WINDIR'), 'explorer.exe')
path = os.path.normpath(path)

if os.path.isdir(path):
subprocess.run([FILEBROWSER_PATH, path])
subprocess.run([filebrowser_path, path])
elif os.path.isfile(path):
subprocess.run([FILEBROWSER_PATH, '/select,', path])
subprocess.run([filebrowser_path, '/select,', path])
elif sys.platform == "darwin": # Mac-OS
try:
subprocess.call(["open", "-R", path])
Expand Down
817 changes: 425 additions & 392 deletions python-scripts/gt_rigger_biped_gui.py

Large diffs are not rendered by default.

57 changes: 39 additions & 18 deletions python-scripts/gt_rigger_biped_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,18 @@
1.10.0 - 2022-09-14
Added feet switcher reference locators

1.10.1 - 2022-09-26
1.10.1 to 1.10.3 - 2022-09-26
Fixed an issue where the right leg feet would be generated broken
Updated pole vector to be taken in consideration while generating right leg
Fixed an issue where the finger controls would have unexpected rotation

1.10.4 - 2022-09-27
Added missing option "simplify_spine" to metadata

1.11.0 to 1.11.1- 2022-10-13
Renamed main functions
Updated validate operations
Updated "store_proxy_as_string" parameters to match new pattern

TODO Biped Rigger:
Transfer scale information from ik spine limit spine to spines
Expand All @@ -303,7 +313,7 @@
Make scale system and breathing system optional
Add more roll joints (upper part of the arm, legs, etc)
Add option to auto create proxy geo
Fix "Use Real-time Skeleton" option (broken after new UI setup)
Move all constraints to another group?
"""
from gt_rigger_utilities import *
from gt_rigger_data import *
Expand All @@ -320,7 +330,7 @@
logger.setLevel(logging.INFO)


def create_proxy(data_biped):
def create_biped_proxy(data_biped):
"""
Creates a proxy (guide) skeleton used to later generate entire rig

Expand Down Expand Up @@ -1673,8 +1683,13 @@ def create_proxy(data_biped):
pos='botLeft', fade=True, alpha=.9)


def create_controls(data_biped):
""" Creates rig using the previously created proxy/guide """
def create_biped_rig(data_biped):
"""
Creates rig using the previously created proxy/guide

Args:
data_biped: biped_data object
"""

def rename_proxy(old_name):
"""
Expand Down Expand Up @@ -3731,10 +3746,10 @@ def remove_numbers(string):
right_foot_offset_ik_ctrl = cmds.duplicate(right_foot_ik_ctrl, renameChildren=True,
name=right_foot_ik_ctrl.replace('_' + CTRL_SUFFIX,
'_offset' + CTRL_SUFFIX.capitalize()))[0]
right_foot_offset_ik_ctrl_grp = cmds.duplicate(right_foot_ik_ctrl, po=True, # group command generates junk data
right_foot_offset_ik_ctrl_grp = cmds.duplicate(right_foot_ik_ctrl, po=True, # group command generates junk data
name=right_foot_offset_ik_ctrl + GRP_SUFFIX.capitalize())[0]

right_foot_offset_data_grp = cmds.duplicate(right_foot_ik_ctrl, po=True, # group command generates junk data
right_foot_offset_data_grp = cmds.duplicate(right_foot_ik_ctrl, po=True, # group command generates junk data
name=right_foot_offset_ik_ctrl.replace(CTRL_SUFFIX.capitalize(),
'Data'))[0]

Expand Down Expand Up @@ -5234,12 +5249,14 @@ def remove_numbers(string):
# Position
cmds.delete(cmds.parentConstraint(rig_joints.get('left_wrist_jnt'), left_fingers_ctrl_grp))
cmds.move(left_wrist_scale_offset * 2.3, left_fingers_ctrl_grp, x=True, relative=True, objectSpace=True)
cmds.setAttr(left_fingers_ctrl_grp + '.rotateX', 0)

# Hierarchy
change_viewport_color(left_fingers_ctrl, LEFT_CTRL_COLOR)
cmds.parent(left_fingers_ctrl_grp, left_hand_grp)

# Rotation
cmds.rotate(90, left_fingers_ctrl_grp, rotateX=True, relative=True)

# Right Finger Automation Controls
# Right Fingers
right_fingers_ctrl_a = cmds.curve(name='right_fingers_' + CTRL_SUFFIX,
Expand Down Expand Up @@ -5391,12 +5408,14 @@ def remove_numbers(string):
# Position
cmds.delete(cmds.parentConstraint(rig_joints.get('right_wrist_jnt'), right_fingers_ctrl_grp))
cmds.move(-right_wrist_scale_offset * 2.3, right_fingers_ctrl_grp, x=True, relative=True, objectSpace=True)
cmds.setAttr(right_fingers_ctrl_grp + '.rotateX', -180)

# Hierarchy
change_viewport_color(right_fingers_ctrl, RIGHT_CTRL_COLOR)
cmds.parent(right_fingers_ctrl_grp, right_hand_grp)

# Rotation
cmds.rotate(90, right_fingers_ctrl_grp, rotateX=True, relative=True)

# ################ ======= Rig Mechanics ======= #################

# Main Scale
Expand Down Expand Up @@ -7717,7 +7736,8 @@ def remove_numbers(string):
# ################# Right Leg IK Controls #################
# Right Leg IK

right_leg_rp_ik_handle = cmds.ikHandle(n='right_footAnkle_RP_ikHandle', sj=right_hip_ik_jnt, ee=right_ankle_ik_jnt,
right_leg_rp_ik_handle = cmds.ikHandle(n='right_footAnkle_RP_ikHandle',
sj=right_hip_ik_jnt, ee=right_ankle_ik_jnt,
sol='ikRPsolver')

# In case ball joint is inverted, undo ikHandle and invert knee's preferredAngleZ
Expand All @@ -7731,6 +7751,8 @@ def remove_numbers(string):
cmds.setAttr(right_ball_probe + '.point2Y', right_ball_probe_end[1])
cmds.setAttr(right_ball_probe + '.point2Z', right_ball_probe_end[2])

cmds.poleVectorConstraint(right_knee_ik_ctrl, right_leg_rp_ik_handle[0])

if cmds.getAttr(right_ball_probe + '.distance') > 0.01:
cmds.delete(right_leg_rp_ik_handle)
cmds.setAttr(right_knee_ik_jnt + ".preferredAngleZ", 90)
Expand All @@ -7744,7 +7766,6 @@ def remove_numbers(string):

right_leg_toe_ik_handle = cmds.ikHandle(n='right_footToe_SC_ikHandle', sj=right_ball_ik_jnt, ee=right_toe_ik_jnt,
sol='ikSCsolver')
cmds.poleVectorConstraint(right_knee_ik_ctrl, right_leg_rp_ik_handle[0])

# Right Foot Automation Setup
right_foot_pivot_grp = cmds.group(name='right_foot_pivot' + GRP_SUFFIX.capitalize(), empty=True, world=True)
Expand Down Expand Up @@ -9929,7 +9950,7 @@ def remove_numbers(string):
cmds.parent(rig_joints.get('cog_jnt'), rig_joints.get('hip_jnt'))

# Store Proxy as String Attribute
store_proxy_as_string(main_ctrl, 'biped_proxy_pose', data_biped)
store_proxy_as_string(data_biped)

# Delete Proxy
cmds.delete(elements.get('main_proxy_grp'))
Expand Down Expand Up @@ -10119,6 +10140,7 @@ def remove_numbers(string):
metadata_dict = {'worldspace_ik_orient': settings.get('worldspace_ik_orient'),
'uniform_ctrl_orient': settings.get('uniform_ctrl_orient'),
'using_no_ssc_skeleton': settings.get('using_no_ssc_skeleton'),
'simplify_spine': settings.get('simplify_spine'),
'skeleton_root': str(rig_joints_default.get('main_jnt')),
}
cmds.setAttr(main_ctrl + '.metadata', json.dumps(metadata_dict, indent=4), typ='string')
Expand Down Expand Up @@ -10270,7 +10292,7 @@ def remove_numbers(string):
# End of Create Base Rig Controls


def build_biped_rig(create_rig_ctrls=True, debugging=True):
def build_test_biped_rig(create_rig_ctrls=True, debugging=True):
"""
Creates a rig without the GUI. Helpful for when debugging or changing the rig.
Args:
Expand Down Expand Up @@ -10303,20 +10325,19 @@ def build_biped_rig(create_rig_ctrls=True, debugging=True):
cmds.setAttr('persp.rz', persp_rot[2])

# Create Proxy
create_proxy(biped_obj)
create_biped_proxy(biped_obj)

# Use Proxy Template
biped_obj.debugging_import_proxy = True
import gt_rigger_biped_gui
if biped_obj.debugging_import_proxy:
gt_rigger_biped_gui.import_biped_proxy_pose(debugging=biped_obj.debugging_import_proxy,
debugging_path=biped_obj.debugging_import_path)
gt_rigger_biped_gui.import_biped_proxy_pose(source_path=biped_obj.debugging_import_path)

# Create Controls
if create_rig_ctrls:
create_controls(biped_obj)
create_biped_rig(biped_obj)


# Test it
if __name__ == '__main__':
build_biped_rig(create_rig_ctrls=True, debugging=True)
build_test_biped_rig(create_rig_ctrls=True, debugging=True)
26 changes: 21 additions & 5 deletions python-scripts/gt_rigger_corrective_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@
Added proxy visibility and locked main group
Added settings to make the creation of certain correctives optional
0.0.11 - 2022-07-13
1.0.1 - 2022-07-13
Updated default position of a few of the corrective targets
1.0.2 - 2022-09-30
Added an auto merge check at the end of the create correctives function
Added suppress warning option to "merge_corrective_elements"
1.0.3 = 2022-10-13
Updated "store_proxy_as_string" parameters to match new pattern
"""
from collections import namedtuple
from gt_rigger_utilities import *
Expand Down Expand Up @@ -1948,12 +1955,16 @@ def rename_proxy(old_name):
cmds.setAttr(obj + '.overrideDisplayType', 1)

# Store Proxy as String Attribute
store_proxy_as_string(main_ctrl, 'corrective_proxy_pose', corrective_data)
store_proxy_as_string(corrective_data)

# Delete Proxy
if cmds.objExists(_corrective_proxy_dict.get('main_proxy_grp')):
cmds.delete(_corrective_proxy_dict.get('main_proxy_grp'))

# Auto Merge
if corrective_data.settings.get('auto_merge'):
merge_corrective_elements(supress_warning=True)

# ###################################### Debugging #######################################
if corrective_data.debugging:
try:
Expand All @@ -1971,8 +1982,12 @@ def rename_proxy(old_name):
logger.debug(exception)


def merge_corrective_elements():
""" Merges corrective elements with pre-existing biped rig """
def merge_corrective_elements(supress_warning=False):
"""
Merges corrective elements with pre-existing biped rig
Args:
supress_warning(bool, optional): If active, function will fail quietly instead of displaying a warning
"""
necessary_elements = []

corrective_rig_grp = 'corrective_rig_grp'
Expand All @@ -1987,7 +2002,8 @@ def merge_corrective_elements():

for obj in necessary_elements:
if not cmds.objExists(obj):
cmds.warning('Missing a require element. "' + obj + ' "')
if not supress_warning:
cmds.warning('Missing a require element. "' + obj + ' "')
return

corrective_joints = cmds.listRelatives('corrective_skeleton_grp', children=True) or []
Expand Down
Loading

0 comments on commit 52a256f

Please sign in to comment.