diff --git a/src/blenderbim/blenderbim/bim/__init__.py b/src/blenderbim/blenderbim/bim/__init__.py index da0e078ee0..375343a285 100644 --- a/src/blenderbim/blenderbim/bim/__init__.py +++ b/src/blenderbim/blenderbim/bim/__init__.py @@ -84,6 +84,7 @@ modules = { "debug": None, "ifcgit": None, "covering": None, + "web": None, # Uncomment this line to enable loading of the demo module. Happy hacking! # The name "demo" must correlate to a folder name in `bim/module/`. # "demo": None, diff --git a/src/blenderbim/blenderbim/bim/module/web/__init__.py b/src/blenderbim/blenderbim/bim/module/web/__init__.py new file mode 100644 index 0000000000..920fb01d57 --- /dev/null +++ b/src/blenderbim/blenderbim/bim/module/web/__init__.py @@ -0,0 +1,35 @@ +# BlenderBIM Add-on - OpenBIM Blender Add-on +# Copyright (C) 2020, 2021 Dion Moult +# +# This file is part of BlenderBIM Add-on. +# +# BlenderBIM Add-on is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# BlenderBIM Add-on is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with BlenderBIM Add-on. If not, see . + +import bpy +from . import ui, prop, operator + +classes = ( + operator.ConnectToWebsocketServer, + operator.killWebsocketServer, + prop.WebProperties, + ui.BIM_PT_webui, +) + + +def register(): + bpy.types.Scene.WebProperties = bpy.props.PointerProperty(type=prop.WebProperties) + + +def unregister(): + del bpy.types.Scene.WebProperties diff --git a/src/blenderbim/blenderbim/bim/module/web/operator.py b/src/blenderbim/blenderbim/bim/module/web/operator.py new file mode 100644 index 0000000000..6331c851f9 --- /dev/null +++ b/src/blenderbim/blenderbim/bim/module/web/operator.py @@ -0,0 +1,37 @@ +# BlenderBIM Add-on - OpenBIM Blender Add-on +# Copyright (C) 2020, 2021 Dion Moult +# +# This file is part of BlenderBIM Add-on. +# +# BlenderBIM Add-on is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# BlenderBIM Add-on is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with BlenderBIM Add-on. If not, see . +import os +import bpy + + +class ConnectToWebsocketServer(bpy.types.Operator): + bl_idname = "bim.connect_to_websocket_server" + bl_label = "Connect to websocket server" + bl_description = "Connect to a websocket server" + + def execute(self, context): + return {"FINISHED"} + + +class killWebsocketServer(bpy.types.Operator): + bl_idname = "bim.kill_websocket_server" + bl_label = "Kill websocket server" + bl_description = "Kill running websocket server" + + def execute(self, context): + return {"FINISHED"} diff --git a/src/blenderbim/blenderbim/bim/module/web/prop.py b/src/blenderbim/blenderbim/bim/module/web/prop.py new file mode 100644 index 0000000000..b23dea1774 --- /dev/null +++ b/src/blenderbim/blenderbim/bim/module/web/prop.py @@ -0,0 +1,34 @@ +# BlenderBIM Add-on - OpenBIM Blender Add-on +# Copyright (C) 2020, 2021 Dion Moult +# +# This file is part of BlenderBIM Add-on. +# +# BlenderBIM Add-on is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# BlenderBIM Add-on is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with BlenderBIM Add-on. If not, see . + +import bpy +from bpy.types import PropertyGroup +from bpy.props import ( + PointerProperty, + StringProperty, + EnumProperty, + BoolProperty, + IntProperty, + FloatProperty, + FloatVectorProperty, + CollectionProperty, +) + + +class WebProperties(PropertyGroup): + Webserver_port: StringProperty(name="Port") diff --git a/src/blenderbim/blenderbim/bim/module/web/ui.py b/src/blenderbim/blenderbim/bim/module/web/ui.py new file mode 100644 index 0000000000..84f8556999 --- /dev/null +++ b/src/blenderbim/blenderbim/bim/module/web/ui.py @@ -0,0 +1,44 @@ +# BlenderBIM Add-on - OpenBIM Blender Add-on +# Copyright (C) 2020, 2021 Dion Moult +# +# This file is part of BlenderBIM Add-on. +# +# BlenderBIM Add-on is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# BlenderBIM Add-on is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with BlenderBIM Add-on. If not, see . + +from bpy.types import Panel + + +class BIM_PT_webui(Panel): + bl_label = "Web UI" + bl_idname = "BIM_PT_webui" + bl_options = {"DEFAULT_CLOSED"} + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "scene" + bl_parent_id = "BIM_PT_tab_collaboration" + + def draw(self, context): + layout = self.layout + + scene = context.scene + props = scene.WebProperties + + row = layout.row() + row.prop(props, "Webserver_port", text="Webserver Port") + + row = layout.row() + row.operator("bim.connect_to_websocket_server") + + row = layout.row() + row.operator("bim.kill_websocket_server")