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:
authorThomas Dinges <blender@dingto.org>2009-08-15 23:40:09 +0400
committerThomas Dinges <blender@dingto.org>2009-08-15 23:40:09 +0400
commit0ce5163cc0aa32df5450752da9056059a88f1fd5 (patch)
treea5aa62f012dba91b3d78935f608a06c1b69b4ef6 /source/blender/editors/space_view3d/view3d_toolbar.c
parentca906df5ccdd0d1b0a600f073b5bad5251d42e07 (diff)
2.5 3D_View:
Patch [#19031] (2.5) python menus for the view3d header by Lorenzo Pierfederici (lento). Thanks! * Added CTX_data_mode_string() to find out in which mode we're in. * Added some "select" menus as a test. This patch makes it basically possible to wrap the 3D View menus to python.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_toolbar.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c40
1 files changed, 2 insertions, 38 deletions
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index a6317100643..ec1ed10cd0b 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -164,42 +164,6 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
/* ******************* */
-char *view3d_context_string(const bContext *C)
-{
- Object *obedit= CTX_data_edit_object(C);
-
- if(obedit) {
- switch(obedit->type) {
- case OB_MESH:
- return "editmode_mesh";
- case OB_CURVE:
- return "editmode_curve";
- case OB_SURF:
- return "editmode_surface";
- case OB_FONT:
- return "editmode_text";
- case OB_ARMATURE:
- return "editmode_armature";
- case OB_MBALL:
- return "editmode_mball";
- case OB_LATTICE:
- return "editmode_lattice";
- }
- }
- else {
- Object *ob = CTX_data_active_object(C);
-
- if(ob && (ob->flag & OB_POSEMODE)) return "pose_mode";
- else if (ob && ob->mode & OB_MODE_SCULPT) return "sculpt_mode";
- else if (G.f & G_WEIGHTPAINT) return "weight_paint";
- else if (G.f & G_VERTEXPAINT) return "vertex_paint";
- else if (G.f & G_TEXTUREPAINT) return "texture_paint";
- else if(G.f & G_PARTICLEEDIT) return "particle_mode";
- }
-
- return "objectmode";
-}
-
typedef struct CustomTool {
struct CustomTool *next, *prev;
char opname[OP_MAX_TYPENAME];
@@ -215,7 +179,7 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2)
BLI_addtail(arg_listbase, ct);
BLI_strncpy(ct->opname, ot->idname, OP_MAX_TYPENAME);
- BLI_strncpy(ct->context, view3d_context_string(C), OP_MAX_TYPENAME);
+ BLI_strncpy(ct->context, CTX_data_mode_string(C), OP_MAX_TYPENAME);
}
}
@@ -278,7 +242,7 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa)
SpaceLink *sl= CTX_wm_space_data(C);
SpaceType *st= NULL;
uiLayout *col;
- const char *context= view3d_context_string(C);
+ const char *context= CTX_data_mode_string(C);
if(sl)
st= BKE_spacetype_from_id(sl->spacetype);