Skip to content

Commit

Permalink
Channel master: use node namespace option setting is stored by node, …
Browse files Browse the repository at this point in the history
…not as a general configuration of the tool #74
  • Loading branch information
miquelcampos committed Jan 25, 2022
1 parent fade2ea commit a4bc4ac
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions release/scripts/mgear/animbits/channel_master.py
Expand Up @@ -501,13 +501,24 @@ def get_data_from_current_node(self):
node = self.get_current_node()
if not node:
return
self.set_namespace(node)
# local data usage
# first check if node has force_local_data attr if not create it
if not cmds.attributeQuery("force_local_data", node=node, exists=True):
cmds.addAttr(node, ln="force_local_data", at="bool", dv=False)
# refresh configuration status in actions
force_local_data = cmds.getAttr("{}.force_local_data".format(node))
self.use_only_local_data_action.setChecked(force_local_data)

# node namespace usage
# first check if node has use_node_namespace attr if not create it
if not cmds.attributeQuery("use_node_namespace", node=node, exists=True):
cmds.addAttr(node, ln="use_node_namespace", at="bool", dv=False)
# refresh configuration status in actions
use_node_namespace = cmds.getAttr("{}.use_node_namespace".format(node))
self.use_node_namespace_action.setChecked(use_node_namespace)

self.set_namespace(node)

return cmn.get_node_data(node)

def import_node_data(self):
Expand Down Expand Up @@ -543,7 +554,6 @@ def update_channel_master_from_node(self):
"""Update the channel master content from the node configuration
"""
print("updating node")
data = self.get_data_from_current_node()
if not data:
return
Expand Down Expand Up @@ -603,7 +613,6 @@ def set_namespace(self, current_node):

# actions
def use_only_local_data(self):
print("Use only local data")
node = self.get_current_node()
if not node:
return
Expand All @@ -612,6 +621,11 @@ def use_only_local_data(self):
self.update_channel_master_from_node()

def use_node_namespace(self):
node = self.get_current_node()
if not node:
return
use_node_ns = self.use_node_namespace_action.isChecked()
cmds.setAttr("{}.use_node_namespace".format(node), use_node_ns)
self.update_channel_master_from_node()

def action_scrubbing_update(self):
Expand Down

0 comments on commit a4bc4ac

Please sign in to comment.