Skip to content

Instantly share code, notes, and snippets.

@oiehot
Last active February 24, 2017 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oiehot/9d743bee7cc072541d75500be5415c60 to your computer and use it in GitHub Desktop.
Save oiehot/9d743bee7cc072541d75500be5415c60 to your computer and use it in GitHub Desktop.
마야에서 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