mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
IfcGit don't switch colouring so much closes #5402
Viewing changes necessarily sets object colours and switches the viewport to object colouring. Previously most other operations switched the viewport 'back' to material colouring. This was an annoyance for users whose workflow makes use of manual object colouring. Now only operators that reload the model (revert, switch and merge), the refresh button, and attempting to view changes with the current revision switch to material colouring.
This commit is contained in:
@@ -98,6 +98,7 @@ class DiscardUncommitted(bpy.types.Operator):
|
||||
|
||||
core.discard_uncommitted(tool.IfcGit, tool.Ifc)
|
||||
refresh()
|
||||
tool.IfcGit.decolourise()
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -132,7 +133,7 @@ class CommitChanges(bpy.types.Operator):
|
||||
|
||||
repo = IfcGitData.data["repo"]
|
||||
core.commit_changes(tool.IfcGit, tool.Ifc, repo)
|
||||
bpy.ops.ifcgit.refresh()
|
||||
core.refresh_revision_list(tool.IfcGit, repo, tool.Ifc)
|
||||
refresh()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -162,7 +163,7 @@ class AddTag(bpy.types.Operator):
|
||||
|
||||
repo = IfcGitData.data["repo"]
|
||||
core.add_tag(tool.IfcGit, repo)
|
||||
bpy.ops.ifcgit.refresh()
|
||||
core.refresh_revision_list(tool.IfcGit, repo, tool.Ifc)
|
||||
refresh()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -179,7 +180,7 @@ class DeleteTag(bpy.types.Operator):
|
||||
|
||||
repo = IfcGitData.data["repo"]
|
||||
core.delete_tag(tool.IfcGit, repo, self.tag_name)
|
||||
bpy.ops.ifcgit.refresh()
|
||||
core.refresh_revision_list(tool.IfcGit, repo, tool.Ifc)
|
||||
refresh()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -204,6 +205,7 @@ class RefreshGit(bpy.types.Operator):
|
||||
repo = IfcGitData.data["repo"]
|
||||
core.refresh_revision_list(tool.IfcGit, repo, tool.Ifc)
|
||||
refresh()
|
||||
tool.IfcGit.decolourise()
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -342,7 +344,7 @@ class AddRemote(bpy.types.Operator):
|
||||
|
||||
repo = IfcGitData.data["repo"]
|
||||
core.add_remote(tool.IfcGit, repo)
|
||||
bpy.ops.ifcgit.refresh()
|
||||
core.refresh_revision_list(tool.IfcGit, repo, tool.Ifc)
|
||||
refresh()
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -358,7 +360,7 @@ class DeleteRemote(bpy.types.Operator):
|
||||
|
||||
repo = IfcGitData.data["repo"]
|
||||
core.delete_remote(tool.IfcGit, repo)
|
||||
bpy.ops.ifcgit.refresh()
|
||||
core.refresh_revision_list(tool.IfcGit, repo, tool.Ifc)
|
||||
refresh()
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ def switch_revision(ifcgit: tool.IfcGit, ifc: tool.Ifc) -> None:
|
||||
ifcgit.switch_to_revision_item()
|
||||
ifcgit.load_project(path_ifc)
|
||||
ifcgit.refresh_revision_list(path_ifc)
|
||||
ifcgit.decolourise()
|
||||
|
||||
|
||||
def merge_branch(ifcgit: tool.IfcGit, ifc: tool.Ifc, operator: bpy.types.Operator) -> None:
|
||||
|
||||
@@ -186,8 +186,6 @@ class IfcGit:
|
||||
|
||||
@classmethod
|
||||
def clear_commits_list(cls) -> None:
|
||||
area = next(area for area in bpy.context.screen.areas if area.type == "VIEW_3D")
|
||||
area.spaces[0].shading.color_type = "MATERIAL"
|
||||
props = bpy.context.scene.IfcGitProperties
|
||||
|
||||
# ifcgit_commits is registered list widget
|
||||
@@ -351,8 +349,7 @@ class IfcGit:
|
||||
current_revision = repo.commit()
|
||||
|
||||
if selected_revision == current_revision:
|
||||
area = next(area for area in bpy.context.screen.areas if area.type == "VIEW_3D")
|
||||
area.spaces[0].shading.color_type = "MATERIAL"
|
||||
cls.decolourise()
|
||||
return
|
||||
|
||||
if current_revision.committed_date > selected_revision.committed_date:
|
||||
@@ -414,6 +411,11 @@ class IfcGit:
|
||||
else:
|
||||
obj.color = (1.0, 1.0, 1.0, 0.5)
|
||||
|
||||
@classmethod
|
||||
def decolourise(cls) -> None:
|
||||
area = next(area for area in bpy.context.screen.areas if area.type == "VIEW_3D")
|
||||
area.spaces[0].shading.color_type = "MATERIAL"
|
||||
|
||||
@classmethod
|
||||
def switch_to_revision_item(cls) -> None:
|
||||
props = bpy.context.scene.IfcGitProperties
|
||||
@@ -527,6 +529,7 @@ class IfcGit:
|
||||
|
||||
cls.load_project(path_ifc)
|
||||
cls.refresh_revision_list(path_ifc)
|
||||
cls.decolourise()
|
||||
|
||||
@classmethod
|
||||
def entity_log(cls, path_ifc: str, step_id: int) -> str:
|
||||
|
||||
Reference in New Issue
Block a user