Layers: use IDProperty and override collection properties system
First this replace a custom data struct with IDProperty, and use IDProperty group merge and copying functions. Which means that a collection property setting is only created if necessary. This implements the "Layer Collection settings" override system, as suggested in the "Override Manifesto" document. The core is working, with Scene, LayerCollection and Object using a single IDProperty to store all the render settings data. Next step is to migrate this to depsgraph. Note: Clay engine "ssao_samples" was hardcoded to 32 for now. It will come back as part of "Workspace Settings" later. Many thanks for Bastien Montagne for the help with the UI template nightmare ;) Differential Revision: https://developer.blender.org/D2563
This commit is contained in:
@@ -43,27 +43,6 @@ class COLLECTION_PT_context_collection(CollectionButtonsPanel, Panel):
|
||||
layout.prop(collection, "name", text="", icon='COLLAPSEMENU')
|
||||
|
||||
|
||||
def template_engine_settings(col, settings, name, use_icon_view=False):
|
||||
icons = {
|
||||
False: 'ZOOMIN',
|
||||
True: 'X',
|
||||
}
|
||||
|
||||
use_name = "{0}_use".format(name)
|
||||
use = getattr(settings, use_name)
|
||||
|
||||
row = col.row()
|
||||
col = row.column()
|
||||
col.active = use
|
||||
|
||||
if use_icon_view:
|
||||
col.template_icon_view(settings, name)
|
||||
else:
|
||||
col.prop(settings, name)
|
||||
|
||||
row.prop(settings, "{}_use".format(name), text="", icon=icons[use], emboss=False)
|
||||
|
||||
|
||||
class COLLECTION_PT_clay_settings(CollectionButtonsPanel, Panel):
|
||||
bl_label = "Render Settings"
|
||||
COMPAT_ENGINES = {'BLENDER_CLAY'}
|
||||
@@ -75,21 +54,20 @@ class COLLECTION_PT_clay_settings(CollectionButtonsPanel, Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
scene_props = context.scene.collection_properties['BLENDER_CLAY']
|
||||
collection = context.layer_collection
|
||||
settings = collection.get_engine_settings()
|
||||
collection_props = collection.engine_overrides['BLENDER_CLAY']
|
||||
|
||||
col = layout.column()
|
||||
template_engine_settings(col, settings, "type")
|
||||
template_engine_settings(col, settings, "matcap_icon", use_icon_view=True)
|
||||
template_engine_settings(col, settings, "matcap_rotation")
|
||||
template_engine_settings(col, settings, "matcap_hue")
|
||||
template_engine_settings(col, settings, "matcap_saturation")
|
||||
template_engine_settings(col, settings, "matcap_value")
|
||||
template_engine_settings(col, settings, "ssao_factor_cavity")
|
||||
template_engine_settings(col, settings, "ssao_factor_edge")
|
||||
template_engine_settings(col, settings, "ssao_distance")
|
||||
template_engine_settings(col, settings, "ssao_attenuation")
|
||||
col.template_override_property(collection_props, scene_props, "matcap_icon", custom_template="icon_view")
|
||||
col.template_override_property(collection_props, scene_props, "matcap_rotation")
|
||||
col.template_override_property(collection_props, scene_props, "matcap_hue")
|
||||
col.template_override_property(collection_props, scene_props, "matcap_saturation")
|
||||
col.template_override_property(collection_props, scene_props, "matcap_value")
|
||||
col.template_override_property(collection_props, scene_props, "ssao_factor_cavity")
|
||||
col.template_override_property(collection_props, scene_props, "ssao_factor_edge")
|
||||
col.template_override_property(collection_props, scene_props, "ssao_distance")
|
||||
col.template_override_property(collection_props, scene_props, "ssao_attenuation")
|
||||
|
||||
|
||||
class COLLECTION_PT_object_mode_settings(CollectionButtonsPanel, Panel):
|
||||
@@ -102,13 +80,13 @@ class COLLECTION_PT_object_mode_settings(CollectionButtonsPanel, Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
scene_props = context.scene.collection_properties['ObjectMode']
|
||||
collection = context.layer_collection
|
||||
settings = collection.get_mode_settings('OBJECT')
|
||||
collection_props = collection.engine_overrides['ObjectMode']
|
||||
|
||||
col = layout.column()
|
||||
template_engine_settings(col, settings, "show_wire")
|
||||
template_engine_settings(col, settings, "show_backface_culling")
|
||||
col.template_override_property(collection_props, scene_props, "show_wire")
|
||||
col.template_override_property(collection_props, scene_props, "show_backface_culling")
|
||||
|
||||
|
||||
class COLLECTION_PT_edit_mode_settings(CollectionButtonsPanel, Panel):
|
||||
@@ -121,17 +99,17 @@ class COLLECTION_PT_edit_mode_settings(CollectionButtonsPanel, Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
scene_props = context.scene.collection_properties['EditMode']
|
||||
collection = context.layer_collection
|
||||
settings = collection.get_mode_settings('EDIT')
|
||||
collection_props = collection.engine_overrides['EditMode']
|
||||
|
||||
col = layout.column()
|
||||
template_engine_settings(col, settings, "show_occlude_wire")
|
||||
template_engine_settings(col, settings, "backwire_opacity")
|
||||
template_engine_settings(col, settings, "face_normals_show")
|
||||
template_engine_settings(col, settings, "vert_normals_show")
|
||||
template_engine_settings(col, settings, "loop_normals_show")
|
||||
template_engine_settings(col, settings, "normals_length")
|
||||
col.template_override_property(collection_props, scene_props, "show_occlude_wire")
|
||||
col.template_override_property(collection_props, scene_props, "backwire_opacity")
|
||||
col.template_override_property(collection_props, scene_props, "face_normals_show")
|
||||
col.template_override_property(collection_props, scene_props, "vert_normals_show")
|
||||
col.template_override_property(collection_props, scene_props, "loop_normals_show")
|
||||
col.template_override_property(collection_props, scene_props, "normals_length")
|
||||
|
||||
|
||||
classes = (
|
||||
|
@@ -584,23 +584,24 @@ class RENDER_PT_bake(RenderButtonsPanel, Panel):
|
||||
sub.prop(rd, "bake_user_scale", text="User Scale")
|
||||
|
||||
|
||||
class RENDER_PT_clay(RenderButtonsPanel, Panel):
|
||||
bl_label = "Default Clay"
|
||||
class RENDER_PT_clay_collection_settings(RenderButtonsPanel, Panel):
|
||||
bl_label = "Clay Collection Settings"
|
||||
COMPAT_ENGINES = {'BLENDER_CLAY'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout;
|
||||
settings = context.scene.active_engine_settings
|
||||
layout.template_icon_view(settings, "matcap_icon")
|
||||
layout.prop(settings, "matcap_rotation")
|
||||
layout.prop(settings, "matcap_hue")
|
||||
layout.prop(settings, "matcap_saturation")
|
||||
layout.prop(settings, "matcap_value")
|
||||
layout.prop(settings, "ssao_factor_cavity")
|
||||
layout.prop(settings, "ssao_factor_edge")
|
||||
layout.prop(settings, "ssao_distance")
|
||||
layout.prop(settings, "ssao_attenuation")
|
||||
layout.prop(settings, "ssao_samples")
|
||||
layout = self.layout
|
||||
props = context.scene.collection_properties['BLENDER_CLAY']
|
||||
|
||||
col = layout.column()
|
||||
col.template_icon_view(props, "matcap_icon")
|
||||
col.prop(props, "matcap_rotation")
|
||||
col.prop(props, "matcap_hue")
|
||||
col.prop(props, "matcap_saturation")
|
||||
col.prop(props, "matcap_value")
|
||||
col.prop(props, "ssao_factor_cavity")
|
||||
col.prop(props, "ssao_factor_edge")
|
||||
col.prop(props, "ssao_distance")
|
||||
col.prop(props, "ssao_attenuation")
|
||||
|
||||
|
||||
classes = (
|
||||
@@ -618,7 +619,7 @@ classes = (
|
||||
RENDER_PT_output,
|
||||
RENDER_PT_encoding,
|
||||
RENDER_PT_bake,
|
||||
RENDER_PT_clay,
|
||||
RENDER_PT_clay_collection_settings,
|
||||
)
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
|
Reference in New Issue
Block a user