feat: ground work for dynamic replicated types
This commit is contained in:
@ -78,15 +78,19 @@ def save_session_config(self,context):
|
||||
for bloc in self.supported_datablock:
|
||||
config["replicated_types"][bloc.type_name] = bloc.is_replicated
|
||||
|
||||
# config["replicated_types"] = rep_type
|
||||
# Generate ordered replicate types
|
||||
environment.genereate_replicated_types(config["replicated_types"])
|
||||
|
||||
# Save out the configuration file
|
||||
environment.save_config(config)
|
||||
|
||||
|
||||
class ReplicatedDatablock(bpy.types.PropertyGroup):
|
||||
'''name = StringProperty() '''
|
||||
type_name: bpy.props.StringProperty()
|
||||
is_replicated: bpy.props.BoolProperty()
|
||||
|
||||
|
||||
class SessionProps(bpy.types.PropertyGroup):
|
||||
username: bpy.props.StringProperty(
|
||||
name="Username",
|
||||
@ -191,9 +195,6 @@ class SessionProps(bpy.types.PropertyGroup):
|
||||
environment.save_config(config)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
classes = (
|
||||
ReplicatedDatablock,
|
||||
SessionProps
|
||||
|
@ -38,6 +38,27 @@ DEFAULT_CONFIG = {
|
||||
}
|
||||
}
|
||||
|
||||
ORDERED_TYPES = [
|
||||
'Image',
|
||||
'Texture',
|
||||
'Curve',
|
||||
'Material',
|
||||
'Light',
|
||||
'SunLight',
|
||||
'SpotLight',
|
||||
'AreaLight',
|
||||
'PointLight',
|
||||
'Camera',
|
||||
'Mesh',
|
||||
'Armature',
|
||||
'GreasePencil',
|
||||
'Object',
|
||||
'Action',
|
||||
'Collection',
|
||||
'Scene',
|
||||
]
|
||||
|
||||
rtypes = []
|
||||
|
||||
def load_config():
|
||||
try:
|
||||
@ -48,6 +69,11 @@ def load_config():
|
||||
|
||||
return DEFAULT_CONFIG
|
||||
|
||||
def genereate_replicated_types(replicated_types):
|
||||
for t in ORDERED_TYPES:
|
||||
if replicated_types[t]:
|
||||
rtypes.append(t)
|
||||
|
||||
|
||||
def save_config(config):
|
||||
logger.info("saving config")
|
||||
|
@ -11,7 +11,7 @@ from .libs import dump_anything
|
||||
|
||||
# TODO: replace hardcoded values...
|
||||
BPY_TYPES = {'Image':'images', 'Texture': 'textures','Material': 'materials', 'GreasePencil': 'grease_pencils', 'Curve': 'curves', 'Collection': 'collections', 'Mesh': 'meshes', 'Object': 'objects',
|
||||
'Scene': 'scenes', 'Light': 'lights', 'SunLight': 'lights', 'SpotLight': 'lights', 'AreaLight': 'lights', 'PointLight': 'lights', 'Camera': 'cameras', 'Action': 'actions', 'Armature': 'armatures', 'Grease Pencil': 'grease_pencils'}
|
||||
'Scene': 'scenes', 'Light': 'lights', 'SunLight': 'lights', 'SpotLight': 'lights', 'AreaLight': 'lights', 'PointLight': 'lights', 'Camera': 'cameras', 'Action': 'actions', 'Armature': 'armatures'}
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
Reference in New Issue
Block a user