2011-02-21 07:25:24 +00:00
|
|
|
/*
|
2008-12-23 19:47:33 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2008-12-23 19:47:33 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-23 19:47:33 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
2011-02-21 07:25:24 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup editors
|
2011-02-21 07:25:24 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __ED_VIEW3D_H__
|
|
|
|
|
#define __ED_VIEW3D_H__
|
2008-12-23 19:47:33 +00:00
|
|
|
|
|
|
|
|
/* ********* exports for space_view3d/ module ********** */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
struct ARegion;
|
2009-05-16 16:18:08 +00:00
|
|
|
struct BMEdge;
|
2019-03-05 14:40:33 +11:00
|
|
|
struct BMElem;
|
2009-05-16 16:18:08 +00:00
|
|
|
struct BMFace;
|
2012-02-27 13:47:53 +00:00
|
|
|
struct BMVert;
|
|
|
|
|
struct BPoint;
|
2017-11-09 15:44:56 -02:00
|
|
|
struct Base;
|
2012-02-27 13:47:53 +00:00
|
|
|
struct BezTriple;
|
|
|
|
|
struct BoundBox;
|
2017-10-26 21:40:37 +11:00
|
|
|
struct Camera;
|
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:13:40 +01:00
|
|
|
struct CustomData_MeshMasks;
|
2017-04-26 10:46:55 +02:00
|
|
|
struct Depsgraph;
|
2012-10-05 15:44:11 +00:00
|
|
|
struct EditBone;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct GPUFX;
|
|
|
|
|
struct GPUFXSettings;
|
|
|
|
|
struct GPUOffScreen;
|
|
|
|
|
struct GPUViewport;
|
2009-01-01 19:18:03 +00:00
|
|
|
struct ImBuf;
|
2012-02-27 13:47:53 +00:00
|
|
|
struct MVert;
|
2009-10-26 12:42:25 +00:00
|
|
|
struct Main;
|
2012-10-06 03:02:14 +00:00
|
|
|
struct MetaElem;
|
2010-03-09 07:41:04 +00:00
|
|
|
struct Nurb;
|
|
|
|
|
struct Object;
|
2017-03-04 13:32:40 +11:00
|
|
|
struct RV3DMatrixStore;
|
2010-03-09 07:41:04 +00:00
|
|
|
struct RegionView3D;
|
2017-10-16 17:15:03 -02:00
|
|
|
struct RenderEngineType;
|
2010-03-09 07:41:04 +00:00
|
|
|
struct Scene;
|
2012-10-10 04:03:22 +00:00
|
|
|
struct ScrArea;
|
2010-03-09 07:41:04 +00:00
|
|
|
struct View3D;
|
|
|
|
|
struct ViewContext;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ViewLayer;
|
|
|
|
|
struct WorkSpace;
|
2012-02-27 13:47:53 +00:00
|
|
|
struct bContext;
|
2012-10-17 04:13:03 +00:00
|
|
|
struct bPoseChannel;
|
|
|
|
|
struct bScreen;
|
2014-08-05 10:47:59 -04:00
|
|
|
struct rctf;
|
2012-02-27 13:47:53 +00:00
|
|
|
struct rcti;
|
2019-03-05 14:40:33 +11:00
|
|
|
struct wmGizmo;
|
2012-01-31 18:33:31 +00:00
|
|
|
struct wmOperator;
|
2012-02-27 13:47:53 +00:00
|
|
|
struct wmOperatorType;
|
|
|
|
|
struct wmWindow;
|
2015-03-17 12:02:10 +05:00
|
|
|
struct wmWindowManager;
|
2019-03-05 14:40:33 +11:00
|
|
|
|
2015-02-12 18:54:41 +01:00
|
|
|
enum eGPUFXFlags;
|
2008-12-23 19:47:33 +00:00
|
|
|
|
2009-01-05 15:19:31 +00:00
|
|
|
/* for derivedmesh drawing callbacks, for view3d_select, .... */
|
|
|
|
|
typedef struct ViewContext {
|
2018-11-23 18:28:36 +03:00
|
|
|
struct bContext *C;
|
2018-06-08 12:16:37 +02:00
|
|
|
struct Main *bmain;
|
2017-04-26 10:46:55 +02:00
|
|
|
struct Depsgraph *depsgraph;
|
2010-08-10 05:41:51 +00:00
|
|
|
struct Scene *scene;
|
2017-11-22 10:52:39 -02:00
|
|
|
struct ViewLayer *view_layer;
|
2010-03-09 07:41:04 +00:00
|
|
|
struct Object *obact;
|
|
|
|
|
struct Object *obedit;
|
2009-01-05 15:19:31 +00:00
|
|
|
struct ARegion *ar;
|
|
|
|
|
struct View3D *v3d;
|
2016-02-04 22:26:46 +01:00
|
|
|
struct wmWindow *win;
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
struct RegionView3D *rv3d;
|
2009-05-18 08:46:04 +00:00
|
|
|
struct BMEditMesh *em;
|
2011-05-12 16:47:36 +00:00
|
|
|
int mval[2];
|
2009-01-05 15:19:31 +00:00
|
|
|
} ViewContext;
|
|
|
|
|
|
2009-01-24 13:45:24 +00:00
|
|
|
typedef struct ViewDepths {
|
|
|
|
|
unsigned short w, h;
|
2010-10-21 07:38:09 +00:00
|
|
|
short x, y; /* only for temp use for sub-rects, added to ar->winx/y */
|
2009-01-24 13:45:24 +00:00
|
|
|
float *depths;
|
|
|
|
|
double depth_range[2];
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-20 23:14:18 +00:00
|
|
|
bool damaged;
|
2009-01-24 13:45:24 +00:00
|
|
|
} ViewDepths;
|
|
|
|
|
|
2018-06-22 15:07:11 +02:00
|
|
|
|
|
|
|
|
/* Rotate 3D cursor on placement. */
|
|
|
|
|
enum eV3DCursorOrient {
|
|
|
|
|
V3D_CURSOR_ORIENT_NONE = 0,
|
|
|
|
|
V3D_CURSOR_ORIENT_VIEW,
|
2018-08-16 16:14:03 +10:00
|
|
|
V3D_CURSOR_ORIENT_XFORM,
|
2018-06-22 15:07:11 +02:00
|
|
|
V3D_CURSOR_ORIENT_GEOM,
|
|
|
|
|
};
|
|
|
|
|
|
2018-11-15 00:05:54 +11:00
|
|
|
void ED_view3d_background_color_get(const struct Scene *scene, const struct View3D *v3d, float r_color[3]);
|
2018-11-26 13:49:17 +11:00
|
|
|
void ED_view3d_cursor3d_calc_mat3(const struct Scene *scene, float mat[3][3]);
|
|
|
|
|
void ED_view3d_cursor3d_calc_mat4(const struct Scene *scene, float mat[4][4]);
|
2018-06-22 15:07:11 +02:00
|
|
|
void ED_view3d_cursor3d_position(
|
|
|
|
|
struct bContext *C, const int mval[2],
|
|
|
|
|
const bool use_depth,
|
|
|
|
|
float cursor_co[3]);
|
|
|
|
|
void ED_view3d_cursor3d_position_rotation(
|
|
|
|
|
struct bContext *C, const int mval[2],
|
|
|
|
|
const bool use_depth, enum eV3DCursorOrient orientation,
|
|
|
|
|
float cursor_co[3], float cursor_quat[4]);
|
|
|
|
|
void ED_view3d_cursor3d_update(
|
|
|
|
|
struct bContext *C, const int mval[2],
|
2018-07-31 02:57:53 +12:00
|
|
|
const bool use_depth, enum eV3DCursorOrient orientation);
|
2008-12-23 19:47:33 +00:00
|
|
|
|
2013-12-09 17:03:37 +11:00
|
|
|
struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d);
|
|
|
|
|
|
2012-12-11 14:29:01 +00:00
|
|
|
void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist);
|
2018-05-25 11:05:51 +02:00
|
|
|
void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], float *dist);
|
2011-05-23 02:23:03 +00:00
|
|
|
|
2018-05-25 11:05:51 +02:00
|
|
|
void ED_view3d_from_object(
|
|
|
|
|
const struct Object *ob,
|
|
|
|
|
float ofs[3], float quat[4], float *dist, float *lens);
|
2018-05-21 20:29:00 +02:00
|
|
|
void ED_view3d_to_object(
|
2018-05-22 07:31:11 +02:00
|
|
|
const struct Depsgraph *depsgraph, struct Object *ob,
|
|
|
|
|
const float ofs[3], const float quat[4], const float dist);
|
2011-05-23 02:23:03 +00:00
|
|
|
|
2014-03-25 14:21:50 +11:00
|
|
|
void ED_view3d_lastview_store(struct RegionView3D *rv3d);
|
|
|
|
|
|
2009-01-17 03:31:56 +00:00
|
|
|
/* Depth buffer */
|
2012-09-20 04:56:24 +00:00
|
|
|
void ED_view3d_depth_update(struct ARegion *ar);
|
2017-08-05 07:28:15 +10:00
|
|
|
float ED_view3d_depth_read_cached(const struct ViewContext *vc, const int mval[2]);
|
|
|
|
|
bool ED_view3d_depth_read_cached_normal(
|
2017-08-05 07:53:07 +10:00
|
|
|
const ViewContext *vc, const int mval[2],
|
2017-08-05 07:28:15 +10:00
|
|
|
float r_normal[3]);
|
|
|
|
|
bool ED_view3d_depth_unproject(
|
2017-08-05 07:53:07 +10:00
|
|
|
const struct ARegion *ar,
|
2017-08-05 07:28:15 +10:00
|
|
|
const int mval[2], const double depth,
|
|
|
|
|
float r_location_world[3]);
|
2012-09-20 04:56:24 +00:00
|
|
|
void ED_view3d_depth_tag_update(struct RegionView3D *rv3d);
|
2009-01-17 03:31:56 +00:00
|
|
|
|
|
|
|
|
/* Projection */
|
2009-01-24 13:45:24 +00:00
|
|
|
#define IS_CLIPPED 12000
|
2009-01-16 01:56:11 +00:00
|
|
|
|
refactor ED_view3d_project_short & ED_view3d_project_short_noclip,
This is apart of a code cleanup to make ED_view3d_project_short/ED_view3d_project_int/ED_view3d_project_float interchangeable. Currently they work very differently in a way thats quite confusing (and cause of bugs in blender that remain uncorrected) - fixes coming.
There are also cases where ED_view3d_project_short is used, then the values are converted from shorts into int's after because ED_view3d_project_int() behaves differently, will unify behavior of these functions after this commit.
- rather then clip/noclip versions, pass flags (for bound-box clip, window clip).
- rather then store the invalid clip-value, return success (or error value clip_near, clip_bb, clip_win, overflow).
- remove local copies of project functions from drawobject.c: view3d_project_short_clip, view3d_project_short_noclip, view3d_project_short_clip_persmat.
add functions:
- ED_view3d_project_short_global() global space projection
- ED_view3d_project_short_object() object space projection.
- ED_view3d_project_short_ex() take perspective matrix and local space option as args.
- ED_view3d_project_base() - special function to set the Object 'Base' screen coords (sx, sy), since this is a common enough operation.
2012-10-04 16:46:15 +00:00
|
|
|
/* return values for ED_view3d_project_...() */
|
|
|
|
|
typedef enum {
|
2012-10-07 14:00:18 +00:00
|
|
|
V3D_PROJ_RET_OK = 0,
|
2019-01-15 23:24:20 +11:00
|
|
|
/** can't avoid this when in perspective mode, (can't avoid) */
|
|
|
|
|
V3D_PROJ_RET_CLIP_NEAR = 1,
|
|
|
|
|
/** so close to zero we can't apply a perspective matrix usefully */
|
|
|
|
|
V3D_PROJ_RET_CLIP_ZERO = 2,
|
|
|
|
|
/** bounding box clip - RV3D_CLIPPING */
|
|
|
|
|
V3D_PROJ_RET_CLIP_BB = 3,
|
|
|
|
|
/** outside window bounds */
|
|
|
|
|
V3D_PROJ_RET_CLIP_WIN = 4,
|
|
|
|
|
/** outside range (mainly for short), (can't avoid) */
|
2019-01-15 23:57:49 +11:00
|
|
|
V3D_PROJ_RET_OVERFLOW = 5,
|
refactor ED_view3d_project_short & ED_view3d_project_short_noclip,
This is apart of a code cleanup to make ED_view3d_project_short/ED_view3d_project_int/ED_view3d_project_float interchangeable. Currently they work very differently in a way thats quite confusing (and cause of bugs in blender that remain uncorrected) - fixes coming.
There are also cases where ED_view3d_project_short is used, then the values are converted from shorts into int's after because ED_view3d_project_int() behaves differently, will unify behavior of these functions after this commit.
- rather then clip/noclip versions, pass flags (for bound-box clip, window clip).
- rather then store the invalid clip-value, return success (or error value clip_near, clip_bb, clip_win, overflow).
- remove local copies of project functions from drawobject.c: view3d_project_short_clip, view3d_project_short_noclip, view3d_project_short_clip_persmat.
add functions:
- ED_view3d_project_short_global() global space projection
- ED_view3d_project_short_object() object space projection.
- ED_view3d_project_short_ex() take perspective matrix and local space option as args.
- ED_view3d_project_base() - special function to set the Object 'Base' screen coords (sx, sy), since this is a common enough operation.
2012-10-04 16:46:15 +00:00
|
|
|
} eV3DProjStatus;
|
|
|
|
|
|
|
|
|
|
/* some clipping tests are optional */
|
|
|
|
|
typedef enum {
|
|
|
|
|
V3D_PROJ_TEST_NOP = 0,
|
|
|
|
|
V3D_PROJ_TEST_CLIP_BB = (1 << 0),
|
|
|
|
|
V3D_PROJ_TEST_CLIP_WIN = (1 << 1),
|
2012-12-21 03:49:47 +00:00
|
|
|
V3D_PROJ_TEST_CLIP_NEAR = (1 << 2),
|
2019-01-15 23:57:49 +11:00
|
|
|
V3D_PROJ_TEST_CLIP_ZERO = (1 << 3),
|
refactor ED_view3d_project_short & ED_view3d_project_short_noclip,
This is apart of a code cleanup to make ED_view3d_project_short/ED_view3d_project_int/ED_view3d_project_float interchangeable. Currently they work very differently in a way thats quite confusing (and cause of bugs in blender that remain uncorrected) - fixes coming.
There are also cases where ED_view3d_project_short is used, then the values are converted from shorts into int's after because ED_view3d_project_int() behaves differently, will unify behavior of these functions after this commit.
- rather then clip/noclip versions, pass flags (for bound-box clip, window clip).
- rather then store the invalid clip-value, return success (or error value clip_near, clip_bb, clip_win, overflow).
- remove local copies of project functions from drawobject.c: view3d_project_short_clip, view3d_project_short_noclip, view3d_project_short_clip_persmat.
add functions:
- ED_view3d_project_short_global() global space projection
- ED_view3d_project_short_object() object space projection.
- ED_view3d_project_short_ex() take perspective matrix and local space option as args.
- ED_view3d_project_base() - special function to set the Object 'Base' screen coords (sx, sy), since this is a common enough operation.
2012-10-04 16:46:15 +00:00
|
|
|
} eV3DProjTest;
|
|
|
|
|
|
2013-02-28 11:29:27 +00:00
|
|
|
#define V3D_PROJ_TEST_CLIP_DEFAULT \
|
|
|
|
|
(V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR)
|
|
|
|
|
#define V3D_PROJ_TEST_ALL \
|
|
|
|
|
(V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR | V3D_PROJ_TEST_CLIP_ZERO)
|
2012-10-10 04:03:22 +00:00
|
|
|
|
refactor ED_view3d_project_short & ED_view3d_project_short_noclip,
This is apart of a code cleanup to make ED_view3d_project_short/ED_view3d_project_int/ED_view3d_project_float interchangeable. Currently they work very differently in a way thats quite confusing (and cause of bugs in blender that remain uncorrected) - fixes coming.
There are also cases where ED_view3d_project_short is used, then the values are converted from shorts into int's after because ED_view3d_project_int() behaves differently, will unify behavior of these functions after this commit.
- rather then clip/noclip versions, pass flags (for bound-box clip, window clip).
- rather then store the invalid clip-value, return success (or error value clip_near, clip_bb, clip_win, overflow).
- remove local copies of project functions from drawobject.c: view3d_project_short_clip, view3d_project_short_noclip, view3d_project_short_clip_persmat.
add functions:
- ED_view3d_project_short_global() global space projection
- ED_view3d_project_short_object() object space projection.
- ED_view3d_project_short_ex() take perspective matrix and local space option as args.
- ED_view3d_project_base() - special function to set the Object 'Base' screen coords (sx, sy), since this is a common enough operation.
2012-10-04 16:46:15 +00:00
|
|
|
|
2012-10-17 04:13:03 +00:00
|
|
|
/* view3d_iterators.c */
|
|
|
|
|
|
|
|
|
|
/* foreach iterators */
|
2012-12-23 03:04:19 +00:00
|
|
|
void meshobject_foreachScreenVert(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct ViewContext *vc,
|
2012-12-23 03:04:19 +00:00
|
|
|
void (*func)(void *userData, struct MVert *eve, const float screen_co[2], int index),
|
|
|
|
|
void *userData, const eV3DProjTest clip_flag);
|
2012-10-17 04:13:03 +00:00
|
|
|
void mesh_foreachScreenVert(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct ViewContext *vc,
|
2012-10-17 04:13:03 +00:00
|
|
|
void (*func)(void *userData, struct BMVert *eve, const float screen_co[2], int index),
|
|
|
|
|
void *userData, const eV3DProjTest clip_flag);
|
|
|
|
|
void mesh_foreachScreenEdge(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct ViewContext *vc,
|
2012-10-17 04:13:03 +00:00
|
|
|
void (*func)(void *userData, struct BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2],
|
|
|
|
|
int index),
|
|
|
|
|
void *userData, const eV3DProjTest clip_flag);
|
|
|
|
|
void mesh_foreachScreenFace(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct ViewContext *vc,
|
2012-10-17 04:13:03 +00:00
|
|
|
void (*func)(void *userData, struct BMFace *efa, const float screen_co[2], int index),
|
|
|
|
|
void *userData, const eV3DProjTest clip_flag);
|
|
|
|
|
void nurbs_foreachScreenVert(
|
|
|
|
|
struct ViewContext *vc,
|
|
|
|
|
void (*func)(void *userData, struct Nurb *nu, struct BPoint *bp, struct BezTriple *bezt,
|
|
|
|
|
int beztindex, const float screen_co[2]),
|
|
|
|
|
void *userData, const eV3DProjTest clip_flag);
|
|
|
|
|
void mball_foreachScreenElem(
|
|
|
|
|
struct ViewContext *vc,
|
|
|
|
|
void (*func)(void *userData, struct MetaElem *ml, const float screen_co[2]),
|
|
|
|
|
void *userData, const eV3DProjTest clip_flag);
|
|
|
|
|
void lattice_foreachScreenVert(
|
|
|
|
|
struct ViewContext *vc,
|
|
|
|
|
void (*func)(void *userData, struct BPoint *bp,
|
|
|
|
|
const float screen_co[2]),
|
|
|
|
|
void *userData, const eV3DProjTest clip_flag);
|
|
|
|
|
void armature_foreachScreenBone(
|
|
|
|
|
struct ViewContext *vc,
|
|
|
|
|
void (*func)(void *userData, struct EditBone *ebone,
|
|
|
|
|
const float screen_co_a[2], const float screen_co_b[2]),
|
|
|
|
|
void *userData, const eV3DProjTest clip_flag);
|
|
|
|
|
void pose_foreachScreenBone(
|
|
|
|
|
struct ViewContext *vc,
|
|
|
|
|
void (*func)(void *userData, struct bPoseChannel *pchan,
|
|
|
|
|
const float screen_co_a[2], const float screen_co_b[2]),
|
|
|
|
|
void *userData, const eV3DProjTest clip_flag);
|
|
|
|
|
/* *** end iterators *** */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* view3d_project.c */
|
2013-03-14 13:58:56 +00:00
|
|
|
void ED_view3d_project_float_v2_m4(const struct ARegion *ar, const float co[3], float r_co[2], float mat[4][4]);
|
|
|
|
|
void ED_view3d_project_float_v3_m4(const struct ARegion *ar, const float co[3], float r_co[3], float mat[4][4]);
|
2012-10-17 04:13:03 +00:00
|
|
|
|
2017-11-09 15:44:56 -02:00
|
|
|
eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *base);
|
2012-10-17 04:13:03 +00:00
|
|
|
|
2012-10-04 17:52:12 +00:00
|
|
|
/* *** short *** */
|
2013-03-14 13:58:56 +00:00
|
|
|
eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *ar, float perspmat[4][4], const bool is_local,
|
2012-10-10 04:03:22 +00:00
|
|
|
const float co[3], short r_co[2], const eV3DProjTest flag);
|
2013-03-14 13:58:56 +00:00
|
|
|
eV3DProjStatus ED_view3d_project_short_global(const struct ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag);
|
|
|
|
|
eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag);
|
2012-10-04 17:52:12 +00:00
|
|
|
|
|
|
|
|
/* *** int *** */
|
2013-03-14 13:58:56 +00:00
|
|
|
eV3DProjStatus ED_view3d_project_int_ex(const struct ARegion *ar, float perspmat[4][4], const bool is_local,
|
2012-10-10 04:03:22 +00:00
|
|
|
const float co[3], int r_co[2], const eV3DProjTest flag);
|
2013-03-14 13:58:56 +00:00
|
|
|
eV3DProjStatus ED_view3d_project_int_global(const struct ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag);
|
|
|
|
|
eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag);
|
2012-10-04 17:52:12 +00:00
|
|
|
|
2012-10-05 01:27:28 +00:00
|
|
|
/* *** float *** */
|
2013-03-14 13:58:56 +00:00
|
|
|
eV3DProjStatus ED_view3d_project_float_ex(const struct ARegion *ar, float perspmat[4][4], const bool is_local,
|
|
|
|
|
const float co[3], float r_co[2], const eV3DProjTest flag);
|
|
|
|
|
eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag);
|
|
|
|
|
eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag);
|
|
|
|
|
|
2018-01-28 14:44:42 +11:00
|
|
|
float ED_view3d_pixel_size(const struct RegionView3D *rv3d, const float co[3]);
|
2018-05-25 10:00:33 +02:00
|
|
|
float ED_view3d_pixel_size_no_ui_scale(const struct RegionView3D *rv3d, const float co[3]);
|
2018-01-28 14:44:42 +11:00
|
|
|
|
2013-03-14 13:58:56 +00:00
|
|
|
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip);
|
2016-07-13 14:42:00 +10:00
|
|
|
bool ED_view3d_clip_segment(const struct RegionView3D *rv3d, float ray_start[3], float ray_end[3]);
|
2018-09-20 12:04:18 +10:00
|
|
|
bool ED_view3d_win_to_ray_clipped(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph *depsgraph,
|
2016-06-29 23:22:54 +10:00
|
|
|
const struct ARegion *ar, const struct View3D *v3d, const float mval[2],
|
|
|
|
|
float ray_start[3], float ray_normal[3], const bool do_clip);
|
2018-09-20 12:04:18 +10:00
|
|
|
bool ED_view3d_win_to_ray_clipped_ex(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph *depsgraph,
|
2016-06-29 23:22:54 +10:00
|
|
|
const struct ARegion *ar, const struct View3D *v3d, const float mval[2],
|
|
|
|
|
float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip);
|
2018-09-20 12:00:02 +10:00
|
|
|
void ED_view3d_win_to_ray(
|
|
|
|
|
const struct ARegion *ar, const float mval[2],
|
|
|
|
|
float r_ray_start[3], float r_ray_normal[3]);
|
2013-03-14 13:58:56 +00:00
|
|
|
void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3]);
|
2016-12-08 12:41:27 +01:00
|
|
|
void ED_view3d_win_to_3d(
|
|
|
|
|
const struct View3D *v3d, const struct ARegion *ar,
|
|
|
|
|
const float depth_pt[3], const float mval[2],
|
|
|
|
|
float r_out[3]);
|
|
|
|
|
void ED_view3d_win_to_3d_int(
|
|
|
|
|
const struct View3D *v3d, const struct ARegion *ar,
|
|
|
|
|
const float depth_pt[3], const int mval[2],
|
|
|
|
|
float r_out[3]);
|
2018-09-20 11:21:34 +10:00
|
|
|
bool ED_view3d_win_to_3d_on_plane(
|
|
|
|
|
const struct ARegion *ar,
|
2018-09-20 12:42:00 +10:00
|
|
|
const float plane[4], const float mval[2], const bool do_clip,
|
2018-09-20 11:21:34 +10:00
|
|
|
float r_out[3]);
|
|
|
|
|
bool ED_view3d_win_to_3d_on_plane_int(
|
|
|
|
|
const struct ARegion *ar,
|
2018-09-20 12:42:00 +10:00
|
|
|
const float plane[4], const int mval[2], const bool do_clip,
|
2018-09-20 11:21:34 +10:00
|
|
|
float r_out[3]);
|
2013-03-14 13:58:56 +00:00
|
|
|
void ED_view3d_win_to_delta(const struct ARegion *ar, const float mval[2], float out[3], const float zfac);
|
2016-07-13 14:42:00 +10:00
|
|
|
void ED_view3d_win_to_origin(const struct ARegion *ar, const float mval[2], float out[3]);
|
2013-03-14 13:58:56 +00:00
|
|
|
void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]);
|
2018-09-20 12:04:18 +10:00
|
|
|
bool ED_view3d_win_to_segment_clipped(
|
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
|
const struct ARegion *ar, struct View3D *v3d, const float mval[2],
|
|
|
|
|
float r_ray_start[3], float r_ray_end[3], const bool do_clip);
|
2013-03-14 13:58:56 +00:00
|
|
|
void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
|
2015-04-28 23:34:40 +10:00
|
|
|
void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d, float obmat[4][4], float pmat[4][4]);
|
2017-02-25 21:58:23 +01:00
|
|
|
|
|
|
|
|
void ED_view3d_project(const struct ARegion *ar, const float world[3], float region[3]);
|
|
|
|
|
bool ED_view3d_unproject(const struct ARegion *ar, float regionx, float regiony, float regionz, float world[3]);
|
2012-10-17 04:13:03 +00:00
|
|
|
|
|
|
|
|
/* end */
|
2012-09-20 04:56:24 +00:00
|
|
|
|
refactor ED_view3d_project_short & ED_view3d_project_short_noclip,
This is apart of a code cleanup to make ED_view3d_project_short/ED_view3d_project_int/ED_view3d_project_float interchangeable. Currently they work very differently in a way thats quite confusing (and cause of bugs in blender that remain uncorrected) - fixes coming.
There are also cases where ED_view3d_project_short is used, then the values are converted from shorts into int's after because ED_view3d_project_int() behaves differently, will unify behavior of these functions after this commit.
- rather then clip/noclip versions, pass flags (for bound-box clip, window clip).
- rather then store the invalid clip-value, return success (or error value clip_near, clip_bb, clip_win, overflow).
- remove local copies of project functions from drawobject.c: view3d_project_short_clip, view3d_project_short_noclip, view3d_project_short_clip_persmat.
add functions:
- ED_view3d_project_short_global() global space projection
- ED_view3d_project_short_object() object space projection.
- ED_view3d_project_short_ex() take perspective matrix and local space option as args.
- ED_view3d_project_base() - special function to set the Object 'Base' screen coords (sx, sy), since this is a common enough operation.
2012-10-04 16:46:15 +00:00
|
|
|
|
2015-03-21 22:34:20 +11:00
|
|
|
void ED_view3d_dist_range_get(
|
|
|
|
|
const struct View3D *v3d,
|
|
|
|
|
float r_dist_range[2]);
|
|
|
|
|
bool ED_view3d_clip_range_get(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph *depsgraph,
|
2015-03-21 22:34:20 +11:00
|
|
|
const struct View3D *v3d, const struct RegionView3D *rv3d,
|
|
|
|
|
float *r_clipsta, float *r_clipend, const bool use_ortho_factor);
|
|
|
|
|
bool ED_view3d_viewplane_get(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph *depsgraph,
|
2015-03-21 22:34:20 +11:00
|
|
|
const struct View3D *v3d, const struct RegionView3D *rv3d, int winxi, int winyi,
|
|
|
|
|
struct rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize);
|
2013-12-09 20:59:29 +11:00
|
|
|
|
|
|
|
|
void ED_view3d_polygon_offset(const struct RegionView3D *rv3d, const float dist);
|
|
|
|
|
|
2015-03-21 22:34:20 +11:00
|
|
|
void ED_view3d_calc_camera_border(
|
2018-04-06 12:07:27 +02:00
|
|
|
const struct Scene *scene, struct Depsgraph *depsgraph,
|
2018-01-18 15:58:02 +01:00
|
|
|
const struct ARegion *ar,
|
2015-03-21 22:34:20 +11:00
|
|
|
const struct View3D *v3d, const struct RegionView3D *rv3d,
|
|
|
|
|
struct rctf *r_viewborder, const bool no_shift);
|
|
|
|
|
void ED_view3d_calc_camera_border_size(
|
2018-04-06 12:07:27 +02:00
|
|
|
const struct Scene *scene, struct Depsgraph *depsgraph,
|
2018-01-18 15:58:02 +01:00
|
|
|
const struct ARegion *ar,
|
2015-03-21 22:34:20 +11:00
|
|
|
const struct View3D *v3d, const struct RegionView3D *rv3d,
|
|
|
|
|
float r_size[2]);
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
bool ED_view3d_calc_render_border(
|
2018-04-06 12:07:27 +02:00
|
|
|
const struct Scene *scene, struct Depsgraph *depsgraph,
|
2018-01-18 15:58:02 +01:00
|
|
|
struct View3D *v3d,
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
struct ARegion *ar, struct rcti *rect);
|
2009-01-20 11:09:26 +00:00
|
|
|
|
2015-03-07 00:25:27 +11:00
|
|
|
void ED_view3d_clipping_calc_from_boundbox(float clip[6][4], const struct BoundBox *clipbb, const bool is_flip);
|
2017-02-25 21:58:23 +01:00
|
|
|
void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4],
|
|
|
|
|
const struct ARegion *ar, const struct Object *ob, const struct rcti *rect);
|
2012-12-11 14:29:01 +00:00
|
|
|
void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]);
|
2015-03-21 22:34:20 +11:00
|
|
|
bool ED_view3d_clipping_test(const struct RegionView3D *rv3d, const float co[3], const bool is_local);
|
2012-02-28 13:03:56 +00:00
|
|
|
void ED_view3d_clipping_set(struct RegionView3D *rv3d);
|
|
|
|
|
void ED_view3d_clipping_enable(void);
|
|
|
|
|
void ED_view3d_clipping_disable(void);
|
|
|
|
|
|
2015-03-21 15:11:30 +11:00
|
|
|
float ED_view3d_radius_to_dist_persp(const float angle, const float radius);
|
|
|
|
|
float ED_view3d_radius_to_dist_ortho(const float lens, const float radius);
|
|
|
|
|
float ED_view3d_radius_to_dist(
|
|
|
|
|
const struct View3D *v3d, const struct ARegion *ar,
|
2018-05-25 11:05:51 +02:00
|
|
|
const struct Depsgraph *depsgraph,
|
2015-03-21 15:11:30 +11:00
|
|
|
const char persp, const bool use_aspect,
|
|
|
|
|
const float radius);
|
2008-12-30 16:03:29 +00:00
|
|
|
|
2017-02-02 03:13:41 -02:00
|
|
|
void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned pos);
|
2009-01-10 18:33:16 +00:00
|
|
|
|
2009-01-01 19:18:03 +00:00
|
|
|
/* backbuffer select and draw support */
|
2018-05-24 20:35:51 +02:00
|
|
|
void ED_view3d_backbuf_validate_with_select_mode(struct ViewContext *vc, short select_mode);
|
2018-04-06 12:07:27 +02:00
|
|
|
void ED_view3d_backbuf_validate(struct ViewContext *vc);
|
2017-08-16 12:45:11 +10:00
|
|
|
struct ImBuf *ED_view3d_backbuf_read(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct ViewContext *vc, int xmin, int ymin, int xmax, int ymax);
|
2015-04-21 03:19:27 +10:00
|
|
|
unsigned int ED_view3d_backbuf_sample_rect(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct ViewContext *vc, const int mval[2], int size,
|
2015-04-21 21:16:19 +10:00
|
|
|
unsigned int min, unsigned int max, float *r_dist);
|
2015-04-21 03:19:27 +10:00
|
|
|
int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist);
|
2017-08-16 12:45:11 +10:00
|
|
|
unsigned int ED_view3d_backbuf_sample(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct ViewContext *vc, int x, int y);
|
2008-12-30 16:03:29 +00:00
|
|
|
|
2015-08-21 09:07:52 +10:00
|
|
|
bool ED_view3d_autodist(
|
2018-05-29 12:01:07 +02:00
|
|
|
struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d,
|
2015-08-21 09:07:52 +10:00
|
|
|
const int mval[2], float mouse_worldloc[3],
|
|
|
|
|
const bool alphaoverride, const float fallback_depth_pt[3]);
|
2009-02-19 23:53:40 +00:00
|
|
|
|
2011-05-20 13:09:34 +00:00
|
|
|
/* only draw so ED_view3d_autodist_simple can be called many times after */
|
2018-06-08 14:38:57 +02:00
|
|
|
void ED_view3d_autodist_init(
|
|
|
|
|
struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, int mode);
|
2013-03-20 23:14:18 +00:00
|
|
|
bool ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth);
|
|
|
|
|
bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
|
|
|
|
|
bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
|
2009-11-30 01:13:46 +00:00
|
|
|
|
2009-01-05 15:19:31 +00:00
|
|
|
/* select */
|
2015-02-24 17:19:07 +01:00
|
|
|
#define MAXPICKELEMS 2500
|
|
|
|
|
#define MAXPICKBUF (4 * MAXPICKELEMS)
|
2017-03-09 05:17:55 +11:00
|
|
|
|
2017-03-09 20:47:37 +11:00
|
|
|
typedef enum {
|
2017-03-09 05:17:55 +11:00
|
|
|
/* all elements in the region, ignore depth */
|
|
|
|
|
VIEW3D_SELECT_ALL = 0,
|
|
|
|
|
/* pick also depth sorts (only for small regions!) */
|
|
|
|
|
VIEW3D_SELECT_PICK_ALL = 1,
|
|
|
|
|
/* sorts and only returns visible objects (only for small regions!) */
|
|
|
|
|
VIEW3D_SELECT_PICK_NEAREST = 2,
|
2017-03-09 20:47:37 +11:00
|
|
|
} eV3DSelectMode;
|
|
|
|
|
|
2018-06-19 16:41:18 +02:00
|
|
|
typedef enum {
|
2018-11-23 10:00:28 +11:00
|
|
|
/** Don't exclude anything. */
|
2018-06-19 16:41:18 +02:00
|
|
|
VIEW3D_SELECT_FILTER_NOP = 0,
|
2018-11-23 10:00:28 +11:00
|
|
|
/** Don't select objects outside the current mode. */
|
2018-06-19 16:41:18 +02:00
|
|
|
VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK = 1,
|
2018-11-23 10:00:28 +11:00
|
|
|
/** A version of #VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK that allows pose-bone selection. */
|
|
|
|
|
VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK = 2,
|
2018-06-19 16:41:18 +02:00
|
|
|
} eV3DSelectObjectFilter;
|
|
|
|
|
|
2018-11-23 10:00:28 +11:00
|
|
|
eV3DSelectObjectFilter ED_view3d_select_filter_from_mode(const struct Scene *scene, const struct Object *obact);
|
|
|
|
|
|
2017-03-09 20:47:37 +11:00
|
|
|
void view3d_opengl_select_cache_begin(void);
|
|
|
|
|
void view3d_opengl_select_cache_end(void);
|
2017-03-09 05:17:55 +11:00
|
|
|
|
|
|
|
|
int view3d_opengl_select(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const struct rcti *input,
|
2018-06-19 16:41:18 +02:00
|
|
|
eV3DSelectMode select_mode, eV3DSelectObjectFilter select_filter);
|
2009-01-17 03:31:56 +00:00
|
|
|
|
2014-03-11 15:34:19 +11:00
|
|
|
/* view3d_select.c */
|
|
|
|
|
float ED_view3d_select_dist_px(void);
|
2018-03-08 17:30:24 +11:00
|
|
|
void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc);
|
2018-04-16 16:27:55 +02:00
|
|
|
void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object *obact);
|
2009-01-17 03:31:56 +00:00
|
|
|
void view3d_operator_needs_opengl(const struct bContext *C);
|
2011-01-18 01:04:14 +00:00
|
|
|
void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar);
|
2013-03-15 19:56:33 +00:00
|
|
|
void view3d_opengl_read_pixels(struct ARegion *ar, int x, int y, int w, int h, int format, int type, void *data);
|
2009-01-15 15:01:39 +00:00
|
|
|
|
2011-03-02 05:05:12 +00:00
|
|
|
/* XXX should move to BLI_math */
|
2013-03-19 23:17:44 +00:00
|
|
|
bool edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2]);
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2009-06-26 15:48:09 +00:00
|
|
|
/* get 3d region from context, also if mouse is in header or toolbar */
|
|
|
|
|
struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
|
2013-03-20 23:14:18 +00:00
|
|
|
bool ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_ar);
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_operator_rv3d_user_region_poll(struct bContext *C);
|
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d);
|
2011-06-09 03:56:32 +00:00
|
|
|
void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d);
|
2013-05-08 13:00:52 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
|
void ED_view3d_clear_mats_rv3d(struct RegionView3D *rv3d);
|
|
|
|
|
void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d);
|
|
|
|
|
#else
|
|
|
|
|
# define ED_view3d_clear_mats_rv3d(rv3d) (void)(rv3d)
|
|
|
|
|
# define ED_view3d_check_mats_rv3d(rv3d) (void)(rv3d)
|
|
|
|
|
#endif
|
2018-07-01 16:22:06 +02:00
|
|
|
int ED_view3d_view_layer_set(int lay, const bool *values, int *active);
|
2009-10-26 12:42:25 +00:00
|
|
|
|
2017-03-04 13:32:40 +11:00
|
|
|
struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d);
|
|
|
|
|
void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat);
|
2015-10-27 11:27:26 -02:00
|
|
|
|
2018-05-22 07:31:11 +02:00
|
|
|
void ED_draw_object_facemap(
|
2018-10-15 15:08:37 +11:00
|
|
|
struct Depsgraph *depsgraph, struct Object *ob, const float col[4], const int facemap);
|
2017-06-10 10:42:35 +10:00
|
|
|
|
2018-04-17 13:35:05 +02:00
|
|
|
struct RenderEngineType *ED_view3d_engine_type(struct Scene *scene, int drawtype);
|
|
|
|
|
|
2013-03-20 23:14:18 +00:00
|
|
|
bool ED_view3d_context_activate(struct bContext *C);
|
2015-02-12 18:54:41 +01:00
|
|
|
void ED_view3d_draw_offscreen(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph *depsgraph, struct Scene *scene,
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
int drawtype,
|
2018-04-06 10:55:11 +02:00
|
|
|
struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4],
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
float winmat[4][4], bool do_sky, bool is_persp, const char *viewname,
|
2018-03-22 16:10:54 +01:00
|
|
|
struct GPUFXSettings *fx_settings,
|
2018-01-05 10:18:44 +01:00
|
|
|
struct GPUOffScreen *ofs, struct GPUViewport *viewport);
|
2017-05-10 13:13:55 +02:00
|
|
|
void ED_view3d_draw_setup_view(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct wmWindow *win, struct Depsgraph *depsgraph, struct Scene *scene, struct ARegion *ar, struct View3D *v3d,
|
2017-05-10 15:54:23 +02:00
|
|
|
float viewmat[4][4], float winmat[4][4], const struct rcti *rect);
|
2015-10-14 12:39:52 +11:00
|
|
|
|
2017-11-24 11:43:16 +01:00
|
|
|
enum {
|
|
|
|
|
V3D_OFSDRAW_NONE = (0),
|
|
|
|
|
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
V3D_OFSDRAW_USE_FULL_SAMPLE = (1 << 0),
|
2017-11-24 11:43:16 +01:00
|
|
|
|
|
|
|
|
/* Only works with ED_view3d_draw_offscreen_imbuf_simple(). */
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
V3D_OFSDRAW_USE_GPENCIL = (1 << 1),
|
2018-12-17 13:21:49 +11:00
|
|
|
V3D_OFSDRAW_USE_CAMERA_DOF = (1 << 2),
|
2017-11-24 11:43:16 +01:00
|
|
|
};
|
|
|
|
|
|
2015-10-14 12:39:52 +11:00
|
|
|
struct ImBuf *ED_view3d_draw_offscreen_imbuf(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph *depsgraph, struct Scene *scene,
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
int drawtype,
|
2018-04-06 10:55:11 +02:00
|
|
|
struct View3D *v3d, struct ARegion *ar,
|
2017-11-27 14:08:35 +01:00
|
|
|
int sizex, int sizey, unsigned int flag, unsigned int draw_flags,
|
2017-11-24 11:43:16 +01:00
|
|
|
int alpha_mode, int samples, const char *viewname,
|
2018-03-22 16:10:54 +01:00
|
|
|
struct GPUOffScreen *ofs, char err_out[256]);
|
2015-10-14 12:39:52 +11:00
|
|
|
struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph *depsgraph, struct Scene *scene,
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
int drawtype,
|
2018-04-06 10:55:11 +02:00
|
|
|
struct Object *camera, int width, int height,
|
2018-04-17 13:35:05 +02:00
|
|
|
unsigned int flag, unsigned int draw_flags, int alpha_mode,
|
2017-11-24 11:43:16 +01:00
|
|
|
int samples, const char *viewname,
|
2018-03-22 16:10:54 +01:00
|
|
|
struct GPUOffScreen *ofs, char err_out[256]);
|
2009-11-21 16:44:05 +00:00
|
|
|
|
2017-11-09 15:44:56 -02:00
|
|
|
struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
|
2018-10-09 14:36:15 +02:00
|
|
|
struct Object *ED_view3d_give_object_under_cursor(struct bContext *C, const int mval[2]);
|
2018-10-17 09:53:05 +02:00
|
|
|
bool ED_view3d_is_object_under_cursor(struct bContext *C, const int mval[2]);
|
2013-03-20 23:14:18 +00:00
|
|
|
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip);
|
2017-05-10 15:54:23 +02:00
|
|
|
void ED_view3d_update_viewmat(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph *depsgraph, struct Scene *scene, struct View3D *v3d, struct ARegion *ar,
|
2017-05-10 15:54:23 +02:00
|
|
|
float viewmat[4][4], float winmat[4][4], const struct rcti *rect);
|
2014-02-12 13:35:06 +11:00
|
|
|
bool ED_view3d_quat_from_axis_view(const char view, float quat[4]);
|
2014-03-20 15:19:02 +11:00
|
|
|
char ED_view3d_quat_to_axis_view(const float quat[4], const float epsilon);
|
2014-02-12 11:26:02 +11:00
|
|
|
char ED_view3d_lock_view_from_index(int index);
|
2015-03-13 04:45:40 +11:00
|
|
|
char ED_view3d_axis_view_opposite(char view);
|
2013-03-09 03:46:30 +00:00
|
|
|
bool ED_view3d_lock(struct RegionView3D *rv3d);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:13:40 +01:00
|
|
|
void ED_view3d_datamask(
|
|
|
|
|
const struct bContext *C, const struct Scene *scene, const struct View3D *v3d,
|
|
|
|
|
struct CustomData_MeshMasks *r_cddata_masks);
|
|
|
|
|
void ED_view3d_screen_datamask(
|
|
|
|
|
const struct bContext *C, const struct Scene *scene, const struct bScreen *screen,
|
|
|
|
|
struct CustomData_MeshMasks *r_cddata_masks);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
2015-03-21 22:34:20 +11:00
|
|
|
bool ED_view3d_offset_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d);
|
2018-05-22 07:31:11 +02:00
|
|
|
void ED_view3d_persp_switch_from_camera(
|
|
|
|
|
const struct Depsgraph *depsgraph,
|
2018-05-21 20:29:00 +02:00
|
|
|
struct View3D *v3d, struct RegionView3D *rv3d, const char persp);
|
2018-05-22 07:31:11 +02:00
|
|
|
bool ED_view3d_persp_ensure(
|
|
|
|
|
const struct Depsgraph *depsgraph,
|
2018-05-21 20:29:00 +02:00
|
|
|
struct View3D *v3d, struct ARegion *ar);
|
2018-01-28 14:44:42 +11:00
|
|
|
|
2013-05-03 07:29:25 +00:00
|
|
|
|
2011-05-15 02:39:36 +00:00
|
|
|
/* camera lock functions */
|
2015-03-21 22:34:20 +11:00
|
|
|
bool ED_view3d_camera_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d);
|
2011-05-15 02:39:36 +00:00
|
|
|
/* copy the camera to the view before starting a view transformation */
|
2018-05-22 07:31:11 +02:00
|
|
|
void ED_view3d_camera_lock_init_ex(
|
|
|
|
|
const struct Depsgraph *depsgraph,
|
2018-05-21 20:29:00 +02:00
|
|
|
struct View3D *v3d, struct RegionView3D *rv3d, const bool calc_dist);
|
|
|
|
|
void ED_view3d_camera_lock_init(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d);
|
2014-04-01 11:34:00 +11:00
|
|
|
/* copy the view to the camera, return true if */
|
2018-05-22 07:31:11 +02:00
|
|
|
bool ED_view3d_camera_lock_sync(
|
|
|
|
|
const struct Depsgraph *depsgraph,
|
2018-05-21 20:29:00 +02:00
|
|
|
struct View3D *v3d, struct RegionView3D *rv3d);
|
2011-05-14 17:50:33 +00:00
|
|
|
|
2014-06-30 13:37:37 +10:00
|
|
|
bool ED_view3d_camera_autokey(
|
|
|
|
|
struct Scene *scene, struct ID *id_key,
|
|
|
|
|
struct bContext *C, const bool do_rotate, const bool do_translate);
|
|
|
|
|
bool ED_view3d_camera_lock_autokey(
|
|
|
|
|
struct View3D *v3d, struct RegionView3D *rv3d,
|
|
|
|
|
struct bContext *C, const bool do_rotate, const bool do_translate);
|
|
|
|
|
|
2018-01-23 20:22:26 +11:00
|
|
|
void ED_view3d_lock_clear(struct View3D *v3d);
|
2012-05-05 16:38:23 +00:00
|
|
|
|
2012-11-30 06:55:36 +00:00
|
|
|
#define VIEW3D_MARGIN 1.4f
|
2012-12-11 15:56:11 +00:00
|
|
|
#define VIEW3D_DIST_FALLBACK 1.0f
|
2014-08-25 14:11:50 +10:00
|
|
|
|
2012-12-11 15:56:11 +00:00
|
|
|
float ED_view3d_offset_distance(float mat[4][4], const float ofs[3], const float dist_fallback);
|
2014-02-20 10:00:16 +11:00
|
|
|
void ED_view3d_distance_set(struct RegionView3D *rv3d, const float dist);
|
2012-12-09 10:48:18 +00:00
|
|
|
|
|
|
|
|
float ED_scene_grid_scale(struct Scene *scene, const char **grid_unit);
|
2012-05-31 16:04:03 +00:00
|
|
|
float ED_view3d_grid_scale(struct Scene *scene, struct View3D *v3d, const char **grid_unit);
|
2018-10-30 14:21:50 -03:00
|
|
|
float ED_view3d_grid_view_scale(
|
|
|
|
|
struct Scene *scene, struct View3D *v3d, struct RegionView3D *rv3d, const char **grid_unit);
|
2012-05-31 16:04:03 +00:00
|
|
|
|
2018-10-25 11:47:37 +02:00
|
|
|
void ED_scene_draw_fps(struct Scene *scene, int xoffset, int *yoffset);
|
2013-10-17 21:17:33 +00:00
|
|
|
|
2012-01-31 18:33:31 +00:00
|
|
|
/* view matrix properties utilities */
|
2012-04-23 06:37:16 +00:00
|
|
|
/* unused */
|
|
|
|
|
#if 0
|
2012-01-31 18:33:31 +00:00
|
|
|
void ED_view3d_operator_properties_viewmat(struct wmOperatorType *ot);
|
|
|
|
|
void ED_view3d_operator_properties_viewmat_set(struct bContext *C, struct wmOperator *op);
|
|
|
|
|
void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op, int *winx, int *winy, float persmat[4][4]);
|
2012-04-23 06:37:16 +00:00
|
|
|
#endif
|
2012-01-31 18:33:31 +00:00
|
|
|
|
2013-10-04 12:30:00 +00:00
|
|
|
/* render */
|
2015-03-17 12:02:10 +05:00
|
|
|
void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *ar);
|
2018-01-30 14:14:26 +01:00
|
|
|
void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa);
|
2013-10-04 12:30:00 +00:00
|
|
|
|
2018-11-23 13:46:40 +11:00
|
|
|
#define V3D_XRAY_FLAG(v3d) (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_BONE : V3D_SHADING_XRAY)
|
2018-09-26 20:31:14 +02:00
|
|
|
#define V3D_IS_ZBUF(v3d) (((v3d)->shading.flag & V3D_XRAY_FLAG(v3d)) == 0)
|
2015-04-20 23:39:54 +10:00
|
|
|
|
2018-01-19 23:11:57 +11:00
|
|
|
/* view3d_draw_legacy.c */
|
|
|
|
|
/* Try avoid using these more move out of legacy. */
|
|
|
|
|
void ED_view3d_draw_bgpic_test(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Scene *scene, struct Depsgraph *depsgraph,
|
2018-01-19 23:11:57 +11:00
|
|
|
struct ARegion *ar, struct View3D *v3d,
|
|
|
|
|
const bool do_foreground, const bool do_camera_frame);
|
|
|
|
|
|
2019-03-05 14:40:33 +11:00
|
|
|
/* view3d_gizmo_preselect_type.c */
|
|
|
|
|
void ED_view3d_gizmo_mesh_preselect_get_active(
|
|
|
|
|
struct bContext *C, struct wmGizmo *gz,
|
|
|
|
|
struct Base **r_base, struct BMElem **r_ele);
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#endif /* __ED_VIEW3D_H__ */
|