Skip to content
Snippets Groups Projects
Commit 2f4c557d authored by Spivak Vladimir (cwolf3d)'s avatar Spivak Vladimir (cwolf3d)
Browse files

Fix T72654: Bolt Factory: Missing Data after Change Bolt.

parent 6d78df97
Branches
Tags
No related merge requests found
...@@ -342,26 +342,23 @@ class add_mesh_bolt(Operator, AddObjectHelper): ...@@ -342,26 +342,23 @@ class add_mesh_bolt(Operator, AddObjectHelper):
def execute(self, context): def execute(self, context):
if bpy.context.mode == "OBJECT": if bpy.context.mode == "OBJECT":
if self.change == True and self.change != None: if context.selected_objects != [] and context.active_object and \
('Bolt' in context.active_object.data.keys()) and (self.change == True):
obj = context.active_object obj = context.active_object
if 'Bolt' in obj.data.keys(): oldmesh = obj.data
oldmesh = obj.data oldmeshname = obj.data.name
oldmeshname = obj.data.name mesh = createMesh.Create_New_Mesh(self, context)
mesh = createMesh.Create_New_Mesh(self, context) obj.data = mesh
obj.data = mesh try:
try: bpy.ops.object.vertex_group_remove(all=True)
bpy.ops.object.vertex_group_remove(all=True) except:
except: pass
pass
for material in oldmesh.materials:
obj.data.materials.append(material)
for material in oldmesh.materials: bpy.data.meshes.remove(oldmesh)
obj.data.materials.append(material) obj.data.name = oldmeshname
bpy.data.meshes.remove(oldmesh)
obj.data.name = oldmeshname
else:
mesh = createMesh.Create_New_Mesh(self, context)
obj = object_utils.object_data_add(context, mesh, operator=None)
else: else:
mesh = createMesh.Create_New_Mesh(self, context) mesh = createMesh.Create_New_Mesh(self, context)
obj = object_utils.object_data_add(context, mesh, operator=None) obj = object_utils.object_data_add(context, mesh, operator=None)
...@@ -408,10 +405,8 @@ def Bolt_contex_menu(self, context): ...@@ -408,10 +405,8 @@ def Bolt_contex_menu(self, context):
def menu_func_bolt(self, context): def menu_func_bolt(self, context):
layout = self.layout layout = self.layout
layout.separator() layout.separator()
self.layout.operator( oper = self.layout.operator(add_mesh_bolt.bl_idname, text="Bolt", icon="MOD_SCREW")
add_mesh_bolt.bl_idname, oper.change = False
text="Bolt",
icon="MOD_SCREW")
classes = ( classes = (
add_mesh_bolt, add_mesh_bolt,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment