layout.menu("CLIP_MT_mask_animation")
+class CLIP_MT_select_mode(Menu):
+ bl_label = "Select Mode"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.operator_enum("clip.mode_set", "mode")
+
+
class CLIP_MT_mask_visibility(Menu):
bl_label = "Show/Hide"
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "UI_view2d.h"
{
SpaceClip *sc = CTX_wm_space_clip(C);
int mode = RNA_enum_get(op->ptr, "mode");
- int toggle = RNA_boolean_get(op->ptr, "toggle");
- if (sc->mode == mode) {
- if (toggle)
- sc->mode = SC_MODE_TRACKING;
- }
- else {
- sc->mode = mode;
- }
+ sc->mode = mode;
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CLIP, NULL);
void CLIP_OT_mode_set(wmOperatorType *ot)
{
- static EnumPropertyItem mode_items[] = {
- {SC_MODE_TRACKING, "TRACKING", 0, "Tracking", "Show tracking and solving tools"},
- {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", 0, "Reconstruction", "Show tracking/reconstruction tools"},
- {SC_MODE_DISTORTION, "DISTORTION", 0, "Distortion", "Show distortion tools"},
- {0, NULL, 0, NULL, NULL}};
-
-
/* identifiers */
ot->name = "Set Clip Mode";
ot->description = "Set the clip interaction mode";
ot->poll = ED_space_clip_poll;
/* properties */
- RNA_def_enum(ot->srna, "mode", mode_items, SC_MODE_TRACKING, "Mode", "");
- RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "");
+ RNA_def_enum(ot->srna, "mode", clip_editor_mode_items, SC_MODE_TRACKING, "Mode", "");
}
/********************** macroses *********************/
RNA_boolean_set(kmi->ptr, "sequence", TRUE);
/* mode */
- kmi = WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
- RNA_enum_set(kmi->ptr, "mode", SC_MODE_RECONSTRUCTION);
- RNA_boolean_set(kmi->ptr, "toggle", TRUE);
-
- kmi = WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
- RNA_enum_set(kmi->ptr, "mode", SC_MODE_DISTORTION);
- RNA_boolean_set(kmi->ptr, "toggle", TRUE);
+ WM_keymap_add_menu(keymap, "CLIP_MT_select_mode", TABKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CLIP_OT_solve_camera", SKEY, KM_PRESS, KM_SHIFT, 0);
extern EnumPropertyItem prop_dynamicpaint_type_items[];
+extern EnumPropertyItem clip_editor_mode_items[];
+
struct bContext;
struct PointerRNA;
struct PropertyRNA;
{0, NULL, 0, NULL, NULL}
};
+EnumPropertyItem clip_editor_mode_items[] = {
+ {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
+ {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
+ "Show tracking/reconstruction tools"},
+ {SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
+ {SC_MODE_MASKEDIT, "MASKEDIT", ICON_MOD_MASK, "Mask editing", "Show mask editing tools"},
+ {0, NULL, 0, NULL, NULL}
+};
+
#ifdef RNA_RUNTIME
#include "DNA_anim_types.h"
StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem mode_items[] = {
- {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
- {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
- "Show tracking/reconstruction tools"},
- {SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
- {SC_MODE_MASKEDIT, "MASKEDIT", ICON_MOD_MASK, "Mask editing", "Show mask editing tools"},
- {0, NULL, 0, NULL, NULL}
- };
-
static EnumPropertyItem view_items[] = {
{SC_VIEW_CLIP, "CLIP", ICON_SEQUENCE, "Clip", "Show editing clip preview"},
{SC_VIEW_GRAPH, "GRAPH", ICON_IPO, "Graph", "Show graph view for active element"},
/* mode */
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, mode_items);
+ RNA_def_property_enum_items(prop, clip_editor_mode_items);
RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_clip_mode_update");