feat: move clean_scene to uils

This commit is contained in:
Swann Martinez 2019-08-08 14:46:59 +02:00
parent fefa7ec13e
commit 69472328d5
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
4 changed files with 25 additions and 27 deletions

@ -1 +1 @@
Subproject commit 3765639ce901c9a9168bfe852f6c216221ac654a Subproject commit 4310938b5300caef79362d15d7614b36fc89886f

View File

@ -41,15 +41,7 @@ execution_queue = queue.Queue()
# return .1 # return .1
# def clean_scene(elements=environment.rtypes):
# for datablock in elements:
# datablock_ref = getattr(bpy.data, utils.BPY_TYPES[datablock])
# for item in datablock_ref:
# try:
# datablock_ref.remove(item)
# # Catch last scene remove
# except RuntimeError:
# pass
# def upload_client_instance_position(): # def upload_client_instance_position():
@ -94,7 +86,7 @@ def init_supported_datablocks(supported_types_id):
for type_id in supported_types_id: for type_id in supported_types_id:
for item in getattr(bpy.data,type_id): for item in getattr(bpy.data,type_id):
print(item) print(item)
client.register(item) client.add(item)
# def default_tick(): # def default_tick():
@ -139,8 +131,8 @@ class SessionStartOperator(bpy.types.Operator):
settings.save(context) settings.save(context)
# Scene setup # Scene setup
# if settings.start_empty: if settings.start_empty:
# clean_scene() utils.clean_scene()
bpy_factory = ReplicatedDataFactory() bpy_factory = ReplicatedDataFactory()
supported_bl_types = [] supported_bl_types = []

24
ui.py
View File

@ -41,8 +41,6 @@ class SESSION_PT_settings(bpy.types.Panel):
row = box.row() row = box.row()
# NETWORK SETTINGS # NETWORK SETTINGS
row = layout.row() row = layout.row()
box = row.box() box = row.box()
@ -84,16 +82,16 @@ class SESSION_PT_settings(bpy.types.Panel):
row.operator("session.start", text="CONNECT").host = False row.operator("session.start", text="CONNECT").host = False
# REPLICATION SETTINGS # REPLICATION SETTINGS
row = layout.row() # row = layout.row()
box = row.box() # box = row.box()
row = box.row() # row = box.row()
row.label(text="REPLICATION", icon='TRIA_RIGHT') # row.label(text="REPLICATION", icon='TRIA_RIGHT')
row = box.row() # row = box.row()
for item in window_manager.session.supported_datablock: # for item in window_manager.session.supported_datablock:
row.label(text=item.type_name,icon=ICONS[item.type_name]) # row.label(text=item.type_name,icon=ICONS[item.type_name])
row.prop(item, "is_replicated", text="") # row.prop(item, "is_replicated", text="")
row = box.row() # row = box.row()
@ -168,7 +166,7 @@ class SESSION_PT_user(bpy.types.Panel):
def get_client_key(item): def get_client_key(item):
return item[0] return item[0]
class SESSION_PT_properties(bpy.types.Panel): class SESSION_PT_outliner(bpy.types.Panel):
bl_idname = "MULTIUSER_PROPERTIES_PT_panel" bl_idname = "MULTIUSER_PROPERTIES_PT_panel"
bl_label = "Replicated properties" bl_label = "Replicated properties"
bl_space_type = 'VIEW_3D' bl_space_type = 'VIEW_3D'
@ -239,7 +237,7 @@ class SESSION_PT_properties(bpy.types.Panel):
classes = ( classes = (
SESSION_PT_settings, SESSION_PT_settings,
SESSION_PT_user, SESSION_PT_user,
SESSION_PT_properties, SESSION_PT_outliner,
) )

View File

@ -70,7 +70,15 @@ def get_selected_objects(scene):
return selected_objects return selected_objects
def clean_scene(elements=environment.rtypes):
for datablock in BPY_TYPES:
datablock_ref = getattr(bpy.data, BPY_TYPES[datablock])
for item in datablock_ref:
try:
datablock_ref.remove(item)
# Catch last scene remove
except RuntimeError:
pass
# LOAD HELPERS # LOAD HELPERS
def load(key, value): def load(key, value):
target = resolve_bpy_path(key) target = resolve_bpy_path(key)