Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_script/space_script.c
| Show All 18 Lines | |||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_space_api.h" | #include "ED_space_api.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "BLO_read_write.h" | |||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| #endif | #endif | ||||
| #include "script_intern.h" /* own include */ | #include "script_intern.h" /* own include */ | ||||
| // static script_run_python(char *funcname, ) | // static script_run_python(char *funcname, ) | ||||
| /* ******************** default callbacks for script space ***************** */ | /* ******************** default callbacks for script space ***************** */ | ||||
| ▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | |||||
| static void script_main_region_listener(const wmRegionListenerParams *UNUSED(params)) | static void script_main_region_listener(const wmRegionListenerParams *UNUSED(params)) | ||||
| { | { | ||||
| /* XXX: Todo, need the ScriptSpace accessible to get the python script to run. */ | /* XXX: Todo, need the ScriptSpace accessible to get the python script to run. */ | ||||
| #if 0 | #if 0 | ||||
| BPY_run_script_space_listener() | BPY_run_script_space_listener() | ||||
| #endif | #endif | ||||
| } | } | ||||
| static void script_blend_read_lib(BlendLibReader *reader, ID *parent_id, SpaceLink *sl) | |||||
| { | |||||
| SpaceScript *scpt = (SpaceScript *)sl; | |||||
| /*scpt->script = NULL; - 2.45 set to null, better re-run the script */ | |||||
| if (scpt->script) { | |||||
| BLO_read_id_address(reader, parent_id->lib, &scpt->script); | |||||
| if (scpt->script) { | |||||
| SCRIPT_SET_NULL(scpt->script); | |||||
| } | |||||
| } | |||||
| } | |||||
| static void script_blend_write(BlendWriter *writer, SpaceLink *sl) | |||||
| { | |||||
| SpaceScript *scr = (SpaceScript *)sl; | |||||
| scr->but_refs = NULL; | |||||
| BLO_write_struct(writer, SpaceScript, sl); | |||||
| } | |||||
| void ED_spacetype_script(void) | void ED_spacetype_script(void) | ||||
| { | { | ||||
| SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype script"); | SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype script"); | ||||
| ARegionType *art; | ARegionType *art; | ||||
| st->spaceid = SPACE_SCRIPT; | st->spaceid = SPACE_SCRIPT; | ||||
| STRNCPY(st->name, "Script"); | STRNCPY(st->name, "Script"); | ||||
| st->create = script_create; | st->create = script_create; | ||||
| st->free = script_free; | st->free = script_free; | ||||
| st->init = script_init; | st->init = script_init; | ||||
| st->duplicate = script_duplicate; | st->duplicate = script_duplicate; | ||||
| st->operatortypes = script_operatortypes; | st->operatortypes = script_operatortypes; | ||||
| st->keymap = script_keymap; | st->keymap = script_keymap; | ||||
| st->blend_read_lib = script_blend_read_lib; | |||||
| st->blend_write = script_blend_write; | |||||
| /* regions: main window */ | /* regions: main window */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype script region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype script region"); | ||||
| art->regionid = RGN_TYPE_WINDOW; | art->regionid = RGN_TYPE_WINDOW; | ||||
| art->init = script_main_region_init; | art->init = script_main_region_init; | ||||
| art->draw = script_main_region_draw; | art->draw = script_main_region_draw; | ||||
| art->listener = script_main_region_listener; | art->listener = script_main_region_listener; | ||||
| /* XXX: Need to further test this ED_KEYMAP_UI is needed for button interaction. */ | /* XXX: Need to further test this ED_KEYMAP_UI is needed for button interaction. */ | ||||
| Show All 17 Lines | |||||