以下是要求和提示需要用python來寫
# Ik Fk matcher
# import maya commands
import maya.cmds as cmds
#First Function will be matching Fk Controls to Ik
def fk_to_ik():
#0. Check selection through if selectoin: cmds.ls() and if statement
#1. get the rotation value of the shoulder ik joint. Store in a variable(): cmds.getAttr
#2. set the rotation of the shoulder Fk control to the same value as the ik joint: cmds.setAttr
#4. Set the switch control to FK: cmds.setAttr
#Second Function will be matching Ik Controls to Fk
def ik_to_fk():
# get selection
#1. match transform of the elbow IK control to the fk elbow locator cmds.matchTransform
#2. match transform of the wrist IK control to the fk wrist joint: cmds.matchTransform
#3. Set the switch control to IK: cmds.setAttr
#The UI generator function
def ik_fk_matcher():
#1. Check if UI already exists if so delete and make a new one. use the window and deleteUI commands
#2. Create a window, give ita title, define it with a name and a variable
#3. Create a layout: cmds.columnLayout
#4. 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(command='fk_to_ik()')
# cmds.button(command='ik_to_fk()')
#6 Show window: cmds.showWindow
ik_fk_matcher()
uj5u.com熱心網友回復:
能做出來可加分uj5u.com熱心網友回復:
腳本的先決條件:-場景中瑪雅人必須有以下關節:鎖骨、肩、肘、腕、腕端
ik控制,Fk控制和開關控制,和肘部目標定位器
運行時,您的腳本將:
a)洗掉“Ik/Fk”視窗,如果它已經存在
b)創建并顯示一個帶有標簽和兩個按鈕的視窗:“Ik to Fk”和“Fk to Ik”
c)如果任何一個按鈕被按下,而一個開關控制元件沒有被選中,腳本將顯示一個警告,而不做其他任何事情
d)否則,“Ik to Fk”將Ik控制元件與Fk控制元件的位置相匹配,并在切換ctrl上將模式設定為Fk
e)和“Fk to Ik”將Fk控制元件與Ik控制元件的位置相匹配,并在開關ctrl上將模式設定為Ik
如何使用:
命令:
視窗,showWindow, getAttr, setAttr, matchTransform, listConnections
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/90911.html
上一篇:求告知如何撰寫人工智能聊天寫作
