Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_buttons/space_buttons.c
| Show All 31 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 "BLO_read_write.h" | |||||
| #include "buttons_intern.h" /* own include */ | #include "buttons_intern.h" /* own include */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Default Callbacks for Properties Space | /** \name Default Callbacks for Properties Space | ||||
| * \{ */ | * \{ */ | ||||
| static SpaceLink *buttons_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene)) | static SpaceLink *buttons_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene)) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 852 Lines • ▼ Show 20 Lines | static void buttons_id_remap(ScrArea *UNUSED(area), | ||||
| if (sbuts->texuser) { | if (sbuts->texuser) { | ||||
| ButsContextTexture *ct = sbuts->texuser; | ButsContextTexture *ct = sbuts->texuser; | ||||
| BKE_id_remapper_apply(mappings, (ID **)&ct->texture, ID_REMAP_APPLY_DEFAULT); | BKE_id_remapper_apply(mappings, (ID **)&ct->texture, ID_REMAP_APPLY_DEFAULT); | ||||
| BLI_freelistN(&ct->users); | BLI_freelistN(&ct->users); | ||||
| ct->user = NULL; | ct->user = NULL; | ||||
| } | } | ||||
| } | } | ||||
| static void buttons_blend_read_data(BlendDataReader *UNUSED(reader), SpaceLink *sl) | |||||
| { | |||||
| SpaceProperties *sbuts = (SpaceProperties *)sl; | |||||
| sbuts->path = NULL; | |||||
| sbuts->texuser = NULL; | |||||
| sbuts->mainbo = sbuts->mainb; | |||||
| sbuts->mainbuser = sbuts->mainb; | |||||
| sbuts->runtime = NULL; | |||||
| } | |||||
| static void buttons_blend_read_lib(BlendLibReader *reader, ID *parent_id, SpaceLink *sl) | |||||
| { | |||||
| SpaceProperties *sbuts = (SpaceProperties *)sl; | |||||
| BLO_read_id_address(reader, parent_id->lib, &sbuts->pinid); | |||||
| if (sbuts->pinid == NULL) { | |||||
| sbuts->flag &= ~SB_PIN_CONTEXT; | |||||
| } | |||||
| } | |||||
| static void buttons_blend_write(BlendWriter *writer, SpaceLink *sl) | |||||
| { | |||||
| BLO_write_struct(writer, SpaceProperties, sl); | |||||
| } | |||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Space Type Initialization | /** \name Space Type Initialization | ||||
| * \{ */ | * \{ */ | ||||
| void ED_spacetype_buttons(void) | void ED_spacetype_buttons(void) | ||||
| { | { | ||||
| SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype buttons"); | SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype buttons"); | ||||
| ARegionType *art; | ARegionType *art; | ||||
| st->spaceid = SPACE_PROPERTIES; | st->spaceid = SPACE_PROPERTIES; | ||||
| STRNCPY(st->name, "Buttons"); | STRNCPY(st->name, "Buttons"); | ||||
| st->create = buttons_create; | st->create = buttons_create; | ||||
| st->free = buttons_free; | st->free = buttons_free; | ||||
| st->init = buttons_init; | st->init = buttons_init; | ||||
| st->duplicate = buttons_duplicate; | st->duplicate = buttons_duplicate; | ||||
| st->operatortypes = buttons_operatortypes; | st->operatortypes = buttons_operatortypes; | ||||
| st->keymap = buttons_keymap; | st->keymap = buttons_keymap; | ||||
| st->listener = buttons_area_listener; | st->listener = buttons_area_listener; | ||||
| st->context = buttons_context; | st->context = buttons_context; | ||||
| st->id_remap = buttons_id_remap; | st->id_remap = buttons_id_remap; | ||||
| st->blend_read_data = buttons_blend_read_data; | |||||
| st->blend_read_lib = buttons_blend_read_lib; | |||||
| st->blend_write = buttons_blend_write; | |||||
| /* regions: main window */ | /* regions: main window */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region"); | ||||
| art->regionid = RGN_TYPE_WINDOW; | art->regionid = RGN_TYPE_WINDOW; | ||||
| art->init = buttons_main_region_init; | art->init = buttons_main_region_init; | ||||
| art->layout = buttons_main_region_layout; | art->layout = buttons_main_region_layout; | ||||
| art->draw = ED_region_panels_draw; | art->draw = ED_region_panels_draw; | ||||
| art->listener = buttons_main_region_listener; | art->listener = buttons_main_region_listener; | ||||
| ▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines | |||||