feat: implement supported datablock

This commit is contained in:
Swann Martinez 2019-07-03 15:03:37 +02:00
parent 524c5a0813
commit 0d33c3eb3d
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
4 changed files with 15 additions and 9 deletions

View File

@ -167,8 +167,10 @@ class SessionProps(bpy.types.PropertyGroup):
if len(self.supported_datablock)>0: if len(self.supported_datablock)>0:
self.supported_datablock.clear() self.supported_datablock.clear()
for datablock,enabled in config["replicated_types"].items(): for datablock,enabled in config["replicated_types"].items():
rep_value = self.supported_datablock.add() rep_value = self.supported_datablock.add()
rep_value.name = datablock
rep_value.type_name = datablock rep_value.type_name = datablock
rep_value.is_replicated = enabled rep_value.is_replicated = enabled
@ -182,11 +184,9 @@ class SessionProps(bpy.types.PropertyGroup):
config["enable_presence"] = self.enable_presence config["enable_presence"] = self.enable_presence
config["client_color"] = [self.client_color.r,self.client_color.g,self.client_color.b] config["client_color"] = [self.client_color.r,self.client_color.g,self.client_color.b]
rep_type = {}
for bloc in self.supported_datablock:
print(bloc.type_name)
config["replicated_types"][bloc.type_name] = bloc.is_replicated
for bloc in self.supported_datablock:
config["replicated_types"][bloc.type_name] = bloc.is_replicated
environment.save_config(config) environment.save_config(config)

View File

@ -18,10 +18,15 @@ SUBPROCESS_DIR = None
DEFAULT_CONFIG = { DEFAULT_CONFIG = {
"replicated_types": { "replicated_types": {
'Client': True, 'Client': True,
'Image': True,
'Texture': True, 'Texture': True,
'Curve': True, 'Curve': True,
'Material': True, 'Material': True,
'Light': True, 'Light': True,
'SunLight': True,
'SpotLight': True,
'AreaLight': True,
'PointLight': True,
'Camera': True, 'Camera': True,
'Mesh': True, 'Mesh': True,
'Armature': True, 'Armature': True,

View File

@ -6,7 +6,7 @@ import json
import bpy import bpy
import mathutils import mathutils
from . import draw from . import draw, environment
from .libs import dump_anything from .libs import dump_anything
# TODO: replace hardcoded values... # TODO: replace hardcoded values...

View File

@ -90,10 +90,11 @@ def update_client_selected_object(context):
def init_datablocks(): def init_datablocks():
for datatype in helpers.BPY_TYPES.keys(): for datatype in helpers.BPY_TYPES.keys():
for item in getattr(bpy.data, helpers.BPY_TYPES[datatype]): if bpy.context.window_manager.session.supported_datablock[datatype].is_replicated:
item.id = bpy.context.window_manager.session.username for item in getattr(bpy.data, helpers.BPY_TYPES[datatype]):
key = "{}/{}".format(datatype, item.name) item.id = bpy.context.window_manager.session.username
client.instance.set(key) key = "{}/{}".format(datatype, item.name)
client.instance.set(key)
def default_tick(): def default_tick():