from Blender import Curve, Object, Scene
cu = Curve.New() # create new curve data
scn = Scene.GetCurrent() # get current scene
ob = scn.objects.new(cu) # make a new curve from the curve data
http://www.blender.org/documentation/249PythonDoc/
Then I thought I would look at Houdini as well, because it also uses python. And here is one example from it. Making a geometry object (not actual mesh) to create a poly cube and subdivide it:
>>> # Build a simple sop network.
>>> hou.hipFile.clear()
>>> geo = hou.node('/obj').createNode('geo')
>>> box = geo.createNode('box')
>>> subd = geo.createNode('subdivide')
>>> subd.parm('iterations').set(3)
>>> subd.setFirstInput(box)
Something for Autodesk to think about :) Especially because python is taking over and considerable time is spent by studios to build their script libraries for Maya. A proper implementation would help and make lot of code writing not needed. OpenSource codes like PyMel or MRV can help, but it`s only wrappers which add another layer (not supported by Autodesk) on top of main architecture made from MEL-to-python commands and SWIG binded C++ API. Also using this python Maya API in scripts doesn`t support undo.
After "first look" comparing, Blender and Houdini scripting API seems a lot better.
No comments:
Post a Comment