diff options
-rw-r--r-- | source/blender/editors/include/ED_screen.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 38 | ||||
-rw-r--r-- | source/blender/editors/object/object_group.c | 8 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 14 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 20 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 18 |
6 files changed, 52 insertions, 47 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 07fae14cc06..4d3e40274f7 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -125,6 +125,7 @@ int ED_operator_areaactive(struct bContext *C); int ED_operator_regionactive(struct bContext *C); int ED_operator_scene_editable(struct bContext *C); +int ED_operator_objectmode(struct bContext *C); int ED_operator_view3d_active(struct bContext *C); int ED_operator_region_view3d_active(struct bContext *C); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index b87792d98d3..88072d7d045 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -332,7 +332,7 @@ void OBJECT_OT_add(wmOperatorType *ot) ot->invoke= ED_object_add_generic_invoke; ot->exec= object_add_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -422,7 +422,7 @@ void OBJECT_OT_effector_add(wmOperatorType *ot) ot->invoke= WM_menu_invoke; ot->exec= effector_add_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -473,7 +473,7 @@ void OBJECT_OT_camera_add(wmOperatorType *ot) /* api callbacks */ ot->exec= object_camera_add_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -557,7 +557,7 @@ void OBJECT_OT_metaball_add(wmOperatorType *ot) /* api callbacks */ ot->invoke= object_metaball_add_invoke; ot->exec= object_metaball_add_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -597,7 +597,7 @@ void OBJECT_OT_text_add(wmOperatorType *ot) /* api callbacks */ ot->invoke= ED_object_add_generic_invoke; ot->exec= object_add_text_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -652,7 +652,7 @@ void OBJECT_OT_armature_add(wmOperatorType *ot) /* api callbacks */ ot->invoke= ED_object_add_generic_invoke; ot->exec= object_armature_add_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -712,7 +712,7 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_menu_invoke; ot->exec= object_lamp_add_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -769,7 +769,7 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot) ot->invoke= WM_enum_search_invoke; ot->exec= group_instance_add_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -835,7 +835,7 @@ void OBJECT_OT_delete(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_operator_confirm; ot->exec= object_delete_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1027,7 +1027,7 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot) /* api callbacks */ ot->exec= object_duplicates_make_real_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1690,7 +1690,7 @@ void OBJECT_OT_duplicate(wmOperatorType *ot) /* api callbacks */ ot->exec= duplicate_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1703,20 +1703,6 @@ void OBJECT_OT_duplicate(wmOperatorType *ot) /* **************** add named object, for dragdrop ************* */ -/* contextual operator dupli */ - -static int add_named_poll(bContext *C) -{ - if(!ED_operator_scene_editable(C)) { - return 0; - } else { - Object *ob= CTX_data_active_object(C); - if(ob && ob->mode != OB_MODE_OBJECT) - return 0; - else - return 1; - } -} static int add_named_exec(bContext *C, wmOperator *op) { @@ -1775,7 +1761,7 @@ void OBJECT_OT_add_named(wmOperatorType *ot) /* api callbacks */ ot->exec= add_named_exec; - ot->poll= add_named_poll; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index 99e27d8a286..3b504995e6a 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -96,7 +96,7 @@ void GROUP_OT_objects_add_active(wmOperatorType *ot) /* api callbacks */ ot->exec= objects_add_active_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -143,7 +143,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot) /* api callbacks */ ot->exec= objects_remove_active_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -177,7 +177,7 @@ void GROUP_OT_objects_remove(wmOperatorType *ot) /* api callbacks */ ot->exec= group_objects_remove_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -214,7 +214,7 @@ void GROUP_OT_create(wmOperatorType *ot) /* api callbacks */ ot->exec= group_create_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index a30fdcfaa3d..b8edbb8c104 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -928,7 +928,7 @@ void OBJECT_OT_track_clear(wmOperatorType *ot) ot->invoke= WM_menu_invoke; ot->exec= object_track_clear_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1033,7 +1033,7 @@ void OBJECT_OT_track_set(wmOperatorType *ot) ot->invoke= WM_menu_invoke; ot->exec= track_set_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1143,7 +1143,7 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot) /* api callbacks */ ot->invoke= move_to_layer_invoke; ot->exec= move_to_layer_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1346,7 +1346,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot) /* api callbacks */ ot->exec= make_links_data_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1850,7 +1850,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_menu_invoke; ot->exec= make_local_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1902,7 +1902,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_menu_invoke; ot->exec= make_single_user_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1949,7 +1949,7 @@ void OBJECT_OT_drop_named_material(wmOperatorType *ot) /* api callbacks */ ot->invoke= drop_named_material_invoke; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_UNDO; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 29c3ee5c95c..b131a358ae7 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -148,7 +148,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_menu_invoke; ot->exec= object_select_by_type_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -330,7 +330,7 @@ void OBJECT_OT_select_linked(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_menu_invoke; ot->exec= object_select_linked_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -618,7 +618,7 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_menu_invoke; ot->exec= object_select_grouped_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -667,7 +667,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) /* api callbacks */ /*ot->invoke = XXX - need a int grid popup*/ ot->exec= object_select_by_layer_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -705,7 +705,7 @@ void OBJECT_OT_select_inverse(wmOperatorType *ot) /* api callbacks */ ot->exec= object_select_inverse_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -766,7 +766,7 @@ void OBJECT_OT_select_all(wmOperatorType *ot) /* api callbacks */ ot->exec= object_select_all_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -815,7 +815,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot) /* api callbacks */ ot->exec= object_select_same_group_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -863,7 +863,7 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot) /* api callbacks */ ot->exec= object_select_mirror_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -920,7 +920,7 @@ void OBJECT_OT_select_name(wmOperatorType *ot) /* api callbacks */ ot->exec= object_select_name_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -968,7 +968,7 @@ void OBJECT_OT_select_random(wmOperatorType *ot) /* api callbacks */ /*ot->invoke= object_select_random_invoke XXX - need a number popup ;*/ ot->exec = object_select_random_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index d85746d4b3e..4fac0abb50e 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -116,6 +116,24 @@ int ED_operator_scene_editable(bContext *C) return 0; } +int ED_operator_objectmode(bContext *C) +{ + Scene *scene= CTX_data_scene(C); + Object *obact= CTX_data_active_object(C); + + if(scene==NULL || scene->id.lib) + return 0; + if( CTX_data_edit_object(C) ) + return 0; + + /* add a check for ob->mode too? */ + if(obact && obact->mode) + return 0; + + return 1; +} + + static int ed_spacetype_test(bContext *C, int type) { if(ED_operator_areaactive(C)) { |