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>2007-04-14 17:18:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-04-14 17:18:24 +0400
commit0a0cf54a27dded2ec23a3ff7b1af9ff3426bfbcf (patch)
treeaf93660b6f2135b63015f1845920c0657e1cea7b /source/blender
parent0a411c47049378906d1a4c3df4d6b6cb9f87ca9e (diff)
update to center view.
- Dont do anything if no verts or faces are selected (used to zoom into 0,0,0) - use the centers of dupli objects (should eventually use their bound boxes), much nicer when dealing with many dupli-objects
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_object.h1
-rw-r--r--source/blender/blenkernel/intern/object.c22
-rw-r--r--source/blender/include/BDR_editface.h2
-rw-r--r--source/blender/include/BSE_edit.h2
-rw-r--r--source/blender/src/edit.c5
-rw-r--r--source/blender/src/editface.c10
-rw-r--r--source/blender/src/view.c9
7 files changed, 39 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index f20f8c01502..52d529ea32d 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -102,6 +102,7 @@ void boundbox_set_from_min_max(struct BoundBox *bb, float min[3], float max[3]);
struct BoundBox *object_get_boundbox(struct Object *ob);
void object_boundbox_flag(struct Object *ob, int flag, int set);
void minmax_object(struct Object *ob, float *min, float *max);
+void minmax_object_duplis(struct Object *ob, float *min, float *max);
void solve_tracking (struct Object *ob, float targetmat[][4]);
void solve_constraints (struct Object *ob, short obtype, void *obdata, float ctime);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index b360dbac189..e93be045dac 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1980,6 +1980,28 @@ void minmax_object(Object *ob, float *min, float *max)
}
}
+/* TODO - use dupli objects bounding boxes */
+void minmax_object_duplis(Object *ob, float *min, float *max)
+{
+ if ((ob->transflag & OB_DUPLI)==0) {
+ return;
+ } else {
+ ListBase *lb;
+ DupliObject *dob;
+
+ lb= object_duplilist(G.scene, ob);
+ for(dob= lb->first; dob; dob= dob->next) {
+ if(dob->no_draw);
+ else {
+ /* should really use bound box of dup object */
+ DO_MINMAX(dob->mat[3], min, max);
+ }
+ }
+ free_object_duplilist(lb); /* does restore */
+ }
+}
+
+
/* proxy rule: lib_object->proxy_from == the one we borrow from, only set temporal and cleared here */
/* local_object->proxy == pointer to library object, saved in files and read */
diff --git a/source/blender/include/BDR_editface.h b/source/blender/include/BDR_editface.h
index 84c1e09d058..aa5276abe67 100644
--- a/source/blender/include/BDR_editface.h
+++ b/source/blender/include/BDR_editface.h
@@ -48,7 +48,7 @@ void deselectall_tface(void);
void selectswap_tface(void);
void rotate_uv_tface(void);
void mirror_uv_tface(void);
-void minmax_tface(float *min, float *max);
+int minmax_tface(float *min, float *max);
void face_select(void);
void face_borderselect(void);
void uv_autocalc_tface(void);
diff --git a/source/blender/include/BSE_edit.h b/source/blender/include/BSE_edit.h
index cceee274d7a..048d4d012b2 100644
--- a/source/blender/include/BSE_edit.h
+++ b/source/blender/include/BSE_edit.h
@@ -43,7 +43,7 @@ void mergemenu(void);
void delete_context_selected(void);
void duplicate_context_selected(void);
void toggle_shading(void);
-void minmax_verts(float *min, float *max);
+int minmax_verts(float *min, float *max);
void snap_sel_to_grid(void);
void snap_sel_to_curs(void);
diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c
index a0057371a33..5a088ec6bef 100644
--- a/source/blender/src/edit.c
+++ b/source/blender/src/edit.c
@@ -1836,7 +1836,7 @@ void toggle_shading(void)
}
}
-void minmax_verts(float *min, float *max)
+int minmax_verts(float *min, float *max)
{
TransVert *tv;
float centroid[3], vec[3], bmat[3][3];
@@ -1845,7 +1845,7 @@ void minmax_verts(float *min, float *max)
tottrans=0;
if ELEM5(G.obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE)
make_trans_verts(bmat[0], bmat[1], 0);
- if(tottrans==0) return;
+ if(tottrans==0) return 0;
Mat3CpyMat4(bmat, G.obedit->obmat);
@@ -1860,5 +1860,6 @@ void minmax_verts(float *min, float *max)
MEM_freeN(transvmain);
transvmain= 0;
+ return 1;
}
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c
index db4d50dccbb..1617f6f68ca 100644
--- a/source/blender/src/editface.c
+++ b/source/blender/src/editface.c
@@ -911,20 +911,20 @@ void mirror_uv_tface()
object_uvs_changed(OBACT);
}
-void minmax_tface(float *min, float *max)
+int minmax_tface(float *min, float *max)
{
Object *ob;
Mesh *me;
MFace *mf;
MTFace *tf;
MVert *mv;
- int a;
+ int a, ok=0;
float vec[3], bmat[3][3];
ob = OBACT;
- if (ob==0) return;
+ if (ob==0) return ok;
me= get_mesh(ob);
- if(me==0 || me->mtface==0) return;
+ if(me==0 || me->mtface==0) return ok;
Mat3CpyMat4(bmat, ob->obmat);
@@ -956,7 +956,9 @@ void minmax_tface(float *min, float *max)
VecAddf(vec, vec, ob->obmat[3]);
DO_MINMAX(vec, min, max);
}
+ ok= 1;
}
+ return ok;
}
#define ME_SEAM_DONE ME_SEAM_LAST /* reuse this flag */
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index a197b1a0a23..56166037e7f 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -1305,8 +1305,7 @@ void centerview() /* like a localview without local! */
if(G.obedit) {
- minmax_verts(min, max); // ony selected
- ok= 1;
+ ok = minmax_verts(min, max); /* only selected */
}
else if(ob && (ob->flag & OB_POSEMODE)) {
if(ob->pose) {
@@ -1330,14 +1329,16 @@ void centerview() /* like a localview without local! */
}
}
else if (G.f & G_FACESELECT) {
- minmax_tface(min, max);
- ok= 1;
+ ok= minmax_tface(min, max);
}
else {
Base *base= FIRSTBASE;
while(base) {
if TESTBASE(base) {
minmax_object(base->object, min, max);
+ /* account for duplis */
+ minmax_object_duplis(base->object, min, max);
+
ok= 1;
}
base= base->next;