Collections: remove per collection and view layer engine overrides.

This will be handled by the new view layer override system which will
store data elsewhere, removing the code already for easier refactoring.
This commit is contained in:
Brecht Van Lommel 2018-05-08 15:57:20 +02:00
parent 03dd109a84
commit e6d11c6ce6
24 changed files with 36 additions and 958 deletions

@ -59,36 +59,8 @@ class COLLECTION_PT_context_collection(CollectionButtonsPanel, Panel):
layout.prop(collection, "name", text="", icon='COLLAPSEMENU')
class COLLECTION_PT_clay_settings(CollectionButtonsPanel, Panel):
bl_label = "Render Settings"
COMPAT_ENGINES = {'BLENDER_CLAY'}
@classmethod
def poll(cls, context):
return context.engine in cls.COMPAT_ENGINES
def draw(self, context):
layout = self.layout
scene_props = context.scene.collection_properties['BLENDER_CLAY']
collection = get_collection_from_context(context)
collection_props = collection.engine_overrides['BLENDER_CLAY']
col = layout.column()
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")
col.template_override_property(collection_props, scene_props, "hair_brightness_randomness")
classes = (
COLLECTION_PT_context_collection,
COLLECTION_PT_clay_settings,
)
if __name__ == "__main__": # only for live edit.

@ -47,316 +47,6 @@ class VIEWLAYER_PT_layer(ViewLayerButtonsPanel, Panel):
layout.prop(rd, "use_single_layer", text="Render Single Layer")
class VIEWLAYER_PT_clay_settings(ViewLayerButtonsPanel, Panel):
bl_label = "Render Settings"
COMPAT_ENGINES = {'BLENDER_CLAY'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_CLAY']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_CLAY']
col = layout.column()
col.template_override_property(layer_props, scene_props, "ssao_samples")
class VIEWLAYER_PT_eevee_ambient_occlusion(ViewLayerButtonsPanel, Panel):
bl_label = "Ambient Occlusion"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
self.layout.template_override_property(layer_props, scene_props, "gtao_enable", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "gtao_use_bent_normals")
col.template_override_property(layer_props, scene_props, "gtao_bounce")
col.template_override_property(layer_props, scene_props, "gtao_distance")
col.template_override_property(layer_props, scene_props, "gtao_factor")
col.template_override_property(layer_props, scene_props, "gtao_quality")
class VIEWLAYER_PT_eevee_motion_blur(ViewLayerButtonsPanel, Panel):
bl_label = "Motion Blur"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
self.layout.template_override_property(layer_props, scene_props, "motion_blur_enable", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "motion_blur_samples")
col.template_override_property(layer_props, scene_props, "motion_blur_shutter")
class VIEWLAYER_PT_eevee_depth_of_field(ViewLayerButtonsPanel, Panel):
bl_label = "Depth Of Field"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
self.layout.template_override_property(layer_props, scene_props, "dof_enable", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "bokeh_max_size")
col.template_override_property(layer_props, scene_props, "bokeh_threshold")
class VIEWLAYER_PT_eevee_bloom(ViewLayerButtonsPanel, Panel):
bl_label = "Bloom"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
self.layout.template_override_property(layer_props, scene_props, "bloom_enable", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "bloom_threshold")
col.template_override_property(layer_props, scene_props, "bloom_knee")
col.template_override_property(layer_props, scene_props, "bloom_radius")
col.template_override_property(layer_props, scene_props, "bloom_color")
col.template_override_property(layer_props, scene_props, "bloom_intensity")
col.template_override_property(layer_props, scene_props, "bloom_clamp")
class VIEWLAYER_PT_eevee_volumetric(ViewLayerButtonsPanel, Panel):
bl_label = "Volumetric"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
self.layout.template_override_property(layer_props, scene_props, "volumetric_enable", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "volumetric_start")
col.template_override_property(layer_props, scene_props, "volumetric_end")
col.template_override_property(layer_props, scene_props, "volumetric_tile_size")
col.template_override_property(layer_props, scene_props, "volumetric_samples")
col.template_override_property(layer_props, scene_props, "volumetric_sample_distribution")
col.template_override_property(layer_props, scene_props, "volumetric_lights")
col.template_override_property(layer_props, scene_props, "volumetric_light_clamp")
col.template_override_property(layer_props, scene_props, "volumetric_shadows")
col.template_override_property(layer_props, scene_props, "volumetric_shadow_samples")
col.template_override_property(layer_props, scene_props, "volumetric_colored_transmittance")
class VIEWLAYER_PT_eevee_subsurface_scattering(ViewLayerButtonsPanel, Panel):
bl_label = "Subsurface Scattering"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
self.layout.template_override_property(layer_props, scene_props, "sss_enable", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "sss_samples")
col.template_override_property(layer_props, scene_props, "sss_jitter_threshold")
col.template_override_property(layer_props, scene_props, "sss_separate_albedo")
class VIEWLAYER_PT_eevee_screen_space_reflections(ViewLayerButtonsPanel, Panel):
bl_label = "Screen Space Reflections"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
self.layout.template_override_property(layer_props, scene_props, "ssr_enable", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "ssr_halfres")
col.template_override_property(layer_props, scene_props, "ssr_refraction")
col.template_override_property(layer_props, scene_props, "ssr_quality")
col.template_override_property(layer_props, scene_props, "ssr_max_roughness")
col.template_override_property(layer_props, scene_props, "ssr_thickness")
col.template_override_property(layer_props, scene_props, "ssr_border_fade")
col.template_override_property(layer_props, scene_props, "ssr_firefly_fac")
class VIEWLAYER_PT_eevee_shadows(ViewLayerButtonsPanel, Panel):
bl_label = "Shadows"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "shadow_method")
col.template_override_property(layer_props, scene_props, "shadow_cube_size")
col.template_override_property(layer_props, scene_props, "shadow_cascade_size")
col.template_override_property(layer_props, scene_props, "shadow_high_bitdepth")
class VIEWLAYER_PT_eevee_sampling(ViewLayerButtonsPanel, Panel):
bl_label = "Sampling"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "taa_samples")
col.template_override_property(layer_props, scene_props, "taa_render_samples")
col.template_override_property(layer_props, scene_props, "taa_reprojection")
class VIEWLAYER_PT_eevee_indirect_lighting(ViewLayerButtonsPanel, Panel):
bl_label = "Indirect Lighting"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
@classmethod
def poll(cls, context):
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
scene = context.scene
scene_props = scene.layer_properties['BLENDER_EEVEE']
layer = bpy.context.view_layer
layer_props = layer.engine_overrides['BLENDER_EEVEE']
col = layout.column()
col.template_override_property(layer_props, scene_props, "gi_diffuse_bounces")
col.template_override_property(layer_props, scene_props, "gi_cubemap_resolution")
col.template_override_property(layer_props, scene_props, "gi_visibility_resolution")
class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel):
bl_label = "Passes"
bl_options = {'DEFAULT_CLOSED'}
@ -388,17 +78,6 @@ class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel):
classes = (
VIEWLAYER_PT_layer,
VIEWLAYER_PT_clay_settings,
VIEWLAYER_PT_eevee_sampling,
VIEWLAYER_PT_eevee_shadows,
VIEWLAYER_PT_eevee_indirect_lighting,
VIEWLAYER_PT_eevee_subsurface_scattering,
VIEWLAYER_PT_eevee_screen_space_reflections,
VIEWLAYER_PT_eevee_ambient_occlusion,
VIEWLAYER_PT_eevee_volumetric,
VIEWLAYER_PT_eevee_motion_blur,
VIEWLAYER_PT_eevee_depth_of_field,
VIEWLAYER_PT_eevee_bloom,
VIEWLAYER_PT_eevee_layer_passes,
)

@ -135,22 +135,17 @@ void BKE_override_layer_collection_boolean_add(struct LayerCollection *layer_col
/* engine settings */
typedef void (*EngineSettingsCB)(struct RenderEngine *engine, struct IDProperty *props);
struct IDProperty *BKE_layer_collection_engine_evaluated_get(struct Object *ob, const char *engine_name);
struct IDProperty *BKE_layer_collection_engine_collection_get(struct LayerCollection *lc, const char *engine_name);
struct IDProperty *BKE_layer_collection_engine_scene_get(struct Scene *scene, const char *engine_name);
void BKE_layer_collection_engine_settings_callback_register(struct Main *bmain, const char *engine_name, EngineSettingsCB func);
void BKE_layer_collection_engine_settings_callback_free(void);
void BKE_layer_collection_engine_settings_create(struct IDProperty *root);
void BKE_layer_collection_engine_settings_validate_scene(struct Scene *scene);
void BKE_layer_collection_engine_settings_validate_collection(struct LayerCollection *lc);
struct IDProperty *BKE_view_layer_engine_evaluated_get(struct ViewLayer *view_layer, const char *engine_name);
struct IDProperty *BKE_view_layer_engine_layer_get(struct ViewLayer *view_layer, const char *engine_name);
struct IDProperty *BKE_view_layer_engine_scene_get(struct Scene *scene, const char *engine_name);
void BKE_view_layer_engine_settings_callback_register(struct Main *bmain, const char *engine_name, EngineSettingsCB func);
void BKE_view_layer_engine_settings_callback_free(void);
void BKE_view_layer_engine_settings_validate_scene(struct Scene *scene);
void BKE_view_layer_engine_settings_validate_layer(struct ViewLayer *view_layer);
void BKE_view_layer_engine_settings_create(struct IDProperty *root);
void BKE_collection_engine_property_add_float(struct IDProperty *props, const char *name, float value);

@ -425,17 +425,6 @@ void BKE_collection_object_add_from(Scene *scene, Object *ob_src, Object *ob_dst
}
}
FOREACH_SCENE_COLLECTION_END;
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
Base *base_src = BKE_view_layer_base_find(view_layer, ob_src);
if (base_src != NULL) {
if (base_src->collection_properties == NULL) {
continue;
}
Base *base_dst = BKE_view_layer_base_find(view_layer, ob_dst);
IDP_MergeGroup(base_dst->collection_properties, base_src->collection_properties, true);
}
}
}
/**
@ -572,9 +561,6 @@ static void layer_collection_sync(LayerCollection *lc_dst, LayerCollection *lc_s
{
lc_dst->flag = lc_src->flag;
/* Pending: sync overrides. */
IDP_MergeGroup(lc_dst->properties, lc_src->properties, true);
/* Continue recursively. */
LayerCollection *lc_dst_nested, *lc_src_nested;
lc_src_nested = lc_src->layer_collections.first;

@ -133,12 +133,9 @@ static ViewLayer *view_layer_add(const char *name, SceneCollection *master_scene
name = DATA_("View Layer");
}
IDPropertyTemplate val = {0};
ViewLayer *view_layer = MEM_callocN(sizeof(ViewLayer), "View Layer");
view_layer->flag = VIEW_LAYER_RENDER | VIEW_LAYER_FREESTYLE;
view_layer->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
layer_engine_settings_init(view_layer->properties, false);
BLI_strncpy_utf8(view_layer->name, name, sizeof(view_layer->name));
/* Link the master collection by default. */
@ -196,12 +193,6 @@ void BKE_view_layer_free_ex(ViewLayer *view_layer, const bool do_id_user)
{
view_layer->basact = NULL;
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
if (base->collection_properties) {
IDP_FreeProperty(base->collection_properties);
MEM_freeN(base->collection_properties);
}
}
BLI_freelistN(&view_layer->object_bases);
for (LayerCollection *lc = view_layer->layer_collections.first; lc; lc = lc->next) {
@ -209,11 +200,6 @@ void BKE_view_layer_free_ex(ViewLayer *view_layer, const bool do_id_user)
}
BLI_freelistN(&view_layer->layer_collections);
if (view_layer->properties) {
IDP_FreeProperty(view_layer->properties);
MEM_freeN(view_layer->properties);
}
if (view_layer->properties_evaluated) {
IDP_FreeProperty(view_layer->properties_evaluated);
MEM_freeN(view_layer->properties_evaluated);
@ -382,15 +368,6 @@ static void layer_collection_sync_flags(
{
layer_collection_dst->flag = layer_collection_src->flag;
if (layer_collection_dst->properties != NULL) {
IDP_FreeProperty(layer_collection_dst->properties);
MEM_SAFE_FREE(layer_collection_dst->properties);
}
if (layer_collection_src->properties != NULL) {
layer_collection_dst->properties = IDP_CopyProperty(layer_collection_src->properties);
}
layer_collections_sync_flags(&layer_collection_dst->layer_collections,
&layer_collection_src->layer_collections);
}
@ -492,8 +469,6 @@ void BKE_view_layer_copy_data(
ViewLayer *view_layer_dst, ViewLayer *view_layer_src, SceneCollection *mc_dst, SceneCollection *mc_src,
const int flag)
{
IDPropertyTemplate val = {0};
if (view_layer_dst->id_properties != NULL) {
view_layer_dst->id_properties = IDP_CopyProperty_ex(view_layer_dst->id_properties, flag);
}
@ -501,8 +476,6 @@ void BKE_view_layer_copy_data(
view_layer_dst->stats = NULL;
view_layer_dst->properties_evaluated = NULL;
view_layer_dst->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
IDP_MergeGroup_ex(view_layer_dst->properties, view_layer_src->properties, true, flag);
/* we start fresh with no overrides and no visibility flags set
* instead of syncing both trees we simply unlink and relink the scene collection */
@ -613,11 +586,6 @@ static void view_layer_object_base_unref(ViewLayer *view_layer, Base *base)
view_layer->basact = NULL;
}
if (base->collection_properties) {
IDP_FreeProperty(base->collection_properties);
MEM_freeN(base->collection_properties);
}
BLI_remlink(&view_layer->object_bases, base);
MEM_freeN(base);
}
@ -638,9 +606,6 @@ static Base *object_base_add(ViewLayer *view_layer, Object *ob)
/* Do not bump user count, leave it for SceneCollections. */
base->object = ob;
BLI_addtail(&view_layer->object_bases, base);
IDPropertyTemplate val = {0};
base->collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
}
base->refcount++;
@ -667,17 +632,6 @@ static void layer_collection_objects_unpopulate(ViewLayer *view_layer, LayerColl
static void layer_collection_free(ViewLayer *view_layer, LayerCollection *lc)
{
layer_collection_objects_unpopulate(view_layer, lc);
BLI_freelistN(&lc->overrides);
if (lc->properties) {
IDP_FreeProperty(lc->properties);
MEM_freeN(lc->properties);
}
if (lc->properties_evaluated) {
IDP_FreeProperty(lc->properties_evaluated);
MEM_freeN(lc->properties_evaluated);
}
for (LayerCollection *nlc = lc->layer_collections.first; nlc; nlc = nlc->next) {
layer_collection_free(view_layer, nlc);
@ -1284,15 +1238,11 @@ static void layer_collection_populate(ViewLayer *view_layer, LayerCollection *lc
static LayerCollection *layer_collection_add(ViewLayer *view_layer, LayerCollection *parent, SceneCollection *sc)
{
IDPropertyTemplate val = {0};
LayerCollection *lc = MEM_callocN(sizeof(LayerCollection), "Collection Base");
lc->scene_collection = sc;
lc->flag = COLLECTION_SELECTABLE | COLLECTION_VIEWPORT | COLLECTION_RENDER;
lc->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
collection_engine_settings_init(lc->properties, false);
if (parent != NULL) {
BLI_addtail(&parent->layer_collections, lc);
}
@ -1476,30 +1426,10 @@ static void create_view_layer_engine_settings_scene(Scene *scene, EngineSettings
create_engine_settings_scene(scene->layer_properties, es_type);
}
static void create_layer_collection_engine_settings_collection(LayerCollection *lc, EngineSettingsCB_Type *es_type)
{
if (BKE_layer_collection_engine_collection_get(lc, es_type->name)) {
return;
}
IDProperty *props = collection_engine_settings_create(es_type, false);
IDP_AddToGroup(lc->properties, props);
for (LayerCollection *lcn = lc->layer_collections.first; lcn; lcn = lcn->next) {
create_layer_collection_engine_settings_collection(lcn, es_type);
}
}
static void create_layer_collection_engines_settings_scene(Scene *scene, EngineSettingsCB_Type *es_type)
{
/* Populate the scene with the new settings. */
create_layer_collection_engine_settings_scene(scene, es_type);
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
for (LayerCollection *lc = view_layer->layer_collections.first; lc; lc = lc->next) {
create_layer_collection_engine_settings_collection(lc, es_type);
}
}
}
static void create_view_layer_engines_settings_scene(Scene *scene, EngineSettingsCB_Type *es_type)
@ -1508,16 +1438,6 @@ static void create_view_layer_engines_settings_scene(Scene *scene, EngineSetting
create_view_layer_engine_settings_scene(scene, es_type);
}
static void create_view_layer_engines_settings_layer(ViewLayer *view_layer, EngineSettingsCB_Type *es_type)
{
if (BKE_view_layer_engine_layer_get(view_layer, es_type->name)) {
return;
}
IDProperty *props = collection_engine_settings_create(es_type, false);
IDP_AddToGroup(view_layer->properties, props);
}
static EngineSettingsCB_Type *engine_settings_callback_register(const char *engine_name, EngineSettingsCB func, ListBase *lb)
{
EngineSettingsCB_Type *es_type;
@ -1562,10 +1482,6 @@ void BKE_view_layer_engine_settings_callback_register(
/* Populate all of the collections of the scene with those settings. */
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
create_view_layer_engines_settings_scene(scene, es_type);
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
create_view_layer_engines_settings_layer(view_layer, es_type);
}
}
}
}
@ -1627,21 +1543,6 @@ static IDProperty *collection_engine_get(IDProperty *root, const char *engine_na
return IDP_GetPropertyFromGroup(root, engine_name);
}
/**
* Return collection engine settings from Object for specified engine of mode
*/
IDProperty *BKE_layer_collection_engine_evaluated_get(Object *ob, const char *engine_name)
{
return collection_engine_get(ob->base_collection_properties, engine_name);
}
/**
* Return layer collection engine settings for specified engine
*/
IDProperty *BKE_layer_collection_engine_collection_get(LayerCollection *lc, const char *engine_name)
{
return collection_engine_get(lc->properties, engine_name);
}
/**
* Return layer collection engine settings for specified engine in the scene
*/
@ -1658,14 +1559,6 @@ IDProperty *BKE_view_layer_engine_scene_get(Scene *scene, const char *engine_nam
return collection_engine_get(scene->layer_properties, engine_name);
}
/**
* Return scene layer engine settings for specified engine
*/
IDProperty *BKE_view_layer_engine_layer_get(ViewLayer *view_layer, const char *engine_name)
{
return collection_engine_get(view_layer->properties, engine_name);
}
/**
* Return scene layer evaluated engine settings for specified engine
*/
@ -1882,19 +1775,6 @@ void BKE_layer_collection_engine_settings_validate_scene(Scene *scene)
}
}
/**
* Maker sure LayerCollection has all required collection settings.
*/
void BKE_layer_collection_engine_settings_validate_collection(LayerCollection *lc)
{
if (root_reference.layer_collection == NULL) {
engine_settings_validate_init();
}
BLI_assert(lc->properties != NULL);
IDP_MergeGroup(lc->properties, root_reference.layer_collection, false);
}
/**
* Make sure Scene has all required collection settings.
*/
@ -1914,18 +1794,6 @@ void BKE_view_layer_engine_settings_validate_scene(Scene *scene)
}
}
/**
* Make sure Scene has all required collection settings.
*/
void BKE_view_layer_engine_settings_validate_layer(ViewLayer *view_layer)
{
if (root_reference.view_layer == NULL) {
engine_settings_validate_init();
}
IDP_MergeGroup(view_layer->properties, root_reference.view_layer, false);
}
/** \} */
/* Iterators */
@ -2249,12 +2117,16 @@ static void layer_eval_layer_collection_pre(Depsgraph *depsgraph, ID *owner_id,
for (Base *base = view_layer->object_bases.first; base != NULL; base = base->next) {
base->flag &= ~(BASE_VISIBLED | BASE_SELECTABLED);
idproperty_reset(&base->collection_properties, scene ? scene->collection_properties : NULL);
}
/* Sync properties from scene to scene layer. */
idproperty_reset(&view_layer->properties_evaluated, scene ? scene->layer_properties : NULL);
IDP_MergeGroup(view_layer->properties_evaluated, view_layer->properties, true);
if (scene) {
idproperty_reset(&view_layer->properties_evaluated, scene->layer_properties);
IDP_MergeGroup(view_layer->properties_evaluated, scene->collection_properties, true);
}
else {
idproperty_reset(&view_layer->properties_evaluated, NULL);
}
/* TODO(sergey): Is it always required? */
view_layer->flag |= VIEW_LAYER_ENGINE_DIRTY;
@ -2318,22 +2190,10 @@ static void layer_eval_layer_collection(Depsgraph *depsgraph,
const bool is_visible = layer_collection_visible_get(depsgraph, layer_collection);
const bool is_selectable = is_visible && ((layer_collection->flag_evaluated & COLLECTION_SELECTABLE) != 0);
/* overrides */
if (is_visible) {
if (parent_layer_collection == NULL) {
idproperty_reset(&layer_collection->properties_evaluated, layer_collection->properties);
}
else {
idproperty_reset(&layer_collection->properties_evaluated, parent_layer_collection->properties_evaluated);
IDP_MergeGroup(layer_collection->properties_evaluated, layer_collection->properties, true);
}
}
for (LinkData *link = layer_collection->object_bases.first; link != NULL; link = link->next) {
Base *base = link->data;
if (is_visible) {
IDP_MergeGroup(base->collection_properties, layer_collection->properties_evaluated, true);
base->flag |= BASE_VISIBLED;
}

@ -457,9 +457,6 @@ void BKE_object_free(Object *ob)
}
BKE_previewimg_free(&ob->preview);
/* don't free, let the base free it */
ob->base_collection_properties = NULL;
}
/* actual check for internal data, not context or flags */

@ -147,8 +147,7 @@ static void copy_dupli_context(DupliContext *r_ctx, const DupliContext *ctx, Obj
*/
static DupliObject *make_dupli(const DupliContext *ctx,
Object *ob, float mat[4][4], int index,
bool animated, bool hide,
IDProperty *collection_properties)
bool animated, bool hide)
{
DupliObject *dob;
int i;
@ -203,10 +202,6 @@ static DupliObject *make_dupli(const DupliContext *ctx,
dob->random_id ^= BLI_hash_int(BLI_hash_string(ctx->object->id.name + 2));
}
if (collection_properties) {
dob->collection_properties = IDP_CopyProperty(collection_properties);
}
return dob;
}
@ -323,8 +318,7 @@ static void make_duplis_group(const DupliContext *ctx)
/* group dupli offset, should apply after everything else */
mul_m4_m4m4(mat, group_mat, base->object->obmat);
BLI_assert(base->collection_properties != NULL);
make_dupli(ctx, base->object, mat, id, animated, false, base->collection_properties);
make_dupli(ctx, base->object, mat, id, animated, false);
/* recursion */
make_recursive_duplis(ctx, base->object, group_mat, id, animated);
@ -386,7 +380,7 @@ static void make_duplis_frames(const DupliContext *ctx)
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM); /* ob-eval will do drivers, so we don't need to do them */
BKE_object_where_is_calc_time(ctx->depsgraph, scene, ob, (float)scene->r.cfra);
make_dupli(ctx, ob, ob->obmat, scene->r.cfra, false, false, NULL);
make_dupli(ctx, ob, ob->obmat, scene->r.cfra, false, false);
}
}
@ -471,7 +465,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, const float co[3],
*/
mul_m4_m4m4(space_mat, obmat, inst_ob->imat);
dob = make_dupli(vdd->ctx, vdd->inst_ob, obmat, index, false, false, NULL);
dob = make_dupli(vdd->ctx, vdd->inst_ob, obmat, index, false, false);
if (vdd->orco)
copy_v3_v3(dob->orco, vdd->orco[index]);
@ -656,7 +650,7 @@ static void make_duplis_font(const DupliContext *ctx)
copy_v3_v3(obmat[3], vec);
make_dupli(ctx, ob, obmat, a, false, false, NULL);
make_dupli(ctx, ob, obmat, a, false, false);
}
}
@ -762,7 +756,7 @@ static void make_child_duplis_faces(const DupliContext *ctx, void *userdata, Obj
*/
mul_m4_m4m4(space_mat, obmat, inst_ob->imat);
dob = make_dupli(ctx, inst_ob, obmat, a, false, false, NULL);
dob = make_dupli(ctx, inst_ob, obmat, a, false, false);
if (use_texcoords) {
float w = 1.0f / (float)mp->totloop;
@ -1073,7 +1067,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
/* individual particle transform */
mul_m4_m4m4(mat, pamat, tmat);
dob = make_dupli(ctx, object, mat, a, false, false, NULL);
dob = make_dupli(ctx, object, mat, a, false, false);
dob->particle_system = psys;
if (use_texcoords) {
@ -1127,7 +1121,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
if (part->draw & PART_DRAW_GLOBAL_OB)
add_v3_v3v3(mat[3], mat[3], vec);
dob = make_dupli(ctx, ob, mat, a, false, false, NULL);
dob = make_dupli(ctx, ob, mat, a, false, false);
dob->particle_system = psys;
if (use_texcoords)
psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
@ -1240,14 +1234,6 @@ ListBase *object_duplilist(Depsgraph *depsgraph, Scene *sce, Object *ob)
void free_object_duplilist(ListBase *lb)
{
for (DupliObject *dob = lb->first; dob; dob = dob->next) {
if (dob->collection_properties) {
IDP_FreeProperty(dob->collection_properties);
MEM_freeN(dob->collection_properties);
}
}
BLI_freelistN(lb);
MEM_freeN(lb);
}

@ -459,18 +459,10 @@ void BKE_object_eval_flush_base_flags(Depsgraph *depsgraph,
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
/* Make sure we have the base collection settings is already populated.
* This will fail when BKE_layer_eval_layer_collection_pre hasn't run yet.
*
* Which usually means a missing call to DEG_id_tag_update(id, DEG_TAG_BASE_FLAGS_UPDATE).
* Either of the entire scene, or of the newly added objects.*/
BLI_assert(!BLI_listbase_is_empty(&base->collection_properties->data.group));
/* Copy flags and settings from base. */
object->base_flag = base->flag;
if (is_from_set) {
object->base_flag |= BASE_FROM_SET;
object->base_flag &= ~(BASE_SELECTED | BASE_SELECTABLED);
}
object->base_collection_properties = base->collection_properties;
}

@ -5535,8 +5535,6 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->currentlod = ob->lodlevels.first;
ob->preview = direct_link_preview_image(fd, ob->preview);
ob->base_collection_properties = NULL;
}
/* ************ READ SCENE ***************** */
@ -5613,18 +5611,6 @@ static void lib_link_scene_collection(FileData *fd, Library *lib, SceneCollectio
}
}
static void lib_link_layer_collection(FileData *fd, LayerCollection *layer_collection)
{
IDP_LibLinkProperty(layer_collection->properties, fd);
for (LayerCollection *layer_collection_nested = layer_collection->layer_collections.first;
layer_collection_nested != NULL;
layer_collection_nested = layer_collection_nested->next)
{
lib_link_layer_collection(fd, layer_collection_nested);
}
}
static void lib_link_view_layer(FileData *fd, Library *lib, ViewLayer *view_layer)
{
/* tag scene layer to update for collection tree evaluation */
@ -5643,17 +5629,8 @@ static void lib_link_view_layer(FileData *fd, Library *lib, ViewLayer *view_laye
/* we only bump the use count for the collection objects */
base->object = newlibadr(fd, lib, base->object);
base->flag |= BASE_DIRTY_ENGINE_SETTINGS;
base->collection_properties = NULL;
}
for (LayerCollection *layer_collection = view_layer->layer_collections.first;
layer_collection != NULL;
layer_collection = layer_collection->next)
{
lib_link_layer_collection(fd, layer_collection);
}
IDP_LibLinkProperty(view_layer->properties, fd);
IDP_LibLinkProperty(view_layer->id_properties, fd);
}
@ -5928,15 +5905,6 @@ static void direct_link_layer_collections(FileData *fd, ListBase *lb)
link->data = newdataadr(fd, link->data);
}
link_list(fd, &lc->overrides);
if (lc->properties) {
lc->properties = newdataadr(fd, lc->properties);
IDP_DirectLinkGroup_OrFree(&lc->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
BKE_layer_collection_engine_settings_validate_collection(lc);
}
lc->properties_evaluated = NULL;
direct_link_layer_collections(fd, &lc->layer_collections);
}
}
@ -5948,13 +5916,6 @@ static void direct_link_view_layer(FileData *fd, ViewLayer *view_layer)
view_layer->basact = newdataadr(fd, view_layer->basact);
direct_link_layer_collections(fd, &view_layer->layer_collections);
if (view_layer->properties != NULL) {
view_layer->properties = newdataadr(fd, view_layer->properties);
BLI_assert(view_layer->properties != NULL);
IDP_DirectLinkGroup_OrFree(&view_layer->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
BKE_view_layer_engine_settings_validate_layer(view_layer);
}
view_layer->id_properties = newdataadr(fd, view_layer->id_properties);
IDP_DirectLinkGroup_OrFree(&view_layer->id_properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
@ -9581,18 +9542,6 @@ static void expand_scene_collection(FileData *fd, Main *mainvar, SceneCollection
}
}
static void expand_layer_collection(FileData *fd, Main *mainvar, LayerCollection *layer_collection)
{
expand_idprops(fd, mainvar, layer_collection->properties);
for (LayerCollection *layer_collection_nested = layer_collection->layer_collections.first;
layer_collection_nested != NULL;
layer_collection_nested = layer_collection_nested->next)
{
expand_layer_collection(fd, mainvar, layer_collection_nested);
}
}
static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
{
SceneRenderLayer *srl;
@ -9629,7 +9578,6 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
}
for (ViewLayer *view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
expand_idprops(fd, mainvar, view_layer->properties);
expand_idprops(fd, mainvar, view_layer->id_properties);
for (module = view_layer->freestyle_config.modules.first; module; module = module->next) {
@ -9644,13 +9592,6 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
}
expand_doit(fd, mainvar, lineset->linestyle);
}
for (LayerCollection *layer_collection = view_layer->layer_collections.first;
layer_collection != NULL;
layer_collection = layer_collection->next)
{
expand_layer_collection(fd, mainvar, layer_collection);
}
}
if (sce->gpd)

