2.5 - Constraint (Re)Naming
authorJoshua Leung <aligorith@gmail.com>
Tue, 21 Jul 2009 02:54:02 +0000 (02:54 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 21 Jul 2009 02:54:02 +0000 (02:54 +0000)
* Names for newly added constraints are now derived from the type of constraint, making it easier to identify the type of constraint

* Fixed crash when renaming constraints (due to invalid pointer being passed for the 'old' string name)

source/blender/editors/interface/interface_templates.c
source/blender/editors/object/editconstraint.c

index c08e8efcdb5eaa89e97344c784cc371588079cc4..e70510753e14cb31f23c23b1495cb938d1d486fd 100644 (file)
@@ -764,7 +764,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
        
        if(proxy_protected == 0) {
                but = uiDefBut(block, TEX, B_CONSTRAINT_TEST, "", xco+120, yco, 85, 18, con->name, 0.0, 29.0, 0.0, 0.0, "Constraint name"); 
-               uiButSetFunc(but, verify_constraint_name_func, con, NULL);
+               uiButSetFunc(but, verify_constraint_name_func, con, con->name);
        }
        else
                uiDefBut(block, LABEL, B_CONSTRAINT_TEST, con->name, xco+120, yco-1, 135, 19, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
index b0890f5858da200324714729cbaad910b3d91b96..69fc440dfe77b0fee6d67e0adc49503d8787b511 100644 (file)
@@ -200,8 +200,7 @@ bConstraint *add_new_constraint (short type)
        /* Set up a generic constraint datablock */
        con->type = type;
        con->flag |= CONSTRAINT_EXPAND;
-       con->enforce = 1.0F;
-       strcpy(con->name, "Const");
+       con->enforce = 1.0f;
        
        /* Load the data for it */
        cti = constraint_get_typeinfo(con);
@@ -211,7 +210,12 @@ bConstraint *add_new_constraint (short type)
                /* only constraints that change any settings need this */
                if (cti->new_data)
                        cti->new_data(con->data);
+                       
+               /* set the name based on the type of constraint */
+               strcpy(con->name, cti->name); 
        }
+       else
+               strcpy(con->name, "Const");
        
        return con;
 }