Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_graph/space_graph.c
| Show All 39 Lines | |||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "BLO_read_write.h" | |||||
| #include "graph_intern.h" /* own include */ | #include "graph_intern.h" /* own include */ | ||||
| /* ******************** default callbacks for ipo space ***************** */ | /* ******************** default callbacks for ipo space ***************** */ | ||||
| static SpaceLink *graph_create(const ScrArea *UNUSED(area), const Scene *scene) | static SpaceLink *graph_create(const ScrArea *UNUSED(area), const Scene *scene) | ||||
| { | { | ||||
| ARegion *region; | ARegion *region; | ||||
| SpaceGraph *sipo; | SpaceGraph *sipo; | ||||
| ▲ Show 20 Lines • Show All 743 Lines • ▼ Show 20 Lines | |||||
| static void graph_space_subtype_item_extend(bContext *UNUSED(C), | static void graph_space_subtype_item_extend(bContext *UNUSED(C), | ||||
| EnumPropertyItem **item, | EnumPropertyItem **item, | ||||
| int *totitem) | int *totitem) | ||||
| { | { | ||||
| RNA_enum_items_add(item, totitem, rna_enum_space_graph_mode_items); | RNA_enum_items_add(item, totitem, rna_enum_space_graph_mode_items); | ||||
| } | } | ||||
| static void graph_blend_read_data(BlendDataReader *reader, SpaceLink *sl) | |||||
| { | |||||
| SpaceGraph *sipo = (SpaceGraph *)sl; | |||||
| BLO_read_data_address(reader, &sipo->ads); | |||||
| memset(&sipo->runtime, 0x0, sizeof(sipo->runtime)); | |||||
| } | |||||
| static void graph_blend_read_lib(BlendLibReader *reader, ID *parent_id, SpaceLink *sl) | |||||
| { | |||||
| SpaceGraph *sipo = (SpaceGraph *)sl; | |||||
| bDopeSheet *ads = sipo->ads; | |||||
| if (ads) { | |||||
| BLO_read_id_address(reader, parent_id->lib, &ads->source); | |||||
| BLO_read_id_address(reader, parent_id->lib, &ads->filter_grp); | |||||
| } | |||||
| } | |||||
| static void graph_blend_write(BlendWriter *writer, SpaceLink *sl) | |||||
| { | |||||
| SpaceGraph *sipo = (SpaceGraph *)sl; | |||||
| ListBase tmpGhosts = sipo->runtime.ghost_curves; | |||||
| /* temporarily disable ghost curves when saving */ | |||||
| BLI_listbase_clear(&sipo->runtime.ghost_curves); | |||||
| BLO_write_struct(writer, SpaceGraph, sl); | |||||
| if (sipo->ads) { | |||||
| BLO_write_struct(writer, bDopeSheet, sipo->ads); | |||||
| } | |||||
| /* Re-enable ghost curves. */ | |||||
| sipo->runtime.ghost_curves = tmpGhosts; | |||||
| } | |||||
| void ED_spacetype_ipo(void) | void ED_spacetype_ipo(void) | ||||
| { | { | ||||
| SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype ipo"); | SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype ipo"); | ||||
| ARegionType *art; | ARegionType *art; | ||||
| st->spaceid = SPACE_GRAPH; | st->spaceid = SPACE_GRAPH; | ||||
| STRNCPY(st->name, "Graph"); | STRNCPY(st->name, "Graph"); | ||||
| st->create = graph_create; | st->create = graph_create; | ||||
| st->free = graph_free; | st->free = graph_free; | ||||
| st->init = graph_init; | st->init = graph_init; | ||||
| st->duplicate = graph_duplicate; | st->duplicate = graph_duplicate; | ||||
| st->operatortypes = graphedit_operatortypes; | st->operatortypes = graphedit_operatortypes; | ||||
| st->keymap = graphedit_keymap; | st->keymap = graphedit_keymap; | ||||
| st->listener = graph_listener; | st->listener = graph_listener; | ||||
| st->refresh = graph_refresh; | st->refresh = graph_refresh; | ||||
| st->id_remap = graph_id_remap; | st->id_remap = graph_id_remap; | ||||
| st->space_subtype_item_extend = graph_space_subtype_item_extend; | st->space_subtype_item_extend = graph_space_subtype_item_extend; | ||||
| st->space_subtype_get = graph_space_subtype_get; | st->space_subtype_get = graph_space_subtype_get; | ||||
| st->space_subtype_set = graph_space_subtype_set; | st->space_subtype_set = graph_space_subtype_set; | ||||
| st->blend_read_data = graph_blend_read_data; | |||||
| st->blend_read_lib = graph_blend_read_lib; | |||||
| st->blend_write = graph_blend_write; | |||||
| /* regions: main window */ | /* regions: main window */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region"); | ||||
| art->regionid = RGN_TYPE_WINDOW; | art->regionid = RGN_TYPE_WINDOW; | ||||
| art->init = graph_main_region_init; | art->init = graph_main_region_init; | ||||
| art->draw = graph_main_region_draw; | art->draw = graph_main_region_draw; | ||||
| art->draw_overlay = graph_main_region_draw_overlay; | art->draw_overlay = graph_main_region_draw_overlay; | ||||
| art->listener = graph_region_listener; | art->listener = graph_region_listener; | ||||
| ▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines | |||||