2.5 Timeline:
WIP Commit, still uncommented. * Adeed some RNA properties for Playback. * Start of Python File.
This commit is contained in:
79
release/ui/space_time.py
Normal file
79
release/ui/space_time.py
Normal file
@@ -0,0 +1,79 @@
|
||||
|
||||
import bpy
|
||||
|
||||
class TIME_HT_header(bpy.types.Header):
|
||||
__space_type__ = "TIMELINE"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
st = context.space_data
|
||||
scene = context.scene
|
||||
|
||||
layout.template_header()
|
||||
|
||||
if context.area.show_menus:
|
||||
row = layout.row()
|
||||
#row.itemM("TIME_MT_view")
|
||||
#row.itemM("TIME_MT_frame")
|
||||
#row.itemM("TIME_MT_playback")
|
||||
|
||||
layout.itemR(scene, "use_preview_range", text="PR", toggle=True)
|
||||
|
||||
layout.itemS()
|
||||
|
||||
row = layout.row(align=True)
|
||||
if not scene.use_preview_range:
|
||||
row.itemR(scene, "start_frame", text="Start")
|
||||
row.itemR(scene, "end_frame", text="End")
|
||||
else:
|
||||
row.itemR(scene, "preview_range_start_frame", text="Start")
|
||||
row.itemR(scene, "preview_range_end_frame", text="End")
|
||||
|
||||
layout.itemS()
|
||||
layout.itemR(scene, "current_frame")
|
||||
|
||||
layout.itemS()
|
||||
|
||||
# XXX: Pause Button
|
||||
row = layout.row(align=True)
|
||||
row.itemO("screen.frame_jump", text="", icon='ICON_REW')
|
||||
row.itemO("screen.keyframe_jump", text="", icon='ICON_PREV_KEYFRAME')
|
||||
row.item_booleanO("screen.animation_play", "reverse", True, text="", icon='ICON_PLAY_REVERSE')
|
||||
row.itemO("screen.animation_play", text="", icon='ICON_PLAY')
|
||||
row.item_booleanO("screen.keyframe_jump", "next", True, text="", icon='ICON_NEXT_KEYFRAME')
|
||||
row.item_booleanO("screen.frame_jump", "end", True, text="", icon='ICON_FF')
|
||||
|
||||
"""
|
||||
class TIME_MT_view(bpy.types.Menu):
|
||||
__space_type__ = "TEXT_EDITOR"
|
||||
__label__ = "View"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
st = context.space_data
|
||||
|
||||
class TIME_MT_frame(bpy.types.Menu):
|
||||
__space_type__ = "TEXT_EDITOR"
|
||||
__label__ = "Frame"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
st = context.space_data
|
||||
|
||||
class TIME_MT_playback(bpy.types.Menu):
|
||||
__space_type__ = "TEXT_EDITOR"
|
||||
__label__ = "Playback"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
st = context.space_data
|
||||
"""
|
||||
|
||||
bpy.types.register(TIME_HT_header)
|
||||
#bpy.types.register(TIME_MT_view)
|
||||
#bpy.types.register(TIME_MT_frame)
|
||||
#bpy.types.register(TIME_MT_playback)
|
||||
@@ -270,14 +270,23 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
||||
|
||||
/* ************************ header time area region *********************** */
|
||||
|
||||
//#define PY_HEADER
|
||||
/* add handlers, stuff you only do once or on area/region changes */
|
||||
static void time_header_area_init(wmWindowManager *wm, ARegion *ar)
|
||||
{
|
||||
#ifdef PY_HEADER
|
||||
ED_region_header_init(ar);
|
||||
#else
|
||||
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void time_header_area_draw(const bContext *C, ARegion *ar)
|
||||
{
|
||||
#ifdef PY_HEADER
|
||||
ED_region_header(C, ar);
|
||||
#else
|
||||
|
||||
float col[3];
|
||||
|
||||
/* clear */
|
||||
@@ -293,7 +302,8 @@ static void time_header_area_draw(const bContext *C, ARegion *ar)
|
||||
UI_view2d_view_ortho(C, &ar->v2d);
|
||||
|
||||
time_header_buttons(C, ar);
|
||||
|
||||
#endif
|
||||
|
||||
/* restore view matrix? */
|
||||
UI_view2d_view_restore(C);
|
||||
}
|
||||
|
||||
@@ -393,6 +393,7 @@ extern StructRNA RNA_SpaceFileBrowser;
|
||||
extern StructRNA RNA_SpaceGraphEditor;
|
||||
extern StructRNA RNA_SpaceImageEditor;
|
||||
extern StructRNA RNA_SpaceNLA;
|
||||
extern StructRNA RNA_SpaceTimeline;
|
||||
extern StructRNA RNA_SpaceOutliner;
|
||||
extern StructRNA RNA_SpaceSequenceEditor;
|
||||
extern StructRNA RNA_SpaceTextEditor;
|
||||
|
||||
@@ -118,10 +118,10 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
|
||||
case SPACE_NLA:
|
||||
return &RNA_SpaceNLA;
|
||||
/*case SPACE_SCRIPT:
|
||||
return &RNA_SpaceScriptsWindow;
|
||||
return &RNA_SpaceScriptsWindow;*/
|
||||
case SPACE_TIME:
|
||||
return &RNA_SpaceTimeline;
|
||||
case SPACE_NODE:
|
||||
/*case SPACE_NODE:
|
||||
return &RNA_SpaceNodeEditor;
|
||||
case SPACE_LOGIC:
|
||||
return &RNA_SpaceLogicEditor;*/
|
||||
@@ -1104,6 +1104,48 @@ static void rna_def_space_nla(BlenderRNA *brna)
|
||||
// TODO... autosnap, dopesheet?
|
||||
}
|
||||
|
||||
static void rna_def_space_time(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna= RNA_def_struct(brna, "SpaceTimeline", "Space");
|
||||
RNA_def_struct_sdna(srna, "SpaceTime");
|
||||
RNA_def_struct_ui_text(srna, "Space Timeline Editor", "Timeline editor space data.");
|
||||
|
||||
/* Define Anim Playback Areas */
|
||||
|
||||
prop= RNA_def_property(srna, "play_top_left", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_REGION);
|
||||
RNA_def_property_ui_text(prop, "Top-Left 3D Window", "");
|
||||
|
||||
prop= RNA_def_property(srna, "play_all_3d", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_3D_WIN);
|
||||
RNA_def_property_ui_text(prop, "All 3D Windows", "");
|
||||
|
||||
prop= RNA_def_property(srna, "play_anim", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_ANIM_WIN);
|
||||
RNA_def_property_ui_text(prop, "Animation Windows", "");
|
||||
|
||||
prop= RNA_def_property(srna, "play_buttons", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_BUTS_WIN);
|
||||
RNA_def_property_ui_text(prop, "Buttons Windows", "");
|
||||
|
||||
prop= RNA_def_property(srna, "play_image", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ALL_IMAGE_WIN);
|
||||
RNA_def_property_ui_text(prop, "Image Windows", "");
|
||||
|
||||
prop= RNA_def_property(srna, "play_sequencer", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_SEQ);
|
||||
RNA_def_property_ui_text(prop, "Sequencer Windows", "");
|
||||
|
||||
/* Other options */
|
||||
|
||||
prop= RNA_def_property(srna, "continue_physics", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_CONTINUE_PHYSICS);
|
||||
RNA_def_property_ui_text(prop, "Continue Physics", "During playblack, continue physics simulations regardless of the frame number");
|
||||
}
|
||||
|
||||
static void rna_def_console_line(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
@@ -1332,6 +1374,7 @@ void RNA_def_space(BlenderRNA *brna)
|
||||
rna_def_space_dopesheet(brna);
|
||||
rna_def_space_graph(brna);
|
||||
rna_def_space_nla(brna);
|
||||
rna_def_space_time(brna);
|
||||
rna_def_space_console(brna);
|
||||
rna_def_console_line(brna);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user