@ -689,25 +689,6 @@ void do_versions_after_linking_280(Main *main)
}
}
static void do_version_layer_collections_idproperties(ListBase *lb)
{
IDPropertyTemplate val = {0};
for (LayerCollection *lc = lb->first; lc; lc = lc->next) {
lc->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
BKE_layer_collection_engine_settings_create(lc->properties);
/* No overrides at first */
for (IDProperty *prop = lc->properties->data.group.first; prop; prop = prop->next) {
while (prop->data.group.first) {
IDP_FreeFromGroup(prop, prop->data.group.first);
}
}
/* Do it recursively */
do_version_layer_collections_idproperties(&lc->layer_collections);
}
}
static void do_version_view_layer_visibility(ViewLayer *view_layer)
{
LayerCollection *layer_collection;
@ -739,16 +720,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
if (DNA_struct_elem_find(fd->filesdna, "LayerCollection", "ListBase", "engine_settings") &&
!DNA_struct_elem_find(fd->filesdna, "LayerCollection", "IDProperty", "properties"))
{
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
do_version_layer_collections_idproperties(&view_layer->layer_collections);
}
}
}
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
scene->r.gauss = 1.5f;
}
@ -767,16 +738,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
if (!DNA_struct_elem_find(fd->filesdna, "ViewLayer", "IDProperty", "*properties")) {
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
for (ViewLayer *view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
IDPropertyTemplate val = {0};
view_layer->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
BKE_view_layer_engine_settings_create(view_layer->properties);
}
}
}
/* MTexPoly now removed. */
if (DNA_struct_find(fd->filesdna, "MTexPoly")) {
const int cd_mtexpoly = 15; /* CD_MTEXPOLY, deprecated */

@ -2414,11 +2414,6 @@ static void write_layer_collections(WriteData *wd, ListBase *lb)
writestruct(wd, DATA, LayerCollection, 1, lc);
writelist(wd, DATA, LinkData, &lc->object_bases);
writelist(wd, DATA, CollectionOverride, &lc->overrides);
if (lc->properties) {
IDP_WriteProperty(lc->properties, wd);
}
write_layer_collections(wd, &lc->layer_collections);
}
@ -2428,9 +2423,6 @@ static void write_view_layer(WriteData *wd, ViewLayer *view_layer)
{
writestruct(wd, DATA, ViewLayer, 1, view_layer);
writelist(wd, DATA, Base, &view_layer->object_bases);
if (view_layer->properties) {
IDP_WriteProperty(view_layer->properties, wd);
}
if (view_layer->id_properties) {
IDP_WriteProperty(view_layer->id_properties, wd);

@ -125,17 +125,6 @@ static bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
temp_dupli_object->transflag &= ~OB_DUPLI;
if (dob->collection_properties != NULL) {
temp_dupli_object->base_collection_properties = dob->collection_properties;
IDP_MergeGroup(temp_dupli_object->base_collection_properties,
dupli_parent->base_collection_properties,
false);
}
else {
temp_dupli_object->base_collection_properties =
dupli_parent->base_collection_properties;
}
copy_m4_m4(data->temp_dupli_object.obmat, dob->mat);
iter->current = &data->temp_dupli_object;
BLI_assert(

@ -632,7 +632,6 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
ListBase gpumaterial_backup;
ListBase *gpumaterial_ptr = NULL;
Mesh *mesh_evaluated = NULL;
IDProperty *base_collection_properties = NULL;
short base_flag = 0;
if (check_datablock_expanded(id_cow)) {
switch (id_type) {
@ -683,7 +682,6 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
}
}
/* Make a backup of base flags. */
base_collection_properties = object->base_collection_properties;
base_flag = object->base_flag;
break;
}
@ -718,10 +716,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
((Mesh *)mesh_evaluated->id.orig_id)->edit_btmesh;
}
}
if (base_collection_properties != NULL) {
object->base_collection_properties = base_collection_properties;
object->base_flag = base_flag;
}
object->base_flag = base_flag;
}
return id_cow;
}

