Skip to content

Instantly share code, notes, and snippets.

@oiehot oiehot/maya_subdiv.mel
Last active Feb 24, 2017

Embed
What would you like to do?
마야에서 Edge의 Normal, Crease, ArnoldSubdiv을 동시에 설정하기
// 0: Smooth
// 1: Jelly
// 2: Round Rect 1
// 3: Round Rect 2
// 4: Bevel
// 5: Hard
global proc TZ_Subdiv_SetLevel(int $level)
{
int $minSubdivLevel = max(5, $level); // 최저 Subdiv레벨: 5
// 폴리곤 노멀 수정
if ($level >= 2) SoftPolyEdgeElements 0; // Hard Normal
else SoftPolyEdgeElements 1; // Soft Normal
// 폴리곤 Crease 수정
polyCrease -ch false -value $level -vertexValue $level;
// 뷰포트 스무스 켜기
displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4 -polygonObject 3;
// 스무스 레벨 수정
string $shape, $shapes[];
$shapes = `listRelatives -p -shapes`; // 선택된 Component로 부터 Shape을 얻는다.
for ($shape in $shapes) {
// 기본 속성
setAttr ($shape+".smoothLevel") $minSubdivLevel; // 프리뷰 수준
setAttr ($shape+".renderSmoothLevel") $minSubdivLevel; // 렌더링 수준
setAttr ($shape+".useSmoothPreviewForRender") 0;
// 아놀드 속성
setAttr ($shape+".aiSubdivType") 1; // 서브디비젼 방식: Clark
setAttr ($shape+".aiSubdivIterations") $minSubdivLevel; // 서브디비젼 퀄리티(Iteration)
}
// 뷰포트에서 Crease Border를 끔.
polyOptions -displayCreaseEdge 0 -activeObjects;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.