After a rather harrowing weekend I decided that I'd follow through on my promise of a Maya/Mel/QT tutorial, so here it is! So without further ado, here we go:
So today we're going to go through how to make a basic qt interface. What we're going to be creating is an interface that will do 4 things:
Get user input to name an object
List all the user objects
Use a combo box to create an object
Rename an object from the list box
The basic premise of this interface will be to make a UI for a user to make an object, with a specific name. It will also list all geometric objects in the scene so we can select and rename the objects.
What we need:
Well to continue with the tutorial to test it out, you'll need a working version of Maya 2011. You can download a trial version from Autodesk's website if you don't already have one. You'll also need the QT toolkit which you'll need to download from Nokia's website. Download the LGPL version, unless you really want to distribute your apps in some other way. (I personally love Open Source software, so that's why I distribute them under a license that is Open Source friendly.) You're also going to need a text editor of some sort. If you're using Windows, I would suggest Notepad++ with the Mel language definition file from CreativeCrash.com.
If you're using a Mac I would suggest either Text Wrangler, Carbon Emacs or if you're familiar with it, Vim. If you choose the latter of the three, I will assume that you are familiar with Vi or are willing to go through the learning process for it. While it has a learning curve, it is EXTREMELY powerful. Emacs is just as powerful as Vi, and I do NOT wish to start that war on here.
2010年11月14日
Maya, Mel, QT and You - Interfacing with the QT Designer
2010年11月3日
Creating Custom Locator with Maya's Python API (English Translation)
2010年10月30日
Live from Apple's 'Back to the Mac' event
- Sorting:
- Newest First | Oldest First
- Auto-refresh:
- Off | On
2010年10月21日
測定腳本運行時間的python腳本
import time
import maya.cmds as cmd
start = time.clock()
for n in range(100,1000,1):
cmd.ls()
print 'time taken %0.4f' % (time.clock()-start)
2010年10月10日
2010年10月2日
特種部隊~幕後技術大公開!!
http://twdesign.net/design/viewtopic.php?f=34&t=36146
大家還記得嗎~!??? 今夏巨作《特種部隊:眼鏡蛇的崛起》以震撼的視覺特效,令全世界影迷趨之若鶩。
原來該影片中近1,500個視覺特效鏡頭,是由全世界數百名美術師,透過全球2D、3D數位設計軟體領導廠商歐特克公司 (Autodesk, Inc.)所提供的各式軟體工具所製作而成,其中包括,Autodesk Flame、Autodesk Maya、Autodesk 3ds Max、Autodesk Softimage、Autodesk MotionBuilder、Autodesk Mudbox和Autodesk FBX。
好萊塢數字領域(Digital Domain)工作室——175名工作人員花費一年多的時間,為影片中的兩個重要橋段製作了320個視覺特效(VFX)鏡頭,包括一場發生在巴黎的追逐橋段,以艾菲爾鐵塔的摧毀告終;另一個橋段,則是一場大規模的艦隊襲擊場景。Digital Domain以Autodesk Maya作為動畫、建模、燈光、人物腳本和角色骨架(Rigging)的核心工具,並使用Autodesk Mudbox繪製建模草圖。動畫監製Bernd Angerer表示道:「我們為艾菲爾鐵塔建造了一個包含數百萬個多邊形(polygon)的超大模型,並運用Autodesk Maya控制大量的資料以順利完成此一工作。Autodesk Maya在眾多方面展示其強大的功能,但最為突出的一點,在於其開放性的特點可以嵌入整個製作流程。」
2010年9月27日
2010年9月26日
2010年9月22日
Matte Painting Studio - Interview_Vulkan
“The Volcano“ describes the scenario of a volcanic eruption in the Eifel and the damages for the people in the disaster area: A drama of a logistical and social emergency situation in the middle of Germany.
Both parts of the film have been a crowd-pleaser for over 10 million spectators.
2010年9月20日
用MEL打造系統時鐘
地址為:
http://www.aboutcg.net/showthread.php?t=2203
零、 前言
這是一篇MEL簡單應用的教學文章,並非什麼高深的理論。對於現在互聯網的各種言論現象,有幾點不得不說的。如果能給各位讀者起到拋磚引玉的作用,筆者這裡會比較欣慰。能幫助學習maya及學習MEL的朋友提高技術是作者寫本篇教學的初衷。當然,如果您不喜歡,認為這個太easy了,也請幫忙進行改進批評。如果只是看著不爽,也免開尊口罵人,這樣不好。本篇文章用一個極簡單的模型:“時鐘”來闡釋MEL對動畫、特效方面的一些應用,不需要很高深的MEL功底,當然更不需要高深的模型能力。如果沒有什麼問題我們就開始吧。
2010年9月19日
粒子顏色分佈控制技巧
在這裡我用的是一個Goal場景,簡單群集。相信大家也都會,這裡就不作贅述。
发几个常用窗口代码,需要的可以取用3
global proc nrCreateYaoTestWindow()
{
string $nrWindowName = "YaoTestWindow";
if(`window -exists $nrWindowName`)
deleteUI $nrWindowName;
if(`windowPref -exists $nrWindowName`)
windowPref -remove $nrWindowName;
$nrWindowName = `window -t "YaoTestWindow"
-s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0 -tlb 0 -rtf 1
-mnc ""
-rc ""
$nrWindowName`;
string $newObject1 = `formLayout -en 1 -w 262 -h 354 -nd 100 formLayout91`;
string $newObject2 = `optionMenu -en 1 -w 107 -h 24 -l "火星时代" optionMenu12`;
menuItem -l "教学";
menuItem -l "网站";
menuItem -l "图书";
optionMenu -e -sl 2 $newObject2;
formLayout -e -attachPosition $newObject2 "top" 12 0 -attachPosition $newObject2 "left" 13 0 $newObject1;
setParent ..;
showWindow $nrWindowName;
}
nrCreateYaoTestWindow;
global proc nrCreateYaoTestWindow()
{
string $nrWindowName = "YaoTestWindow";
if(`window -exists $nrWindowName`)
deleteUI $nrWindowName;
if(`windowPref -exists $nrWindowName`)
windowPref -remove $nrWindowName;
$nrWindowName = `window -t "YaoTestWindow"
-s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0 -tlb 0 -rtf 1
-mnc ""
-rc ""
$nrWindowName`;
string $newObject1 = `formLayout -en 1 -w 262 -h 354 -nd 100 formLayout91`;
string $newObject2 = `floatSliderGrp -en 1 -w 240 -h 22 -f 1 -min 0 -max 100 -fmn 0 -fmx 100 -s 1 -fs 0.1 -ss 1 -v 0 -dc "" floatSliderGrp1`;
formLayout -e -attachPosition $newObject2 "top" 16 0 -attachPosition $newObject2 "left" 18 0 $newObject1;
setParent ..;
showWindow $nrWindowName;
}
nrCreateYaoTestWindow;
global proc nrCreateYaoTestWindow()
{
string $nrWindowName = "YaoTestWindow";
if(`window -exists $nrWindowName`)
deleteUI $nrWindowName;
if(`windowPref -exists $nrWindowName`)
windowPref -remove $nrWindowName;
$nrWindowName = `window -t "YaoTestWindow"
-s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0 -tlb 0 -rtf 1
-mnc ""
-rc ""
$nrWindowName`;
string $newObject1 = `formLayout -en 1 -w 374 -h 389 -nd 100 formLayout91`;
string $newObject2 = `text -en 1 -w 32 -h 16 -l "文本1" -al "left" -fn "plainLabelFont" -rs 1 text2`;
formLayout -e -attachPosition $newObject2 "top" 56 0 -attachPosition $newObject2 "left" 57 0 $newObject1;
string $newObject3 = `separator -en 1 -w 300 -h 5 -st "out" -hr 1 separator6`;
formLayout -e -attachPosition $newObject3 "top" 77 0 -attachPosition $newObject3 "left" 40 0 $newObject1;
string $newObject4 = `text -en 1 -w 32 -h 16 -l "文本2" -al "left" -fn "plainLabelFont" -rs 1 text3`;
formLayout -e -attachPosition $newObject4 "top" 89 0 -attachPosition $newObject4 "left" 57 0 $newObject1;
setParent ..;
showWindow $nrWindowName;
}
nrCreateYaoTestWindow;
发几个常用窗口代码,需要的可以取用2
global proc nrCreateYaoTestWindow(){ string $nrWindowName
= "YaoTestWindow"; if(`window -exists
$nrWindowName`) deleteUI
$nrWindowName; if(`windowPref -exists
$nrWindowName`) windowPref -remove
$nrWindowName; $nrWindowName = `window -t "YaoTestWindow"
-s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0
-tlb 0 -rtf 1 -mnc
"" -rc ""
$nrWindowName`;
string $newObject1 = `formLayout -en
1 -w 262 -h 354 -nd 100
formLayout91`;
string $newObject2 = `text -en 1 -w 26 -h 16 -l "文本" -al "left" -fn
"plainLabelFont" -rs 1
text2`;
formLayout -e -attachPosition $newObject2 "top" 4 0 -attachPosition $newObject2
"left" 8 0 $newObject1; setParent
..; showWindow $nrWindowName;}nrCreateYaoTestWindow;
6.勾选主要语法及flag可以参见help中checkBox的MEL;global proc nrCreateYaoTestWindow(){ string $nrWindowName = "YaoTestWindow"; if(`window -exists $nrWindowName`) deleteUI $nrWindowName; if(`windowPref -exists $nrWindowName`) windowPref -remove $nrWindowName; $nrWindowName = `window -t "YaoTestWindow" -s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0 -tlb 0 -rtf 1 -mnc "" -rc "" $nrWindowName`; string $newObject1 = `formLayout -en 1 -w 262 -h 354 -nd 100 formLayout91`; string $newObject2 = `checkBox -en 1 -w 84 -h 16 -l "Yes" -al "left" -v 0 -ed 1 -rs 1 checkBox36`; formLayout -e -attachPosition $newObject2 "top" 6 0 -attachPosition $newObject2 "left" 12 0 $newObject1; string $newObject3 = `checkBox -en 1 -w 84 -h 16 -l "No" -al "left" -v 0 -ed 1 -rs 1 checkBox37`; formLayout -e -attachPosition $newObject3 "top" 6 0 -attachPosition $newObject3 "left" 116 0 $newObject1; setParent ..; showWindow $nrWindowName;}nrCreateYaoTestWindow;
7.文本输入框注意textField的用法,很容易和intSliderGrp中的-field混淆;
global proc nrCreateYaoTestWindow(){ string $nrWindowName = "YaoTestWindow"; if(`window -exists $nrWindowName`) deleteUI $nrWindowName; if(`windowPref -exists $nrWindowName`) windowPref -remove $nrWindowName; $nrWindowName = `window -t "YaoTestWindow" -s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0 -tlb 0 -rtf 1 -mnc "" -rc "" $nrWindowName`; string $newObject1 = `formLayout -en 1 -w 262 -h 354 -nd 100 formLayout91`; string $newObject2 = `textField -en 1 -w 150 -h 22 -tx "" -fn "plainLabelFont" -ed 1 -ec "" -rfc "" textField140`; formLayout -e -attachPosition $newObject2 "top" 3 0 -attachPosition $newObject2 "left" 57 0 $newObject1; setParent ..; showWindow $nrWindowName;}nrCreateYaoTestWindow;
发几个常用窗口代码,需要的可以取用
global proc nrCreateYaoTestWindow(){ string $nrWindowName =
"YaoTestWindow";
if(`window -exists $nrWindowName`) deleteUI
$nrWindowName;
if(`windowPref -exists $nrWindowName`) windowPref -remove
$nrWindowName; $nrWindowName = `window -t "YaoTestWindow" -s 1 -tb 1
-mnb
1 -mxb 1 -mb 0 -mbv 0 -tlb 0 -rtf 1 -mnc "" -rc ""
$nrWindowName`; string $newObject1 = `formLayout -en 1 -w 247 -h 354
-nd
100 formLayout79`; setParent ..; showWindow $nrWindowName;}
nrCreateYaoTestWindow;
2.标准按钮主要语法及flag可以参见help中button的MEL;
global proc nrCreateYaoTestWindow(){ string $nrWindowName
= "YaoTestWindow"; if(`window -exists
$nrWindowName`) deleteUI
$nrWindowName; if(`windowPref -exists
$nrWindowName`) windowPref -remove
$nrWindowName; $nrWindowName = `window -t "YaoTestWindow"
-s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0
-tlb 0 -rtf 1 -mnc
"" -rc ""
$nrWindowName`;
string $newObject1 = `formLayout -en
1 -w 247 -h 354 -nd 100
formLayout91`;
string $newObject2 = `button -en 1 -w 100 -h 22 -l "按钮1" -al "center" -c "" -aop
0 -rs 1
button19`;
formLayout -e -attachPosition $newObject2 "top" 6 0 -attachPosition $newObject2
"left" 9 0 $newObject1; setParent
..; showWindow $nrWindowName;}nrCreateYaoTestWindow;
3.列按钮会用button语法以后依次写就会逐渐向下排列下去;
global proc nrCreateYaoTestWindow(){ string $nrWindowName =
"YaoTestWindow"; if(`window -exists
$nrWindowName`) deleteUI
$nrWindowName; if(`windowPref -exists
$nrWindowName`) windowPref -remove
$nrWindowName; $nrWindowName = `window -t "YaoTestWindow"
-s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0
-tlb 0 -rtf 1 -mnc
"" -rc ""
$nrWindowName`;
string $newObject1 = `formLayout -en
1 -w 247 -h 354 -nd 100
formLayout91`;
string $newObject2 = `button -en 1 -w 100 -h 22 -l "按钮1" -al "center" -c "" -aop
0 -rs 1
button19`;
formLayout -e -attachPosition $newObject2 "top" 6 0 -attachPosition $newObject2
"left" 9 0
$newObject1;
string $newObject3 = `button -en 1 -w 100 -h 22 -l "按钮2" -al "center" -c "" -aop
0 -rs 1
button20`;
formLayout -e -attachPosition $newObject3 "top" 32 0 -attachPosition $newObject3
"left" 9 0
$newObject1;
string $newObject4 = `button -en 1 -w 100 -h 22 -l "按钮3" -al "center" -c "" -aop
0 -rs 1
button21`;
formLayout -e -attachPosition $newObject4 "top" 58 0 -attachPosition $newObject4
"left" 9 0 $newObject1; setParent
..; showWindow $nrWindowName;}nrCreateYaoTestWindow;
4.三排两列MEL没有新的,多主义左侧对齐数值就可以;
global proc nrCreateYaoTestWindow(){ string $nrWindowName = "YaoTestWindow";
if(`window -exists $nrWindowName`) deleteUI $nrWindowName; if(`windowPref
-exists $nrWindowName`) windowPref -remove $nrWindowName; $nrWindowName =
`window -t "YaoTestWindow" -s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0 -tlb 0 -rtf 1
-mnc "" -rc "" $nrWindowName`; string $newObject1 = `formLayout -en 1 -w 262 -h
354 -nd 100 formLayout91`; string $newObject2 = `button -en 1 -w 100 -h 22 -l
"按钮1" -al "center" -c "" -aop 0 -rs 1 button19`; formLayout -e -attachPosition
$newObject2 "top" 6 0 -attachPosition $newObject2 "left" 9 0 $newObject1; string
$newObject3 = `button -en 1 -w 100 -h 22 -l "按钮2" -al "center" -c "" -aop 0 -rs
1 button20`; formLayout -e -attachPosition $newObject3 "top" 32 0
-attachPosition $newObject3 "left" 9 0 $newObject1; string $newObject4 = `button
-en 1 -w 100 -h 22 -l "按钮3" -al "center" -c "" -aop 0 -rs 1 button21`;
formLayout -e -attachPosition $newObject4 "top" 58 0 -attachPosition $newObject4
"left" 9 0 $newObject1; string $newObject5 = `button -en 1 -w 100 -h 22 -l "按钮4"
-al "center" -c "" -aop 0 -rs 1 button22`; formLayout -e -attachPosition
$newObject5 "top" 6 0 -attachPosition $newObject5 "left" 144 0 $newObject1;
string $newObject6 = `button -en 1 -w 100 -h 22 -l "按钮5" -al "center" -c "" -aop
0 -rs 1 button23`; formLayout -e -attachPosition $newObject6 "top" 32 0
-attachPosition $newObject6 "left" 144 0 $newObject1; string $newObject7 =
`button -en 1 -w 100 -h 22 -l "按钮6" -al "center" -c "" -aop 0 -rs 1 button24`;
formLayout -e -attachPosition $newObject7 "top" 58 0 -attachPosition $newObject7
"left" 144 0 $newObject1; setParent ..; showWindow
$nrWindowName;}nrCreateYaoTestWindow;