multi-user/multi_user/__init__.py

106 lines
3.1 KiB
Python
Raw Normal View History

2020-03-20 21:56:50 +08: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-08 00:41:18 +08:00
bl_info = {
"name": "Multi-User",
2019-10-22 22:37:23 +08:00
"author": "Swann Martinez",
"version": (0, 0, 3),
"description": "Enable real-time collaborative workflow inside blender",
"blender": (2, 80, 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-08 00:41:18 +08:00
}
2019-03-14 23:44:18 +08:00
2019-07-02 00:04:35 +08:00
import logging
2019-08-23 18:28:57 +08:00
import os
import random
import sys
2019-08-23 18:28:57 +08:00
import bpy
2019-08-22 16:58:54 +08:00
from bpy.app.handlers import persistent
from . import environment, utils
2019-09-24 20:42:59 +08:00
2019-08-23 18:28:57 +08:00
# TODO: remove dependency as soon as replication will be installed as a module
DEPENDENCIES = {
2019-08-27 05:14:30 +08:00
("zmq","zmq"),
2020-04-08 00:19:17 +08:00
("jsondiff","jsondiff"),
("deepdiff", "deepdiff")
}
2019-07-02 22:43:30 +08:00
2019-07-02 00:04:35 +08:00
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
2020-02-04 02:04:08 +08:00
libs = os.path.dirname(os.path.abspath(__file__))+"\\libs\\replication\\replication"
2019-05-23 22:49:32 +08:00
def register():
2019-08-05 22:48:46 +08:00
if libs not in sys.path:
sys.path.append(libs)
2019-07-02 00:04:35 +08:00
environment.setup(DEPENDENCIES,bpy.app.binary_path_python)
2019-05-16 00:37:14 +08:00
try:
from . import presence
from . import operators
from . import ui
from . import preferences
from . import addon_updater_ops
except ModuleNotFoundError:
logger.error("Libraries not installed, try to relaunch blender with admin rights")
2019-05-16 00:37:14 +08:00
preferences.register()
addon_updater_ops.register(bl_info)
presence.register()
operators.register()
ui.register()
bpy.types.WindowManager.session = bpy.props.PointerProperty(
type=preferences.SessionProps)
2019-08-09 00:12:13 +08:00
bpy.types.ID.uuid = bpy.props.StringProperty(default="")
bpy.types.WindowManager.online_users = bpy.props.CollectionProperty(
type=preferences.SessionUser
)
bpy.types.WindowManager.user_index = bpy.props.IntProperty()
2019-09-24 19:26:51 +08:00
2019-02-08 00:41:18 +08:00
def unregister():
from . import presence
2019-05-16 00:37:14 +08:00
from . import operators
from . import ui
from . import preferences
2020-03-12 05:42:09 +08:00
from . import addon_updater_ops
presence.unregister()
2020-03-12 05:42:09 +08:00
addon_updater_ops.unregister()
2019-04-10 23:01:21 +08:00
ui.unregister()
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