Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/space_view3d.cc
- This file was moved from source/blender/editors/space_view3d/space_view3d.c.
| Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | |||||
| #include "view3d_navigate.h" | #include "view3d_navigate.h" | ||||
| /* ******************** manage regions ********************* */ | /* ******************** manage regions ********************* */ | ||||
| RegionView3D *ED_view3d_context_rv3d(bContext *C) | RegionView3D *ED_view3d_context_rv3d(bContext *C) | ||||
| { | { | ||||
| RegionView3D *rv3d = CTX_wm_region_view3d(C); | RegionView3D *rv3d = CTX_wm_region_view3d(C); | ||||
| if (rv3d == NULL) { | if (rv3d == nullptr) { | ||||
| ScrArea *area = CTX_wm_area(C); | ScrArea *area = CTX_wm_area(C); | ||||
| if (area && area->spacetype == SPACE_VIEW3D) { | if (area && area->spacetype == SPACE_VIEW3D) { | ||||
| ARegion *region = BKE_area_find_region_active_win(area); | ARegion *region = BKE_area_find_region_active_win(area); | ||||
| if (region) { | if (region) { | ||||
| rv3d = region->regiondata; | rv3d = static_cast<RegionView3D *>(region->regiondata); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return rv3d; | return rv3d; | ||||
| } | } | ||||
| bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_region) | bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_region) | ||||
| { | { | ||||
| ScrArea *area = CTX_wm_area(C); | ScrArea *area = CTX_wm_area(C); | ||||
| *r_v3d = NULL; | *r_v3d = nullptr; | ||||
| *r_region = NULL; | *r_region = nullptr; | ||||
| if (area && area->spacetype == SPACE_VIEW3D) { | if (area && area->spacetype == SPACE_VIEW3D) { | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| View3D *v3d = (View3D *)area->spacedata.first; | View3D *v3d = (View3D *)area->spacedata.first; | ||||
| if (region) { | if (region) { | ||||
| RegionView3D *rv3d; | RegionView3D *rv3d; | ||||
| if ((region->regiontype == RGN_TYPE_WINDOW) && (rv3d = region->regiondata) && | if ((region->regiontype == RGN_TYPE_WINDOW) && | ||||
| (rv3d = static_cast<RegionView3D *>(region->regiondata)) && | |||||
| (rv3d->viewlock & RV3D_LOCK_ROTATION) == 0) { | (rv3d->viewlock & RV3D_LOCK_ROTATION) == 0) { | ||||
| *r_v3d = v3d; | *r_v3d = v3d; | ||||
| *r_region = region; | *r_region = region; | ||||
| return true; | return true; | ||||
| } | } | ||||
| if (ED_view3d_area_user_region(area, v3d, r_region)) { | if (ED_view3d_area_user_region(area, v3d, r_region)) { | ||||
| *r_v3d = v3d; | *r_v3d = v3d; | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| bool ED_view3d_area_user_region(const ScrArea *area, const View3D *v3d, ARegion **r_region) | bool ED_view3d_area_user_region(const ScrArea *area, const View3D *v3d, ARegion **r_region) | ||||
| { | { | ||||
| RegionView3D *rv3d = NULL; | RegionView3D *rv3d = nullptr; | ||||
| ARegion *region_unlock_user = NULL; | ARegion *region_unlock_user = nullptr; | ||||
| ARegion *region_unlock = NULL; | ARegion *region_unlock = nullptr; | ||||
| const ListBase *region_list = (v3d == area->spacedata.first) ? &area->regionbase : | const ListBase *region_list = (v3d == area->spacedata.first) ? &area->regionbase : | ||||
| &v3d->regionbase; | &v3d->regionbase; | ||||
| BLI_assert(v3d->spacetype == SPACE_VIEW3D); | BLI_assert(v3d->spacetype == SPACE_VIEW3D); | ||||
| LISTBASE_FOREACH (ARegion *, region, region_list) { | LISTBASE_FOREACH (ARegion *, region, region_list) { | ||||
| /* find the first unlocked rv3d */ | /* find the first unlocked rv3d */ | ||||
| if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) { | if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) { | ||||
| rv3d = region->regiondata; | rv3d = static_cast<RegionView3D *>(region->regiondata); | ||||
| if ((rv3d->viewlock & RV3D_LOCK_ROTATION) == 0) { | if ((rv3d->viewlock & RV3D_LOCK_ROTATION) == 0) { | ||||
| region_unlock = region; | region_unlock = region; | ||||
| if (ELEM(rv3d->persp, RV3D_PERSP, RV3D_CAMOB)) { | if (ELEM(rv3d->persp, RV3D_PERSP, RV3D_CAMOB)) { | ||||
| region_unlock_user = region; | region_unlock_user = region; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| BLI_ASSERT_ZERO_M4(rv3d->viewmatob); | BLI_ASSERT_ZERO_M4(rv3d->viewmatob); | ||||
| BLI_ASSERT_ZERO_M4(rv3d->persmatob); | BLI_ASSERT_ZERO_M4(rv3d->persmatob); | ||||
| } | } | ||||
| #endif | #endif | ||||
| void ED_view3d_stop_render_preview(wmWindowManager *wm, ARegion *region) | void ED_view3d_stop_render_preview(wmWindowManager *wm, ARegion *region) | ||||
| { | { | ||||
| RegionView3D *rv3d = region->regiondata; | RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata); | ||||
| if (rv3d->render_engine) { | if (rv3d->render_engine) { | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| BPy_BEGIN_ALLOW_THREADS; | BPy_BEGIN_ALLOW_THREADS; | ||||
| #endif | #endif | ||||
| WM_jobs_kill_type(wm, region, WM_JOB_TYPE_RENDER_PREVIEW); | WM_jobs_kill_type(wm, region, WM_JOB_TYPE_RENDER_PREVIEW); | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| BPy_END_ALLOW_THREADS; | BPy_END_ALLOW_THREADS; | ||||
| #endif | #endif | ||||
| RE_engine_free(rv3d->render_engine); | RE_engine_free(rv3d->render_engine); | ||||
| rv3d->render_engine = NULL; | rv3d->render_engine = nullptr; | ||||
| } | } | ||||
| /* A bit overkill but this make sure the viewport is reset completely. (fclem) */ | /* A bit overkill but this make sure the viewport is reset completely. (fclem) */ | ||||
| WM_draw_region_free(region, false); | WM_draw_region_free(region, false); | ||||
| } | } | ||||
| void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *area) | void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *area) | ||||
| { | { | ||||
| wmWindowManager *wm = bmain->wm.first; | wmWindowManager *wm = static_cast<wmWindowManager *>(bmain->wm.first); | ||||
| if (v3d->shading.type != OB_RENDER) { | if (v3d->shading.type != OB_RENDER) { | ||||
| ARegion *region; | ARegion *region; | ||||
| for (region = area->regionbase.first; region; region = region->next) { | for (region = static_cast<ARegion *>(area->regionbase.first); region; region = region->next) { | ||||
| if ((region->regiontype == RGN_TYPE_WINDOW) && region->regiondata) { | if ((region->regiontype == RGN_TYPE_WINDOW) && region->regiondata) { | ||||
| ED_view3d_stop_render_preview(wm, region); | ED_view3d_stop_render_preview(wm, region); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* ******************** default callbacks for view3d space ***************** */ | /* ******************** default callbacks for view3d space ***************** */ | ||||
| static SpaceLink *view3d_create(const ScrArea *UNUSED(area), const Scene *scene) | static SpaceLink *view3d_create(const ScrArea *UNUSED(area), const Scene *scene) | ||||
| { | { | ||||
| ARegion *region; | ARegion *region; | ||||
| View3D *v3d; | View3D *v3d; | ||||
| RegionView3D *rv3d; | RegionView3D *rv3d; | ||||
| v3d = DNA_struct_default_alloc(View3D); | v3d = DNA_struct_default_alloc(View3D); | ||||
| if (scene) { | if (scene) { | ||||
| v3d->camera = scene->camera; | v3d->camera = scene->camera; | ||||
| } | } | ||||
| /* header */ | /* header */ | ||||
| region = MEM_callocN(sizeof(ARegion), "header for view3d"); | region = MEM_cnew<ARegion>("header for view3d"); | ||||
| BLI_addtail(&v3d->regionbase, region); | BLI_addtail(&v3d->regionbase, region); | ||||
| region->regiontype = RGN_TYPE_HEADER; | region->regiontype = RGN_TYPE_HEADER; | ||||
| region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; | region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; | ||||
| /* tool header */ | /* tool header */ | ||||
| region = MEM_callocN(sizeof(ARegion), "tool header for view3d"); | region = MEM_cnew<ARegion>("tool header for view3d"); | ||||
| BLI_addtail(&v3d->regionbase, region); | BLI_addtail(&v3d->regionbase, region); | ||||
| region->regiontype = RGN_TYPE_TOOL_HEADER; | region->regiontype = RGN_TYPE_TOOL_HEADER; | ||||
| region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; | region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; | ||||
| region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER; | region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER; | ||||
| /* tool shelf */ | /* tool shelf */ | ||||
| region = MEM_callocN(sizeof(ARegion), "toolshelf for view3d"); | region = MEM_cnew<ARegion>("toolshelf for view3d"); | ||||
| BLI_addtail(&v3d->regionbase, region); | BLI_addtail(&v3d->regionbase, region); | ||||
| region->regiontype = RGN_TYPE_TOOLS; | region->regiontype = RGN_TYPE_TOOLS; | ||||
| region->alignment = RGN_ALIGN_LEFT; | region->alignment = RGN_ALIGN_LEFT; | ||||
| region->flag = RGN_FLAG_HIDDEN; | region->flag = RGN_FLAG_HIDDEN; | ||||
| /* buttons/list view */ | /* buttons/list view */ | ||||
| region = MEM_callocN(sizeof(ARegion), "buttons for view3d"); | region = MEM_cnew<ARegion>("buttons for view3d"); | ||||
| BLI_addtail(&v3d->regionbase, region); | BLI_addtail(&v3d->regionbase, region); | ||||
| region->regiontype = RGN_TYPE_UI; | region->regiontype = RGN_TYPE_UI; | ||||
| region->alignment = RGN_ALIGN_RIGHT; | region->alignment = RGN_ALIGN_RIGHT; | ||||
| region->flag = RGN_FLAG_HIDDEN; | region->flag = RGN_FLAG_HIDDEN; | ||||
| /* main region */ | /* main region */ | ||||
| region = MEM_callocN(sizeof(ARegion), "main region for view3d"); | region = MEM_cnew<ARegion>("main region for view3d"); | ||||
| BLI_addtail(&v3d->regionbase, region); | BLI_addtail(&v3d->regionbase, region); | ||||
| region->regiontype = RGN_TYPE_WINDOW; | region->regiontype = RGN_TYPE_WINDOW; | ||||
| region->regiondata = MEM_callocN(sizeof(RegionView3D), "region view3d"); | region->regiondata = MEM_cnew<RegionView3D>("region view3d"); | ||||
| rv3d = region->regiondata; | rv3d = static_cast<RegionView3D *>(region->regiondata); | ||||
| rv3d->viewquat[0] = 1.0f; | rv3d->viewquat[0] = 1.0f; | ||||
| rv3d->persp = RV3D_PERSP; | rv3d->persp = RV3D_PERSP; | ||||
| rv3d->view = RV3D_VIEW_USER; | rv3d->view = RV3D_VIEW_USER; | ||||
| rv3d->dist = 10.0; | rv3d->dist = 10.0; | ||||
| return (SpaceLink *)v3d; | return (SpaceLink *)v3d; | ||||
| } | } | ||||
| Show All 9 Lines | static void view3d_free(SpaceLink *sl) | ||||
| MEM_SAFE_FREE(vd->runtime.local_stats); | MEM_SAFE_FREE(vd->runtime.local_stats); | ||||
| if (vd->runtime.properties_storage) { | if (vd->runtime.properties_storage) { | ||||
| MEM_freeN(vd->runtime.properties_storage); | MEM_freeN(vd->runtime.properties_storage); | ||||
| } | } | ||||
| if (vd->shading.prop) { | if (vd->shading.prop) { | ||||
| IDP_FreeProperty(vd->shading.prop); | IDP_FreeProperty(vd->shading.prop); | ||||
| vd->shading.prop = NULL; | vd->shading.prop = nullptr; | ||||
| } | } | ||||
| } | } | ||||
| /* spacetype; init callback */ | /* spacetype; init callback */ | ||||
| static void view3d_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(area)) | static void view3d_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(area)) | ||||
| { | { | ||||
| } | } | ||||
| static void view3d_exit(wmWindowManager *UNUSED(wm), ScrArea *area) | static void view3d_exit(wmWindowManager *UNUSED(wm), ScrArea *area) | ||||
| { | { | ||||
| BLI_assert(area->spacetype == SPACE_VIEW3D); | BLI_assert(area->spacetype == SPACE_VIEW3D); | ||||
| View3D *v3d = area->spacedata.first; | View3D *v3d = static_cast<View3D *>(area->spacedata.first); | ||||
| MEM_SAFE_FREE(v3d->runtime.local_stats); | MEM_SAFE_FREE(v3d->runtime.local_stats); | ||||
| } | } | ||||
| static SpaceLink *view3d_duplicate(SpaceLink *sl) | static SpaceLink *view3d_duplicate(SpaceLink *sl) | ||||
| { | { | ||||
| View3D *v3do = (View3D *)sl; | View3D *v3do = (View3D *)sl; | ||||
| View3D *v3dn = MEM_dupallocN(sl); | View3D *v3dn = static_cast<View3D *>(MEM_dupallocN(sl)); | ||||
| memset(&v3dn->runtime, 0x0, sizeof(v3dn->runtime)); | memset(&v3dn->runtime, 0x0, sizeof(v3dn->runtime)); | ||||
| /* clear or remove stuff from old */ | /* clear or remove stuff from old */ | ||||
| if (v3dn->localvd) { | if (v3dn->localvd) { | ||||
| v3dn->localvd = NULL; | v3dn->localvd = nullptr; | ||||
| } | } | ||||
| v3dn->local_collections_uuid = 0; | v3dn->local_collections_uuid = 0; | ||||
| v3dn->flag &= ~(V3D_LOCAL_COLLECTIONS | V3D_XR_SESSION_MIRROR); | v3dn->flag &= ~(V3D_LOCAL_COLLECTIONS | V3D_XR_SESSION_MIRROR); | ||||
| if (v3dn->shading.type == OB_RENDER) { | if (v3dn->shading.type == OB_RENDER) { | ||||
| v3dn->shading.type = OB_SOLID; | v3dn->shading.type = OB_SOLID; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | |||||
| static ID_Type view3d_drop_id_in_main_region_poll_get_id_type(bContext *C, | static ID_Type view3d_drop_id_in_main_region_poll_get_id_type(bContext *C, | ||||
| wmDrag *drag, | wmDrag *drag, | ||||
| const wmEvent *event) | const wmEvent *event) | ||||
| { | { | ||||
| const ScrArea *area = CTX_wm_area(C); | const ScrArea *area = CTX_wm_area(C); | ||||
| if (ED_region_overlap_isect_any_xy(area, event->xy)) { | if (ED_region_overlap_isect_any_xy(area, event->xy)) { | ||||
| return 0; | return ID_Type(0); | ||||
| } | } | ||||
| if (!view3d_drop_in_main_region_poll(C, event)) { | if (!view3d_drop_in_main_region_poll(C, event)) { | ||||
| return 0; | return ID_Type(0); | ||||
| } | } | ||||
| ID *local_id = WM_drag_get_local_ID(drag, 0); | ID *local_id = WM_drag_get_local_ID(drag, 0); | ||||
| if (local_id) { | if (local_id) { | ||||
| return GS(local_id->name); | return GS(local_id->name); | ||||
| } | } | ||||
| wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0); | wmDragAsset *asset_drag = WM_drag_get_asset_data(drag, 0); | ||||
| if (asset_drag) { | if (asset_drag) { | ||||
| return asset_drag->id_type; | return ID_Type(asset_drag->id_type); | ||||
| } | } | ||||
| return 0; | return ID_Type(0); | ||||
| } | } | ||||
| static bool view3d_drop_id_in_main_region_poll(bContext *C, | static bool view3d_drop_id_in_main_region_poll(bContext *C, | ||||
| wmDrag *drag, | wmDrag *drag, | ||||
| const wmEvent *event, | const wmEvent *event, | ||||
| ID_Type id_type) | ID_Type id_type) | ||||
| { | { | ||||
| if (!view3d_drop_in_main_region_poll(C, event)) { | if (!view3d_drop_in_main_region_poll(C, event)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return WM_drag_is_ID_type(drag, id_type); | return WM_drag_is_ID_type(drag, id_type); | ||||
| } | } | ||||
| static void view3d_ob_drop_draw_activate(struct wmDropBox *drop, wmDrag *drag) | static void view3d_ob_drop_draw_activate(struct wmDropBox *drop, wmDrag *drag) | ||||
| { | { | ||||
| V3DSnapCursorState *state = drop->draw_data; | V3DSnapCursorState *state = static_cast<V3DSnapCursorState *>(drop->draw_data); | ||||
| if (state) { | if (state) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* Don't use the snap cursor when linking the object. Object transform isn't editable then and | /* Don't use the snap cursor when linking the object. Object transform isn't editable then and | ||||
| * would be reset on reload. */ | * would be reset on reload. */ | ||||
| if (WM_drag_asset_will_import_linked(drag)) { | if (WM_drag_asset_will_import_linked(drag)) { | ||||
| return; | return; | ||||
| } | } | ||||
| state = drop->draw_data = ED_view3d_cursor_snap_active(); | state = static_cast<V3DSnapCursorState *>(ED_view3d_cursor_snap_active()); | ||||
| drop->draw_data = state; | |||||
| state->draw_plane = true; | state->draw_plane = true; | ||||
| float dimensions[3] = {0.0f}; | float dimensions[3] = {0.0f}; | ||||
| if (drag->type == WM_DRAG_ID) { | if (drag->type == WM_DRAG_ID) { | ||||
| Object *ob = (Object *)WM_drag_get_local_ID(drag, ID_OB); | Object *ob = (Object *)WM_drag_get_local_ID(drag, ID_OB); | ||||
| BKE_object_dimensions_get(ob, dimensions); | BKE_object_dimensions_get(ob, dimensions); | ||||
| } | } | ||||
| else { | else { | ||||
| struct AssetMetaData *meta_data = WM_drag_get_asset_meta_data(drag, ID_OB); | struct AssetMetaData *meta_data = WM_drag_get_asset_meta_data(drag, ID_OB); | ||||
| IDProperty *dimensions_prop = BKE_asset_metadata_idprop_find(meta_data, "dimensions"); | IDProperty *dimensions_prop = BKE_asset_metadata_idprop_find(meta_data, "dimensions"); | ||||
| if (dimensions_prop) { | if (dimensions_prop) { | ||||
| copy_v3_v3(dimensions, IDP_Array(dimensions_prop)); | copy_v3_v3(dimensions, static_cast<float *>(IDP_Array(dimensions_prop))); | ||||
| } | } | ||||
| } | } | ||||
| if (!is_zero_v3(dimensions)) { | if (!is_zero_v3(dimensions)) { | ||||
| mul_v3_v3fl(state->box_dimensions, dimensions, 0.5f); | mul_v3_v3fl(state->box_dimensions, dimensions, 0.5f); | ||||
| UI_GetThemeColor4ubv(TH_GIZMO_PRIMARY, state->color_box); | UI_GetThemeColor4ubv(TH_GIZMO_PRIMARY, state->color_box); | ||||
| state->draw_box = true; | state->draw_box = true; | ||||
| } | } | ||||
| } | } | ||||
| static void view3d_ob_drop_draw_deactivate(struct wmDropBox *drop, wmDrag *UNUSED(drag)) | static void view3d_ob_drop_draw_deactivate(struct wmDropBox *drop, wmDrag *UNUSED(drag)) | ||||
| { | { | ||||
| V3DSnapCursorState *state = drop->draw_data; | V3DSnapCursorState *state = static_cast<V3DSnapCursorState *>(drop->draw_data); | ||||
| if (state) { | if (state) { | ||||
| ED_view3d_cursor_snap_deactive(state); | ED_view3d_cursor_snap_deactive(state); | ||||
| drop->draw_data = NULL; | drop->draw_data = nullptr; | ||||
| } | } | ||||
| } | } | ||||
| static bool view3d_ob_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | static bool view3d_ob_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | ||||
| { | { | ||||
| return view3d_drop_id_in_main_region_poll(C, drag, event, ID_OB); | return view3d_drop_id_in_main_region_poll(C, drag, event, ID_OB); | ||||
| } | } | ||||
| static bool view3d_ob_drop_poll_external_asset(bContext *C, wmDrag *drag, const wmEvent *event) | static bool view3d_ob_drop_poll_external_asset(bContext *C, wmDrag *drag, const wmEvent *event) | ||||
| ▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | |||||
| static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | ||||
| { | { | ||||
| if (!view3d_ima_drop_poll(C, drag, event)) { | if (!view3d_ima_drop_poll(C, drag, event)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| Object *ob = ED_view3d_give_object_under_cursor(C, event->mval); | Object *ob = ED_view3d_give_object_under_cursor(C, event->mval); | ||||
| if (ob == NULL) { | if (ob == nullptr) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) { | if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||
| ▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | static void view3d_ob_drop_copy_external_asset(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop) | ||||
| /* TODO(sergey): Only update relations for the current scene. */ | /* TODO(sergey): Only update relations for the current scene. */ | ||||
| DEG_relations_tag_update(CTX_data_main(C)); | DEG_relations_tag_update(CTX_data_main(C)); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene); | WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene); | ||||
| RNA_int_set(drop->ptr, "session_uuid", id->session_uuid); | RNA_int_set(drop->ptr, "session_uuid", id->session_uuid); | ||||
| BKE_view_layer_synced_ensure(scene, view_layer); | BKE_view_layer_synced_ensure(scene, view_layer); | ||||
| Base *base = BKE_view_layer_base_find(view_layer, (Object *)id); | Base *base = BKE_view_layer_base_find(view_layer, (Object *)id); | ||||
| if (base != NULL) { | if (base != nullptr) { | ||||
| BKE_view_layer_base_select_and_set_active(view_layer, base); | BKE_view_layer_base_select_and_set_active(view_layer, base); | ||||
| WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); | WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); | ||||
| } | } | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_SELECT); | DEG_id_tag_update(&scene->id, ID_RECALC_SELECT); | ||||
| ED_outliner_select_sync_from_object_tag(C); | ED_outliner_select_sync_from_object_tag(C); | ||||
| V3DSnapCursorState *snap_state = drop->draw_data; | V3DSnapCursorState *snap_state = static_cast<V3DSnapCursorState *>(drop->draw_data); | ||||
| if (snap_state) { | if (snap_state) { | ||||
| float obmat_final[4][4]; | float obmat_final[4][4]; | ||||
| view3d_ob_drop_matrix_from_snap(snap_state, (Object *)id, obmat_final); | view3d_ob_drop_matrix_from_snap(snap_state, (Object *)id, obmat_final); | ||||
| RNA_float_set_array(drop->ptr, "matrix", &obmat_final[0][0]); | RNA_float_set_array(drop->ptr, "matrix", &obmat_final[0][0]); | ||||
| } | } | ||||
| } | } | ||||
| Show All 26 Lines | static void view3d_collection_drop_copy_external_asset(bContext *UNUSED(C), | ||||
| /* TODO(sergey): Only update relations for the current scene. */ | /* TODO(sergey): Only update relations for the current scene. */ | ||||
| DEG_relations_tag_update(CTX_data_main(C)); | DEG_relations_tag_update(CTX_data_main(C)); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene); | WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene); | ||||
| RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid); | RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid); | ||||
| /* Make an object active, just use the first one in the collection. */ | /* Make an object active, just use the first one in the collection. */ | ||||
| CollectionObject *cobject = collection->gobject.first; | CollectionObject *cobject = static_cast<CollectionObject *>(collection->gobject.first); | ||||
| BKE_view_layer_synced_ensure(scene, view_layer); | BKE_view_layer_synced_ensure(scene, view_layer); | ||||
| Base *base = cobject ? BKE_view_layer_base_find(view_layer, cobject->ob) : NULL; | Base *base = cobject ? BKE_view_layer_base_find(view_layer, cobject->ob) : nullptr; | ||||
| if (base) { | if (base) { | ||||
| BLI_assert((base->flag & BASE_SELECTABLE) && (base->flag & BASE_ENABLED_VIEWPORT)); | BLI_assert((base->flag & BASE_SELECTABLE) && (base->flag & BASE_ENABLED_VIEWPORT)); | ||||
| BKE_view_layer_base_select_and_set_active(view_layer, base); | BKE_view_layer_base_select_and_set_active(view_layer, base); | ||||
| WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); | WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); | ||||
| } | } | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_SELECT); | DEG_id_tag_update(&scene->id, ID_RECALC_SELECT); | ||||
| ED_outliner_select_sync_from_object_tag(C); | ED_outliner_select_sync_from_object_tag(C); | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | if (!BKE_scene_uses_blender_eevee(scene)) { | ||||
| return; | return; | ||||
| } | } | ||||
| wmOperatorType *ot = WM_operatortype_find("SCENE_OT_light_cache_bake", true); | wmOperatorType *ot = WM_operatortype_find("SCENE_OT_light_cache_bake", true); | ||||
| WM_operator_properties_create_ptr(&op_ptr, ot); | WM_operator_properties_create_ptr(&op_ptr, ot); | ||||
| RNA_int_set(&op_ptr, "delay", 200); | RNA_int_set(&op_ptr, "delay", 200); | ||||
| RNA_enum_set_identifier(C, &op_ptr, "subset", "DIRTY"); | RNA_enum_set_identifier(C, &op_ptr, "subset", "DIRTY"); | ||||
| WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr, NULL); | WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr, nullptr); | ||||
| WM_operator_properties_free(&op_ptr); | WM_operator_properties_free(&op_ptr); | ||||
| } | } | ||||
| /* region dropbox definition */ | /* region dropbox definition */ | ||||
| static void view3d_dropboxes(void) | static void view3d_dropboxes(void) | ||||
| { | { | ||||
| ListBase *lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW); | ListBase *lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW); | ||||
| struct wmDropBox *drop; | struct wmDropBox *drop; | ||||
| drop = WM_dropbox_add(lb, | drop = WM_dropbox_add(lb, | ||||
| "OBJECT_OT_add_named", | "OBJECT_OT_add_named", | ||||
| view3d_ob_drop_poll_local_id, | view3d_ob_drop_poll_local_id, | ||||
| view3d_ob_drop_copy_local_id, | view3d_ob_drop_copy_local_id, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| NULL); | nullptr); | ||||
| drop->draw_droptip = WM_drag_draw_item_name_fn; | drop->draw_droptip = WM_drag_draw_item_name_fn; | ||||
| drop->draw_activate = view3d_ob_drop_draw_activate; | drop->draw_activate = view3d_ob_drop_draw_activate; | ||||
| drop->draw_deactivate = view3d_ob_drop_draw_deactivate; | drop->draw_deactivate = view3d_ob_drop_draw_deactivate; | ||||
| drop = WM_dropbox_add(lb, | drop = WM_dropbox_add(lb, | ||||
| "OBJECT_OT_transform_to_mouse", | "OBJECT_OT_transform_to_mouse", | ||||
| view3d_ob_drop_poll_external_asset, | view3d_ob_drop_poll_external_asset, | ||||
| view3d_ob_drop_copy_external_asset, | view3d_ob_drop_copy_external_asset, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| NULL); | nullptr); | ||||
| drop->draw_droptip = WM_drag_draw_item_name_fn; | drop->draw_droptip = WM_drag_draw_item_name_fn; | ||||
| drop->draw_activate = view3d_ob_drop_draw_activate; | drop->draw_activate = view3d_ob_drop_draw_activate; | ||||
| drop->draw_deactivate = view3d_ob_drop_draw_deactivate; | drop->draw_deactivate = view3d_ob_drop_draw_deactivate; | ||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "OBJECT_OT_collection_external_asset_drop", | "OBJECT_OT_collection_external_asset_drop", | ||||
| view3d_collection_drop_poll_external_asset, | view3d_collection_drop_poll_external_asset, | ||||
| view3d_collection_drop_copy_external_asset, | view3d_collection_drop_copy_external_asset, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| NULL); | nullptr); | ||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "OBJECT_OT_collection_instance_add", | "OBJECT_OT_collection_instance_add", | ||||
| view3d_collection_drop_poll_local_id, | view3d_collection_drop_poll_local_id, | ||||
| view3d_collection_drop_copy_local_id, | view3d_collection_drop_copy_local_id, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| NULL); | nullptr); | ||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "OBJECT_OT_drop_named_material", | "OBJECT_OT_drop_named_material", | ||||
| view3d_mat_drop_poll, | view3d_mat_drop_poll, | ||||
| view3d_id_drop_copy, | view3d_id_drop_copy, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| view3d_mat_drop_tooltip); | view3d_mat_drop_tooltip); | ||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "VIEW3D_OT_background_image_add", | "VIEW3D_OT_background_image_add", | ||||
| view3d_ima_bg_drop_poll, | view3d_ima_bg_drop_poll, | ||||
| view3d_id_path_drop_copy, | view3d_id_path_drop_copy, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| NULL); | nullptr); | ||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "OBJECT_OT_drop_named_image", | "OBJECT_OT_drop_named_image", | ||||
| view3d_ima_empty_drop_poll, | view3d_ima_empty_drop_poll, | ||||
| view3d_id_path_drop_copy, | view3d_id_path_drop_copy, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| NULL); | nullptr); | ||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "OBJECT_OT_volume_import", | "OBJECT_OT_volume_import", | ||||
| view3d_volume_drop_poll, | view3d_volume_drop_poll, | ||||
| view3d_id_path_drop_copy, | view3d_id_path_drop_copy, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| NULL); | nullptr); | ||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "OBJECT_OT_data_instance_add", | "OBJECT_OT_data_instance_add", | ||||
| view3d_object_data_drop_poll, | view3d_object_data_drop_poll, | ||||
| view3d_id_drop_copy_with_type, | view3d_id_drop_copy_with_type, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| view3d_object_data_drop_tooltip); | view3d_object_data_drop_tooltip); | ||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "VIEW3D_OT_drop_world", | "VIEW3D_OT_drop_world", | ||||
| view3d_world_drop_poll, | view3d_world_drop_poll, | ||||
| view3d_id_drop_copy, | view3d_id_drop_copy, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| NULL); | nullptr); | ||||
| } | } | ||||
| static void view3d_widgets(void) | static void view3d_widgets(void) | ||||
| { | { | ||||
| wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure( | wmGizmoMapType_Params params{SPACE_VIEW3D, RGN_TYPE_WINDOW}; | ||||
| &(const struct wmGizmoMapType_Params){SPACE_VIEW3D, RGN_TYPE_WINDOW}); | wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(¶ms); | ||||
| WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_xform_gizmo_context); | WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_xform_gizmo_context); | ||||
| WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_spot); | WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_spot); | ||||
| WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_area); | WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_area); | ||||
| WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_target); | WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_light_target); | ||||
| WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_force_field); | WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_force_field); | ||||
| WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_camera); | WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_camera); | ||||
| WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_camera_view); | WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_camera_view); | ||||
| Show All 19 Lines | #endif | ||||
| WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_navigate); | WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_navigate); | ||||
| WM_gizmotype_append(VIEW3D_GT_navigate_rotate); | WM_gizmotype_append(VIEW3D_GT_navigate_rotate); | ||||
| } | } | ||||
| /* type callback, not region itself */ | /* type callback, not region itself */ | ||||
| static void view3d_main_region_free(ARegion *region) | static void view3d_main_region_free(ARegion *region) | ||||
| { | { | ||||
| RegionView3D *rv3d = region->regiondata; | RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata); | ||||
| if (rv3d) { | if (rv3d) { | ||||
| if (rv3d->localvd) { | if (rv3d->localvd) { | ||||
| MEM_freeN(rv3d->localvd); | MEM_freeN(rv3d->localvd); | ||||
| } | } | ||||
| if (rv3d->clipbb) { | if (rv3d->clipbb) { | ||||
| MEM_freeN(rv3d->clipbb); | MEM_freeN(rv3d->clipbb); | ||||
| } | } | ||||
| if (rv3d->render_engine) { | if (rv3d->render_engine) { | ||||
| RE_engine_free(rv3d->render_engine); | RE_engine_free(rv3d->render_engine); | ||||
| } | } | ||||
| if (rv3d->sms) { | if (rv3d->sms) { | ||||
| MEM_freeN(rv3d->sms); | MEM_freeN(rv3d->sms); | ||||
| } | } | ||||
| MEM_freeN(rv3d); | MEM_freeN(rv3d); | ||||
| region->regiondata = NULL; | region->regiondata = nullptr; | ||||
| } | } | ||||
| } | } | ||||
| /* copy regiondata */ | /* copy regiondata */ | ||||
| static void *view3d_main_region_duplicate(void *poin) | static void *view3d_main_region_duplicate(void *poin) | ||||
| { | { | ||||
| if (poin) { | if (poin) { | ||||
| RegionView3D *rv3d = poin, *new; | RegionView3D *rv3d = static_cast<RegionView3D *>(poin); | ||||
| RegionView3D *new_rv3d; | |||||
| new = MEM_dupallocN(rv3d); | new_rv3d = static_cast<RegionView3D *>(MEM_dupallocN(rv3d)); | ||||
| if (rv3d->localvd) { | if (rv3d->localvd) { | ||||
| new->localvd = MEM_dupallocN(rv3d->localvd); | new_rv3d->localvd = static_cast<RegionView3D *>(MEM_dupallocN(rv3d->localvd)); | ||||
| } | } | ||||
| if (rv3d->clipbb) { | if (rv3d->clipbb) { | ||||
| new->clipbb = MEM_dupallocN(rv3d->clipbb); | new_rv3d->clipbb = static_cast<BoundBox *>(MEM_dupallocN(rv3d->clipbb)); | ||||
| } | } | ||||
| new->render_engine = NULL; | new_rv3d->render_engine = nullptr; | ||||
| new->sms = NULL; | new_rv3d->sms = nullptr; | ||||
| new->smooth_timer = NULL; | new_rv3d->smooth_timer = nullptr; | ||||
| return new; | return new_rv3d; | ||||
| } | } | ||||
| return NULL; | return nullptr; | ||||
| } | } | ||||
| static void view3d_main_region_listener(const wmRegionListenerParams *params) | static void view3d_main_region_listener(const wmRegionListenerParams *params) | ||||
| { | { | ||||
| wmWindow *window = params->window; | wmWindow *window = params->window; | ||||
| ScrArea *area = params->area; | ScrArea *area = params->area; | ||||
| ARegion *region = params->region; | ARegion *region = params->region; | ||||
| const wmNotifier *wmn = params->notifier; | const wmNotifier *wmn = params->notifier; | ||||
| const Scene *scene = params->scene; | const Scene *scene = params->scene; | ||||
| View3D *v3d = area->spacedata.first; | View3D *v3d = static_cast<View3D *>(area->spacedata.first); | ||||
| RegionView3D *rv3d = region->regiondata; | RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata); | ||||
| wmGizmoMap *gzmap = region->gizmo_map; | wmGizmoMap *gzmap = region->gizmo_map; | ||||
| /* context changes */ | /* context changes */ | ||||
| switch (wmn->category) { | switch (wmn->category) { | ||||
| case NC_WM: | case NC_WM: | ||||
| if (ELEM(wmn->data, ND_UNDO)) { | if (ELEM(wmn->data, ND_UNDO)) { | ||||
| WM_gizmomap_tag_refresh(gzmap); | WM_gizmomap_tag_refresh(gzmap); | ||||
| } | } | ||||
| Show All 28 Lines | case NC_SCENE: | ||||
| switch (wmn->data) { | switch (wmn->data) { | ||||
| case ND_SCENEBROWSE: | case ND_SCENEBROWSE: | ||||
| case ND_LAYER_CONTENT: | case ND_LAYER_CONTENT: | ||||
| ED_region_tag_redraw(region); | ED_region_tag_redraw(region); | ||||
| WM_gizmomap_tag_refresh(gzmap); | WM_gizmomap_tag_refresh(gzmap); | ||||
| break; | break; | ||||
| case ND_LAYER: | case ND_LAYER: | ||||
| if (wmn->reference) { | if (wmn->reference) { | ||||
| BKE_screen_view3d_sync(v3d, wmn->reference); | BKE_screen_view3d_sync(v3d, static_cast<Scene *>(wmn->reference)); | ||||
| } | } | ||||
| ED_region_tag_redraw(region); | ED_region_tag_redraw(region); | ||||
| WM_gizmomap_tag_refresh(gzmap); | WM_gizmomap_tag_refresh(gzmap); | ||||
| break; | break; | ||||
| case ND_OB_ACTIVE: | case ND_OB_ACTIVE: | ||||
| case ND_OB_SELECT: | case ND_OB_SELECT: | ||||
| ATTR_FALLTHROUGH; | ATTR_FALLTHROUGH; | ||||
| case ND_FRAME: | case ND_FRAME: | ||||
| ▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | case NC_MOVIECLIP: | ||||
| break; | break; | ||||
| case NC_SPACE: | case NC_SPACE: | ||||
| if (wmn->data == ND_SPACE_VIEW3D) { | if (wmn->data == ND_SPACE_VIEW3D) { | ||||
| if (wmn->subtype == NS_VIEW3D_GPU) { | if (wmn->subtype == NS_VIEW3D_GPU) { | ||||
| rv3d->rflag |= RV3D_GPULIGHT_UPDATE; | rv3d->rflag |= RV3D_GPULIGHT_UPDATE; | ||||
| } | } | ||||
| else if (wmn->subtype == NS_VIEW3D_SHADING) { | else if (wmn->subtype == NS_VIEW3D_SHADING) { | ||||
| #ifdef WITH_XR_OPENXR | #ifdef WITH_XR_OPENXR | ||||
| ED_view3d_xr_shading_update(G_MAIN->wm.first, v3d, scene); | ED_view3d_xr_shading_update( | ||||
| static_cast<wmWindowManager *>(G_MAIN->wm.first), v3d, scene); | |||||
| #endif | #endif | ||||
| ViewLayer *view_layer = WM_window_get_active_view_layer(window); | ViewLayer *view_layer = WM_window_get_active_view_layer(window); | ||||
| Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer); | Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer); | ||||
| if (depsgraph) { | if (depsgraph) { | ||||
| ED_render_view3d_update(depsgraph, window, area, true); | ED_render_view3d_update(depsgraph, window, area, true); | ||||
| } | } | ||||
| } | } | ||||
| Show All 40 Lines | static void view3d_do_msg_notify_workbench_view_update(struct bContext *C, | ||||
| struct wmMsgSubscribeKey *UNUSED(msg_key), | struct wmMsgSubscribeKey *UNUSED(msg_key), | ||||
| struct wmMsgSubscribeValue *msg_val) | struct wmMsgSubscribeValue *msg_val) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ScrArea *area = (ScrArea *)msg_val->user_data; | ScrArea *area = (ScrArea *)msg_val->user_data; | ||||
| View3D *v3d = (View3D *)area->spacedata.first; | View3D *v3d = (View3D *)area->spacedata.first; | ||||
| if (v3d->shading.type == OB_SOLID) { | if (v3d->shading.type == OB_SOLID) { | ||||
| RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type); | RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type); | ||||
| DRWUpdateContext drw_context = {NULL}; | DRWUpdateContext drw_context = {nullptr}; | ||||
| drw_context.bmain = CTX_data_main(C); | drw_context.bmain = CTX_data_main(C); | ||||
| drw_context.depsgraph = CTX_data_depsgraph_pointer(C); | drw_context.depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| drw_context.scene = scene; | drw_context.scene = scene; | ||||
| drw_context.view_layer = CTX_data_view_layer(C); | drw_context.view_layer = CTX_data_view_layer(C); | ||||
| drw_context.region = (ARegion *)(msg_val->owner); | drw_context.region = (ARegion *)(msg_val->owner); | ||||
| drw_context.v3d = v3d; | drw_context.v3d = v3d; | ||||
| drw_context.engine_type = engine_type; | drw_context.engine_type = engine_type; | ||||
| DRW_notify_view_update(&drw_context); | DRW_notify_view_update(&drw_context); | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | static void view3d_main_region_message_subscribe(const wmRegionMessageSubscribeParams *params) | ||||
| }; | }; | ||||
| for (int i = 0; i < ARRAY_SIZE(type_array); i++) { | for (int i = 0; i < ARRAY_SIZE(type_array); i++) { | ||||
| msg_key_params.ptr.type = type_array[i]; | msg_key_params.ptr.type = type_array[i]; | ||||
| WM_msg_subscribe_rna_params(mbus, &msg_key_params, &msg_sub_value_region_tag_redraw, __func__); | WM_msg_subscribe_rna_params(mbus, &msg_key_params, &msg_sub_value_region_tag_redraw, __func__); | ||||
| } | } | ||||
| /* Subscribe to a handful of other properties. */ | /* Subscribe to a handful of other properties. */ | ||||
| RegionView3D *rv3d = region->regiondata; | RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata); | ||||
| WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, engine, &msg_sub_value_region_tag_redraw); | WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, engine, &msg_sub_value_region_tag_redraw); | ||||
| WM_msg_subscribe_rna_anon_prop( | WM_msg_subscribe_rna_anon_prop( | ||||
| mbus, RenderSettings, resolution_x, &msg_sub_value_region_tag_redraw); | mbus, RenderSettings, resolution_x, &msg_sub_value_region_tag_redraw); | ||||
| WM_msg_subscribe_rna_anon_prop( | WM_msg_subscribe_rna_anon_prop( | ||||
| mbus, RenderSettings, resolution_y, &msg_sub_value_region_tag_redraw); | mbus, RenderSettings, resolution_y, &msg_sub_value_region_tag_redraw); | ||||
| WM_msg_subscribe_rna_anon_prop( | WM_msg_subscribe_rna_anon_prop( | ||||
| mbus, RenderSettings, pixel_aspect_x, &msg_sub_value_region_tag_redraw); | mbus, RenderSettings, pixel_aspect_x, &msg_sub_value_region_tag_redraw); | ||||
| WM_msg_subscribe_rna_anon_prop( | WM_msg_subscribe_rna_anon_prop( | ||||
| mbus, RenderSettings, pixel_aspect_y, &msg_sub_value_region_tag_redraw); | mbus, RenderSettings, pixel_aspect_y, &msg_sub_value_region_tag_redraw); | ||||
| if (rv3d->persp == RV3D_CAMOB) { | if (rv3d->persp == RV3D_CAMOB) { | ||||
| WM_msg_subscribe_rna_anon_prop( | WM_msg_subscribe_rna_anon_prop( | ||||
| mbus, RenderSettings, use_border, &msg_sub_value_region_tag_redraw); | mbus, RenderSettings, use_border, &msg_sub_value_region_tag_redraw); | ||||
| } | } | ||||
| WM_msg_subscribe_rna_anon_type(mbus, SceneEEVEE, &msg_sub_value_region_tag_redraw); | WM_msg_subscribe_rna_anon_type(mbus, SceneEEVEE, &msg_sub_value_region_tag_redraw); | ||||
| WM_msg_subscribe_rna_anon_type(mbus, SceneDisplay, &msg_sub_value_region_tag_redraw); | WM_msg_subscribe_rna_anon_type(mbus, SceneDisplay, &msg_sub_value_region_tag_redraw); | ||||
| WM_msg_subscribe_rna_anon_type(mbus, ObjectDisplay, &msg_sub_value_region_tag_redraw); | WM_msg_subscribe_rna_anon_type(mbus, ObjectDisplay, &msg_sub_value_region_tag_redraw); | ||||
| const Scene *scene = CTX_data_scene(C); | const Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| BKE_view_layer_synced_ensure(scene, view_layer); | BKE_view_layer_synced_ensure(scene, view_layer); | ||||
| Object *obact = BKE_view_layer_active_object_get(view_layer); | Object *obact = BKE_view_layer_active_object_get(view_layer); | ||||
| if (obact != NULL) { | if (obact != nullptr) { | ||||
| switch (obact->mode) { | switch (obact->mode) { | ||||
| case OB_MODE_PARTICLE_EDIT: | case OB_MODE_PARTICLE_EDIT: | ||||
| WM_msg_subscribe_rna_anon_type(mbus, ParticleEdit, &msg_sub_value_region_tag_redraw); | WM_msg_subscribe_rna_anon_type(mbus, ParticleEdit, &msg_sub_value_region_tag_redraw); | ||||
| break; | break; | ||||
| case OB_MODE_SCULPT: | case OB_MODE_SCULPT: | ||||
| WM_msg_subscribe_rna_anon_prop( | WM_msg_subscribe_rna_anon_prop( | ||||
| mbus, WorkSpace, tools, &msg_sub_value_workbench_view_update); | mbus, WorkSpace, tools, &msg_sub_value_workbench_view_update); | ||||
| ▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void ED_view3d_buttons_region_layout_ex(const bContext *C, | void ED_view3d_buttons_region_layout_ex(const bContext *C, | ||||
| ARegion *region, | ARegion *region, | ||||
| const char *category_override) | const char *category_override) | ||||
| { | { | ||||
| const enum eContextObjectMode mode = CTX_data_mode_enum(C); | const enum eContextObjectMode mode = CTX_data_mode_enum(C); | ||||
| const char *contexts_base[4] = {NULL}; | const char *contexts_base[4] = {nullptr}; | ||||
| contexts_base[0] = CTX_data_mode_string(C); | contexts_base[0] = CTX_data_mode_string(C); | ||||
| const char **contexts = &contexts_base[1]; | const char **contexts = &contexts_base[1]; | ||||
| switch (mode) { | switch (mode) { | ||||
| case CTX_MODE_EDIT_MESH: | case CTX_MODE_EDIT_MESH: | ||||
| ARRAY_SET_ITEMS(contexts, ".mesh_edit"); | ARRAY_SET_ITEMS(contexts, ".mesh_edit"); | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | case CTX_MODE_VERTEX_GPENCIL: | ||||
| break; | break; | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| ListBase *paneltypes = ®ion->type->paneltypes; | ListBase *paneltypes = ®ion->type->paneltypes; | ||||
| /* Allow drawing 3D view toolbar from non 3D view space type. */ | /* Allow drawing 3D view toolbar from non 3D view space type. */ | ||||
| if (category_override != NULL) { | if (category_override != nullptr) { | ||||
| SpaceType *st = BKE_spacetype_from_id(SPACE_VIEW3D); | SpaceType *st = BKE_spacetype_from_id(SPACE_VIEW3D); | ||||
| ARegionType *art = BKE_regiontype_from_id(st, RGN_TYPE_UI); | ARegionType *art = BKE_regiontype_from_id(st, RGN_TYPE_UI); | ||||
| paneltypes = &art->paneltypes; | paneltypes = &art->paneltypes; | ||||
| } | } | ||||
| ED_region_panels_layout_ex(C, region, paneltypes, contexts_base, category_override); | ED_region_panels_layout_ex(C, region, paneltypes, contexts_base, category_override); | ||||
| } | } | ||||
| static void view3d_buttons_region_layout(const bContext *C, ARegion *region) | static void view3d_buttons_region_layout(const bContext *C, ARegion *region) | ||||
| { | { | ||||
| ED_view3d_buttons_region_layout_ex(C, region, NULL); | ED_view3d_buttons_region_layout_ex(C, region, nullptr); | ||||
| } | } | ||||
| static void view3d_buttons_region_listener(const wmRegionListenerParams *params) | static void view3d_buttons_region_listener(const wmRegionListenerParams *params) | ||||
| { | { | ||||
| ARegion *region = params->region; | ARegion *region = params->region; | ||||
| const wmNotifier *wmn = params->notifier; | const wmNotifier *wmn = params->notifier; | ||||
| /* context changes */ | /* context changes */ | ||||
| ▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | static void view3d_tools_region_init(wmWindowManager *wm, ARegion *region) | ||||
| ED_region_panels_init(wm, region); | ED_region_panels_init(wm, region); | ||||
| keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0); | keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0); | ||||
| WM_event_add_keymap_handler(®ion->handlers, keymap); | WM_event_add_keymap_handler(®ion->handlers, keymap); | ||||
| } | } | ||||
| static void view3d_tools_region_draw(const bContext *C, ARegion *region) | static void view3d_tools_region_draw(const bContext *C, ARegion *region) | ||||
| { | { | ||||
| ED_region_panels_ex(C, region, (const char *[]){CTX_data_mode_string(C), NULL}); | const char *contexts[] = {CTX_data_mode_string(C), nullptr}; | ||||
| ED_region_panels_ex(C, region, contexts); | |||||
| } | } | ||||
| /* area (not region) level listener */ | /* area (not region) level listener */ | ||||
| static void space_view3d_listener(const wmSpaceTypeListenerParams *params) | static void space_view3d_listener(const wmSpaceTypeListenerParams *params) | ||||
| { | { | ||||
| ScrArea *area = params->area; | ScrArea *area = params->area; | ||||
| const wmNotifier *wmn = params->notifier; | const wmNotifier *wmn = params->notifier; | ||||
| View3D *v3d = area->spacedata.first; | View3D *v3d = static_cast<View3D *>(area->spacedata.first); | ||||
| /* context changes */ | /* context changes */ | ||||
| switch (wmn->category) { | switch (wmn->category) { | ||||
| case NC_SCENE: | case NC_SCENE: | ||||
| switch (wmn->data) { | switch (wmn->data) { | ||||
| case ND_WORLD: { | case ND_WORLD: { | ||||
| const bool use_scene_world = V3D_USES_SCENE_WORLD(v3d); | const bool use_scene_world = V3D_USES_SCENE_WORLD(v3d); | ||||
| if (v3d->flag2 & V3D_HIDE_OVERLAYS || use_scene_world) { | if (v3d->flag2 & V3D_HIDE_OVERLAYS || use_scene_world) { | ||||
| Show All 37 Lines | static void space_view3d_refresh(const bContext *C, ScrArea *area) | ||||
| View3D *v3d = (View3D *)area->spacedata.first; | View3D *v3d = (View3D *)area->spacedata.first; | ||||
| MEM_SAFE_FREE(v3d->runtime.local_stats); | MEM_SAFE_FREE(v3d->runtime.local_stats); | ||||
| } | } | ||||
| const char *view3d_context_dir[] = { | const char *view3d_context_dir[] = { | ||||
| "active_object", | "active_object", | ||||
| "selected_ids", | "selected_ids", | ||||
| NULL, | nullptr, | ||||
| }; | }; | ||||
| static int view3d_context(const bContext *C, const char *member, bContextDataResult *result) | static int view3d_context(const bContext *C, const char *member, bContextDataResult *result) | ||||
| { | { | ||||
| /* fallback to the scene layer, | /* fallback to the scene layer, | ||||
| * allows duplicate and other object operators to run outside the 3d view */ | * allows duplicate and other object operators to run outside the 3d view */ | ||||
| if (CTX_data_dir(member)) { | if (CTX_data_dir(member)) { | ||||
| CTX_data_dir_set(result, view3d_context_dir); | CTX_data_dir_set(result, view3d_context_dir); | ||||
| return CTX_RESULT_OK; | return CTX_RESULT_OK; | ||||
| } | } | ||||
| if (CTX_data_equals(member, "active_object")) { | if (CTX_data_equals(member, "active_object")) { | ||||
| /* In most cases the active object is the `view_layer->basact->object`. | /* In most cases the active object is the `view_layer->basact->object`. | ||||
| * For the 3D view however it can be NULL when hidden. | * For the 3D view however it can be nullptr when hidden. | ||||
| * | * | ||||
| * This is ignored in the case the object is in any mode (besides object-mode), | * This is ignored in the case the object is in any mode (besides object-mode), | ||||
| * since the object's mode impacts the current tool, cursor, gizmos etc. | * since the object's mode impacts the current tool, cursor, gizmos etc. | ||||
| * If we didn't have this exception, changing visibility would need to perform | * If we didn't have this exception, changing visibility would need to perform | ||||
| * many of the same updates as changing the objects mode. | * many of the same updates as changing the objects mode. | ||||
| * | * | ||||
| * Further, there are multiple ways to hide objects - by collection, by object type, etc. | * Further, there are multiple ways to hide objects - by collection, by object type, etc. | ||||
| * it's simplest if all these methods behave consistently - respecting the object-mode | * it's simplest if all these methods behave consistently - respecting the object-mode | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | static void view3d_id_remap_v3d(ScrArea *area, | ||||
| const bool is_local) | const bool is_local) | ||||
| { | { | ||||
| ARegion *region; | ARegion *region; | ||||
| if (BKE_id_remapper_apply(mappings, (ID **)&v3d->camera, ID_REMAP_APPLY_DEFAULT) == | if (BKE_id_remapper_apply(mappings, (ID **)&v3d->camera, ID_REMAP_APPLY_DEFAULT) == | ||||
| ID_REMAP_RESULT_SOURCE_UNASSIGNED) { | ID_REMAP_RESULT_SOURCE_UNASSIGNED) { | ||||
| /* 3D view might be inactive, in that case needs to use slink->regionbase */ | /* 3D view might be inactive, in that case needs to use slink->regionbase */ | ||||
| ListBase *regionbase = (slink == area->spacedata.first) ? &area->regionbase : | ListBase *regionbase = (slink == area->spacedata.first) ? &area->regionbase : | ||||
| &slink->regionbase; | &slink->regionbase; | ||||
| for (region = regionbase->first; region; region = region->next) { | for (region = static_cast<ARegion *>(regionbase->first); region; region = region->next) { | ||||
| if (region->regiontype == RGN_TYPE_WINDOW) { | if (region->regiontype == RGN_TYPE_WINDOW) { | ||||
| RegionView3D *rv3d = is_local ? ((RegionView3D *)region->regiondata)->localvd : | RegionView3D *rv3d = is_local ? ((RegionView3D *)region->regiondata)->localvd : | ||||
| region->regiondata; | static_cast<RegionView3D *>(region->regiondata); | ||||
| if (rv3d && (rv3d->persp == RV3D_CAMOB)) { | if (rv3d && (rv3d->persp == RV3D_CAMOB)) { | ||||
| rv3d->persp = RV3D_PERSP; | rv3d->persp = RV3D_PERSP; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void view3d_id_remap(ScrArea *area, SpaceLink *slink, const struct IDRemapper *mappings) | static void view3d_id_remap(ScrArea *area, SpaceLink *slink, const struct IDRemapper *mappings) | ||||
| { | { | ||||
| if (!BKE_id_remapper_has_mapping_for( | if (!BKE_id_remapper_has_mapping_for( | ||||
| mappings, FILTER_ID_OB | FILTER_ID_MA | FILTER_ID_IM | FILTER_ID_MC)) { | mappings, FILTER_ID_OB | FILTER_ID_MA | FILTER_ID_IM | FILTER_ID_MC)) { | ||||
| return; | return; | ||||
| } | } | ||||
| View3D *view3d = (View3D *)slink; | View3D *view3d = (View3D *)slink; | ||||
| view3d_id_remap_v3d(area, slink, view3d, mappings, false); | view3d_id_remap_v3d(area, slink, view3d, mappings, false); | ||||
| view3d_id_remap_v3d_ob_centers(view3d, mappings); | view3d_id_remap_v3d_ob_centers(view3d, mappings); | ||||
| if (view3d->localvd != NULL) { | if (view3d->localvd != nullptr) { | ||||
| /* Object centers in local-view aren't used, see: T52663 */ | /* Object centers in local-view aren't used, see: T52663 */ | ||||
| view3d_id_remap_v3d(area, slink, view3d->localvd, mappings, true); | view3d_id_remap_v3d(area, slink, view3d->localvd, mappings, true); | ||||
| } | } | ||||
| } | } | ||||
| void ED_spacetype_view3d(void) | void ED_spacetype_view3d(void) | ||||
| { | { | ||||
| SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype view3d"); | SpaceType *st = MEM_cnew<SpaceType>("spacetype view3d"); | ||||
| ARegionType *art; | ARegionType *art; | ||||
| st->spaceid = SPACE_VIEW3D; | st->spaceid = SPACE_VIEW3D; | ||||
| STRNCPY(st->name, "View3D"); | STRNCPY(st->name, "View3D"); | ||||
| st->create = view3d_create; | st->create = view3d_create; | ||||
| st->free = view3d_free; | st->free = view3d_free; | ||||
| st->init = view3d_init; | st->init = view3d_init; | ||||
| st->exit = view3d_exit; | st->exit = view3d_exit; | ||||
| st->listener = space_view3d_listener; | st->listener = space_view3d_listener; | ||||
| st->refresh = space_view3d_refresh; | st->refresh = space_view3d_refresh; | ||||
| st->duplicate = view3d_duplicate; | st->duplicate = view3d_duplicate; | ||||
| st->operatortypes = view3d_operatortypes; | st->operatortypes = view3d_operatortypes; | ||||
| st->keymap = view3d_keymap; | st->keymap = view3d_keymap; | ||||
| st->dropboxes = view3d_dropboxes; | st->dropboxes = view3d_dropboxes; | ||||
| st->gizmos = view3d_widgets; | st->gizmos = view3d_widgets; | ||||
| st->context = view3d_context; | st->context = view3d_context; | ||||
| st->id_remap = view3d_id_remap; | st->id_remap = view3d_id_remap; | ||||
| /* regions: main window */ | /* regions: main window */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype view3d main region"); | art = MEM_cnew<ARegionType>("spacetype view3d main region"); | ||||
| art->regionid = RGN_TYPE_WINDOW; | art->regionid = RGN_TYPE_WINDOW; | ||||
| art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_TOOL | ED_KEYMAP_GPENCIL; | art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_TOOL | ED_KEYMAP_GPENCIL; | ||||
| art->draw = view3d_main_region_draw; | art->draw = view3d_main_region_draw; | ||||
| art->init = view3d_main_region_init; | art->init = view3d_main_region_init; | ||||
| art->exit = view3d_main_region_exit; | art->exit = view3d_main_region_exit; | ||||
| art->free = view3d_main_region_free; | art->free = view3d_main_region_free; | ||||
| art->duplicate = view3d_main_region_duplicate; | art->duplicate = view3d_main_region_duplicate; | ||||
| art->listener = view3d_main_region_listener; | art->listener = view3d_main_region_listener; | ||||
| art->message_subscribe = view3d_main_region_message_subscribe; | art->message_subscribe = view3d_main_region_message_subscribe; | ||||
| art->cursor = view3d_main_region_cursor; | art->cursor = view3d_main_region_cursor; | ||||
| art->lock = 1; /* can become flag, see BKE_spacedata_draw_locks */ | art->lock = 1; /* can become flag, see BKE_spacedata_draw_locks */ | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| /* regions: listview/buttons */ | /* regions: listview/buttons */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype view3d buttons region"); | art = MEM_cnew<ARegionType>("spacetype view3d buttons region"); | ||||
| art->regionid = RGN_TYPE_UI; | art->regionid = RGN_TYPE_UI; | ||||
| art->prefsizex = UI_SIDEBAR_PANEL_WIDTH; | art->prefsizex = UI_SIDEBAR_PANEL_WIDTH; | ||||
| art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; | art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; | ||||
| art->listener = view3d_buttons_region_listener; | art->listener = view3d_buttons_region_listener; | ||||
| art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_ui; | art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_ui; | ||||
| art->init = view3d_buttons_region_init; | art->init = view3d_buttons_region_init; | ||||
| art->layout = view3d_buttons_region_layout; | art->layout = view3d_buttons_region_layout; | ||||
| art->draw = ED_region_panels_draw; | art->draw = ED_region_panels_draw; | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| view3d_buttons_register(art); | view3d_buttons_register(art); | ||||
| /* regions: tool(bar) */ | /* regions: tool(bar) */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype view3d tools region"); | art = MEM_cnew<ARegionType>("spacetype view3d tools region"); | ||||
| art->regionid = RGN_TYPE_TOOLS; | art->regionid = RGN_TYPE_TOOLS; | ||||
| art->prefsizex = 58; /* XXX */ | art->prefsizex = 58; /* XXX */ | ||||
| art->prefsizey = 50; /* XXX */ | art->prefsizey = 50; /* XXX */ | ||||
| art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; | art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; | ||||
| art->listener = view3d_buttons_region_listener; | art->listener = view3d_buttons_region_listener; | ||||
| art->message_subscribe = ED_region_generic_tools_region_message_subscribe; | art->message_subscribe = ED_region_generic_tools_region_message_subscribe; | ||||
| art->snap_size = ED_region_generic_tools_region_snap_size; | art->snap_size = ED_region_generic_tools_region_snap_size; | ||||
| art->init = view3d_tools_region_init; | art->init = view3d_tools_region_init; | ||||
| art->draw = view3d_tools_region_draw; | art->draw = view3d_tools_region_draw; | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| /* regions: tool header */ | /* regions: tool header */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype view3d tool header region"); | art = MEM_cnew<ARegionType>("spacetype view3d tool header region"); | ||||
| art->regionid = RGN_TYPE_TOOL_HEADER; | art->regionid = RGN_TYPE_TOOL_HEADER; | ||||
| art->prefsizey = HEADERY; | art->prefsizey = HEADERY; | ||||
| art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; | art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; | ||||
| art->listener = view3d_header_region_listener; | art->listener = view3d_header_region_listener; | ||||
| art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_header; | art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_header; | ||||
| art->init = view3d_header_region_init; | art->init = view3d_header_region_init; | ||||
| art->draw = view3d_header_region_draw; | art->draw = view3d_header_region_draw; | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| /* regions: header */ | /* regions: header */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype view3d header region"); | art = MEM_cnew<ARegionType>("spacetype view3d header region"); | ||||
| art->regionid = RGN_TYPE_HEADER; | art->regionid = RGN_TYPE_HEADER; | ||||
| art->prefsizey = HEADERY; | art->prefsizey = HEADERY; | ||||
| art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; | art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; | ||||
| art->listener = view3d_header_region_listener; | art->listener = view3d_header_region_listener; | ||||
| art->message_subscribe = view3d_header_region_message_subscribe; | art->message_subscribe = view3d_header_region_message_subscribe; | ||||
| art->init = view3d_header_region_init; | art->init = view3d_header_region_init; | ||||
| art->draw = view3d_header_region_draw; | art->draw = view3d_header_region_draw; | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| /* regions: hud */ | /* regions: hud */ | ||||
| art = ED_area_type_hud(st->spaceid); | art = ED_area_type_hud(st->spaceid); | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| /* regions: xr */ | /* regions: xr */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype view3d xr region"); | art = MEM_cnew<ARegionType>("spacetype view3d xr region"); | ||||
| art->regionid = RGN_TYPE_XR; | art->regionid = RGN_TYPE_XR; | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| BKE_spacetype_register(st); | BKE_spacetype_register(st); | ||||
| } | } | ||||