diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-31 22:33:31 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-31 22:33:31 +0400 |
commit | db79c8b01e67e8707aa3810cb727997c9ea3c250 (patch) | |
tree | 9901a0588df91f92ed4a631a46d81cdcd89ec563 /source/blender/editors/include/ED_view3d.h | |
parent | 23db21e2c17052ba756a68eb7450fedacc14c555 (diff) |
Implemented general functions to store view context like viewport width/height
and projection matrix, so operators which depends on such things can easily save
settings in operator properties in invoke and then reuse them in exec callback.
This will fix: #24767: Knife tool last operations panel doesn't cause changes even though F6 pop-up does.
#27129: Problem with knife cuts/midpoint type in quad view
Usage is pretty simple:
- From operator template declaration function call ED_view3d_operator_properties_viewmat()
to register all needed properties in operator.
- From invoke callback call ED_view3d_operator_properties_viewmat_set to
store all needed settings in operator properties().
- To access this settings from exec callback, use function
ED_view3d_operator_properties_viewmat_get().
Additional change:
added function apply_project_float() which does the same as
project_float() but accepts actual values for viewport width/height and
projection matrix.
Diffstat (limited to 'source/blender/editors/include/ED_view3d.h')
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index f087cdc7442..7616e25cbe9 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -52,7 +52,8 @@ struct View3D; struct ViewContext; struct wmWindow; struct MVert; - +struct wmOperatorType; +struct wmOperator; /* for derivedmesh drawing callbacks, for view3d_select, .... */ typedef struct ViewContext { @@ -209,6 +210,7 @@ void project_short_noclip(struct ARegion *ar, const float vec[3], short adr[2]); void project_int(struct ARegion *ar, const float vec[3], int adr[2]); void project_int_noclip(struct ARegion *ar, const float vec[3], int adr[2]); +void apply_project_float(float persmat[4][4], int winx, int winy, const float vec[], float adr[2]); void project_float(struct ARegion *ar, const float vec[3], float adr[2]); void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]); @@ -301,4 +303,9 @@ struct BGpic *ED_view3D_background_image_new(struct View3D *v3d); void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic); void ED_view3D_background_image_clear(struct View3D *v3d); +/* view matrix properties utilities */ +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]); + #endif /* ED_VIEW3D_H */ |