diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-08 20:59:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-08 20:59:06 +0400 |
commit | 5f40c0e9a5b5665e559b441c7659050ff861931d (patch) | |
tree | a1ab1fe645405794053a16a1f2d0c6ea5b1d3839 /source/blender/editors/screen/screen_context.c | |
parent | 51ead63ae6a9e032af892058f132f12933f4c138 (diff) |
- operator presets now work in the 3D view as well as the file selector.
to enable from python:
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
from C:
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_PRESET;
- added context member 'active_operator'
- enable this for 'Add Torus' for testing.
Diffstat (limited to 'source/blender/editors/screen/screen_context.c')
-rw-r--r-- | source/blender/editors/screen/screen_context.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index cb42cd786ed..581c1e3597b 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -35,6 +35,8 @@ #include "DNA_sequence_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" +#include "DNA_space_types.h" +#include "DNA_windowmanager_types.h" #include "BLI_utildefines.h" @@ -50,6 +52,8 @@ #include "ED_object.h" #include "ED_armature.h" +#include "WM_api.h" + #include "screen_intern.h" const char *screen_context_dir[] = { @@ -62,6 +66,7 @@ const char *screen_context_dir[] = { "sculpt_object", "vertex_paint_object", "weight_paint_object", "image_paint_object", "particle_edit_object", "sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */ + "active_operator", NULL}; int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result) @@ -387,6 +392,25 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult return 1; } } + else if(CTX_data_equals(member, "active_operator")) { + wmOperator *op= NULL; + + SpaceFile *sfile= CTX_wm_space_file(C); + if(sfile) { + op= sfile->op; + } + else { + /* note, this checks poll, could be a problem, but this also + * happens for the toolbar */ + op= WM_operator_last_redo(C); + } + /* TODO, get the operator from popup's */ + + if (op && op->ptr) { + CTX_data_pointer_set(result, NULL, &RNA_Operator, op); + return 1; + } + } else { return 0; /* not found */ } |