@ -636,9 +636,11 @@ static int hair_mat_in_ubo(CLAY_Storage *storage, const CLAY_HAIR_UBO_Material *
return id;
}
static void ubo_mat_from_object(CLAY_Storage *storage, Object *ob, bool *r_needs_ao, int *r_id)
static void ubo_mat_from_object(CLAY_Storage *storage, Object *UNUSED(ob), bool *r_needs_ao, int *r_id)
{
IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, RE_engine_id_BLENDER_CLAY);
const DRWContextState *draw_ctx = DRW_context_state_get();
ViewLayer *view_layer = draw_ctx->view_layer;
IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_CLAY);
int matcap_icon = BKE_collection_engine_property_value_get_int(props, "matcap_icon");
float matcap_rot = BKE_collection_engine_property_value_get_float(props, "matcap_rotation");
@ -678,9 +680,11 @@ static void ubo_mat_from_object(CLAY_Storage *storage, Object *ob, bool *r_needs
*r_id = mat_in_ubo(storage, &r_ubo);
}
static void hair_ubo_mat_from_object(Object *ob, CLAY_HAIR_UBO_Material *r_ubo)
static void hair_ubo_mat_from_object(Object *UNUSED(ob), CLAY_HAIR_UBO_Material *r_ubo)
{
IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, RE_engine_id_BLENDER_CLAY);
const DRWContextState *draw_ctx = DRW_context_state_get();
ViewLayer *view_layer = draw_ctx->view_layer;
IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_CLAY);
int matcap_icon = BKE_collection_engine_property_value_get_int(props, "matcap_icon");
float matcap_rot = BKE_collection_engine_property_value_get_float(props, "matcap_rotation");

