def add_from_selected(self, field_layout):
# Get parentConstraints from the selected nodes
sel = cmds.ls(sl=True) or []
constraints = [x for x in sel if cmds.nodeType(x) == 'parentConstraint']
transforms = [x for x in sel if cmds.nodeType(x) in ['transform', 'joint']]
for transform in transforms:
constraints += (cmds.listConnections(transform, type='parentConstraint') or [])
constraints = list(set(constraints))
for constraint in constraints:
# Update the UI with the added constraint
data = constraint_data(constraint)
self.constraints.add_element(data=data, field_layout=field_layout)
评论列表
文章目录