Browse Source

Leave Local View mode before attempting to Add Mesh objects.

pull/181/head
Joseph Davies 5 years ago
parent
commit
0b0c5242a6
Signed by untrusted user: Deledrius
GPG Key ID: 28ACC6E8D2B24B8A
  1. 13
      korman/operators/op_mesh.py

13
korman/operators/op_mesh.py

@ -140,11 +140,9 @@ class PlasmaAddLadderMeshOperator(PlasmaMeshOperator, bpy.types.Operator):
row.label("Warning: Operator does not work in local view mode", icon="ERROR") row.label("Warning: Operator does not work in local view mode", icon="ERROR")
def execute(self, context): def execute(self, context):
if context.mode == "OBJECT": if context.space_data.local_view:
bpy.ops.view3d.localview()
self.create_ladder_objects() self.create_ladder_objects()
else:
self.report({"WARNING"}, "Ladder creation only valid in Object mode")
return {"CANCELLED"}
return {"FINISHED"} return {"FINISHED"}
def create_guide_rungs(self): def create_guide_rungs(self):
@ -431,14 +429,11 @@ class PlasmaAddLinkingBookMeshOperator(PlasmaMeshOperator, bpy.types.Operator):
row.label("Warning: Operator does not work in local view mode", icon="ERROR") row.label("Warning: Operator does not work in local view mode", icon="ERROR")
def execute(self, context): def execute(self, context):
if context.mode == "OBJECT": if context.space_data.local_view:
bpy.ops.view3d.localview()
self.create_linkingbook_objects() self.create_linkingbook_objects()
else:
self.report({"WARNING"}, "Linking Book creation only valid in Object mode")
return {"CANCELLED"}
return {"FINISHED"} return {"FINISHED"}
def create_linkingbook_objects(self): def create_linkingbook_objects(self):
bpyscene = bpy.context.scene bpyscene = bpy.context.scene
cursor_shift = mathutils.Matrix.Translation(bpy.context.scene.cursor_location) cursor_shift = mathutils.Matrix.Translation(bpy.context.scene.cursor_location)

Loading…
Cancel
Save