def lock_phase3(self, hook_obj): module_container = self.module_namespace + ":module_container" if hook_obj != None: hook_obj_module_node = utils.strip_leading_namespace(hook_obj) hook_obj_module = hook_obj_module_node[0] hook_obj_joint = hook_obj_module_node[1].split( "_translation_control")[0] hook_obj = hook_obj_module + ":blueprint_" + hook_obj_joint parent_con = cmds.parentConstraint( hook_obj, self.module_namespace + ":HOOK_IN", maintainOffset=True, name=self.module_namespace + ":hook_parent_constraint")[0] scale_con = cmds.scaleConstraint( hook_obj, self.module_namespace + ":HOOK_IN", maintainOffset=True, name=self.module_namespace + ":hook_scale_constraint")[0] module_container = self.module_namespace + ":module_container" utils.add_node_to_container(module_container, [parent_con, scale_con]) cmds.lockNode(module_container, lock=True, lockUnpublished=True)
def rehook(self, new_hook_obj): old_hook_obj = self.find_hook_obj() self.hook_obj =self.module_namespace+":unhookedTarget" if new_hook_obj != None: if new_hook_obj.find("_translation_control") != -1: split_string = new_hook_obj.split("_translation_control") if split_string[1] == "": if utils.strip_leading_namespace(new_hook_obj)[0] != self.module_namespace: self.hook_obj = new_hook_obj if self.hook_obj == old_hook_obj: return self.unconstrain_root_from_hook() cmds.lockNode(self.container_name, lock=False, lockUnpublished=False) hook_constraint = self.module_namespace+":hook_pointConstraint" cmds.connectAttr(self.hook_obj+".parentMatrix[0]", hook_constraint+".target[0].targetParentMatrix", force=True) cmds.connectAttr(self.hook_obj+".translate", hook_constraint+".target[0].targetTranslate", force=True) cmds.connectAttr(self.hook_obj+".rotatePivot", hook_constraint+".target[0].targetRotatePivot", force=True) cmds.connectAttr(self.hook_obj+".rotatePivotTranslate", hook_constraint+".target[0].targetRotateTranslate", force=True) cmds.lockNode(self.container_name, lock=True, lockUnpublished=True)
def lock_phase3(self, hook_obj): module_container = self.module_namespace+":module_container" if hook_obj != None: hook_obj_module_node = utils.strip_leading_namespace(hook_obj) hook_obj_module = hook_obj_module_node[0] hook_obj_joint = hook_obj_module_node[1].split("_translation_control")[0] hook_obj = hook_obj_module+":blueprint_"+hook_obj_joint parent_con = cmds.parentConstraint( hook_obj, self.module_namespace+":HOOK_IN", maintainOffset=True, name=self.module_namespace+":hook_parent_constraint" )[0] scale_con = cmds.scaleConstraint( hook_obj, self.module_namespace+":HOOK_IN", maintainOffset=True, name=self.module_namespace+":hook_scale_constraint" )[0] module_container = self.module_namespace+":module_container" utils.add_node_to_container(module_container, [parent_con, scale_con]) cmds.lockNode(module_container, lock=True, lockUnpublished=True)
def create_trans_ctrl_at_joint(self,joint): pos_ctrl_file = os.environ["mlrig_tool"]+"/controlobjects/blueprint/translation_control.ma" cmds.file(pos_ctrl_file, i=True) container = cmds.rename("translation_control_container", joint+"_translation_control_container") utils.add_node_to_container(self.container_name, container) for node in cmds.container(container, q=True, nodeList=True): cmds.rename(node, joint+"_"+node, ignoreShape=True) control = joint+"_translation_control" cmds.parent(control, self.module_trans, absolute=True) joint_pos = cmds.xform(joint, q=True, worldSpace=True, translation=True) cmds.xform(control, worldSpace=True, absolute=True, translation=joint_pos) nice_name = utils.strip_leading_namespace(joint)[1] attr_name = nice_name+"_T" cmds.container(container, edit=True, publishAndBind=[control+".translate", attr_name]) cmds.container(self.container_name, edit=True, publishAndBind=[container+"."+attr_name, attr_name]) return control
def delete(self): cmds.lockNode(self.container_name, lock=False, lockUnpublished=False) valid_module_info = utils.find_all_module_names("/modules/blueprint") valid_modules = valid_module_info[0] valid_module_names = valid_module_info[1] hooked_modules = set() for joint_info in self.joint_info: joint = joint_info[0] trans_control = self.get_trans_ctrl(self.module_namespace + ":" + joint) connections = cmds.listConnections(trans_control) for connection in connections: module_instance = utils.strip_leading_namespace(connection) if module_instance != None: split_string = module_instance[0].partition("__") if module_instance[ 0] != self.module_namespace and split_string[ 0] in valid_module_names: index = valid_module_names.index(split_string[0]) hooked_modules.add( (valid_modules[index], split_string[2])) for module in hooked_modules: mod = __import__("blueprint." + module[0], {}, {}, [module[0]]) module_class = getattr(mod, mod.CLASS_NAME) module_inst = module_class(module[1], None) module_inst.rehook(None) module_trans = self.module_namespace + ":module_transform" module_trans_parent = cmds.listRelatives(module_trans, parent=True) cmds.delete(self.container_name) cmds.namespace(setNamespace=":") cmds.namespace(removeNamespace=self.module_namespace) if module_trans_parent != None: parent_group = module_trans_parent[0] children = cmds.listRelatives(parent_group, children=True) children = cmds.ls(children, transforms=True) if len(children) == 0: cmds.select(parent_group, replace=True) group_selected.UngroupSelected()
def __init__(self): selection = cmds.ls(sl=True, transforms=True) if len(selection) == 0: return first_selected = selection[0] self.modules = [] self.group = None if first_selected.find("Group__") == 0: self.group = first_selected self.modules = self.find_sub_modules(first_selected) else: module_namespace_info = utils.strip_leading_namespace( first_selected) if module_namespace_info != None: self.modules.append(module_namespace_info[0]) ##################### temp_module_list = [] for module in self.modules: if self.is_module_a_mirror(module): cmds.confirmDialog( title="Mirror Module(s)", message= "Cannot mirror a previously mirrored module, aborting mirror.", button="Accept", default="Accpet") return if not self.can_module_be_mirrored(module): print "Module \"" + module + "\" is of a module type that cannot be mirrored... skipping module." else: temp_module_list.append(module) self.modules = temp_module_list if len(self.modules) > 0: self.mirror_module_ui()
def delete(self): cmds.lockNode(self.container_name, lock=False, lockUnpublished=False) valid_module_info = utils.find_all_module_names("/modules/blueprint") valid_modules = valid_module_info[0] valid_module_names = valid_module_info[1] hooked_modules = set() for joint_info in self.joint_info: joint = joint_info[0] trans_control = self.get_trans_ctrl(self.module_namespace+":"+joint) connections = cmds.listConnections(trans_control) for connection in connections: module_instance = utils.strip_leading_namespace(connection) if module_instance != None: split_string = module_instance[0].partition("__") if module_instance[0] != self.module_namespace and split_string[0] in valid_module_names: index = valid_module_names.index(split_string[0]) hooked_modules.add( (valid_modules[index], split_string[2]) ) for module in hooked_modules: mod = __import__("blueprint."+module[0], {}, {}, [module[0]]) module_class = getattr(mod, mod.CLASS_NAME) module_inst = module_class(module[1], None) module_inst.rehook(None) module_trans = self.module_namespace+":module_transform" module_trans_parent = cmds.listRelatives(module_trans, parent=True) cmds.delete(self.container_name) cmds.namespace(setNamespace=":") cmds.namespace(removeNamespace=self.module_namespace) if module_trans_parent != None: parent_group = module_trans_parent[0] children = cmds.listRelatives(parent_group, children=True) children = cmds.ls(children, transforms=True) if len(children) == 0: cmds.select(parent_group, replace=True) group_selected.UngroupSelected()
def __init__(self): selection = cmds.ls(sl=True, transforms=True) if len(selection) == 0: return first_selected = selection[0] self.modules = [] self.group = None if first_selected.find("Group__") == 0: self.group = first_selected self.modules = self.find_sub_modules(first_selected) else: module_namespace_info = utils.strip_leading_namespace(first_selected) if module_namespace_info != None: self.modules.append(module_namespace_info[0]) ##################### temp_module_list = [] for module in self.modules: if self.is_module_a_mirror(module): cmds.confirmDialog(title="Mirror Module(s)", message="Cannot mirror a previously mirrored module, aborting mirror.", button="Accept", default="Accpet") return if not self.can_module_be_mirrored(module): print "Module \""+module+"\" is of a module type that cannot be mirrored... skipping module." else: temp_module_list.append(module) self.modules = temp_module_list if len(self.modules) > 0: self.mirror_module_ui()
def rehook(self, new_hook_obj): old_hook_obj = self.find_hook_obj() self.hook_obj = self.module_namespace + ":unhookedTarget" if new_hook_obj != None: if new_hook_obj.find("_translation_control") != -1: split_string = new_hook_obj.split("_translation_control") if split_string[1] == "": if utils.strip_leading_namespace( new_hook_obj)[0] != self.module_namespace: self.hook_obj = new_hook_obj if self.hook_obj == old_hook_obj: return self.unconstrain_root_from_hook() cmds.lockNode(self.container_name, lock=False, lockUnpublished=False) hook_constraint = self.module_namespace + ":hook_pointConstraint" cmds.connectAttr(self.hook_obj + ".parentMatrix[0]", hook_constraint + ".target[0].targetParentMatrix", force=True) cmds.connectAttr(self.hook_obj + ".translate", hook_constraint + ".target[0].targetTranslate", force=True) cmds.connectAttr(self.hook_obj + ".rotatePivot", hook_constraint + ".target[0].targetRotatePivot", force=True) cmds.connectAttr(self.hook_obj + ".rotatePivotTranslate", hook_constraint + ".target[0].targetRotateTranslate", force=True) cmds.lockNode(self.container_name, lock=True, lockUnpublished=True)
def find_child_modules(self, group): modules = [] children = cmds.listRelatives(group, children=True) if children != None: for child in children: module_namespace_info = utils.strip_leading_namespace(child) if module_namespace_info != None: modules.append(module_namespace_info[0]) elif child.find("Group__") != -1: modules.extend(self.find_child_modules(child)) return modules
def find_child_modules(self, group): modules = [] children = cmds.listRelatives(group, children=True) if children != None: for child in children: module_namespace_info = utils.strip_leading_namespace(child) if module_namespace_info != None: modules.append(module_namespace_info[0]) elif child.find("Group__") != -1: modules.extend(self.find_child_modules(child)) return modules
def create_trans_ctrl_at_joint(self, joint): pos_ctrl_file = os.environ[ "mlrig_tool"] + "/controlobjects/blueprint/translation_control.ma" cmds.file(pos_ctrl_file, i=True) container = cmds.rename("translation_control_container", joint + "_translation_control_container") utils.add_node_to_container(self.container_name, container) for node in cmds.container(container, q=True, nodeList=True): cmds.rename(node, joint + "_" + node, ignoreShape=True) control = joint + "_translation_control" cmds.parent(control, self.module_trans, absolute=True) joint_pos = cmds.xform(joint, q=True, worldSpace=True, translation=True) cmds.xform(control, worldSpace=True, absolute=True, translation=joint_pos) nice_name = utils.strip_leading_namespace(joint)[1] attr_name = nice_name + "_T" cmds.container(container, edit=True, publishAndBind=[control + ".translate", attr_name]) cmds.container(self.container_name, edit=True, publishAndBind=[container + "." + attr_name, attr_name]) return control
def create_group(self, group_name): full_group_name = "Group__"+group_name if cmds.objExists(full_group_name): cmds.confirmDialog( title="Name Conflict", message="Group \""+group_name+"\" already exists", button="Accept", defaultButton="Accept" ) return None group_transform = cmds.rename(self.temp_group_transform, full_group_name) group_container = "Group_container" if not cmds.objExists(group_container): cmds.container(name=group_container) containers = [group_container] for obj in self.objects_to_group: if obj.find("Group__") == 0: continue obj_namespace = utils.strip_leading_namespace(obj)[0] containers.append(obj_namespace+":module_container") for c in containers: cmds.lockNode(c, lock=False, lockUnpublished=False) if len(self.objects_to_group) != 0: temp_group = cmds.group(self.objects_to_group, absolute=True) group_parent = cmds.listRelatives(temp_group, parent=True) if group_parent != None: cmds.parent(group_transform, group_parent[0], absolute=True) cmds.parent(self.objects_to_group, group_transform, absolute=True) cmds.delete(temp_group) self.add_group_to_container(group_transform) for c in containers: cmds.lockNode(c, lock=True, lockUnpublished=True) cmds.setToolTo("moveSuperContext") cmds.select(group_transform, replace=True) return group_transform
def mirror_modules(self): mirror_modules_progress_ui = cmds.progressWindow(title="Mirroring Module(s)", status="This may take a few minutes...", isInteruptable=False) mirror_modules_progress = 0 mirror_modules_progress_stage1_proportion = 15 mirror_modules_progress_stage2_proportion = 70 mirror_modules_progress_stage3_proportion = 10 module_name_info = utils.find_all_module_names("/modules/blueprint") valid_modules = module_name_info[0] valid_module_names = module_name_info[1] for module in self.module_info: module_name = module[0].partition("__")[0] if module_name in valid_module_names: index = valid_module_names.index(module_name) module.append(valid_modules[index]) mirror_modules_progress_progress_increment = mirror_modules_progress_stage1_proportion/len(self.module_info) for module in self.module_info: user_specified_name = module[0].partition("__")[2] mod = __import__("blueprint."+module[5], {}, {}, [module[5]]) reload(mod) module_class = getattr(mod, mod.CLASS_NAME) module_inst = module_class(user_specified_name, None) hook_object = module_inst.find_hook_obj() new_hook_object = None hook_module = utils.strip_leading_namespace(hook_object)[0] hook_found = False for m in self.module_info: if hook_module == m[0]: hook_found = True if m == module: continue hook_object_name = utils.strip_leading_namespace(hook_object)[1] new_hook_object = m[1]+":"+hook_object_name if not hook_found: new_hook_object = hook_object module.append(new_hook_object) hook_constrained = module_inst.is_root_constrained() module.append(hook_constrained) mirror_modules_progress += mirror_modules_progress_progress_increment cmds.progressWindow(mirror_modules_progress_ui, edit=True, progress=mirror_modules_progress) mirror_modules_progress_progress_increment = mirror_modules_progress_stage2_proportion/len(self.module_info) for module in self.module_info: new_user_specified_name = module[1].partition("__")[2] mod = __import__("blueprint."+module[5], {}, {}, [module[5]]) reload(mod) module_class = getattr(mod, mod.CLASS_NAME) module_inst = module_class(new_user_specified_name, None) module_inst.mirror(module[0], module[2], module[3], module[4]) mirror_modules_progress += mirror_modules_progress_progress_increment cmds.progressWindow(mirror_modules_progress_ui, edit=True, progress=mirror_modules_progress) mirror_modules_progress_progress_increment = mirror_modules_progress_stage3_proportion/len(self.module_info) for module in self.module_info: new_user_specified_name = module[1].partition("__")[2] mod = __import__("blueprint."+module[5], {}, {}, [module[5]]) reload(mod) module_class = getattr(mod, mod.CLASS_NAME) module_inst = module_class(new_user_specified_name, None) module_inst.rehook(module[6]) hook_constrained = module[7] if hook_constrained: module_inst.constrain_root_to_hook() mirror_modules_progress += mirror_modules_progress_progress_increment cmds.progressWindow(mirror_modules_progress_ui, edit=True, pr=mirror_modules_progress) if self.group != None: cmds.lockNode("Group_container", lock=False, lockUnpublished=False) group_parent = cmds.listRelatives(self.group, parent=True) if group_parent != None: group_parent = group_parent[0] self.process_group(self.group, group_parent) cmds.lockNode("Group_container", lock=True, lockUnpublished=True) cmds.select(clear=True) cmds.progressWindow(mirror_modules_progress_ui, edit=True, endProgress=True) utils.force_scene_update()
def create_group(self, group_name): full_group_name = "Group__" + group_name if cmds.objExists(full_group_name): cmds.confirmDialog(title="Name Conflict", message="Group \"" + group_name + "\" already exists", button="Accept", defaultButton="Accept") return None group_transform = cmds.rename(self.temp_group_transform, full_group_name) group_container = "Group_container" if not cmds.objExists(group_container): cmds.container(name=group_container) containers = [group_container] for obj in self.objects_to_group: if obj.find("Group__") == 0: continue obj_namespace = utils.strip_leading_namespace(obj)[0] containers.append(obj_namespace + ":module_container") for c in containers: cmds.lockNode(c, lock=False, lockUnpublished=False) if len(self.objects_to_group) != 0: temp_group = cmds.group(self.objects_to_group, absolute=True) group_parent = cmds.listRelatives(temp_group, parent=True) if group_parent != None: cmds.parent(group_transform, group_parent[0], absolute=True) cmds.parent(self.objects_to_group, group_transform, absolute=True) cmds.delete(temp_group) self.add_group_to_container(group_transform) for c in containers: cmds.lockNode(c, lock=True, lockUnpublished=True) cmds.setToolTo("moveSuperContext") cmds.select(group_transform, replace=True) return group_transform
def mirror_modules(self): mirror_modules_progress_ui = cmds.progressWindow( title="Mirroring Module(s)", status="This may take a few minutes...", isInteruptable=False) mirror_modules_progress = 0 mirror_modules_progress_stage1_proportion = 15 mirror_modules_progress_stage2_proportion = 70 mirror_modules_progress_stage3_proportion = 10 module_name_info = utils.find_all_module_names("/modules/blueprint") valid_modules = module_name_info[0] valid_module_names = module_name_info[1] for module in self.module_info: module_name = module[0].partition("__")[0] if module_name in valid_module_names: index = valid_module_names.index(module_name) module.append(valid_modules[index]) mirror_modules_progress_progress_increment = mirror_modules_progress_stage1_proportion / len( self.module_info) for module in self.module_info: user_specified_name = module[0].partition("__")[2] mod = __import__("blueprint." + module[5], {}, {}, [module[5]]) reload(mod) module_class = getattr(mod, mod.CLASS_NAME) module_inst = module_class(user_specified_name, None) hook_object = module_inst.find_hook_obj() new_hook_object = None hook_module = utils.strip_leading_namespace(hook_object)[0] hook_found = False for m in self.module_info: if hook_module == m[0]: hook_found = True if m == module: continue hook_object_name = utils.strip_leading_namespace( hook_object)[1] new_hook_object = m[1] + ":" + hook_object_name if not hook_found: new_hook_object = hook_object module.append(new_hook_object) hook_constrained = module_inst.is_root_constrained() module.append(hook_constrained) mirror_modules_progress += mirror_modules_progress_progress_increment cmds.progressWindow(mirror_modules_progress_ui, edit=True, progress=mirror_modules_progress) mirror_modules_progress_progress_increment = mirror_modules_progress_stage2_proportion / len( self.module_info) for module in self.module_info: new_user_specified_name = module[1].partition("__")[2] mod = __import__("blueprint." + module[5], {}, {}, [module[5]]) reload(mod) module_class = getattr(mod, mod.CLASS_NAME) module_inst = module_class(new_user_specified_name, None) module_inst.mirror(module[0], module[2], module[3], module[4]) mirror_modules_progress += mirror_modules_progress_progress_increment cmds.progressWindow(mirror_modules_progress_ui, edit=True, progress=mirror_modules_progress) mirror_modules_progress_progress_increment = mirror_modules_progress_stage3_proportion / len( self.module_info) for module in self.module_info: new_user_specified_name = module[1].partition("__")[2] mod = __import__("blueprint." + module[5], {}, {}, [module[5]]) reload(mod) module_class = getattr(mod, mod.CLASS_NAME) module_inst = module_class(new_user_specified_name, None) module_inst.rehook(module[6]) hook_constrained = module[7] if hook_constrained: module_inst.constrain_root_to_hook() mirror_modules_progress += mirror_modules_progress_progress_increment cmds.progressWindow(mirror_modules_progress_ui, edit=True, pr=mirror_modules_progress) if self.group != None: cmds.lockNode("Group_container", lock=False, lockUnpublished=False) group_parent = cmds.listRelatives(self.group, parent=True) if group_parent != None: group_parent = group_parent[0] self.process_group(self.group, group_parent) cmds.lockNode("Group_container", lock=True, lockUnpublished=True) cmds.select(clear=True) cmds.progressWindow(mirror_modules_progress_ui, edit=True, endProgress=True) utils.force_scene_update()
def modify_selected(self, *args): selected_nodes = cmds.ls(selection=True) if len(selected_nodes) <= 1: self.module_instance = None selected_module_namespace = None current_module_file = None cmds.button(self.ui_elements["ungroup_btn"], edit=True, enable=False) cmds.button(self.ui_elements["mirror_module_btn"], edit=True, enable=False) if len(selected_nodes) == 1: last_selected = selected_nodes[0] if last_selected.find("Group__") == 0: cmds.button(self.ui_elements["ungroup_btn"], edit=True, enable=True) cmds.button(self.ui_elements["mirror_module_btn"], edit=True, enable=True, label="Mirror Group") namespace_and_node = utils.strip_leading_namespace(last_selected) if namespace_and_node != None: namespace = namespace_and_node[0] module_name_info = utils.find_all_module_names("/modules/blueprint") valid_modules = module_name_info[0] valid_module_names = module_name_info[1] index = 0 for module_name in valid_module_names: module_name_inc_suffix = module_name+"__" if namespace.find(module_name_inc_suffix) == 0: current_module_file = valid_modules[index] selected_module_namespace = namespace break index += 1 control_enabled = False user_specified_name = "" constrain_command = self.constrain_root_to_hook constrain_label = "Constrain Root > Hook" if selected_module_namespace != None: control_enabled = True user_specified_name = selected_module_namespace.partition("__")[2] mod = __import__("blueprint."+current_module_file, {}, {}, [current_module_file]) reload(mod) module_class = getattr(mod, mod.CLASS_NAME) self.module_instance = module_class(user_specified_name, None) cmds.button(self.ui_elements["mirror_module_btn"], edit=True, enable=True, label="Mirror Module") if self.module_instance.is_root_constrained(): constrain_command = self.unconstrain_root_from_hook constrain_label = "Unconstrain Root" cmds.button(self.ui_elements["rehook_btn"], edit=True, enable=control_enabled) cmds.button(self.ui_elements["snap_root_btn"], edit=True, enable=control_enabled) cmds.button( self.ui_elements["constraint_root_btn"], edit=True, enable=control_enabled, label=constrain_label, c=constrain_command ) cmds.button(self.ui_elements["delete_module_btn"], edit=True, enable=control_enabled) cmds.textField(self.ui_elements["module"], edit=True, enable=control_enabled, text=user_specified_name) self.create_module_specific_controls() self.create_script_job()
def modify_selected(self, *args): selected_nodes = cmds.ls(selection=True) if len(selected_nodes) <= 1: self.module_instance = None selected_module_namespace = None current_module_file = None cmds.button(self.ui_elements["ungroup_btn"], edit=True, enable=False) cmds.button(self.ui_elements["mirror_module_btn"], edit=True, enable=False) if len(selected_nodes) == 1: last_selected = selected_nodes[0] if last_selected.find("Group__") == 0: cmds.button(self.ui_elements["ungroup_btn"], edit=True, enable=True) cmds.button(self.ui_elements["mirror_module_btn"], edit=True, enable=True, label="Mirror Group") namespace_and_node = utils.strip_leading_namespace( last_selected) if namespace_and_node != None: namespace = namespace_and_node[0] module_name_info = utils.find_all_module_names( "/modules/blueprint") valid_modules = module_name_info[0] valid_module_names = module_name_info[1] index = 0 for module_name in valid_module_names: module_name_inc_suffix = module_name + "__" if namespace.find(module_name_inc_suffix) == 0: current_module_file = valid_modules[index] selected_module_namespace = namespace break index += 1 control_enabled = False user_specified_name = "" constrain_command = self.constrain_root_to_hook constrain_label = "Constrain Root > Hook" if selected_module_namespace != None: control_enabled = True user_specified_name = selected_module_namespace.partition( "__")[2] mod = __import__("blueprint." + current_module_file, {}, {}, [current_module_file]) reload(mod) module_class = getattr(mod, mod.CLASS_NAME) self.module_instance = module_class(user_specified_name, None) cmds.button(self.ui_elements["mirror_module_btn"], edit=True, enable=True, label="Mirror Module") if self.module_instance.is_root_constrained(): constrain_command = self.unconstrain_root_from_hook constrain_label = "Unconstrain Root" cmds.button(self.ui_elements["rehook_btn"], edit=True, enable=control_enabled) cmds.button(self.ui_elements["snap_root_btn"], edit=True, enable=control_enabled) cmds.button(self.ui_elements["constraint_root_btn"], edit=True, enable=control_enabled, label=constrain_label, c=constrain_command) cmds.button(self.ui_elements["delete_module_btn"], edit=True, enable=control_enabled) cmds.textField(self.ui_elements["module"], edit=True, enable=control_enabled, text=user_specified_name) self.create_module_specific_controls() self.create_script_job()