New Tool: multi mesh edit
This commit is contained in:
parent
e6b81de7e1
commit
36190021e9
|
@ -178,6 +178,7 @@ class OscPanelMesh(Panel):
|
|||
return context.scene.oscurart.osc_mesh_tools
|
||||
|
||||
def draw(self, context):
|
||||
scene = context.scene
|
||||
layout = self.layout
|
||||
col = layout.column(align=1)
|
||||
|
||||
|
@ -200,10 +201,15 @@ class OscPanelMesh(Panel):
|
|||
colrow.operator("mesh.uv_island_copy", icon="COPYDOWN")
|
||||
colrow.operator("mesh.uv_island_paste", icon="PASTEDOWN")
|
||||
colrow = col.row(align=1)
|
||||
colrow.operator("view3d.modal_operator", icon="STICKY_UVS_DISABLE")
|
||||
colrow.operator("view3d.modal_operator", icon="STICKY_UVS_DISABLE")
|
||||
colrow = col.row(align=1)
|
||||
colrow.operator("lattice.mirror_selected", icon="LATTICE_DATA")
|
||||
|
||||
colrow = col.row(align=1)
|
||||
colrow.label(text="Multimesh")
|
||||
colrow.prop_search(scene, "multimeshedit", bpy.data, "groups", text="")
|
||||
colrow = col.row(align=1)
|
||||
colrow.operator("mesh.create_edit_multimesh", icon="IMPORT")
|
||||
colrow.operator("mesh.apply_edit_multimesh", icon="EXPORT")
|
||||
|
||||
class OscPanelShapes(Panel):
|
||||
bl_idname = "Oscurart Shapes Tools"
|
||||
|
@ -225,8 +231,8 @@ class OscPanelShapes(Panel):
|
|||
col.operator("mesh.create_lmr_groups_osc", icon="GROUP_VERTEX")
|
||||
col.operator("mesh.split_lr_shapes_osc", icon="SHAPEKEY_DATA")
|
||||
colrow = col.row(align=1)
|
||||
colrow.operator("mesh.create_symmetrical_layout_osc", icon="SETTINGS")
|
||||
colrow.operator("mesh.create_asymmetrical_layout_osc", icon="SETTINGS")
|
||||
colrow.operator("mesh.create_symmetrical_layout_osc", icon="IMPORT")
|
||||
colrow.operator("mesh.create_asymmetrical_layout_osc", icon="EXPORT")
|
||||
|
||||
|
||||
class OscPanelRender(Panel):
|
||||
|
@ -436,6 +442,7 @@ class OscurartToolsAddonPreferences(AddonPreferences):
|
|||
|
||||
|
||||
def register():
|
||||
from bpy.types import Scene
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
bpy.types.Scene.oscurart = PointerProperty(type=View3DOscPanel)
|
||||
|
@ -445,6 +452,8 @@ def register():
|
|||
bpy.types.Scene.quick_animation_in = IntProperty(default=1)
|
||||
bpy.types.Scene.quick_animation_out = IntProperty(default=250)
|
||||
|
||||
Scene.multimeshedit = StringProperty()
|
||||
|
||||
# SETEO VARIABLE DE ENTORNO
|
||||
bpy.types.Scene.SearchAndSelectOt = StringProperty(
|
||||
default="Object name initials"
|
||||
|
|
|
@ -637,4 +637,61 @@ class PasteUvIsland(Operator):
|
|||
|
||||
def execute(self, context):
|
||||
defPasteUvsIsland(self, context)
|
||||
return {'FINISHED'}
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
||||
class createEditMultimesh(Operator):
|
||||
"""Create Edit Multi Mesh"""
|
||||
bl_idname = "mesh.create_edit_multimesh"
|
||||
bl_label = "Create edit multimesh"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
|
||||
# creo el merge para editar
|
||||
def execute(self,context):
|
||||
global relvert
|
||||
global me
|
||||
global ob
|
||||
temp = [[ob , [vert.co for vert in ob.data.vertices]]for ob in bpy.data.groups[bpy.context.scene.multimeshedit].objects]
|
||||
vi = 0
|
||||
pi = 0
|
||||
relvert = {}
|
||||
vertlist = []
|
||||
polylist = []
|
||||
for ob in temp:
|
||||
for vert in ob[0].data.vertices:
|
||||
#print(vert.co[:])
|
||||
vertlist.append(vert.co+ob[0].location)
|
||||
for poly in ob[0].data.polygons:
|
||||
#print(poly.vertices[:])
|
||||
polylist.append(tuple([vert+vi for vert in poly.vertices[:]]))
|
||||
relvert[ob[0]] = {vert.index:vert.index+vi for vert in ob[0].data.vertices}
|
||||
vi += len(ob[0].data.vertices)
|
||||
ob[0].hide = 1
|
||||
me = bpy.data.meshes.new("editMesh")
|
||||
ob = bpy.data.objects.new("editMesh", me)
|
||||
bpy.context.scene.objects.link(ob)
|
||||
me.from_pydata(vertlist,[],polylist)
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
bpy.context.scene.objects.active = ob
|
||||
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class ApplyEditMultimesh(Operator):
|
||||
"""Apply Edit Multi Mesh"""
|
||||
bl_idname = "mesh.apply_edit_multimesh"
|
||||
bl_label = "Apply edit multimesh"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def execute(self,context):
|
||||
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
||||
for object,rv in relvert.items():
|
||||
for source, target in rv.items():
|
||||
object.data.vertices[source].co = me.vertices[target].co-object.location
|
||||
object.hide = 0
|
||||
bpy.context.scene.objects.unlink(ob)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
Loading…
Reference in New Issue