diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-20 21:05:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-20 21:11:41 +0300 |
commit | 2b5050a4cdfbb075d360fd39433acea07432c60b (patch) | |
tree | 05959f9b47c59c7ac2f41c25cb6a2cb35fa57f93 /source/blender/makesrna | |
parent | 6991b477d7adcea2426110c9e53482db6b7d3f90 (diff) |
UI: expose Timeline as a space type
See: T54744
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/RNA_enum_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 79 |
2 files changed, 64 insertions, 16 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index cb82ab8a88f..b4edc0dc99d 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -58,6 +58,7 @@ extern const EnumPropertyItem rna_enum_mesh_delimit_mode_items[]; extern const EnumPropertyItem rna_enum_space_graph_mode_items[]; extern const EnumPropertyItem rna_enum_space_type_items[]; extern const EnumPropertyItem rna_enum_space_image_mode_items[]; +extern const EnumPropertyItem rna_enum_space_action_mode_items[]; extern const EnumPropertyItem rna_enum_region_type_items[]; extern const EnumPropertyItem rna_enum_object_modifier_type_items[]; extern const EnumPropertyItem rna_enum_constraint_type_items[]; diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 5b1800e808c..635560e88ce 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -79,8 +79,8 @@ const EnumPropertyItem rna_enum_space_type_items[] = { /* Animation */ {0, "", ICON_NONE, "Animation", ""}, //{SPACE_ACTION, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls (NOTE: Switch to 'Timeline' mode)"}, /* XXX */ - {SPACE_IPO, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", "Edit drivers and keyframe interpolation"}, {SPACE_ACTION, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", "Adjust timing of keyframes"}, + {SPACE_IPO, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", "Edit drivers and keyframe interpolation"}, {SPACE_NLA, "NLA_EDITOR", ICON_NLA, "NLA Editor", "Combine and layer Actions"}, /* Scripting */ @@ -113,6 +113,59 @@ const EnumPropertyItem rna_enum_space_graph_mode_items[] = { {0, NULL, 0, NULL, NULL} }; +#define SACT_ITEM_DOPESHEET \ + {SACTCONT_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dope Sheet", "Edit all keyframes in scene"} +#define SACT_ITEM_TIMELINE \ + {SACTCONT_TIMELINE, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls"} +#define SACT_ITEM_ACTION \ + {SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", "Edit keyframes in active object's Object-level action"} +#define SACT_ITEM_SHAPEKEY \ + {SACTCONT_SHAPEKEY, "SHAPEKEY", ICON_SHAPEKEY_DATA, "Shape Key Editor", "Edit keyframes in active object's Shape Keys action"} +#define SACT_ITEM_GPENCIL \ + {SACTCONT_GPENCIL, "GPENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Edit timings for all Grease Pencil sketches in file"} +#define SACT_ITEM_MASK \ + {SACTCONT_MASK, "MASK", ICON_MOD_MASK, "Mask", "Edit timings for Mask Editor splines"} +#define SACT_ITEM_CACHEFILE \ + {SACTCONT_CACHEFILE, "CACHEFILE", ICON_FILE, "Cache File", "Edit timings for Cache File data-blocks"} + +#ifndef RNA_RUNTIME +/* XXX: action-editor is currently for object-level only actions, so show that using object-icon hint */ +static EnumPropertyItem rna_enum_space_action_mode_all_items[] = { + SACT_ITEM_DOPESHEET, + SACT_ITEM_TIMELINE, + SACT_ITEM_ACTION, + SACT_ITEM_SHAPEKEY, + SACT_ITEM_GPENCIL, + SACT_ITEM_MASK, + SACT_ITEM_CACHEFILE, + {0, NULL, 0, NULL, NULL} +}; +static EnumPropertyItem rna_enum_space_action_ui_mode_items[] = { + SACT_ITEM_DOPESHEET, + /* SACT_ITEM_TIMELINE, */ + SACT_ITEM_ACTION, + SACT_ITEM_SHAPEKEY, + SACT_ITEM_GPENCIL, + SACT_ITEM_MASK, + SACT_ITEM_CACHEFILE, + {0, NULL, 0, NULL, NULL} +}; +#endif +/* expose as ui_mode */ +const EnumPropertyItem rna_enum_space_action_mode_items[] = { + SACT_ITEM_DOPESHEET, + SACT_ITEM_TIMELINE, + {0, NULL, 0, NULL, NULL} +}; + +#undef SACT_ITEM_DOPESHEET +#undef SACT_ITEM_TIMELINE +#undef SACT_ITEM_ACTION +#undef SACT_ITEM_SHAPEKEY +#undef SACT_ITEM_GPENCIL +#undef SACT_ITEM_MASK +#undef SACT_ITEM_CACHEFILE + const EnumPropertyItem rna_enum_space_image_mode_items[] = { {SI_MODE_VIEW, "VIEW", ICON_FILE_IMAGE, "View", "View the image and UV edit in mesh editmode"}, {SI_MODE_PAINT, "PAINT", ICON_TPAINT_HLT, "Paint", "2D image painting mode"}, @@ -3542,19 +3595,6 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - /* XXX: action-editor is currently for object-level only actions, so show that using object-icon hint */ - static EnumPropertyItem mode_items[] = { - {SACTCONT_TIMELINE, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls"}, - {SACTCONT_DOPESHEET, "DOPESHEET", ICON_OOPS, "Dope Sheet", "Edit all keyframes in scene"}, - {SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", "Edit keyframes in active object's Object-level action"}, - {SACTCONT_SHAPEKEY, "SHAPEKEY", ICON_SHAPEKEY_DATA, "Shape Key Editor", "Edit keyframes in active object's Shape Keys action"}, - {SACTCONT_GPENCIL, "GPENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Edit timings for all Grease Pencil sketches in file"}, - {SACTCONT_MASK, "MASK", ICON_MOD_MASK, "Mask", "Edit timings for Mask Editor splines"}, - {SACTCONT_CACHEFILE, "CACHEFILE", ICON_FILE, "Cache File", "Edit timings for Cache File data-blocks"}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "SpaceDopeSheetEditor", "Space"); RNA_def_struct_sdna(srna, "SpaceAction"); RNA_def_struct_ui_text(srna, "Space Dope Sheet Editor", "Dope Sheet space data"); @@ -3568,10 +3608,17 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_SpaceDopeSheetEditor_action_update"); - /* mode */ + /* mode (hidden in the UI, see 'ui_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, rna_enum_space_action_mode_all_items); + RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update"); + + prop = RNA_def_property(srna, "ui_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, rna_enum_space_action_ui_mode_items); RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed"); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update"); |