顯示具有 一般(general) 標籤的文章。 顯示所有文章
顯示具有 一般(general) 標籤的文章。 顯示所有文章

2016年6月22日 星期三

如何把一個 transform 裡存在多個 shapes 的物件獨立出來 (how to separate multiple shapes inside one transform node)


有些工具或外掛會產生出向這種一個 transform 裡存在多個 shapes 的物件。這可能是為了效能關係或其他因素,不過就可能會造成其他一些軟體,工具,或 renderer 無法正常運作。

以下這段小程式可以幫你把這些shapes 拆成"正常"獨立的物件。







2015年7月13日 星期一

Maya 2015 的 ui mixin class 讓你可以很輕鬆把一個 ui widget 變成 maya 介面的 dockable item

現在在 maya 裡寫 python 的 qt ui 比以前方便多了。2014版本開始把 pyside 完全包在 maya 裡,2015 版本更是加了一些 mixin class 讓寫 pyside ui 簡單許多,其中一個 mixin 就是 MayaQWidgetDockableMixin . 這個 mixin class 讓你繼承他之後可以 生成一個 widget 然後直接用 .show(dockable=True) 讓它顯示成 maya ui 的 dockable item.


簡單的 UI 範例 :
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin
from PySide import QtCore, QtGui

class MyWidget(MayaQWidgetDockableMixin,QtGui.QWidget):
    def __init__(self,parent=None):
        super(MyWidget, self).__init__(parent=parent)
        
        self.setWindowTitle("my widget")
        
        layout = QtGui.QVBoxLayout()
        self.setLayout(layout)
        
        btn1 = QtGui.QPushButton("run this")
        layout.addWidget(btn1)
        
        btn2 = QtGui.QPushButton("run that")
        layout.addWidget(btn2)
        
        spacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        layout.addSpacerItem(spacer)


newWidget = MyWidget()
newWidget.show(dockable=True)
        
        


效果:



Maya PySide UI 參考資料:




2015年1月1日 星期四

如何在 pyside 的程式裡直接使用 Qt designer 產生的 .ui 檔

Maya 每次更新一個版本都會多塞幾個外掛進去,包括 python 的 package 也是如此。2011版加了 pymel, 2014版則是把 PySide 也裝進去了。在那之前 大家如果要在 maya 裡使用 QT 寫介面就得自己裝 PyQt  或 PySide ,現在既然有內建的就應該好好利用它。


