rss - Maya 每日一招

Syndicate content
Updated: 38 min 18 sec ago

使用 MEL 來選取所有某一類的物件

Sun, 2010-06-06 23:09
檔你想選取所以某一類的物件時,最快速的方法(之一)就是使用 MEL 或 python 程式來協助. 例如你如果想選所有 curve 線, 就可以使用以下的指令:
{
select (`ls -type "nurbsCurve"`)
}

以下有幾個其他常用的類別當參考

"mesh" : polygon 模型
"nurbsSurface" : nurbs 模型
"locator" : locator
"joint" : 骨架
"camera" : 攝影
"light" : 燈光
"animCurve" : key動畫的曲線

其他type 如果大家常用到的話 我會一一再補上去.
Categories: Network @ Digimax

按住q + 滑鼠左鍵 : 快速切入選取相關選項 ( q + LMB quick acess to selection marking menu)

Wed, 2010-05-19 10:11
今天才學到的.
原來 利用 q + 滑鼠左鍵 就可以快速設定有關選取的很多設定,例如 對稱選取(reflection), paint select, soft select 等等這些設定.



Categories: Network @ Digimax

複製 模型 UV ( Copy polygon UV )

Wed, 2010-05-05 15:10

以下的程式可以把一個拆好的UV 複製到其他 結構(topology)一樣的模型上. 什麼是結構一樣的模型?



使用方法:
  • 先選 UV 好的模型, 然後再選一個或多個要貼上UV的模型.
程式:

{
string $allObj[] =`ls -sl`;
string $source[];
$source[0] = $allObj[0];
string $target[] = stringArrayRemove($source,$allObj);

for($each in $target)
{
if(`polyCompare -fd $each $source[0]`==4 || `polyCompare -fd $each $source[0]`==12)
{
polyNormal -normalMode 0 -userNormalMode 0 -ch 1 $each;
polyTransfer -v 0 -vc 0 -uv 1 -ao $source[0] $each;
polyNormal -normalMode 0 -userNormalMode 0 -ch 1 $each;

}
else if(`polyCompare -fd $each $source[0]`==0 || `polyCompare -fd $each $source[0]`==8)
{
polyTransfer -v 0 -vc 0 -uv 1 -ao $source[0] $each;
}

}
}
Categories: Network @ Digimax

Maya 2011 新功能 : 內建自動備份檔案( auto save or auto backup)

Sat, 2010-05-01 12:16
當 Maya 突然之間停住不動或直接跳掉 , 讓你花費無數時間的力勞消失在你面前時,以上的圖片應該很適合用來表達你當下的心情吧.

幸好 Maya 開發團隊也終於開始了解他們產品有多麼的脆弱 . Maya 2011 裡的官方發表文件上列出了幾十項新功能 , 可是裡頭好像沒提到有 自動備份這功能. 直到在 cgtalk 上有人提這功能是我才發現 , 好像真的有呢!

這秘密武器是 "隱藏" 在 Window -> Settings/Preferences -> Preferences : Files/Project 的某個角落裡.


AutoSave 介面說明:

Enable : 打開 auto save 功能 .
Prompt before save : 是否讓Maya要 auto save 時 先警告一下 .
Limit autosaves : 限制 auto save 的 次數 .
Number of autosaves : 若有打勾[Limit autosaves]的話 , 指定 auto save 暫存檔的數量 . 例如 數值設為 2 的話,就只會有兩個 暫存檔 . 每當超過兩個 , maya就會把最舊的暫存檔砍掉 .
Interval (minutes) : auto save 相隔時間 (分鐘) .
Autosave destination : auto save 暫存檔 目錄 :
  • Project : auto save 檔會存到 project 目錄的 autosave 目錄
  • Named folder : 自訂目錄
  • Env var : 在 maya.env 裡加上 MAYA_AUTOSAVE_FOLDER 來設定 暫存檔 目錄 , 例如 MAYA_AUTOSAVE_FOLDER = F:\backup
