Home > other >  Help do a Maya ikfk seamless switching the UI
Help do a Maya ikfk seamless switching the UI

Time:09-28

Below is the requirement and prompted for written in python
# Ik fk1 - Fk matcher

# import Maya commands
The import Maya. CMDS as CMDS


# First Function will be matching fk1 - Fk Controls to Ik
Def fk_to_ik () :
# 0. Check selection through the if selectoin: CMDS. Ls () and the if statement


# 1. Get the rotation value of the shoulder ik be. Store in a variable () : CMDS. GetAttr


# 2. Set the rotation of the shoulder fk1 - Fk control to the same value as the ik to be: CMDS. SetAttr

# 4. Set the switch control to fk1 - FK, CMDS. SetAttr

# Second Function will be matching Ik Controls to fk1 - Fk
Def ik_to_fk () :
# get selection

# 1. Match the transform of the here IK control to the fk1 - fk here locator CMDS. MatchTransform

# 2. Match the transform of the wrist IK control to the fk1 - fk wrist to be: CMDS. MatchTransform

# 3. Set the switch control to IK: CMDS. SetAttr

# The UI generator function

Def ik_fk_matcher () :
# 1. Check if the UI already exists if so delete and make a new one. The use of the window and deleteUI commands

# 2. Create a window, the difference of ita title, define it with a name and a variable

# 3. Create a layout: CMDS columnLayout

# 4. The Text that tells the user what the buttons do and what they need to do: CMDS. Text

# 5. Rowcolumnlayout and buttons for iktofk, fktoik, and cancel: CMDS. Rowcolumnlayout
# CMDS. Button (the command='fk_to_ik ()')
# CMDS. Button (the command='ik_to_fk ()')

# 6 Show window: CMDS showWindow


Ik_fk_matcher ()

CodePudding user response:

Can make to can add cent

CodePudding user response:

The script prerequisites:

- the mayans in the scene must have the following joint: collarbone, shoulder, elbow, wrist, wrist end

Fk1 - Fk ik control, control and switch control, target and elbow locator



Run time, your script will:

A) to delete "fk1 - Fk/Ik" window, if it already exists

B) to create and display a window that has a label and two buttons: "Ik to fk1 - Fk" and "fk1 - Fk to Ik"

C) if any button is pressed, and a switch control is not selected, the script will display a warning, and do not do any other things

D) otherwise, Ik to fk1 - Fk Ik controls and fk1 - Fk "controls the location of the match, and admiral switching control mode to fk1 - Fk

E) and "fk1 - Fk to Ik" will match the Ik controls the position of fk1 - Fk control, and admiral in the switch control mode to Ik



How to use:

Command:

Window, showWindow getAttr, setAttr, matchTransform listConnections
  • Related