fix console errors adding new style and changing it's color

1) As adding new styles means it's not assigned anywhere, there is no need to keep graph up to date.
2) Removed Ifc Operator super class from couple operators that do not write ifc data
3) Moved common code to tool.Style
This commit is contained in:
Andrej730
2024-07-29 16:42:40 +05:00
parent 732bb93826
commit 11b62a0fdc
2 changed files with 22 additions and 10 deletions
@@ -535,22 +535,22 @@ class RemoveTextureMap(bpy.types.Operator):
return {"FINISHED"}
class EnableAddingPresentationStyle(bpy.types.Operator, tool.Ifc.Operator):
class EnableAddingPresentationStyle(bpy.types.Operator):
bl_idname = "bim.enable_adding_presentation_style"
bl_label = "Enable Add Presentation Style"
bl_options = {"REGISTER", "UNDO"}
@classmethod
def poll(cls, context):
style_type = bpy.context.scene.BIMStylesProperties.style_type
style_type = tool.Style.get_active_style_type()
if style_type != "IfcSurfaceStyle":
cls.poll_message_set(f"Adding {style_type} is not currently supported.")
return False
return True
def _execute(self, context):
props = bpy.context.scene.BIMStylesProperties
props.is_adding = True
def execute(self, context):
tool.Style.enable_adding_presentation_style()
return {"FINISHED"}
class DuplicateStyle(bpy.types.Operator, tool.Ifc.Operator):
@@ -569,14 +569,14 @@ class DuplicateStyle(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.bim.load_styles(style_type=style_type)
class DisableAddingPresentationStyle(bpy.types.Operator, tool.Ifc.Operator):
class DisableAddingPresentationStyle(bpy.types.Operator):
bl_idname = "bim.disable_adding_presentation_style"
bl_label = "Disable Add Presentation Style"
bl_options = {"REGISTER", "UNDO"}
def _execute(self, context):
props = bpy.context.scene.BIMStylesProperties
props.is_adding = False
def execute(self, context):
tool.Style.disable_adding_presentation_style()
return {"FINISHED"}
class AddPresentationStyle(bpy.types.Operator, tool.Ifc.Operator):
@@ -629,7 +629,7 @@ class AddPresentationStyle(bpy.types.Operator, tool.Ifc.Operator):
else:
self.report({"INFO"}, f"Adding style of type {props.style_type} is not yet supported.")
props.is_adding = False
tool.Style.disable_adding_presentation_style()
core.load_styles(tool.Style, style_type=props.style_type)
+12
View File
@@ -55,6 +55,18 @@ class Style(blenderbim.core.tool.Style):
def delete_object(cls, obj: bpy.types.Material) -> None:
tool.Blender.remove_data_block(obj)
@classmethod
def enable_adding_presentation_style(cls) -> None:
props = bpy.context.scene.BIMStylesProperties
props.is_adding = True
props.update_graph = False
@classmethod
def disable_adding_presentation_style(cls) -> None:
props = bpy.context.scene.BIMStylesProperties
props.is_adding = False
props.update_graph = True
@classmethod
def disable_editing(cls) -> None:
bpy.context.scene.BIMStylesProperties.is_editing_style = 0