2
$\begingroup$

I'm in the process of writing an addon that generates buildings based on a group of assets such as bits of wall and roofing.

My current plan is to somehow dynamically save custom assets, including UV coordinate, textures, etc. to an object that I can create using python. (Much in the same way objects are typically created in python, only they would be defined by an object in the scene, rather than pre-defined by another piece of code)

For instance, when I want to create a Monkey with python, (and who wouldn't?) I can just call bpy.ops.mesh.primitive_monkey_add() and viola, I have a monkey. Is there a way to take my active object and dynamically create a function that is able to recreate it?

Feel free to ask further questions on my dilemma, as I feel I may not be explaining it very well!

Thanks!

$\endgroup$
1
$\begingroup$

You could select you own object and create a Group

  • Select your object(s)
  • Ctrl-G to create a group
  • After that you can create instances of this group by calling:

    bpy.ops.object.group_instance_add(group='GroupName', view_align=False, location=(0,0,0))

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.