要注意的事情是,我都是用 "自動備份" 這名詞,而不是 "自動存檔" , 因為Maya 並不會真正把你現在製作的檔案存起來,它只會把目前製作進度備份到暫存目錄裡. 所以你還是照樣要自己按下 Save 做存檔的動作. 這種設計的好處是你不會因為 打開 autosave 而 "不小心" 存到你不想存的檔案 .

其實我覺得這功能應該叫做 "auto backup" 而不是 "auto save".


若把[Prompt before save]打開的話,maya備份前會先跳出確認視窗
Categories: Network @ Digimax

把曲線貼到模型表面上( attach curve to surface )

Sat, 2010-04-17 14:50



使用方法: 先選 curve, 再選模型,然後執行以下程式既可把curve 貼到模型表面上.

MEL:
{
string $selected[]=`ls -sl`;

if(size($selected)>1)
{
string $curve = $selected[0];
string $obj = $selected[1];

string $allCVs[] = `ls -fl ($curve+".cv[*]")`;

for($cv in $allCVs)
{
float $oriPos[] =`pointPosition -w $cv`;
string $newLoc[]=`spaceLocator -p $oriPos[0] $oriPos[1] $oriPos[2]`;
CenterPivot;
select -r $obj;
select -add $newLoc[0];
geometryConstraint -w 1;
float $newPos[]=`pointPosition -w $newLoc[0]`;
move -a $newPos[0] $newPos[1] $newPos[2] $cv;
delete $newLoc;
}
}

select -r $selected;
}

Pymel 1.0 :
from pymel.core import *
def curveToSurface():
selection = ls(sl=1)

currCurve = selection[0]
currObject = selection[1]



for each in currCurve.cv:
pos = each.getPosition(space='world')
newLoc = spaceLocator(p=pos)
mel.eval('CenterPivot')
select(currObject,r=1)
select(newLoc,add=1)
geometryConstraint(w=1)
locPos = pointPosition(newLoc,w=1)

each.setPosition(locPos,space='world')
delete(newLoc)



為何會想到要寫這工具呢?因為有時候要做配件(prop)模型時,會需要把物件與角色位子對齊(例如把戒指對到手指大小). 利用這工具就可以先建一些 curve, 然後使用 extrude/loft 把戒子生出來.
Categories: Network @ Digimax

Maya 2011 新功能影片 ( new feature videos)

Tue, 2010-04-06 20:27


今天 Maya 2011 正式 上市了 (但只給 subscription member 下載), 可是其實 online documentation 早就已經先放上去了.

http://download.autodesk.com/us/maya/2011help/

裡頭有一些新功能教學影片,例如:

新介面操作:
Watch: Qt Interface

Asset 新功能:
Watch: Asset Enhancements

Offline editing(把reference 的動作存成一個檔,然後套到其他卡的 reference 身上:
Watch: Offline Edits

Bezier 曲線 :
Watch: Bezier Curves

新 paint weight方法:
Watch: Interactive Skin Binding

mocap 常會用到的 animation retargeting:
Watch: Non-destructive Retargeting

Fluid container 自動調整大小:
Watch: Fluids Auto Resize

nParticle 內建轉動(rotation):
Watch: nParticle Rotation

新的viewport顯示環境:
Watch: Viewport 2.0 in Maya

Color profile 功能:
Watch: Color profile support in Maya

Watch: Using color management in the Render View


還有之前在 Area blog 放的新功能影片...

graph editor 新的使用方法:
http://area.autodesk.com/blogs/stevenr/maya_2011_highlight_animation_improvements

新的viewport顯示環境:
http://area.autodesk.com/blogs/stevenr/maya_2011_highlight_viewport_2_0


新介面:
http://area.autodesk.com/blogs/stevenr/maya_2011_highlight_qt_user_interface


新的 dynamic 功能 ( nParticle, fluid):
http://area.autodesk.com/blogs/duncan/some_fun_stuff_in_maya2011
Categories: Network @ Digimax