有很多人喜歡使用 Qt Designer 先把介面設計好再 load 進 pyqt/pyside 裡. 但如果每次都要把 .ui 檔轉成 .py 檔 (pyuic4 / pyside-uic)實在是有點麻煩,所以大家通常都想直接 load .ui 檔。pyqt 本身有個 function 叫 loadUi 可以達到這件事 (http://pyqt.sourceforge.net/Docs/PyQt4/designer.html) , 但目前 pyside 好像沒有相對的功能,所以有人在 github 上放了一個 wrapper, 把 PySide.QtUiTools.QUiLoader  包成 loadUi function, 也讓 pyqt  code 可以"無接縫" 的轉換 pyside code.

https://github.com/lunaryorn/snippets/blob/master/qt4/designer/pyside_dynamic.py

大家只需要把這個 module 下載放到自己的 python path 裡 (class MainWindow 以下的 範例程式可以刪掉),就可以像 pyqt 一樣使用 loadUi('mainwindow.ui') 把 ui 檔裡的元件直接匯入 pyside 程式裡。


2014年8月5日 星期二

如何把 maya 預設 icon 通通存下來 (how to save maya default icon to a directory)



假設你想 "美化" shelf 上的一些小工具,不妨可以換一下工具的小圖案。有哪些圖案可以用呢? 其實 maya 內建就有很多不錯的圖案,個人覺得大部分的狀況下其實不需要自己製作一個圖案(除非是個用途很重要需要一眼就認出來的工具)。

在 shelf editor 裡可以透過選取介面去選你想要替換的圖案。



只是這樣一行一行預覽可能很難選到你滿意的圖案來表示這工具的用途。以下的小程式可以幫你把所有 maya 內建的圖案下載到一個目錄裡,方便你使用 file browser 來瀏覽。


python:
import maya.cmds as cmds
for item in cmds.resourceManager(nf='*png'):
    cmds.resourceManager(s=(item, "H:/rainmaker/maya_icon/{0}".format(item)))
(把 H:/rainmaker/maya_icon 改為你的指定目錄)

有了這些圖案你就可以快速找到滿意的,然後在 shelf editor 裡直接 filter 圖案名稱去快速替換你想要用的那個圖案。

2014年2月13日 星期四

Maya 2014 的 multi component selection 問題




在 Maya 2014 之前的版本,要同時選取不同的 component (vertex & edge, face & vertex) 是件很容易做到的事情。例如 edge&vertex, 只要先選好 edge, 在按右鍵 切換到 vertex 模式 shift+選 vertex 就可以了。但在maya 2014 這版本卻無法做到這件事。只要切換到別的 component 模式,原本被選取的 component 就會消失。

原來 Maya 2014 的 multi component selection 行為是有做了些變動。但幸好在 preference 裡還是保留了可以回到舊行為的選項。那就是在 preference 裡的 selection-> preserve component selection 這個選項。只要不打勾它就可以回到以前的 "正常" 行為 。

n.b. : 這選項的寫法其實也有點怪。照常來說一般人會認為 "preserve component selection " 就是要保留不同的 component 選取結果,但它卻是反過來的意思。



當然在 Maya 裡還有一個 component 模式是可以達到類似的效果,也就是 Multi 這個模式。但是有些人還是會習慣切換到專屬模式來做選取。







2013年12月15日 星期日

存 .ma 檔時保留節點屬性的全名 (save attribute full names in .ma file)



有時候為了偷學 Maya 怎麼做事或是想知道某個節點 ( node ) 會有哪一些屬性 ( attribute )可以用,我們可能需要使用文字編輯器打開 Maya 的 .ma 檔。但一般來說 Maya 並不會在 .ma 檔裡把屬性的全名存起來,而是用簡稱來代替 (可能是為了縮減檔案大小吧)。

以下是 "正常" Maya 會存的格式。我們從這裡並很難看出來 .s .g .wgt 這種屬性到底是代表什麼,必須到 maya 官方 help 才可以查得出來 wgt --> weightedTangents,  cuv --> createUVs . 
 createNode lightLinker -s -n "lightLinker1";  
     setAttr -s 2 ".lnk";  
     setAttr -s 2 ".slnk";  
 createNode displayLayerManager -n "layerManager";  
 createNode displayLayer -n "defaultLayer";  
 createNode renderLayerManager -n "renderLayerManager";  
 createNode renderLayer -n "defaultRenderLayer";  
     setAttr ".g" yes;  
 createNode polyCube -n "polyCube1";  
     setAttr ".cuv" 4;  
 createNode animCurveUL -n "pCube1_translateX";  
     setAttr ".tan" 18;  
     setAttr ".wgt" no;  
     setAttr -s 3 ".ktv[0:2]" 0.00078463554382324219 0 3.7023928165435791   
         -6.4533541657909801 5.9996156692504883 -0.74532827237241772;  
 createNode animCurveUL -n "pCube1_translateY";  
     setAttr ".tan" 18;  
     setAttr ".wgt" no;  
     setAttr -s 3 ".ktv[0:2]" 0.00060009956359863281 0 3.7026000022888184   
         6.453 5.9995999336242676 -0.745;  

有一個方法可以強迫 Maya 把屬性全名存下來,也就是在 save as[] 時打開 Use full names for attributes on nodes 這選項。


相較之下,這種存法就清楚多了。不需要額外上網搜尋就大概可以了解每個屬性到底是可以用來設定什麼參數。
 createNode lightLinker -shared -name "lightLinker1";  
     setAttr -size 2 ".link";  
     setAttr -size 2 ".shadowLink";  
 createNode displayLayerManager -name "layerManager";  
 createNode displayLayer -name "defaultLayer";  
 createNode renderLayerManager -name "renderLayerManager";  
 createNode renderLayer -name "defaultRenderLayer";  
     setAttr ".global" yes;  
 createNode polyCube -name "polyCube1";  
     setAttr ".createUVs" 4;  
 createNode animCurveUL -name "pCube1_translateX";  
     setAttr ".tangentType" 18;  
     setAttr ".weightedTangents" no;  
     setAttr -size 3 ".keyTimeValue[0:2]" 0.00078463554382324219 0 3.7023928165435791   
         -6.4533541657909801 5.9996156692504883 -0.74532827237241772;  
 createNode animCurveUL -name "pCube1_translateY";  
     setAttr ".tangentType" 18;  
     setAttr ".weightedTangents" no;  
     setAttr -size 3 ".keyTimeValue[0:2]" 0.00060009956359863281 0 3.7026000022888184   
         6.453 5.9995999336242676 -0.745;  

2013年11月24日 星期日

如何關掉 Maya 2014 的 Help 訊息 (In View Messages) ?



Maya 2014 新增了一個功能,看來是針對 Maya 新手所設計的,也就是當你用了一些快速鍵時,在 畫面上會顯示訊息告訴你這快速鍵的用法。這功能雖然很貼切,但對於靠 Maya 吃飯的人來說卻可能只是一種干擾。如此"假會"的功能要在哪關掉呢?


最快的方式就是透過 Display -> Heads up Display -> In View Messages 這裡切換。

把 In View Messages 勾勾拿掉,就可以再也不用看到礙眼的 Help 訊息。


另外還有一個地方可以調整這個Help 設定就在 Window-> Settings/Preferences-> Preferences 裡的 Help 分區。在這有比較完整的 "小幫手" 選項,例如 顯示時間長短,字體大小,還有透明度等設定可以調。



2012年2月21日 星期二

"偷看" 未來板 maya ( 2013 ? ) 可能會出現的新功能 !



隨著 GDC (3月初)  的來臨 (這時候 Autodesk 通常都會統一發佈新軟體版本), Maya 開發者又開始 "釋放" 一些 Maya 2013 可能會出先的新功能影片.   由於Autodesk 是一家上市公司, 在Maya 2013 正事發佈前, 他們並無法公開宣稱那些影片內容就是 maya 2013 的新功能 (會牽涉到一些法律問題),所以文章一開始都會先註明說這只是個 "技術展示"。這幾個影片包括 nHair ( ! ) ,  Graph Editor 新功能 (animation retiming ?),  還有viewport2.0的新功能(跟 matte painting 有關? deep compositing preview?)


nHair 影片 :




graph editor 影片:





viewport2.0 影片:



資料來源 :
http://area.autodesk.com/blogs/cory



2011年7月2日 星期六

Maya 2012 簡體中文官方版 登場了!


Autodesk 前幾天很低調的發布了 Maya 2012 Hotfix 3. 說它這麼低調是因為在知名論壇或CG blog 上好像都沒看到相關的新聞。我猜是因為 Autodesk 怕被 Maya user 痛罵一頓,原因是在這次 hotfix 裡什麼 bug 也沒修,卻只加了一個功能就是可以顯示簡體中文的介面! 可能是越來越多 CG 代工都轉移到大陸去了,所以想多賺一點他們的錢吧 (實際報酬率我是有點質疑啦。。。)


Maya 2012 Hotfix 3 下載:
http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=17286269&linkID=9242259


Maya 2012 簡體中文版 Help 網頁 ( 對於看得懂簡體中文的同學們應該有不少的幫助,我本身是完全看不懂 XD )
http://download.autodesk.com/global/docs/maya2012/zh-cn/index.html


資訊來源:
http://area.autodesk.com/blogs/cory/maya_2012_in_chinese

2011年6月28日 星期二

maya 無法啟動 ? 可能是 userPrefs.mel 出了問題




如果某一天你想啟動 Maya, 但發現她跑到一半突然出現錯誤訊息,然後就自取滅亡了。。怎麼辦 ? 這時候可以試一招她復活的方法。
  1. 先開啟 Maya 設定目錄 (例如 C:\Documents and Settings\me\My Documents\maya\2010)
  2. 把prefs目錄裡頭的 userPrefs.mel 刪除,然後再重開 Maya 看看。
  3. 如果還是不行的話,把整個 prefs 目錄砍掉 (或改名,e.g 改為 prefs_old), 然後再次再重開看她能不能復活。
  4. 如果發現第三招還是無把她救活的話, 那看來你只好走重灌這一條路了...

2011年6月15日 星期三

polygon face selection display

在 Maya 2008 之前,當我們把模型選取方式切換到 component mode ->face (面) 時 (F11), 模型每的個一面中間都會出現一個小點, 來表示該面的中間位子,也是該面的選取範圍。自從 maya 2008 之後有了 preselection highlight (選取預覽)這功能, Maya 也加了一個 面部選取方式,也就是只要我們把游標移到面部的任何區域都可以把該面選起來。切換這兩個模式的選項是在 Window ->Settings/Preferences->Preferences 裡的 Selection 視窗。


  • Center : 面中間會出現一個小點。游標必須移到點附近才可以選取該面。
  • Whole face: 游標只要移到面部的任何區域子都可以把該面選取。

左:whole face
右:center

2011年4月27日 星期三

快速把 translate / rotate 歸零 ( scale 歸一)



這一段小程式主要是用來快速把 translate, rotate, scale 值歸回預設值,不需要特別打開 channel box 或 attribute editor只為了要做這件事。 (對 建模,骨架設定,動畫等等都蠻有幫助的)。

mel 程式 :
{
string $sel[]=`ls -sl`;
string $resetAttrs[]={"translateX","translateY","translateZ","rotateX","rotateY","rotateZ"};
for($each in $sel)
{
for($attr in $resetAttrs)
if (`getAttr -k ($each+"."+$attr)`)
{
catch(`setAttr ($each+"."+$attr) 0`);
}
}

$resetAttrs2 = {"scaleX","scaleY","scaleZ"};
for($each in $sel)
{
for($attr in $resetAttrs2)
if (`getAttr -k ($each+"."+$attr)`)
{
catch(`setAttr ($each+"."+$attr) 1`);
}
}

}
pymel 版 :
from pymel.core import *

zeroList = ['tx','ty','tz','rx','ry','rz']

oneList = ['sx','sy','sz']

reset = ls(sl=1)

for r in reset:
for attr in zeroList:
try:
setAttr('%s.%s'%(r,attr),0)
except RuntimeError:
pass

for attr in oneList:
try:
setAttr('%s.%s'%(r,attr),1)
except RuntimeError:
pass



如何設定成快速鍵 : http://maya-tricks.blogspot.com/2009/04/blog-post.html

2011年3月7日 星期一

Maya 2012, Mudbox 2012, 3dsMax 2012 等等 官方介紹 @ GDC 2011




Autodesk 在 GDC 2011 宣佈了他們的下一版 CG 軟體 lineup, 包括 Maya, Mudbox, Max, Softimage, MotionBuilder 等等。以下是幾個 軟體的介紹影片:



Maya 2012 套件 (Maya , Softimage, Motion Builder, Mudbox) 的互相支援介紹:


Mudbox 2012 (有介紹 PTex, 自動 UV, stencil editing , Photoshop Blending Mode 等等)
影片




3ds Max 介紹:
影片

資料來源: http://area.autodesk.com/gdc2011/productdemos (裡頭還有其他介紹影片)

2011年3月2日 星期三

Autodesk Maya 2012 降臨!

官方發宣佈: http://area.autodesk.com/maya2012

此網站列出的新功能:

New features in Maya 2012 include:

  • Viewport 2.0 Enhancements
    Viewport 2.0 Enhancements: Evaluate your work in a higher fidelity environment with full-screen effects in the high-performance viewport.
  • Node-Based Render Passes
    Node-Based Render Passes: Create and edit node-based representations of render passes directly within Maya, to verify and refine your work.
  • Editable Motion Trails
    Editable Motion Trails: Edit animation directly in the viewport without the need to switch context to the graph editor.
  • Sequencer Enhancements
    Sequencer Enhancements: Reorder clips, edit In and Out points, and change camera assignments in the new Sequencer Playlist.
  • Substance Procedural Textures
    Substance Procedural Textures: Achieve a vast range of look variations with a new library of 80 Substance procedural textures.
  • Craft Animation Tools
    Craft Animation Tools: Easily create believable, complex camera movements that mimic real-world setups, with 4 new camera rigs from the Craft Director Studio™ animation tool.
  • Enhanced, Consistent Graph Editor
    Enhanced, Consistent Graph Editor: Enjoy some of the best features from the f-curve editors within each of the products in the Autodesk Entertainment Creation Suites 2012, combined into a toolset that offers more consistent functionality and terminology.
  • New Simulation Options
    New Simulation Options: Create compelling dynamic visual effects in less time, with new simulation options that incorporate industry-leading technology into Maya.
  • Single-Step Suites Interoperability: Take advantage of the focused toolsets in the Autodesk® Maya® Entertainment Creation Suites 2012 , with new single-step interoperability between the products found in the suites.
  • HumanIK Enhancements
    HumanIK Enhancements: Working with characters is now easier in both Maya 2012 and MotionBuilder 2012, with an enhanced interface and unified solver for HumanIK® technology (formerly implemented as FBIK in Maya).
  • Vector Displacement Map Support: Use mental® ray to render complex high-resolution details created in Autodesk® Mudbox® software or certain other packages on low-resolution geometry.
  • Motion Capture Samples: Leverage the advanced motion retargeting capabilities of Maya 2012, with 70 motion capture samples that provide useful starting points for creating previsualizations and developing character animations.
  • Python API Enhancements: Enjoy easier and more powerful ways to extend and customize Maya, thanks to an improved Python® API that offers more idiomatic (pythonic) command writing capabilities, and is up to three times faster.
官方研發人員 blog : http://area.autodesk.com/blogs/cory/maya-1

2011年2月21日 星期一

Maya 2012 可能會出現的新功能... (Video)





世界末日快來臨啦... 所以 Maya 研發團隊迫不期待得先跟大家分享了 Maya 未來版(2012?) 可能會出現的一些新功能.


Viewport 2.0 改善版:






Maya fluid 新功能?





Maya animation 新功能 (3D Graph Editor ?!?! )




更新2011-02-23 : Rendering


更新2011-02-25: 遊戲引擎?
http://the-area.com/blogs/eric/technology_preview_video



這些聯結是從 Autodesk 官方 Blog 抓過來的: http://the-area.com/blogs/cory

2011年2月18日 星期五

2011年2月11日 星期五

移動/旋轉物件 並且保持 子孫物件的位子



切換功能快速鍵 :  w+滑鼠左鍵 -> Preserve Child Transform.
這功能特別適用於調整 控制器 / 骨架 / 一般有層次的物件.


介紹影片:


2010年11月20日 星期六

Maya 2011 新功能 : Point on Poly Constraint



Point on Poly Constraint 可以把 一個物件緊貼 (constrain) 在另外一個 polygon模型的點、線、或面上。 一但constraint 成功之後 這物件就會一直黏貼在主物件的身上,不管它怎麼甩、怎麼動都OK。這新功能可以說是部分取代了以前常用的 rivet tool (或是 maya hair follicle ) constraint 的做法。


Constraint 使用方法 : 先選取 poly模型上的一個點、線、或面,然後再加選一個要被 constraint的物件。選完再執行 Animation Menu 裡的 Constrain -> Point on Poly。


Point on Poly Constraint 效果可以參考以下的影片:


2010年11月13日 星期六

Transfer Attribute Values : 複製物件屬性值到其他物件上。

 
這功能主要是用來把一個物件的屬性值複製到另一個物件上,好像是 Maya 2009 版本才新加上去的一個功能。它尤其實用在屬性超級多,又不能直接用複製(duplicate )來做的物件,例如 Hair system 這種東西,因為用 複製物件(duplicate)的方式可能會使其他相關聯結失效的可能。




Edit -> Transfer Attribute Values[]



選項細節:
  • From Channel Box : 只複製顯示在 channel box 上的屬性。
  • Values : 只複製屬性的數值。
    若是不勾選的話, 就要選以下 in connections 其中之一:
    • Share with source : 把 source 的 入連結(in connections) 複製到 target 的屬性上。
    • Transfer from source : 把 source 的 入連結(in connections) 接到 target 的屬性上,並取消 原本 source 的連結。
  • Out connections : 順便把 source 的 出連結 (out connections) 轉移到 target 的  屬性上。

2010年10月19日 星期二

History & Undo






你如果發現你製造或修改物件時,channel 裡的 input 沒啥東西出現的話 (只剩物件的 shape 名
稱),那應該就是你不小心(或刻意也行) 把 history 的 切換關掉了,再給它按下去一次吧, 這動作雖然救不回你之前所用過的history, 但至少 之後的 history都會出現了。



還有一個蠻實用的選項就是在 Window->Settings/Preferences->Preferences->Undo 裡。你可以把 Undo 次數設成無限多次/infinite (雖然個人不建議這麼做), 或設成比較多的次數,例如 100 或 200。 這樣你就不用怕 修改很多東西之後不能 undo 回來 ( 但有些動作,例如 import 是沒辦法 undo 的,不管你設成幾次都沒用)。