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 = {
|
2019-07-01 15:39:01 +02:00
|
|
|
"name": "Multi-User",
|
2019-10-22 16:37:23 +02:00
|
|
|
"author": "Swann Martinez",
|
2020-03-19 17:26:30 +01:00
|
|
|
"version": (0, 0, 3),
|
2020-02-27 23:15:31 +01:00
|
|
|
"description": "Enable real-time collaborative workflow inside blender",
|
2019-05-21 16:53:55 +02:00
|
|
|
"blender": (2, 80, 0),
|
2020-02-27 23:15:31 +01:00
|
|
|
"location": "3D View > Sidebar > Multi-User tab",
|
2019-09-18 17:54:02 +02:00
|
|
|
"warning": "Unstable addon, use it at your own risks",
|
2020-02-27 23:15:31 +01:00
|
|
|
"category": "Collaboration",
|
2020-03-12 13:25:13 +01:00
|
|
|
"doc_url": "https://multi-user.readthedocs.io/en/develop/index.html",
|
2020-02-27 23:15:31 +01:00
|
|
|
"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
|
2019-07-01 15:39:01 +02:00
|
|
|
import random
|
|
|
|
import sys
|
2019-08-23 12:28:57 +02:00
|
|
|
|
2019-07-01 15:39:01 +02:00
|
|
|
import bpy
|
2019-08-22 10:58:54 +02:00
|
|
|
from bpy.app.handlers import persistent
|
2019-07-01 15:39:01 +02:00
|
|
|
|
2020-03-26 14:04:47 +01:00
|
|
|
from . import environment, utils
|
2019-09-24 14:42:59 +02:00
|
|
|
|
2019-08-23 12:28:57 +02:00
|
|
|
|
2019-09-18 17:54:02 +02:00
|
|
|
# TODO: remove dependency as soon as replication will be installed as a module
|
2019-07-01 15:39:01 +02:00
|
|
|
DEPENDENCIES = {
|
2019-08-26 23:14:30 +02:00
|
|
|
("zmq","zmq"),
|
2020-04-07 18:19:17 +02:00
|
|
|
("jsondiff","jsondiff"),
|
|
|
|
("deepdiff", "deepdiff")
|
2019-07-01 15:39:01 +02:00
|
|
|
}
|
2019-05-22 18:19:11 +02:00
|
|
|
|
2019-07-02 16:43:30 +02:00
|
|
|
|
2020-02-03 19:04:08 +01:00
|
|
|
libs = os.path.dirname(os.path.abspath(__file__))+"\\libs\\replication\\replication"
|
2019-05-21 16:53:55 +02:00
|
|
|
|
2019-05-23 16:49:32 +02:00
|
|
|
def register():
|
2020-04-22 17:04:14 +02:00
|
|
|
# Setup logging policy
|
|
|
|
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
|
|
|
|
|
2019-08-05 16:48:46 +02:00
|
|
|
if libs not in sys.path:
|
|
|
|
sys.path.append(libs)
|
|
|
|
|
2020-04-17 15:28:17 +02:00
|
|
|
try:
|
2020-04-22 17:04:14 +02:00
|
|
|
environment.setup(DEPENDENCIES, bpy.app.binary_path_python)
|
2020-04-17 15:28:17 +02:00
|
|
|
except ModuleNotFoundError:
|
2020-04-22 17:04:14 +02:00
|
|
|
logging.fatal("Fail to install multi-user dependencies, try to execute blender with admin rights.")
|
|
|
|
return
|
|
|
|
|
|
|
|
from . import presence
|
|
|
|
from . import operators
|
|
|
|
from . import ui
|
|
|
|
from . import preferences
|
|
|
|
from . import addon_updater_ops
|
2019-05-15 18:37:14 +02:00
|
|
|
|
2020-03-26 14:04:47 +01:00
|
|
|
preferences.register()
|
|
|
|
addon_updater_ops.register(bl_info)
|
|
|
|
presence.register()
|
|
|
|
operators.register()
|
|
|
|
ui.register()
|
2019-05-15 14:52:45 +02:00
|
|
|
|
|
|
|
bpy.types.WindowManager.session = bpy.props.PointerProperty(
|
2020-03-26 14:04:47 +01:00
|
|
|
type=preferences.SessionProps)
|
2019-08-08 18:12:13 +02:00
|
|
|
bpy.types.ID.uuid = bpy.props.StringProperty(default="")
|
2020-01-17 18:15:37 +01:00
|
|
|
bpy.types.WindowManager.online_users = bpy.props.CollectionProperty(
|
2020-03-26 14:04:47 +01:00
|
|
|
type=preferences.SessionUser
|
2020-01-17 18:15:37 +01:00
|
|
|
)
|
|
|
|
bpy.types.WindowManager.user_index = bpy.props.IntProperty()
|
2019-09-24 13:26:51 +02:00
|
|
|
|
2019-02-07 17:41:18 +01:00
|
|
|
def unregister():
|
2019-09-27 14:50:00 +02:00
|
|
|
from . import presence
|
2019-05-15 18:37:14 +02:00
|
|
|
from . import operators
|
|
|
|
from . import ui
|
2020-02-28 17:34:30 +01:00
|
|
|
from . import preferences
|
2020-03-11 22:42:09 +01:00
|
|
|
from . import addon_updater_ops
|
2019-05-21 16:53:55 +02:00
|
|
|
|
2019-09-27 14:50:00 +02: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()
|
|
|
|
operators.unregister()
|
2020-02-28 17:34:30 +01:00
|
|
|
preferences.unregister()
|
2019-05-15 14:52:45 +02:00
|
|
|
|
2020-03-26 14:04:47 +01:00
|
|
|
del bpy.types.WindowManager.session
|
|
|
|
del bpy.types.ID.uuid
|
|
|
|
del bpy.types.WindowManager.online_users
|
|
|
|
del bpy.types.WindowManager.user_index
|