I’m working on an addon. I’d like to make a list that shows two dropdown fields with each field allowing you to select an object and a vertex group respectively.
These fields appear on a row. More rows can be added by clicking a button.
This panel appears only when you select a mesh object so the vertex groups and assigned objects will be specific to each mesh object in the scene.
The idea is, this list allows you to assign a high poly mesh to the vertex group (which belongs to a low poly mesh). A translation can then be applied to each vertex group in that list, essentially moving the vertex group as if it was a object. Since we know which mesh is “assigned” to each group, the same translation can be applied said high poly meshes.
This allows us to explode and recombine the mesh for baking purposes in one click.
Anyway, I know a bit of Python but my main issue is understanding how it works in Blender. This is what I have so far for my panel:
class ExplodedBake(bpy.types.Panel): """Explodes a selection, bakes a number of maps, and un-explodes it"""
bl_label = "Exploded Bake"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
def draw(self, context):
layout = self.layout
scene = context.scene
ob = context.object
split = layout.split()
#column one
col = split.column()
col.label(text="Object:")
##### add object group picker here
#column two
col = split.column()
col.label(text="Vertex Group:")
row = col.row(align=True)
##### add vertex group picker here
layout.operator("button.explode", text="Explode!")
As you can see I’m not sure how to add the object and vertex group picker. How would you make a field that allows you to pick certain things (in this case vertex group and mesh object)?
Also, assuming we have multiple rows of fields, how would you iterate through them to get the objects and vertex groups they represent?
Thanks