Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c37
-rw-r--r--source/blender/editors/space_view3d/view3d_camera_control.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c23
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c2
6 files changed, 47 insertions, 26 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 8ec7d5a166b..020c58270fc 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -436,35 +436,50 @@ static void view3d_main_region_exit(wmWindowManager *wm, ARegion *region)
ED_view3d_stop_render_preview(wm, region);
}
-static bool view3d_ob_drop_poll(bContext *UNUSED(C),
+static bool view3d_drop_id_in_main_region_poll(bContext *C,
+ wmDrag *drag,
+ const wmEvent *event,
+ ID_Type id_type)
+{
+ ScrArea *area = CTX_wm_area(C);
+ if (ED_region_overlap_isect_any_xy(area, &event->x)) {
+ return false;
+ }
+ return WM_drag_ID(drag, id_type) != NULL;
+}
+
+static bool view3d_ob_drop_poll(bContext *C,
wmDrag *drag,
- const wmEvent *UNUSED(event),
+ const wmEvent *event,
const char **UNUSED(tooltip))
{
- return WM_drag_ID(drag, ID_OB) != NULL;
+ return view3d_drop_id_in_main_region_poll(C, drag, event, ID_OB);
}
-static bool view3d_collection_drop_poll(bContext *UNUSED(C),
+static bool view3d_collection_drop_poll(bContext *C,
wmDrag *drag,
- const wmEvent *UNUSED(event),
+ const wmEvent *event,
const char **UNUSED(tooltip))
{
- return WM_drag_ID(drag, ID_GR) != NULL;
+ return view3d_drop_id_in_main_region_poll(C, drag, event, ID_GR);
}
-static bool view3d_mat_drop_poll(bContext *UNUSED(C),
+static bool view3d_mat_drop_poll(bContext *C,
wmDrag *drag,
- const wmEvent *UNUSED(event),
+ const wmEvent *event,
const char **UNUSED(tooltip))
{
- return WM_drag_ID(drag, ID_MA) != NULL;
+ return view3d_drop_id_in_main_region_poll(C, drag, event, ID_MA);
}
-static bool view3d_ima_drop_poll(bContext *UNUSED(C),
+static bool view3d_ima_drop_poll(bContext *C,
wmDrag *drag,
- const wmEvent *UNUSED(event),
+ const wmEvent *event,
const char **UNUSED(tooltip))
{
+ if (ED_region_overlap_isect_any_xy(CTX_wm_area(C), &event->x)) {
+ return false;
+ }
if (drag->type == WM_DRAG_PATH) {
/* rule might not work? */
return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE));
diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c
index 260546738f4..d812ed530ce 100644
--- a/source/blender/editors/space_view3d/view3d_camera_control.c
+++ b/source/blender/editors/space_view3d/view3d_camera_control.c
@@ -101,7 +101,7 @@ typedef struct View3DCameraControl {
void *obtfm;
} View3DCameraControl;
-BLI_INLINE Object *view3d_cameracontrol_object(View3DCameraControl *vctrl)
+BLI_INLINE Object *view3d_cameracontrol_object(const View3DCameraControl *vctrl)
{
return vctrl->root_parent ? vctrl->root_parent : vctrl->ctx_v3d->camera;
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 087fce9e4fd..dbbbbc2af54 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -109,7 +109,7 @@
* \note keep this synced with #ED_view3d_mats_rv3d_backup/#ED_view3d_mats_rv3d_restore
*/
void ED_view3d_update_viewmat(Depsgraph *depsgraph,
- Scene *scene,
+ const Scene *scene,
View3D *v3d,
ARegion *region,
float viewmat[4][4],
@@ -208,7 +208,7 @@ static void view3d_main_region_setup_view(Depsgraph *depsgraph,
}
static void view3d_main_region_setup_offscreen(Depsgraph *depsgraph,
- Scene *scene,
+ const Scene *scene,
View3D *v3d,
ARegion *region,
float viewmat[4][4],
@@ -222,7 +222,10 @@ static void view3d_main_region_setup_offscreen(Depsgraph *depsgraph,
GPU_matrix_set(rv3d->viewmat);
}
-static bool view3d_stereo3d_active(wmWindow *win, Scene *scene, View3D *v3d, RegionView3D *rv3d)
+static bool view3d_stereo3d_active(wmWindow *win,
+ const Scene *scene,
+ View3D *v3d,
+ RegionView3D *rv3d)
{
if ((scene->r.scemode & R_MULTIVIEW) == 0) {
return false;
@@ -842,7 +845,7 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *region, View3D *v3d, bo
/* ******************** other elements ***************** */
/** could move this elsewhere, but tied into #ED_view3d_grid_scale */
-float ED_scene_grid_scale(Scene *scene, const char **grid_unit)
+float ED_scene_grid_scale(const Scene *scene, const char **grid_unit)
{
/* apply units */
if (scene->unit.system) {
@@ -863,13 +866,13 @@ float ED_scene_grid_scale(Scene *scene, const char **grid_unit)
return 1.0f;
}
-float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
+float ED_view3d_grid_scale(const Scene *scene, View3D *v3d, const char **grid_unit)
{
return v3d->grid * ED_scene_grid_scale(scene, grid_unit);
}
#define STEPS_LEN 8
-void ED_view3d_grid_steps(Scene *scene,
+void ED_view3d_grid_steps(const Scene *scene,
View3D *v3d,
RegionView3D *rv3d,
float r_grid_steps[STEPS_LEN])
@@ -1562,7 +1565,7 @@ static void view3d_draw_view(const bContext *C, ARegion *region)
DRW_draw_view(C);
}
-RenderEngineType *ED_view3d_engine_type(Scene *scene, int drawtype)
+RenderEngineType *ED_view3d_engine_type(const Scene *scene, int drawtype)
{
/*
* Temporary viewport draw modes until we have a proper system.
@@ -1606,7 +1609,7 @@ void view3d_main_region_draw(const bContext *C, ARegion *region)
* \{ */
static void view3d_stereo3d_setup_offscreen(Depsgraph *depsgraph,
- Scene *scene,
+ const Scene *scene,
View3D *v3d,
ARegion *region,
float winmat[4][4],
@@ -1630,7 +1633,7 @@ static void view3d_stereo3d_setup_offscreen(Depsgraph *depsgraph,
}
void ED_view3d_draw_offscreen(Depsgraph *depsgraph,
- Scene *scene,
+ const Scene *scene,
eDrawType drawtype,
View3D *v3d,
ARegion *region,
@@ -2395,7 +2398,7 @@ void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixSto
* \note The info that this uses is updated in #ED_refresh_viewport_fps,
* which currently gets called during #SCREEN_OT_animation_step.
*/
-void ED_scene_draw_fps(Scene *scene, int xoffset, int *yoffset)
+void ED_scene_draw_fps(const Scene *scene, int xoffset, int *yoffset)
{
ScreenFrameRateInfo *fpsi = scene->fps_info;
char printable[16];
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 2ced545a108..610c40c37eb 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -202,7 +202,7 @@ void view3d_winmatrix_set(struct Depsgraph *depsgraph,
const View3D *v3d,
const rcti *rect);
void view3d_viewmatrix_set(struct Depsgraph *depsgraph,
- Scene *scene,
+ const struct Scene *scene,
const View3D *v3d,
RegionView3D *rv3d,
const float rect_scale[2]);
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c
index f6ec5c93e7f..e7153ddd361 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -586,8 +586,11 @@ bool ED_view3d_camera_lock_sync(const Depsgraph *depsgraph, View3D *v3d, RegionV
}
}
-bool ED_view3d_camera_autokey(
- Scene *scene, ID *id_key, struct bContext *C, const bool do_rotate, const bool do_translate)
+bool ED_view3d_camera_autokey(const Scene *scene,
+ ID *id_key,
+ struct bContext *C,
+ const bool do_rotate,
+ const bool do_translate)
{
if (autokeyframe_cfra_can_key(scene, id_key)) {
const float cfra = (float)CFRA;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 9b0c987c451..ee41b73ed16 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -807,7 +807,7 @@ static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob)
* \note don't set windows active in here, is used by renderwin too.
*/
void view3d_viewmatrix_set(Depsgraph *depsgraph,
- Scene *scene,
+ const Scene *scene,
const View3D *v3d,
RegionView3D *rv3d,
const float rect_scale[2])