Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2022-04-03 20:37:41 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-04-03 20:37:41 +0300
commit25c09de0a16100d348909ee0fa5300293ecb757f (patch)
tree349c1fd229a4ed64cba98252b86d04b1b71d6527 /source/blender/makesrna/intern
parent7ec7fa03ea81814781e1b86113dd22d91bd087f8 (diff)
parent336082acba51b3a237338e2cc316b04320c05ad4 (diff)
Merge branch 'master' into temp-sculpt-colors
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/rna_access_compare_override.c4
-rw-r--r--source/blender/makesrna/intern/rna_animation.c8
-rw-r--r--source/blender/makesrna/intern/rna_collection.c6
-rw-r--r--source/blender/makesrna/intern/rna_internal.h4
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c3
-rw-r--r--source/blender/makesrna/intern/rna_object.c40
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c33
-rw-r--r--source/blender/makesrna/intern/rna_pose.c5
-rw-r--r--source/blender/makesrna/intern/rna_rna.c28
-rw-r--r--source/blender/makesrna/intern/rna_scene.c104
-rw-r--r--source/blender/makesrna/intern/rna_space.c22
-rw-r--r--source/blender/makesrna/intern/rna_world.c23
14 files changed, 256 insertions, 28 deletions
diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c
index cce310e4b6d..5974788884e 100644
--- a/source/blender/makesrna/intern/rna_access_compare_override.c
+++ b/source/blender/makesrna/intern/rna_access_compare_override.c
@@ -612,10 +612,6 @@ static bool rna_property_override_operation_apply(Main *bmain,
ptr_item_src,
ptr_item_storage,
opop);
- if (success) {
- RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
- }
-
return success;
}
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index ba7f3c55460..4f07cb235fa 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -680,7 +680,7 @@ static FCurve *rna_Driver_find(AnimData *adt,
return BKE_fcurve_find(&adt->drivers, data_path, index);
}
-bool rna_AnimaData_override_apply(Main *UNUSED(bmain),
+bool rna_AnimaData_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *ptr_storage,
@@ -707,11 +707,13 @@ bool rna_AnimaData_override_apply(Main *UNUSED(bmain),
if (adt_dst == NULL && adt_src != NULL) {
/* Copy anim data from reference into final local ID. */
BKE_animdata_copy_id(NULL, ptr_dst->owner_id, ptr_src->owner_id, 0);
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
else if (adt_dst != NULL && adt_src == NULL) {
/* Override has cleared/removed anim data from its reference. */
BKE_animdata_free(ptr_dst->owner_id, true);
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
@@ -722,7 +724,7 @@ bool rna_NLA_tracks_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *prop_dst,
PropertyRNA *UNUSED(prop_src),
PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst),
@@ -771,6 +773,8 @@ bool rna_NLA_tracks_override_apply(Main *bmain,
BLI_insertlinkafter(&anim_data_dst->nla_tracks, nla_track_anchor, nla_track_dst);
// printf("%s: We inserted a NLA Track...\n", __func__);
+
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c
index eceabe65a67..599d36c0af7 100644
--- a/source/blender/makesrna/intern/rna_collection.c
+++ b/source/blender/makesrna/intern/rna_collection.c
@@ -138,7 +138,7 @@ static bool rna_Collection_objects_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *UNUSED(ptr_src),
PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *prop_dst,
PropertyRNA *UNUSED(prop_src),
PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst),
@@ -185,6 +185,7 @@ static bool rna_Collection_objects_override_apply(Main *bmain,
BKE_main_collection_sync(bmain);
}
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
@@ -245,7 +246,7 @@ static bool rna_Collection_children_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *UNUSED(ptr_src),
PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *prop_dst,
PropertyRNA *UNUSED(prop_src),
PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst),
@@ -287,6 +288,7 @@ static bool rna_Collection_children_override_apply(Main *bmain,
BKE_collection_object_cache_free(coll_dst);
BKE_main_collection_sync(bmain);
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 7fb84246fc0..ba040f88b55 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -360,6 +360,10 @@ void rna_ViewLayer_active_aov_index_range(
PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax);
int rna_ViewLayer_active_aov_index_get(PointerRNA *ptr);
void rna_ViewLayer_active_aov_index_set(PointerRNA *ptr, int value);
+void rna_ViewLayer_active_lightgroup_index_range(
+ PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax);
+int rna_ViewLayer_active_lightgroup_index_get(PointerRNA *ptr);
+void rna_ViewLayer_active_lightgroup_index_set(PointerRNA *ptr, int value);
/**
* Set `r_rna_path` with the base view-layer path.
* `rna_path_buffer_size` should be at least `sizeof(ViewLayer.name) * 3`.
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index b239260c8eb..6c621604e40 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -92,6 +92,7 @@
# include "DNA_volume_types.h"
# include "DNA_world_types.h"
+# include "ED_node.h"
# include "ED_screen.h"
# include "BLT_translation.h"
@@ -291,6 +292,7 @@ static struct bNodeTree *rna_Main_nodetree_new(Main *bmain, const char *name, in
bNodeTreeType *typeinfo = rna_node_tree_type_from_enum(type);
if (typeinfo) {
bNodeTree *ntree = ntreeAddTree(bmain, safe_name, typeinfo->idname);
+ ED_node_tree_propagate_change(NULL, bmain, ntree);
id_us_min(&ntree->id);
return ntree;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index fe0d4fed838..54031f5a416 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -896,7 +896,7 @@ static void rna_HookModifier_object_set(PointerRNA *ptr,
BKE_object_modifier_hook_reset(owner, hmd);
}
-static bool rna_HookModifier_object_override_apply(Main *UNUSED(bmain),
+static bool rna_HookModifier_object_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *ptr_storage,
@@ -934,6 +934,7 @@ static bool rna_HookModifier_object_override_apply(Main *UNUSED(bmain),
/* The only case where we do want default behavior (with matrix reset). */
BKE_object_modifier_hook_reset(owner, hmd);
}
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 0b39c8e27c7..f995ee3383e 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -646,7 +646,7 @@ static void rna_Object_parent_set(PointerRNA *ptr,
}
}
-static bool rna_Object_parent_override_apply(Main *UNUSED(bmain),
+static bool rna_Object_parent_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *ptr_storage,
@@ -683,6 +683,7 @@ static bool rna_Object_parent_override_apply(Main *UNUSED(bmain),
else {
ob->parent = parent_src;
}
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
@@ -1667,11 +1668,11 @@ static bConstraint *rna_Object_constraints_copy(Object *object, Main *bmain, Poi
return new_con;
}
-bool rna_Object_constraints_override_apply(Main *UNUSED(bmain),
+bool rna_Object_constraints_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *prop_dst,
PropertyRNA *UNUSED(prop_src),
PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst),
@@ -1716,6 +1717,7 @@ bool rna_Object_constraints_override_apply(Main *UNUSED(bmain),
BKE_constraint_unique_name(con_dst, &ob_dst->constraints);
// printf("%s: We inserted a constraint...\n", __func__);
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
@@ -1786,7 +1788,7 @@ bool rna_Object_modifiers_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *prop_dst,
PropertyRNA *UNUSED(prop_src),
PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst),
@@ -1847,6 +1849,7 @@ bool rna_Object_modifiers_override_apply(Main *bmain,
BLI_insertlinkafter(&ob_dst->modifiers, mod_anchor, mod_dst);
// printf("%s: We inserted a modifier '%s'...\n", __func__, mod_dst->name);
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
@@ -1883,7 +1886,7 @@ bool rna_Object_greasepencil_modifiers_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *prop_dst,
PropertyRNA *UNUSED(prop_src),
PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst),
@@ -1932,6 +1935,7 @@ bool rna_Object_greasepencil_modifiers_override_apply(Main *bmain,
BLI_insertlinkafter(&ob_dst->greasepencil_modifiers, mod_anchor, mod_dst);
// printf("%s: We inserted a gpencil modifier '%s'...\n", __func__, mod_dst->name);
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
@@ -1967,7 +1971,7 @@ static void rna_Object_shaderfx_clear(Object *object, bContext *C)
static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
{
Object *ob = (Object *)ptr->owner_id;
- BoundBox *bb = BKE_object_boundbox_get(ob);
+ const BoundBox *bb = BKE_object_boundbox_get(ob);
if (bb) {
memcpy(values, bb->vec, sizeof(bb->vec));
}
@@ -2288,6 +2292,21 @@ static int rna_Object_mesh_symmetry_yz_editable(PointerRNA *ptr, const char **UN
return PROP_EDITABLE;
}
+void rna_Object_lightgroup_get(PointerRNA *ptr, char *value)
+{
+ BKE_lightgroup_membership_get(((Object *)ptr->owner_id)->lightgroup, value);
+}
+
+int rna_Object_lightgroup_length(PointerRNA *ptr)
+{
+ return BKE_lightgroup_membership_length(((Object *)ptr->owner_id)->lightgroup);
+}
+
+void rna_Object_lightgroup_set(PointerRNA *ptr, const char *value)
+{
+ BKE_lightgroup_membership_set(&((Object *)ptr->owner_id)->lightgroup, value);
+}
+
#else
static void rna_def_vertex_group(BlenderRNA *brna)
@@ -3771,6 +3790,15 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_editable_func(prop, "rna_Object_mesh_symmetry_yz_editable");
RNA_def_property_ui_text(prop, "Z", "Enable mesh symmetry in the Z axis");
+ /* Lightgroup Membership */
+ prop = RNA_def_property(srna, "lightgroup", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_Object_lightgroup_get",
+ "rna_Object_lightgroup_length",
+ "rna_Object_lightgroup_set");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Lightgroup", "Lightgroup that the object belongs to");
+
RNA_define_lib_overridable(false);
/* anim */
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index ece1c5e5815..6967f78026a 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -594,7 +594,7 @@ static void rna_Object_ray_cast(Object *ob,
}
/* Test BoundBox first (efficiency) */
- BoundBox *bb = BKE_object_boundbox_get(ob);
+ const BoundBox *bb = BKE_object_boundbox_get(ob);
float distmin;
/* Needed for valid distance check from #isect_ray_aabb_v3_simple() call. */
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 8579f188428..ce4b1a193a3 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -49,6 +49,8 @@ static const EnumPropertyItem effector_shape_items[] = {
# include "BLI_math_base.h"
+# include "RNA_access.h"
+
/* type specific return values only used from functions */
static const EnumPropertyItem curve_shape_items[] = {
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
@@ -239,6 +241,33 @@ static void rna_Cache_toggle_disk_cache(Main *UNUSED(bmain), Scene *UNUSED(scene
}
}
+bool rna_Cache_use_disk_cache_override_apply(Main *UNUSED(bmain),
+ PointerRNA *ptr_dst,
+ PointerRNA *ptr_src,
+ PointerRNA *UNUSED(ptr_storage),
+ PropertyRNA *prop_dst,
+ PropertyRNA *prop_src,
+ PropertyRNA *UNUSED(prop_storage),
+ const int UNUSED(len_dst),
+ const int UNUSED(len_src),
+ const int UNUSED(len_storage),
+ PointerRNA *UNUSED(ptr_item_dst),
+ PointerRNA *UNUSED(ptr_item_src),
+ PointerRNA *UNUSED(ptr_item_storage),
+ IDOverrideLibraryPropertyOperation *opop)
+{
+ BLI_assert(RNA_property_type(prop_dst) == PROP_BOOLEAN);
+ BLI_assert(opop->operation == IDOVERRIDE_LIBRARY_OP_REPLACE);
+ UNUSED_VARS_NDEBUG(opop);
+
+ RNA_property_boolean_set(ptr_dst, prop_dst, RNA_property_boolean_get(ptr_src, prop_src));
+
+ /* DO NOT call `RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);`, that would trigger
+ * the whole 'update from mem point cache' process, ending up in the complete deletion of an
+ * existing diskcache if any. */
+ return true;
+}
+
static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = NULL;
@@ -407,7 +436,7 @@ int rna_Cache_info_length(PointerRNA *ptr)
PTCacheID pid = BKE_ptcache_id_find(ob, scene, cache);
- if (cache->flag & PTCACHE_FLAG_INFO_DIRTY) {
+ if (pid.cache != NULL && pid.cache->flag & PTCACHE_FLAG_INFO_DIRTY) {
BKE_ptcache_update_info(&pid);
}
@@ -983,6 +1012,7 @@ static void rna_def_pointcache_common(StructRNA *srna)
RNA_def_property_ui_text(
prop, "Disk Cache", "Save cache files to disk (.blend file must be saved first)");
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_toggle_disk_cache");
+ RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Cache_use_disk_cache_override_apply");
prop = RNA_def_property(srna, "is_outdated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_OUTDATED);
@@ -1016,6 +1046,7 @@ static void rna_def_pointcache_common(StructRNA *srna)
prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "info");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
/* Note that we do not actually need a getter here, `rna_Cache_info_length` will update the info
* string just as well. */
RNA_def_property_string_funcs(prop, NULL, "rna_Cache_info_length", NULL);
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 8b59962d858..2390fdd72f0 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -644,11 +644,11 @@ static bConstraint *rna_PoseChannel_constraints_copy(ID *id,
return new_con;
}
-bool rna_PoseChannel_constraints_override_apply(Main *UNUSED(bmain),
+bool rna_PoseChannel_constraints_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *prop_dst,
PropertyRNA *UNUSED(prop_src),
PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst),
@@ -694,6 +694,7 @@ bool rna_PoseChannel_constraints_override_apply(Main *UNUSED(bmain),
BKE_constraint_unique_name(con_dst, &pchan_dst->constraints);
// printf("%s: We inserted a constraint...\n", __func__);
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
return true;
}
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 8f1847c00f4..373df6b7444 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -2297,7 +2297,7 @@ bool rna_property_override_store_default(Main *UNUSED(bmain),
return changed;
}
-bool rna_property_override_apply_default(Main *UNUSED(bmain),
+bool rna_property_override_apply_default(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *ptr_storage,
@@ -2319,6 +2319,8 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
const int index = is_array ? opop->subitem_reference_index : 0;
const short override_op = opop->operation;
+ bool ret_success = true;
+
switch (RNA_property_type(prop_dst)) {
case PROP_BOOLEAN:
if (is_array && index == -1) {
@@ -2355,7 +2357,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
return false;
}
}
- return true;
+ break;
case PROP_INT:
if (is_array && index == -1) {
int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
@@ -2434,7 +2436,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
return false;
}
}
- return true;
+ break;
case PROP_FLOAT:
if (is_array && index == -1) {
float array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
@@ -2527,7 +2529,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
return false;
}
}
- return true;
+ break;
case PROP_ENUM: {
const int value = RNA_property_enum_get(ptr_src, prop_src);
@@ -2540,7 +2542,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
BLI_assert_msg(0, "Unsupported RNA override operation on enum");
return false;
}
- return true;
+ break;
}
case PROP_POINTER: {
PointerRNA value = RNA_property_pointer_get(ptr_src, prop_src);
@@ -2553,7 +2555,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
BLI_assert_msg(0, "Unsupported RNA override operation on pointer");
return false;
}
- return true;
+ break;
}
case PROP_STRING: {
char buff[256];
@@ -2571,7 +2573,7 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
if (value != buff) {
MEM_freeN(value);
}
- return true;
+ break;
}
case PROP_COLLECTION: {
/* We only support IDProperty-based collection insertion here. */
@@ -2636,19 +2638,27 @@ bool rna_property_override_apply_default(Main *UNUSED(bmain),
IDProperty *item_idprop_dst = item_ptr_dst.data;
IDP_CopyPropertyContent(item_idprop_dst, item_idprop_src);
- return RNA_property_collection_move(ptr_dst, prop_dst, item_index_added, item_index_dst);
+ ret_success = RNA_property_collection_move(
+ ptr_dst, prop_dst, item_index_added, item_index_dst);
+ break;
}
default:
BLI_assert_msg(0, "Unsupported RNA override operation on collection");
return false;
}
+ break;
}
default:
BLI_assert(0);
return false;
}
- return false;
+ /* Default apply callback always call property update. */
+ if (ret_success) {
+ RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
+ }
+
+ return ret_success;
}
# undef RNA_PROPERTY_GET_SINGLE
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 4c53d29c032..7095d8a4172 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1767,6 +1767,10 @@ void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
ViewLayerAOV *aov = (ViewLayerAOV *)ptr->data;
view_layer = BKE_view_layer_find_with_aov(scene, aov);
}
+ else if (ptr->type == &RNA_Lightgroup) {
+ ViewLayerLightgroup *lightgroup = (ViewLayerLightgroup *)ptr->data;
+ view_layer = BKE_view_layer_find_with_lightgroup(scene, lightgroup);
+ }
if (view_layer) {
RenderEngineType *engine_type = RE_engines_find(scene->r.engine);
@@ -2447,6 +2451,49 @@ void rna_ViewLayer_active_aov_index_set(PointerRNA *ptr, int value)
view_layer->active_aov = aov;
}
+void rna_ViewLayer_active_lightgroup_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
+{
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
+
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&view_layer->lightgroups) - 1);
+}
+
+int rna_ViewLayer_active_lightgroup_index_get(PointerRNA *ptr)
+{
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
+ return BLI_findindex(&view_layer->lightgroups, view_layer->active_lightgroup);
+}
+
+void rna_ViewLayer_active_lightgroup_index_set(PointerRNA *ptr, int value)
+{
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
+ ViewLayerLightgroup *lightgroup = BLI_findlink(&view_layer->lightgroups, value);
+ view_layer->active_lightgroup = lightgroup;
+}
+
+static void rna_ViewLayerLightgroup_name_get(PointerRNA *ptr, char *value)
+{
+ ViewLayerLightgroup *lightgroup = (ViewLayerLightgroup *)ptr->data;
+ BLI_strncpy(value, lightgroup->name, sizeof(lightgroup->name));
+}
+
+static int rna_ViewLayerLightgroup_name_length(PointerRNA *ptr)
+{
+ ViewLayerLightgroup *lightgroup = (ViewLayerLightgroup *)ptr->data;
+ return strlen(lightgroup->name);
+}
+
+static void rna_ViewLayerLightgroup_name_set(PointerRNA *ptr, const char *value)
+{
+ ViewLayerLightgroup *lightgroup = (ViewLayerLightgroup *)ptr->data;
+ Scene *scene = (Scene *)ptr->owner_id;
+ ViewLayer *view_layer = BKE_view_layer_find_with_lightgroup(scene, lightgroup);
+
+ BKE_view_layer_rename_lightgroup(view_layer, lightgroup, value);
+}
+
/* Fake value, used internally (not saved to DNA). */
# define V3D_ORIENT_DEFAULT -1
@@ -4156,6 +4203,43 @@ static void rna_def_view_layer_aov(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
}
+static void rna_def_view_layer_lightgroups(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ /* PropertyRNA *prop; */
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "Lightgroups");
+ srna = RNA_def_struct(brna, "Lightgroups", NULL);
+ RNA_def_struct_sdna(srna, "ViewLayer");
+ RNA_def_struct_ui_text(srna, "List of Lightgroups", "Collection of Lightgroups");
+
+ func = RNA_def_function(srna, "add", "BKE_view_layer_add_lightgroup");
+ parm = RNA_def_pointer(func, "lightgroup", "Lightgroup", "", "Newly created Lightgroup");
+ RNA_def_function_return(func, parm);
+}
+
+static void rna_def_view_layer_lightgroup(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+ srna = RNA_def_struct(brna, "Lightgroup", NULL);
+ RNA_def_struct_sdna(srna, "ViewLayerLightgroup");
+ RNA_def_struct_ui_text(srna, "Light Group", "");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ViewLayerLightgroup_name_get",
+ "rna_ViewLayerLightgroup_name_length",
+ "rna_ViewLayerLightgroup_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Name of the Lightgroup");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ RNA_def_struct_name_property(srna, prop);
+}
+
void rna_def_view_layer_common(BlenderRNA *brna, StructRNA *srna, const bool scene)
{
PropertyRNA *prop;
@@ -4226,6 +4310,25 @@ void rna_def_view_layer_common(BlenderRNA *brna, StructRNA *srna, const bool sce
RNA_def_property_ui_text(prop, "Active AOV Index", "Index of active aov");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ prop = RNA_def_property(srna, "lightgroups", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "lightgroups", NULL);
+ RNA_def_property_struct_type(prop, "Lightgroup");
+ RNA_def_property_ui_text(prop, "Light Groups", "");
+ rna_def_view_layer_lightgroups(brna, prop);
+
+ prop = RNA_def_property(srna, "active_lightgroup", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Lightgroup");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Light Groups", "Active Lightgroup");
+
+ prop = RNA_def_property(srna, "active_lightgroup_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_ViewLayer_active_lightgroup_index_get",
+ "rna_ViewLayer_active_lightgroup_index_set",
+ "rna_ViewLayer_active_lightgroup_index_range");
+ RNA_def_property_ui_text(prop, "Active Lightgroup Index", "Index of active lightgroup");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
prop = RNA_def_property(srna, "use_pass_cryptomatte_object", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cryptomatte_flag", VIEW_LAYER_CRYPTOMATTE_OBJECT);
RNA_def_property_ui_text(
@@ -8088,6 +8191,7 @@ void RNA_def_scene(BlenderRNA *brna)
rna_def_scene_display(brna);
rna_def_scene_eevee(brna);
rna_def_view_layer_aov(brna);
+ rna_def_view_layer_lightgroup(brna);
rna_def_view_layer_eevee(brna);
rna_def_scene_gpencil(brna);
RNA_define_animate_sdna(true);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 5927298ae0c..5f1eece5abf 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3593,6 +3593,21 @@ static void rna_def_space_outliner(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem lib_override_view_mode[] = {
+ {SO_LIB_OVERRIDE_VIEW_PROPERTIES,
+ "PROPERTIES",
+ ICON_NONE,
+ "Properties",
+ "Display all local override data-blocks with their overridden properties and buttons to "
+ "edit them"},
+ {SO_LIB_OVERRIDE_VIEW_HIERARCHIES,
+ "HIERARCHIES",
+ ICON_NONE,
+ "Hierarchies",
+ "Display library override relationships"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
static const EnumPropertyItem filter_state_items[] = {
{SO_FILTER_OB_ALL, "ALL", 0, "All", "Show all objects in the view layer"},
{SO_FILTER_OB_VISIBLE, "VISIBLE", 0, "Visible", "Show visible objects"},
@@ -3612,6 +3627,13 @@ static void rna_def_space_outliner(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+ prop = RNA_def_property(srna, "lib_override_view_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, lib_override_view_mode);
+ RNA_def_property_ui_text(prop,
+ "Library Override View Mode",
+ "Choose different visualizations of library override data");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "search_string");
RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 04008665342..d1049eef2c7 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -22,6 +22,7 @@
# include "MEM_guardedalloc.h"
# include "BKE_context.h"
+# include "BKE_layer.h"
# include "BKE_main.h"
# include "BKE_texture.h"
@@ -84,6 +85,21 @@ static void rna_World_use_nodes_update(bContext *C, PointerRNA *ptr)
rna_World_draw_update(bmain, scene, ptr);
}
+void rna_World_lightgroup_get(PointerRNA *ptr, char *value)
+{
+ BKE_lightgroup_membership_get(((World *)ptr->owner_id)->lightgroup, value);
+}
+
+int rna_World_lightgroup_length(PointerRNA *ptr)
+{
+ return BKE_lightgroup_membership_length(((World *)ptr->owner_id)->lightgroup);
+}
+
+void rna_World_lightgroup_set(PointerRNA *ptr, const char *value)
+{
+ BKE_lightgroup_membership_set(&((World *)ptr->owner_id)->lightgroup, value);
+}
+
#else
static void rna_def_lighting(BlenderRNA *brna)
@@ -234,6 +250,13 @@ void RNA_def_world(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the world");
RNA_def_property_update(prop, 0, "rna_World_use_nodes_update");
+ /* Lightgroup Membership */
+ prop = RNA_def_property(srna, "lightgroup", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_World_lightgroup_get", "rna_World_lightgroup_length", "rna_World_lightgroup_set");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Lightgroup", "Lightgroup that the world belongs to");
+
rna_def_lighting(brna);
rna_def_world_mist(brna);
}