make sure render layer names are unique when setting through rna.

This commit is contained in:
Campbell Barton 2011-10-15 09:59:31 +00:00
parent f8317ed450
commit 9613de6248
2 changed files with 6 additions and 3 deletions

@ -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;
int a, tot;
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) {
int tot;
int a;
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]);
}
}
}
else if(but->pointype == CHA) {

@ -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;
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;