@ -409,7 +409,7 @@ void workbench_materials_cache_init(WORKBENCH_Data *vedata)
}
}
}
static WORKBENCH_MaterialData *get_or_create_material_data(WORKBENCH_Data *vedata, IDProperty *props, Object *ob, Material *mat, Image *ima, int drawtype)
static WORKBENCH_MaterialData *get_or_create_material_data(WORKBENCH_Data *vedata, Object *ob, Material *mat, Image *ima, int drawtype)
{
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PassList *psl = vedata->psl;
@ -418,6 +418,9 @@ static WORKBENCH_MaterialData *get_or_create_material_data(WORKBENCH_Data *vedat
WORKBENCH_ObjectData *engine_object_data = (WORKBENCH_ObjectData *)DRW_object_engine_data_ensure(
ob, &draw_engine_workbench_solid, sizeof(WORKBENCH_ObjectData), &workbench_init_object_data, NULL);
WORKBENCH_MaterialData material_template;
const DRWContextState *draw_ctx = DRW_context_state_get();
ViewLayer *view_layer = draw_ctx->view_layer;
IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_WORKBENCH);
const float hsv_saturation = BKE_collection_engine_property_value_get_float(props, "random_object_color_saturation");
const float hsv_value = BKE_collection_engine_property_value_get_float(props, "random_object_color_value");
@ -453,7 +456,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(WORKBENCH_Data *vedat
return material;
}
static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, IDProperty *props, Object *ob)
static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, Object *ob)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
@ -475,7 +478,7 @@ static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, IDPropert
if (draw_as == PART_DRAW_PATH) {
struct Gwn_Batch *geom = DRW_cache_particles_get_hair(psys, NULL);
WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, props, ob, NULL, NULL, OB_SOLID);
WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, ob, NULL, NULL, OB_SOLID);
DRW_shgroup_call_add(material->shgrp, geom, mat);
}
}
@ -492,9 +495,8 @@ void workbench_materials_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob
if (!DRW_object_is_renderable(ob))
return;
IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, RE_engine_id_BLENDER_WORKBENCH);
if (ob->type == OB_MESH) {
workbench_cache_populate_particles(vedata, props, ob);
workbench_cache_populate_particles(vedata, ob);
}
WORKBENCH_MaterialData *material;
@ -520,7 +522,7 @@ void workbench_materials_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob
if (image) {
mat_drawtype = OB_TEXTURE;
}
material = get_or_create_material_data(vedata, props, ob, mat, image, mat_drawtype);
material = get_or_create_material_data(vedata, ob, mat, image, mat_drawtype);
DRW_shgroup_call_object_add(material->shgrp, geom_array[i], ob);
}
is_drawn = true;
@ -534,7 +536,7 @@ void workbench_materials_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob
/* No material split needed */
struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
material = get_or_create_material_data(vedata, props, ob, NULL, NULL, OB_SOLID);
material = get_or_create_material_data(vedata, ob, NULL, NULL, OB_SOLID);
if (is_sculpt_mode) {
DRW_shgroup_call_sculpt_add(material->shgrp, ob, ob->obmat);
}
@ -554,7 +556,7 @@ void workbench_materials_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob
if (mat_geom) {
for (int i = 0; i < materials_len; ++i) {
Material *mat = give_current_material(ob, i + 1);
material = get_or_create_material_data(vedata, props, ob, mat, NULL, OB_SOLID);
material = get_or_create_material_data(vedata, ob, mat, NULL, OB_SOLID);
DRW_shgroup_call_object_add(material->shgrp, mat_geom[i], ob);
}
}

