Skip to content

Commit

Permalink
Animbits: Spring Manager misc updates. fix issue with lock attr in re…
Browse files Browse the repository at this point in the history
…ferenced rigs mgear-dev#349
  • Loading branch information
miquelcampos authored and ireneweng committed Nov 27, 2023
1 parent c74cf3c commit d9dc17b
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions release/scripts/mgear/animbits/spring_manager/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"springRotationalDamping",
"springRotationalStiffness",
"springSetupMembers",
"springConfig",
"springTranslation",
"springRotation",
]

SPRING_PRESET_EXTENSION = ".spg"
Expand All @@ -40,14 +43,14 @@ def create_settings_attr(node, config):
# Check if attr already exists at node
if pm.attributeQuery("springTotalIntensity", node=node, exists=True):
return False
lock = True
keyable = True
channelBox = True
keyable = False
# separator Attr
attr_name = "springConfig"
attribute.addEnumAttribute(
node, attr_name, 0, ["Spring Config"], niceName="__________"
)
node.setAttr(attr_name, lock=lock, keyable=keyable)
node.setAttr(attr_name, channelBox=channelBox, keyable=keyable)

# Keyable attr

Expand All @@ -72,7 +75,7 @@ def create_settings_attr(node, config):
attribute.addEnumAttribute(
node, attr_name, 0, ["Spring Translation"], niceName="__________"
)
node.setAttr(attr_name, lock=lock, keyable=keyable)
node.setAttr(attr_name, channelBox=channelBox, keyable=keyable)

# Keyable attr
attribute.addAttribute(
Expand Down Expand Up @@ -104,7 +107,7 @@ def create_settings_attr(node, config):
attribute.addEnumAttribute(
node, attr_name, 0, ["Spring Rotation"], niceName="__________"
)
node.setAttr(attr_name, lock=lock, keyable=keyable)
node.setAttr(attr_name, channelBox=channelBox, keyable=keyable)

# Keyable attr
attribute.addAttribute(
Expand Down Expand Up @@ -180,7 +183,7 @@ def get_settings_attr_val(node):
attr_vals = {}

# Loop through each attribute and attempt to get its value
for attr in SPRING_ATTRS[:-1]:
for attr in SPRING_ATTRS[:-4]:
if pm.attributeQuery(attr, node=node, exists=True):
attr_vals[attr] = node.attr(attr).get()
else:
Expand All @@ -206,7 +209,7 @@ def set_settings_attr_val(node, attr_vals):
node = pm.PyNode(node)

# Loop through each attribute and attempt to set its value
for attr in SPRING_ATTRS[:-1]:
for attr in SPRING_ATTRS[:-4]:
if pm.attributeQuery(attr, node=node, exists=True):
node.attr(attr).set(attr_vals[attr])
else:
Expand Down Expand Up @@ -739,12 +742,12 @@ def get_spring_targets():

@one_undo
def delete_all_springs():
delete_spring_setup(get_spring_targets)
delete_spring_setup(get_spring_targets())


@one_undo
def select_all_springs_targets():
pm.select(get_spring_targets)
pm.select(get_spring_targets())


def move_animation_curves(source_node, target_node):
Expand Down

0 comments on commit d9dc17b

Please sign in to comment.