Remove ViewLayer settings - cleanup 1/2
This commit is contained in:
parent
09e419fa8d
commit
e51bf11b15
|
@ -56,8 +56,6 @@ struct SceneCollection;
|
|||
struct ViewLayer;
|
||||
struct WorkSpace;
|
||||
|
||||
void BKE_layer_exit(void);
|
||||
|
||||
struct ViewLayer *BKE_view_layer_default_view(const struct Scene *scene);
|
||||
struct ViewLayer *BKE_view_layer_default_render(const struct Scene *scene);
|
||||
struct ViewLayer *BKE_view_layer_from_workspace_get(const struct Scene *scene, const struct WorkSpace *workspace);
|
||||
|
@ -132,36 +130,10 @@ void BKE_override_view_layer_int_add(struct ViewLayer *view_layer, int id_type,
|
|||
|
||||
void BKE_override_layer_collection_boolean_add(struct LayerCollection *layer_collection, int id_type, const char *data_path, const bool value);
|
||||
|
||||
/* engine settings */
|
||||
typedef void (*EngineSettingsCB)(struct RenderEngine *engine, struct IDProperty *props);
|
||||
|
||||
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);
|
||||
|
||||
struct IDProperty *BKE_view_layer_engine_evaluated_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_create(struct IDProperty *root);
|
||||
|
||||
void BKE_collection_engine_property_add_float(struct IDProperty *props, const char *name, float value);
|
||||
void BKE_collection_engine_property_add_float_array(
|
||||
struct IDProperty *props, const char *name, const float *values, const int array_length);
|
||||
void BKE_collection_engine_property_add_int(struct IDProperty *props, const char *name, int value);
|
||||
void BKE_collection_engine_property_add_bool(struct IDProperty *props, const char *name, bool value);
|
||||
|
||||
int BKE_collection_engine_property_value_get_int(struct IDProperty *props, const char *name);
|
||||
float BKE_collection_engine_property_value_get_float(struct IDProperty *props, const char *name);
|
||||
const float *BKE_collection_engine_property_value_get_float_array(struct IDProperty *props, const char *name);
|
||||
bool BKE_collection_engine_property_value_get_bool(struct IDProperty *props, const char *name);
|
||||
void BKE_collection_engine_property_value_set_int(struct IDProperty *props, const char *name, int value);
|
||||
void BKE_collection_engine_property_value_set_float(struct IDProperty *props, const char *name, float value);
|
||||
void BKE_collection_engine_property_value_set_float_array(struct IDProperty *props, const char *name, const float *values);
|
||||
void BKE_collection_engine_property_value_set_bool(struct IDProperty *props, const char *name, bool value);
|
||||
|
||||
/* evaluation */
|
||||
|
||||
|
|
|
@ -104,8 +104,6 @@ void BKE_blender_free(void)
|
|||
BKE_sequencer_cache_destruct();
|
||||
IMB_moviecache_destruct();
|
||||
|
||||
BKE_layer_exit();
|
||||
|
||||
free_nodesystem();
|
||||
}
|
||||
|
||||
|
|
|
@ -68,10 +68,6 @@ static void layer_collection_free(ViewLayer *view_layer, LayerCollection *lc);
|
|||
static void layer_collection_objects_populate(ViewLayer *view_layer, LayerCollection *lc, ListBase *objects);
|
||||
static LayerCollection *layer_collection_add(ViewLayer *view_layer, LayerCollection *parent, SceneCollection *sc);
|
||||
static LayerCollection *find_layer_collection_by_scene_collection(LayerCollection *lc, const SceneCollection *sc);
|
||||
static IDProperty *collection_engine_settings_create(struct EngineSettingsCB_Type *ces_type, const bool populate);
|
||||
static IDProperty *collection_engine_get(IDProperty *root, const char *engine_name);
|
||||
static void collection_engine_settings_init(IDProperty *root, const bool populate);
|
||||
static void layer_engine_settings_init(IDProperty *root, const bool populate);
|
||||
static void object_bases_iterator_next(BLI_Iterator *iter, const int flag);
|
||||
|
||||
/* RenderLayer */
|
||||
|
@ -200,11 +196,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_evaluated) {
|
||||
IDP_FreeProperty(view_layer->properties_evaluated);
|
||||
MEM_freeN(view_layer->properties_evaluated);
|
||||
}
|
||||
|
||||
for (ViewLayerEngineData *sled = view_layer->drawdata.first; sled; sled = sled->next) {
|
||||
if (sled->storage) {
|
||||
if (sled->free) {
|
||||
|
@ -475,7 +466,6 @@ void BKE_view_layer_copy_data(
|
|||
BKE_freestyle_config_copy(&view_layer_dst->freestyle_config, &view_layer_src->freestyle_config, flag);
|
||||
|
||||
view_layer_dst->stats = NULL;
|
||||
view_layer_dst->properties_evaluated = NULL;
|
||||
|
||||
/* we start fresh with no overrides and no visibility flags set
|
||||
* instead of syncing both trees we simply unlink and relink the scene collection */
|
||||
|
@ -1391,217 +1381,9 @@ void BKE_override_layer_collection_boolean_add(struct LayerCollection *layer_col
|
|||
TODO_LAYER_OVERRIDE;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Engine Settings */
|
||||
|
||||
ListBase R_layer_collection_engines_settings_callbacks = {NULL, NULL};
|
||||
ListBase R_view_layer_engines_settings_callbacks = {NULL, NULL};
|
||||
|
||||
typedef struct EngineSettingsCB_Type {
|
||||
struct EngineSettingsCB_Type *next, *prev;
|
||||
|
||||
char name[MAX_NAME]; /* engine name */
|
||||
|
||||
EngineSettingsCB callback;
|
||||
|
||||
} EngineSettingsCB_Type;
|
||||
|
||||
static void create_engine_settings_scene(IDProperty *root, EngineSettingsCB_Type *es_type)
|
||||
{
|
||||
if (collection_engine_get(root, es_type->name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IDProperty *props = collection_engine_settings_create(es_type, true);
|
||||
IDP_AddToGroup(root, props);
|
||||
}
|
||||
|
||||
static void create_layer_collection_engine_settings_scene(Scene *scene, EngineSettingsCB_Type *es_type)
|
||||
{
|
||||
create_engine_settings_scene(scene->collection_properties, es_type);
|
||||
}
|
||||
|
||||
static void create_view_layer_engine_settings_scene(Scene *scene, EngineSettingsCB_Type *es_type)
|
||||
{
|
||||
create_engine_settings_scene(scene->layer_properties, 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);
|
||||
}
|
||||
|
||||
static void create_view_layer_engines_settings_scene(Scene *scene, EngineSettingsCB_Type *es_type)
|
||||
{
|
||||
/* Populate the scene with the new settings. */
|
||||
create_view_layer_engine_settings_scene(scene, es_type);
|
||||
}
|
||||
|
||||
static EngineSettingsCB_Type *engine_settings_callback_register(const char *engine_name, EngineSettingsCB func, ListBase *lb)
|
||||
{
|
||||
EngineSettingsCB_Type *es_type;
|
||||
|
||||
/* Cleanup in case it existed. */
|
||||
es_type = BLI_findstring(lb, engine_name, offsetof(EngineSettingsCB_Type, name));
|
||||
|
||||
if (es_type) {
|
||||
BLI_remlink(lb, es_type);
|
||||
MEM_freeN(es_type);
|
||||
}
|
||||
|
||||
es_type = MEM_callocN(sizeof(EngineSettingsCB_Type), __func__);
|
||||
BLI_strncpy_utf8(es_type->name, engine_name, sizeof(es_type->name));
|
||||
es_type->callback = func;
|
||||
BLI_addtail(lb, es_type);
|
||||
|
||||
return es_type;
|
||||
}
|
||||
|
||||
void BKE_layer_collection_engine_settings_callback_register(
|
||||
Main *bmain, const char *engine_name, EngineSettingsCB func)
|
||||
{
|
||||
EngineSettingsCB_Type *es_type =
|
||||
engine_settings_callback_register(engine_name, func, &R_layer_collection_engines_settings_callbacks);
|
||||
|
||||
if (bmain) {
|
||||
/* Populate all of the collections of the scene with those settings. */
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
create_layer_collection_engines_settings_scene(scene, es_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_view_layer_engine_settings_callback_register(
|
||||
Main *bmain, const char *engine_name, EngineSettingsCB func)
|
||||
{
|
||||
EngineSettingsCB_Type *es_type =
|
||||
engine_settings_callback_register(engine_name, func, &R_view_layer_engines_settings_callbacks);
|
||||
|
||||
if (bmain) {
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_layer_collection_engine_settings_callback_free(void)
|
||||
{
|
||||
BLI_freelistN(&R_layer_collection_engines_settings_callbacks);
|
||||
}
|
||||
|
||||
void BKE_view_layer_engine_settings_callback_free(void)
|
||||
{
|
||||
BLI_freelistN(&R_view_layer_engines_settings_callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a root IDProperty for this engine
|
||||
*
|
||||
* \param populate whether we want to pre-fill the collection with the default properties
|
||||
*/
|
||||
static IDProperty *collection_engine_settings_create(EngineSettingsCB_Type *es_type, const bool populate)
|
||||
{
|
||||
IDProperty *props;
|
||||
IDPropertyTemplate val = {0};
|
||||
|
||||
props = IDP_New(IDP_GROUP, &val, es_type->name);
|
||||
props->subtype = IDP_GROUP_SUB_ENGINE_RENDER;
|
||||
|
||||
/* properties */
|
||||
if (populate) {
|
||||
es_type->callback(NULL, props);
|
||||
}
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
static void layer_collection_create_render_settings(IDProperty *root, const bool populate)
|
||||
{
|
||||
EngineSettingsCB_Type *es_type;
|
||||
for (es_type = R_layer_collection_engines_settings_callbacks.first; es_type; es_type = es_type->next) {
|
||||
IDProperty *props = collection_engine_settings_create(es_type, populate);
|
||||
IDP_AddToGroup(root, props);
|
||||
}
|
||||
}
|
||||
|
||||
static void view_layer_create_render_settings(IDProperty *root, const bool populate)
|
||||
{
|
||||
EngineSettingsCB_Type *es_type;
|
||||
for (es_type = R_view_layer_engines_settings_callbacks.first; es_type; es_type = es_type->next) {
|
||||
IDProperty *props = collection_engine_settings_create(es_type, populate);
|
||||
IDP_AddToGroup(root, props);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return collection enginne settings for either Object s of LayerCollection s
|
||||
*/
|
||||
static IDProperty *collection_engine_get(IDProperty *root, const char *engine_name)
|
||||
{
|
||||
return IDP_GetPropertyFromGroup(root, engine_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return layer collection engine settings for specified engine in the scene
|
||||
*/
|
||||
IDProperty *BKE_layer_collection_engine_scene_get(Scene *scene, const char *engine_name)
|
||||
{
|
||||
return collection_engine_get(scene->collection_properties, engine_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return scene layer engine settings for specified engine in the scene
|
||||
*/
|
||||
IDProperty *BKE_view_layer_engine_scene_get(Scene *scene, const char *engine_name)
|
||||
{
|
||||
return collection_engine_get(scene->layer_properties, engine_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return scene layer evaluated engine settings for specified engine
|
||||
*/
|
||||
IDProperty *BKE_view_layer_engine_evaluated_get(ViewLayer *view_layer, const char *engine_name)
|
||||
{
|
||||
return collection_engine_get(view_layer->properties_evaluated, engine_name);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Engine Settings Properties */
|
||||
|
||||
void BKE_collection_engine_property_add_float(IDProperty *props, const char *name, float value)
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
val.f = value;
|
||||
IDP_AddToGroup(props, IDP_New(IDP_FLOAT, &val, name));
|
||||
}
|
||||
|
||||
void BKE_collection_engine_property_add_float_array(
|
||||
IDProperty *props, const char *name, const float *values, const int array_length)
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
val.array.len = array_length;
|
||||
val.array.type = IDP_FLOAT;
|
||||
|
||||
IDProperty *idprop = IDP_New(IDP_ARRAY, &val, name);
|
||||
memcpy(IDP_Array(idprop), values, sizeof(float) * idprop->len);
|
||||
IDP_AddToGroup(props, idprop);
|
||||
}
|
||||
|
||||
void BKE_collection_engine_property_add_int(IDProperty *props, const char *name, int value)
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
val.i = value;
|
||||
IDP_AddToGroup(props, IDP_New(IDP_INT, &val, name));
|
||||
}
|
||||
|
||||
void BKE_collection_engine_property_add_bool(IDProperty *props, const char *name, bool value)
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
val.i = value;
|
||||
IDP_AddToGroup(props, IDP_New(IDP_INT, &val, name));
|
||||
}
|
||||
|
||||
int BKE_collection_engine_property_value_get_int(IDProperty *props, const char *name)
|
||||
{
|
||||
|
@ -1627,173 +1409,6 @@ bool BKE_collection_engine_property_value_get_bool(IDProperty *props, const char
|
|||
return idprop ? IDP_Int(idprop) : 0;
|
||||
}
|
||||
|
||||
void BKE_collection_engine_property_value_set_int(IDProperty *props, const char *name, int value)
|
||||
{
|
||||
IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
|
||||
IDP_Int(idprop) = value;
|
||||
}
|
||||
|
||||
void BKE_collection_engine_property_value_set_float(IDProperty *props, const char *name, float value)
|
||||
{
|
||||
IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
|
||||
IDP_Float(idprop) = value;
|
||||
}
|
||||
|
||||
void BKE_collection_engine_property_value_set_float_array(IDProperty *props, const char *name, const float *values)
|
||||
{
|
||||
IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
|
||||
memcpy(IDP_Array(idprop), values, sizeof(float) * idprop->len);
|
||||
}
|
||||
|
||||
void BKE_collection_engine_property_value_set_bool(IDProperty *props, const char *name, bool value)
|
||||
{
|
||||
IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
|
||||
IDP_Int(idprop) = value;
|
||||
}
|
||||
|
||||
/* Engine Settings recalculate */
|
||||
|
||||
/* get all the default settings defined in scene and merge them here */
|
||||
static void collection_engine_settings_init(IDProperty *root, const bool populate)
|
||||
{
|
||||
/* render engines */
|
||||
layer_collection_create_render_settings(root, populate);
|
||||
}
|
||||
|
||||
/* get all the default settings defined in scene and merge them here */
|
||||
static void layer_engine_settings_init(IDProperty *root, const bool populate)
|
||||
{
|
||||
/* render engines */
|
||||
view_layer_create_render_settings(root, populate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the layer collection render setings
|
||||
* It's used mainly for scenes
|
||||
*/
|
||||
void BKE_layer_collection_engine_settings_create(IDProperty *root)
|
||||
{
|
||||
collection_engine_settings_init(root, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the render setings
|
||||
* It's used mainly for scenes
|
||||
*/
|
||||
void BKE_view_layer_engine_settings_create(IDProperty *root)
|
||||
{
|
||||
layer_engine_settings_init(root, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference of IDProperty group scene collection settings
|
||||
* Used when reading blendfiles, to see if there is any missing settings.
|
||||
*/
|
||||
static struct {
|
||||
struct {
|
||||
IDProperty *collection_properties;
|
||||
IDProperty *render_settings;
|
||||
} scene;
|
||||
IDProperty *view_layer;
|
||||
IDProperty *layer_collection;
|
||||
} root_reference = {
|
||||
.scene = {NULL, NULL},
|
||||
.view_layer = NULL,
|
||||
.layer_collection = NULL,
|
||||
};
|
||||
|
||||
/**
|
||||
* Free the reference scene collection settings IDProperty group.
|
||||
*/
|
||||
static void engine_settings_validate_init(void)
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
|
||||
/* LayerCollection engine settings. */
|
||||
if (root_reference.scene.collection_properties == NULL) {
|
||||
root_reference.scene.collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
collection_engine_settings_init(root_reference.scene.collection_properties, true);
|
||||
}
|
||||
|
||||
if (root_reference.layer_collection == NULL) {
|
||||
root_reference.layer_collection = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
collection_engine_settings_init(root_reference.layer_collection, false);
|
||||
}
|
||||
|
||||
/* Render engine setting. */
|
||||
if (root_reference.scene.render_settings == NULL) {
|
||||
root_reference.scene.render_settings = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
layer_engine_settings_init(root_reference.scene.render_settings, true);
|
||||
}
|
||||
|
||||
if (root_reference.view_layer == NULL) {
|
||||
root_reference.view_layer = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
layer_engine_settings_init(root_reference.view_layer, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Free the reference scene collection settings IDProperty group.
|
||||
*/
|
||||
static void layer_collection_engine_settings_validate_free(void)
|
||||
{
|
||||
IDProperty *idprops[] = {
|
||||
root_reference.scene.render_settings,
|
||||
root_reference.scene.collection_properties,
|
||||
root_reference.view_layer,
|
||||
root_reference.layer_collection,
|
||||
NULL,
|
||||
};
|
||||
|
||||
IDProperty **idprop = &idprops[0];
|
||||
while (*idprop) {
|
||||
if (*idprop) {
|
||||
IDP_FreeProperty(*idprop);
|
||||
MEM_freeN(*idprop);
|
||||
*idprop = NULL;
|
||||
idprop++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure Scene has all required collection settings.
|
||||
*/
|
||||
void BKE_layer_collection_engine_settings_validate_scene(Scene *scene)
|
||||
{
|
||||
if (root_reference.scene.collection_properties == NULL) {
|
||||
engine_settings_validate_init();
|
||||
}
|
||||
|
||||
if (scene->collection_properties == NULL) {
|
||||
IDPropertyTemplate val = {0};
|
||||
scene->collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
BKE_layer_collection_engine_settings_create(scene->collection_properties);
|
||||
}
|
||||
else {
|
||||
IDP_MergeGroup(scene->collection_properties, root_reference.scene.collection_properties, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure Scene has all required collection settings.
|
||||
*/
|
||||
void BKE_view_layer_engine_settings_validate_scene(Scene *scene)
|
||||
{
|
||||
if (root_reference.scene.render_settings == NULL) {
|
||||
engine_settings_validate_init();
|
||||
}
|
||||
|
||||
if (scene->layer_properties == NULL) {
|
||||
IDPropertyTemplate val = {0};
|
||||
scene->layer_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
BKE_view_layer_engine_settings_create(scene->layer_properties);
|
||||
}
|
||||
else {
|
||||
IDP_MergeGroup(scene->layer_properties, root_reference.scene.render_settings, false);
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* Iterators */
|
||||
|
@ -2090,44 +1705,15 @@ void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator *UNUSED(iter))
|
|||
|
||||
/* Evaluation */
|
||||
|
||||
/**
|
||||
* Reset props
|
||||
*
|
||||
* If props_ref is pasted, copy props from it
|
||||
*/
|
||||
static void idproperty_reset(IDProperty **props, IDProperty *props_ref)
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
|
||||
if (*props) {
|
||||
IDP_FreeProperty(*props);
|
||||
MEM_freeN(*props);
|
||||
}
|
||||
*props = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
|
||||
if (props_ref) {
|
||||
IDP_MergeGroup(*props, props_ref, true);
|
||||
}
|
||||
}
|
||||
|
||||
static void layer_eval_layer_collection_pre(Depsgraph *depsgraph, ID *owner_id, ViewLayer *view_layer)
|
||||
static void layer_eval_layer_collection_pre(Depsgraph *depsgraph, ID *UNUSED(owner_id), ViewLayer *view_layer)
|
||||
{
|
||||
DEG_debug_print_eval(depsgraph, __func__, view_layer->name, view_layer);
|
||||
Scene *scene = (GS(owner_id->name) == ID_SCE) ? (Scene *)owner_id : NULL;
|
||||
//Scene *scene = (GS(owner_id->name) == ID_SCE) ? (Scene *)owner_id : NULL;
|
||||
|
||||
for (Base *base = view_layer->object_bases.first; base != NULL; base = base->next) {
|
||||
base->flag &= ~(BASE_VISIBLED | BASE_SELECTABLED);
|
||||
}
|
||||
|
||||
/* Sync properties from scene to scene layer. */
|
||||
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;
|
||||
}
|
||||
|
@ -2261,11 +1847,3 @@ void BKE_layer_eval_view_layer_indexed(struct Depsgraph *depsgraph,
|
|||
BLI_assert(view_layer != NULL);
|
||||
BKE_layer_eval_view_layer(depsgraph, owner_id, view_layer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Free any static allocated memory.
|
||||
*/
|
||||
void BKE_layer_exit(void)
|
||||
{
|
||||
layer_collection_engine_settings_validate_free();
|
||||
}
|
||||
|
|
|
@ -252,7 +252,6 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
|
|||
/* Recursively creates a new SceneCollection tree. */
|
||||
BKE_collection_copy_data(mc_dst, mc_src, flag_subdata);
|
||||
|
||||
IDPropertyTemplate val = {0};
|
||||
BLI_duplicatelist(&sce_dst->view_layers, &sce_src->view_layers);
|
||||
for (ViewLayer *view_layer_src = sce_src->view_layers.first, *view_layer_dst = sce_dst->view_layers.first;
|
||||
view_layer_src;
|
||||
|
@ -261,15 +260,6 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
|
|||
BKE_view_layer_copy_data(view_layer_dst, view_layer_src, mc_dst, mc_src, flag_subdata);
|
||||
}
|
||||
|
||||
sce_dst->collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
if (sce_src->collection_properties) {
|
||||
IDP_MergeGroup_ex(sce_dst->collection_properties, sce_src->collection_properties, true, flag_subdata);
|
||||
}
|
||||
sce_dst->layer_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
if (sce_src->layer_properties) {
|
||||
IDP_MergeGroup_ex(sce_dst->layer_properties, sce_src->layer_properties, true, flag_subdata);
|
||||
}
|
||||
|
||||
BLI_duplicatelist(&(sce_dst->markers), &(sce_src->markers));
|
||||
BLI_duplicatelist(&(sce_dst->transform_spaces), &(sce_src->transform_spaces));
|
||||
BLI_duplicatelist(&(sce_dst->r.views), &(sce_src->r.views));
|
||||
|
@ -520,19 +510,8 @@ void BKE_scene_free_ex(Scene *sce, const bool do_id_user)
|
|||
MEM_freeN(sce->collection);
|
||||
sce->collection = NULL;
|
||||
|
||||
/* LayerCollection engine settings. */
|
||||
if (sce->collection_properties) {
|
||||
IDP_FreeProperty(sce->collection_properties);
|
||||
MEM_freeN(sce->collection_properties);
|
||||
sce->collection_properties = NULL;
|
||||
}
|
||||
|
||||
/* Render engine setting. */
|
||||
if (sce->layer_properties) {
|
||||
IDP_FreeProperty(sce->layer_properties);
|
||||
MEM_freeN(sce->layer_properties);
|
||||
sce->layer_properties = NULL;
|
||||
}
|
||||
/* These are freed on doversion. */
|
||||
BLI_assert(sce->layer_properties == NULL);
|
||||
}
|
||||
|
||||
void BKE_scene_free(Scene *sce)
|
||||
|
@ -813,14 +792,6 @@ void BKE_scene_init(Scene *sce)
|
|||
sce->collection = MEM_callocN(sizeof(SceneCollection), "Master Collection");
|
||||
BLI_strncpy(sce->collection->name, "Master Collection", sizeof(sce->collection->name));
|
||||
|
||||
/* Engine settings */
|
||||
IDPropertyTemplate val = {0};
|
||||
sce->collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
BKE_layer_collection_engine_settings_create(sce->collection_properties);
|
||||
|
||||
sce->layer_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
|
||||
BKE_view_layer_engine_settings_create(sce->layer_properties);
|
||||
|
||||
BKE_view_layer_add(sce, "View Layer");
|
||||
|
||||
/* SceneDisplay */
|
||||
|
|
|
@ -5923,8 +5923,6 @@ static void direct_link_view_layer(FileData *fd, ViewLayer *view_layer)
|
|||
link_list(fd, &(view_layer->freestyle_config.modules));
|
||||
link_list(fd, &(view_layer->freestyle_config.linesets));
|
||||
|
||||
view_layer->properties_evaluated = NULL;
|
||||
|
||||
BLI_listbase_clear(&view_layer->drawdata);
|
||||
view_layer->object_bases_array = NULL;
|
||||
}
|
||||
|
@ -6215,15 +6213,9 @@ static void direct_link_scene(FileData *fd, Scene *sce, Main *bmain)
|
|||
direct_link_view_layer(fd, view_layer);
|
||||
}
|
||||
|
||||
sce->collection_properties = newdataadr(fd, sce->collection_properties);
|
||||
IDP_DirectLinkGroup_OrFree(&sce->collection_properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
|
||||
|
||||
sce->layer_properties = newdataadr(fd, sce->layer_properties);
|
||||
IDP_DirectLinkGroup_OrFree(&sce->layer_properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
|
||||
|
||||
BKE_layer_collection_engine_settings_validate_scene(sce);
|
||||
BKE_view_layer_engine_settings_validate_scene(sce);
|
||||
|
||||
direct_link_workspace_link_scene_data(fd, sce, &bmain->workspaces);
|
||||
}
|
||||
|
||||
|
|
|
@ -2629,13 +2629,8 @@ static void write_scene(WriteData *wd, Scene *sce)
|
|||
write_view_layer(wd, view_layer);
|
||||
}
|
||||
|
||||
if (sce->layer_properties) {
|
||||
IDP_WriteProperty(sce->layer_properties, wd);
|
||||
}
|
||||
|
||||
if (sce->collection_properties) {
|
||||
IDP_WriteProperty(sce->collection_properties, wd);
|
||||
}
|
||||
/* Freed on doversion. */
|
||||
BLI_assert(sce->layer_properties == NULL);
|
||||
}
|
||||
|
||||
static void write_gpencil(WriteData *wd, bGPdata *gpd)
|
||||
|
|
|
@ -245,7 +245,7 @@ DrawEngineType draw_engine_basic_type = {
|
|||
RenderEngineType DRW_engine_viewport_basic_type = {
|
||||
NULL, NULL,
|
||||
BASIC_ENGINE, N_("Basic"), RE_INTERNAL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
&draw_engine_basic_type,
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -938,22 +938,6 @@ static void clay_draw_scene(void *vedata)
|
|||
}
|
||||
}
|
||||
|
||||
static void clay_layer_collection_settings_create(RenderEngine *UNUSED(engine), IDProperty *props)
|
||||
{
|
||||
BLI_assert(props &&
|
||||
props->type == IDP_GROUP &&
|
||||
props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
|
||||
UNUSED_VARS_NDEBUG(props);
|
||||
}
|
||||
|
||||
static void clay_view_layer_settings_create(RenderEngine *UNUSED(engine), IDProperty *props)
|
||||
{
|
||||
BLI_assert(props &&
|
||||
props->type == IDP_GROUP &&
|
||||
props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
|
||||
UNUSED_VARS_NDEBUG(props);
|
||||
}
|
||||
|
||||
static void clay_engine_free(void)
|
||||
{
|
||||
DRW_SHADER_FREE_SAFE(e_data.clay_sh);
|
||||
|
@ -989,8 +973,6 @@ RenderEngineType DRW_engine_viewport_clay_type = {
|
|||
NULL, NULL,
|
||||
CLAY_ENGINE, N_("Clay"), RE_INTERNAL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
&clay_layer_collection_settings_create,
|
||||
&clay_view_layer_settings_create,
|
||||
&draw_engine_clay_type,
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -423,22 +423,6 @@ static void eevee_engine_free(void)
|
|||
EEVEE_volumes_free();
|
||||
}
|
||||
|
||||
static void eevee_layer_collection_settings_create(RenderEngine *UNUSED(engine), IDProperty *props)
|
||||
{
|
||||
BLI_assert(props &&
|
||||
props->type == IDP_GROUP &&
|
||||
props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
|
||||
UNUSED_VARS_NDEBUG(props);
|
||||
}
|
||||
|
||||
static void eevee_view_layer_settings_create(RenderEngine *UNUSED(engine), IDProperty *props)
|
||||
{
|
||||
BLI_assert(props &&
|
||||
props->type == IDP_GROUP &&
|
||||
props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
|
||||
UNUSED_VARS_NDEBUG(props);
|
||||
}
|
||||
|
||||
static const DrawEngineDataSize eevee_data_size = DRW_VIEWPORT_DATA_SIZE(EEVEE_Data);
|
||||
|
||||
DrawEngineType draw_engine_eevee_type = {
|
||||
|
@ -462,8 +446,6 @@ RenderEngineType DRW_engine_viewport_eevee_type = {
|
|||
EEVEE_ENGINE, N_("Eevee"), RE_INTERNAL | RE_USE_SHADING_NODES | RE_USE_PREVIEW,
|
||||
NULL, &DRW_render_to_image, NULL, NULL, NULL, NULL,
|
||||
&EEVEE_render_update_passes,
|
||||
&eevee_layer_collection_settings_create,
|
||||
&eevee_view_layer_settings_create,
|
||||
&draw_engine_eevee_type,
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -226,7 +226,7 @@ DrawEngineType draw_engine_external_type = {
|
|||
RenderEngineType DRW_engine_viewport_external_type = {
|
||||
NULL, NULL,
|
||||
EXTERNAL_ENGINE, N_("External"), RE_INTERNAL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
&draw_engine_external_type,
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
RenderEngineType DRW_engine_viewport_workbench_type = {
|
||||
NULL, NULL,
|
||||
WORKBENCH_ENGINE, N_("Workbench"), RE_INTERNAL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
&draw_engine_workbench_solid,
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -2026,10 +2026,10 @@ void DRW_engine_register(DrawEngineType *draw_engine_type)
|
|||
void DRW_engines_register(void)
|
||||
{
|
||||
#ifdef WITH_CLAY_ENGINE
|
||||
RE_engines_register(NULL, &DRW_engine_viewport_clay_type);
|
||||
RE_engines_register(&DRW_engine_viewport_clay_type);
|
||||
#endif
|
||||
RE_engines_register(NULL, &DRW_engine_viewport_eevee_type);
|
||||
RE_engines_register(NULL, &DRW_engine_viewport_workbench_type);
|
||||
RE_engines_register(&DRW_engine_viewport_eevee_type);
|
||||
RE_engines_register(&DRW_engine_viewport_workbench_type);
|
||||
|
||||
DRW_engine_register(&draw_engine_workbench_solid);
|
||||
|
||||
|
|
|
@ -165,14 +165,6 @@ static void EDIT_ARMATURE_draw_scene(void *vedata)
|
|||
DRW_draw_pass(psl->bone_axes);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void EDIT_ARMATURE_collection_settings_create(CollectionEngineSettings *ces)
|
||||
{
|
||||
BLI_assert(ces);
|
||||
//BKE_collection_engine_property_add_int(ces, "show_occlude_wire", false);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const DrawEngineDataSize EDIT_ARMATURE_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_ARMATURE_Data);
|
||||
|
||||
DrawEngineType draw_engine_edit_armature_type = {
|
||||
|
|
|
@ -319,27 +319,6 @@ static void EDIT_CURVE_engine_free(void)
|
|||
DRW_SHADER_FREE_SAFE(e_data.overlay_vert_sh);
|
||||
}
|
||||
|
||||
/* Create collection settings here.
|
||||
*
|
||||
* Be sure to add this function there :
|
||||
* source/blender/draw/DRW_engine.h
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
* source/blenderplayer/bad_level_call_stubs/stubs.c
|
||||
*
|
||||
* And relevant collection settings to :
|
||||
* source/blender/makesrna/intern/rna_scene.c
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
*/
|
||||
#if 0
|
||||
void EDIT_CURVE_collection_settings_create(CollectionEngineSettings *ces)
|
||||
{
|
||||
BLI_assert(ces);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_bool_prop", false);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_int_prop", 0);
|
||||
// BKE_collection_engine_property_add_float(ces, "my_float_prop", 0.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const DrawEngineDataSize EDIT_CURVE_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_CURVE_Data);
|
||||
|
||||
DrawEngineType draw_engine_edit_curve_type = {
|
||||
|
|
|
@ -259,27 +259,6 @@ static void EDIT_LATTICE_engine_free(void)
|
|||
DRW_SHADER_FREE_SAFE(e_data.overlay_vert_sh);
|
||||
}
|
||||
|
||||
/* Create collection settings here.
|
||||
*
|
||||
* Be sure to add this function there :
|
||||
* source/blender/draw/DRW_engine.h
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
* source/blenderplayer/bad_level_call_stubs/stubs.c
|
||||
*
|
||||
* And relevant collection settings to :
|
||||
* source/blender/makesrna/intern/rna_scene.c
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
*/
|
||||
#if 0
|
||||
void EDIT_LATTICE_collection_settings_create(CollectionEngineSettings *ces)
|
||||
{
|
||||
BLI_assert(ces);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_bool_prop", false);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_int_prop", 0);
|
||||
// BKE_collection_engine_property_add_float(ces, "my_float_prop", 0.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const DrawEngineDataSize EDIT_LATTICE_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_LATTICE_Data);
|
||||
|
||||
DrawEngineType draw_engine_edit_lattice_type = {
|
||||
|
|
|
@ -215,27 +215,6 @@ static void EDIT_METABALL_engine_free(void)
|
|||
// DRW_SHADER_FREE_SAFE(custom_shader);
|
||||
}
|
||||
|
||||
/* Create collection settings here.
|
||||
*
|
||||
* Be sure to add this function there :
|
||||
* source/blender/draw/DRW_engine.h
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
* source/blenderplayer/bad_level_call_stubs/stubs.c
|
||||
*
|
||||
* And relevant collection settings to :
|
||||
* source/blender/makesrna/intern/rna_scene.c
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
*/
|
||||
#if 0
|
||||
void EDIT_METABALL_collection_settings_create(CollectionEngineSettings *ces)
|
||||
{
|
||||
BLI_assert(ces);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_bool_prop", false);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_int_prop", 0);
|
||||
// BKE_collection_engine_property_add_float(ces, "my_float_prop", 0.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const DrawEngineDataSize EDIT_METABALL_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_METABALL_Data);
|
||||
|
||||
DrawEngineType draw_engine_edit_metaball_type = {
|
||||
|
|
|
@ -231,27 +231,6 @@ static void EDIT_SURFACE_engine_free(void)
|
|||
// DRW_SHADER_FREE_SAFE(custom_shader);
|
||||
}
|
||||
|
||||
/* Create collection settings here.
|
||||
*
|
||||
* Be sure to add this function there :
|
||||
* source/blender/draw/DRW_engine.h
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
* source/blenderplayer/bad_level_call_stubs/stubs.c
|
||||
*
|
||||
* And relevant collection settings to :
|
||||
* source/blender/makesrna/intern/rna_scene.c
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
*/
|
||||
#if 0
|
||||
void EDIT_SURFACE_collection_settings_create(CollectionEngineSettings *ces)
|
||||
{
|
||||
BLI_assert(ces);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_bool_prop", false);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_int_prop", 0);
|
||||
// BKE_collection_engine_property_add_float(ces, "my_float_prop", 0.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const DrawEngineDataSize EDIT_SURFACE_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_SURFACE_Data);
|
||||
|
||||
DrawEngineType draw_engine_edit_surface_type = {
|
||||
|
|
|
@ -272,27 +272,6 @@ static void EDIT_TEXT_engine_free(void)
|
|||
// DRW_SHADER_FREE_SAFE(custom_shader);
|
||||
}
|
||||
|
||||
/* Create collection settings here.
|
||||
*
|
||||
* Be sure to add this function there :
|
||||
* source/blender/draw/DRW_engine.h
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
* source/blenderplayer/bad_level_call_stubs/stubs.c
|
||||
*
|
||||
* And relevant collection settings to :
|
||||
* source/blender/makesrna/intern/rna_scene.c
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
*/
|
||||
#if 0
|
||||
void EDIT_TEXT_collection_settings_create(CollectionEngineSettings *ces)
|
||||
{
|
||||
BLI_assert(ces);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_bool_prop", false);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_int_prop", 0);
|
||||
// BKE_collection_engine_property_add_float(ces, "my_float_prop", 0.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const DrawEngineDataSize EDIT_TEXT_data_size = DRW_VIEWPORT_DATA_SIZE(EDIT_TEXT_Data);
|
||||
|
||||
DrawEngineType draw_engine_edit_text_type = {
|
||||
|
|
|
@ -379,27 +379,6 @@ static void PAINT_TEXTURE_engine_free(void)
|
|||
DRW_SHADER_FREE_SAFE(e_data.wire_overlay_shader);
|
||||
}
|
||||
|
||||
/* Create collection settings here.
|
||||
*
|
||||
* Be sure to add this function there :
|
||||
* source/blender/draw/DRW_engine.h
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
* source/blenderplayer/bad_level_call_stubs/stubs.c
|
||||
*
|
||||
* And relevant collection settings to :
|
||||
* source/blender/makesrna/intern/rna_scene.c
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
*/
|
||||
#if 0
|
||||
void PAINT_TEXTURE_collection_settings_create(CollectionEngineSettings *ces)
|
||||
{
|
||||
BLI_assert(ces);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_bool_prop", false);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_int_prop", 0);
|
||||
// BKE_collection_engine_property_add_float(ces, "my_float_prop", 0.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const DrawEngineDataSize PAINT_TEXTURE_data_size = DRW_VIEWPORT_DATA_SIZE(PAINT_TEXTURE_Data);
|
||||
|
||||
DrawEngineType draw_engine_paint_texture_type = {
|
||||
|
|
|
@ -276,25 +276,6 @@ static void POSE_draw_scene(void *vedata)
|
|||
DRW_draw_pass(psl->bone_axes);
|
||||
}
|
||||
|
||||
/* Create collection settings here.
|
||||
*
|
||||
* Be sure to add this function there :
|
||||
* source/blender/draw/DRW_engine.h
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
* source/blenderplayer/bad_level_call_stubs/stubs.c
|
||||
*
|
||||
* And relevant collection settings to :
|
||||
* source/blender/makesrna/intern/rna_scene.c
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
*/
|
||||
#if 0
|
||||
void POSE_collection_settings_create(CollectionEngineSettings *ces)
|
||||
{
|
||||
BLI_assert(ces);
|
||||
// BKE_collection_engine_property_add_int(ces, "foo", 37);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const DrawEngineDataSize POSE_data_size = DRW_VIEWPORT_DATA_SIZE(POSE_Data);
|
||||
|
||||
DrawEngineType draw_engine_pose_type = {
|
||||
|
|
|
@ -263,27 +263,6 @@ static void SCULPT_engine_free(void)
|
|||
// DRW_SHADER_FREE_SAFE(custom_shader);
|
||||
}
|
||||
|
||||
/* Create collection settings here.
|
||||
*
|
||||
* Be sure to add this function there :
|
||||
* source/blender/draw/DRW_engine.h
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
* source/blenderplayer/bad_level_call_stubs/stubs.c
|
||||
*
|
||||
* And relevant collection settings to :
|
||||
* source/blender/makesrna/intern/rna_scene.c
|
||||
* source/blender/blenkernel/intern/layer.c
|
||||
*/
|
||||
#if 0
|
||||
void SCULPT_collection_settings_create(CollectionEngineSettings *ces)
|
||||
{
|
||||
BLI_assert(ces);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_bool_prop", false);
|
||||
// BKE_collection_engine_property_add_int(ces, "my_int_prop", 0);
|
||||
// BKE_collection_engine_property_add_float(ces, "my_float_prop", 0.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const DrawEngineDataSize SCULPT_data_size = DRW_VIEWPORT_DATA_SIZE(SCULPT_Data);
|
||||
|
||||
DrawEngineType draw_engine_sculpt_type = {
|
||||
|
|
|
@ -72,7 +72,6 @@ typedef struct ViewLayer {
|
|||
struct SceneStats *stats; /* default allocated now */
|
||||
struct Base *basact;
|
||||
ListBase layer_collections; /* LayerCollection */
|
||||
struct IDProperty *properties_evaluated;
|
||||
|
||||
/* Old SceneRenderLayer data. */
|
||||
int layflag;
|
||||
|
|
|
@ -1512,7 +1512,6 @@ typedef struct Scene {
|
|||
ListBase view_layers;
|
||||
struct SceneCollection *collection;
|
||||
|
||||
IDProperty *collection_properties; /* settings to be overriden by layer collections */
|
||||
IDProperty *layer_properties; /* settings to be override by workspaces */
|
||||
|
||||
struct SceneDisplay display;
|
||||
|
|
|
@ -247,201 +247,8 @@ static void rna_SceneCollection_object_unlink(
|
|||
WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene);
|
||||
}
|
||||
|
||||
/****** layer collection engine settings *******/
|
||||
|
||||
#define RNA_LAYER_ENGINE_GET_SET(_TYPE_, _ENGINE_, _NAME_) \
|
||||
static _TYPE_ rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr) \
|
||||
{ \
|
||||
IDProperty *props = (IDProperty *)ptr->data; \
|
||||
return BKE_collection_engine_property_value_get_##_TYPE_(props, #_NAME_); \
|
||||
} \
|
||||
\
|
||||
static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, _TYPE_ value) \
|
||||
{ \
|
||||
IDProperty *props = (IDProperty *)ptr->data; \
|
||||
BKE_collection_engine_property_value_set_##_TYPE_(props, #_NAME_, value); \
|
||||
}
|
||||
|
||||
#define RNA_LAYER_ENGINE_GET_SET_ARRAY(_TYPE_, _ENGINE_, _NAME_, _LEN_) \
|
||||
static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr, _TYPE_ *values) \
|
||||
{ \
|
||||
IDProperty *props = (IDProperty *)ptr->data; \
|
||||
IDProperty *idprop = IDP_GetPropertyFromGroup(props, #_NAME_); \
|
||||
if (idprop != NULL) { \
|
||||
memcpy(values, IDP_Array(idprop), sizeof(_TYPE_) * idprop->len); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, const _TYPE_ *values) \
|
||||
{ \
|
||||
IDProperty *props = (IDProperty *)ptr->data; \
|
||||
BKE_collection_engine_property_value_set_##_TYPE_##_array(props, #_NAME_, values); \
|
||||
}
|
||||
|
||||
#undef RNA_LAYER_ENGINE_GET_SET
|
||||
|
||||
static void UNUSED_FUNCTION(rna_ViewLayerEngineSettings_update)(bContext *C, PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
/* TODO(sergey): Use proper flag for tagging here. */
|
||||
DEG_id_tag_update(&scene->id, 0);
|
||||
}
|
||||
|
||||
static void UNUSED_FUNCTION(rna_LayerCollectionEngineSettings_update)(bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
ID *id = ptr->id.data;
|
||||
/* TODO(sergey): Use proper flag for tagging here. */
|
||||
DEG_id_tag_update(id, 0);
|
||||
|
||||
/* Instead of passing 'noteflag' to the rna update function, we handle the notifier ourselves.
|
||||
* We need to do this because the LayerCollection may be coming from different ID types (Scene or Group)
|
||||
* and when using NC_SCENE the id most match the active scene for the listener to receive the notification.*/
|
||||
|
||||
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
|
||||
}
|
||||
|
||||
/***********************************/
|
||||
|
||||
static void engine_settings_use(IDProperty *root, IDProperty *props, PointerRNA *props_ptr, const char *identifier)
|
||||
{
|
||||
PropertyRNA *prop = RNA_struct_find_property(props_ptr, identifier);
|
||||
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_FLOAT:
|
||||
{
|
||||
float value = BKE_collection_engine_property_value_get_float(props, identifier);
|
||||
BKE_collection_engine_property_add_float(root, identifier, value);
|
||||
break;
|
||||
}
|
||||
case PROP_ENUM:
|
||||
{
|
||||
int value = BKE_collection_engine_property_value_get_int(props, identifier);
|
||||
BKE_collection_engine_property_add_int(root, identifier, value);
|
||||
break;
|
||||
}
|
||||
case PROP_INT:
|
||||
{
|
||||
int value = BKE_collection_engine_property_value_get_int(props, identifier);
|
||||
BKE_collection_engine_property_add_int(root, identifier, value);
|
||||
break;
|
||||
}
|
||||
case PROP_BOOLEAN:
|
||||
{
|
||||
int value = BKE_collection_engine_property_value_get_int(props, identifier);
|
||||
BKE_collection_engine_property_add_bool(root, identifier, value);
|
||||
break;
|
||||
}
|
||||
case PROP_STRING:
|
||||
case PROP_POINTER:
|
||||
case PROP_COLLECTION:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static StructRNA *rna_ViewLayerSettings_refine(PointerRNA *ptr)
|
||||
{
|
||||
IDProperty *props = (IDProperty *)ptr->data;
|
||||
BLI_assert(props && props->type == IDP_GROUP);
|
||||
|
||||
switch (props->subtype) {
|
||||
case IDP_GROUP_SUB_ENGINE_RENDER:
|
||||
break;
|
||||
default:
|
||||
BLI_assert(!"Mode not fully implemented");
|
||||
break;
|
||||
}
|
||||
|
||||
return &RNA_ViewLayerSettings;
|
||||
}
|
||||
|
||||
static void rna_ViewLayerSettings_name_get(PointerRNA *ptr, char *value)
|
||||
{
|
||||
IDProperty *props = (IDProperty *)ptr->data;
|
||||
strcpy(value, props->name);
|
||||
}
|
||||
|
||||
static int rna_ViewLayerSettings_name_length(PointerRNA *ptr)
|
||||
{
|
||||
IDProperty *props = (IDProperty *)ptr->data;
|
||||
return strnlen(props->name, sizeof(props->name));
|
||||
}
|
||||
|
||||
static void rna_ViewLayerSettings_use(ID *id, IDProperty *props, const char *identifier)
|
||||
{
|
||||
Scene *scene = (Scene *)id;
|
||||
PointerRNA scene_props_ptr;
|
||||
IDProperty *scene_props;
|
||||
|
||||
scene_props = BKE_view_layer_engine_scene_get(scene, props->name);
|
||||
RNA_pointer_create(id, &RNA_ViewLayerSettings, scene_props, &scene_props_ptr);
|
||||
|
||||
engine_settings_use(props, scene_props, &scene_props_ptr, identifier);
|
||||
|
||||
/* TODO(sergey): Use proper flag for tagging here. */
|
||||
DEG_id_tag_update(id, 0);
|
||||
}
|
||||
|
||||
static void rna_ViewLayerSettings_unuse(ID *id, IDProperty *props, const char *identifier)
|
||||
{
|
||||
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, 0);
|
||||
}
|
||||
|
||||
static StructRNA *rna_LayerCollectionSettings_refine(PointerRNA *ptr)
|
||||
{
|
||||
IDProperty *props = (IDProperty *)ptr->data;
|
||||
BLI_assert(props && props->type == IDP_GROUP);
|
||||
|
||||
switch (props->subtype) {
|
||||
case IDP_GROUP_SUB_ENGINE_RENDER:
|
||||
break;
|
||||
default:
|
||||
BLI_assert(!"Mode not fully implemented");
|
||||
break;
|
||||
}
|
||||
|
||||
return &RNA_LayerCollectionSettings;
|
||||
}
|
||||
|
||||
static void rna_LayerCollectionSettings_name_get(PointerRNA *ptr, char *value)
|
||||
{
|
||||
IDProperty *props = (IDProperty *)ptr->data;
|
||||
strcpy(value, props->name);
|
||||
}
|
||||
|
||||
static int rna_LayerCollectionSettings_name_length(PointerRNA *ptr)
|
||||
{
|
||||
IDProperty *props = (IDProperty *)ptr->data;
|
||||
return strnlen(props->name, sizeof(props->name));
|
||||
}
|
||||
|
||||
static void rna_LayerCollectionSettings_use(ID *id, IDProperty *props, const char *identifier)
|
||||
{
|
||||
Scene *scene = (Scene *)id;
|
||||
PointerRNA scene_props_ptr;
|
||||
IDProperty *scene_props;
|
||||
|
||||
scene_props = BKE_layer_collection_engine_scene_get(scene, props->name);
|
||||
RNA_pointer_create(id, &RNA_LayerCollectionSettings, scene_props, &scene_props_ptr);
|
||||
engine_settings_use(props, scene_props, &scene_props_ptr, identifier);
|
||||
|
||||
/* TODO(sergey): Use proper flag for tagging here. */
|
||||
DEG_id_tag_update(id, 0);
|
||||
}
|
||||
|
||||
static void rna_LayerCollectionSettings_unuse(ID *id, IDProperty *props, const char *identifier)
|
||||
{
|
||||
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, 0);
|
||||
}
|
||||
|
||||
static void rna_LayerCollection_name_get(PointerRNA *ptr, char *value)
|
||||
{
|
||||
SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection;
|
||||
|
@ -857,78 +664,6 @@ static void rna_def_scene_collection(BlenderRNA *brna)
|
|||
RNA_def_function_return(func, parm);
|
||||
}
|
||||
|
||||
static void rna_def_view_layer_settings(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
srna = RNA_def_struct(brna, "ViewLayerSettings", NULL);
|
||||
RNA_def_struct_sdna(srna, "IDProperty");
|
||||
RNA_def_struct_ui_text(srna, "Scene Layer Settings",
|
||||
"Engine specific settings that can be overriden by ViewLayer");
|
||||
RNA_def_struct_refine_func(srna, "rna_ViewLayerSettings_refine");
|
||||
|
||||
RNA_define_verify_sdna(0);
|
||||
|
||||
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_funcs(prop, "rna_ViewLayerSettings_name_get", "rna_ViewLayerSettings_name_length", NULL);
|
||||
RNA_def_property_ui_text(prop, "Name", "Engine Name");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_struct_name_property(srna, prop);
|
||||
|
||||
func = RNA_def_function(srna, "use", "rna_ViewLayerSettings_use");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_ui_description(func, "Initialize this property to use");
|
||||
parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to set");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
|
||||
func = RNA_def_function(srna, "unuse", "rna_ViewLayerSettings_unuse");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_ui_description(func, "Remove the property");
|
||||
parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to unset");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
|
||||
RNA_define_verify_sdna(1);
|
||||
}
|
||||
|
||||
static void rna_def_layer_collection_settings(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
srna = RNA_def_struct(brna, "LayerCollectionSettings", NULL);
|
||||
RNA_def_struct_sdna(srna, "IDProperty");
|
||||
RNA_def_struct_ui_text(srna, "Layer Collection Settings",
|
||||
"Engine specific settings that can be overriden by LayerCollection");
|
||||
RNA_def_struct_refine_func(srna, "rna_LayerCollectionSettings_refine");
|
||||
|
||||
RNA_define_verify_sdna(0);
|
||||
|
||||
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_funcs(prop, "rna_LayerCollectionSettings_name_get", "rna_LayerCollectionSettings_name_length", NULL);
|
||||
RNA_def_property_ui_text(prop, "Name", "Engine Name");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_struct_name_property(srna, prop);
|
||||
|
||||
func = RNA_def_function(srna, "use", "rna_LayerCollectionSettings_use");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_ui_description(func, "Initialize this property to use");
|
||||
parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to set");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
|
||||
func = RNA_def_function(srna, "unuse", "rna_LayerCollectionSettings_unuse");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_ui_description(func, "Remove the property");
|
||||
parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to unset");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
|
||||
RNA_define_verify_sdna(1);
|
||||
}
|
||||
|
||||
static void rna_def_layer_collection(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
|
@ -1189,8 +924,6 @@ void RNA_def_view_layer(BlenderRNA *brna)
|
|||
rna_def_object_base(brna);
|
||||
RNA_define_animate_sdna(true);
|
||||
/* *** Animated *** */
|
||||
rna_def_view_layer_settings(brna);
|
||||
rna_def_layer_collection_settings(brna);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -264,23 +264,6 @@ static void engine_update_script_node(RenderEngine *engine, struct bNodeTree *nt
|
|||
RNA_parameter_list_free(&list);
|
||||
}
|
||||
|
||||
static void engine_collection_settings_create(RenderEngine *engine, struct IDProperty *props)
|
||||
{
|
||||
extern FunctionRNA rna_RenderEngine_collection_settings_create_func;
|
||||
PointerRNA ptr;
|
||||
ParameterList list;
|
||||
FunctionRNA *func;
|
||||
|
||||
RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
|
||||
func = &rna_RenderEngine_collection_settings_create_func;
|
||||
|
||||
RNA_parameter_list_create(&list, &ptr, func);
|
||||
RNA_parameter_set_lookup(&list, "props", &props);
|
||||
engine->type->ext.call(NULL, &ptr, func, &list);
|
||||
|
||||
RNA_parameter_list_free(&list);
|
||||
}
|
||||
|
||||
static void engine_update_render_passes(RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer)
|
||||
{
|
||||
extern FunctionRNA rna_RenderEngine_update_render_passes_func;
|
||||
|
@ -366,9 +349,8 @@ static StructRNA *rna_RenderEngine_register(
|
|||
et->render_to_view = (have_function[4]) ? engine_render_to_view : NULL;
|
||||
et->update_script_node = (have_function[5]) ? engine_update_script_node : NULL;
|
||||
et->update_render_passes = (have_function[6]) ? engine_update_render_passes : NULL;
|
||||
et->collection_settings_create = (have_function[7]) ? engine_collection_settings_create : NULL;
|
||||
|
||||
RE_engines_register(bmain, et);
|
||||
RE_engines_register(et);
|
||||
|
||||
return et->ext.srna;
|
||||
}
|
||||
|
@ -560,13 +542,6 @@ static void rna_def_render_engine(BlenderRNA *brna)
|
|||
parm = RNA_def_pointer(func, "scene", "Scene", "", "");
|
||||
parm = RNA_def_pointer(func, "renderlayer", "ViewLayer", "", "");
|
||||
|
||||
/* per-collection engine settings initialization */
|
||||
func = RNA_def_function(srna, "collection_settings_create", NULL);
|
||||
RNA_def_function_ui_description(func, "Create the per collection settings for the engine");
|
||||
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
|
||||
parm = RNA_def_pointer(func, "collection_settings", "LayerCollectionSettings", "", "");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
||||
|
||||
/* tag for redraw */
|
||||
func = RNA_def_function(srna, "tag_redraw", "engine_tag_redraw");
|
||||
RNA_def_function_ui_description(func, "Request redraw for viewport rendering");
|
||||
|
|
|
@ -6429,19 +6429,6 @@ void RNA_def_scene(BlenderRNA *brna)
|
|||
RNA_def_property_struct_type(prop, "RenderSettings");
|
||||
RNA_def_property_ui_text(prop, "Render Data", "");
|
||||
|
||||
/* Render Engine Data */
|
||||
prop = RNA_def_property(srna, "layer_properties", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "layer_properties->data.group", NULL);
|
||||
RNA_def_property_struct_type(prop, "ViewLayerSettings");
|
||||
RNA_def_property_ui_text(prop, "Layer Settings",
|
||||
"Engine specific render settings to be overridden by layers");
|
||||
|
||||
prop = RNA_def_property(srna, "collection_properties", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "collection_properties->data.group", NULL);
|
||||
RNA_def_property_struct_type(prop, "LayerCollectionSettings");
|
||||
RNA_def_property_ui_text(prop, "Collection Settings",
|
||||
"Engine specific render settings to be overridden by collections");
|
||||
|
||||
/* Safe Areas */
|
||||
prop = RNA_def_property(srna, "safe_areas", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "safe_areas");
|
||||
|
|
|
@ -107,9 +107,6 @@ typedef struct RenderEngineType {
|
|||
void (*update_script_node)(struct RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node);
|
||||
void (*update_render_passes)(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer);
|
||||
|
||||
void (*collection_settings_create)(struct RenderEngine *engine, struct IDProperty *props);
|
||||
void (*render_settings_create)(struct RenderEngine *engine, struct IDProperty *props);
|
||||
|
||||
struct DrawEngineType *draw_engine;
|
||||
|
||||
/* RNA integration */
|
||||
|
@ -187,7 +184,7 @@ void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, s
|
|||
|
||||
void RE_engines_init(void);
|
||||
void RE_engines_exit(void);
|
||||
void RE_engines_register(struct Main *bmain, RenderEngineType *render_type);
|
||||
void RE_engines_register(RenderEngineType *render_type);
|
||||
|
||||
bool RE_engine_is_opengl(RenderEngineType *render_type);
|
||||
|
||||
|
|
|
@ -87,9 +87,6 @@ void RE_engines_exit(void)
|
|||
|
||||
DRW_engines_free();
|
||||
|
||||
BKE_layer_collection_engine_settings_callback_free();
|
||||
BKE_view_layer_engine_settings_callback_free();
|
||||
|
||||
for (type = R_engines.first; type; type = next) {
|
||||
next = type->next;
|
||||
|
||||
|
@ -104,19 +101,11 @@ void RE_engines_exit(void)
|
|||
}
|
||||
}
|
||||
|
||||
void RE_engines_register(Main *bmain, RenderEngineType *render_type)
|
||||
void RE_engines_register(RenderEngineType *render_type)
|
||||
{
|
||||
if (render_type->draw_engine) {
|
||||
DRW_engine_register(render_type->draw_engine);
|
||||
}
|
||||
if (render_type->collection_settings_create) {
|
||||
BKE_layer_collection_engine_settings_callback_register(
|
||||
bmain, render_type->idname, render_type->collection_settings_create);
|
||||
}
|
||||
if (render_type->render_settings_create) {
|
||||
BKE_view_layer_engine_settings_callback_register(
|
||||
bmain, render_type->idname, render_type->render_settings_create);
|
||||
}
|
||||
BLI_addtail(&R_engines, render_type);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue