[Bf-python] Python mesh modifiers

Nick M uberfob at gmail.com
Thu Sep 15 07:23:16 CEST 2005


A while back I posted a bunch of messages to the bf-committers and the
forum about allowing Python scripts to be run as modifiers on regular
objects. So, I got something working now, and it's time to fix some
last bugs and make a proper API; I need some input/suggestions on the
latter. Also I'd appreciate comments on the code itself, e.g. if I am
doing something wrong.

Here is a URL to the current pre-alpha patch:
http://amatan.com/nmatan/PyDeform-patch-050915.txt

The code is still very much unfinished; plus there are some debug
prints I put in temporarily.

Right now, the modifier is called "PyDeform", and it has just one
option in the modifier stack GUI - the text-block name containing the
script. Thus, it acts very similarly to a scriptlink (although not the
same). The modifier is marked as non-realtime and constructive.

The script can access the mesh data to modify through an NMesh
instance, stored under Blender.modifierMesh. Any changes are supposed
to be done in place, using whatever regular NMesh methods.

Now, there are some additions that folks will probably want to see.
Firstly, the source object reference could be exposed as Blender.link
or Blender.modifierObject (I'm not really sure which one). Also, the
"useRenderSettings" option from modifier code could be passed under
similarly named Blender module var. I am not sure what the
"isFinalCalc" option is in modifier function - can someone give a
hint?

Another major issue is the custom modifier parameters - exposing
parameters wanted by the script as regular options in the modifier GUI
(similar to how texture plugins do it). That seems like a complicated
piece of code to implement - I don't know if it can be postponed.

Finally, I am still experiencing a crash when trying to load a .blend
file that has an object with the modifier on it. There are more
details about the crash, but I'm not going to list them here. So
beware - do not save file when the modifier is applied to some object.

Tell me what ya guys think.

Thanks!
-Nick



More information about the Bf-python mailing list