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 = {
|
2019-07-01 21:39:01 +08:00
|
|
|
"name": "Multi-User",
|
2019-10-22 22:37:23 +08:00
|
|
|
"author": "Swann Martinez",
|
2021-04-23 17:46:29 +08:00
|
|
|
"version": (0, 4, 0),
|
2020-02-28 06:15:31 +08:00
|
|
|
"description": "Enable real-time collaborative workflow inside blender",
|
2020-07-27 23:44:27 +08:00
|
|
|
"blender": (2, 82, 0),
|
2020-02-28 06:15:31 +08:00
|
|
|
"location": "3D View > Sidebar > Multi-User tab",
|
2019-09-18 23:54:02 +08:00
|
|
|
"warning": "Unstable addon, use it at your own risks",
|
2020-02-28 06:15:31 +08:00
|
|
|
"category": "Collaboration",
|
2020-03-12 20:25:13 +08:00
|
|
|
"doc_url": "https://multi-user.readthedocs.io/en/develop/index.html",
|
2020-02-28 06:15:31 +08: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-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
|
2019-07-01 21:39:01 +08:00
|
|
|
import random
|
|
|
|
import sys
|
2019-08-23 18:28:57 +08:00
|
|
|
|
2019-07-01 21:39:01 +08:00
|
|
|
import bpy
|
2019-08-22 16:58:54 +08:00
|
|
|
from bpy.app.handlers import persistent
|
2019-07-01 21:39:01 +08:00
|
|
|
|
2020-10-06 15:45:13 +08:00
|
|
|
from . import environment
|
2019-09-24 20:42:59 +08:00
|
|
|
|
2019-08-23 18:28:57 +08:00
|
|
|
|
2019-07-01 21:39:01 +08:00
|
|
|
DEPENDENCIES = {
|
2021-06-03 05:10:13 +08:00
|
|
|
("replication", '0.1.36'),
|
2019-07-01 21:39:01 +08:00
|
|
|
}
|
2019-05-23 00:19:11 +08:00
|
|
|
|
2019-07-02 22:43:30 +08:00
|
|
|
|
2020-09-25 17:23:36 +08:00
|
|
|
module_error_msg = "Insufficient rights to install the multi-user \
|
|
|
|
dependencies, aunch blender with administrator rights."
|
2019-05-23 22:49:32 +08:00
|
|
|
def register():
|
2020-04-22 23:04:14 +08:00
|
|
|
# Setup logging policy
|
2020-09-15 18:31:46 +08:00
|
|
|
logging.basicConfig(
|
|
|
|
format='%(asctime)s CLIENT %(levelname)-8s %(message)s',
|
|
|
|
datefmt='%H:%M:%S',
|
|
|
|
level=logging.INFO)
|
2020-07-10 22:50:09 +08:00
|
|
|
|
2020-04-17 21:28:17 +08:00
|
|
|
try:
|
2020-11-26 01:20:28 +08:00
|
|
|
if bpy.app.version[1] >= 91:
|
|
|
|
python_binary_path = sys.executable
|
|
|
|
else:
|
|
|
|
python_binary_path = bpy.app.binary_path_python
|
|
|
|
|
|
|
|
environment.setup(DEPENDENCIES, python_binary_path)
|
2019-05-15 20:52:45 +08:00
|
|
|
|
2020-09-25 17:23:36 +08:00
|
|
|
from . import presence
|
|
|
|
from . import operators
|
|
|
|
from . import ui
|
|
|
|
from . import preferences
|
|
|
|
from . import addon_updater_ops
|
|
|
|
|
|
|
|
preferences.register()
|
|
|
|
addon_updater_ops.register(bl_info)
|
|
|
|
presence.register()
|
|
|
|
operators.register()
|
|
|
|
ui.register()
|
|
|
|
except ModuleNotFoundError as e:
|
|
|
|
raise Exception(module_error_msg)
|
|
|
|
logging.error(module_error_msg)
|
|
|
|
|
2019-05-15 20:52:45 +08:00
|
|
|
bpy.types.WindowManager.session = bpy.props.PointerProperty(
|
2020-03-26 21:04:47 +08:00
|
|
|
type=preferences.SessionProps)
|
2020-06-10 00:02:53 +08:00
|
|
|
bpy.types.ID.uuid = bpy.props.StringProperty(
|
|
|
|
default="",
|
|
|
|
options={'HIDDEN', 'SKIP_SAVE'})
|
2020-01-18 01:15:37 +08:00
|
|
|
bpy.types.WindowManager.online_users = bpy.props.CollectionProperty(
|
2020-03-26 21:04:47 +08:00
|
|
|
type=preferences.SessionUser
|
2020-01-18 01:15:37 +08:00
|
|
|
)
|
|
|
|
bpy.types.WindowManager.user_index = bpy.props.IntProperty()
|
2020-12-16 18:05:58 +08:00
|
|
|
bpy.types.TOPBAR_MT_file_import.append(operators.menu_func_import)
|
|
|
|
|
2019-09-24 19:26:51 +08:00
|
|
|
|
2019-02-08 00:41:18 +08:00
|
|
|
def unregister():
|
2019-09-27 20:50:00 +08:00
|
|
|
from . import presence
|
2019-05-16 00:37:14 +08:00
|
|
|
from . import operators
|
|
|
|
from . import ui
|
2020-02-29 00:34:30 +08:00
|
|
|
from . import preferences
|
2020-03-12 05:42:09 +08:00
|
|
|
from . import addon_updater_ops
|
2019-05-21 22:53:55 +08:00
|
|
|
|
2020-12-16 18:05:58 +08:00
|
|
|
bpy.types.TOPBAR_MT_file_import.remove(operators.menu_func_import)
|
|
|
|
|
2019-09-27 20:50:00 +08:00
|
|
|
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()
|
2020-02-29 00:34:30 +08:00
|
|
|
preferences.unregister()
|
2019-05-15 20:52:45 +08:00
|
|
|
|
2020-03-26 21:04:47 +08:00
|
|
|
del bpy.types.WindowManager.session
|
|
|
|
del bpy.types.ID.uuid
|
|
|
|
del bpy.types.WindowManager.online_users
|
|
|
|
del bpy.types.WindowManager.user_index
|