diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-01-16 03:13:12 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-01-16 03:13:12 +0400 |
commit | e0df491d1e465588cc018c6f6d00f72739b71516 (patch) | |
tree | fe4cbcdaa4633545bbc817c28eb780b551e5ac05 /source/blender/editors/object | |
parent | 76a211d80947a453f594e4cf0a1e0acc6786eddf (diff) | |
parent | 23806a2b7d50082d70a0e4ecab22aafb8433708a (diff) |
Merged changes in the trunk up to revision 43404.
Conflicts resolved:
source/blender/python/SConscript
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_add.c | 45 | ||||
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 6 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 133 | ||||
-rw-r--r-- | source/blender/editors/object/object_group.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_hook.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 8 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 17 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 8 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 96 | ||||
-rw-r--r-- | source/blender/editors/object/object_transform.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 2 |
12 files changed, 55 insertions, 272 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 1547c5daf54..c53549728f6 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -189,52 +189,55 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) PropertyRNA *prop; /* note: this property gets hidden for add-camera operator */ - prop= RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view"); + prop = RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view"); RNA_def_property_update_runtime(prop, view_align_update); if(do_editmode) { - prop= RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode", "Enter editmode when adding this object"); - RNA_def_property_flag(prop, PROP_HIDDEN); + prop = RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode", + "Enter editmode when adding this object"); + RNA_def_property_flag(prop, PROP_HIDDEN|PROP_SKIP_SAVE); } - RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object", -FLT_MAX, FLT_MAX); - RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f); + prop = RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", + "Location for the newly added object", -FLT_MAX, FLT_MAX); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", + "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", ""); - RNA_def_property_flag(prop, PROP_HIDDEN); + RNA_def_property_flag(prop, PROP_HIDDEN|PROP_SKIP_SAVE); } static void object_add_generic_invoke_options(bContext *C, wmOperator *op) { if(RNA_struct_find_property(op->ptr, "enter_editmode")) /* optional */ - if (!RNA_property_is_set(op->ptr, "enter_editmode")) + if (!RNA_struct_property_is_set(op->ptr, "enter_editmode")) RNA_boolean_set(op->ptr, "enter_editmode", U.flag & USER_ADD_EDITMODE); - if(!RNA_property_is_set(op->ptr, "location")) { + if(!RNA_struct_property_is_set(op->ptr, "location")) { float loc[3]; ED_object_location_from_view(C, loc); RNA_float_set_array(op->ptr, "location", loc); } - if(!RNA_property_is_set(op->ptr, "layers")) { + if(!RNA_struct_property_is_set(op->ptr, "layers")) { View3D *v3d = CTX_wm_view3d(C); Scene *scene = CTX_data_scene(C); int a, values[20], layer; - + if(v3d) { layer = (v3d->scenelock && !v3d->localvd)? scene->layact: v3d->layact; - - for(a=0; a<20; a++) - values[a]= (layer & (1<<a)); } else { layer = scene->layact; + } - for(a=0; a<20; a++) - values[a]= (layer & (1<<a)); + for (a=0; a<20; a++) { + values[a]= (layer & (1<<a)); } - + RNA_boolean_set_array(op->ptr, "layers", values); } } @@ -257,7 +260,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, *enter_editmode = TRUE; } - if(RNA_property_is_set(op->ptr, "layers")) { + if(RNA_struct_property_is_set(op->ptr, "layers")) { RNA_boolean_get_array(op->ptr, "layers", layer_values); *layer= 0; for(a=0; a<20; a++) { @@ -278,9 +281,9 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, if(v3d && v3d->localvd) *layer |= v3d->lay; - if(RNA_property_is_set(op->ptr, "rotation")) + if(RNA_struct_property_is_set(op->ptr, "rotation")) view_align = FALSE; - else if (RNA_property_is_set(op->ptr, "view_align")) + else if (RNA_struct_property_is_set(op->ptr, "view_align")) view_align = RNA_boolean_get(op->ptr, "view_align"); else { view_align = U.flag & USER_ADD_VIEWALIGNED; @@ -1916,7 +1919,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 +1974,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..a90edb29c29 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"); } @@ -553,7 +553,7 @@ static int edit_constraint_invoke_properties(bContext *C, wmOperator *op) bConstraint *con; ListBase *list; - if (RNA_property_is_set(op->ptr, "constraint") && RNA_property_is_set(op->ptr, "owner")) + if (RNA_struct_property_is_set(op->ptr, "constraint") && RNA_struct_property_is_set(op->ptr, "owner")) return 1; if (ptr.data) { @@ -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 6a68a264a28..61ba54e7d36 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -321,9 +321,6 @@ void ED_object_exit_editmode(bContext *C, int flag) // if(EM_texFaceCheck()) -// if(retopo_mesh_paint_check()) -// retopo_end_okee(); - if(me->edit_mesh->totvert>MESH_MAX_VERTS) { error("Too many vertices"); return; @@ -595,132 +592,6 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -/* *********************** */ - -#if 0 -// XXX should be in view3d? - -/* context: ob = lamp */ -/* code should be replaced with proper (custom) transform handles for lamp properties */ -static void spot_interactive(Object *ob, int mode) -{ - Lamp *la= ob->data; - float transfac, dx, dy, ratio, origval; - int keep_running= 1, center2d[2]; - int mval[2], mvalo[2]; - -// getmouseco_areawin(mval); -// getmouseco_areawin(mvalo); - - project_int(ob->obmat[3], center2d); - if( center2d[0] > 100000 ) { /* behind camera */ -// center2d[0]= curarea->winx/2; -// center2d[1]= curarea->winy/2; - } - -// helpline(mval, center2d); - - /* ratio is like scaling */ - dx = (float)(center2d[0] - mval[0]); - dy = (float)(center2d[1] - mval[1]); - transfac = (float)sqrt( dx*dx + dy*dy); - if(transfac==0.0f) transfac= 1.0f; - - if(mode==1) - origval= la->spotsize; - else if(mode==2) - origval= la->dist; - else if(mode==3) - origval= la->clipsta; - else - origval= la->clipend; - - while (keep_running>0) { - -// getmouseco_areawin(mval); - - /* essential for idling subloop */ - if(mval[0]==mvalo[0] && mval[1]==mvalo[1]) { - PIL_sleep_ms(2); - } - else { - char str[32]; - - dx = (float)(center2d[0] - mval[0]); - dy = (float)(center2d[1] - mval[1]); - ratio = (float)(sqrt( dx*dx + dy*dy))/transfac; - - /* do the trick */ - - if(mode==1) { /* spot */ - la->spotsize = ratio*origval; - CLAMP(la->spotsize, 1.0f, 180.0f); - sprintf(str, "Spot size %.2f\n", la->spotsize); - } - else if(mode==2) { /* dist */ - la->dist = ratio*origval; - CLAMP(la->dist, 0.01f, 5000.0f); - sprintf(str, "Distance %.2f\n", la->dist); - } - else if(mode==3) { /* sta */ - la->clipsta = ratio*origval; - CLAMP(la->clipsta, 0.001f, 5000.0f); - sprintf(str, "Distance %.2f\n", la->clipsta); - } - else if(mode==4) { /* end */ - la->clipend = ratio*origval; - CLAMP(la->clipend, 0.1f, 5000.0f); - sprintf(str, "Clip End %.2f\n", la->clipend); - } - - /* cleanup */ - mvalo[0]= mval[0]; - mvalo[1]= mval[1]; - - /* handle shaded mode */ -// XXX shade_buttons_change_3d(); - - /* DRAW */ - headerprint(str); - force_draw_plus(SPACE_BUTS, 0); - -// helpline(mval, center2d); - } - - while( qtest() ) { - short val; - unsigned short event= extern_qread(&val); - - switch (event){ - case ESCKEY: - case RIGHTMOUSE: - keep_running= 0; - break; - case LEFTMOUSE: - case SPACEKEY: - case PADENTER: - case RETKEY: - if(val) - keep_running= -1; - break; - } - } - } - - if(keep_running==0) { - if(mode==1) - la->spotsize= origval; - else if(mode==2) - la->dist= origval; - else if(mode==3) - la->clipsta= origval; - else - la->clipend= origval; - } - -} -#endif - static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob) { //XXX no longer used - to be removed - replaced by game_properties_copy_exec @@ -1609,7 +1480,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); @@ -1642,7 +1513,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_intern.h b/source/blender/editors/object/object_intern.h index 8973fb88c85..7f416feb0d5 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -96,14 +96,12 @@ void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot); /* object_select.c */ void OBJECT_OT_select_all(struct wmOperatorType *ot); -void OBJECT_OT_select_inverse(struct wmOperatorType *ot); void OBJECT_OT_select_random(struct wmOperatorType *ot); void OBJECT_OT_select_by_type(struct wmOperatorType *ot); void OBJECT_OT_select_by_layer(struct wmOperatorType *ot); void OBJECT_OT_select_linked(struct wmOperatorType *ot); void OBJECT_OT_select_grouped(struct wmOperatorType *ot); void OBJECT_OT_select_mirror(struct wmOperatorType *ot); -void OBJECT_OT_select_name(struct wmOperatorType *ot); void OBJECT_OT_select_same_group(struct wmOperatorType *ot); /* object_add.c */ diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 9a592bc9324..93f4a31f1ff 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) @@ -736,7 +736,7 @@ static int edit_modifier_invoke_properties(bContext *C, wmOperator *op) PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier); ModifierData *md; - if (RNA_property_is_set(op->ptr, "modifier")) + if (RNA_struct_property_is_set(op->ptr, "modifier")) return 1; if (ptr.data) { @@ -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); @@ -1209,7 +1209,7 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U if(CustomData_external_test(&me->fdata, CD_MDISPS)) return OPERATOR_CANCELLED; - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return multires_external_save_exec(C, op); op->customdata= me; diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index acc318723d8..99eeaf334a8 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -94,7 +94,6 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_make_links_data); WM_operatortype_append(OBJECT_OT_move_to_layer); - WM_operatortype_append(OBJECT_OT_select_inverse); WM_operatortype_append(OBJECT_OT_select_random); WM_operatortype_append(OBJECT_OT_select_all); WM_operatortype_append(OBJECT_OT_select_same_group); @@ -103,7 +102,6 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_select_linked); WM_operatortype_append(OBJECT_OT_select_grouped); WM_operatortype_append(OBJECT_OT_select_mirror); - WM_operatortype_append(OBJECT_OT_select_name); /* XXX - weak, not compat with linked objects */ WM_operatortype_append(GROUP_OT_create); WM_operatortype_append(GROUP_OT_objects_remove); @@ -246,7 +244,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"); @@ -297,23 +295,28 @@ void ED_keymap_object(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "VIEW3D_OT_game_start", PKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "OBJECT_OT_select_all", AKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "OBJECT_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); + kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", AKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); + kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0); + RNA_enum_set(kmi->ptr, "action", SEL_INVERT); + WM_keymap_add_item(keymap, "OBJECT_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); kmi= WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0); RNA_enum_set_identifier(kmi->ptr, "direction", "PARENT"); + RNA_boolean_set(kmi->ptr, "extend", FALSE); kmi= WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0); RNA_enum_set_identifier(kmi->ptr, "direction", "PARENT"); - RNA_boolean_set(kmi->ptr, "extend", 1); + RNA_boolean_set(kmi->ptr, "extend", TRUE); kmi= WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0); RNA_enum_set_identifier(kmi->ptr, "direction", "CHILD"); + RNA_boolean_set(kmi->ptr, "extend", FALSE); kmi= WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0); RNA_enum_set_identifier(kmi->ptr, "direction", "CHILD"); - RNA_boolean_set(kmi->ptr, "extend", 1); + RNA_boolean_set(kmi->ptr, "extend", TRUE); WM_keymap_verify_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_verify_item(keymap, "OBJECT_OT_parent_no_inverse_set", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 1ba0157e8d3..a0bddda0413 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); @@ -1056,7 +1056,7 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op) int values[20], a; unsigned int lay= 0; - if(!RNA_property_is_set(op->ptr, "layers")) { + if(!RNA_struct_property_is_set(op->ptr, "layers")) { /* note: layers are set in bases, library objects work for this */ CTX_DATA_BEGIN(C, Base*, base, selected_bases) { lay |= base->lay; @@ -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 c4d33b74574..69372ac1a90 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -739,41 +739,6 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) RNA_def_int(ot->srna, "layers", 1, 1, 20, "Layer", "", 1, 20); } -/************************** Select Inverse *************************/ - -static int object_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) -{ - CTX_DATA_BEGIN(C, Base*, base, visible_bases) { - if (base->flag & SELECT) - ED_base_object_select(base, BA_DESELECT); - else - ED_base_object_select(base, BA_SELECT); - } - CTX_DATA_END; - - /* undo? */ - WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C)); - - return OPERATOR_FINISHED; -} - -void OBJECT_OT_select_inverse(wmOperatorType *ot) -{ - - /* identifiers */ - ot->name= "Select Inverse"; - ot->description = "Invert selection of all visible objects"; - ot->idname= "OBJECT_OT_select_inverse"; - - /* api callbacks */ - ot->exec= object_select_inverse_exec; - ot->poll= objects_selectable_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - -} - /**************************** (De)select All ****************************/ static int object_select_all_exec(bContext *C, wmOperator *op) @@ -841,7 +806,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 +847,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 ****************************/ @@ -939,63 +904,6 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot) } -static int object_select_name_exec(bContext *C, wmOperator *op) -{ - char *name= RNA_string_get_alloc(op->ptr, "name", NULL, 0); - short extend= RNA_boolean_get(op->ptr, "extend"); - short changed = 0; - - if(!extend) { - CTX_DATA_BEGIN(C, Base*, base, selectable_bases) { - if(base->flag & SELECT) { - ED_base_object_select(base, BA_DESELECT); - changed= 1; - } - } - CTX_DATA_END; - } - - CTX_DATA_BEGIN(C, Base*, base, selectable_bases) { - /* this is a bit dodjy, there should only be ONE object with this name, but library objects can mess this up */ - if(strcmp(name, base->object->id.name+2)==0) { - ED_base_object_activate(C, base); - ED_base_object_select(base, BA_SELECT); - changed= 1; - } - } - CTX_DATA_END; - - MEM_freeN(name); - - /* undo? */ - if(changed) { - WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C)); - return OPERATOR_FINISHED; - } - else { - return OPERATOR_CANCELLED; - } -} - -void OBJECT_OT_select_name(wmOperatorType *ot) -{ - - /* identifiers */ - ot->name= "Select Name"; - ot->description = "Select an object with this name"; - ot->idname= "OBJECT_OT_select_name"; - - /* api callbacks */ - ot->exec= object_select_name_exec; - ot->poll= objects_selectable_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - RNA_def_string(ot->srna, "name", "", 0, "Name", "Object name to select"); - RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first"); -} - /**************************** Select Random ****************************/ static int object_select_random_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index a83896e7280..e57574af839 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -645,7 +645,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) /* get the view settings if 'around' isnt set and the view is available */ View3D *v3d= CTX_wm_view3d(C); copy_v3_v3(cursor, give_cursor(scene, v3d)); - if(v3d && !RNA_property_is_set(op->ptr, "center")) + if(v3d && !RNA_struct_property_is_set(op->ptr, "center")) around= v3d->around; } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index dfe0b94605d..f91740f4b47 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -2058,7 +2058,7 @@ static int vertex_group_poll(bContext *C) return (ob && !ob->id.lib && OB_TYPE_SUPPORT_VGROUP(ob->type) && data && !data->lib); } -static int vertex_group_poll_edit(bContext *C) +static int UNUSED_FUNCTION(vertex_group_poll_edit)(bContext *C) { Object *ob= ED_object_context(C); ID *data= (ob)? ob->data: NULL; |