Skip to content

Commit

Permalink
release <- dev (2.4.9)
Browse files Browse the repository at this point in the history
release <- dev (2.4.9)
  • Loading branch information
TrevisanGMW authored Nov 16, 2022
2 parents 81fd28e + 811687d commit a510e54
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 13 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.8"
PACKAGE_VERSION = "2.4.9"

# Initial Setup - Add path and initialize logger
if __name__ != '__main__':
Expand Down
87 changes: 87 additions & 0 deletions python-scripts/gt_blend_utilities.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
"""
GT Blend Utilities
github.com/TrevisanGMW/gt-tools - 2020-11-15
0.0.1 to 0.0.2 - 2020-11-15
Added "delete_blends_target"
Added "delete_blends_targets"
Added "delete_all_blend_targets"
TODO:
Add search/replace renamer
Add error handling
"""
import maya.cmds as cmds
import logging

# Logging Setup
logging.basicConfig()
logger = logging.getLogger("gt_blend_utilities")
logger.setLevel(logging.INFO)

# Script Name
script_name = "GT - Blend Utilities"

# Version:
script_version = "0.0.2"


def delete_blends_targets(blend_node):
"""
Delete all blend targets found in the provided blend shape node
Args:
blend_node (string) Name of the blend shape node
"""
cmds.select(d=True) # Deselect
blendshape_names = cmds.listAttr(blend_node + '.w', m=True)
for i in range(len(blendshape_names)):
cmds.removeMultiInstance(blend_node + ".weight[" + str(i) + "]", b=True)
cmds.removeMultiInstance(blend_node + ".inputTarget[0].inputTargetGroup[" + str(i) + "]", b=True)


def delete_all_blend_targets():
"""
Delete all blend shape targets (not the nodes, only the targets)
Dependencies:
delete_blends_targets()
"""
cmds.select(d=True) # Deselect
for blend_node in cmds.ls(typ="blendShape"):
delete_blends_targets(blend_node)


def delete_blends_target(blend_node, target_name):
"""
Deletes only the provided blend target
Args:
blend_node (string) Name of the blend shape node
target_name (string) Name of the blend shape target to delete
"""
cmds.select(d=True) # Deselect
blendshape_names = cmds.listAttr(blend_node + '.w', m=True)

for i in range(len(blendshape_names)):
if blendshape_names[i] == target_name:
cmds.removeMultiInstance(blend_node + ".weight[" + str(i) + "]", b=True)
cmds.removeMultiInstance(blend_node + ".inputTarget[0].inputTargetGroup[" + str(i) + "]", b=True)


def delete_blend_nodes(obj):
"""
Deletes any blend shape nodes found under the history of the provided object
Args:
obj (String): name of the object. e.g. "pSphere1"
"""
history = cmds.listHistory(obj)
for node in history:
if cmds.objectType(node) == "blendShape":
cmds.delete(node)


if __name__ == '__main__':
logger.setLevel(logging.DEBUG)
first_selection = cmds.ls(selection=True)[0]
delete_blend_nodes(first_selection)
2 changes: 1 addition & 1 deletion python-scripts/gt_rigger_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
SCRIPT_VERSION_BASE = '1.12.6'
SCRIPT_VERSION_FACIAL = '1.0.9'
SCRIPT_VERSION_CORRECTIVE = '1.0.7'
SCRIPT_VERSION_REBUILD = '0.0.13'
SCRIPT_VERSION_REBUILD = '0.0.14'

# General Vars
GRP_SUFFIX = 'grp'
Expand Down
25 changes: 14 additions & 11 deletions python-scripts/gt_rigger_rebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
Added teardown and setup script execution
UI Idea:
[X] <STEP-NAME> <STEP-STATUS> <MESSAGE> <HELP-?>
[<Activation>] <STEP-NAME> <STEP-STATUS> <HELP-?>
TODO
Add bound joint extraction
Expand All @@ -42,15 +42,16 @@
Add corrective and facial reference position
Add side GUI, fingers and feet positioning
"""
from gt_rigger_biped_gui import *
from gt_rigger_utilities import *
from gt_rigger_data import *
from gt_rigger_facial_logic import create_facial_proxy
from gt_rigger_corrective_logic import create_corrective_proxy
import gt_rigger_biped_gui as rigger_gui
import maya.cmds as cmds
import traceback
import logging
import json
import os

# Logging Setup
logging.basicConfig()
Expand All @@ -59,8 +60,10 @@

# Data Object
data_rebuild = GTBipedRiggerRebuildData()
if not data_biped: # Create one in case not already available
data_biped = GTBipedRiggerData()
# if not data_biped: # Create one in case not already available
data_biped = GTBipedRiggerData()
data_facial = GTBipedRiggerFacialData()
data_corrective = GTBipedRiggerCorrectiveData()


def evaluate_python_string(py_string, custom_error_message=None):
Expand Down Expand Up @@ -352,32 +355,32 @@ def rebuild_biped_rig(data_rebuild_object):

# -------- Rebuild Base / Biped --------
logger.debug("recreating/importing base proxy...")
create_biped_proxy(data_biped)
import_biped_proxy_pose(source_dict=data_rebuild_object.extracted_base_proxy_json)
rigger_gui.create_biped_proxy(data_biped)
rigger_gui.import_biped_proxy_pose(source_dict=data_rebuild_object.extracted_base_proxy_json)

# Rebuild Base Rig
logger.debug("recreating base rig...")
validate_biped_operation('create_biped_rig')
rigger_gui.validate_biped_operation('create_biped_rig')

# -------- Rebuild Facial --------
if data_rebuild_object.extracted_facial_proxy_json:
logger.debug("recreating/importing facial proxy...")
create_facial_proxy(data_facial)
import_facial_proxy_pose(source_dict=data_rebuild_object.extracted_facial_proxy_json)
rigger_gui.import_facial_proxy_pose(source_dict=data_rebuild_object.extracted_facial_proxy_json)

# Rebuild Facial Rig
logger.debug("recreating facial rig...")
validate_facial_operation('create_facial_rig')
rigger_gui.validate_facial_operation('create_facial_rig')

# -------- Rebuild Corrective --------
if data_rebuild_object.extracted_corrective_proxy_json:
logger.debug("recreating/importing corrective proxy...")
create_corrective_proxy(data_corrective)
import_corrective_proxy_pose(source_dict=data_rebuild_object.extracted_corrective_proxy_json)
rigger_gui.import_corrective_proxy_pose(source_dict=data_rebuild_object.extracted_corrective_proxy_json)

# Rebuild Facial Rig
logger.debug("recreating facial rig...")
validate_corrective_operation('create_corrective_rig')
rigger_gui.validate_corrective_operation('create_corrective_rig')

return True

Expand Down

0 comments on commit a510e54

Please sign in to comment.