Skip to content

Commit

Permalink
Shifter: Adding hostRelative feature in components. In some situation…
Browse files Browse the repository at this point in the history
… we need to decouple the relative and the host UI. Now, we can do it by setting the self.hostRelatives = {}
  • Loading branch information
miquelcampos committed Jul 18, 2024
1 parent 547bc51 commit d53f586
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion release/scripts/mgear/shifter/component/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def __init__(self, rig, guide):
self.controlRelatives = {}
self.aliasRelatives = {} # alias names for pretty names on combo box

# in some situation we need to decouple the relative and the host UI
self.hostRelatives = {}

# --------------------------------------------------
# Joint positions init
# jnt_pos is a list of lists [Joint position object + name + optional
Expand Down Expand Up @@ -1178,7 +1181,19 @@ def add_match_ref(self, ctl, parent, name, cnx=True):

def getHost(self):
"""Get the host for the properties"""
self.uihost = self.rig.findRelative(self.settings["ui_host"])
comp_relative = self.rig.findComponent(self.settings["ui_host"])
if comp_relative and comp_relative.hostRelatives:
hostRelatives = comp_relative.hostRelatives
relative_name = self.rig.getRelativeName(self.settings["ui_host"])
if relative_name in hostRelatives.keys():
self.uihost = hostRelatives[relative_name]
else:
pm.displayWarning(
"Host relative name {} not found".format(relative_name)
)
self.uihost = self.rig.findRelative(self.settings["ui_host"])
else:
self.uihost = self.rig.findRelative(self.settings["ui_host"])

def set_ui_host_components_controls(self):
"""Set a list of all controls that are common to the ui host
Expand Down

0 comments on commit d53f586

Please sign in to comment.