これはなに?
3dsMaxのPython API、MaxPlusにてモディファイアを取得したりしようとしているときに書きつけたメモです
試行錯誤
python.execute "print dir()"
['MaxPlus', '_ToListener', '__builtins__', '__doc__', '__name__', '__package__', '_old_stderr', '_old_stdout', '_redirected_stdout', 'sys']
#success
↑Max開いた時点でMaxPlus読み込まれてます
MaxPlus.SelectionManager.Nodes
で、選択中のオブジェクトを取得できます。
というわけで、なんかジオメトリを掴んでレッツスタート。
python.execute "print MaxPlus.SelectionManager.Nodes"
<generator object <genexpr> at 0x00000000FBB2ABD0>
#success
↑ジェネレータで返ってくるのか~
取得したノードに対して .Modifiers で、適用されてるモディファイアが取得できます。
また、モディファイアに対して .GetClassName() で、そのモディファイアの名前が得られます。
横着して(?)リスト内包表記二重にしてみたりした↓
python.execute "print [ mod.GetClassName() for node in MaxPlus.SelectionManager.Nodes for mod in node.Modifiers]"
[u'\u30bf\u30fc\u30dc\u30b9\u30e0\u30fc\u30ba', u'\u30b9\u30ad\u30f3']
#success
desuyone〜〜
python.execute "modList = [ mod.GetClassName() for node in MaxPlus.SelectionManager.Nodes for mod in node.Modifiers]"
#success
python.execute "for i in modList:print i"
ターボスムーズ
スキン
#success
「ターボスムーズ」「スキン」というモディファイア名がとれました
まとめ
この選択オブジェクト、「ターボスムーズ」「スキン」と「モーファー」もアサインされてるんだけどな!
今日はここまで。
参考
MaxPlus and Setting Slice_Modifier Position/Rotation/Scale & "Animatable"
http://tech-artists.org/forum/showthread.php?4697-MaxPlus-and-Setting-Slice_Modifier-Position-Rotation-Scale-amp-quot-Animatable-quot
MaxPlus.SelectionManager.Nodes
http://help.autodesk.com/view/3DSMAX/2015/ENU/?guid=__files_GUID_B8C79798_1908_4FBA_A936_8A383F8494F7_htm
Python APIでのモディファイアの追加とか
http://help.autodesk.com/cloudhelp/2015/ENU/Max-Python-API/files/GUID-1AC35645-91D7-4DBE-9714-681C8CC8700F.htm
Modifier Class Reference
http://help.autodesk.com/view/3DSMAX/2015/ENU/?guid=__py_ref_class_max_plus_1_1_modifier_html
help(mod)
python.execute "help(mod)"
Help on Modifier in module MaxPlus object:
class Modifier(BaseObject)
| The base class for Object Space and Space Warp (World Space) Modifier plug-ins
|
| Method resolution order:
| Modifier
| BaseObject
| ReferenceTarget
| ReferenceMaker
| Animatable
| InterfaceServer
| Wrapper
| __builtin__.object
|
| Methods defined here:
(中略)
| ----------------------------------------------------------------------
| Methods inherited from InterfaceServer:
|
| GetInterface(self, *args)
| GetInterface(InterfaceServer self, Interface_ID id) -> BaseInterface
|
| ----------------------------------------------------------------------
| Methods inherited from Wrapper:
|
| GetUnwrappedPtr(self)
| GetUnwrappedPtr(Wrapper self) -> void *
|
| __nonzero__(self)
| __nonzero__(Wrapper self) -> bool
|
| __str__(self)
| __str__(Wrapper self) -> char const *
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Wrapper:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
#success