Revision: 51239
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51239
Author:   campbellbarton
Date:     2012-10-10 03:13:02 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
code cleanup: split `foreach` object data iterator functions out of 
drawobject.c (since they are used for selection too), into their own file: 
object_iterators.c

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_object.h
    trunk/blender/source/blender/editors/include/ED_view3d.h
    trunk/blender/source/blender/editors/mesh/editmesh_select.c
    trunk/blender/source/blender/editors/object/CMakeLists.txt
    trunk/blender/source/blender/editors/space_view3d/drawobject.c

Added Paths:
-----------
    trunk/blender/source/blender/editors/object/object_iterators.c

Modified: trunk/blender/source/blender/editors/include/ED_object.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_object.h    2012-10-10 
01:54:02 UTC (rev 51238)
+++ trunk/blender/source/blender/editors/include/ED_object.h    2012-10-10 
03:13:02 UTC (rev 51239)
@@ -35,22 +35,31 @@
 extern "C" {
 #endif
 
+struct BMEdge;
+struct BMFace;
+struct BMVert;
+struct BPoint;
 struct Base;
-struct bConstraint;
-struct bContext;
-struct bPoseChannel;
+struct BezTriple;
 struct Curve;
+struct EditBone;
 struct EnumPropertyItem;
 struct ID;
 struct KeyBlock;
 struct Lattice;
 struct Main;
 struct Mesh;
+struct MetaElem;
 struct ModifierData;
+struct Nurb;
 struct Object;
 struct ReportList;
 struct Scene;
 struct View3D;
+struct ViewContext;
+struct bConstraint;
+struct bContext;
+struct bPoseChannel;
 struct wmEvent;
 struct wmKeyConfig;
 struct wmKeyMap;
@@ -82,8 +91,10 @@
        PAR_TRIA
 } eParentType;
 
+#ifdef __RNA_TYPES_H__
 extern struct EnumPropertyItem prop_clear_parent_types[];
 extern struct EnumPropertyItem prop_make_parent_types[];
+#endif
 
 int ED_object_parent_set(struct ReportList *reports, struct Main *bmain, 
struct Scene *scene, struct Object *ob,
                          struct Object *par, int partype, int xmirror, int 
keep_transform);
@@ -183,9 +194,58 @@
 
 int ED_object_multires_update_totlevels_cb(struct Object *ob, void 
*totlevel_v);
 
-/* ibject_select.c */
+/* object_select.c */
 void ED_object_select_linked_by_id(struct bContext *C, struct ID *id);
 
+
+/* object_iterators.c */
+
+/* enum for passing to foreach functions to test RV3D_CLIPPING */
+typedef enum eV3DClipTest {
+       V3D_CLIP_TEST_OFF =            0, /* clipping is off */
+       V3D_CLIP_TEST_RV3D_CLIPPING =  1, /* clip single points */
+       V3D_CLIP_TEST_REGION =         2  /* use for edges to check if both 
verts are in the view, but not RV3D_CLIPPING */
+} eV3DClipTest;
+
+/* foreach iterators */
+void mesh_foreachScreenVert(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct BMVert *eve, const float 
screen_co[2], int index),
+        void *userData, eV3DClipTest clipVerts);
+void mesh_foreachScreenEdge(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct BMEdge *eed, const float 
screen_co_a[2], const float screen_co_b[2],
+                     int index),
+        void *userData, eV3DClipTest clipVerts);
+void mesh_foreachScreenFace(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct BMFace *efa, const float 
screen_co[2], int index),
+        void *userData);
+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);
+void mball_foreachScreenElem(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct MetaElem *ml, const float 
screen_co[2]),
+        void *userData);
+void lattice_foreachScreenVert(
+        struct ViewContext *vc,
+        void (*func)(void *userData, struct BPoint *bp,
+                     const float screen_co[2]),
+        void *userData);
+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);
+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);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_view3d.h    2012-10-10 
01:54:02 UTC (rev 51238)
+++ trunk/blender/source/blender/editors/include/ED_view3d.h    2012-10-10 
03:13:02 UTC (rev 51239)
@@ -80,13 +80,6 @@
        char damaged;
 } ViewDepths;
 
-/* enum for passing to foreach functions to test RV3D_CLIPPING */
-typedef enum eV3DClipTest {
-       V3D_CLIP_TEST_OFF =            0, /* clipping is off */
-       V3D_CLIP_TEST_RV3D_CLIPPING =  1, /* clip single points */
-       V3D_CLIP_TEST_REGION =         2  /* use for edges to check if both 
verts are in the view, but not RV3D_CLIPPING */
-} eV3DClipTest;
-
 float *give_cursor(struct Scene *scene, struct View3D *v3d);
 
 int initgrabz(struct RegionView3D *rv3d, float x, float y, float z);
