multi-user/multi_user/__init__.py

120 lines
3.7 KiB
Python
Raw Normal View History

2020-03-20 14:56:50 +01:00
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program 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.
#
# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
#
# ##### END GPL LICENSE BLOCK #####
2019-02-07 17:41:18 +01:00
bl_info = {
"name": "Multi-User",
2019-10-22 16:37:23 +02:00
"author": "Swann Martinez",
2021-12-10 15:56:47 +01:00
"version": (0, 4, 1),
"description": "Enable real-time collaborative workflow inside blender",
2020-07-27 17:44:27 +02:00
"blender": (2, 82, 0),
"location": "3D View > Sidebar > Multi-User tab",
"warning": "Unstable addon, use it at your own risks",
"category": "Collaboration",
"doc_url": "https://multi-user.readthedocs.io/en/develop/index.html",
"wiki_url": "https://multi-user.readthedocs.io/en/develop/index.html",
"tracker_url": "https://gitlab.com/slumber/multi-user/issues",
"support": "COMMUNITY"
2019-02-07 17:41:18 +01:00
}
2019-03-14 16:44:18 +01:00
2019-07-01 18:04:35 +02:00
import logging
2019-08-23 12:28:57 +02:00
import os
import random
import sys
2019-08-23 12:28:57 +02:00
import bpy
2019-08-22 10:58:54 +02:00
from bpy.app.handlers import persistent
2020-10-06 09:45:13 +02:00
from . import environment
2019-09-24 14:42:59 +02:00
2019-08-23 12:28:57 +02:00
2020-09-25 11:23:36 +02:00
module_error_msg = "Insufficient rights to install the multi-user \
dependencies, aunch blender with administrator rights."
2019-05-23 16:49:32 +02:00
def register():
2020-04-22 17:04:14 +02:00
# Setup logging policy
logging.basicConfig(
format='%(asctime)s CLIENT %(levelname)-8s %(message)s',
datefmt='%H:%M:%S',
level=logging.INFO)
2020-07-10 16:50:09 +02:00
try:
environment.register()
2020-09-25 11:23:36 +02:00
from . import presence
from . import operators
2021-06-18 14:59:56 +02:00
from . import handlers
2020-09-25 11:23:36 +02:00
from . import ui
from . import icons
2020-09-25 11:23:36 +02:00
from . import preferences
from . import addon_updater_ops
preferences.register()
addon_updater_ops.register(bl_info)
presence.register()
operators.register()
2021-06-18 14:59:56 +02:00
handlers.register()
2020-09-25 11:23:36 +02:00
ui.register()
icons.register()
2020-09-25 11:23:36 +02:00
except ModuleNotFoundError as e:
raise Exception(module_error_msg)
logging.error(module_error_msg)
bpy.types.WindowManager.session = bpy.props.PointerProperty(
type=preferences.SessionProps)
2020-06-09 18:02:53 +02:00
bpy.types.ID.uuid = bpy.props.StringProperty(
default="",
options={'HIDDEN', 'SKIP_SAVE'})
bpy.types.WindowManager.online_users = bpy.props.CollectionProperty(
type=preferences.SessionUser
)
bpy.types.WindowManager.user_index = bpy.props.IntProperty()
bpy.types.WindowManager.server_index = bpy.props.IntProperty()
2020-12-16 11:05:58 +01:00
bpy.types.TOPBAR_MT_file_import.append(operators.menu_func_import)
bpy.types.TOPBAR_MT_file_export.append(operators.menu_func_export)
2020-12-16 11:05:58 +01:00
2019-09-24 13:26:51 +02:00
2019-02-07 17:41:18 +01:00
def unregister():
from . import presence
2019-05-15 18:37:14 +02:00
from . import operators
2021-06-18 14:59:56 +02:00
from . import handlers
2019-05-15 18:37:14 +02:00
from . import ui
from . import icons
from . import preferences
2020-03-11 22:42:09 +01:00
from . import addon_updater_ops
2020-12-16 11:05:58 +01:00
bpy.types.TOPBAR_MT_file_import.remove(operators.menu_func_import)
bpy.types.TOPBAR_MT_file_export.remove(operators.menu_func_export)
2020-12-16 11:05:58 +01:00
presence.unregister()
2020-03-11 22:42:09 +01:00
addon_updater_ops.unregister()
2019-04-10 17:01:21 +02:00
ui.unregister()
icons.unregister()
2021-06-18 14:59:56 +02:00
handlers.unregister()
2019-04-10 17:01:21 +02:00
operators.unregister()
preferences.unregister()
del bpy.types.WindowManager.session
del bpy.types.ID.uuid
del bpy.types.WindowManager.online_users
del bpy.types.WindowManager.user_index
del bpy.types.WindowManager.server_index
environment.unregister()