edit: I meant the title to be “add instance group”, my bge days poked through but I’m talking about addon-style scripting!
Hello,
This is a crazy simple thing to do, but I don’t understand why blender is coughing at me. The scenario is you have a group and you want to add it to the scene. Via the interface, you hit shift-a, go under group, and click the one you want – no problem. But through python, with the same command, for me it’s either ‘CANCELLED’ or simply crashes blender.
I’ve simplified the scenario to the most straightforward file as possible in the attached blend, and below is the code/behavior:
(there is a group named ‘g’, consisting only of the default cube)
bpy.ops.object.group_instance_add(name="Group", group='g', view_align=False, location=(0.0145764, -0.0171438, -0.040683), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
# the above returns "CANCELLED", but is the same line as the info bar if done via interface
bpy.ops.object.group_instance_add(name="Group",group='g')
# the above immediately crashes blender
bpy.ops.object.group_instance_add(name="g")
# the above also immediately crashes blender
Am I missing something more fundamental? The documentation doesn’t indicate anything else is needed, and I didn’t see any other threads with anyone having issues.
If anyone could just send me a line of code how to do this properly, that’s all I need – or if the case may be, just say that it’s significantly more complicated that I thought. Thanks!
Attachments
test_group.zip (75.9 KB)