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
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-01-11 12:51:06 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-01-11 12:51:06 +0400
commit51bada696f77de9d7f673884cec9560218654fae (patch)
treed2434eac2fb74377592ee7c8c86d68b55733960c /source/blender/editors/object
parent782f0b63829a2c257a6e2942c49882f7fe04c33c (diff)
Longer names support for all ID and other object names
This commit extends limit of ID and objects to 64 (it means 63 meaning characters and 1 for zero-terminator). CustomData layers names are also extended. Changed DNA structures and all places where length constants were hardcoded. All names which are "generating" from ID block should be limited by MAX_ID_NAME-2, all non-id names now has got own define called MAX_NAME which should be used all over for non-id names to make further name migration stuff easier. All name fields in DNA now have comment with constant which corresponds to hardcoded numeric value which should make it easier to further update this limits or even switch to non-hardcoded values in DNA. Special thanks to Campbell who helped figuring out some issues and helped a lot in finding all cases where hardcoded valued were still used in code. Both of forwards and backwards compatibility is stored with blender versions newer than January 5, 2011. Older versions had issue with placing null-terminator to DNA strings on file load which will lead to some unpredictable behavior or even crashes.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_add.c4
-rw-r--r--source/blender/editors/object/object_constraint.c4
-rw-r--r--source/blender/editors/object/object_edit.c4
-rw-r--r--source/blender/editors/object/object_group.c4
-rw-r--r--source/blender/editors/object/object_hook.c4
-rw-r--r--source/blender/editors/object/object_modifier.c4
-rw-r--r--source/blender/editors/object/object_ops.c2
-rw-r--r--source/blender/editors/object/object_relations.c6
-rw-r--r--source/blender/editors/object/object_select.c4
9 files changed, 18 insertions, 18 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 1547c5daf54..0d4ad663b92 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1916,7 +1916,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
Object *ob;
int linked= RNA_boolean_get(op->ptr, "linked");
int dupflag= (linked)? 0: U.dupflag;
- char name[32];
+ char name[MAX_ID_NAME-2];
/* find object, create fake base */
RNA_string_get(op->ptr, "name", name);
@@ -1971,7 +1971,7 @@ void OBJECT_OT_add_named(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data");
- RNA_def_string(ot->srna, "name", "Cube", 24, "Name", "Object name to add");
+ RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 8266f3501c5..ac73f03c2d7 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -542,7 +542,7 @@ static int edit_constraint_poll(bContext *C)
static void edit_constraint_properties(wmOperatorType *ot)
{
- RNA_def_string(ot->srna, "constraint", "", 32, "Constraint", "Name of the constraint to edit");
+ RNA_def_string(ot->srna, "constraint", "", MAX_NAME, "Constraint", "Name of the constraint to edit");
RNA_def_enum(ot->srna, "owner", constraint_owner_items, 0, "Owner", "The owner of this constraint");
}
@@ -575,7 +575,7 @@ static int edit_constraint_invoke_properties(bContext *C, wmOperator *op)
static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int type)
{
- char constraint_name[32];
+ char constraint_name[MAX_NAME];
int owner = RNA_enum_get(op->ptr, "owner");
bConstraint *con;
ListBase *list=NULL;
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 7574059980c..e9bff9b644d 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1483,7 +1483,7 @@ static int game_property_new(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_active_object(C);
bProperty *prop;
- char name[32];
+ char name[MAX_NAME];
int type= RNA_enum_get(op->ptr, "type");
prop= new_property(type);
@@ -1516,7 +1516,7 @@ void OBJECT_OT_game_property_new(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", gameproperty_type_items, 2, "Type", "Type of game property to add");
- RNA_def_string(ot->srna, "name", "", 32, "Name", "Name of the game property to add");
+ RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the game property to add");
}
static int game_property_remove(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 74cf174d7b4..1b8c0fd0840 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -192,7 +192,7 @@ static int group_create_exec(bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
Group *group= NULL;
- char name[32]; /* id name */
+ char name[MAX_ID_NAME-2]; /* id name */
RNA_string_get(op->ptr, "name", name);
@@ -223,7 +223,7 @@ void GROUP_OT_create(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- RNA_def_string(ot->srna, "name", "Group", 32, "Name", "Name of the new group");
+ RNA_def_string(ot->srna, "name", "Group", MAX_ID_NAME-2, "Name", "Name of the new group");
}
/****************** properties window operators *********************/
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 7bb91c1fc4b..de991f28e4a 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -428,7 +428,7 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
HookModifierData *hmd = NULL;
float cent[3];
int tot, ok, *indexar;
- char name[32];
+ char name[MAX_NAME];
ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
@@ -747,7 +747,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
Object *ob=NULL;
HookModifierData *hmd=NULL;
float cent[3];
- char name[32];
+ char name[MAX_NAME];
int *indexar, tot;
if (ptr.data) { /* if modifier context is available, use that */
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 9a592bc9324..b7736843561 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -728,7 +728,7 @@ static int edit_modifier_poll(bContext *C)
static void edit_modifier_properties(wmOperatorType *ot)
{
- RNA_def_string(ot->srna, "modifier", "", 32, "Modifier", "Name of the modifier to edit");
+ RNA_def_string(ot->srna, "modifier", "", MAX_NAME, "Modifier", "Name of the modifier to edit");
}
static int edit_modifier_invoke_properties(bContext *C, wmOperator *op)
@@ -750,7 +750,7 @@ static int edit_modifier_invoke_properties(bContext *C, wmOperator *op)
static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type)
{
- char modifier_name[32];
+ char modifier_name[MAX_NAME];
ModifierData *md;
RNA_string_get(op->ptr, "modifier", modifier_name);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 137466bdf73..7e66d353121 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -245,7 +245,7 @@ void ED_operatormacros_object(void)
ot= WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO|OPTYPE_REGISTER);
if(ot) {
ot->description = "Add named object at cursor";
- RNA_def_string(ot->srna, "name", "Cube", 24, "Name", "Object name to add");
+ RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
WM_operatortype_macro_define(ot, "VIEW3D_OT_cursor3d");
WM_operatortype_macro_define(ot, "OBJECT_OT_add_named");
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 1ba0157e8d3..fb577ad7035 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -335,7 +335,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
if (ob) {
Object *newob;
Base *newbase, *oldbase= BASACT;
- char name[32];
+ char name[MAX_ID_NAME+4];
/* Add new object for the proxy */
newob= add_object(scene, OB_EMPTY);
@@ -1890,7 +1890,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even
Main *bmain= CTX_data_main(C);
Base *base= ED_view3d_give_base_under_cursor(C, event->mval);
Material *ma;
- char name[32];
+ char name[MAX_ID_NAME-2];
RNA_string_get(op->ptr, "name", name);
ma= (Material *)find_id("MA", name);
@@ -1923,5 +1923,5 @@ void OBJECT_OT_drop_named_material(wmOperatorType *ot)
ot->flag= OPTYPE_UNDO;
/* properties */
- RNA_def_string(ot->srna, "name", "Material", 24, "Name", "Material name to assign");
+ RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME-2, "Name", "Material name to assign");
}
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index b48b2e8718d..da69c2a0640 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -841,7 +841,7 @@ void OBJECT_OT_select_all(wmOperatorType *ot)
static int object_select_same_group_exec(bContext *C, wmOperator *op)
{
Group *group;
- char group_name[32];
+ char group_name[MAX_ID_NAME];
/* passthrough if no objects are visible */
if (CTX_DATA_COUNT(C, visible_bases) == 0) return OPERATOR_PASS_THROUGH;
@@ -882,7 +882,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- RNA_def_string(ot->srna, "group", "", 32, "Group", "Name of the group to select");
+ RNA_def_string(ot->srna, "group", "", MAX_ID_NAME, "Group", "Name of the group to select");
}
/**************************** Select Mirror ****************************/