Fix lightgroup creation without a specified name

This commit is contained in:
Lukas Stockner 2022-04-08 11:51:31 +02:00
parent a410cea291
commit aa46a67634
1 changed files with 3 additions and 2 deletions

View File

@ -1124,9 +1124,10 @@ static int view_layer_add_lightgroup_exec(bContext *C, wmOperator *op)
ViewLayer *view_layer = CTX_data_view_layer(C);
char name[MAX_NAME];
RNA_string_get(op->ptr, "name", name);
name[0] = '\0';
/* If a name is provided, ensure that it is unique. */
if (name[0]) {
if (RNA_struct_property_is_set(op->ptr, "name")) {
RNA_string_get(op->ptr, "name", name);
/* Ensure that there are no dots in the name. */
BLI_str_replace_char(name, '.', '_');
LISTBASE_FOREACH (ViewLayerLightgroup *, lightgroup, &view_layer->lightgroups) {