feat: modifiers support
This commit is contained in:
@ -81,7 +81,7 @@ def save_session_config(self,context):
|
|||||||
config["replicated_types"][bloc.type_name] = bloc.is_replicated
|
config["replicated_types"][bloc.type_name] = bloc.is_replicated
|
||||||
|
|
||||||
# Generate ordered replicate types
|
# Generate ordered replicate types
|
||||||
environment.genereate_replicated_types(config["replicated_types"])
|
environment.genererate_replicated_types()
|
||||||
|
|
||||||
# Save out the configuration file
|
# Save out the configuration file
|
||||||
environment.save_config(config)
|
environment.save_config(config)
|
||||||
|
@ -82,9 +82,11 @@ def get_replicated_types():
|
|||||||
|
|
||||||
return tlist
|
return tlist
|
||||||
|
|
||||||
def genereate_replicated_types(replicated_types):
|
def genererate_replicated_types():
|
||||||
rtypes.clear()
|
rtypes.clear()
|
||||||
|
|
||||||
|
cfg = load_config()
|
||||||
|
replicated_types = cfg['replicated_types']
|
||||||
for t in ORDERED_TYPES:
|
for t in ORDERED_TYPES:
|
||||||
if replicated_types[t]:
|
if replicated_types[t]:
|
||||||
rtypes.append(t)
|
rtypes.append(t)
|
||||||
|
26
helpers.py
26
helpers.py
@ -71,9 +71,6 @@ def get_selected_objects(scene):
|
|||||||
|
|
||||||
# LOAD HELPERS
|
# LOAD HELPERS
|
||||||
|
|
||||||
# def load_color(color_dict, target_color_attribute):
|
|
||||||
# target_color_attribute
|
|
||||||
|
|
||||||
def load_dict(src_dict, target):
|
def load_dict(src_dict, target):
|
||||||
try:
|
try:
|
||||||
for item in src_dict:
|
for item in src_dict:
|
||||||
@ -96,7 +93,7 @@ def load(key, value):
|
|||||||
if target_type == 'Object':
|
if target_type == 'Object':
|
||||||
load_object(target=target, data=value,
|
load_object(target=target, data=value,
|
||||||
create=True)
|
create=True)
|
||||||
if target_type == 'Image':
|
elif target_type == 'Image':
|
||||||
load_image(target=target, data=value)
|
load_image(target=target, data=value)
|
||||||
elif target_type == 'Mesh':
|
elif target_type == 'Mesh':
|
||||||
load_mesh(target=target, data=value,
|
load_mesh(target=target, data=value,
|
||||||
@ -337,6 +334,21 @@ def load_object(target=None, data=None, create=False):
|
|||||||
|
|
||||||
client = bpy.context.window_manager.session.username
|
client = bpy.context.window_manager.session.username
|
||||||
|
|
||||||
|
# Load modifiers
|
||||||
|
if hasattr(target,'modifiers'):
|
||||||
|
for local_modifier in target.modifiers:
|
||||||
|
if local_modifier.name not in data['modifiers']:
|
||||||
|
target.modifiers.remove(local_modifier)
|
||||||
|
for modifier in data['modifiers']:
|
||||||
|
target_modifier = target.modifiers.get(modifier)
|
||||||
|
|
||||||
|
if not target_modifier:
|
||||||
|
target_modifier = target.modifiers.new(data['modifiers'][modifier]['name'],data['modifiers'][modifier]['type'])
|
||||||
|
|
||||||
|
dump_anything.load(target_modifier, data['modifiers'][modifier])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if target.id == client or target.id == "Common":
|
if target.id == client or target.id == "Common":
|
||||||
target.hide_select = False
|
target.hide_select = False
|
||||||
else:
|
else:
|
||||||
@ -615,8 +627,6 @@ def load_default(target=None, data=None, create=False, type=None):
|
|||||||
logger.error("default loading error {}".format(e))
|
logger.error("default loading error {}".format(e))
|
||||||
|
|
||||||
# DUMP HELPERS
|
# DUMP HELPERS
|
||||||
|
|
||||||
|
|
||||||
def dump(key):
|
def dump(key):
|
||||||
target = resolve_bpy_path(key)
|
target = resolve_bpy_path(key)
|
||||||
target_type = key.split('/')[0]
|
target_type = key.split('/')[0]
|
||||||
@ -667,6 +677,10 @@ def dump(key):
|
|||||||
# "radius_interpolation", "resolution_v", "use_bezier_u", "use_bezier_v", "use_cyclic_u", "use_cyclic_v", "use_endpoint_u", "use_endpoint_v"], 3)
|
# "radius_interpolation", "resolution_v", "use_bezier_u", "use_bezier_v", "use_cyclic_u", "use_cyclic_v", "use_endpoint_u", "use_endpoint_v"], 3)
|
||||||
elif target_type == 'Object':
|
elif target_type == 'Object':
|
||||||
data = dump_datablock(target, 1)
|
data = dump_datablock(target, 1)
|
||||||
|
|
||||||
|
if hasattr(target,'modifiers'):
|
||||||
|
dump_datablock_attibutes(
|
||||||
|
target, ['modifiers'], 3, data)
|
||||||
elif target_type == 'Collection':
|
elif target_type == 'Collection':
|
||||||
data = dump_datablock(target, 4)
|
data = dump_datablock(target, 4)
|
||||||
elif target_type == 'Scene':
|
elif target_type == 'Scene':
|
||||||
|
@ -90,6 +90,7 @@ def update_client_selected_object(context):
|
|||||||
|
|
||||||
|
|
||||||
def init_datablocks():
|
def init_datablocks():
|
||||||
|
environment.genererate_replicated_types()
|
||||||
for datatype in environment.rtypes:
|
for datatype in environment.rtypes:
|
||||||
if bpy.context.window_manager.session.supported_datablock[datatype].is_replicated:
|
if bpy.context.window_manager.session.supported_datablock[datatype].is_replicated:
|
||||||
logger.debug("INIT: {}".format(datatype))
|
logger.debug("INIT: {}".format(datatype))
|
||||||
|
Reference in New Issue
Block a user