2016年10月17日 星期一

如何在Visual Studio 2013裡寫Maya Python?

安裝Visual Studio 2013 Community

如果要在Visual Studio裡寫Python,需要Plug-in PTVS(Python Tools or Visual Studio) 才能建立一個Python環境方便我們工作!
原本免費版本的Visual Studio Express因為不支援Extension的緣故(不能加掛PTVS)

我們需要下載Microsoft的Visual Studio Community,幸好Microsoft目前已經免費釋出了Community版本!我們可以無需付費就可以享受到Visual Studio的完整功能。

雖然目前已經有Visual Studio Community 2015,但是還是推薦使用VS2013。原因是因為目前VS2015還是多少會有一些相容性的問題,使用VS2013功能上已經足夠我們開發。

Microsoft Visual Studio 2013 Community :
http://download.microsoft.com/download/A/A/D/AAD1AA11-FF9A-4B3C-8601-054E89260B78/vs2013.5_ce_enu.iso?type=ISO

下載下來之後是一個ISO檔;將他掛載至光碟之後安裝,安裝完畢之後如果沒有Microsoft Member的話可以選擇註冊一個。

安裝PTVS

接著下載 PTVS 來安裝,在這邊下載2013版
https://github.com/Microsoft/PTVS/releases/v2.2




專案設定

安裝完之後我們打開Visual Studio發現可以新增Python專案,先新增一個Python專案 並且指定資料夾作為工作區。


TOOLS -> Python Tools -> Python Environments,右邊會彈出Python Env 的設定視窗
並且點擊Custom+來新增一個新的Python環境 這邊以Maya 2015為例。





設定如下,請注意 如果你的Maya位置和我不一樣,就必須去對應到該安裝路徑
如果你的Maya是64位元的,請設定Architecture為64,設定完請按Apply完成新增。



到目前為止,我們已經可以在Visual Studio裡面編寫Python Application!
(你也可以自行設定PyQT or PySide 或其他Python package來進行開發)


Search Path Setting

為了要讓Visual Studio可以知道Maya有哪些class和methods可以用,
我們必須在Solution Explorer加入Search Paths

請加入這些 : 
${MAYA_INSTALL_PATH}\Python\Lib\site-packages
${MAYA_INSTALL_PATH}\Python\Lib\site-packages\pymel\core
${MAYA_INSTALL_PATH}\devkit\other\pymel\extras\completion\py\maya
${MAYA_INSTALL_PATH}\devkit\other\pymel\extras\completion\py
${MAYA_INSTALL_PATH}\lib




Install ToMaya plug-in

接著我們要下載並安裝ToMaya2013這個Plug-in來跟Maya進行溝通:

https://visualstudiogallery.msdn.microsoft.com/80e6846e-c40c-435b-b23a-f0cabb23569b

安裝之後,TOOLS底下會出現ToMaya的選項,就代表安裝成功。



接著打開Maya,並且執行Script去開通我們的Command Port,詳情看網頁:

http://josbalcaen.com/scripts/maya/tomaya/

這主要是開通Maya的CommandPort來跟Visual Studio進行溝通



輸入一些Script 並且選取起來,執行ToMaya,如果出現下面視窗代表Command Port無法執行:



請回到Maya裡面再執行CommandPort的Script,回去Visual Studio測試我們的ToMaya。


Maya 有反應代表 成功了!

為了執行上的方便我們可以到Visual Studio TOOLS->Options->Environment->Keyboard裡
輸入ToMaya,設定HotKey,這邊我設定的是Alt + Space。



到這邊 我們就可以順暢地編寫我們的Maya Script了!

Chiaxin

2016年10月5日 星期三

MRRP002 Weird texture appear in color management

If your pipeline have color profile,and you take texture degamma use Maya file attribute-color profile with too dark texture, may appear weird color look like no enough color level.

This is a problem in color management.

The solution is connect a "gammaCorrent" node between them and set Colo profile to linear sRGB.gamma value is 0.454.

Now you should be get current render image.

2016年10月4日 星期二

mental ray render problems(MRRP001) issue in render transparency object

If you can't render current image though the glass with mia_material_x , result was nothing, Please check out below:

1) The transparency mode is "thin wall" instead of "solid" under "Advanced Refraction"。

2) Index of refraction must be 1.0 if you wouldn't need real refraction effect。

3) Check out the outside object's texture , the filter maybe to 0.0, because this default setting 1.0 may take final render blur, if they thought the glass and far。

Chiaxin