@ -1036,11 +1036,6 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);
void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr);
void uiTemplateOverrideProperty(
uiLayout *layout, struct PointerRNA *collection_props_ptr, struct PointerRNA *scene_props_ptr,
const char *propname,
const char *name, const char *text_ctxt, int translate, int icon,
const char *custom_template);
void uiTemplateComponentMenu(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name);
void uiTemplateNodeSocket(uiLayout *layout, struct bContext *C, float *color);
void uiTemplateCacheFile(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname);

@ -334,128 +334,6 @@ static void UI_OT_unset_property_button(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
}
/* Use/Unuse Property Button Operator ------------------------ */
static int use_property_button_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr, scene_props_ptr;
PropertyRNA *prop;
IDProperty *props;
uiBut *but = UI_context_active_but_get(C);
prop = but->rnaprop;
ptr = but->rnapoin;
props = (IDProperty *)ptr.data;
/* XXX Using existing data struct to pass another RNAPointer */
scene_props_ptr = but->rnasearchpoin;
const char *identifier = RNA_property_identifier(prop);
if (IDP_GetPropertyFromGroup(props, identifier)) {
return OPERATOR_CANCELLED;
}
int array_len = RNA_property_array_length(&scene_props_ptr, prop);
bool is_array = array_len != 0;
switch (RNA_property_type(prop)) {
case PROP_FLOAT:
{
if (is_array) {
float values[RNA_MAX_ARRAY_LENGTH];
RNA_property_float_get_array(&scene_props_ptr, prop, values);
BKE_collection_engine_property_add_float_array(props, identifier, values, array_len);
}
else {
float value = RNA_property_float_get(&scene_props_ptr, prop);
BKE_collection_engine_property_add_float(props, identifier, value);
}
break;
}
case PROP_ENUM:
{
int value = RNA_enum_get(&scene_props_ptr, identifier);
BKE_collection_engine_property_add_int(props, identifier, value);
break;
}
case PROP_INT:
{
int value = RNA_int_get(&scene_props_ptr, identifier);
BKE_collection_engine_property_add_int(props, identifier, value);
break;
}
case PROP_BOOLEAN:
{
int value = RNA_boolean_get(&scene_props_ptr, identifier);
BKE_collection_engine_property_add_bool(props, identifier, value);
break;
}
case PROP_STRING:
case PROP_POINTER:
case PROP_COLLECTION:
default:
break;
}
/* TODO(sergey): Use proper flag for tagging here. */
DEG_id_tag_update((ID *)CTX_data_scene(C), 0);
return OPERATOR_FINISHED;
}
static void UI_OT_use_property_button(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Use property";
ot->idname = "UI_OT_use_property_button";
ot->description = "Create a property";
/* callbacks */
ot->poll = ED_operator_regionactive;
ot->exec = use_property_button_exec;
/* flags */
ot->flag = OPTYPE_UNDO;
}
static int unuse_property_button_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr;
PropertyRNA *prop;
int index;
/* try to unset the nominated property */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
const char *identifier = RNA_property_identifier(prop);
IDProperty *props = (IDProperty *)ptr.data;
IDProperty *prop_to_remove = IDP_GetPropertyFromGroup(props, identifier);
IDP_FreeFromGroup(props, prop_to_remove);
/* TODO(sergey): Use proper flag for tagging here. */
DEG_id_tag_update((ID *)CTX_data_scene(C), 0);
return OPERATOR_FINISHED;
}
static void UI_OT_unuse_property_button(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Unuse property";
ot->idname = "UI_OT_unuse_property_button";
ot->description = "Remove a property";
/* callbacks */
ot->poll = ED_operator_regionactive;
ot->exec = unuse_property_button_exec;
/* flags */
ot->flag = OPTYPE_UNDO;
}
/* Note that we use different values for UI/UX than 'real' override operations, user does not care
* whether it's added or removed for the differential operation e.g. */
@ -1455,8 +1333,6 @@ void ED_operatortypes_ui(void)
WM_operatortype_append(UI_OT_copy_python_command_button);
WM_operatortype_append(UI_OT_reset_default_button);
WM_operatortype_append(UI_OT_unset_property_button);
WM_operatortype_append(UI_OT_use_property_button);
WM_operatortype_append(UI_OT_unuse_property_button);
WM_operatortype_append(UI_OT_override_type_set_button);
WM_operatortype_append(UI_OT_override_remove_button);
WM_operatortype_append(UI_OT_copy_to_selected_button);

@ -4346,66 +4346,6 @@ void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
}
}
/********************************* Overrides *************************************/
void uiTemplateOverrideProperty(
uiLayout *layout, PointerRNA *collection_props_ptr, PointerRNA *scene_props_ptr, const char *propname,
const char *name, const char *text_ctxt, int translate, int icon,
const char *custom_template)
{
bool is_set = false;
uiLayout *row, *col;
PointerRNA *ptr;
PropertyRNA *prop;
IDProperty *collection_props = collection_props_ptr->data;
if (IDP_GetPropertyFromGroup(collection_props, propname)) {
prop = RNA_struct_find_property(collection_props_ptr, propname);
ptr = collection_props_ptr;
is_set = RNA_property_is_set(ptr, prop);
}
else {
/* property doesn't exist yet */
prop = RNA_struct_find_property(scene_props_ptr, propname);
ptr = scene_props_ptr;
}
/* Get translated name (label). */
name = RNA_translate_ui_text(name, text_ctxt, NULL, prop, translate);
row = uiLayoutRow(layout, false);
col = uiLayoutColumn(row, false);
uiLayoutSetEnabled(col, is_set);
if (custom_template && STREQ(custom_template, "icon_view")) {
uiTemplateIconView(col, ptr, propname, false, 5.0f);
}
else {
uiItemFullR(col, ptr, prop, -1, 0, 0, name, icon);
}
col = uiLayoutColumn(row, false);
uiBut *but;
uiBlock *block = uiLayoutGetBlock(col);
UI_block_emboss_set(block, UI_EMBOSS_NONE);
if (is_set) {
but = uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_unuse_property_button", WM_OP_EXEC_DEFAULT, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
}
else {
but = uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_use_property_button", WM_OP_EXEC_DEFAULT, ICON_ZOOMIN, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
/* XXX - Using existing data struct to pass another RNAPointer */
but->rnasearchpoin = *scene_props_ptr;
}
but->rnapoin = *collection_props_ptr;
but->rnaprop = prop;
UI_block_emboss_set(block, UI_EMBOSS);
}
/********************************* Color management *************************************/
void uiTemplateColorspaceSettings(uiLayout *layout, PointerRNA *ptr, const char *propname)

