feat: clean scene ui consistency

This commit is contained in:
Swann 2019-08-27 17:33:48 +02:00
parent 7e14227337
commit baa59e8b4b
5 changed files with 24 additions and 17 deletions

View File

@ -118,7 +118,7 @@ class SessionProps(bpy.types.PropertyGroup):
init_scene: bpy.props.BoolProperty(name="init_scene", default=True)
start_empty: bpy.props.BoolProperty(
name="start_empty",
default=False,
default=True,
update=save_session_config)
active_object: bpy.props.PointerProperty(
name="active_object", type=bpy.types.Object)

View File

@ -5,6 +5,7 @@ from jsondiff import diff
from .. import utils
from .bl_datablock import BlDatablock
def load_gpencil_layer(target=None, data=None, create=False):
utils.dump_anything.load(target, data)
@ -31,15 +32,16 @@ def load_gpencil_layer(target=None, data=None, create=False):
utils.dump_anything.load(tpoint, p)
class BlGpencil(BlDatablock):
def __init__(self, *args, **kwargs):
self.icon = 'GREASEPENCIL'
super().__init__( *args, **kwargs)
def construct(self,data):
super().__init__(*args, **kwargs)
def construct(self, data):
return bpy.data.grease_pencils.new(data["name"])
def load(self, data, target):
for layer in target.layers:
target.layers.remove(layer)
@ -70,19 +72,20 @@ class BlGpencil(BlDatablock):
utils.dump_datablock_attibutes(
pointer, ['layers'], 9, data)
return data
def resolve(self):
assert(self.buffer)
assert(self.buffer)
self.pointer = bpy.data.grease_pencils.get(self.buffer['name'])
def resolve_dependencies(self):
deps = []
for material in self.pointer.materials:
deps.append(material)
return deps
bl_id = "grease_pencils"
bl_class = bpy.types.GreasePencil
bl_rep_class = BlGpencil

@ -1 +1 @@
Subproject commit 0c54c24c9fdbb4e5297064a5b0311fe19eb4c2d5
Subproject commit 52ec8569b491fcd0d5699d51f337f70dbb2bc0ef

View File

@ -66,10 +66,6 @@ class SessionStartOperator(bpy.types.Operator):
# save config
settings.save(context)
# Scene setup
if settings.start_empty:
utils.clean_scene()
bpy_factory = ReplicatedDataFactory()
supported_bl_types = []
@ -92,13 +88,21 @@ class SessionStartOperator(bpy.types.Operator):
client = Session(factory=bpy_factory)
if self.host:
# Scene setup
if settings.start_empty:
utils.clean_scene()
client.host(
id=settings.username,
address=settings.ip,
port=settings.port
)
settings.is_admin = True
else:
utils.clean_scene()
client.connect(
id=settings.username,
address=settings.ip,

6
ui.py
View File

@ -83,9 +83,6 @@ class SESSION_PT_settings_network(bpy.types.Panel):
row.label(text="draw overlay:")
row.prop(settings, "enable_presence", text="")
row = layout.row()
row.label(text="clear blend:")
row.prop(settings, "start_empty", text="")
row = layout.row()
row = layout.row()
row.prop(settings, "session_mode", expand=True)
@ -94,6 +91,9 @@ class SESSION_PT_settings_network(bpy.types.Panel):
if settings.session_mode == 'HOST':
box = row.box()
row = box.row()
row.label(text="clear blend:")
row.prop(settings, "start_empty", text="")
row = box.row()
row.label(text="init scene:")
row.prop(settings, "init_scene", text="")
row = box.row()