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:
authorCampbell Barton <ideasman42@gmail.com>2011-04-25 07:02:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-04-25 07:02:26 +0400
commitbdbf0abe600b6e2608d93b6c27ec7ff9d474b743 (patch)
treed95d8accd8e252dc964a2937203b43ffd55343d0 /source/blender/editors
parent262eec84cd8911dcdae2fe9415a94f68a039282b (diff)
rna api
- allow RegionView3D.view_matrix to be set. - RegionView3D.view_rotation was inverted. - add C function view3d_settings_from_mat() note, intentionally removed NULL checks, double checked this is ok with callers.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/ED_view3d.h6
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h4
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c29
3 files changed, 21 insertions, 18 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index a3e99e6358e..6729295e07d 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -183,5 +183,11 @@ int ED_view3d_lock(struct RegionView3D *rv3d);
unsigned int ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
unsigned int ED_viewedit_datamask(struct bScreen *screen);
+
+/* assigning view matrix */
+void view3d_settings_from_mat(float mat[][4], float *ofs, float *quat, float *dist);
+void view3d_settings_from_ob(struct Object *ob, float *ofs, float *quat, float *dist, float *lens);
+int view3d_is_ortho(struct View3D *v3d, struct RegionView3D *rv3d);
+
#endif /* ED_VIEW3D_H */
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 12ad01e3977..a3b9188ab81 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -147,10 +147,6 @@ void VIEW3D_OT_select_circle(struct wmOperatorType *ot);
void VIEW3D_OT_select_border(struct wmOperatorType *ot);
void VIEW3D_OT_select_lasso(struct wmOperatorType *ot);
-/* view3d_view.c */
-void view3d_settings_from_ob(struct Object *ob, float *ofs, float *quat, float *dist, float *lens);
-int view3d_is_ortho(View3D *v3d, RegionView3D *rv3d);
-
void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
void VIEW3D_OT_setcameratoview(struct wmOperatorType *ot);
void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 6dae0938f54..46e1dd2d7cc 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -106,9 +106,7 @@ float *give_cursor(Scene *scene, View3D *v3d)
/* Gets the lens and clipping values from a camera of lamp type object */
static void object_lens_clip_settings(Object *ob, float *lens, float *clipsta, float *clipend)
-{
- if (!ob) return;
-
+{
if(ob->type==OB_LAMP ) {
Lamp *la = ob->data;
if (lens) {
@@ -137,39 +135,42 @@ static void object_lens_clip_settings(Object *ob, float *lens, float *clipsta, f
*
* The dist is not modified for this function, if NULL its assimed zero
* */
-void view3d_settings_from_ob(Object *ob, float *ofs, float *quat, float *dist, float *lens)
+void view3d_settings_from_mat(float mat[][4], float *ofs, float *quat, float *dist)
{
- if (!ob) return;
-
/* Offset */
if (ofs)
- negate_v3_v3(ofs, ob->obmat[3]);
+ negate_v3_v3(ofs, mat[3]);
/* Quat */
if (quat) {
float imat[4][4];
- invert_m4_m4(imat, ob->obmat);
+ invert_m4_m4(imat, mat);
mat4_to_quat(quat, imat);
}
if (dist) {
- float tquat[4];
+ float nmat[3][3];
float vec[3];
vec[0]= 0.0f;
vec[1]= 0.0f;
vec[2]= -(*dist);
- mat4_to_quat(tquat, ob->obmat);
-
- mul_qt_v3(tquat, vec);
+ copy_m3_m4(nmat, mat);
+ normalize_m3(nmat);
+ mul_m3_v3(nmat, vec);;
sub_v3_v3(ofs, vec);
}
+}
- /* Lens */
- if (lens)
+void view3d_settings_from_ob(Object *ob, float *ofs, float *quat, float *dist, float *lens)
+{
+ view3d_settings_from_mat(ob->obmat, ofs, quat, dist);
+
+ if (lens) {
object_lens_clip_settings(ob, lens, NULL, NULL);
+ }
}