feat: auto_updater script
This commit is contained in:
parent
75839e60f0
commit
dbaff5df85
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@ __pycache__/
|
||||
cache
|
||||
config
|
||||
*.code-workspace
|
||||
multi_user_updater/
|
||||
|
||||
# sphinx build folder
|
||||
_build
|
@ -1,7 +1,7 @@
|
||||
bl_info = {
|
||||
"name": "Multi-User",
|
||||
"author": "Swann Martinez",
|
||||
"version": (0, 0, 2),
|
||||
"version": (0, 0, 1),
|
||||
"description": "Enable real-time collaborative workflow inside blender",
|
||||
"blender": (2, 80, 0),
|
||||
"location": "3D View > Sidebar > Multi-User tab",
|
||||
@ -133,6 +133,7 @@ def register():
|
||||
from . import operators
|
||||
from . import ui
|
||||
from . import preferences
|
||||
from . import addon_updater_ops
|
||||
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
@ -146,6 +147,7 @@ def register():
|
||||
bpy.types.WindowManager.user_index = bpy.props.IntProperty()
|
||||
|
||||
preferences.register()
|
||||
addon_updater_ops.register(bl_info)
|
||||
presence.register()
|
||||
operators.register()
|
||||
ui.register()
|
||||
@ -155,8 +157,10 @@ def unregister():
|
||||
from . import operators
|
||||
from . import ui
|
||||
from . import preferences
|
||||
from . import addon_updater_ops
|
||||
|
||||
presence.unregister()
|
||||
addon_updater_ops.unregister()
|
||||
ui.unregister()
|
||||
operators.unregister()
|
||||
preferences.unregister()
|
||||
|
1663
multi_user/addon_updater.py
Normal file
1663
multi_user/addon_updater.py
Normal file
File diff suppressed because it is too large
Load Diff
1454
multi_user/addon_updater_ops.py
Normal file
1454
multi_user/addon_updater_ops.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,11 @@
|
||||
import logging
|
||||
import bpy
|
||||
|
||||
from . import utils, bl_types, environment
|
||||
from . import utils, bl_types, environment, addon_updater_ops
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ReplicatedDatablock(bpy.types.PropertyGroup):
|
||||
type_name: bpy.props.StringProperty()
|
||||
bl_name: bpy.props.StringProperty()
|
||||
@ -14,8 +15,9 @@ class ReplicatedDatablock(bpy.types.PropertyGroup):
|
||||
auto_push: bpy.props.BoolProperty(default=True)
|
||||
icon: bpy.props.StringProperty()
|
||||
|
||||
|
||||
class SessionPrefs(bpy.types.AddonPreferences):
|
||||
bl_idname = __package__
|
||||
bl_idname = __package__
|
||||
|
||||
ip: bpy.props.StringProperty(
|
||||
name="ip",
|
||||
@ -33,19 +35,19 @@ class SessionPrefs(bpy.types.AddonPreferences):
|
||||
name="port",
|
||||
description='Distant host port',
|
||||
default=5555
|
||||
)
|
||||
)
|
||||
supported_datablocks: bpy.props.CollectionProperty(
|
||||
type=ReplicatedDatablock,
|
||||
)
|
||||
)
|
||||
ipc_port: bpy.props.IntProperty(
|
||||
name="ipc_port",
|
||||
description='internal ttl port(only usefull for multiple local instances)',
|
||||
default=5561
|
||||
)
|
||||
)
|
||||
start_empty: bpy.props.BoolProperty(
|
||||
name="start_empty",
|
||||
default=False
|
||||
)
|
||||
)
|
||||
right_strategy: bpy.props.EnumProperty(
|
||||
name='right_strategy',
|
||||
description='right strategy',
|
||||
@ -58,16 +60,16 @@ class SessionPrefs(bpy.types.AddonPreferences):
|
||||
subtype="DIR_PATH",
|
||||
default=environment.DEFAULT_CACHE_DIR)
|
||||
# for UI
|
||||
# category: bpy.props.EnumProperty(
|
||||
# name="Category",
|
||||
# description="Preferences Category",
|
||||
# items=[
|
||||
# ('INFO', "Information", "Information about this add-on"),
|
||||
# ('CONFIG', "Configuration", "Configuration about this add-on"),
|
||||
# ('UPDATE', "Update", "Update this add-on"),
|
||||
# ],
|
||||
# default='INFO'
|
||||
# )
|
||||
category: bpy.props.EnumProperty(
|
||||
name="Category",
|
||||
description="Preferences Category",
|
||||
items=[
|
||||
('INFO', "Information", "Information about this add-on"),
|
||||
('CONFIG', "Configuration", "Configuration about this add-on"),
|
||||
('UPDATE', "Update", "Update this add-on"),
|
||||
],
|
||||
default='INFO'
|
||||
)
|
||||
conf_session_identity_expanded: bpy.props.BoolProperty(
|
||||
name="Identity",
|
||||
description="Identity",
|
||||
@ -94,82 +96,119 @@ class SessionPrefs(bpy.types.AddonPreferences):
|
||||
default=False
|
||||
)
|
||||
|
||||
auto_check_update: bpy.props.BoolProperty(
|
||||
name="Auto-check for Update",
|
||||
description="If enabled, auto-check for updates using an interval",
|
||||
default=False,
|
||||
)
|
||||
updater_intrval_months: bpy.props.IntProperty(
|
||||
name='Months',
|
||||
description="Number of months between checking for updates",
|
||||
default=0,
|
||||
min=0
|
||||
)
|
||||
updater_intrval_days: bpy.props.IntProperty(
|
||||
name='Days',
|
||||
description="Number of days between checking for updates",
|
||||
default=7,
|
||||
min=0,
|
||||
max=31
|
||||
)
|
||||
updater_intrval_hours: bpy.props.IntProperty(
|
||||
name='Hours',
|
||||
description="Number of hours between checking for updates",
|
||||
default=0,
|
||||
min=0,
|
||||
max=23
|
||||
)
|
||||
updater_intrval_minutes: bpy.props.IntProperty(
|
||||
name='Minutes',
|
||||
description="Number of minutes between checking for updates",
|
||||
default=0,
|
||||
min=0,
|
||||
max=59
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
# layout.row().prop(self, "category", expand=True)
|
||||
layout.row().prop(self, "category", expand=True)
|
||||
|
||||
# if self.category == 'INFO':
|
||||
# layout.separator()
|
||||
# layout.label(text="Enable real-time collaborative workflow inside blender")
|
||||
# if self.category == 'CONFIG':
|
||||
grid = layout.column()
|
||||
if self.category == 'INFO':
|
||||
layout.separator()
|
||||
layout.label(text="Enable real-time collaborative workflow inside blender")
|
||||
|
||||
# USER INFORMATIONS
|
||||
box = grid.box()
|
||||
box.prop(
|
||||
self, "conf_session_identity_expanded", text="User informations",
|
||||
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_identity_expanded
|
||||
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
|
||||
if self.conf_session_identity_expanded:
|
||||
box.row().prop(self, "username", text="name")
|
||||
box.row().prop(self, "client_color", text="color")
|
||||
|
||||
# NETWORK SETTINGS
|
||||
box = grid.box()
|
||||
box.prop(
|
||||
self, "conf_session_net_expanded", text="Netorking",
|
||||
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_net_expanded
|
||||
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
|
||||
|
||||
if self.conf_session_net_expanded:
|
||||
box.row().prop(self, "ip", text="Address")
|
||||
row = box.row()
|
||||
row.label(text="Port:")
|
||||
row.prop(self, "port", text="Address")
|
||||
row = box.row()
|
||||
row.label(text="Start with an empty scene:")
|
||||
row.prop(self, "start_empty", text="")
|
||||
|
||||
table = box.box()
|
||||
table.row().prop(
|
||||
self, "conf_session_timing_expanded", text="Refresh rates",
|
||||
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_timing_expanded
|
||||
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
|
||||
if self.category == 'CONFIG':
|
||||
grid = layout.column()
|
||||
|
||||
if self.conf_session_timing_expanded:
|
||||
line = table.row()
|
||||
line.label(text=" ")
|
||||
line.separator()
|
||||
line.label(text="refresh (sec)")
|
||||
line.label(text="apply (sec)")
|
||||
# USER INFORMATIONS
|
||||
box = grid.box()
|
||||
box.prop(
|
||||
self, "conf_session_identity_expanded", text="User informations",
|
||||
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_identity_expanded
|
||||
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
|
||||
if self.conf_session_identity_expanded:
|
||||
box.row().prop(self, "username", text="name")
|
||||
box.row().prop(self, "client_color", text="color")
|
||||
|
||||
for item in self.supported_datablocks:
|
||||
line = table.row(align=True)
|
||||
line.label(text="", icon=item.icon)
|
||||
line.prop(item, "bl_delay_refresh", text="")
|
||||
line.prop(item, "bl_delay_apply", text="")
|
||||
# HOST SETTINGS
|
||||
box = grid.box()
|
||||
box.prop(
|
||||
self, "conf_session_hosting_expanded", text="Hosting",
|
||||
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_hosting_expanded
|
||||
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
|
||||
if self.conf_session_hosting_expanded:
|
||||
box.row().prop(self, "right_strategy", text="Right model")
|
||||
row = box.row()
|
||||
row.label(text="Start with an empty scene:")
|
||||
row.prop(self, "start_empty", text="")
|
||||
|
||||
# CACHE SETTINGS
|
||||
box = grid.box()
|
||||
box.prop(
|
||||
self, "conf_session_cache_expanded", text="Cache",
|
||||
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_cache_expanded
|
||||
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
|
||||
if self.conf_session_cache_expanded:
|
||||
box.row().prop(self, "cache_directory", text="Cache directory")
|
||||
# NETWORK SETTINGS
|
||||
box = grid.box()
|
||||
box.prop(
|
||||
self, "conf_session_net_expanded", text="Netorking",
|
||||
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_net_expanded
|
||||
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
|
||||
|
||||
if self.conf_session_net_expanded:
|
||||
box.row().prop(self, "ip", text="Address")
|
||||
row = box.row()
|
||||
row.label(text="Port:")
|
||||
row.prop(self, "port", text="Address")
|
||||
row = box.row()
|
||||
row.label(text="Start with an empty scene:")
|
||||
row.prop(self, "start_empty", text="")
|
||||
|
||||
table = box.box()
|
||||
table.row().prop(
|
||||
self, "conf_session_timing_expanded", text="Refresh rates",
|
||||
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_timing_expanded
|
||||
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
|
||||
|
||||
if self.conf_session_timing_expanded:
|
||||
line = table.row()
|
||||
line.label(text=" ")
|
||||
line.separator()
|
||||
line.label(text="refresh (sec)")
|
||||
line.label(text="apply (sec)")
|
||||
|
||||
for item in self.supported_datablocks:
|
||||
line = table.row(align=True)
|
||||
line.label(text="", icon=item.icon)
|
||||
line.prop(item, "bl_delay_refresh", text="")
|
||||
line.prop(item, "bl_delay_apply", text="")
|
||||
# HOST SETTINGS
|
||||
box = grid.box()
|
||||
box.prop(
|
||||
self, "conf_session_hosting_expanded", text="Hosting",
|
||||
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_hosting_expanded
|
||||
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
|
||||
if self.conf_session_hosting_expanded:
|
||||
box.row().prop(self, "right_strategy", text="Right model")
|
||||
row = box.row()
|
||||
row.label(text="Start with an empty scene:")
|
||||
row.prop(self, "start_empty", text="")
|
||||
|
||||
# CACHE SETTINGS
|
||||
box = grid.box()
|
||||
box.prop(
|
||||
self, "conf_session_cache_expanded", text="Cache",
|
||||
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_cache_expanded
|
||||
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
|
||||
if self.conf_session_cache_expanded:
|
||||
box.row().prop(self, "cache_directory", text="Cache directory")
|
||||
|
||||
if self.category == 'UPDATE':
|
||||
from . import addon_updater_ops
|
||||
addon_updater_ops.update_settings_ui_condensed(self, context)
|
||||
|
||||
def generate_supported_types(self):
|
||||
self.supported_datablocks.clear()
|
||||
@ -181,19 +220,22 @@ class SessionPrefs(bpy.types.AddonPreferences):
|
||||
type_impl_name = "Bl{}".format(type.split('_')[1].capitalize())
|
||||
type_module_class = getattr(type_module, type_impl_name)
|
||||
|
||||
new_db.name = type_impl_name
|
||||
new_db.name = type_impl_name
|
||||
new_db.type_name = type_impl_name
|
||||
new_db.bl_delay_refresh = type_module_class.bl_delay_refresh
|
||||
new_db.bl_delay_apply =type_module_class.bl_delay_apply
|
||||
new_db.bl_delay_apply = type_module_class.bl_delay_apply
|
||||
new_db.use_as_filter = True
|
||||
new_db.icon = type_module_class.bl_icon
|
||||
new_db.auto_push =type_module_class.bl_automatic_push
|
||||
new_db.bl_name=type_module_class.bl_id
|
||||
new_db.auto_push = type_module_class.bl_automatic_push
|
||||
new_db.bl_name = type_module_class.bl_id
|
||||
|
||||
|
||||
classes = (
|
||||
ReplicatedDatablock,
|
||||
SessionPrefs,
|
||||
)
|
||||
|
||||
|
||||
def register():
|
||||
from bpy.utils import register_class
|
||||
|
||||
@ -205,8 +247,9 @@ def register():
|
||||
logger.info('Generating bl_types preferences')
|
||||
prefs.generate_supported_types()
|
||||
|
||||
|
||||
def unregister():
|
||||
from bpy.utils import unregister_class
|
||||
|
||||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
unregister_class(cls)
|
||||
|
Loading…
Reference in New Issue
Block a user