@@ -166,17 +159,6 @@
 void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, 
struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short 
no_shift);
 void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion 
*ar, struct View3D *v3d, struct RegionView3D *rv3d, float size_r[2]);
 
-/* drawobject.c iterators */
-void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void 
*userData, struct BMVert *eve, const float screen_co[2], int index), void 
*userData, eV3DClipTest clipVerts);
-void mesh_foreachScreenEdge(struct ViewContext *vc, void (*func)(void 
*userData, struct BMEdge *eed, const float screen_co_a[2], const float 
screen_co_b[2], int index), void *userData, eV3DClipTest clipVerts);
-void mesh_foreachScreenFace(struct ViewContext *vc, void (*func)(void 
*userData, struct BMFace *efa, const float screen_co[2], int index), void 
*userData);
-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);
-void mball_foreachScreenElem(struct ViewContext *vc, void (*func)(void 
*userData, struct MetaElem *ml, const float screen_co[2]), void *userData);
-void lattice_foreachScreenVert(struct ViewContext *vc, void (*func)(void 
*userData, struct BPoint *bp, const float screen_co[2]), void *userData);
-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);
-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);
-
-
 void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], struct 
bglMats *mats, const struct rcti *rect);
 void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[][4]);
 int  ED_view3d_clipping_test(struct RegionView3D *rv3d, const float vec[3], 
const int is_local);

Modified: trunk/blender/source/blender/editors/mesh/editmesh_select.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_select.c 2012-10-10 
01:54:02 UTC (rev 51238)
+++ trunk/blender/source/blender/editors/mesh/editmesh_select.c 2012-10-10 
03:13:02 UTC (rev 51239)
@@ -57,6 +57,7 @@
 #include "ED_mesh.h"
 #include "ED_screen.h"
 #include "ED_uvedit.h"
+#include "ED_object.h"
 #include "ED_view3d.h"
 
 #include "BIF_gl.h"

Modified: trunk/blender/source/blender/editors/object/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/editors/object/CMakeLists.txt  2012-10-10 
01:54:02 UTC (rev 51238)
+++ trunk/blender/source/blender/editors/object/CMakeLists.txt  2012-10-10 
03:13:02 UTC (rev 51239)
@@ -46,6 +46,7 @@
        object_edit.c
        object_group.c
        object_hook.c
+       object_iterators.c
        object_lattice.c
        object_modifier.c
        object_ops.c

Added: trunk/blender/source/blender/editors/object/object_iterators.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_iterators.c              
                (rev 0)
+++ trunk/blender/source/blender/editors/object/object_iterators.c      
2012-10-10 03:13:02 UTC (rev 51239)
@@ -0,0 +1,429 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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
+ * of the License, or (at your option) any later version.
+ *
+ * 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,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Foundation, full recode and added functions
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/object/object_iterators.c
+ *  \ingroup edobj
+ */
+
+#include "DNA_curve_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_meta_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_object_types.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_blenlib.h"
+
+#include "BKE_armature.h"
+#include "BKE_curve.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_displist.h"
+
+#include "bmesh.h"
+
+#include "ED_mesh.h"
+#include "ED_screen.h"
+#include "ED_armature.h"
+#include "ED_object.h"
+#include "ED_view3d.h"
+
+
+typedef struct foreachScreenVert_userData {
+       void (*func)(void *userData, BMVert *eve, const float screen_co_b[2], 
int index);
+       void *userData;
+       ViewContext vc;
+       eV3DClipTest clipVerts;
+} foreachScreenVert_userData;
+
+/* user data structures for derived mesh callbacks */
+typedef struct foreachScreenEdge_userData {
+       void (*func)(void *userData, BMEdge *eed, const float screen_co_a[2], 
const float screen_co_b[2], int index);
+       void *userData;
+       ViewContext vc;
+       rctf win_rect; /* copy of: vc.ar->winx/winy, use for faster tests, 
minx/y will always be 0 */
+       eV3DClipTest clipVerts;
+} foreachScreenEdge_userData;
+
+typedef struct foreachScreenFace_userData {
+       void (*func)(void *userData, BMFace *efa, const float screen_co_b[2], 
int index);
+       void *userData;
+       ViewContext vc;
+} foreachScreenFace_userData;
+
+
+/* Note! - foreach funcs should be called while drawing or directly after
+ * if not, ED_view3d_init_mats_rv3d() can be used for selection tools

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to