2.5: Lists for vertex groups, shape keys, uvs, vertex colors.
RNA * Added the relevant active_*_index properties, with proper get/set/range, updates and notifiers. * Context.tool_settings. * ToolSettings.vertex_group_weight. Operators * MESH_OT_uv_texture_add/remove * MESH_OT_vertex_color_add/remove * MESH_OT_sticky_add/remove * OBJECT_OT_vertex_group_add/remove/assign/remove_from/ select/deselect/copy/copy_to_linked * OBJECT_OT_shape_key_add/remove UI * Some updates and cleanups in list template code. Known issue: when going in & out of editmode, uv textures and vertex colors dissappear. I thought me->edit_mesh would be NULL when not in edit mode but it is not?
This commit is contained in:
@@ -62,30 +62,125 @@ class DATA_PT_materials(DataButtonsPanel):
|
||||
|
||||
row = layout.row()
|
||||
|
||||
row.template_list(ob, "materials", "active_material_index")
|
||||
row.template_list(ob, "materials", ob, "active_material_index")
|
||||
|
||||
col = row.column(align=True)
|
||||
col.itemO("OBJECT_OT_material_slot_add", icon="ICON_ZOOMIN", text="")
|
||||
col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
if context.edit_object:
|
||||
row = layout.row(align=True)
|
||||
|
||||
row.itemO("OBJECT_OT_material_slot_assign", text="Assign");
|
||||
row.itemO("OBJECT_OT_material_slot_select", text="Select");
|
||||
row.itemO("OBJECT_OT_material_slot_deselect", text="Deselect");
|
||||
row.itemO("OBJECT_OT_material_slot_assign", text="Assign")
|
||||
row.itemO("OBJECT_OT_material_slot_select", text="Select")
|
||||
row.itemO("OBJECT_OT_material_slot_deselect", text="Deselect")
|
||||
|
||||
"""
|
||||
layout.itemS()
|
||||
|
||||
box= layout.box()
|
||||
|
||||
row = box.row()
|
||||
row.template_list(ob, "materials", "active_material_index", compact=True)
|
||||
row.template_list(ob, "materials", ob, "active_material_index", compact=True)
|
||||
|
||||
subrow = row.row(align=True)
|
||||
subrow.itemO("OBJECT_OT_material_slot_add", icon="ICON_ZOOMIN", text="")
|
||||
subrow.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
|
||||
"""
|
||||
|
||||
class DATA_PT_vertex_groups(DataButtonsPanel):
|
||||
__idname__ = "DATA_PT_vertex_groups"
|
||||
__label__ = "Vertex Groups"
|
||||
|
||||
def poll(self, context):
|
||||
return (context.object and context.object.type in ('MESH', 'LATTICE'))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
ob = context.object
|
||||
|
||||
row = layout.row()
|
||||
|
||||
row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index")
|
||||
|
||||
col = row.column(align=True)
|
||||
col.itemO("OBJECT_OT_vertex_group_add", icon="ICON_ZOOMIN", text="")
|
||||
col.itemO("OBJECT_OT_vertex_group_remove", icon="ICON_ZOOMOUT", text="")
|
||||
|
||||
col.itemO("OBJECT_OT_vertex_group_copy", icon="ICON_BLANK1", text="")
|
||||
if ob.data.users > 1:
|
||||
col.itemO("OBJECT_OT_vertex_group_copy_to_linked", icon="ICON_BLANK1", text="")
|
||||
|
||||
if context.edit_object:
|
||||
row = layout.row(align=True)
|
||||
|
||||
row.itemO("OBJECT_OT_vertex_group_assign", text="Assign")
|
||||
row.itemO("OBJECT_OT_vertex_group_remove_from", text="Remove")
|
||||
row.itemO("OBJECT_OT_vertex_group_select", text="Select")
|
||||
row.itemO("OBJECT_OT_vertex_group_deselect", text="Deselect")
|
||||
|
||||
layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight")
|
||||
|
||||
class DATA_PT_shape_keys(DataButtonsPanel):
|
||||
__idname__ = "DATA_PT_shape_keys"
|
||||
__label__ = "Shape Keys"
|
||||
|
||||
def poll(self, context):
|
||||
return (context.object and context.object.type in ('MESH', 'LATTICE'))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
ob = context.object
|
||||
|
||||
row = layout.row()
|
||||
|
||||
key = ob.data.shape_keys
|
||||
|
||||
row.template_list(key, "keys", ob, "active_shape_key_index")
|
||||
|
||||
col = row.column(align=True)
|
||||
col.itemO("OBJECT_OT_shape_key_add", icon="ICON_ZOOMIN", text="")
|
||||
col.itemO("OBJECT_OT_shape_key_remove", icon="ICON_ZOOMOUT", text="")
|
||||
|
||||
if context.edit_object:
|
||||
layout.enabled = False
|
||||
|
||||
class DATA_PT_uv_texture(DataButtonsPanel):
|
||||
__idname__ = "DATA_PT_uv_texture"
|
||||
__label__ = "UV Texture"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
me = context.mesh
|
||||
|
||||
row = layout.row()
|
||||
|
||||
row.template_list(me, "uv_textures", me, "active_uv_texture_index")
|
||||
|
||||
col = row.column(align=True)
|
||||
col.itemO("MESH_OT_uv_texture_add", icon="ICON_ZOOMIN", text="")
|
||||
col.itemO("MESH_OT_uv_texture_remove", icon="ICON_ZOOMOUT", text="")
|
||||
|
||||
class DATA_PT_vertex_colors(DataButtonsPanel):
|
||||
__idname__ = "DATA_PT_vertex_colors"
|
||||
__label__ = "Vertex Colors"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
me = context.mesh
|
||||
|
||||
row = layout.row()
|
||||
|
||||
row.template_list(me, "vertex_colors", me, "active_vertex_color_index")
|
||||
|
||||
col = row.column(align=True)
|
||||
col.itemO("MESH_OT_vertex_color_add", icon="ICON_ZOOMIN", text="")
|
||||
col.itemO("MESH_OT_vertex_color_remove", icon="ICON_ZOOMOUT", text="")
|
||||
|
||||
bpy.types.register(DATA_PT_mesh)
|
||||
bpy.types.register(DATA_PT_materials)
|
||||
bpy.types.register(DATA_PT_vertex_groups)
|
||||
bpy.types.register(DATA_PT_shape_keys)
|
||||
bpy.types.register(DATA_PT_uv_texture)
|
||||
bpy.types.register(DATA_PT_vertex_colors)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user