@ -42,15 +42,8 @@ typedef struct Base {
struct Object *object;
unsigned int lay;
int flag_legacy;
struct IDProperty *collection_properties; /* used by depsgraph, flushed from collection-tree */
} Base;
typedef struct CollectionOverride {
struct CollectionOverride *next, *prev;
char name[64]; /* MAX_NAME */
/* TODO proper data */
} CollectionOverride;
typedef struct ViewLayerEngineData {
struct ViewLayerEngineData *next, *prev;
struct DrawEngineType *engine_type;
@ -66,10 +59,7 @@ typedef struct LayerCollection {
short flag_evaluated;
short pad[2];
ListBase object_bases; /* (ObjectBase *)LinkData->data - synced with collection->objects */
ListBase overrides;
ListBase layer_collections; /* synced with collection->collections */
struct IDProperty *properties; /* overrides */
struct IDProperty *properties_evaluated;
} LayerCollection;
typedef struct ViewLayer {
@ -82,7 +72,6 @@ typedef struct ViewLayer {
struct SceneStats *stats; /* default allocated now */
struct Base *basact;
ListBase layer_collections; /* LayerCollection */
struct IDProperty *properties; /* overrides */
struct IDProperty *properties_evaluated;
/* Old SceneRenderLayer data. */

@ -291,8 +291,6 @@ typedef struct Object {
struct PreviewImage *preview;
struct IDProperty *base_collection_properties; /* used by depsgraph, flushed from base */
ListBase drawdata; /* runtime, ObjectEngineData */
int pad6;
int select_color;
@ -339,7 +337,6 @@ typedef struct DupliObject {
struct ParticleSystem *particle_system;
unsigned int random_id;
unsigned int pad;
struct IDProperty *collection_properties;
} DupliObject;
/* **************** OBJECT ********************* */

@ -320,7 +320,6 @@ extern StructRNA RNA_Lattice;
extern StructRNA RNA_LatticeModifier;
extern StructRNA RNA_LatticePoint;
extern StructRNA RNA_LayerCollection;
extern StructRNA RNA_LayerCollectionOverride;
extern StructRNA RNA_Library;
extern StructRNA RNA_LimitDistanceConstraint;
extern StructRNA RNA_LimitLocationConstraint;

@ -94,7 +94,7 @@ static PointerRNA rna_SceneCollection_objects_get(CollectionPropertyIterator *it
{
ListBaseIterator *internal = &iter->internal.listbase;
/* we are actually iterating a LinkData list, so override get */
/* we are actually iterating a LinkData list */
return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((LinkData *)internal->link)->data);
}
@ -810,7 +810,7 @@ static PointerRNA rna_ViewLayer_objects_get(CollectionPropertyIterator *iter)
{
ListBaseIterator *internal = &iter->internal.listbase;
/* we are actually iterating a ObjectBase list, so override get */
/* we are actually iterating a ObjectBase list */
Base *base = (Base *)internal->link;
return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object);
}
@ -996,22 +996,6 @@ static void rna_def_scene_collection(BlenderRNA *brna)
RNA_def_function_return(func, parm);
}
static void rna_def_layer_collection_override(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "LayerCollectionOverride", NULL);
RNA_def_struct_sdna(srna, "CollectionOverride");
RNA_def_struct_ui_text(srna, "Collection Override", "Collection Override");
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Name", "Collection name");
RNA_def_struct_name_property(srna, prop);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL);
}
#ifdef WITH_CLAY_ENGINE
static void rna_def_view_layer_engine_settings_clay(BlenderRNA *brna)
{
@ -1786,17 +1770,6 @@ static void rna_def_layer_collection(BlenderRNA *brna)
RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_LayerCollection_objects_get", NULL, NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Objects", "All the objects directly or indirectly added to this collection (not including sub-collection objects)");
prop = RNA_def_property(srna, "overrides", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "overrides", NULL);
RNA_def_property_struct_type(prop, "LayerCollectionOverride");
RNA_def_property_ui_text(prop, "Collection Overrides", "");
/* Override settings */
prop = RNA_def_property(srna, "engine_overrides", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "properties->data.group", NULL);
RNA_def_property_struct_type(prop, "LayerCollectionSettings");
RNA_def_property_ui_text(prop, "Collection Settings", "Override of engine specific render settings");
/* Functions */
func = RNA_def_function(srna, "move_above", "rna_LayerCollection_move_above");
RNA_def_function_ui_description(func, "Move collection after another");
@ -2002,12 +1975,6 @@ void RNA_def_view_layer(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "FreestyleSettings");
RNA_def_property_ui_text(prop, "Freestyle Settings", "");
/* Override settings */
prop = RNA_def_property(srna, "engine_overrides", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "properties->data.group", NULL);
RNA_def_property_struct_type(prop, "ViewLayerSettings");
RNA_def_property_ui_text(prop, "Layer Settings", "Override of engine specific render settings");
/* debug update routine */
func = RNA_def_function(srna, "update", "rna_ViewLayer_update_tagged");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
@ -2025,7 +1992,6 @@ void RNA_def_view_layer(BlenderRNA *brna)
RNA_define_animate_sdna(false);
rna_def_scene_collection(brna);
rna_def_layer_collection(brna);
rna_def_layer_collection_override(brna);
rna_def_object_base(brna);
RNA_define_animate_sdna(true);
/* *** Animated *** */

@ -236,15 +236,6 @@ static int rna_Object_is_visible_get(PointerRNA *ptr)
return BKE_object_is_visible(ob, OB_VISIBILITY_CHECK_UNKNOWN_RENDER_MODE);
}
static void rna_Object_collection_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Object *ob = ptr->data;
if (ob->base_collection_properties != NULL) {
rna_iterator_listbase_begin(iter, &ob->base_collection_properties->data.group, NULL);
}
}
static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
{
Object *ob = ptr->id.data;
@ -2289,22 +2280,6 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Visible", "Visible to camera rays, set only on objects evaluated by depsgraph");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "collection_properties", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "base_collection_properties->data.group", NULL);
RNA_def_property_collection_funcs(prop,
"rna_Object_collection_properties_begin",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
RNA_def_property_struct_type(prop, "LayerCollectionSettings");
RNA_def_property_flag(prop, PROP_NO_COMPARISON); /* XXX see T53800. */
RNA_def_property_ui_text(prop, "Collection Settings",
"Engine specific render settings to be overridden by collections");
/* anim */
rna_def_animdata_common(srna);

@ -1013,16 +1013,6 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
func = RNA_def_function(srna, "template_override_property", "uiTemplateOverrideProperty");
parm = RNA_def_pointer(func, "collection_render_overrides", "AnyType", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_pointer(func, "scene_collection_properties", "AnyType", "", "");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in collection_properties");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
api_ui_item_common(func);
parm = RNA_def_string(func, "custom_template", NULL, 0, "", "Optional template to use for property");
func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu");
RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu");
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");