make sure render layer names are unique when setting through rna.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 15 Oct 2011 09:59:31 +0000 (09:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 15 Oct 2011 09:59:31 +0000 (09:59 +0000)
source/blender/editors/interface/interface.c
source/blender/makesrna/intern/rna_scene.c

index a62658349c1359acaf00b82403d62a6b6b5bc91e..299bec0db8a95e9af31f629af4d6ffae269f93a7 100644 (file)
@@ -1259,7 +1259,6 @@ void ui_get_but_vectorf(uiBut *but, float vec[3])
 void ui_set_but_vectorf(uiBut *but, const float vec[3])
 {
        PropertyRNA *prop;
 void ui_set_but_vectorf(uiBut *but, const float vec[3])
 {
        PropertyRNA *prop;
-       int a, tot;
 
        if(but->editvec) {
                copy_v3_v3(but->editvec, vec);
 
        if(but->editvec) {
                copy_v3_v3(but->editvec, vec);
@@ -1269,11 +1268,15 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
                prop= but->rnaprop;
 
                if(RNA_property_type(prop) == PROP_FLOAT) {
                prop= but->rnaprop;
 
                if(RNA_property_type(prop) == PROP_FLOAT) {
+                       int tot;
+                       int a;
+
                        tot= RNA_property_array_length(&but->rnapoin, prop);
                        tot= MIN2(tot, 3);
 
                        tot= RNA_property_array_length(&but->rnapoin, prop);
                        tot= MIN2(tot, 3);
 
-                       for(a=0; a<tot; a++)
+                       for (a=0; a<tot; a++) {
                                RNA_property_float_set_index(&but->rnapoin, prop, a, vec[a]);
                                RNA_property_float_set_index(&but->rnapoin, prop, a, vec[a]);
+                       }
                }
        }
        else if(but->pointype == CHA) {
                }
        }
        else if(but->pointype == CHA) {
index 0eaacc62f33add368071be48d19445b01191e0be..ccc8151ac7fd351732fe1b0467b9a94342b7f5b0 100644 (file)
@@ -812,8 +812,8 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
 {
        Scene *scene= (Scene*)ptr->id.data;
        SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data;
 {
        Scene *scene= (Scene*)ptr->id.data;
        SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data;
-
        BLI_strncpy_utf8(rl->name, value, sizeof(rl->name));
        BLI_strncpy_utf8(rl->name, value, sizeof(rl->name));
+       BLI_uniquename(&scene->r.layers, rl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(rl->name));
 
        if(scene->nodetree) {
                bNode *node;
 
        if(scene->nodetree) {
                bNode *node;