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
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-07-21 06:54:02 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-21 06:54:02 +0400
commit74fce51841dab8ef81a7eab58ef14a946dfc0043 (patch)
tree30ca47dd0bbcf2cb7345c3fe61fcc60aa06fa65b /source
parent22f421a9eea41262ea9a327862afb233c22d98aa (diff)
2.5 - Constraint (Re)Naming
* 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)
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_templates.c2
-rw-r--r--source/blender/editors/object/editconstraint.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index c08e8efcdb5..e70510753e1 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -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, "");
diff --git a/source/blender/editors/object/editconstraint.c b/source/blender/editors/object/editconstraint.c
index b0890f5858d..69fc440dfe7 100644
--- a/source/blender/editors/object/editconstraint.c
+++ b/source/blender/editors/object/editconstraint.c
@@ -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;
}