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:
authorLukas Stockner <lukas.stockner@freenet.de>2022-04-04 04:50:55 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2022-04-08 02:08:03 +0300
commit3214028ae822d6b9b1622589d27dd9b9746f2aa8 (patch)
tree08cb475db64f13d6507cd723c537f8dba568e39f /source/blender/blenkernel/intern
parent5dd855102130bfbc140cbe334a8f79c309e4a5c5 (diff)
Cycles: Support adding Lightgroups from the object/world properties
Currently, only Lightgroups that exist in the current view layer can be selected from object or world properties. The internal UI code already has support for search fields that accept unknown input, so I just added that to the API and use it for lightgroups. When a lightgroup is entered that does not exist in the current view layer (e.g. because it's completely new, because the view layer was switched or because it was deleted earlier), a new button next to it becomes active and adds it to the view layer when pressed. Differential Revision: https://developer.blender.org/D14540
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/layer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index c99bf885074..1cc1839d2d0 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -2535,11 +2535,17 @@ static void viewlayer_lightgroup_active_set(ViewLayer *view_layer, ViewLayerLigh
}
}
-struct ViewLayerLightgroup *BKE_view_layer_add_lightgroup(struct ViewLayer *view_layer)
+struct ViewLayerLightgroup *BKE_view_layer_add_lightgroup(struct ViewLayer *view_layer,
+ const char *name)
{
ViewLayerLightgroup *lightgroup;
lightgroup = MEM_callocN(sizeof(ViewLayerLightgroup), __func__);
- BLI_strncpy(lightgroup->name, DATA_("Lightgroup"), sizeof(lightgroup->name));
+ if (name && name[0]) {
+ BLI_strncpy(lightgroup->name, name, sizeof(lightgroup->name));
+ }
+ else {
+ BLI_strncpy(lightgroup->name, DATA_("Lightgroup"), sizeof(lightgroup->name));
+ }
BLI_addtail(&view_layer->lightgroups, lightgroup);
viewlayer_lightgroup_active_set(view_layer, lightgroup);
viewlayer_lightgroup_make_name_unique(view_layer, lightgroup);