mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 09:05:18 +00:00
Add icon and convenience functions for walk and set orbit center in explore tool
This commit is contained in:
@@ -56,7 +56,7 @@ classes = (
|
|||||||
operator.UnlinkIfc,
|
operator.UnlinkIfc,
|
||||||
operator.UnloadLink,
|
operator.UnloadLink,
|
||||||
operator.UnloadProject,
|
operator.UnloadProject,
|
||||||
workspace.QueryHotkey,
|
workspace.ExploreHotkey,
|
||||||
prop.LibraryElement,
|
prop.LibraryElement,
|
||||||
prop.FilterCategory,
|
prop.FilterCategory,
|
||||||
prop.Link,
|
prop.Link,
|
||||||
@@ -79,7 +79,7 @@ addon_keymaps = []
|
|||||||
|
|
||||||
def register():
|
def register():
|
||||||
if not bpy.app.background:
|
if not bpy.app.background:
|
||||||
bpy.utils.register_tool(workspace.QueryTool, after={"builtin.select"}, separator=True, group=False)
|
bpy.utils.register_tool(workspace.ExploreTool, after={"builtin.transform"}, separator=True, group=False)
|
||||||
bpy.types.Scene.BIMProjectProperties = bpy.props.PointerProperty(type=prop.BIMProjectProperties)
|
bpy.types.Scene.BIMProjectProperties = bpy.props.PointerProperty(type=prop.BIMProjectProperties)
|
||||||
bpy.types.TOPBAR_MT_file.prepend(ui.file_menu)
|
bpy.types.TOPBAR_MT_file.prepend(ui.file_menu)
|
||||||
bpy.types.TOPBAR_MT_file_context_menu.prepend(ui.file_menu)
|
bpy.types.TOPBAR_MT_file_context_menu.prepend(ui.file_menu)
|
||||||
@@ -100,7 +100,7 @@ def register():
|
|||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
if not bpy.app.background:
|
if not bpy.app.background:
|
||||||
bpy.utils.unregister_tool(workspace.QueryTool)
|
bpy.utils.unregister_tool(workspace.ExploreTool)
|
||||||
bpy.types.TOPBAR_MT_file.remove(ui.file_menu)
|
bpy.types.TOPBAR_MT_file.remove(ui.file_menu)
|
||||||
bpy.types.TOPBAR_MT_file_context_menu.remove(ui.file_menu)
|
bpy.types.TOPBAR_MT_file_context_menu.remove(ui.file_menu)
|
||||||
del bpy.types.Scene.BIMProjectProperties
|
del bpy.types.Scene.BIMProjectProperties
|
||||||
|
|||||||
Binary file not shown.
@@ -16,25 +16,27 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import os
|
||||||
import bpy
|
import bpy
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from bpy.types import WorkSpaceTool
|
from bpy.types import WorkSpaceTool
|
||||||
from blenderbim.bim.module.project.data import LinksData
|
from blenderbim.bim.module.project.data import LinksData
|
||||||
|
|
||||||
|
|
||||||
class QueryTool(bpy.types.WorkSpaceTool):
|
class ExploreTool(bpy.types.WorkSpaceTool):
|
||||||
bl_space_type = "VIEW_3D"
|
bl_space_type = "VIEW_3D"
|
||||||
bl_context_mode = "OBJECT"
|
bl_context_mode = "OBJECT"
|
||||||
bl_idname = "bim.query_tool"
|
bl_idname = "bim.explore_tool"
|
||||||
bl_label = "Query Tool"
|
bl_label = "Explore Tool"
|
||||||
bl_description = "Fetch data about a linked IFC element"
|
bl_description = "Fetch data about a linked IFC element"
|
||||||
bl_icon = "ops.generic.select_circle"
|
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.explore")
|
||||||
bl_widget = None
|
bl_widget = None
|
||||||
bl_keymap = (
|
bl_keymap = (
|
||||||
("bim.query_linked_element", {"type": "RIGHTMOUSE", "value": "PRESS"}, None),
|
("bim.query_linked_element", {"type": "RIGHTMOUSE", "value": "PRESS"}, None),
|
||||||
("bim.query_hotkey", {"type": "C", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_C")]}),
|
("bim.explore_hotkey", {"type": "W", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_W")]}),
|
||||||
("bim.query_hotkey", {"type": "F", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_F")]}),
|
("bim.explore_hotkey", {"type": "C", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_C")]}),
|
||||||
("bim.query_hotkey", {"type": "C", "value": "PRESS", "alt": True}, {"properties": [("hotkey", "A_C")]}),
|
("bim.explore_hotkey", {"type": "F", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_F")]}),
|
||||||
|
("bim.explore_hotkey", {"type": "C", "value": "PRESS", "alt": True}, {"properties": [("hotkey", "A_C")]}),
|
||||||
)
|
)
|
||||||
|
|
||||||
def draw_settings(context, layout, ws_tool):
|
def draw_settings(context, layout, ws_tool):
|
||||||
@@ -42,18 +44,24 @@ class QueryTool(bpy.types.WorkSpaceTool):
|
|||||||
row.label(text="Query Object", icon="MOUSE_RMB")
|
row.label(text="Query Object", icon="MOUSE_RMB")
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
|
row.label(text="Walk Mode", icon="EVENT_W")
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
row.label(text="Add Clipping Plane", icon="EVENT_C")
|
row.label(text="Add Clipping Plane", icon="EVENT_C")
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
row.label(text="Flip Clipping Plane", icon="EVENT_F")
|
row.label(text="Flip Clipping Plane", icon="EVENT_F")
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text="", icon="EVENT_ALT")
|
row.label(text="", icon="EVENT_ALT")
|
||||||
|
row.label(text="Set Orbit Center", icon="MOUSE_MMB")
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.label(text="", icon="EVENT_ALT")
|
||||||
row.label(text="Disable Culling" if LinksData.enable_culling else "Enable Culling", icon="EVENT_C")
|
row.label(text="Disable Culling" if LinksData.enable_culling else "Enable Culling", icon="EVENT_C")
|
||||||
|
|
||||||
|
|
||||||
class QueryHotkey(bpy.types.Operator):
|
class ExploreHotkey(bpy.types.Operator):
|
||||||
bl_idname = "bim.query_hotkey"
|
bl_idname = "bim.explore_hotkey"
|
||||||
bl_label = "Query Hotkey"
|
bl_label = "Explore Hotkey"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
hotkey: bpy.props.StringProperty()
|
hotkey: bpy.props.StringProperty()
|
||||||
description: bpy.props.StringProperty()
|
description: bpy.props.StringProperty()
|
||||||
@@ -66,6 +74,9 @@ class QueryHotkey(bpy.types.Operator):
|
|||||||
getattr(self, f"hotkey_{self.hotkey}")()
|
getattr(self, f"hotkey_{self.hotkey}")()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
def hotkey_S_W(self):
|
||||||
|
bpy.ops.view3d.walk("INVOKE_DEFAULT")
|
||||||
|
|
||||||
def hotkey_S_C(self):
|
def hotkey_S_C(self):
|
||||||
bpy.ops.bim.create_clipping_plane("INVOKE_DEFAULT")
|
bpy.ops.bim.create_clipping_plane("INVOKE_DEFAULT")
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user