Created
March 28, 2015 14:38
-
-
Save nrtkbb/2882d63df78ecd87ac4c to your computer and use it in GitHub Desktop.
follicleがないhairSystemとpfxHairを見つけて選択するやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import pymel.core as pm | |
def selectEmptyHairs(): | |
hairs = pm.ls(type='hairSystem') | |
if len(hairs) is 0: | |
pfxs = pm.ls(type='pfxHair') | |
if len(pfxs) is 0: | |
return 'Not found hairSystem and pfxHair.' | |
else: | |
# pfxHairShapeのtransformを選択 | |
pm.select(map(lambda p:p.getParent(), pfxs)) | |
return 'Not found hairSystem, But few found pfxHair.' | |
selection = [] | |
for hair in hairs: | |
follicles = hair.attr('inputHair').inputs() | |
if len(follicles) is 0: | |
selection.append(hair.getParent()) | |
pfxs = pm.listConnections(hair, source=False, type='pfxHair') | |
selection.extend(pfxs) | |
pfxs = pm.ls(type='pfxHair') | |
for pfx in pfxs: | |
try: | |
hairs = pfx.attr('renderHairs').inputs() | |
if len(hairs) is 0: | |
selection.append(pfx.getParent()) | |
except: | |
selection.append(pfx.getParent()) | |
if len(selection) is 0: | |
return 'Not found empty hairSystem and empty pfxHair.' | |
else: | |
pm.select(selection) | |
return 'Found empty hairSystem or pfxHair.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
maya/scriptsなどに保存してMayaのScriptEditor(PythonTab)へコマンドを打ち込む