-
-
Save Pakmanv/acd52641ec086be0555775aacabf58c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import maya.cmds as cmds | |
| def create_ui(): | |
| # Check if window exists and delete it | |
| if cmds.window("jointSizeUI", exists=True): | |
| cmds.deleteUI("jointSizeUI") | |
| # Create window | |
| window = cmds.window("jointSizeUI", title="Joint Size Changer VV", widthHeight=(300, 150)) | |
| # Create layout | |
| cmds.columnLayout(adjustableColumn=True) | |
| # Add description text | |
| cmds.text(label="Set all joint sizes in scene to:", height=30) | |
| # Add size field | |
| cmds.floatFieldGrp("sizeField", label="Joint Size", value1=0.01, precision=3) | |
| # Add buttons | |
| cmds.button(label="Apply", command=change_joint_size, height=40) | |
| cmds.button(label="Close", command='cmds.deleteUI(\"' + window + '\")', height=40) | |
| # Show window | |
| cmds.showWindow(window) | |
| def change_joint_size(*args): | |
| # Get size from field | |
| new_size = cmds.floatFieldGrp("sizeField", query=True, value1=True) | |
| # Get all joints in scene | |
| all_joints = cmds.ls(type="joint") | |
| if not all_joints: | |
| cmds.warning("No joints found in the scene!") | |
| return | |
| # Change size of each joint | |
| for joint in all_joints: | |
| cmds.setAttr(f"{joint}.radius", new_size) | |
| print(f"Changed {len(all_joints)} joints to size {new_size}") | |
| # Run the UI | |
| if __name__ == "__main__": | |
| create_ui() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment