Scripting IvyGen with Python

I am quite new to Blender and scripting in it. I am looking for a way to use IvyGen in script, but found no tutorials. I checked the Info panel in Blender, but it only says

bpy.ops.object.editmode_toggle()
bpy.ops.object.editmode_toggle()
bpy.ops.curve.ivy_gen(updateIvy=False)


whenever I add an ivy. I am expecting to see more parameters (to control the location, the appearance, etc.) than just it. Indeed, I've tried to run these commands on Blender Python console, but just got:

{'PASS_THROUGH'}


So I am wondering if you could help me understand how scripting is actually working with ivy_gen and maybe some guide of how I can get started with it.

• This should be an answer. – cmomoney Feb 13 '17 at 15:16

1 Answer

You can call the ivy_gen operator with specific values for all the parameters you would later edit in the context menu:

bpy.ops.curve.ivy_gen(
maxIvyLength         = 1,
primaryWeight        = 0.5,
randomWeight         = 0.2,
gravityWeight        = 1,
adhesionWeight       = 0.1,
branchingProbability = 0.05,
leafProbability      = 0.35,
ivySize              = 0.02,
ivyLeafSize          = 0.02,
ivyBranchSize        = 0.001,
maxFloatLength       = 0.5,
maxAdhesionDistance  = 1,
randomSeed           = 0,
maxTime              = 0,
growLeaves           = True,
updateIvy            = False
)


To fully automate this, all you need to do prior to calling this operator is to place the 3D cursor where you want your ivy to start growing:

bpy.context.scene.cursor_location = (x,y,z)

And to also select the object you want to grow your ivy on:

bpy.context.scene.objects['MyObject'].select = True
bpy.context.scene.objects.active             = bpy.context.scene.objects['MyObject']