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:
-rw-r--r--intern/itasc/kdl/framevel.hpp12
-rw-r--r--source/blender/blenkernel/BKE_context.h2
-rw-r--r--source/blender/blenkernel/BKE_tessmesh.h7
-rw-r--r--source/blender/blenkernel/BKE_utildefines.h7
-rw-r--r--source/blender/blenkernel/BKE_verse.h586
-rw-r--r--source/blender/blenkernel/SConscript5
-rw-r--r--source/blender/blenkernel/intern/BME_Customdata.c1
-rw-r--r--source/blender/blenkernel/intern/BME_conversions.c1
-rw-r--r--source/blender/blenkernel/intern/BME_eulers.c1
-rw-r--r--source/blender/blenkernel/intern/BME_mesh.c1
-rw-r--r--source/blender/blenkernel/intern/BME_structure.c1
-rw-r--r--source/blender/blenkernel/intern/BME_tools.c1
-rw-r--r--source/blender/blenkernel/intern/booleanops.c603
-rw-r--r--source/blender/blenkernel/intern/cloth.c2
-rw-r--r--source/blender/blenkernel/intern/collision.c1
-rw-r--r--source/blender/blenkernel/intern/context.c2
-rw-r--r--source/blender/blenkernel/intern/customdata.c16
-rw-r--r--source/blender/blenkernel/intern/editderivedbmesh.c9
-rw-r--r--source/blender/blenkernel/intern/mesh.c3
-rw-r--r--source/blender/blenkernel/intern/modifiers_bmesh.c2
-rw-r--r--source/blender/blenkernel/intern/particle_system.c2
-rw-r--r--source/blender/blenkernel/intern/smoke.c2
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c3
-rw-r--r--source/blender/blenkernel/intern/verse_bitmap_node.c451
-rw-r--r--source/blender/blenkernel/intern/verse_geometry_node.c2101
-rw-r--r--source/blender/blenkernel/intern/verse_method.c523
-rw-r--r--source/blender/blenkernel/intern/verse_node.c750
-rw-r--r--source/blender/blenkernel/intern/verse_object_node.c620
-rw-r--r--source/blender/blenkernel/intern/verse_session.c480
-rw-r--r--source/blender/blenlib/BLI_arithb.h569
-rw-r--r--source/blender/blenlib/BLI_ghash.h36
-rw-r--r--source/blender/blenlib/CMakeLists.txt4
-rw-r--r--source/blender/blenlib/intern/BLI_cellalloc.c2
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c2
-rw-r--r--source/blender/blenlib/intern/edgehash.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.c3
-rw-r--r--source/blender/bmesh/intern/bmesh_newcore.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c3
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_impl.c2
-rw-r--r--source/blender/bmesh/operators/bevel.c3
-rw-r--r--source/blender/bmesh/operators/bmesh_dupeops.c2
-rw-r--r--source/blender/bmesh/operators/createops.c2
-rw-r--r--source/blender/bmesh/operators/extrudeops.c2
-rw-r--r--source/blender/bmesh/operators/mesh_conv.c2
-rw-r--r--source/blender/bmesh/operators/primitiveops.c2
-rw-r--r--source/blender/bmesh/operators/removedoubles.c2
-rw-r--r--source/blender/editors/armature/meshlaplacian.c2
-rw-r--r--source/blender/editors/mesh/bmesh_select.c2
-rw-r--r--source/blender/editors/mesh/bmesh_tools.c2
-rw-r--r--source/blender/editors/mesh/bmeshutils.c2
-rw-r--r--source/blender/editors/mesh/editbmesh_add.c2
-rw-r--r--source/blender/editors/mesh/editbmesh_bvh.c2
-rw-r--r--source/blender/editors/mesh/editface.c1
-rwxr-xr-xsource/blender/editors/mesh/knifetool.c1
-rw-r--r--source/blender/editors/mesh/mesh_data.c1
-rw-r--r--source/blender/editors/space_image/image_header.c92
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c1
-rw-r--r--source/blender/editors/space_view3d/drawobject.c1
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c1
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c1
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c13
-rw-r--r--source/blender/modifiers/intern/MOD_array.c2
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c2
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c2
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c2
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c2
-rw-r--r--source/creator/creator.c4
69 files changed, 109 insertions, 6868 deletions
diff --git a/intern/itasc/kdl/framevel.hpp b/intern/itasc/kdl/framevel.hpp
index 21a7844f522..b70182bccde 100644
--- a/intern/itasc/kdl/framevel.hpp
+++ b/intern/itasc/kdl/framevel.hpp
@@ -133,8 +133,8 @@ public:
Vector w; // rotation vector
public:
RotationVel():R(),w() {}
- explicit RotationVel(const Rotation& _R):R(_R),w(Vector::Zero()){}
- RotationVel(const Rotation& _R,const Vector& _w):R(_R),w(_w){}
+ explicit RotationVel(const Rotation& R_):R(R_),w(Vector::Zero()){}
+ RotationVel(const Rotation& R_,const Vector& _w):R(R_),w(_w){}
Rotation value() const { return R;}
@@ -194,11 +194,11 @@ public:
public:
FrameVel(){}
- explicit FrameVel(const Frame& _T):
- M(_T.M),p(_T.p) {}
+ explicit FrameVel(const Frame& T_):
+ M(T_.M),p(T_.p) {}
- FrameVel(const Frame& _T,const Twist& _t):
- M(_T.M,_t.rot),p(_T.p,_t.vel) {}
+ FrameVel(const Frame& T_,const Twist& _t):
+ M(T_.M,_t.rot),p(T_.p,_t.vel) {}
FrameVel(const RotationVel& _M,const VectorVel& _p):
M(_M),p(_p) {}
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 36c442741ec..c18bdbac107 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -278,7 +278,7 @@ int CTX_data_visible_pose_bones(const bContext *C, ListBase *list);
int CTX_rec_events(bContext *C);
FILE *CTX_rec_file(bContext *C);
-int CTX_set_events_path(bContext *C, char *path);
+int CTX_set_events_path(bContext *C, const char *path);
int CTX_play_events(bContext *C, char **playpath);
int CTX_rec_events_set(bContext *C, int state);
double CTX_rec_lasttime(bContext *C, double newtime);
diff --git a/source/blender/blenkernel/BKE_tessmesh.h b/source/blender/blenkernel/BKE_tessmesh.h
index f2827747555..601d95de268 100644
--- a/source/blender/blenkernel/BKE_tessmesh.h
+++ b/source/blender/blenkernel/BKE_tessmesh.h
@@ -50,9 +50,8 @@ typedef struct BMEditMesh {
struct BMFace **face_index;
/*selection mode*/
- int selectmode;
-
- int mat_nr;
+ short selectmode;
+ short mat_nr;
/*Mesh structure this editmesh came from, if it came from one*/
struct Mesh *me;
@@ -69,4 +68,4 @@ BMEditMesh *BMEdit_Copy(BMEditMesh *tm);
void BMEdit_Free(BMEditMesh *em);
void BMEdit_UpdateLinkedCustomData(BMEditMesh *em);
-#endif /* _BKE_TESSMESH_H */ \ No newline at end of file
+#endif /* _BKE_TESSMESH_H */
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
index 0e2817365f8..4ace73dbeb1 100644
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ b/source/blender/blenkernel/BKE_utildefines.h
@@ -87,16 +87,9 @@ extern "C" {
#define BROW(min, max) (((max)>=31? 0xFFFFFFFF: (1<<(max+1))-1) - ((min)? ((1<<(min))-1):0) )
#define BMEMSET(mem, val, size) {unsigned int _i; char *_c = (char*) mem; for (_i=0; _i<size; _i++) *_c++ = val;}
-/*little macro so inline keyword works*/
-#if defined(_MSC_VER)
-#define BM_INLINE static __forceinline
-#else
-#define BM_INLINE static inline __attribute((always_inline))
-#endif
#ifdef __cplusplus
}
#endif
#endif // BKE_UTILDEFINES_H
-
diff --git a/source/blender/blenkernel/BKE_verse.h b/source/blender/blenkernel/BKE_verse.h
deleted file mode 100644
index ee22081b03f..00000000000
--- a/source/blender/blenkernel/BKE_verse.h
+++ /dev/null
@@ -1,586 +0,0 @@
-/**
- * $Id: BKE_verse.h 12931 2007-12-17 18:20:48Z theeth $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/* #define WITH_VERSE */
-
-#ifndef BKE_VERSE_H
-#define BKE_VERSE_H
-
-#include "DNA_listBase.h"
-#include "BLI_dynamiclist.h"
-
-#include "verse.h"
-#include "verse_ms.h"
-
-struct VNode;
-struct VerseEdge;
-
-/*
- * Verse Edge Hash (similar to edit edge hash)
- */
-#define VEDHASHSIZE (512*512)
-#define VEDHASH(a, b) ((a<b ? a : b) % VEDHASHSIZE)
-
-/*
- * verse data: 4 float value
- */
-typedef struct quat_real32_item {
- struct quat_real32_item *next, *prev;
- struct VLayer *vlayer; /* pointer at VerseLayer */
- uint32 id; /* id of item */
- real32 value[4];
-} quat_real32_item;
-
-/*
- * verse data: 4 uint32 values
- */
-typedef struct quat_uint32_item {
- struct quat_uint32_item *next, *prev;
- struct VLayer *vlayer; /* pointer at VerseLayer */
- uint32 id; /* id of item */
- uint32 value[4];
-} quat_uint32_item;
-
-/*
- * verse data: 3 float values
- */
-typedef struct vec_real32_item {
- struct vec_real32_item *next, *prev;
- struct VLayer *vlayer; /* pointer at VerseLayer */
- uint32 id; /* id of item */
- real32 value[3];
-} vec_real32_item;
-
-/*
- * verse data: float value (weight)
- */
-typedef struct real32_item {
- struct real32_item *next, *prev;
- struct VLayer *vlayer; /* pointer at VerseLayer */
- uint32 id; /* id of item */
- real32 value;
-} real32_item;
-
-/*
- * verse data: uint32 value
- */
-typedef struct uint32_item {
- struct uint32_item *next, *prev;
- struct VLayer *vlayer; /* pointer at VerseLayer */
- uint32 id; /* id of item */
- uint32 value;
-} uint32_item;
-
-/*
- * verse data: uint8 value
- */
-typedef struct uint8_item {
- struct uint8_item *next, *prev;
- struct VLayer *vlayer; /* pointer at VerseLayer */
- uint32 id; /* id of item */
- uint8 value;
-} uint8_item;
-
-/*
- * verse data: vertex
- */
-typedef struct VerseVert {
- struct VerseVert *next, *prev;
- /* verse data */
- struct VLayer *vlayer; /* pointer at VerseLayer */
- uint32 id; /* id of vertex */
- real32 co[3]; /* x,y,z-coordinates of vertex */
- real32 no[3]; /* normal of vertex */
- /* blender internals */
- short flag; /* flags: VERT_DELETED, VERT_RECEIVED, etc. */
- void *vertex; /* pointer at EditVert or MVert */
- int counter; /* counter of VerseFaces using this VerseVert */
- union {
- unsigned int index; /* counter need during transformation to mesh */
- struct VerseVert *vvert;
- } tmp; /* pointer at new created verse vert, it is
- * used during duplicating geometry node */
- float *cos; /* modified coordinates of vertex */
- float *nos; /* modified normal vector */
-} VerseVert;
-
-/*
- * structture used for verse edge hash
- */
-typedef struct HashVerseEdge {
- struct VerseEdge *vedge;
- struct HashVerseEdge *next;
-} HashVerseEdge;
-
-/*
- * fake verse data: edge
- */
-typedef struct VerseEdge {
- struct VerseEdge *next, *prev;
- uint32 v0, v1; /* indexes of verse vertexes */
- int counter; /* counter of verse faces using this edge */
- struct HashVerseEdge hash; /* hash table */
- union {
- unsigned int index; /* temporary index of edge */
- } tmp;
-} VerseEdge;
-
-/*
- * verse data: polygon
- */
-typedef struct VerseFace {
- struct VerseFace *next, *prev;
- /* verse data */
- struct VLayer *vlayer; /* pointer at VerseLayer */
- uint32 id; /* id of face */
- struct VerseVert *vvert0; /* pointer at 1st VerseVert */
- struct VerseVert *vvert1; /* pointer at 2nd VerseVert */
- struct VerseVert *vvert2; /* pointer at 3th VerseVert */
- struct VerseVert *vvert3; /* pointer at 4th VerseVert */
- unsigned int v0, v1, v2, v3; /* indexes of VerseVerts ... needed during receiving */
- /* blender internals */
- char flag; /* flags: FACE_SEND_READY, FACE_SENT, FACE_RECEIVED, FACE_CHANGED*/
- short counter; /* counter of missed VerseVertexes */
- void *face; /* pointer at EditFace */
- float no[3]; /* normal vector */
- float *nos; /* modified normal vector */
-} VerseFace;
-
-/*
- * verse data: layer
- */
-typedef struct VLayer {
- struct VLayer *next, *prev;
- /* verse data*/
- struct VNode *vnode; /* pointer at VerseNode */
- uint16 id; /* id of layer */
- char *name; /* name of layer */
- VNGLayerType type; /* type of layer (VN_G_LAYER_VERTEX_XYZ, VN_G_LAYER_POLYGON_CORNER_UINT32) */
- uint32 def_int; /* default integer value */
- real64 def_real; /* default float value */
- /* blender internals */
- char flag; /* flags: LAYER_SENT, LAYER_RECEIVED, LAYER_DELETED, LAYER_OBSOLETE */
- short content; /* type of content (VERTEX_LAYER, POLYGON_LAYER) */
- struct DynamicList dl; /* vertexes, polygons, etc. */
- struct ListBase queue; /* queue of vertexes, polygons, etc. waiting for sending to verse server */
- struct ListBase orphans; /* list of versedata (polygons, etc.), that can be added to the DynamicList
- * due to not received VerseVerts */
- unsigned int counter; /* counter of sent items */
- /* client dependent methods */
- void (*post_layer_create)(struct VLayer *vlayer);
- void (*post_layer_destroy)(struct VLayer *vlayer);
-} VLayer;
-
-/*
- * verse data: link
- */
-typedef struct VLink{
- struct VLink *next, *prev;
- /* verse data */
- struct VerseSession *session; /* session pointer */
- struct VNode *source; /* object VerseNode "pointing" at some other VerseNode */
- struct VNode *target; /* VerseNode linked with some object node */
- unsigned int id; /* id of VerseLink */
- unsigned int target_id; /* some unknow id */
- char *label; /* name/label of VerseLink */
- /* blender internals */
- char flag; /* flags: LINK_SEND_READY */
- /* client dependent methods */
- void (*post_link_set)(struct VLink *vlink);
- void (*post_link_destroy)(struct VLink *vlink);
-} VLink;
-
-/*
- * bitmap layer
- */
-typedef struct VBitmapLayer {
- struct VBitmapLayer *next, *prev;
- /* verse data */
- struct VNode *vnode; /* pointer at Verse Node */
- VLayerID id; /* id of layer */
- char *name; /* name of layer */
- VNBLayerType type; /* type of layer (bits per channel) 1, 8, 16, 32, 64 */
- void *data; /* dynamic allocated data */
- /* blender internals */
- char flag;
-} VBitmapLayer;
-
-/*
- * data of bitmap node
- */
-typedef struct VBitmapData {
- struct DynamicList layers; /* dynamic list with access array of bitmap layers */
- struct ListBase queue; /* queue of layers waiting for receiving from verse server */
- uint16 width; /* width of all verse layers */
- uint16 height; /* height of all verse layers */
- uint16 depth; /* depth of bitmap 1 is 2D bitmap, >1 is 3D bitmap */
- /* blender internals */
- uint16 t_width; /* = (width/VN_B_TILE_SIZE + 1)*VN_B_TILE_SIZE */
- uint16 t_height; /* = (height/VN_B_TILE_SIZE + 1)*VN_B_TILE_SIZE */
- void *image; /* pointer at image */
- /* client dependent methods */
- void (*post_bitmap_dimension_set)(struct VNode *vnode);
- void (*post_bitmap_layer_create)(struct VBitmapLayer *vblayer);
- void (*post_bitmap_layer_destroy)(struct VBitmapLayer *vblayer);
- void (*post_bitmap_tile_set)(struct VBitmapLayer *vblayer, unsigned int xs, unsigned int ys);
-}VBitmapData;
-
-/*
- * data of geometry node
- */
-typedef struct VGeomData {
- struct DynamicList layers; /* dynamic list with access array of Layers */
- struct VLink *vlink; /* pointer at VerseLink connecting object node and geom node */
- struct ListBase queue; /* queue of our layers waiting for receiving from verse server */
- void *mesh; /* pointer at Mesh (object node) */
- void *editmesh; /* pointer at EditMesh (edit mode) */
- struct HashVerseEdge *hash; /* verse edge hash */
- struct ListBase edges; /* list of fake verse edges */
- /* client dependent methods */
- void (*post_vertex_create)(struct VerseVert *vvert);
- void (*post_vertex_set_xyz)(struct VerseVert *vvert);
- void (*post_vertex_delete)(struct VerseVert *vvert);
- void (*post_vertex_free_constraint)(struct VerseVert *vvert);
- void (*post_polygon_create)(struct VerseFace *vface);
- void (*post_polygon_set_corner)(struct VerseFace *vface);
- void (*post_polygon_delete)(struct VerseFace *vface);
- void (*post_polygon_free_constraint)(struct VerseFace *vface);
- void (*post_geometry_free_constraint)(struct VNode *vnode);
- void (*post_polygon_set_uint8)(struct VerseFace *vface);
-} VGeomData;
-
-/*
- * data of object node
- */
-typedef struct VObjectData {
- struct DynamicList links; /* dynamic list with access array of links between other nodes */
- struct ListBase queue; /* queue of links waiting for sending and receiving from verse server */
- float pos[3]; /* position of object VerseNode */
- float quat[4]; /* rotation of object VerseNode stored in quat */
- float scale[3]; /* scale of object VerseNode */
- void *object; /* pointer at object */
- short flag; /* flag: POS_RECEIVE_READY, ROT_RECEIVE_READY. SCALE_RECEIVE_READY */
- /* client dependent methods */
-/* void (*post_transform)(struct VNode *vnode);*/
- void (*post_transform_pos)(struct VNode *vnode);
- void (*post_transform_rot)(struct VNode *vnode);
- void (*post_transform_scale)(struct VNode *vnode);
- void (*post_object_free_constraint)(struct VNode *vnode);
-} VObjectData;
-
-/*
- * Verse Tag
- */
-typedef struct VTag {
- struct VTag *next, *prev;
- /* verse data*/
- struct VTagGroup *vtaggroup; /* pointer at Verse Tag Group */
- uint16 id; /* id of this tag */
- char *name; /* name of this tag*/
- VNTagType type; /* type: VN_TAG_BOOLEAN, VN_TAG_UINT32, VN_TAG_REAL64, VN_TAG_REAL64_VEC3,
- VN_TAG_LINK, VN_TAG_ANIMATION, VN_TAG_BLOB */
- VNTag *tag; /* pointer at value (enum: vboolean, vuint32, vreal64, vstring,
- vreal64_vec3, vlink, vanimation, vblob)*/
- /* blender internals */
- void *value; /* pointer at blender value */
-} VTag;
-
-/*
- * Verse Tag Group (verse tags are grouped in tag groups)
- */
-typedef struct VTagGroup {
- struct VTagGroup *next, *prev;
- /* verse data*/
- struct VNode *vnode; /* pointer at Verse Node */
- uint16 id; /* id of this tag group */
- char *name; /* name of this tag group */
- /* blender internals */
- struct DynamicList tags; /* dynamic list with access array containing tags */
- struct ListBase queue; /* list of tags waiting for receiving from verse server */
- /* client dependent methods */
- void (*post_tag_change)(struct VTag *vatg);
- void (*post_taggroup_create)(struct VTagGroup *vtaggroup);
-} VTagGroup;
-
- /*
- * Verse Method Group
- */
-typedef struct VMethodGroup
-{
- struct VMethodGroup *next, *prev;
- uint16 group_id;
- char name[16];
- struct ListBase methods;
-} VMethodGroup;
-
-/*
- * Verse Method
- */
-typedef struct VMethod
-{
- struct VMethod *next, *prev;
- uint16 id;
- char name[500];
- uint8 param_count;
- VNOParamType *param_type;
- char **param_name;
-} VMethod;
-
-/*
- * Verse Node
- */
-typedef struct VNode {
- struct VNode *next, *prev;
- /* verse data*/
- struct VerseSession *session; /* session pointer */
- VNodeID id; /* node id */
- VNodeID owner_id; /* owner's id of this node */
- char *name; /* name of this node */
- uint32 type; /* type of node (V_NT_OBJECT, V_NT_GEOMETRY, V_NT_BITMAP) */
- /* blender internals */
- char flag; /* flags: NODE_SENT, NODE_RECEIVED, NODE_DELTED, NODE_OBSOLETE */
- struct DynamicList taggroups; /* dynamic list with access array of taggroups */
- struct ListBase methodgroups; /* method groups */
- struct ListBase queue; /* list of taggroups waiting for receiving from verse server */
- void *data; /* generic pointer at some data (VObjectData, VGeomData, ...) */
- int counter; /* counter of verse link pointing at this vnode (vlink->target) */
- /* client dependent methods */
- void (*post_node_create)(struct VNode *vnode);
- void (*post_node_destroy)(struct VNode *vnode);
- void (*post_node_name_set)(struct VNode *vnode);
-#ifdef VERSECHAT
- /* verse chat */
- int chat_flag; /* CHAT_LOGGED, CHAT_NOTLOGGED */
-#endif
-} VNode;
-
-
-/*
- * Verse Session: verse client can be connected to several verse servers
- * it is neccessary to store some information about each session
- */
-typedef struct VerseSession {
- struct VerseSession *next, *prev;
- /* verse data */
- VSession *vsession; /* pointer at VSeesion (verse.h) */
- uint32 avatar; /* id of avatar */
- char *address; /* string containg IP/domain name of verse server and number of port */
- void *connection; /* no clue */
- uint8 *host_id; /* no clue */
- /* blender internals */
- short flag; /* flag: VERSE_CONNECTING, VERSE_CONNECTED */
- DynamicList nodes; /* list of verse nodes */
- ListBase queue; /* list of nodes waiting for sending to verse server */
- unsigned int counter; /* count of events, when connection wasn't accepted */
- /* client dependent methods */
- void (*post_connect_accept)(struct VerseSession *session);
- void (*post_connect_terminated)(struct VerseSession *session);
- void (*post_connect_update)(struct VerseSession *session);
-} VerseSession;
-
-typedef struct VerseServer {
- struct VerseServer *next, *prev;
- char *name; /* human-readable server name */
- char *ip; /* string containing IP/domain name of verse server and number of port */
- short flag; /* flag: VERSE_CONNECTING, VERSE_CONNECTED */
- struct VerseSession *session; /* pointer to related session */
-} VerseServer;
-/*
- * list of post callback functions
- */
-typedef struct PostCallbackFunction {
- void (*function)(void *arg);
- void *param;
-} PostCallbackFunction;
-
-/* VerseSession->flag */
-#define VERSE_CONNECTING 1
-#define VERSE_CONNECTED 2
-#define VERSE_AUTOSUBSCRIBE 4
-
-/* max VerseSession->counter value */
-#define MAX_UNCONNECTED_EVENTS 100
-
-/* VNode flags */
-#define NODE_SENT 1
-#define NODE_RECEIVED 2
-#define NODE_DELTED 4
-#define NODE_OBSOLETE 8
-
-#ifdef VERSECHAT
-#define CHAT_NOTLOGGED 0
-#define CHAT_LOGGED 1
-#endif
-
-/* VLayer flags */
-#define LAYER_SENT 1
-#define LAYER_RECEIVED 2
-#define LAYER_DELETED 4
-#define LAYER_OBSOLETE 8
-
-/* VLink->flag */
-#define LINK_SEND_READY 1
-
-/* VObjectData->flag */
-#define POS_RECEIVE_READY 1
-#define ROT_RECEIVE_READY 2
-#define SCALE_RECEIVE_READY 4
-#define POS_SEND_READY 8
-#define ROT_SEND_READY 16
-#define SCALE_SEND_READY 32
-
-/* VLayer->content */
-#define VERTEX_LAYER 0
-#define POLYGON_LAYER 1
-
-/* VerseVert->flag */
-#define VERT_DELETED 1 /* vertex delete command was received from verse server */
-#define VERT_RECEIVED 2 /* VerseVert was received from verse server (is not in sending queue) */
-#define VERT_LOCKED 4 /* VerseVert is ready to send local position to verse server */
-#define VERT_POS_OBSOLETE 8 /* position of vertex was changed during sending to verse server */
-#define VERT_OBSOLETE 16 /* vertex delete command was sent to verse server; it means, that
- * no information related to this vertex shoudln't be sent to verse
- * until verse vertex is completely deleted ... then this vertex id
- * can be reused again for new vertex */
-
-/* VerseFace->flag */
-#define FACE_SEND_READY 1 /* VerseFace is ready for sending to verse server */
-#define FACE_RECEIVED 2 /* VerseFace was received from verse server */
-#define FACE_SENT 4 /* VerseFace was sent to verse server and we expect receiving from verse server */
-#define FACE_DELETED 8 /* delete command was sent to verse server */
-#define FACE_CHANGED 16 /* VerseFace was only changed not created */
-#define FACE_OBSOLETE 32 /* VerseFace was changed during sending to verse server */
-
-/* Queue type */
-#define VERSE_NODE 1
-#define VERSE_LINK 2
-#define VERSE_LAYER 3
-#define VERSE_VERT 4
-#define VERSE_FACE 5
-
-#define VERSE_TAG 6
-#define VERSE_TAG_GROUP 7
-
-#define VERSE_VERT_UINT32 8
-#define VERSE_VERT_REAL32 9
-#define VERSE_VERT_VEC_REAL32 10
-
-#define VERSE_FACE_UINT8 11
-#define VERSE_FACE_UINT32 12
-#define VERSE_FACE_REAL32 13
-#define VERSE_FACE_QUAT_UINT32 14
-#define VERSE_FACE_QUAT_REAL32 15
-
-/* Verse Bitmap Layer flags */
-#define VBLAYER_SUBSCRIBED 1
-
-/* function prototypes */
-
-/* functions from verse_session.c */
-void set_verse_session_callbacks(void);
-struct VerseSession *versesession_from_vsession(VSession *vsession);
-struct VerseSession *current_verse_session(void);
-struct VerseSession *create_verse_session(const char *name, const char *pass, const char *address, uint8 *expected_key);
-void free_verse_session(struct VerseSession *session);
-void b_verse_update(void);
-void b_verse_ms_get(void);
-void b_verse_connect(char *address);
-void end_verse_session(struct VerseSession *session);
-void end_all_verse_sessions(void);
-
-/* functions from verse_node.c */
-void send_verse_tag(struct VTag *vtag);
-void send_verse_taggroup(struct VTagGroup *vtaggroup);
-void send_verse_node(struct VNode *vnode);
-void free_verse_node_data(struct VNode *vnode);
-void free_verse_node(struct VNode *vnode);
-struct VNode* lookup_vnode(VerseSession *session, VNodeID node_id);
-struct VNode* create_verse_node(VerseSession *session, VNodeID node_id, uint8 type, VNodeID owner_id);
-void set_node_callbacks(void);
-
-/* functions from verse_object_node.c */
-struct VLink *find_unsent_parent_vlink(struct VerseSession *session, struct VNode *vnode);
-struct VLink *find_unsent_child_vlink(struct VerseSession *session, struct VNode *vnode);
-struct VLink *create_verse_link(VerseSession *session, struct VNode *source, struct VNode *target, uint16 link_id, uint32 target_id, const char *label);
-void send_verse_object_position(struct VNode *vnode);
-void send_verse_object_rotation(struct VNode *vnode);
-void send_verse_object_scale(struct VNode *vnode);
-void send_verse_link(struct VLink *vlink);
-
-void free_object_data(struct VNode *vnode);
-void set_object_callbacks(void);
-struct VObjectData *create_object_data(void);
-
-
-/* functions from verse_method.c */
-void free_verse_methodgroup(VMethodGroup *vmg);
-#ifdef VERSECHAT
-void send_say(const char *chan, const char *utter);
-void send_login(struct VNode *vnode);
-void send_logout(struct VNode *vnode);
-void send_join(struct VNode *vnode, const char *chan);
-void send_leave(struct VNode *vnode, const char *chan);
-#endif
-void set_method_callbacks(void);
-
-/* functions from verse_geometry_node.c */
-struct VerseFace* create_verse_face(struct VLayer *vlayer, uint32 polygon_id, uint32 v0, uint32 v1, uint32 v2, uint32 v3);
-struct VerseVert* create_verse_vertex(struct VLayer *vlayer, uint32 vertex_id, real32 x, real32 y, real32 z);
-struct VLayer *create_verse_layer(struct VNode *vnode, VLayerID layer_id, const char *name, VNGLayerType type, uint32 def_integer, real64 def_real);
-struct VGeomData *create_geometry_data(void);
-
-void send_verse_layer(struct VLayer *vlayer);
-
-void send_verse_face_corner_quat_real32(struct quat_real32_item *item, short type);
-void send_verse_face_corner_quat_uint32(struct quat_uint32_item *item, short type);
-void send_verse_face_real32(struct real32_item *item, short type);
-void send_verse_face_uint32(struct uint32_item *item, short type);
-void send_verse_face_uint8(struct uint8_item *item, short type);
-
-void send_verse_vert_vec_real32(struct vec_real32_item *item, short type);
-void send_verse_vert_real32(struct real32_item *item, short type);
-void send_verse_vert_uint32(struct uint32_item *item, short type);
-
-void send_verse_vertex_delete(struct VerseVert *vvert);
-void send_verse_vertex(struct VerseVert *vvert);
-void send_verse_face_delete(struct VerseFace *vface);
-
-void destroy_geometry(struct VNode *vnode);
-
-struct VLayer* find_verse_layer_type(struct VGeomData *geom, short content);
-void add_item_to_send_queue(struct ListBase *lb, void *item, short type);
-void free_geom_data(struct VNode *vnode);
-void set_geometry_callbacks(void);
-
-/* functions prototypes from verse_bitmap.c */
-void set_bitmap_callbacks(void);
-void free_bitmap_layer_data(struct VBitmapLayer *vblayer);
-struct VBitmapLayer *create_bitmap_layer(struct VNode *vnode, VLayerID layer_id, const char *name, VNBLayerType type);
-void free_bitmap_node_data(struct VNode *vnode);
-struct VBitmapData *create_bitmap_data(void);
-
-#endif
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 71b6d02fd4b..ff04b46e18e 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -1,13 +1,8 @@
#!/usr/bin/python
Import ('env')
-import os
-
sources = env.Glob('intern/*.c')
-# bmesh doesn't use booleanops.c - probably remove
-sources.remove('intern' + os.sep + 'booleanops.c')
-
incs = '. #/intern/guardedalloc #/intern/memutil ../editors/include'
incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager'
incs += ' ../render/extern/include #/intern/decimation/extern ../makesrna'
diff --git a/source/blender/blenkernel/intern/BME_Customdata.c b/source/blender/blenkernel/intern/BME_Customdata.c
index 503470bb89a..58975502124 100644
--- a/source/blender/blenkernel/intern/BME_Customdata.c
+++ b/source/blender/blenkernel/intern/BME_Customdata.c
@@ -1,6 +1,5 @@
#if 0
/**
-/*
* BME_customdata.c jan 2007
*
* Custom Data functions for Bmesh
diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c
index 65b0c3797d9..ac7e7de8f2a 100644
--- a/source/blender/blenkernel/intern/BME_conversions.c
+++ b/source/blender/blenkernel/intern/BME_conversions.c
@@ -1,6 +1,5 @@
#if 0
/**
-/*
* BME_mesh.c jan 2007
*
* BMesh mesh level functions.
diff --git a/source/blender/blenkernel/intern/BME_eulers.c b/source/blender/blenkernel/intern/BME_eulers.c
index 85007889e0a..d7cff7cfe27 100644
--- a/source/blender/blenkernel/intern/BME_eulers.c
+++ b/source/blender/blenkernel/intern/BME_eulers.c
@@ -1,6 +1,5 @@
#if 0
/**
-/*
* BME_eulers.c jan 2007
*
* BMesh Euler construction API.
diff --git a/source/blender/blenkernel/intern/BME_mesh.c b/source/blender/blenkernel/intern/BME_mesh.c
index 171b818ec49..fd38fae13cf 100644
--- a/source/blender/blenkernel/intern/BME_mesh.c
+++ b/source/blender/blenkernel/intern/BME_mesh.c
@@ -1,6 +1,5 @@
#if 0
/**
-/*
* BME_mesh.c jan 2007
*
* BMesh mesh level functions.
diff --git a/source/blender/blenkernel/intern/BME_structure.c b/source/blender/blenkernel/intern/BME_structure.c
index de6ee53f048..ce7601d1fd8 100644
--- a/source/blender/blenkernel/intern/BME_structure.c
+++ b/source/blender/blenkernel/intern/BME_structure.c
@@ -1,6 +1,5 @@
#if 0
/**
-/*
* BME_structure.c jan 2007
*
* Low level routines for manipulating the BMesh structure.
diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c
index 653330d03f4..744276db146 100644
--- a/source/blender/blenkernel/intern/BME_tools.c
+++ b/source/blender/blenkernel/intern/BME_tools.c
@@ -1,6 +1,5 @@
#if 0
/**
-/*
* BME_tools.c jan 2007
*
* Functions for changing the topology of a mesh.
diff --git a/source/blender/blenkernel/intern/booleanops.c b/source/blender/blenkernel/intern/booleanops.c
deleted file mode 100644
index f9df0beca7c..00000000000
--- a/source/blender/blenkernel/intern/booleanops.c
+++ /dev/null
@@ -1,603 +0,0 @@
-/**
- * $Id$
- *
- * ***** 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.
- *
- * The Original Code is Copyright (C) Blender Foundation
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * CSG operations.
- */
-
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_ghash.h"
-
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "CSG_BooleanOps.h"
-
-#include "BKE_cdderivedmesh.h"
-#include "BKE_customdata.h"
-#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_global.h"
-#include "BKE_library.h"
-#include "BKE_material.h"
-#include "BKE_mesh.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-
-
-
-/**
- * Here's the vertex iterator structure used to walk through
- * the blender vertex structure.
- */
-
-typedef struct {
- DerivedMesh *dm;
- Object *ob;
- int pos;
-} VertexIt;
-
-/**
- * Implementations of local vertex iterator functions.
- * These describe a blender mesh to the CSG module.
- */
-
-static void VertexIt_Destruct(CSG_VertexIteratorDescriptor * iterator)
-{
- if (iterator->it) {
- // deallocate memory for iterator
- MEM_freeN(iterator->it);
- iterator->it = 0;
- }
- iterator->Done = NULL;
- iterator->Fill = NULL;
- iterator->Reset = NULL;
- iterator->Step = NULL;
- iterator->num_elements = 0;
-
-}
-
-static int VertexIt_Done(CSG_IteratorPtr it)
-{
- VertexIt * iterator = (VertexIt *)it;
- return(iterator->pos >= iterator->dm->getNumVerts(iterator->dm));
-}
-
-static void VertexIt_Fill(CSG_IteratorPtr it, CSG_IVertex *vert)
-{
- VertexIt * iterator = (VertexIt *)it;
- MVert *verts = iterator->dm->getVertArray(iterator->dm);
-
- float global_pos[3];
-
- /* boolean happens in global space, transform both with obmat */
- mul_v3_m4v3(
- global_pos,
- iterator->ob->obmat,
- verts[iterator->pos].co
- );
-
- vert->position[0] = global_pos[0];
- vert->position[1] = global_pos[1];
- vert->position[2] = global_pos[2];
-}
-
-static void VertexIt_Step(CSG_IteratorPtr it)
-{
- VertexIt * iterator = (VertexIt *)it;
- iterator->pos ++;
-}
-
-static void VertexIt_Reset(CSG_IteratorPtr it)
-{
- VertexIt * iterator = (VertexIt *)it;
- iterator->pos = 0;
-}
-
-static void VertexIt_Construct(CSG_VertexIteratorDescriptor *output, DerivedMesh *dm, Object *ob)
-{
-
- VertexIt *it;
- if (output == 0) return;
-
- // allocate some memory for blender iterator
- it = (VertexIt *)(MEM_mallocN(sizeof(VertexIt),"Boolean_VIt"));
- if (it == 0) {
- return;
- }
- // assign blender specific variables
- it->dm = dm;
- it->ob = ob; // needed for obmat transformations
-
- it->pos = 0;
-
- // assign iterator function pointers.
- output->Step = VertexIt_Step;
- output->Fill = VertexIt_Fill;
- output->Done = VertexIt_Done;
- output->Reset = VertexIt_Reset;
- output->num_elements = it->dm->getNumVerts(it->dm);
- output->it = it;
-}
-
-/**
- * Blender Face iterator
- */
-
-typedef struct {
- DerivedMesh *dm;
- int pos;
- int offset;
- int flip;
-} FaceIt;
-
-static void FaceIt_Destruct(CSG_FaceIteratorDescriptor * iterator)
-{
- MEM_freeN(iterator->it);
- iterator->Done = NULL;
- iterator->Fill = NULL;
- iterator->Reset = NULL;
- iterator->Step = NULL;
- iterator->num_elements = 0;
-}
-
-static int FaceIt_Done(CSG_IteratorPtr it)
-{
- // assume CSG_IteratorPtr is of the correct type.
- FaceIt * iterator = (FaceIt *)it;
- return(iterator->pos >= iterator->dm->getNumTessFaces(iterator->dm));
-}
-
-static void FaceIt_Fill(CSG_IteratorPtr it, CSG_IFace *face)
-{
- // assume CSG_IteratorPtr is of the correct type.
- FaceIt *face_it = (FaceIt *)it;
- MFace *mfaces = face_it->dm->getTessFaceArray(face_it->dm);
- MFace *mface = &mfaces[face_it->pos];
-
- /* reverse face vertices if necessary */
- face->vertex_index[1] = mface->v2;
- if( face_it->flip == 0 ) {
- face->vertex_index[0] = mface->v1;
- face->vertex_index[2] = mface->v3;
- } else {
- face->vertex_index[2] = mface->v1;
- face->vertex_index[0] = mface->v3;
- }
- if (mface->v4) {
- face->vertex_index[3] = mface->v4;
- face->vertex_number = 4;
- } else {
- face->vertex_number = 3;
- }
-
- face->orig_face = face_it->offset + face_it->pos;
-}
-
-static void FaceIt_Step(CSG_IteratorPtr it)
-{
- FaceIt * face_it = (FaceIt *)it;
- face_it->pos ++;
-}
-
-static void FaceIt_Reset(CSG_IteratorPtr it)
-{
- FaceIt * face_it = (FaceIt *)it;
- face_it->pos = 0;
-}
-
-static void FaceIt_Construct(
- CSG_FaceIteratorDescriptor *output, DerivedMesh *dm, int offset, Object *ob)
-{
- FaceIt *it;
- if (output == 0) return;
-
- // allocate some memory for blender iterator
- it = (FaceIt *)(MEM_mallocN(sizeof(FaceIt),"Boolean_FIt"));
- if (it == 0) {
- return ;
- }
- // assign blender specific variables
- it->dm = dm;
- it->offset = offset;
- it->pos = 0;
-
- /* determine if we will need to reverse order of face vertices */
- if (ob->size[0] < 0.0f) {
- if (ob->size[1] < 0.0f && ob->size[2] < 0.0f) {
- it->flip = 1;
- } else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
- it->flip = 1;
- } else {
- it->flip = 0;
- }
- } else {
- if (ob->size[1] < 0.0f && ob->size[2] < 0.0f) {
- it->flip = 0;
- } else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
- it->flip = 0;
- } else {
- it->flip = 1;
- }
- }
-
- // assign iterator function pointers.
- output->Step = FaceIt_Step;
- output->Fill = FaceIt_Fill;
- output->Done = FaceIt_Done;
- output->Reset = FaceIt_Reset;
- output->num_elements = it->dm->getNumTessFaces(it->dm);
- output->it = it;
-}
-
-static Object *AddNewBlenderMesh(Scene *scene, Base *base)
-{
- // This little function adds a new mesh object to the blender object list
- // It uses ob to duplicate data as this seems to be easier than creating
- // a new one. This new oject contains no faces nor vertices.
- Mesh *old_me;
- Base *basen;
- Object *ob_new;
-
- // now create a new blender object.
- // duplicating all the settings from the previous object
- // to the new one.
- ob_new= copy_object(base->object);
-
- // Ok we don't want to use the actual data from the
- // last object, the above function incremented the
- // number of users, so decrement it here.
- old_me= ob_new->data;
- old_me->id.us--;
-
- // Now create a new base to add into the linked list of
- // vase objects.
-
- basen= MEM_mallocN(sizeof(Base), "duplibase");
- *basen= *base;
- BLI_addhead(&scene->base, basen); /* addhead: anders oneindige lus */
- basen->object= ob_new;
- basen->flag &= ~SELECT;
-
- // Initialize the mesh data associated with this object.
- ob_new->data= add_mesh("Mesh");
-
- // Finally assign the object type.
- ob_new->type= OB_MESH;
-
- return ob_new;
-}
-
-static void InterpCSGFace(
- DerivedMesh *dm, DerivedMesh *orig_dm, int index, int orig_index, int nr,
- float mapmat[][4])
-{
- float obco[3], *co[4], *orig_co[4], w[4][4];
- MFace *mface, *orig_mface;
- int j;
-
- mface = CDDM_get_tessface(dm, index);
- orig_mface = orig_dm->getTessFaceArray(orig_dm) + orig_index;
-
- // get the vertex coordinates from the original mesh
- orig_co[0] = (orig_dm->getVertArray(orig_dm) + orig_mface->v1)->co;
- orig_co[1] = (orig_dm->getVertArray(orig_dm) + orig_mface->v2)->co;
- orig_co[2] = (orig_dm->getVertArray(orig_dm) + orig_mface->v3)->co;
- orig_co[3] = (orig_mface->v4)? (orig_dm->getVertArray(orig_dm) + orig_mface->v4)->co: NULL;
-
- // get the vertex coordinates from the new derivedmesh
- co[0] = CDDM_get_vert(dm, mface->v1)->co;
- co[1] = CDDM_get_vert(dm, mface->v2)->co;
- co[2] = CDDM_get_vert(dm, mface->v3)->co;
- co[3] = (nr == 4)? CDDM_get_vert(dm, mface->v4)->co: NULL;
-
- for (j = 0; j < nr; j++) {
- // get coordinate into the space of the original mesh
- if (mapmat)
- mul_v3_m4v3(obco, mapmat, co[j]);
- else
- copy_v3_v3(obco, co[j]);
-
- interp_weights_face_v3( w[j],orig_co[0], orig_co[1], orig_co[2], orig_co[3], obco);
- }
-
- CustomData_interp(&orig_dm->faceData, &dm->faceData, &orig_index, NULL, (float*)w, 1, index);
-}
-
-/* Iterate over the CSG Output Descriptors and create a new DerivedMesh
- from them */
-static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
- CSG_FaceIteratorDescriptor *face_it,
- CSG_VertexIteratorDescriptor *vertex_it,
- float parinv[][4],
- float mapmat[][4],
- Material **mat,
- int *totmat,
- DerivedMesh *dm1,
- Object *ob1,
- DerivedMesh *dm2,
- Object *ob2)
-{
- DerivedMesh *result, *orig_dm;
- GHash *material_hash = NULL;
- Mesh *me1= (Mesh*)ob1->data;
- Mesh *me2= (Mesh*)ob2->data;
- int i;
-
- // create a new DerivedMesh
- result = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements, 0, 0);
- CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_DERIVEDMESH,
- CD_DEFAULT, face_it->num_elements);
- CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH,
- CD_DEFAULT, face_it->num_elements);
-
- // step through the vertex iterators:
- for (i = 0; !vertex_it->Done(vertex_it->it); i++) {
- CSG_IVertex csgvert;
- MVert *mvert = CDDM_get_vert(result, i);
-
- // retrieve a csg vertex from the boolean module
- vertex_it->Fill(vertex_it->it, &csgvert);
- vertex_it->Step(vertex_it->it);
-
- // we have to map the vertex coordinates back in the coordinate frame
- // of the resulting object, since it was computed in world space
- mul_v3_m4v3(mvert->co, parinv, csgvert.position);
- }
-
- // a hash table to remap materials to indices
- if (mat) {
- material_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "booleanops.c");
- *totmat = 0;
- }
-
- // step through the face iterators
- for(i = 0; !face_it->Done(face_it->it); i++) {
- Mesh *orig_me;
- Object *orig_ob;
- Material *orig_mat;
- CSG_IFace csgface;
- MFace *mface;
- int orig_index, mat_nr;
-
- // retrieve a csg face from the boolean module
- face_it->Fill(face_it->it, &csgface);
- face_it->Step(face_it->it);
-
- // find the original mesh and data
- orig_ob = (csgface.orig_face < dm1->getNumTessFaces(dm1))? ob1: ob2;
- orig_dm = (csgface.orig_face < dm1->getNumTessFaces(dm1))? dm1: dm2;
- orig_me = (orig_ob == ob1)? me1: me2;
- orig_index = (orig_ob == ob1)? csgface.orig_face: csgface.orig_face - dm1->getNumTessFaces(dm1);
-
- // copy all face layers, including mface
- CustomData_copy_data(&orig_dm->faceData, &result->faceData, orig_index, i, 1);
-
- // set mface
- mface = CDDM_get_tessface(result, i);
- mface->v1 = csgface.vertex_index[0];
- mface->v2 = csgface.vertex_index[1];
- mface->v3 = csgface.vertex_index[2];
- mface->v4 = (csgface.vertex_number == 4)? csgface.vertex_index[3]: 0;
-
- // set material, based on lookup in hash table
- orig_mat= give_current_material(orig_ob, mface->mat_nr+1);
-
- if (mat && orig_mat) {
- if (!BLI_ghash_haskey(material_hash, orig_mat)) {
- mat[*totmat] = orig_mat;
- mat_nr = mface->mat_nr = (*totmat)++;
- BLI_ghash_insert(material_hash, orig_mat, SET_INT_IN_POINTER(mat_nr));
- }
- else
- mface->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat));
- }
- else
- mface->mat_nr = 0;
-
- InterpCSGFace(result, orig_dm, i, orig_index, csgface.vertex_number,
- (orig_me == me2)? mapmat: NULL);
-
- test_index_face(mface, &result->faceData, i, csgface.vertex_number);
- }
-
- if (material_hash)
- BLI_ghash_free(material_hash, NULL, NULL);
-
- CDDM_calc_edges(result);
- CDDM_calc_normals(result);
-
- CDDM_tessfaces_to_faces(result);
-
- return result;
-}
-
-static void BuildMeshDescriptors(
- struct DerivedMesh *dm,
- struct Object *ob,
- int face_offset,
- struct CSG_FaceIteratorDescriptor * face_it,
- struct CSG_VertexIteratorDescriptor * vertex_it)
-{
- VertexIt_Construct(vertex_it,dm, ob);
- FaceIt_Construct(face_it,dm,face_offset,ob);
-}
-
-static void FreeMeshDescriptors(
- struct CSG_FaceIteratorDescriptor *face_it,
- struct CSG_VertexIteratorDescriptor *vertex_it)
-{
- VertexIt_Destruct(vertex_it);
- FaceIt_Destruct(face_it);
-}
-
-DerivedMesh *NewBooleanDerivedMesh_intern(
- DerivedMesh *dm, struct Object *ob, DerivedMesh *dm_select, struct Object *ob_select,
- int int_op_type, Material **mat, int *totmat)
-{
-
- float inv_mat[4][4];
- float map_mat[4][4];
-
- DerivedMesh *result = NULL;
-
- if (dm == NULL || dm_select == NULL) return 0;
- if (!dm->getNumTessFaces(dm) || !dm_select->getNumTessFaces(dm_select)) return 0;
-
- // we map the final object back into ob's local coordinate space. For this
- // we need to compute the inverse transform from global to ob (inv_mat),
- // and the transform from ob to ob_select for use in interpolation (map_mat)
- invert_m4_m4(inv_mat, ob->obmat);
- mul_m4_m4m4(map_mat, ob_select->obmat, inv_mat);
- invert_m4_m4(inv_mat, ob_select->obmat);
-
- {
- // interface with the boolean module:
- //
- // the idea is, we pass the boolean module verts and faces using the
- // provided descriptors. once the boolean operation is performed, we
- // get back output descriptors, from which we then build a DerivedMesh
-
- CSG_VertexIteratorDescriptor vd_1, vd_2;
- CSG_FaceIteratorDescriptor fd_1, fd_2;
- CSG_OperationType op_type;
- CSG_BooleanOperation *bool_op;
-
- // work out the operation they chose and pick the appropriate
- // enum from the csg module.
- switch (int_op_type) {
- case 1 : op_type = e_csg_intersection; break;
- case 2 : op_type = e_csg_union; break;
- case 3 : op_type = e_csg_difference; break;
- case 4 : op_type = e_csg_classify; break;
- default : op_type = e_csg_intersection;
- }
-
- BuildMeshDescriptors(dm_select, ob_select, 0, &fd_1, &vd_1);
- BuildMeshDescriptors(dm, ob, dm_select->getNumTessFaces(dm_select) , &fd_2, &vd_2);
-
- bool_op = CSG_NewBooleanFunction();
-
- // perform the operation
- if (CSG_PerformBooleanOperation(bool_op, op_type, fd_1, vd_1, fd_2, vd_2)) {
- CSG_VertexIteratorDescriptor vd_o;
- CSG_FaceIteratorDescriptor fd_o;
-
- CSG_OutputFaceDescriptor(bool_op, &fd_o);
- CSG_OutputVertexDescriptor(bool_op, &vd_o);
-
- // iterate through results of operation and insert
- // into new object
- result = ConvertCSGDescriptorsToDerivedMesh(
- &fd_o, &vd_o, inv_mat, map_mat, mat, totmat, dm_select, ob_select, dm, ob);
-
- // free up the memory
- CSG_FreeVertexDescriptor(&vd_o);
- CSG_FreeFaceDescriptor(&fd_o);
- }
- else
- printf("Unknown internal error in boolean");
-
- CSG_FreeBooleanOperation(bool_op);
-
- FreeMeshDescriptors(&fd_1, &vd_1);
- FreeMeshDescriptors(&fd_2, &vd_2);
- }
-
- return result;
-}
-
-int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type)
-{
- Mesh *me_new;
- int a, maxmat, totmat= 0;
- Object *ob_new, *ob, *ob_select;
- Material **mat;
- DerivedMesh *result;
- DerivedMesh *dm_select;
- DerivedMesh *dm;
-
- ob= base->object;
- ob_select= base_select->object;
-
- dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
- dm_select = mesh_create_derived_view(scene, ob_select, 0); // no modifiers in editmode ??
-
- maxmat= ob->totcol + ob_select->totcol;
- mat= (Material**)MEM_mallocN(sizeof(Material*)*maxmat, "NewBooleanMeshMat");
-
- /* put some checks in for nice user feedback */
- if (dm == NULL || dm_select == NULL) return 0;
- if (!dm->getNumTessFaces(dm) || !dm_select->getNumTessFaces(dm_select))
- {
- MEM_freeN(mat);
- return -1;
- }
-
- result= NewBooleanDerivedMesh_intern(dm, ob, dm_select, ob_select, int_op_type, mat, &totmat);
-
- if (result == NULL) {
- MEM_freeN(mat);
- return 0;
- }
-
- /* create a new blender mesh object - using 'base' as a template */
- ob_new= AddNewBlenderMesh(scene, base_select);
- me_new= ob_new->data;
-
- DM_to_mesh(result, me_new);
- result->release(result);
-
- dm->release(dm);
- dm_select->release(dm_select);
-
- /* add materials to object */
- for (a = 0; a < totmat; a++)
- assign_material(ob_new, mat[a], a+1);
-
- MEM_freeN(mat);
-
- /* update dag */
- DAG_id_flush_update(&ob_new->id, OB_RECALC_DATA);
-
- return 1;
-}
-
-DerivedMesh *NewBooleanDerivedMesh(DerivedMesh *dm, struct Object *ob, DerivedMesh *dm_select, struct Object *ob_select,
- int int_op_type)
-{
- return NewBooleanDerivedMesh_intern(dm, ob, dm_select, ob_select, int_op_type, NULL, NULL);
-}
-
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 89e60cc5e0c..4703b75299b 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -37,6 +37,7 @@
#include "DNA_object_types.h"
#include "DNA_meshdata_types.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_utildefines.h"
@@ -48,6 +49,7 @@
#include "BKE_modifier.h"
#include "BKE_pointcache.h"
+
#ifdef _WIN32
void tstart ( void )
{}
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index e2a1b0dfb33..1fec977851e 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -44,6 +44,7 @@
#include "DNA_scene_types.h"
#include "DNA_meshdata_types.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 22646ab3cb5..400bea1a48a 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -147,7 +147,7 @@ FILE *CTX_rec_file(bContext *C)
return f;
}
-int CTX_set_events_path(bContext *C, char *path)
+int CTX_set_events_path(bContext *C, const char *path)
{
if (!path) {
C->evtplaypath[0] = 0;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 52519f95d30..bf7b67486bf 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -39,7 +39,6 @@
#include <math.h>
#include <string.h>
-
#include <assert.h>
#include "MEM_guardedalloc.h"
@@ -47,6 +46,7 @@
#include "DNA_meshdata_types.h"
#include "DNA_ID.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_path_util.h"
#include "BLI_linklist.h"
@@ -59,7 +59,6 @@
#include "BKE_customdata_file.h"
#include "BKE_global.h"
#include "BKE_main.h"
-#include "BKE_utildefines.h"
#include "BKE_multires.h"
#include "bmesh.h"
@@ -298,7 +297,6 @@ static void layerInterp_tface(void **sources, float *weights,
}
*tf = *(MTFace *)sources[0];
-
for(j = 0; j < 4; ++j) {
tf->uv[j][0] = uv[j][0];
tf->uv[j][1] = uv[j][1];
@@ -659,7 +657,6 @@ static void layerDefault_mloopcol(void *data, int count)
MLoopCol default_mloopcol = {255,255,255,255};
MLoopCol *mlcol = (MLoopCol*)data;
int i;
-
for(i = 0; i < count; i++)
mlcol[i] = default_mloopcol;
@@ -1037,7 +1034,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
/*const LayerTypeInfo *typeInfo;*/
CustomDataLayer *layer, *newlayer;
int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0, lastclone = 0, lastmask = 0, lastflag = 0;
-
+
for(i = 0; i < source->totlayer; ++i) {
layer = &source->layers[i];
/*typeInfo = layerType_getInfo(layer->type);*/ /*UNUSED*/
@@ -1373,9 +1370,8 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
int size = typeInfo->size * totelem, flag = 0, index = data->totlayer;
void *newlayerdata;
- if (!typeInfo->defaultname && CustomData_has_layer(data, type)) {
+ if (!typeInfo->defaultname && CustomData_has_layer(data, type))
return &data->layers[CustomData_get_layer_index(data, type)];
- }
if((alloctype == CD_ASSIGN) || (alloctype == CD_REFERENCE)) {
newlayerdata = layerdata;
@@ -1589,10 +1585,10 @@ void CustomData_free_temporary(CustomData *data, int totelem)
if (i != j)
data->layers[j] = data->layers[i];
-
- if ((layer->flag & CD_FLAG_TEMPORARY) == CD_FLAG_TEMPORARY) {
+
+ if ((layer->flag & CD_FLAG_TEMPORARY) == CD_FLAG_TEMPORARY)
customData_free_layer__internal(layer, totelem);
- } else
+ else
j++;
}
diff --git a/source/blender/blenkernel/intern/editderivedbmesh.c b/source/blender/blenkernel/intern/editderivedbmesh.c
index 3db70d918b1..73f7357dc18 100644
--- a/source/blender/blenkernel/intern/editderivedbmesh.c
+++ b/source/blender/blenkernel/intern/editderivedbmesh.c
@@ -52,6 +52,7 @@
#include "DNA_space_types.h"
#include "DNA_particle_types.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
@@ -61,7 +62,6 @@
#include "BLI_scanfill.h"
#include "BLI_ghash.h"
#include "BLI_array.h"
-#include "BLI_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_customdata.h"
@@ -78,7 +78,6 @@
#include "BKE_object.h"
#include "BKE_subsurf.h"
#include "BKE_texture.h"
-#include "BKE_utildefines.h"
#include "BKE_particle.h"
#include "BKE_tessmesh.h"
@@ -755,7 +754,7 @@ static void bmDM_drawFacesTex_common(DerivedMesh *dm,
BMFace *efa;
BMVert *eve;
BMIter iter;
- MLoopUV *luv[3], dummyluv = {0};
+ MLoopUV *luv[3], dummyluv = {{0}};
MLoopCol *lcol[3], dummylcol = {0};
int i, has_vcol = CustomData_has_layer(&bm->ldata, CD_MLOOPCOL);
int has_uv = CustomData_has_layer(&bm->pdata, CD_MTEXPOLY);
@@ -781,7 +780,7 @@ static void bmDM_drawFacesTex_common(DerivedMesh *dm,
for (i=0; i<em->tottri; i++) {
BMLoop **ls = em->looptris[i];
MTexPoly *tp= CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY);
- MTFace mtf = {0};
+ MTFace mtf = {{{0}}};
unsigned char *cp= NULL;
int drawSmooth= BM_TestHFlag(ls[0]->f, BM_SMOOTH);
int flag;
@@ -856,7 +855,7 @@ static void bmDM_drawFacesTex_common(DerivedMesh *dm,
for (i=0; i<em->tottri; i++) {
BMLoop **ls = em->looptris[i];
MTexPoly *tp= CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY);
- MTFace mtf = {0};
+ MTFace mtf = {{{0}}};
unsigned char *cp= NULL;
int drawSmooth= BM_TestHFlag(ls[0]->f, BM_SMOOTH);
int flag;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 8c9240bb0f8..1c1e6ffe067 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -49,11 +49,11 @@
#include "DNA_ipo_types.h"
#include "DNA_customdata_types.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
-#include "BLI_utildefines.h"
#include "BLI_scanfill.h"
#include "BKE_animsys.h"
@@ -623,7 +623,6 @@ static void make_local_tface(Main *bmain, Mesh *me)
}
}
}
-
}
static void expand_local_mesh(Main *bmain, Mesh *me)
diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c
index 63784fb00bf..b415b09daa4 100644
--- a/source/blender/blenkernel/intern/modifiers_bmesh.c
+++ b/source/blender/blenkernel/intern/modifiers_bmesh.c
@@ -36,6 +36,7 @@
#include "float.h"
#include "ctype.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_kdopbvh.h"
@@ -93,7 +94,6 @@
#include "BKE_softbody.h"
#include "BKE_subsurf.h"
#include "BKE_texture.h"
-#include "BKE_utildefines.h"
#include "BKE_tessmesh.h"
#include "depsgraph_private.h"
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 701a34d1794..3df56760697 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -59,6 +59,7 @@
#include "DNA_ipo_types.h" // XXX old animation system stuff... to be removed!
#include "DNA_listBase.h"
+#include "BLI_utildefines.h"
#include "BLI_edgehash.h"
#include "BLI_rand.h"
#include "BLI_jitter.h"
@@ -69,7 +70,6 @@
#include "BLI_listbase.h"
#include "BLI_threads.h"
#include "BLI_storage.h" /* For _LARGEFILE64_SOURCE; zlib needs this on some systems */
-#include "BLI_utildefines.h"
#include "BKE_main.h"
#include "BKE_animsys.h"
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 814ad92e6e9..9f351fead79 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -45,6 +45,7 @@
#include <stdio.h>
#include <string.h> /* memset */
+#include "BLI_utildefines.h"
#include "BLI_linklist.h"
#include "BLI_rand.h"
#include "BLI_jitter.h"
@@ -53,7 +54,6 @@
#include "BLI_edgehash.h"
#include "BLI_kdtree.h"
#include "BLI_kdopbvh.h"
-#include "BLI_utildefines.h"
#include "BKE_bvhutils.h"
#include "BKE_cdderivedmesh.h"
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 2c0428b8597..5b7884a4f98 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -46,12 +46,12 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BLI_pbvh.h"
-#include "BLI_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
@@ -61,7 +61,6 @@
#include "BKE_scene.h"
#include "BKE_subsurf.h"
#include "BKE_tessmesh.h"
-#include "BKE_utildefines.h"
#include "PIL_time.h"
#include "BLI_array.h"
diff --git a/source/blender/blenkernel/intern/verse_bitmap_node.c b/source/blender/blenkernel/intern/verse_bitmap_node.c
deleted file mode 100644
index d27f7a13f02..00000000000
--- a/source/blender/blenkernel/intern/verse_bitmap_node.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/**
- * $Id: verse_bitmap_node.c 12931 2007-12-17 18:20:48Z theeth $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WITH_VERSE
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_listBase.h"
-
-#include "BLI_dynamiclist.h"
-#include "BLI_blenlib.h"
-
-#include "BIF_verse.h"
-
-#include "BKE_verse.h"
-
-#include "verse.h"
-
-/* function prototypes of static functions */
-static void cb_b_dimension_set(void *user_data, VNodeID node_id, uint16 width, uint16 height, uint16 depth);
-static void cb_b_layer_create(void *user_data, VNodeID node_id, VLayerID layer_id, const char *name, VNBLayerType type);
-static void cb_b_layer_destroy(void *user_data, VNodeID node_id, VLayerID layer_id);
-static void cb_b_tile_set(void *user_data, VNodeID node_id, VLayerID layer_id, uint16 tile_x, uint16 tile_y, uint16 z, VNBLayerType type, const VNBTile *tile);
-
-static void change_layer_dimension(
- VBitmapLayer *vblayer,
- unsigned int old_width,
- unsigned int old_height,
- unsigned int t_old_width,
- unsigned int t_old_height);
-static void *alloc_verse_bitmap_layer_data(struct VBitmapLayer *vblayer);
-
-/*
- * resize/crop verse bitmap layer
- */
-static void change_layer_dimension(
- VBitmapLayer *vblayer,
- unsigned int old_width,
- unsigned int old_height,
- unsigned int t_old_width,
- unsigned int t_old_height)
-{
- struct VNode *vnode = vblayer->vnode;
- unsigned int t_width = ((VBitmapData*)(vnode->data))->t_width;
- unsigned int width = ((VBitmapData*)(vnode->data))->width;
- unsigned int height = ((VBitmapData*)(vnode->data))->height;
- unsigned int x, y, i, j;
-
- i = j = 0;
-
- /* "copy" old data to new data */
- if(vblayer->type==VN_B_LAYER_UINT8) {
- unsigned char *data = (unsigned char*)vblayer->data;
- /* allocate new verse bitmap layer data */
- unsigned char *new_data = (unsigned char*)alloc_verse_bitmap_layer_data(vblayer);
- for(y=0; y<old_height && y<height; y++, i=y*t_width, j=y*t_old_width) {
- for(x=0; x<old_width && y<width; x++, i++, j++) {
- new_data[i] = data[j];
- }
- }
- MEM_freeN(vblayer->data);
- vblayer->data = new_data;
- }
-}
-
-/*
- * free data stored in verse bitmap layer
- */
-void free_bitmap_layer_data(VBitmapLayer *vblayer)
-{
- struct VerseSession *session = vblayer->vnode->session;
-
- /* free name of bitmap layer */
- MEM_freeN(vblayer->name);
-
- /* unsubscribe from verse bitmap layer */
- if(session->flag & VERSE_CONNECTED)
- verse_send_b_layer_unsubscribe(vblayer->vnode->id, vblayer->id);
-
- /* free image data of bitmap layer */
- if(vblayer->data) MEM_freeN(vblayer->data);
-}
-
-/*
- * allocate data of verse bitmap layer
- */
-static void *alloc_verse_bitmap_layer_data(VBitmapLayer *vblayer)
-{
- struct VNode *vnode = vblayer->vnode;
- unsigned int t_width = ((VBitmapData*)(vnode->data))->t_width;
- unsigned int t_height = ((VBitmapData*)(vnode->data))->t_height;
- unsigned int size;
- void *data;
-
- size = t_width*t_height;
-
- /* allocation of own data stored in verse bitmap layer */
- switch (vblayer->type) {
- case VN_B_LAYER_UINT1:
- data = (void*)MEM_mallocN(sizeof(unsigned char)*size, "VBLayer data uint1");
- break;
- case VN_B_LAYER_UINT8:
- data = (void*)MEM_mallocN(sizeof(unsigned char)*size, "VBLayer data uint8");
- break;
- case VN_B_LAYER_UINT16:
- data = (void*)MEM_mallocN(sizeof(unsigned int)*size, "VBLayer data uint16");
- break;
- case VN_B_LAYER_REAL32:
- data = (void*)MEM_mallocN(sizeof(float)*size, "VBLayer data float16");
- break;
- case VN_B_LAYER_REAL64:
- data = (void*)MEM_mallocN(sizeof(double)*size, "VBLayer data float32");
- break;
- default:
- data = NULL;
- break;
- }
-
- return data;
-}
-
-/*
- * create verse bitmap layer
- */
-VBitmapLayer *create_bitmap_layer(
- VNode *vnode,
- VLayerID layer_id,
- const char *name,
- VNBLayerType type)
-{
- struct VBitmapLayer *vblayer;
- unsigned int width = ((VBitmapData*)(vnode->data))->width;
- unsigned int height = ((VBitmapData*)(vnode->data))->height;
-
- /* allocate memory for own verse bitmap layer */
- vblayer = (VBitmapLayer*)MEM_mallocN(sizeof(VBitmapLayer), "Verse Bitmap Layer");
-
- /* verse bitmap layer will include pointer at parent verse node and own id */
- vblayer->vnode = vnode;
- vblayer->id = layer_id;
-
- /* name of verse layer */
- vblayer->name = (char*)MEM_mallocN(sizeof(char)*(strlen(name)+1), "Verse Bitmap Layer name");
- vblayer->name[0] = '\0';
- strcpy(vblayer->name, name);
-
- /* type of data stored in verse bitmap layer */
- vblayer->type = type;
-
- /* we can allocate memory for layer data, when we know dimmension of layers; when
- * we don't know it, then we will allocate this data when we will receive dimmension */
- if(width==0 || height==0)
- vblayer->data = NULL;
- else
- vblayer->data = alloc_verse_bitmap_layer_data(vblayer);
-
- vblayer->flag = 0;
-
- return vblayer;
-}
-
-/*
- * free data of bitmap node
- */
-void free_bitmap_node_data(VNode *vnode)
-{
- if(vnode->data) {
- struct VBitmapLayer *vblayer = (VBitmapLayer*)((VBitmapData*)(vnode->data))->layers.lb.first;
-
- /* free all VerseLayer data */
- while(vblayer) {
- free_bitmap_layer_data(vblayer);
- vblayer = vblayer->next;
- }
-
- /* free all VerseLayers */
- BLI_dlist_destroy(&(((VGeomData*)vnode->data)->layers));
- }
-}
-
-/*
- * create data of bitmap node
- */
-VBitmapData *create_bitmap_data()
-{
- struct VBitmapData *vbitmap;
-
- vbitmap = (VBitmapData*)MEM_mallocN(sizeof(VBitmapData), "Verse Bitmap Data");
-
- BLI_dlist_init(&(vbitmap->layers));
- vbitmap->queue.first = vbitmap->queue.last = NULL;
-
- vbitmap->width = 0;
- vbitmap->height = 0;
- vbitmap->depth = 0;
-
- vbitmap->image = NULL;
-
- vbitmap->post_bitmap_dimension_set = post_bitmap_dimension_set;
- vbitmap->post_bitmap_layer_create = post_bitmap_layer_create;
- vbitmap->post_bitmap_layer_destroy = post_bitmap_layer_destroy;
- vbitmap->post_bitmap_tile_set = post_bitmap_tile_set;
-
- return vbitmap;
-}
-
-/*
- * callback function, dimension of image was changed, it is neccessary to
- * crop all layers
- */
-static void cb_b_dimension_set(
- void *user_data,
- VNodeID node_id,
- uint16 width,
- uint16 height,
- uint16 depth)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VBitmapLayer *vblayer;
- unsigned int old_width, old_height, t_old_width, t_old_height;
-
- if(!session) return;
-
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(!vnode) return;
-
-#ifdef VERSE_DEBUG_PRINT
- printf("\t cb_b_dimension_set()\n");
-#endif
-
- /* backup old width and height */
- old_width = ((VBitmapData*)(vnode->data))->width;
- old_height = ((VBitmapData*)(vnode->data))->height;
- t_old_width = ((VBitmapData*)(vnode->data))->t_width;
- t_old_height = ((VBitmapData*)(vnode->data))->t_height;
-
- /* set up new dimension of layers */
- ((VBitmapData*)(vnode->data))->width = width;
- ((VBitmapData*)(vnode->data))->height = height;
- ((VBitmapData*)(vnode->data))->depth = depth;
-
- /* we cache t_width because tiles aren't one pixel width */
- if((width % VN_B_TILE_SIZE)!=0)
- ((VBitmapData*)(vnode->data))->t_width = (width/VN_B_TILE_SIZE + 1)*VN_B_TILE_SIZE;
- else
- ((VBitmapData*)(vnode->data))->t_width = width;
-
- /* we cache t_height because tiles aren't one pixel height */
- if((height % VN_B_TILE_SIZE)!=0)
- ((VBitmapData*)(vnode->data))->t_height = (height/VN_B_TILE_SIZE + 1)*VN_B_TILE_SIZE;
- else
- ((VBitmapData*)(vnode->data))->t_height = height;
-
- /* crop resize all layers */
- vblayer = ((VBitmapData*)vnode->data)->layers.lb.first;
-
- while(vblayer) {
- /* when this callback function received after cb_b_layer_create,
- * then we have to allocate memory for verse bitmap layer data */
- if(!vblayer->data) vblayer->data = alloc_verse_bitmap_layer_data(vblayer);
- /* crop/resize all verse bitmap layers */
- else change_layer_dimension(vblayer, old_width, old_height, t_old_width, t_old_height);
-
- vblayer = vblayer->next;
- }
-
- /* post callback function */
- ((VBitmapData*)(vnode->data))->post_bitmap_dimension_set(vnode);
-}
-
-/*
- * callback function, new layer channel of image was created
- */
-static void cb_b_layer_create(
- void *user_data,
- VNodeID node_id,
- VLayerID layer_id,
- const char *name,
- VNBLayerType type)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VBitmapLayer *vblayer;
-
- if(!session) return;
-
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(!vnode) return;
-
-#ifdef VERSE_DEBUG_PRINT
- printf("\t cb_b_layer_create()\n");
-#endif
-
- /* when no layer exists, then new layer will be created */
- vblayer = create_bitmap_layer(vnode, layer_id, name, type);
-
- /* add verse bitmap layer to list of layers */
- BLI_dlist_add_item_index(&((VBitmapData*)vnode->data)->layers, vblayer, layer_id);
-
- /* post callback function */
- ((VBitmapData*)(vnode->data))->post_bitmap_layer_create(vblayer);
-
-}
-
-/*
- * callback function, existing layer of image was destroyed
- */
-static void cb_b_layer_destroy(
- void *user_data,
- VNodeID node_id,
- VLayerID layer_id)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VBitmapLayer *vblayer;
-
- if(!session) return;
-
- /* find node of this layer*/
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(!vnode) return;
-
- vblayer = (VBitmapLayer*)BLI_dlist_find_link(&(((VBitmapData*)vnode->data)->layers), layer_id);
- if(!vblayer) return;
-
-#ifdef VERSE_DEBUG_PRINT
- printf("\t cb_b_layer_destroy()\n");
-#endif
-
- /* remove verse bitmap layer from list of layers */
- BLI_dlist_rem_item(&(((VBitmapData*)vnode->data)->layers), layer_id);
-
- /* post callback function */
- ((VBitmapData*)(vnode->data))->post_bitmap_layer_destroy(vblayer);
-
- /* free data of verse bitmap layer */
- free_bitmap_layer_data(vblayer);
-
- /* free verse bitmap layer */
- MEM_freeN(vblayer);
-}
-
-/*
- * callback function, small part (8x8 pixels) was changed
- */
-static void cb_b_tile_set(
- void *user_data,
- VNodeID node_id,
- VLayerID layer_id,
- uint16 tile_x,
- uint16 tile_y,
- uint16 z,
- VNBLayerType type,
- const VNBTile *tile)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VBitmapLayer *vblayer;
- unsigned int x, y, xs, ys, width, height, t_height, t_width, i, j;
-
- if(!session) return;
-
- /* try to find verse node in dynamic list nodes */
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(!vnode) return;
-
- /* try to find verse bitmap layer in list of layers */
- vblayer = (VBitmapLayer*)BLI_dlist_find_link(&(((VBitmapData*)vnode->data)->layers), layer_id);
- if(!vblayer) return;
-
- /* we have to have allocated memory for bitmap layer */
- if(!vblayer->data) return;
-
- width = ((VBitmapData*)vnode->data)->width;
- height = ((VBitmapData*)vnode->data)->height;
-
- /* width of verse image including all tiles */
- t_height = ((VBitmapData*)vnode->data)->t_height;
- /* height of verse image including all tiles */
- t_width = ((VBitmapData*)vnode->data)->t_width;
-
-#ifdef VERSE_DEBUG_PRINT
- printf("\t cb_b_tile_set()\n");
-#endif
-
- xs = tile_x*VN_B_TILE_SIZE;
- ys = tile_y*VN_B_TILE_SIZE;
-
- /* initial position in one dimension vblayer->data (y_start*width + x_start) */
- i = ys*t_width + xs;
- /* intial position in one dimension tile array */
- j = 0;
-
- if(type==VN_B_LAYER_UINT8) {
- unsigned char *data = (unsigned char*)vblayer->data;
- for(y=ys; y<ys+VN_B_TILE_SIZE && y<height; y++, i=y*t_width+xs)
- for(x=xs; x<xs+VN_B_TILE_SIZE && x<width; x++, i++, j++)
- data[i] = (unsigned char)tile->vuint8[j];
- }
-
- /* post callback function */
- ((VBitmapData*)(vnode->data))->post_bitmap_tile_set(vblayer, xs, ys);
-}
-
-/*
- * set up all callbacks functions for image nodes
- */
-void set_bitmap_callbacks(void)
-{
- /* dimension (size) of bitmap was set up or changes (image will be croped) */
- verse_callback_set(verse_send_b_dimensions_set, cb_b_dimension_set, NULL);
-
- /* new layer (chanell) of image was added or created */
- verse_callback_set(verse_send_b_layer_create, cb_b_layer_create, NULL);
-
- /* existing layer was destroyed */
- verse_callback_set(verse_send_b_layer_destroy, cb_b_layer_destroy, NULL);
-
- /* some tile (small part 8x8 pixels of image was changed) */
- verse_callback_set(verse_send_b_tile_set, cb_b_tile_set, NULL);
-}
-
-#endif
-
diff --git a/source/blender/blenkernel/intern/verse_geometry_node.c b/source/blender/blenkernel/intern/verse_geometry_node.c
deleted file mode 100644
index 0b3f26007a6..00000000000
--- a/source/blender/blenkernel/intern/verse_geometry_node.c
+++ /dev/null
@@ -1,2101 +0,0 @@
-/**
- * $Id: verse_geometry_node.c 12931 2007-12-17 18:20:48Z theeth $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WITH_VERSE
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_listBase.h"
-
-#include "BLI_dynamiclist.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-
-#include "BKE_verse.h"
-#include "BKE_utildefines.h"
-
-#include "BIF_verse.h"
-
-#include "verse.h"
-
-/* function prototypes of static functions */
-
-/* test functions for callback functions */
-static char test_polygon_set_corner_uint32(uint32 v0, uint32 v1, uint32 v2, uint32 v3);
-
-/* callback functions */
-static void cb_g_layer_create(void *user_data, VNodeID node_id, VLayerID layer_id, const char *name, VNGLayerType type, uint32 def_integer, real64 def_real);
-static void cb_g_layer_destroy(void *user_data, VNodeID node_id, VLayerID layer_id);
-static void cb_g_vertex_set_xyz_real32(void *user_data, VNodeID node_id, VLayerID layer_id, uint32 vertex_id, real32 x, real32 y, real32 z);
-static void cb_g_polygon_set_corner_uint32(void *user_data, VNodeID node_id, VLayerID layer_id, uint32 polygon_id, uint32 v0, uint32 v1, uint32 v2, uint32 v3);
-static void cb_g_vertex_delete_real32(void *user_data, VNodeID node_id, uint32 vertex_id);
-static void cb_g_polygon_delete(void *user_data, VNodeID node_id, uint32 polygon_id);
-static void cb_g_crease_set_edge(void *user_data, VNodeID node_id, const char *layer, uint32 def_crease);
-static void cb_g_crease_set_vertex(void *user_data, VNodeID node_id, const char *layer, uint32 def_crease);
-
-/* other static functions */
-
-static void free_unneeded_verseverts_of_verseface(struct VNode *vnode, struct VerseFace *vface);
-static void free_verse_vertex(struct VLayer *vlayer, struct VerseVert *vvert);
-static void free_verse_face(struct VLayer *vlayer, struct VerseFace *vface);
-static void free_verse_layer_data(struct VNode *vnode, struct VLayer *vlayer);
-
-static void send_verse_face(struct VerseFace *vface);
-
-static VerseVert* find_verse_vert_in_queue(struct VLayer *vlayer, VNodeID node_id, uint32 vertex_id, real32 x, real32 y, real32 z);
-static VerseFace* find_verse_face_in_queue(struct VLayer *vlayer, VNodeID node_id, uint32 polygon_id, uint32 v0, uint32 v1, uint32 v2, uint32 v3);
-
-static unsigned short test_incoming_verseface(struct VGeomData *geom, struct VerseFace *vface);
-static void find_unsent_faces(struct VNode *vnode, struct VerseVert *vvert);
-static void find_vlayer_orphans(struct VNode *vnode, struct VerseVert *vvert);
-static void move_face_orphan_to_dlist(struct VNode *vnode, struct VLayer *vlayer, struct VerseFace *vface);
-static void increase_verse_verts_references(struct VerseFace *vface);
-static void recalculate_verseface_normals(struct VNode *vnode);
-
-/* verse edge functions */
-static VerseEdge* find_verse_edge(struct VNode *vnode, uint32 v0, uint32 v1);
-static void insert_verse_edgehash(struct VNode *vnode, struct VerseEdge *vedge);
-static void remove_verse_edgehash(struct VNode *vnode, struct VerseEdge *vedge);
-static void remove_verse_edge(struct VNode *vnode, uint32 v0, uint32 v1);
-static void add_verse_edge(struct VNode *vnode, uint32 v0, uint32 v1);
-static void update_edgehash_of_deleted_verseface(struct VNode *vnode, struct VerseFace *vface);
-static void update_edgehash_of_changed_verseface(struct VNode *vnode, struct VerseFace *vface, uint32 v0, uint32 v1, uint32 v2, uint32 v3);
-static void update_edgehash_of_new_verseface(struct VNode *vnode, uint32 v0, uint32 v1, uint32 v2, uint32 v3);
-
-/*
- * recalcute normals of all VerseFaces
- */
-static void recalculate_verseface_normals(VNode *vnode)
-{
- struct VLayer *vert_layer, *face_layer;
- struct VerseFace *vface;
- struct VerseVert *vvert;
-
- if(vnode->type != V_NT_GEOMETRY) return;
-
- vert_layer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
- face_layer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
-
- vvert = vert_layer->dl.lb.first;
- while(vvert) {
- vvert->no[0] = vvert->no[1] = vvert->no[2] = 0.0;
- vvert = vvert->next;
- }
-
- vface = face_layer->dl.lb.first;
- while(vface) {
- /* calculate face normals */
- if(vface->vvert3) {
- CalcNormFloat4(vface->vvert0->co, vface->vvert1->co,
- vface->vvert2->co, vface->vvert3->co, vface->no);
- add_v3_v3v3(vface->vvert3->no, vface->vvert3->no, vface->no);
- }
- else
- CalcNormFloat(vface->vvert0->co, vface->vvert1->co,
- vface->vvert2->co, vface->no);
-
- /* calculate vertex normals ... it is averadge of all face normals using the vertex */
- add_v3_v3v3(vface->vvert0->no, vface->vvert0->no, vface->no);
- add_v3_v3v3(vface->vvert1->no, vface->vvert1->no, vface->no);
- add_v3_v3v3(vface->vvert2->no, vface->vvert2->no, vface->no);
-
- vface = vface->next;
- }
-
- /* we have to normalize all vertex normals */
- vvert = vert_layer->dl.lb.first;
- while(vvert) {
- normalize_v3(vvert->no);
- vvert = vvert->next;
- }
-}
-
-/*
- * add created item to the queue and send it if possible
- */
-void add_item_to_send_queue(ListBase *lb, void *item, short type)
-{
- struct VNode *vnode;
- struct VLayer *vlayer;
- struct VerseVert *vvert;
- struct VerseFace *vface;
-
- /* this prevent from adding duplicated faces */
- if(type==VERSE_FACE) {
- struct Link *link = (Link*)lb->first;
- while(link) {
- if(link==item) {
- if(((VerseFace*)item)->flag & FACE_SENT) {
-/* printf("\tverse face %d marked as OBSOLETE\n", ((VerseFace*)item)->id);*/
- ((VerseFace*)item)->flag |= FACE_OBSOLETE;
- }
- return;
- }
- link = link->next;
- }
- }
-
- /* add item to sending queue (two way dynamic list) */
- BLI_addtail(lb, item);
-
- /* send item, when it is possible */
- switch (type) {
- case VERSE_NODE: /* only first node in queue can be sent */
- if(lb->first==lb->last)
- send_verse_node((VNode*)item);
- break;
- case VERSE_LINK: /* both object between have to exist */
- if(((VLink*)item)->flag & LINK_SEND_READY)
- send_verse_link((VLink*)item);
- break;
- case VERSE_LAYER:
- if(((VLayer*)item)->vnode->flag & NODE_RECEIVED)
- send_verse_layer((VLayer*)item);
- break;
- case VERSE_VERT:
- if(((VerseVert*)item)->vlayer->flag & LAYER_RECEIVED)
- send_verse_vertex((VerseVert*)item);
- break;
- case VERSE_FACE: /* all vertexes of face have to be received */
- if(((VerseFace*)item)->flag & FACE_SEND_READY)
- send_verse_face((VerseFace*)item);
- break;
- case VERSE_TAG:
- send_verse_tag((VTag*)item);
- break;
- case VERSE_TAG_GROUP:
- send_verse_taggroup((VTagGroup*)item);
- break;
- case VERSE_VERT_UINT32: /* parent item has to exist */
- vnode = (((uint32_item*)item)->vlayer)->vnode;
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), 0 );
- vvert = (VerseVert*)BLI_dlist_find_link(&(vlayer->dl), ((uint32_item*)item)->id );
- if(vvert != NULL)
- send_verse_vert_uint32((uint32_item*)item, type);
- break;
- case VERSE_VERT_REAL32: /* parent item has to exist */
- vnode = (((real32_item*)item)->vlayer)->vnode;
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), 0 );
- vvert = (VerseVert*)BLI_dlist_find_link(&(vlayer->dl), ((real32_item*)item)->id );
- if( vvert != NULL)
- send_verse_vert_real32((real32_item*)item, type);
- break;
- case VERSE_VERT_VEC_REAL32: /* parent item has to exist */
- vnode = (((vec_real32_item*)item)->vlayer)->vnode;
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), 0 );
- vvert = (VerseVert*)BLI_dlist_find_link(&(vlayer->dl), ((vec_real32_item*)item)->id );
- if(vvert != NULL)
- send_verse_vert_vec_real32((vec_real32_item*)item, type);
- break;
- case VERSE_FACE_UINT8: /* parent item has to exist */
- vnode = (((uint8_item*)item)->vlayer)->vnode;
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), 1 );
- vface = (VerseFace*)BLI_dlist_find_link(&(vlayer->dl), ((uint8_item*)item)->id );
- if(vface != NULL)
- send_verse_face_uint8((uint8_item*)item, type);
- break;
- case VERSE_FACE_UINT32: /* parent item has to exist */
- vnode = (((uint32_item*)item)->vlayer)->vnode;
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), 1 );
- vface = (VerseFace*)BLI_dlist_find_link(&(vlayer->dl), ((uint32_item*)item)->id );
- if(vface != NULL)
- send_verse_face_uint32((uint32_item*)item, type);
- break;
- case VERSE_FACE_REAL32: /* parent item has to exist */
- vnode = (((real32_item*)item)->vlayer)->vnode;
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), 1 );
- vface = (VerseFace*)BLI_dlist_find_link(&(vlayer->dl), ((real32_item*)item)->id );
- if(vface != NULL)
- send_verse_face_real32((real32_item*)item, type);
- break;
- case VERSE_FACE_QUAT_UINT32: /* parent item has to exist */
- vnode = (((quat_uint32_item*)item)->vlayer)->vnode;
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), 1 );
- vface = (VerseFace*)BLI_dlist_find_link(&(vlayer->dl), ((quat_uint32_item*)item)->id );
- if(vface != NULL)
- send_verse_face_corner_quat_uint32((quat_uint32_item*)item, type);
- break;
- case VERSE_FACE_QUAT_REAL32: /* parent item has to exist */
- vnode = (((quat_real32_item*)item)->vlayer)->vnode;
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), 1 );
- vface = (VerseFace*)BLI_dlist_find_link(&(vlayer->dl), ((quat_real32_item*)item)->id );
- if(vface != NULL)
- send_verse_face_corner_quat_real32((quat_real32_item*)item, type);
- break;
- }
-}
-
-/*
- * return VerseLayer with certain content (vertexes, polygons, in the
- * future: weight, red color, etc.)
- */
-VLayer* find_verse_layer_type(VGeomData *geom, short content)
-{
- struct VLayer *vlayer = NULL;
-
- switch(content) {
- case VERTEX_LAYER:
- /* VERTEX_LAYER equals 0 and vertex layer is
- * always in 1st layer */
- vlayer = geom->layers.da.items[VERTEX_LAYER];
- break;
- case POLYGON_LAYER:
- /* POLYGON_LAYER equals 1 and vertex layer is
- * always in 2nd layer */
- vlayer = geom->layers.da.items[POLYGON_LAYER];
- break;
- }
-
- return vlayer;
-}
-
-/*
- * increase references of VerseVerts of new VerseFace
- */
-static void increase_verse_verts_references(VerseFace *vface)
-{
- if(vface->vvert0) vface->vvert0->counter++;
- if(vface->vvert1) vface->vvert1->counter++;
- if(vface->vvert2) vface->vvert2->counter++;
- if(vface->vvert3) vface->vvert3->counter++;
-}
-
-/*
- * move VerseFace from list of orphans to dlist of VerseFaces (if VerseFace was only changed
- * then this VerseFace is only removed from list of orphans)
- */
-static void move_face_orphan_to_dlist(VNode *vnode, VLayer *vlayer, VerseFace *vface)
-{
- /* remove vface from list of orphans */
- BLI_remlink(&(vlayer->orphans), vface);
- /* increase references of all vertexes beying part of this face*/
- increase_verse_verts_references(vface);
-
- if(vface->flag & FACE_RECEIVED) {
- /* set up vface flag */
- vface->flag &= ~FACE_RECEIVED;
- /* move vface to dynamic list of faces */
- BLI_dlist_add_item_index(&(vlayer->dl), (void*)vface, vface->id);
- /* recalculate all vertex and faces normals */
- recalculate_verseface_normals(vnode);
- /* post create action (change local data) */
- ((VGeomData*)vnode->data)->post_polygon_create(vface);
- }
- else if(vface->flag & FACE_CHANGED) {
- /* set up vface flag */
- vface->flag &= ~FACE_CHANGED;
- /* move vface to dynamic list of faces */
- BLI_dlist_add_item_index(&(vlayer->dl), (void*)vface, vface->id);
- /* recalculate all vertex and faces normals */
- recalculate_verseface_normals(vnode);
- /* post create action (change local data) */
- ((VGeomData*)vnode->data)->post_polygon_set_corner(vface);
- }
-}
-
-/*
- * find all VerseFaces waiting in queue, which needs id of new VerseVert
- */
-static void find_unsent_faces(VNode *vnode, VerseVert *vvert)
-{
- VLayer *vlayer;
- VerseFace *vface, *next_vface;
-
- vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
-
- if(vlayer) {
- vface = vlayer->queue.first;
- while(vface) {
- next_vface = vface->next;
- if(vface->vvert0==vvert) {
- vface->v0 = vvert->id;
- vface->counter--;
- }
- else if(vface->vvert1==vvert) {
- vface->v1 = vvert->id;
- vface->counter--;
- }
- else if(vface->vvert2==vvert) {
- vface->v2 = vvert->id;
- vface->counter--;
- }
- else if(vface->vvert3==vvert){
- vface->v3 = vvert->id;
- vface->counter--;
- }
-
- if(vface->counter<1 && !(vface->flag & FACE_SENT))
- send_verse_face(vface);
-
- vface = next_vface;
- }
- }
-}
-
-/*
- * find all VerseFace orphans, which needs incoming VerseVert
- */
-static void find_vlayer_orphans(VNode *vnode, VerseVert *vvert)
-{
- VLayer *vlayer;
- VerseFace *vface, *next_vface;
- unsigned int vertex_id = vvert->id;
-
- vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
-
- if(vlayer) {
- vface = vlayer->orphans.first;
- while(vface){
- next_vface = vface->next;
- if(vface->v0 == vertex_id) {
- vface->vvert0 = vvert;
- vface->counter--;
- }
- else if(vface->v1 == vertex_id) {
- vface->vvert1 = vvert;
- vface->counter--;
- }
- else if(vface->v2 == vertex_id) {
- vface->vvert2 = vvert;
- vface->counter--;
- }
- else if(vface->v3 == vertex_id) {
- vface->vvert3 = vvert;
- vface->counter--;
- }
- if(vface->counter<1) {
- /* moving VerseFace orphan to dlist */
- move_face_orphan_to_dlist(vnode, vlayer, vface);
- }
- vface = next_vface;
- }
- }
-}
-
-/*
- * return number of VerseVerts missing to incoming VerseFace, set up pointers
- * at VerseVerts
- */
-static unsigned short test_incoming_verseface(VGeomData *geom, VerseFace *vface)
-{
- struct VLayer *vert_layer;
- struct VerseVert *vvert;
- int counter=0;
-
- vert_layer = find_verse_layer_type(geom, VERTEX_LAYER);
-
- if(vface->v0 != -1){
- vvert = BLI_dlist_find_link(&(vert_layer->dl), vface->v0);
- if(vvert==NULL) counter++;
- else vface->vvert0 = vvert;
- }
- if(vface->v1 != -1){
- vvert = BLI_dlist_find_link(&(vert_layer->dl), vface->v1);
- if(vvert==NULL) counter++;
- else vface->vvert1 = vvert;
- }
- if(vface->v2 != -1){
- vvert = BLI_dlist_find_link(&(vert_layer->dl), vface->v2);
- if(vvert==NULL) counter++;
- else vface->vvert2 = vvert;
- }
- if(vface->v3 != -1){
- vvert = BLI_dlist_find_link(&(vert_layer->dl), vface->v3);
- if(vvert==NULL) counter++;
- else vface->vvert3 = vvert;
- }
-
- return counter;
-}
-
-/*
- * try to find changed VerseFace in sending queue
- */
-static VerseFace* find_changed_verse_face_in_queue(VLayer *vlayer, uint32 polygon_id)
-{
- struct VerseFace *vface = vlayer->queue.first;
-
- while(vface){
- if(vface->id == polygon_id && vface->flag & FACE_CHANGED) {
- return vface;
- }
- vface = vface->next;
- }
- return NULL;
-}
-
-/*
- * try to find VerseFace in queue
- */
-static VerseFace* find_verse_face_in_queue(
- VLayer *vlayer,
- VNodeID node_id,
- uint32 polygon_id,
- uint32 v0,
- uint32 v1,
- uint32 v2,
- uint32 v3)
-{
- struct VerseFace *vface = vlayer->queue.first;
-
- while(vface){
- if((vface->v0==v0) && (vface->v1==v1) && (vface->v2==v2) && (vface->v3==v3)){
- vface->id = polygon_id;
- vface->vlayer = vlayer;
- return vface;
- }
- vface = vface->next;
- }
- return NULL;
-}
-
-/*
- * try to find VerseVert in queue
- */
-static VerseVert* find_verse_vert_in_queue(
- VLayer *vlayer,
- VNodeID node_id,
- uint32 vertex_id,
- real32 x,
- real32 y,
- real32 z)
-{
- struct VerseVert *vvert = vlayer->queue.first;
-
- while(vvert){
- if((vvert->vlayer->vnode->id == node_id) && (vvert->co[0] == x) && (vvert->co[1] == y) && (vvert->co[2] == z))
- {
- vvert->id = vertex_id;
- vvert->vlayer = vlayer;
-
- return vvert;
- }
- vvert = vvert->next;
- }
-
- return NULL;
-}
-
-
-/*
- * send quat of float values to verse server (4x32 bits)
- */
-void send_verse_face_corner_quat_real32(quat_real32_item *item, short type)
-{
- verse_send_g_polygon_set_corner_real32(
- item->vlayer->vnode->id,
- item->vlayer->id,
- item->id,
- item->value[0],
- item->value[1],
- item->value[2],
- item->value[3]);
-}
-
-/*
- * send quat of unsigned int values to verse server (4x32 bits)
- */
-void send_verse_face_corner_quat_uint32(quat_uint32_item *item, short type)
-{
- verse_send_g_polygon_set_corner_uint32(
- item->vlayer->vnode->id,
- item->vlayer->id,
- item->id,
- item->value[0],
- item->value[1],
- item->value[2],
- item->value[3]);
-}
-
-/*
- * send float value (32 bits) to verse server
- */
-void send_verse_face_real32(real32_item *item, short type)
-{
- verse_send_g_polygon_set_face_real32(
- item->vlayer->vnode->id,
- item->vlayer->id,
- item->id,
- item->value);
-}
-
-/*
- * send unsigned integer (32 bits) to verse server
- */
-void send_verse_face_uint32(uint32_item *item, short type)
-{
- verse_send_g_polygon_set_face_uint32(
- item->vlayer->vnode->id,
- item->vlayer->id,
- item->id,
- item->value);
-}
-
-/*
- * send unsigned char (8 bits) to verse server
- */
-void send_verse_face_uint8(uint8_item *item, short type)
-{
- verse_send_g_polygon_set_face_uint8(
- item->vlayer->vnode->id,
- item->vlayer->id,
- item->id,
- item->value);
-}
-
-/*
- * send vector of float values to verse server (3x32 bits)
- */
-void send_verse_vert_vec_real32(vec_real32_item *item, short type)
-{
- verse_send_g_vertex_set_xyz_real32(
- item->vlayer->vnode->id,
- item->vlayer->id,
- item->id,
- item->value[0],
- item->value[1],
- item->value[2]);
-}
-
-/*
- * send float value (32 bits) to verse server
- */
-void send_verse_vert_real32(real32_item *item, short type)
-{
- verse_send_g_vertex_set_real32(
- item->vlayer->vnode->id,
- item->vlayer->id,
- item->id,
- item->value);
-}
-
-/*
- * send unsigned integer (32 bits) to verse server
- */
-void send_verse_vert_uint32(uint32_item *item, short type)
-{
- verse_send_g_vertex_set_uint32(
- item->vlayer->vnode->id,
- item->vlayer->id,
- item->id,
- item->value);
-}
-
-/*
- * send delete command to verse server
- */
-void send_verse_vertex_delete(VerseVert *vvert)
-{
- verse_session_set(vvert->vlayer->vnode->session->vsession);
-
- vvert->flag |= VERT_OBSOLETE;
-
- verse_send_g_vertex_delete_real32(vvert->vlayer->vnode->id, vvert->id);
-}
-
-/*
- * send VerseLayer to verse server
- */
-void send_verse_layer(VLayer *vlayer)
-{
- verse_session_set(vlayer->vnode->session->vsession);
-
- verse_send_g_layer_create(
- vlayer->vnode->id,
- vlayer->id,
- vlayer->name,
- vlayer->type,
- vlayer->def_int,
- vlayer->def_real);
-}
-
-/*
- * send VerseVert to verse server
- */
-void send_verse_vertex(VerseVert *vvert)
-{
- /* new vertex position will not be sent, when vertex was deleted */
- if(vvert->flag & VERT_OBSOLETE) return;
-
- verse_session_set(vvert->vlayer->vnode->session->vsession);
-
- verse_send_g_vertex_set_xyz_real32(
- vvert->vlayer->vnode->id,
- vvert->vlayer->id,
- vvert->id,
- vvert->co[0],
- vvert->co[2],
- -vvert->co[1]);
-}
-
-/*
- * send delete command to verse server
- */
-void send_verse_face_delete(VerseFace *vface)
-{
- verse_session_set(vface->vlayer->vnode->session->vsession);
-
- vface->flag |= FACE_DELETED;
-
- verse_send_g_polygon_delete(vface->vlayer->vnode->id, vface->id);
-}
-
-/*
- * send VerseFace to verse server
- */
-static void send_verse_face(VerseFace *vface)
-{
- verse_session_set(vface->vlayer->vnode->session->vsession);
-
- vface->flag |= FACE_SENT;
-
- if(vface->v3 != -1) {
- verse_send_g_polygon_set_corner_uint32(
- vface->vlayer->vnode->id,
- vface->vlayer->id,
- vface->id,
- vface->v0,
- vface->v3, /* verse use clock-wise winding */
- vface->v2,
- vface->v1); /* verse use clock-wise winding */
- }
- else {
- verse_send_g_polygon_set_corner_uint32(
- vface->vlayer->vnode->id,
- vface->vlayer->id,
- vface->id,
- vface->v0,
- vface->v2, /* verse use clock-wise winding */
- vface->v1, /* verse use clock-wise winding */
- vface->v3);
- }
-}
-
-/*
- * free VerseVert
- */
-static void free_verse_vertex(VLayer *vlayer, VerseVert *vvert)
-{
- /* free VerseVert */
- BLI_freelinkN(&(vlayer->orphans), vvert);
-}
-
-/*
- * free VerseFace (and blender face)
- */
-static void free_verse_face(VLayer *vlayer, VerseFace *vface)
-{
- /* free VerseFace */
- BLI_dlist_free_item(&(vlayer->dl), (unsigned int)vface->id);
-}
-
-/*
- * free VerseLayer data
- */
-static void free_verse_layer_data(VNode *vnode, VLayer *vlayer)
-{
- struct VerseFace *vface;
- struct VerseVert *vvert;
-
- /* set up EditVert->vvert and EditFace->vface pointers to NULL */
- switch(vlayer->content) {
- case VERTEX_LAYER:
- vvert = (VerseVert*)vlayer->dl.lb.first;
- while(vvert) {
- ((VGeomData*)vnode->data)->post_vertex_free_constraint(vvert);
- vvert = vvert->next;
- }
- break;
- case POLYGON_LAYER:
- vface = (VerseFace*)vlayer->dl.lb.first;
- while(vface) {
- ((VGeomData*)vnode->data)->post_polygon_free_constraint(vface);
- vface = vface->next;
- }
- break;
- default:
- break;
- }
- /* free Verse Layer name */
- MEM_freeN(vlayer->name);
- /* destroy VerseLayer data (vertexes, polygons, etc.) */
- BLI_dlist_destroy(&(vlayer->dl));
- /* free unsent data */
- BLI_freelistN(&(vlayer->queue));
- /* free orphans */
- BLI_freelistN(&(vlayer->orphans));
-}
-
-/*
- * free all unneeded VerseVerts waiting for deleting
- */
-static void free_unneeded_verseverts_of_verseface(VNode *vnode, VerseFace *vface)
-{
- struct VLayer *vert_vlayer;
-
- /* find layer containing vertexes */
- vert_vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
-
- /* free all "deleted" VerseVert waiting for deleting this VerseFace */
-
- if((vface->vvert0->counter < 1) && (vface->vvert0->flag & VERT_DELETED)) {
- ((VGeomData*)vnode->data)->post_vertex_delete(vface->vvert0);
- free_verse_vertex(vert_vlayer, vface->vvert0);
- vface->vvert0 = NULL;
- }
- if((vface->vvert1->counter < 1) && (vface->vvert1->flag & VERT_DELETED)) {
- ((VGeomData*)vnode->data)->post_vertex_delete(vface->vvert1);
- free_verse_vertex(vert_vlayer, vface->vvert1);
- vface->vvert1 = NULL;
- }
- if((vface->vvert2->counter < 1) && (vface->vvert2->flag & VERT_DELETED)) {
- ((VGeomData*)vnode->data)->post_vertex_delete(vface->vvert2);
- free_verse_vertex(vert_vlayer, vface->vvert2);
- vface->vvert2 = NULL;
- }
- if((vface->vvert3) && (vface->vvert3->counter < 1) && (vface->vvert3->flag & VERT_DELETED)) {
- ((VGeomData*)vnode->data)->post_vertex_delete(vface->vvert3);
- free_verse_vertex(vert_vlayer, vface->vvert3);
- vface->vvert3 = NULL;
- }
-}
-
-/*
- * This function create VerseVert and returns pointer on this vertex
- */
-VerseVert* create_verse_vertex(
- VLayer *vlayer,
- uint32 vertex_id,
- real32 x,
- real32 y,
- real32 z)
-{
- struct VerseVert *vvert;
-
- vvert = (VerseVert*)MEM_mallocN(sizeof(VerseVert), "VerseVert");
-
- /* set up pointer on parent node */
- vvert->vlayer = vlayer;
- vvert->id = vertex_id;
- /* position */
- vvert->co[0] = x;
- vvert->co[1] = y;
- vvert->co[2] = z;
- /* normal */
- vvert->no[0] = vvert->no[1] = vvert->no[2] = 0.0;
- /* blender internals */
- vvert->flag = 0;
- vvert->counter = 0;
- vvert->vertex = NULL;
-
- /* increase layer counter of vertexes */
- vlayer->counter++;
-
- return vvert;
-}
-
-/*
- * this function creates fake VerseEdge and returns pointer at this edge
- */
-VerseEdge *create_verse_edge(uint32 v0, uint32 v1)
-{
- struct VerseEdge *vedge;
-
- vedge = (VerseEdge*)MEM_mallocN(sizeof(VerseEdge), "VerseEdge");
-
- vedge->v0 = v0;
- vedge->v1 = v1;
- vedge->counter = 0;
-
- return vedge;
-}
-
-/*
- * this function will create new VerseFace and will return pointer on such Face
- */
-VerseFace* create_verse_face(
- VLayer *vlayer,
- uint32 polygon_id,
- uint32 v0,
- uint32 v1,
- uint32 v2,
- uint32 v3)
-{
- struct VerseFace *vface;
-
- vface = (VerseFace*)MEM_mallocN(sizeof(VerseFace), "VerseFace");
-
- /* verse data */
- vface->vlayer = vlayer;
- vface->id = polygon_id;
-
- vface->vvert0 = NULL;
- vface->vvert1 = NULL;
- vface->vvert2 = NULL;
- vface->vvert3 = NULL;
-
- vface->v0 = v0;
- vface->v1 = v1;
- vface->v2 = v2;
- vface->v3 = v3;
-
- /* blender data */
- vface->face = NULL;
- vface->flag = 0;
- vface->counter = 4;
-
- /* increase layer counter of faces */
- vlayer->counter++;
-
- return vface;
-}
-
-/*
- * create and return VerseLayer
- */
-VLayer *create_verse_layer(
- VNode *vnode,
- VLayerID layer_id,
- const char *name,
- VNGLayerType type,
- uint32 def_integer,
- real64 def_real)
-{
- struct VLayer *vlayer;
-
- /* add layer to the DynamicList */
- vlayer = (VLayer*)MEM_mallocN(sizeof(VLayer), "VerseLayer");
-
- /* store all relevant info to the vlayer and set up vlayer */
- vlayer->vnode = vnode;
- vlayer->id = layer_id;
- vlayer->name = (char*)MEM_mallocN(sizeof(char)*(sizeof(name)+1),"Verse Layer name");
- strcpy(vlayer->name, name);
- vlayer->type = type;
- vlayer->def_int = def_integer;
- vlayer->def_real = def_real;
-
- if((type == VN_G_LAYER_VERTEX_XYZ) && (layer_id == 0))
- vlayer->content = VERTEX_LAYER;
- else if((type == VN_G_LAYER_POLYGON_CORNER_UINT32) && (layer_id == 1))
- vlayer->content = POLYGON_LAYER;
- else
- vlayer->content = -1;
-
- /* initialize DynamicList in the vlayer (vertexes, polygons, etc.)*/
- BLI_dlist_init(&(vlayer->dl));
- /* initialization of queue of layer */
- vlayer->queue.first = vlayer->queue.last = NULL;
- /* initialization of list of orphans */
- vlayer->orphans.first = vlayer->orphans.last = NULL;
- /* initialize number of sent items (vertexes, faces, etc) */
- vlayer->counter = 0;
- /* initialize flag */
- vlayer->flag = 0;
-
- /* set up methods */
- vlayer->post_layer_create = post_layer_create;
- vlayer->post_layer_destroy = post_layer_destroy;
-
- return vlayer;
-}
-
-/*
- * create geometry data
- */
-VGeomData *create_geometry_data(void)
-{
- struct VGeomData *geom;
-
- geom = (VGeomData*)MEM_mallocN(sizeof(VGeomData), "VerseGeometryData");
- BLI_dlist_init(&(geom->layers));
- geom->vlink = NULL;
- geom->queue.first = geom->queue.last = NULL;
- geom->mesh = NULL;
- geom->editmesh = NULL;
-
- /* initialize list of fake verse edges and initialize verse edge hash */
- geom->edges.first = geom->edges.last = NULL;
- geom->hash = MEM_callocN(VEDHASHSIZE*sizeof(HashVerseEdge), "verse hashedge tab");
-
- /* set up methods */
- geom->post_vertex_create = post_vertex_create;
- geom->post_vertex_set_xyz = post_vertex_set_xyz;
- geom->post_vertex_delete = post_vertex_delete;
- geom->post_vertex_free_constraint = post_vertex_free_constraint;
- geom->post_polygon_create = post_polygon_create;
- geom->post_polygon_set_corner = post_polygon_set_corner;
- geom->post_polygon_delete = post_polygon_delete;
- geom->post_polygon_free_constraint = post_polygon_free_constraint;
- geom->post_geometry_free_constraint = post_geometry_free_constraint;
- geom->post_polygon_set_uint8 = post_polygon_set_uint8;
-
- return geom;
-}
-
-/* Create item containing 4 floats */
-static quat_real32_item *create_quat_real32_item(
- VLayer *vlayer,
- uint32 item_id,
- real32 v0,
- real32 v1,
- real32 v2,
- real32 v3)
-{
- struct quat_real32_item *item;
-
- item = (quat_real32_item*)MEM_mallocN(sizeof(quat_real32_item), "quat_real32_item");
-
- item->vlayer = vlayer;
- item->id = item_id;
- item->value[0] = v0;
- item->value[1] = v1;
- item->value[2] = v2;
- item->value[3] = v3;
-
- return item;
-}
-
-/* Create item containing 1 float */
-static real32_item *create_real32_item(VLayer *vlayer, uint32 item_id, real32 value)
-{
- struct real32_item *item;
-
- item = (real32_item*)MEM_mallocN(sizeof(real32_item), "real32_item");
-
- item->vlayer = vlayer;
- item->id = item_id;
- item->value = value;
-
- return item;
-}
-
-/* Create item containing 1 integer */
-static uint32_item *create_uint32_item(VLayer *vlayer, uint32 item_id, uint32 value)
-{
- struct uint32_item *item;
-
- item = (uint32_item*)MEM_mallocN(sizeof(uint32_item), "uint32_item");
-
- item->vlayer = vlayer;
- item->id = item_id;
- item->value = value;
-
- return item;
-}
-
-/* Create item containing 1 byte */
-static uint8_item *create_uint8_item(VLayer *vlayer, uint32 item_id, uint8 value)
-{
- struct uint8_item *item;
-
- item = (uint8_item*)MEM_mallocN(sizeof(uint8_item), "uint8_item");
-
- item->vlayer = vlayer;
- item->id = item_id;
- item->value = value;
-
- return item;
-}
-
-/*
- * callback function: vertex crease was set
- */
-static void cb_g_crease_set_vertex(
- void *user_data,
- VNodeID node_id,
- const char *layer,
- uint32 def_crease)
-{
-}
-
-/*
- * we have to test corretness of incoming data from verse server
- * no two vertexes can have the same index
- */
-static char test_polygon_set_corner_uint32(
- uint32 v0,
- uint32 v1,
- uint32 v2,
- uint32 v3)
-{
- if((v0==v1) || (v0==v2) || (v0==v3) || (v1==v2) || (v1==v3) || (v2==v3))
- return 0;
- else
- return 1;
-}
-
-/*
- * try to find verse layer in sending queue of verse geometry node
- */
-static VLayer *find_vlayer_in_sending_queue(VNode *vnode, VLayerID layer_id)
-{
- struct VLayer *vlayer;
-
- /* try to find verse layyer in sending queue */
- vlayer = ((VGeomData*)vnode->data)->queue.first;
- while(vlayer) {
- if(vlayer->id==layer_id) return vlayer;
- vlayer = vlayer->next;
- }
-
- return NULL;
-}
-
-/*
- * this function will find edge in hash table, hash function isn't too optimal (it needs
- * lot of memory for every verse node), but it works without any bug
- */
-static VerseEdge* find_verse_edge(VNode *vnode, uint32 v0, uint32 v1)
-{
- struct HashVerseEdge *hve;
-
- if(((VGeomData*)vnode->data)->hash==NULL)
- ((VGeomData*)vnode->data)->hash = MEM_callocN(VEDHASHSIZE*sizeof(HashVerseEdge), "verse hashedge tab");
-
- hve = ((VGeomData*)vnode->data)->hash + VEDHASH(v0, v1);;
- while(hve) {
- /* edge v0---v1 is the same edge as v1---v0 */
- if(hve->vedge && ((hve->vedge->v0==v0 && hve->vedge->v1==v1) || (hve->vedge->v0==v1 && hve->vedge->v1==v0))) return hve->vedge;
- hve = hve->next;
- }
-
- return NULL;
-}
-
-/*
- * insert hash of verse edge to hash table
- */
-static void insert_verse_edgehash(VNode *vnode, VerseEdge *vedge)
-{
- struct HashVerseEdge *first, *hve;
-
- if(((VGeomData*)vnode->data)->hash==NULL)
- ((VGeomData*)vnode->data)->hash = MEM_callocN(VEDHASHSIZE*sizeof(HashVerseEdge), "verse hashedge tab");
-
- first = ((VGeomData*)vnode->data)->hash + VEDHASH(vedge->v0, vedge->v1);
-
- if(first->vedge==NULL) {
- first->vedge = vedge;
- }
- else {
- hve = &(vedge->hash);
- hve->vedge = vedge;
- hve->next = first->next;
- first->next = hve;
- }
-}
-
-/*
- * remove hash of verse edge from hash table
- */
-static void remove_verse_edgehash(VNode *vnode, VerseEdge *vedge)
-{
- struct HashVerseEdge *first, *hve, *prev;
-
- hve = first = ((VGeomData*)vnode->data)->hash + VEDHASH(vedge->v0, vedge->v1);
-
- while(hve) {
- if(hve->vedge == vedge) {
- if(hve==first) {
- if(first->next) {
- hve = first->next;
- first->vedge = hve->vedge;
- first->next = hve->next;
- }
- else {
- hve->vedge = NULL;
- }
- }
- else {
- prev->next = hve->next;
- }
- return;
- }
- prev = hve;
- hve = hve->next;
- }
-}
-
-/*
- * this function will try to remove existing fake verse edge, when this verse
- * edge is still used by some faces, then counter will be only decremented
- */
-static void remove_verse_edge(VNode *vnode, uint32 v0, uint32 v1)
-{
- struct VerseEdge *vedge;
-
- vedge = find_verse_edge(vnode, v0, v1);
- if(vedge) {
- vedge->counter--;
- if(vedge->counter==0) {
- remove_verse_edgehash(vnode, vedge);
- BLI_freelinkN(&(((VGeomData*)vnode->data)->edges), vedge);
- }
- }
- else {
- printf("error: remove_verse_edge %d, %d\n", v0, v1);
- }
-}
-
-/*
- * this function will try to add new fake verse edge, when no such edge exist,
- * when such edge exist, then only counter of edge will be incremented
- */
-static void add_verse_edge(VNode *vnode, uint32 v0, uint32 v1)
-{
- struct VerseEdge *vedge;
-
- vedge = find_verse_edge(vnode, v0, v1);
- if(!vedge) {
- if(v0!=v1) {
- vedge = create_verse_edge(v0, v1);
- BLI_addtail(&(((VGeomData*)vnode->data)->edges), vedge);
- insert_verse_edgehash(vnode, vedge);
- }
- else {
- printf("error:add_verse_edge: %d, %d\n", v0, v1);
- return;
- }
- }
- vedge->counter++;
-}
-
-/*
- * verse face was deleted ... update edge hash
- */
-static void update_edgehash_of_deleted_verseface(VNode *vnode, VerseFace *vface)
-{
- uint32 v0, v1, v2, v3; /* verse vertex indexes of deleted verse face */
-
- v0 = vface->vvert0->id;
- v1 = vface->vvert1->id;
- v2 = vface->vvert2->id;
- v3 = vface->vvert3 ? vface->vvert3->id : -1;
-
- remove_verse_edge(vnode, v0, v1);
- remove_verse_edge(vnode, v1, v2);
- if(v3!=-1) {
- remove_verse_edge(vnode, v2, v3);
- remove_verse_edge(vnode, v3, v0);
- }
- else {
- remove_verse_edge(vnode, v2, v0);
- }
-}
-
-/*
- * existing verse face was changed ... update edge hash
- */
-static void update_edgehash_of_changed_verseface(
- VNode *vnode,
- VerseFace *vface,
- uint32 v0,
- uint32 v1,
- uint32 v2,
- uint32 v3)
-{
- uint32 ov0, ov1, ov2, ov3; /* old indexes at verse vertexes*/
-
- ov0 = vface->vvert0->id;
- ov1 = vface->vvert1->id;
- ov2 = vface->vvert2->id;
- ov3 = vface->vvert3 ? vface->vvert3->id : -1;
-
- /* 1st edge */
- if(v0!=ov0 || v1!=ov1) {
- remove_verse_edge(vnode, ov0, ov1);
- add_verse_edge(vnode, v0, v1);
- }
-
- /* 2nd edge */
- if(v1!=ov1 || v2!=ov2) {
- remove_verse_edge(vnode, ov1, ov2);
- add_verse_edge(vnode, v1, v2);
- }
-
- /* 3rd edge */
- if(v2!=ov2 || v3!=ov3 || v0!=ov0) {
- if(ov3!=-1) {
- remove_verse_edge(vnode, ov2, ov3);
- if(v3!=-1) {
- add_verse_edge(vnode, v2, v3); /* new 3rd edge (quat->quat) */
- }
- else {
- remove_verse_edge(vnode, ov3, ov0); /* old edge v3,v0 of quat have to be removed */
- add_verse_edge(vnode, v2, v0); /* new 3rd edge (quat->triangle) */
- }
- }
- else {
- remove_verse_edge(vnode, ov2, ov0);
- if(v3!=-1) {
- add_verse_edge(vnode, v2, v3); /* new 3rd edge (triangle->quat) */
- }
- else {
- add_verse_edge(vnode, v2, v0); /* new 3rd edge (triangle->triangle) */
- }
- }
- }
-
- /* 4th edge */
- if(v3!=-1 && (v3!=ov3 || v0!=ov0)) {
- remove_verse_edge(vnode, ov3, ov0);
- add_verse_edge(vnode, v3, v0);
- }
-}
-
-/*
- * new verse face was created ... update list of edges and edge has
- */
-static void update_edgehash_of_new_verseface(
- VNode *vnode,
- uint32 v0,
- uint32 v1,
- uint32 v2,
- uint32 v3)
-{
- /* when edge already exists, then only its counter is incremented,
- * look at commentary of add_verse_edge() function */
- add_verse_edge(vnode, v0, v1);
- add_verse_edge(vnode, v1, v2);
- if(v3!=-1) {
- add_verse_edge(vnode, v2, v3);
- add_verse_edge(vnode, v3, v0);
- }
- else {
- add_verse_edge(vnode, v2, v0);
- }
-}
-
-/*
- * callback function: edge crease was set
- */
-static void cb_g_crease_set_edge(
- void *user_data,
- VNodeID node_id,
- const char *layer,
- uint32 def_crease)
-{
-}
-
-/*
- * callback function: float value for polygon was set up
- */
-static void cb_g_polygon_set_face_real32(
- void *user_def,
- VNodeID node_id,
- VLayerID layer_id,
- uint32 polygon_id,
- real32 value)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VLayer *vlayer;
- struct real32_item *item;
-
- if(!session) return;
-
- /* find needed node (we can be sure, that it is geometry node) */
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- /* find layer containing uint_8 data */
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), (unsigned int)layer_id);
-
- /* try to find item*/
- item = BLI_dlist_find_link(&(vlayer->dl), polygon_id);
-
- if(item) {
- item->value = value;
- }
- else {
- item = create_real32_item(vlayer, polygon_id, value);
- BLI_dlist_add_item_index(&(vlayer->dl), item, item->id);
- }
-}
-
-/*
- * callback function: int values for polygon was set up
- */
-static void cb_g_polygon_set_face_uint32(
- void *user_def,
- VNodeID node_id,
- VLayerID layer_id,
- uint32 polygon_id,
- uint32 value)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VLayer *vlayer;
- struct uint32_item *item;
-
- if(!session) return;
-
- /* find needed node (we can be sure, that it is geometry node) */
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- /* find layer containing uint_8 data */
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), (unsigned int)layer_id);
-
- /* try to find item*/
- item = BLI_dlist_find_link(&(vlayer->dl), polygon_id);
-
- if(item) {
- item->value = value;
- }
- else {
- item = create_uint32_item(vlayer, polygon_id, value);
- BLI_dlist_add_item_index(&(vlayer->dl), item, item->id);
- }
-}
-
-/*
- * callback function: uint8 value for polygon was set up
- */
-static void cb_g_polygon_set_face_uint8(
- void *user_def,
- VNodeID node_id,
- VLayerID layer_id,
- uint32 polygon_id,
- uint8 value)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VLayer *vlayer;
- struct uint8_item *item;
-
- if(!session) return;
-
- /* find needed node (we can be sure, that it is geometry node) */
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- /* find layer containing uint_8 data */
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), (unsigned int)layer_id);
-
- /* try to find item*/
- item = BLI_dlist_find_link(&(vlayer->dl), polygon_id);
-
- if(item) {
- item->value = value;
- }
- else {
- item = create_uint8_item(vlayer, polygon_id, value);
- BLI_dlist_add_item_index(&(vlayer->dl), item, item->id);
- }
-}
-
-/*
- * callback function: float value for polygon corner was set up
- */
-static void cb_g_polygon_set_corner_real32(
- void *user_def,
- VNodeID node_id,
- VLayerID layer_id,
- uint32 polygon_id,
- real32 v0,
- real32 v1,
- real32 v2,
- real32 v3)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VLayer *vlayer;
- struct quat_real32_item *item;
-
- if(!session) return;
-
- /* find needed node (we can be sure, that it is geometry node) */
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- /* find layer containing uint_8 data */
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), (unsigned int)layer_id);
-
- /* try to find item*/
- item = BLI_dlist_find_link(&(vlayer->dl), polygon_id);
-
- if(item) {
- item->value[0] = v0;
- item->value[1] = v1;
- item->value[2] = v2;
- item->value[3] = v3;
- }
- else {
- item = create_quat_real32_item(vlayer, polygon_id, v0, v1, v2, v3);
- BLI_dlist_add_item_index(&(vlayer->dl), item, item->id);
- }
-}
-
-/*
- * callback function: polygon is deleted
- */
-static void cb_g_polygon_delete(
- void *user_data,
- VNodeID node_id,
- uint32 polygon_id)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- VNode *vnode;
- VLayer *vlayer;
- VerseFace *vface;
-
- if(!session) return;
-
- /* find needed node (we can be sure, that it is geometry node) */
- vnode = BLI_dlist_find_link(&(session->nodes), node_id);
-
- /* find layer containing faces */
- vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
-
- /* find wanted VerseFace */
- vface = BLI_dlist_find_link(&(vlayer->dl), polygon_id);
-
- if(!vface) return;
-
- /* update edge hash */
- update_edgehash_of_deleted_verseface(vnode, vface);
-
- ((VGeomData*)vnode->data)->post_polygon_delete(vface);
-
- /* decrease references at coresponding VerseVertexes */
- vface->vvert0->counter--;
- vface->vvert1->counter--;
- vface->vvert2->counter--;
- if(vface->vvert3) vface->vvert3->counter--;
-
- /* delete unneeded VerseVertexes */
- free_unneeded_verseverts_of_verseface(vnode, vface);
-
- free_verse_face(vlayer, vface);
-}
-
-/*
- * callback function: new polygon (face) created or existing polygon was changed
- */
-static void cb_g_polygon_set_corner_uint32(
- void *user_data,
- VNodeID node_id,
- VLayerID layer_id,
- uint32 polygon_id,
- uint32 v0,
- uint32 v1,
- uint32 v2,
- uint32 v3)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VLayer *vlayer;
- struct VerseFace *vface=NULL;
-
- if(!session) return;
-
- /* try to find VerseNode */
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(!vnode) return;
-
- /* try to find VerseLayer */
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), (unsigned int)layer_id);
- if(!vlayer) return;
-
- /* we have to test coretness of incoming data */
- if(!test_polygon_set_corner_uint32(v0, v1, v2, v3)) return;
-
- /* Blender uses different order of vertexes */
- if(v3!=-1) { /* quat swap */
- unsigned int v; v = v1; v1 = v3; v3 = v;
- }
- else { /* triangle swap */
- unsigned int v; v = v1; v1 = v2; v2 = v;
- }
-
- /* try to find VerseFace */
- vface = (VerseFace*)BLI_dlist_find_link(&(vlayer->dl), (unsigned int)polygon_id);
-
- /* try to find modified VerseFace */
- if(!vface) {
- vface = find_changed_verse_face_in_queue(vlayer, polygon_id);
- if(vface) {
- BLI_remlink(&(vlayer->queue), (void*)vface);
- BLI_dlist_add_item_index(&(vlayer->dl), (void*)vface, (unsigned int)polygon_id);
- }
- }
-
- if(!vface) {
- /* try to find VerseFace in list of VerseVaces created by me and set up polygon and
- * layer ids */
- vface = find_verse_face_in_queue(vlayer, node_id, polygon_id, v0, v1, v2, v3);
-
- /* update edge hash */
- update_edgehash_of_new_verseface(vnode, v0, v1, v2, v3);
-
- if(vface){
- /* I creeated this face ... remove VerseFace from queue */
- BLI_remlink(&(vlayer->queue), (void*)vface);
- }
- else {
- /* some other client created this face*/
- vface = create_verse_face(vlayer, polygon_id, v0, v1, v2, v3);
- }
-
- vface->flag &= ~FACE_SENT;
-
- /* return number of missing verse vertexes */
- vface->counter = test_incoming_verseface((VGeomData*)vnode->data, vface);
-
- if(vface->counter < 1) {
- /* when VerseFace received all needed VerseFaces, then it is moved
- * to list of VerseFaces */
- BLI_dlist_add_item_index(&(vlayer->dl), (void*)vface, (unsigned int)polygon_id);
- increase_verse_verts_references(vface);
- recalculate_verseface_normals(vnode);
- ((VGeomData*)vnode->data)->post_polygon_create(vface);
- }
- else {
- /* when all needed VerseVertexes weren't received, then VerseFace is moved to
- * the list of orphans waiting on needed vertexes */
- vface->flag |= FACE_RECEIVED;
- BLI_addtail(&(vlayer->orphans), (void*)vface);
- }
- }
- else {
- VLayer *vert_vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
- /* VerseVertexes of existing VerseFace were changed (VerseFace will use some different
- * VerseVertexes or it will use them in different order) */
-
- /* update fake verse edges */
- update_edgehash_of_changed_verseface(vnode, vface, v0, v1, v2, v3);
-
- /* initialize count of unreceived vertexes needed for this face */
- vface->counter = 4;
-
- /* 1st corner */
- if(vface->vvert0->id != v0) {
- /* decrease references of obsolete vertexes*/
- vface->vvert0->counter--;
- /* delete this vertex, when it isn't used by any face and it was marked as deleted */
- if((vface->vvert0->counter < 1) && (vface->vvert0->flag & VERT_DELETED)) {
- ((VGeomData*)vnode->data)->post_vertex_delete(vface->vvert0);
- free_verse_vertex(vert_vlayer, vface->vvert0);
- }
- /* try to set up new pointer at verse vertex */
- vface->v0 = v0;
- vface->vvert0 = BLI_dlist_find_link(&(vert_vlayer->dl), vface->v0);
- if(vface->vvert0) {
- /* increase references at new vertex */
- vface->vvert0->counter++;
- /* decrease count of needed vertex to receive */
- vface->counter--;
- }
-
- }
- else
- /* this corner wasn't changed */
- vface->counter--;
-
- /* 2nd corner */
- if(vface->vvert1->id != v1) {
- vface->vvert1->counter--;
- if((vface->vvert1->counter < 1) && (vface->vvert1->flag & VERT_DELETED)) {
- ((VGeomData*)vnode->data)->post_vertex_delete(vface->vvert1);
- free_verse_vertex(vert_vlayer, vface->vvert1);
- }
- vface->v1 = v1;
- vface->vvert1 = BLI_dlist_find_link(&(vert_vlayer->dl), vface->v1);
- if(vface->vvert1) {
- vface->vvert1->counter++;
- vface->counter--;
- }
- }
- else
- vface->counter--;
-
- /* 3rd corner */
- if(vface->vvert2->id != v2) {
- vface->vvert2->counter--;
- if((vface->vvert2->counter < 1) && (vface->vvert2->flag & VERT_DELETED)) {
- ((VGeomData*)vnode->data)->post_vertex_delete(vface->vvert2);
- free_verse_vertex(vert_vlayer, vface->vvert2);
- }
- vface->v2 = v2;
- vface->vvert2 = BLI_dlist_find_link(&(vert_vlayer->dl), vface->v2);
- if(vface->vvert2) {
- vface->vvert2->counter++;
- vface->counter--;
- }
- }
- else
- vface->counter--;
-
- /* 4th corner */
- if(vface->vvert3) {
- if(vface->vvert3->id != v3) {
- vface->vvert3->counter--;
- if((vface->vvert3->counter < 1) && (vface->vvert3->flag & VERT_DELETED)) {
- ((VGeomData*)vnode->data)->post_vertex_delete(vface->vvert3);
- free_verse_vertex(vert_vlayer, vface->vvert3);
- }
- vface->v3 = v3;
- if(v3 != -1) {
- vface->vvert3 = BLI_dlist_find_link(&(vert_vlayer->dl), vface->v3);
- if(vface->vvert3) {
- vface->vvert3->counter++;
- vface->counter--;
- }
- }
- else {
- /* this is some special case, this face hase now only 3 corners
- * quat -> triangle */
- vface->vvert3 = NULL;
- vface->counter--;
- }
- }
- }
- else if(v3 != -1)
- /* this is some special case, 4th corner of this polygon was created
- * triangle -> quat */
- vface->v3 = v3;
- vface->vvert3 = BLI_dlist_find_link(&(vert_vlayer->dl), vface->v3);
- if(vface->vvert3) {
- vface->vvert3->counter++;
- vface->counter--;
- }
- else {
- vface->v3 = -1;
- vface->counter--;
- }
-
- vface->flag &= ~FACE_SENT;
- vface->flag |= FACE_CHANGED;
-
- if(vface->counter<1) {
- vface->flag &= ~FACE_CHANGED;
- recalculate_verseface_normals(vnode);
- ((VGeomData*)vnode->data)->post_polygon_set_corner(vface);
- }
- else {
- /* when all needed VerseVertexes weren't received, then VerseFace is added to
- * the list of orphans waiting on needed vertexes */
- BLI_dlist_rem_item(&(vlayer->dl), vface->id);
- BLI_addtail(&(vlayer->orphans), (void*)vface);
- }
- }
-}
-
-/*
- * callback function: float value was set up for VerseVert with vertex_id
- */
-static void cb_g_vertex_set_real32(
- void *user_def,
- VNodeID node_id,
- VLayerID layer_id,
- uint32 vertex_id,
- real32 value)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VLayer *vlayer;
- struct real32_item *item;
-
- if(!session) return;
-
- /* find needed node (we can be sure, that it is geometry node) */
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- /* find layer containing uint_8 data */
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), (unsigned int)layer_id);
-
- /* try to find item*/
- item = BLI_dlist_find_link(&(vlayer->dl), vertex_id);
-
- if(item) {
- item->value = value;
- }
- else {
- item = create_real32_item(vlayer, vertex_id, value);
- BLI_dlist_add_item_index(&(vlayer->dl), item, item->id);
- }
-}
-
-/*
- * callback function: int value was set up for VerseVert with vertex_id
- */
-static void cb_g_vertex_set_uint32(
- void *user_def,
- VNodeID node_id,
- VLayerID layer_id,
- uint32 vertex_id,
- uint32 value)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VLayer *vlayer;
- struct uint32_item *item;
-
- if(!session) return;
-
- /* find needed node (we can be sure, that it is geometry node) */
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- /* find layer containing uint_8 data */
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), (unsigned int)layer_id);
-
- /* try to find item*/
- item = BLI_dlist_find_link(&(vlayer->dl), vertex_id);
-
- if(item) {
- item->value = value;
- }
- else {
- item = create_uint32_item(vlayer, vertex_id, value);
- BLI_dlist_add_item_index(&(vlayer->dl), item, item->id);
- }
-}
-
-/*
- * callback function: polygon was deleted
- */
-static void cb_g_vertex_delete_real32(
- void *user_data,
- VNodeID node_id,
- uint32 vertex_id)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- VNode *vnode=NULL;
- VLayer *vert_vlayer=NULL;
- VerseVert *vvert=NULL;
-
- if(!session) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- vert_vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
-
- vvert = BLI_dlist_find_link(&(vert_vlayer->dl), (unsigned int)vertex_id);
-
- if(!vvert) return;
-
- if(vvert->counter < 1) {
- ((VGeomData*)vnode->data)->post_vertex_delete(vvert);
- BLI_dlist_free_item(&(vert_vlayer->dl), (unsigned int)vertex_id);
- }
- else {
- /* some VerseFace(s) still need VerseVert, remove verse vert from
- * list verse vertexes and put it to list of orphans */
- vvert->flag |= VERT_DELETED;
- BLI_dlist_rem_item(&(vert_vlayer->dl), (unsigned int)vertex_id);
- BLI_addtail(&(vert_vlayer->orphans), vvert);
- }
-}
-
-/*
- * callback function: position of one vertex was changed or new vertex was created
- */
-static void cb_g_vertex_set_xyz_real32(
- void *user_data,
- VNodeID node_id,
- VLayerID layer_id,
- uint32 vertex_id,
- real32 x,
- real32 y,
- real32 z)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode = NULL;
- struct VLayer *vlayer = NULL;
- struct VerseVert *vvert = NULL;
- real32 tmp;
-
- if(!session) return;
-
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(!vnode)return;
-
- vlayer = (VLayer*)BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), (unsigned int)layer_id);
- if(!vlayer) return;
-
- /* switch axis orientation */
- tmp = y;
- y = -z;
- z = tmp;
-
- if(vlayer->id == 0) {
- /* try to pick up verse vert from DynamicList */
- vvert = (VerseVert*)BLI_dlist_find_link(&(vlayer->dl), (unsigned int)vertex_id);
-
- if(vvert) {
- if(vvert->flag & VERT_OBSOLETE) return;
-
- if (vvert->flag & VERT_LOCKED) {
- /* this application changed position of this vertex */
- if((vvert->co[0]==x) && (vvert->co[1]==y) && (vvert->co[2]==z)) {
- /* unlock vertex position */
- vvert->flag &= ~VERT_LOCKED;
- /* call post_vertex_set_xyz only, when position of vertex is
- * obsolete ... the new vertex position will be sent to
- * verse server */
- if (vvert->flag & VERT_POS_OBSOLETE) {
- ((VGeomData*)vnode->data)->post_vertex_set_xyz(vvert);
- }
- }
- }
- else {
- /* somebody else changed position of this vertex*/
- if((vvert->co[0]!=x) || (vvert->co[1]!=y) || (vvert->co[2]!=z)) {
- vvert->co[0] = x;
- vvert->co[1] = y;
- vvert->co[2] = z;
- recalculate_verseface_normals(vnode);
- ((VGeomData*)vnode->data)->post_vertex_set_xyz(vvert);
- }
- }
- }
- else {
- /* create new verse vert */
-
- /* test if we are authors of this vertex :-) */
- vvert = find_verse_vert_in_queue(vlayer, node_id, vertex_id, x, y, z);
-
- if(vvert) {
- /* remove vert from queue */
- BLI_remlink(&(vlayer->queue), (void*)vvert);
- /* add vvert to the dynamic list */
- BLI_dlist_add_item_index(&(vlayer->dl), (void*)vvert, (unsigned int)vertex_id);
- /* set VerseVert flags */
- vvert->flag |= VERT_RECEIVED;
- if(!(vvert->flag & VERT_POS_OBSOLETE))
- vvert->flag &= ~VERT_LOCKED;
- /* find VerseFaces orphans */
- find_vlayer_orphans(vnode, vvert);
- /* find unsent VerseFaces */
- find_unsent_faces(vnode, vvert);
- }
- else {
- /* create new VerseVert */
- vvert = create_verse_vertex(vlayer, vertex_id, x, y, z);
- /* add VerseVert to list of VerseVerts */
- BLI_dlist_add_item_index(&(vlayer->dl), (void*)vvert, (unsigned int)vertex_id);
- /* set VerseVert flags */
- vvert->flag |= VERT_RECEIVED;
- /* find VerseFaces orphans */
- find_vlayer_orphans(vnode, vvert);
- }
-
- ((VGeomData*)vnode->data)->post_vertex_create(vvert);
- }
- }
-}
-
-/*
- * callback function for destroyng of verse layer
- */
-static void cb_g_layer_destroy(
- void *user_data,
- VNodeID node_id,
- VLayerID layer_id)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VLayer *vlayer;
-
- if(!session) return;
-
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), node_id);
- if(!vnode) return;
-
- vlayer = (VLayer*) BLI_dlist_find_link(&(((VGeomData*)vnode->data)->layers), layer_id);
-
- if(vlayer){
- /* free VerseLayer data */
- free_verse_layer_data(vnode, vlayer);
- /* remove VerseLayer from list of verse layers */
- BLI_dlist_rem_item(&(((VGeomData*)vnode->data)->layers), layer_id);
- /* do client dependent actions */
- vlayer->post_layer_destroy(vlayer);
- /* free vlayer itself */
- MEM_freeN(vlayer);
- }
-
-}
-
-/*
- * callback function: new layer was created
- */
-static void cb_g_layer_create(
- void *user_data,
- VNodeID node_id,
- VLayerID layer_id,
- const char *name,
- VNGLayerType type,
- uint32 def_integer,
- real64 def_real)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode=NULL;
- struct VLayer *vlayer=NULL;
-
- if(!session) return;
-
- /* find node of this layer*/
- vnode = BLI_dlist_find_link(&(session->nodes), node_id);
- if(!vnode) return;
-
- /* when we created this layer, then subscribe to this layer */
- if(vnode->owner_id == VN_OWNER_MINE || session->flag & VERSE_AUTOSUBSCRIBE)
- verse_send_g_layer_subscribe(node_id, layer_id, 0);
-
- /* try to find */
- if(vnode->owner_id == VN_OWNER_MINE)
- vlayer = find_vlayer_in_sending_queue(vnode, layer_id);
-
- if(vlayer) {
- /* remove vlayer form sending queue add verse layer to list of verse layers */
- BLI_remlink(&((VGeomData*)vnode->data)->queue, vlayer);
- BLI_dlist_add_item_index(&((VGeomData*)vnode->data)->layers, (void*)vlayer, (unsigned int)vlayer->id);
- /* send all not sent vertexes to verse server
- * other items waiting in sending queue will be automaticaly sent to verse server,
- * when verse vertexes will be received from verse server */
- if((vlayer->type == VN_G_LAYER_VERTEX_XYZ) && (layer_id==0)) {
- struct VerseVert *vvert = (VerseVert*)vlayer->queue.first;
- while(vvert) {
- send_verse_vertex(vvert);
- vvert = vvert->next;
- }
- }
- }
- else {
- /* create new VerseLayer */
- vlayer = create_verse_layer(vnode, layer_id, name, type, def_integer, def_real);
- /* add layer to the list of VerseLayers */
- BLI_dlist_add_item_index(&(((VGeomData*)vnode->data)->layers), (void*)vlayer, (unsigned int)layer_id);
- }
-
- vlayer->flag |= LAYER_RECEIVED;
-
- /* post callback function */
- vlayer->post_layer_create(vlayer);
-}
-
-/*
- * this function will send destroy commands for all VerseVertexes and
- * VerseFaces to verse server, but it will not send destroy commands
- * for VerseLayers or geometry node, it can be used in other functions
- * (undo, destroy geom node, some edit mesh commands, ... ), parameter of
- * this function has to be geometry verse node
- */
-void destroy_geometry(VNode *vnode)
-{
- struct VLayer *vert_vlayer, *face_vlayer;
- struct VerseFace *vface;
- struct VerseVert *vvert;
-
- if(vnode->type != V_NT_GEOMETRY) return;
-
- face_vlayer = find_verse_layer_type((VGeomData*)vnode->data, POLYGON_LAYER);
- vface = face_vlayer->dl.lb.first;
-
- while(vface) {
- send_verse_face_delete(vface);
- vface = vface->next;
- }
-
- vert_vlayer = find_verse_layer_type((VGeomData*)vnode->data, VERTEX_LAYER);
- vvert = vert_vlayer->dl.lb.first;
-
- while(vvert) {
- send_verse_vertex_delete(vvert);
- vvert = vvert->next;
- }
-
- /* own destruction of local verse date will be executed, when client will
- * receive apropriate callback commands from verse server */
-}
-
-/*
- * free VGeomData
- */
-void free_geom_data(VNode *vnode)
-{
- struct VerseSession *session = vnode->session;
- struct VLayer *vlayer;
-
- if(vnode->data){
- vlayer = (VLayer*)((VGeomData*)vnode->data)->layers.lb.first;
- while(vlayer){
- /* unsubscribe from layer */
- if(session->flag & VERSE_CONNECTED)
- verse_send_g_layer_unsubscribe(vnode->id, vlayer->id);
- /* free VerseLayer data */
- free_verse_layer_data(vnode, vlayer);
- /* next layer */
- vlayer = vlayer->next;
- }
- /* free constraint between vnode and mesh */
- ((VGeomData*)vnode->data)->post_geometry_free_constraint(vnode);
- /* free all VerseLayers */
- BLI_dlist_destroy(&(((VGeomData*)vnode->data)->layers));
- /* free fake verse edges */
- BLI_freelistN(&((VGeomData*)vnode->data)->edges);
- /* free edge hash */
- MEM_freeN(((VGeomData*)vnode->data)->hash);
- }
-}
-
-void set_geometry_callbacks(void)
-{
- /* new layer created */
- verse_callback_set(verse_send_g_layer_create, cb_g_layer_create, NULL);
- /* layer was destroyed */
- verse_callback_set(verse_send_g_layer_destroy, cb_g_layer_destroy, NULL);
-
- /* position of vertex was changed */
- verse_callback_set(verse_send_g_vertex_set_xyz_real32, cb_g_vertex_set_xyz_real32, NULL);
- /* vertex was deleted */
- verse_callback_set(verse_send_g_vertex_delete_real32, cb_g_vertex_delete_real32, NULL);
-
- /* callback functions for values being associated with vertexes */
- verse_callback_set(verse_send_g_vertex_set_uint32, cb_g_vertex_set_uint32, NULL);
- verse_callback_set(verse_send_g_vertex_set_real32, cb_g_vertex_set_real32, NULL);
-
- /* new polygon was created / vertex(es) of polygon was set */
- verse_callback_set(verse_send_g_polygon_set_corner_uint32, cb_g_polygon_set_corner_uint32, NULL);
- /* polygon was deleted */
- verse_callback_set(verse_send_g_polygon_delete, cb_g_polygon_delete, NULL);
-
- /* callback functions for values being associated with polygon corners */
- verse_callback_set(verse_send_g_polygon_set_corner_real32, cb_g_polygon_set_corner_real32, NULL);
- /* callback functions for values being associated with faces */
- verse_callback_set(verse_send_g_polygon_set_face_uint8, cb_g_polygon_set_face_uint8, NULL);
- verse_callback_set(verse_send_g_polygon_set_face_uint32, cb_g_polygon_set_face_uint32, NULL);
- verse_callback_set(verse_send_g_polygon_set_face_real32, cb_g_polygon_set_face_real32, NULL);
-
- /* crease of vertex was set */
- verse_callback_set(verse_send_g_crease_set_vertex, cb_g_crease_set_vertex, NULL);
- /* crease of edge was set */
- verse_callback_set(verse_send_g_crease_set_edge, cb_g_crease_set_edge, NULL);
-}
-
-#endif
diff --git a/source/blender/blenkernel/intern/verse_method.c b/source/blender/blenkernel/intern/verse_method.c
deleted file mode 100644
index 20f7e2c9f9d..00000000000
--- a/source/blender/blenkernel/intern/verse_method.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Nathan Letwory.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WITH_VERSE
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_listBase.h"
-#include "DNA_userdef_types.h"
-#include "DNA_text_types.h"
-
-#include "BLI_dynamiclist.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-
-#include "BIF_verse.h"
-
-#include "BKE_bad_level_calls.h"
-#include "BKE_library.h"
-#include "BKE_text.h"
-#include "BKE_verse.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-
-#include "verse.h"
-
-/* helper struct for creating method descriptions */
-typedef struct VMethodInfo {
- const char *name;
- uint8 param_count;
- const VNOParamType param_type[4];
- const char *param_name[4];
- uint16 id;
-} VMethodInfo;
-
-#ifdef VERSECHAT
-/* array with methods for verse chat */
-static VMethodInfo vmethod_info[] = {
- { "join", 1, { VN_O_METHOD_PTYPE_STRING }, { "channel"}},
- { "leave", 1, { VN_O_METHOD_PTYPE_STRING }, { "channel"}},
- { "hear", 3, { VN_O_METHOD_PTYPE_STRING, VN_O_METHOD_PTYPE_STRING, VN_O_METHOD_PTYPE_STRING }, { "channel", "from", "msg"}}
-};
-#endif
-
-/* lookup a method group based on its name */
-struct VMethodGroup *lookup_vmethodgroup_name(ListBase *lb, const char *name) {
- struct VMethodGroup *vmg;
-
- for(vmg= lb->first; vmg; vmg= vmg->next)
- if(strcmp(vmg->name,name)==0) break;
-
- return vmg;
-}
-
-/* lookup a method group based on its group_id */
-struct VMethodGroup *lookup_vmethodgroup(ListBase *lb, uint16 group_id) {
- struct VMethodGroup *vmg;
-
- for(vmg= lb->first; vmg; vmg= vmg->next)
- if(vmg->group_id==group_id) break;
-
- return vmg;
-}
-
-/* lookup a method based on its name */
-struct VMethod *lookup_vmethod_name(ListBase *lb, const char *name) {
- struct VMethod *vm;
- for(vm= lb->first; vm; vm= vm->next)
- if(strcmp(vm->name,name)==0) break;
-
- return vm;
-}
-
-/* lookup a method based on its method_id */
-struct VMethod *lookup_vmethod(ListBase *lb, uint8 method_id) {
- struct VMethod *vm;
- for(vm= lb->first; vm; vm= vm->next)
- if(vm->id==method_id) break;
-
- return vm;
-}
-
-#ifdef VERSECHAT
-/*
- * send say command
- */
-void send_say(const char *chan, const char *utter)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VMethodGroup *vmg;
- struct VMethod *vm;
- VNOPackedParams *utterpack;
- VNOParam args[2];
-
- vnode= (VNode *)(session->nodes.lb.first);
-
- for( ; vnode; vnode= vnode->next) {
- if(strcmp(vnode->name, "tawksrv")==0) {
- vmg= lookup_vmethodgroup_name(&(vnode->methodgroups), "tawk");
- if(!vmg) break;
- vm= lookup_vmethod_name(&(vmg->methods), "say");
- if(!vm) break;
- args[0].vstring= (char *)chan;
- args[1].vstring= (char *)utter;
- if((utterpack= verse_method_call_pack(vm->param_count, vm->param_type, args))!=NULL) {
- verse_send_o_method_call(vnode->id, vmg->group_id, vm->id, vnode->session->avatar, utterpack);
- }
- break;
- }
-
- }
-}
-
-/*
- * send logout command
- */
-void send_logout(VNode *vnode)
-{
- struct VMethodGroup *vmg;
- struct VMethod *vm;
- VNOPackedParams *pack;
-
- vnode->chat_flag = CHAT_LOGGED;
- vmg= lookup_vmethodgroup_name(&(vnode->methodgroups), "tawk");
- if(!vmg) return;
- vm= lookup_vmethod_name(&(vmg->methods), "logout");
- if(!vm) return;
-
- if((pack= verse_method_call_pack(vm->param_count, vm->param_type, NULL))!=NULL) {
- verse_send_o_method_call(vnode->id, vmg->group_id, vm->id, vnode->session->avatar, pack);
- }
- vnode->chat_flag = CHAT_NOTLOGGED;
-}
-
-/*
- * send join command
- */
-void send_join(VNode *vnode, const char *chan)
-{
- struct VMethodGroup *vmg;
- struct VMethod *vm;
- VNOPackedParams *join;
- VNOParam channel[1];
-
- vmg= lookup_vmethodgroup_name(&(vnode->methodgroups), "tawk");
- if(!vmg) return;
- vm= lookup_vmethod_name(&(vmg->methods), "join");
- if(!vm) return;
-
- channel[0].vstring= (char *)chan;
- if((join= verse_method_call_pack(vm->param_count, vm->param_type, channel))!=NULL) {
- verse_send_o_method_call(vnode->id, vmg->group_id, vm->id, vnode->session->avatar, join);
- }
-}
-
-/*
- * send leave command
- */
-void send_leave(VNode *vnode, const char *chan)
-{
- struct VMethodGroup *vmg;
- struct VMethod *vm;
- VNOPackedParams *leave;
- VNOParam channel[1];
-
- vmg= lookup_vmethodgroup_name(&(vnode->methodgroups), "tawk");
- if(!vmg) return;
- vm= lookup_vmethod_name(&(vmg->methods), "leave");
- if(!vm) return;
-
- channel[0].vstring= (char *)chan;
- if((leave= verse_method_call_pack(vm->param_count, vm->param_type, channel))!=NULL) {
- verse_send_o_method_call(vnode->id, vmg->group_id, vm->id, vnode->session->avatar, leave);
- }
-}
-
-/*
- * send login command
- */
-void send_login(VNode *vnode)
-{
- struct VMethodGroup *vmg;
- struct VMethod *vm;
- VNOPackedParams *login;
- VNOParam param[1];
-
- vnode->chat_flag = CHAT_LOGGED;
- vmg= lookup_vmethodgroup_name(&(vnode->methodgroups), "tawk");
- if(!vmg) return;
- vm= lookup_vmethod_name(&(vmg->methods), "login");
- if(!vm) return;
-
- param[0].vstring= U.verseuser;
-
- if((login= verse_method_call_pack(vm->param_count, vm->param_type, param))!=NULL) {
- verse_send_o_method_call(vnode->id, vmg->group_id, vm->id, vnode->session->avatar, login);
- }
- vnode->chat_flag = CHAT_LOGGED;
-
- vnode= lookup_vnode(vnode->session, vnode->session->avatar);
- vmg= lookup_vmethodgroup_name(&(vnode->methodgroups), "tawk-client");
- if(!vmg)
- verse_send_o_method_group_create(vnode->session->avatar, ~0, "tawk-client");
-}
-#endif
-
-/*
- * Free a VMethod
- */
-void free_verse_method(VMethod *vm) {
- if(!vm) return;
-
- MEM_freeN(vm->param_type);
-}
-
-/*
- * Free methods for VMethodGroup
- */
-void free_verse_methodgroup(VMethodGroup *vmg)
-{
- struct VMethod *vm, *tmpvm;
-
- if(!vmg) return;
-
- vm= vmg->methods.first;
- while(vm) {
- tmpvm=vm->next;
- free_verse_method(vm);
- vm= tmpvm;
- }
- BLI_freelistN(&(vmg->methods));
-}
-
-/* callback for method group creation */
-static void cb_o_method_group_create(
- void *user_data,
- VNodeID node_id,
- uint16 group_id,
- const char *name)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VMethodGroup *vmg;
-
- if(!session) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- vmg = lookup_vmethodgroup(&(vnode->methodgroups), group_id);
-
- /* create method group holder in node node_id */
- if(!vmg) {
- vmg= MEM_mallocN(sizeof(VMethodGroup), "VMethodGroup");
- vmg->group_id = group_id;
- vmg->methods.first = vmg->methods.last = NULL;
- BLI_addtail(&(vnode->methodgroups), vmg);
- printf("new method group with name %s (group_id %d) for node %u created\n", name, group_id, node_id);
- }
-
- /* this ensures name of an existing group gets updated, in case it is changed */
- BLI_strncpy(vmg->name, (char *)name, 16);
-
- /* subscribe to method group */
- verse_send_o_method_group_subscribe(node_id, group_id);
-
-#ifdef VERSECHAT
- /* if this is our own method group, register our methods */
- if(node_id==session->avatar) {
- verse_send_o_method_create(node_id, group_id, (uint8)~0u, vmethod_info[0].name,
- vmethod_info[0].param_count,
- (VNOParamType *)vmethod_info[0].param_type,
- (const char **)vmethod_info[0].param_name);
- b_verse_update();
- verse_send_o_method_create(node_id, group_id, (uint8)~0u, vmethod_info[1].name,
- vmethod_info[1].param_count,
- (VNOParamType *)vmethod_info[1].param_type,
- (const char **)vmethod_info[1].param_name);
- b_verse_update();
- verse_send_o_method_create(node_id, group_id, (uint8)~0u, vmethod_info[2].name,
- vmethod_info[2].param_count,
- (VNOParamType *)vmethod_info[2].param_type,
- (const char **)vmethod_info[2].param_name);
- b_verse_update();
- }
-#endif
-}
-
-/* callback for method group destruction */
-static void cb_o_method_group_destroy(
- void *user_data,
- VNodeID node_id,
- uint16 group_id,
- const char *name)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VMethodGroup *vmg;
- struct VMethod *vm;
-
- printf("method group %d destroyed\n", group_id);
-
- if(!session) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- for(vmg= vnode->methodgroups.first; vmg; vmg= vmg->next)
- if(vmg->group_id==group_id) break;
-
- if(!vmg) return; /* method group doesn't exist? */
-
- vmg->group_id = 0;
- vmg->name[0] = '\0';
- vm= vmg->methods.first;
- while(vm) {
- /* free vm */
-
- }
-
- /* TODO: unsubscribe from method group */
- BLI_remlink(&(vnode->methodgroups),vmg);
- MEM_freeN(vmg);
-}
-
-/* callback for method creation */
-static void cb_o_method_create(
- void *user_data,
- VNodeID node_id,
- uint16 group_id,
- uint16 method_id,
- const char *name,
- uint8 param_count,
- const VNOParamType *param_type,
- const char *param_name[])
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VMethodGroup *vmg;
- struct VMethod *vm;
- unsigned int size;
- unsigned int i;
- char *put;
-
- if(!session) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- vmg= lookup_vmethodgroup((&vnode->methodgroups), group_id);
-
- if(!vmg) return;
-
- vm= lookup_vmethod((&vmg->methods), method_id);
-
- if(!vm) {
- vm= MEM_mallocN(sizeof(VMethod), "VMethod");
- vm->id= method_id;
- vm->param_count= param_count;
- size= param_count* (sizeof(*vm->param_type) + sizeof(*vm->param_name));
- for(i= 0; i <param_count; i++) {
- size+=strlen(param_name[i])+1;
- }
- vm->param_type= MEM_mallocN(size, "param_type and param_name");
- memcpy(vm->param_type, param_type, sizeof(VNOParamType)*param_count);
- vm->param_name= (char **)(vm->param_type + param_count);
- put= (char *)(vm->param_name + param_count);
- for(i= 0; i < param_count; i++) {
- vm->param_name[i]= put;
- strcpy(put, param_name[i]);
- put += strlen(param_name[i]) + 1;
- }
-
- BLI_addtail(&(vmg->methods), vm);
-#ifdef VERSECHAT
- if(strcmp(vmethod_info[0].name, name)==0) {
- vmethod_info[0].id = method_id;
- }
-#endif
- printf("method %s in group %d of node %u created\n", name, group_id, node_id);
- }
-
- BLI_strncpy(vm->name, (char *)name, 500);
-}
-
-/* callback for method destruction */
-static void cb_o_method_destroy(
- void *user_data,
- VNodeID node_id,
- uint16 group_id,
- uint16 method_id,
- const char *name,
- uint8 param_count,
- const VNOParamType *param_type,
- const char *param_name[])
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VMethodGroup *vmg;
- struct VMethod *vm;
-
- if(!session) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- for(vmg= vnode->methodgroups.first; vmg; vmg= vmg->next)
- if(vmg->group_id==group_id) break;
-
- if(!vmg) return; /* method group doesn't exist? */
-
- for(vm= vmg->methods.first; vm; vm= vm->next)
- if(vm->id==method_id) break;
-
- if(!vm) return;
-
- BLI_remlink(&(vmg->methods), vm);
- MEM_freeN(vm->param_type);
- MEM_freeN(vm);
-}
-
-/* callback for method calls */
-static void cb_o_method_call(void *user_data, VNodeID node_id, uint8 group_id, uint8 method_id, VNodeID sender, VNOPackedParams *params)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VMethodGroup *vmg;
- struct VMethod *vm;
- Text *text;
- int method_idx= -1;
-
- VNOParam arg[3];
-
- if(!session) return;
-
- if(session->avatar!=node_id) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- vmg= lookup_vmethodgroup(&(vnode->methodgroups), group_id);
- if(!vmg) return;
-
- vm= lookup_vmethod(&(vmg->methods), method_id);
- if(!vm) return;
-#ifdef VERSECHAT
- if(strcmp(vm->name, "join")==0) method_idx=0;
- if(strcmp(vm->name, "leave")==0) method_idx=1;
- if(strcmp(vm->name, "hear")==0) method_idx=2;
- if(method_idx>-1)
- verse_method_call_unpack(params, vmethod_info[method_idx].param_count, vmethod_info[method_idx].param_type, arg);
-
- switch(method_idx) {
- case 0:
- printf("Joining channel %s\n",arg[0].vstring);
- text=add_empty_text();
- text->flags |= TXT_ISCHAT;
- rename_id(&(text->id), arg[0].vstring);
- break;
- case 1:
- printf("Leaving channel %s\n",arg[0].vstring);
- break;
- case 2:
- {
- ListBase lb = G.main->text;
- ID *id= (ID *)lb.first;
- char showstr[1024];
- showstr[0]='\0';
- text = NULL;
- sprintf(showstr, "%s: %s\n", arg[1].vstring, arg[2].vstring);
- for(; id; id= id->next) {
- if(strcmp(id->name+2, arg[0].vstring)==0 && strcmp(arg[0].vstring, "#server")!=0) {
- text = (Text *)id;
- break;
- }
- }
- if(text) {
- txt_insert_buf(text, showstr);
- txt_move_eof(text, 0);
- allqueue(REDRAWCHAT, 0);
- } else {
- printf("%s> %s: %s\n",arg[0].vstring, arg[1].vstring, arg[2].vstring);
- }
- }
- break;
- }
-#endif
-}
-
-void set_method_callbacks(void)
-{
- /* create and destroy method groups */
- verse_callback_set(verse_send_o_method_group_create, cb_o_method_group_create, NULL);
- verse_callback_set(verse_send_o_method_group_destroy, cb_o_method_group_destroy, NULL);
-
- /* create and destroy methods */
- verse_callback_set(verse_send_o_method_create, cb_o_method_create, NULL);
- verse_callback_set(verse_send_o_method_destroy, cb_o_method_destroy, NULL);
-
- /* call methods */
- verse_callback_set(verse_send_o_method_call, cb_o_method_call, NULL);
-}
-
-#endif
diff --git a/source/blender/blenkernel/intern/verse_node.c b/source/blender/blenkernel/intern/verse_node.c
deleted file mode 100644
index 682ae773da5..00000000000
--- a/source/blender/blenkernel/intern/verse_node.c
+++ /dev/null
@@ -1,750 +0,0 @@
-/**
- * $Id: verse_node.c 12931 2007-12-17 18:20:48Z theeth $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WITH_VERSE
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_listBase.h"
-#include "DNA_userdef_types.h"
-
-#include "BLI_dynamiclist.h"
-#include "BLI_blenlib.h"
-
-#include "BIF_verse.h"
-
-#include "BKE_verse.h"
-
-#include "verse.h"
-
-/* function prototypes of static functions */
- /* for tags */
-static void free_verse_tag_data(struct VTag *vtag);
-static struct VTag *find_tag_in_queue(struct VTagGroup *vtaggroup, const char *name);
-static struct VTag *create_verse_tag(struct VTagGroup *vtaggroup, uint16 tag_id, const char *name, VNTagType type, const VNTag *tag);
- /* for verse tag groups */
-static void free_verse_taggroup_data(struct VTagGroup *taggroup);
-static struct VTagGroup *find_taggroup_in_queue(struct VNode *vnode, const char *name);
-static struct VTagGroup *create_verse_taggroup(VNode *vnode, uint16 group_id, const char *name);
- /* for verse nodes */
-static void move_verse_node_to_dlist(struct VerseSession *session, VNodeID vnode_id);
- /* function prototypes of node callback functions */
-static void cb_tag_destroy(void *user_data, VNodeID node_id, uint16 group_id, uint16 tag_id);
-static void cb_tag_create(void *user_data, VNodeID node_id, uint16 group_id, uint16 tag_id, const char *name, VNTagType type, const VNTag *tag);
-static void cb_tag_group_destroy(void *user_data, VNodeID node_id, uint16 group_id);
-static void cb_tag_group_create(void *user_data, VNodeID node_id, uint16 group_id, const char *name);
-static void cb_node_name_set(void *user_data, VNodeID node_id, const char *name);
-static void cb_node_destroy(void *user_data, VNodeID node_id);
-static void cb_node_create(void *user_data, VNodeID node_id, uint8 type, VNodeID owner_id);
-
-/*
- * send new tag to verse server
- */
-void send_verse_tag(VTag *vtag)
-{
- verse_send_tag_create(vtag->vtaggroup->vnode->id,
- vtag->vtaggroup->id,
- vtag->id,
- vtag->name,
- vtag->type,
- vtag->tag);
-}
-
-/*
- * free tag data
- */
-static void free_verse_tag_data(VTag *vtag)
-{
- /* free name of verse tag */
- MEM_freeN(vtag->name);
- /* free value of tag */
- MEM_freeN(vtag->tag);
-}
-
-/*
- * try to find tag in sending queue ... if tag will be found, then
- * this function will removed tag from queue and will return pointer
- * at this tag
- */
-static VTag *find_tag_in_queue(VTagGroup *vtaggroup, const char *name)
-{
- struct VTag *vtag;
-
- vtag = vtaggroup->queue.first;
-
- while(vtag) {
- if(strcmp(vtag->name, name)==0) {
- BLI_remlink(&(vtaggroup->queue), vtag);
- break;
- }
- vtag = vtag->next;
- }
-
- return vtag;
-}
-
-/*
- * create new verse tag
- */
-static VTag *create_verse_tag(
- VTagGroup *vtaggroup,
- uint16 tag_id,
- const char *name,
- VNTagType type,
- const VNTag *tag)
-{
- struct VTag *vtag;
-
- vtag = (VTag*)MEM_mallocN(sizeof(VTag), "VTag");
-
- vtag->vtaggroup = vtaggroup;
- vtag->id = tag_id;
- vtag->name = (char*)MEM_mallocN(sizeof(char)*(strlen(name)+1), "VTag name");
- strcpy(vtag->name, name);
- vtag->type = type;
-
- vtag->tag = (VNTag*)MEM_mallocN(sizeof(VNTag), "VNTag");
- *vtag->tag = *tag;
-
- vtag->value = NULL;
-
- return vtag;
-}
-
-/*
- * send taggroup to verse server
- */
-void send_verse_taggroup(VTagGroup *vtaggroup)
-{
- verse_send_tag_group_create(
- vtaggroup->vnode->id,
- vtaggroup->id,
- vtaggroup->name);
-}
-
-/*
- * free taggroup data
- */
-static void free_verse_taggroup_data(VTagGroup *taggroup)
-{
- struct VerseSession *session = taggroup->vnode->session;
- struct VTag *vtag;
-
- vtag = taggroup->tags.lb.first;
-
- while(vtag) {
- free_verse_tag_data(vtag);
- vtag = vtag->next;
- }
-
- /* unsubscribe from taggroup */
- if(session->flag & VERSE_CONNECTED)
- verse_send_tag_group_unsubscribe(taggroup->vnode->id, taggroup->id);
-
- BLI_dlist_destroy(&(taggroup->tags));
- MEM_freeN(taggroup->name);
-}
-
-/*
- * move taggroup from queue to dynamic list with access array,
- * set up taggroup id and return pointer at this taggroup
- */
-static VTagGroup *find_taggroup_in_queue(VNode *vnode, const char *name)
-{
- struct VTagGroup *vtaggroup;
-
- vtaggroup = vnode->queue.first;
-
- while(vtaggroup) {
- if(strcmp(vtaggroup->name, name)==0) {
- BLI_remlink(&(vnode->queue), vtaggroup);
- break;
- }
- vtaggroup = vtaggroup->next;
- }
-
- return vtaggroup;
-}
-
-/*
- * create new verse group of tags
- */
-static VTagGroup *create_verse_taggroup(VNode *vnode, uint16 group_id, const char *name)
-{
- struct VTagGroup *taggroup;
-
- taggroup = (VTagGroup*)MEM_mallocN(sizeof(VTagGroup), "VTagGroup");
-
- taggroup->vnode = vnode;
- taggroup->id = group_id;
- taggroup->name = (char*)MEM_mallocN(sizeof(char)*(strlen(name)+1), "VTagGroup name");
- strcpy(taggroup->name, name);
-
- BLI_dlist_init(&(taggroup->tags));
- taggroup->queue.first = taggroup->queue.last = NULL;
-
- taggroup->post_tag_change = post_tag_change;
- taggroup->post_taggroup_create = post_taggroup_create;
-
- return taggroup;
-}
-
-/*
- * move first VerseNode waiting in sending queue to dynamic list of VerseNodes
- * (it usually happens, when "our" VerseNode was received from verse server)
- */
-static void move_verse_node_to_dlist(VerseSession *session, VNodeID vnode_id)
-{
- VNode *vnode;
-
- vnode = session->queue.first;
-
- if(vnode) {
- BLI_remlink(&(session->queue), vnode);
- BLI_dlist_add_item_index(&(session->nodes), (void*)vnode, vnode_id);
- }
-}
-
-/*
- * send VerseNode to verse server
- */
-void send_verse_node(VNode *vnode)
-{
- verse_send_node_create(
- vnode->id,
- vnode->type,
- vnode->session->avatar);
-}
-
-/*
- * free Verse Node data
- */
-void free_verse_node_data(VNode *vnode)
-{
- struct VerseSession *session = vnode->session;
- struct VTagGroup *vtaggroup;
-
- /* free node data (object, geometry, etc.) */
- switch(vnode->type){
- case V_NT_OBJECT:
- free_object_data(vnode);
- break;
- case V_NT_GEOMETRY:
- free_geom_data(vnode);
- break;
- case V_NT_BITMAP:
- free_bitmap_node_data(vnode);
- break;
- default:
- break;
- }
-
- /* free all tag groups in dynamic list with access array */
- vtaggroup = vnode->taggroups.lb.first;
- while(vtaggroup) {
- free_verse_taggroup_data(vtaggroup);
- vtaggroup = vtaggroup->next;
- }
- BLI_dlist_destroy(&(vnode->taggroups));
-
- /* free all tag groups still waiting in queue */
- vtaggroup = vnode->queue.first;
- while(vtaggroup) {
- free_verse_taggroup_data(vtaggroup);
- vtaggroup = vtaggroup->next;
- }
- BLI_freelistN(&(vnode->queue));
-
- /* unsubscribe from node */
- if(session->flag & VERSE_CONNECTED)
- verse_send_node_unsubscribe(vnode->id);
-
- /* free node name */
- MEM_freeN(vnode->name);
- vnode->name = NULL;
-
- /* free node data */
- MEM_freeN(vnode->data);
- vnode->data = NULL;
-
-}
-
-/*
- * free VerseNode
- */
-void free_verse_node(VNode *vnode)
-{
- free_verse_node_data(vnode);
-
- BLI_dlist_free_item(&(vnode->session->nodes), vnode->id);
-}
-
-/*
- * Find a Verse Node from session
- */
-VNode* lookup_vnode(VerseSession *session, VNodeID node_id)
-{
- struct VNode *vnode;
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- return vnode;
-}
-
-/*
- * create new Verse Node
- */
-VNode* create_verse_node(VerseSession *session, VNodeID node_id, uint8 type, VNodeID owner_id)
-{
- struct VNode *vnode;
-
- vnode = (VNode*)MEM_mallocN(sizeof(VNode), "VerseNode");
-
- vnode->session = session;
- vnode->id = node_id;
- vnode->owner_id = owner_id;
- vnode->name = NULL;
- vnode->type = type;
-
- BLI_dlist_init(&(vnode->taggroups));
- vnode->queue.first = vnode->queue.last = NULL;
- vnode->methodgroups.first = vnode->methodgroups.last = NULL;
-
- vnode->data = NULL;
-
- vnode->counter = 0;
-
- vnode->flag = 0;
-#ifdef VERSECHAT
- vnode->chat_flag = CHAT_NOTLOGGED;
-#endif
-
- vnode->post_node_create = post_node_create;
- vnode->post_node_destroy = post_node_destroy;
- vnode->post_node_name_set = post_node_name_set;
-
- return vnode;
-}
-
-/*
- * callback function: tag was destroyed
- */
-static void cb_tag_destroy(
- void *user_data,
- VNodeID node_id,
- uint16 group_id,
- uint16 tag_id)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VTagGroup *vtaggroup;
- struct VTag *vtag;
-
- if(!session) return;
-
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(!vnode) return;
-
- /* try to find tag group in list of tag groups */
- vtaggroup = BLI_dlist_find_link(&(vnode->taggroups), group_id);
-
- if(!vtaggroup) return;
-
- /* try to find verse tag in dynamic list of tags in tag group */
- vtag = (VTag*)BLI_dlist_find_link(&(vtaggroup->tags), tag_id);
-
- if(vtag) {
- free_verse_tag_data(vtag);
- BLI_dlist_free_item(&(vtaggroup->tags), vtag->id);
- }
-}
-
-/*
- * callback function: new tag was created
- */
-static void cb_tag_create(
- void *user_data,
- VNodeID node_id,
- uint16 group_id,
- uint16 tag_id,
- const char *name,
- VNTagType type,
- const VNTag *tag)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VTagGroup *vtaggroup;
- struct VTag *vtag;
-
- if(!session) return;
-
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(!vnode) return;
-
- /* try to find tag group in list of tag groups */
- vtaggroup = BLI_dlist_find_link(&(vnode->taggroups), group_id);
-
- if(!vtaggroup) return;
-
- /* try to find verse tag in dynamic list of tags in tag group */
- vtag = (VTag*)BLI_dlist_find_link(&(vtaggroup->tags), tag_id);
-
- if(!vtag) {
- /* we will try to find vtag in sending queue */
- vtag = find_tag_in_queue(vtaggroup, name);
-
- /* when we didn't create this tag, then we will have to create one */
- if(!vtag) vtag = create_verse_tag(vtaggroup, tag_id, name, type, tag);
- else vtag->id = tag_id;
-
- /* add tag to the list of tags in tag group */
- BLI_dlist_add_item_index(&(vtaggroup->tags), vtag, tag_id);
-
- /* post change/create method */
- vtaggroup->post_tag_change(vtag);
- }
- else {
- /* this tag exists, then we will propably change value of this tag */
- if((vtag->type != type) || (strcmp(vtag->name, name)!=0)) {
- /* changes of type or name are not allowed and such
- * stupid changes will be returned back */
- send_verse_tag(vtag);
- }
- else {
- /* post change/create method */
- vtaggroup->post_tag_change(vtag);
- }
- }
-}
-
-/*
- * callback function: tag group was destroyed
- */
-static void cb_tag_group_destroy(
- void *user_data,
- VNodeID node_id,
- uint16 group_id)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VTagGroup *vtaggroup;
-
- if(!session) return;
-
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(!vnode) return;
-
- vtaggroup = BLI_dlist_find_link(&(vnode->taggroups), group_id);
-
- if(vtaggroup) {
- free_verse_taggroup_data(vtaggroup);
- BLI_dlist_free_item(&(vnode->taggroups), vtaggroup->id);
- }
-}
-
-/*
- * callback function: new tag group was created
- */
-static void cb_tag_group_create(
- void *user_data,
- VNodeID node_id,
- uint16 group_id,
- const char *name)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VTagGroup *vtaggroup;
-
- if(!session) return;
-
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(!vnode) return;
-
- /* name of taggroup has to begin with string "blender:" */
- if(strncmp("blender:", name, 8)) return;
-
- /* try to find tag group in list of tag groups */
- vtaggroup = BLI_dlist_find_link(&(vnode->taggroups), group_id);
-
- if(!vtaggroup) {
- /* subscribe to tag group (when new tag will be created, then blender will
- * receive command about it) */
- verse_send_tag_group_subscribe(vnode->id, group_id);
- verse_callback_update(0);
-
- /* try to find taggroup in waiting queue */
- vtaggroup = find_taggroup_in_queue(vnode, name);
-
- /* if no taggroup exist, then new has to be created */
- if(!vtaggroup) vtaggroup = create_verse_taggroup(vnode, group_id, name);
- else vtaggroup->id = group_id;
-
- /* add tag group to dynamic list with access array */
- BLI_dlist_add_item_index(&(vnode->taggroups), (void*)vtaggroup, (unsigned int)group_id);
-
- /* post create method */
- vtaggroup->post_taggroup_create(vtaggroup);
- }
- else {
- /* this taggroup exist and somebody try to change its name */
- if(strcmp(vtaggroup->name, name)!=0) {
- /* blender doesn't allow such stupid and dangerous things */
- send_verse_taggroup(vtaggroup);
- }
- }
-}
-
-/*
- * callback function: change name of node
- */
-static void cb_node_name_set(
- void *user_data,
- VNodeID node_id,
- const char *name)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
-
- if(!session) return;
-
- vnode = (VNode*)BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- if(vnode && name) {
- if(!vnode->name) {
- vnode->name = (char*)MEM_mallocN(sizeof(char)*(strlen(name)+1), "VerseNode name");
- }
- else if(strlen(name) > strlen(vnode->name)) {
- MEM_freeN(vnode->name);
- vnode->name = (char*)MEM_mallocN(sizeof(char)*(strlen(name)+1), "VerseNode name");
- }
- strcpy(vnode->name, name);
-
- vnode->post_node_name_set(vnode);
- }
-}
-
-/*
- * callback function for deleting node
- */
-static void cb_node_destroy(
- void *user_data,
- VNodeID node_id)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
-
- if(!session) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- if(vnode) {
- /* remove VerseNode from dynamic list */
- BLI_dlist_rem_item(&(session->nodes), (unsigned int)node_id);
- /* do post destroy operations */
- vnode->post_node_destroy(vnode);
- /* free verse data */
- free_verse_node_data(vnode);
- /* free VerseNode */
- MEM_freeN(vnode);
- };
-}
-
-
-/*
- * callback function for new created node
- */
-static void cb_node_create(
- void *user_data,
- VNodeID node_id,
- uint8 type,
- VNodeID owner_id)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode = NULL;
-
- if(!session) return;
-
- /* subscribe to node */
- if((type==V_NT_OBJECT) || (type==V_NT_GEOMETRY) || (type==V_NT_BITMAP))
- verse_send_node_subscribe(node_id);
- else
- return;
-
- switch(type){
- case V_NT_OBJECT :
- if(owner_id==VN_OWNER_MINE) {
- struct VLink *vlink;
- /* collect VerseNode from VerseNode queue */
- move_verse_node_to_dlist(session, node_id);
- /* send next VerseNode waiting in queue */
- if(session->queue.first) send_verse_node(session->queue.first);
- /* get received VerseNode from list of VerseNodes */
- vnode = BLI_dlist_find_link(&(session->nodes), node_id);
- /* set up ID */
- vnode->id = node_id;
- /* set up flags */
- vnode->flag |= NODE_RECEIVED;
- /* find unsent link pointing at this VerseNode */
- vlink = find_unsent_child_vlink(session, vnode);
- /* send VerseLink */
- if(vlink) send_verse_link(vlink);
- /* send name of object node */
- verse_send_node_name_set(node_id, vnode->name);
- /* subscribe to changes of object node transformations */
- verse_send_o_transform_subscribe(node_id, 0);
- /* send object transformation matrix */
- send_verse_object_position(vnode);
- send_verse_object_rotation(vnode);
- send_verse_object_scale(vnode);
- }
- else {
- /* create new VerseNode */
- vnode = create_verse_node(session, node_id, type, owner_id);
- /* add VerseNode to list of nodes */
- BLI_dlist_add_item_index(&(session->nodes), (void*)vnode, (unsigned int)node_id);
- /* set up flags */
- vnode->flag |= NODE_RECEIVED;
- /* create object data */
- vnode->data = create_object_data();
- /* set up avatar's name */
- if(node_id == session->avatar) {
- verse_send_node_name_set(node_id, U.verseuser);
- }
- else if(session->flag & VERSE_AUTOSUBSCRIBE) {
- /* subscribe to changes of object node transformations */
- verse_send_o_transform_subscribe(node_id, 0);
- }
- }
- break;
- case V_NT_GEOMETRY :
- if(owner_id==VN_OWNER_MINE){
- struct VLink *vlink;
- struct VLayer *vlayer;
- /* collect VerseNode from VerseNode queue */
- move_verse_node_to_dlist(session, node_id);
- /* send next VerseNode waiting in queue */
- if(session->queue.first) send_verse_node(session->queue.first);
- /* get received VerseNode from list of VerseNodes */
- vnode = BLI_dlist_find_link(&(session->nodes), node_id);
- /* set up ID */
- vnode->id = node_id;
- /* set up flags */
- vnode->flag |= NODE_RECEIVED;
- /* find unsent link pointing at this VerseNode */
- vlink = find_unsent_parent_vlink(session, vnode);
- /* send VerseLink */
- if(vlink) send_verse_link(vlink);
- /* send name of geometry node */
- verse_send_node_name_set(node_id, vnode->name);
- /* send all not sent layer to verse server */
- vlayer = (VLayer*)((VGeomData*)vnode->data)->queue.first;
- if(vlayer) {
- while(vlayer) {
- send_verse_layer(vlayer);
- vlayer = vlayer->next;
- }
- }
- else {
- /* send two verse layers to verse server */
-/* verse_send_g_layer_create(node_id, 0, "vertex", VN_G_LAYER_VERTEX_XYZ, 0, 0);
- verse_send_g_layer_create(node_id, 1, "polygon", VN_G_LAYER_POLYGON_CORNER_UINT32, 0, 0);*/
- }
- }
- else {
- /* create new VerseNode*/
- vnode = create_verse_node(session, node_id, type, owner_id);
- /* add VerseNode to dlist of nodes */
- BLI_dlist_add_item_index(&(session->nodes), (void*)vnode, (unsigned int)node_id);
- /* set up flags */
- vnode->flag |= NODE_RECEIVED;
- /* create geometry data */
- vnode->data = (void*)create_geometry_data();
- }
- break;
- case V_NT_BITMAP :
- if(owner_id==VN_OWNER_MINE) {
- /* collect VerseNode from VerseNode queue */
- move_verse_node_to_dlist(session, node_id);
- /* send next VerseNode waiting in queue */
- if(session->queue.first) send_verse_node(session->queue.first);
- /* get received VerseNode from list of VerseNodes */
- vnode = BLI_dlist_find_link(&(session->nodes), node_id);
- /* set up ID */
- vnode->id = node_id;
- /* set up flags */
- vnode->flag |= NODE_RECEIVED;
- /* send name of object node */
- verse_send_node_name_set(node_id, vnode->name);
- /* send dimension of image to verse server */
- verse_send_b_dimensions_set(node_id,
- ((VBitmapData*)vnode->data)->width,
- ((VBitmapData*)vnode->data)->height,
- ((VBitmapData*)vnode->data)->depth);
- }
- else {
- /* create new VerseNode*/
- vnode = create_verse_node(session, node_id, type, owner_id);
- /* add VerseNode to dlist of nodes */
- BLI_dlist_add_item_index(&(session->nodes), (void*)vnode, (unsigned int)node_id);
- /* set up flags */
- vnode->flag |= NODE_RECEIVED;
- /* create bitmap data */
- vnode->data = (void*)create_bitmap_data();
- }
- break;
- default:
- vnode = NULL;
- break;
- }
-
- if(vnode) vnode->post_node_create(vnode);
-}
-
-/*
- * set up all callbacks for verse nodes
- */
-void set_node_callbacks(void)
-{
- /* new node created */
- verse_callback_set(verse_send_node_create, cb_node_create, NULL);
- /* node was deleted */
- verse_callback_set(verse_send_node_destroy, cb_node_destroy, NULL);
- /* name of node was set */
- verse_callback_set(verse_send_node_name_set, cb_node_name_set, NULL);
-
- /* new tag group was created */
- verse_callback_set(verse_send_tag_group_create, cb_tag_group_create, NULL);
- /* tag group was destroy */
- verse_callback_set(verse_send_tag_group_destroy, cb_tag_group_destroy, NULL);
-
- /* new tag was created */
- verse_callback_set(verse_send_tag_create, cb_tag_create, NULL);
- /* tag was destroy */
- verse_callback_set(verse_send_tag_destroy, cb_tag_destroy, NULL);
-}
-
-#endif
diff --git a/source/blender/blenkernel/intern/verse_object_node.c b/source/blender/blenkernel/intern/verse_object_node.c
deleted file mode 100644
index fc5a27cd5d9..00000000000
--- a/source/blender/blenkernel/intern/verse_object_node.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/**
- * $Id: verse_object_node.c 12931 2007-12-17 18:20:48Z theeth $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WITH_VERSE
-
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_listBase.h"
-#include "DNA_userdef_types.h"
-
-#include "BLI_dynamiclist.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-
-#include "BIF_verse.h"
-
-#include "BKE_verse.h"
-#include "BKE_utildefines.h"
-
-#include "verse.h"
-
-/* function prototypes of static functions */
-
-/* callback functions */
-static void cb_o_transform_pos_real32(void *user_data, VNodeID node_id, uint32 time_s, uint32 time_f, const real32 *pos, const real32 *speed, const real32 *accelerate, const real32 *drag_normal, real32 drag);
-static void cb_o_transform_rot_real32(void *user_data, VNodeID node_id, uint32 time_s, uint32 time_f, const VNQuat32 *temp, const VNQuat32 *speed, const VNQuat32 *accelerate, const VNQuat32 *drag_normal, real32 drag);
-static void cb_o_transform_scale_real32(void *user_data, VNodeID node_id, real32 scale_x, real32 scale_y, real32 scale_z);
-static void cb_o_link_set(void *user_data, VNodeID node_id, uint16 link_id, VNodeID link, const char *label, uint32 target_id);
-static void cb_o_link_destroy(void *user_data, VNodeID node_id,uint16 link_id);
-
-/* other functions */
-static void set_target_node_link_pointer(struct VNode *vnode, struct VLink *vlink);
-static void free_verse_link_data(struct VLink *vlink);
-
-/*
- * find noy sent VerseLink in queue
- */
-VLink *find_unsent_child_vlink(VerseSession *session, VNode *vnode)
-{
- struct VLink *vlink;
-
- if(vnode->type!=V_NT_OBJECT) return NULL;
-
- vlink = ((VObjectData*)vnode->data)->queue.first;
- while(vlink) {
- if(vlink->target->id != -1) {
- printf("\t vlink found, vnode target id %d\n", vlink->target->id);
- return vlink;
- }
- vlink = vlink->next;
- }
- return NULL;
-}
-
-/*
- * find unsent VerseLink "pointing at this VerseNode"
- */
-VLink *find_unsent_parent_vlink(VerseSession *session, VNode *vnode)
-{
- struct VNode *tmp;
- struct VLink *vlink;
-
- tmp = session->nodes.lb.first;
-
- while(tmp) {
- if(tmp->type==V_NT_OBJECT) {
- vlink = ((VObjectData*)tmp->data)->queue.first;
- while(vlink) {
- if(vlink->target == vnode)
- return vlink;
- vlink = vlink->next;
- }
- }
- tmp = tmp->next;
- }
- return NULL;
-}
-
-/*
- * send object position to verse server
- */
-void send_verse_object_position(VNode *vnode)
-{
- float tmp;
-
- ((VObjectData*)vnode->data)->flag &= ~POS_SEND_READY;
-
- /* we have to do rotation around x axis (+pi/2) to be
- compatible with other verse applications */
- tmp = -((VObjectData*)vnode->data)->pos[1];
- ((VObjectData*)vnode->data)->pos[1] = ((VObjectData*)vnode->data)->pos[2];
- ((VObjectData*)vnode->data)->pos[2] = tmp;
-
- verse_send_o_transform_pos_real32(
- vnode->id, /* node id */
- 0, /* time_s ... no interpolation */
- 0, /* time_f ... no interpolation */
- ((VObjectData*)vnode->data)->pos,
- NULL, /* speed ... no interpolation */
- NULL, /* accelerate ... no interpolation */
- NULL, /* drag normal ... no interpolation */
- 0.0); /* drag ... no interpolation */
-}
-
-/*
- * send object rotation to verse server
- */
-void send_verse_object_rotation(VNode *vnode)
-{
- VNQuat32 quat;
- float q[4] = {cos(-M_PI/4), -sin(-M_PI/4), 0, 0}, v[4], tmp[4];
-
- /* inverse transformation to transformation in function cb_o_transform_rot_real32 */
- mul_qt_qtqt(v, ((VObjectData*)vnode->data)->quat, q);
- q[1]= sin(-M_PI/4);
- mul_qt_qtqt(tmp, q, v);
-
- quat.x = tmp[1];
- quat.y = tmp[2];
- quat.z = tmp[3];
- quat.w = tmp[0];
-
- ((VObjectData*)vnode->data)->flag &= ~ROT_SEND_READY;
-
- verse_send_o_transform_rot_real32(
- vnode->id, /* node id */
- 0, /* time_s ... no interpolation */
- 0, /* time_f ... no interpolation */
- &quat,
- NULL, /* speed ... no interpolation */
- NULL, /* accelerate ... no interpolation */
- NULL, /* drag normal ... no interpolation */
- 0.0); /* drag ... no interpolation */
-}
-
-/*
- * send object rotation to verse server
- */
-void send_verse_object_scale(VNode *vnode)
-{
- float tmp;
-
- ((VObjectData*)vnode->data)->flag &= ~SCALE_SEND_READY;
-
- /* we have to do rotation around x axis (+pi/2) to be
- compatible with other verse applications */
- tmp = ((VObjectData*)vnode->data)->scale[1];
- ((VObjectData*)vnode->data)->scale[1] = ((VObjectData*)vnode->data)->scale[2];
- ((VObjectData*)vnode->data)->scale[2] = tmp;
-
- verse_send_o_transform_scale_real32(
- vnode->id,
- ((VObjectData*)vnode->data)->scale[0],
- ((VObjectData*)vnode->data)->scale[1],
- ((VObjectData*)vnode->data)->scale[2]);
-}
-
-/*
- * send VerseLink to verse server
- */
-void send_verse_link(VLink *vlink)
-{
- verse_session_set(vlink->session->vsession);
-
- verse_send_o_link_set(
- vlink->source->id,
- vlink->id,
- vlink->target->id,
- vlink->label,
- vlink->target_id);
-}
-
-/*
- * set up pointer at VerseLink of target node (geometry node, material node, etc.)
- */
-static void set_target_node_link_pointer(VNode *vnode, VLink *vlink)
-{
- switch (vnode->type) {
- case V_NT_GEOMETRY:
- ((VGeomData*)vnode->data)->vlink = vlink;
- break;
- default:
- break;
- }
-}
-
-/*
- * free VerseLink and it's label
- */
-static void free_verse_link_data(VLink *vlink)
-{
- MEM_freeN(vlink->label);
-}
-
-/*
- * create new VerseLink
- */
-VLink *create_verse_link(
- VerseSession *session,
- VNode *source,
- VNode *target,
- uint16 link_id,
- uint32 target_id,
- const char *label)
-{
- struct VLink *vlink;
-
- vlink = (VLink*)MEM_mallocN(sizeof(VLink), "VerseLink");
- vlink->session = session;
- vlink->source = source;
- vlink->target = target;
- vlink->id = link_id;
- vlink->target_id = target_id;
-
- set_target_node_link_pointer(target, vlink);
-
- vlink->label = (char*)MEM_mallocN(sizeof(char)*(strlen(label)+1), "VerseLink label");
- vlink->label[0] = '\0';
- strcat(vlink->label, label);
-
- vlink->flag = 0;
-
- vlink->post_link_set = post_link_set;
- vlink->post_link_destroy = post_link_destroy;
-
- return vlink;
-}
-
-/*
- * free ObjectData (links, links in queue and lables of links)
- */
-void free_object_data(VNode *vnode)
-{
- struct VerseSession *session = vnode->session;
- struct VObjectData *obj = (VObjectData*)vnode->data;
- struct VLink *vlink;
- struct VMethodGroup *vmg;
-
- if(!obj) return;
-
- /* free all labels of links in dlist */
- vlink = obj->links.lb.first;
- while(vlink){
- free_verse_link_data(vlink);
- vlink = vlink->next;
- }
-
- /* free all labels of links waiting in queue */
- vlink = obj->queue.first;
- while(vlink){
- free_verse_link_data(vlink);
- vlink = vlink->next;
- }
- /* free dynamic list and sendig queue of links */
- BLI_dlist_destroy(&(obj->links));
- BLI_freelistN(&(obj->queue));
-
- /* free method groups and their methods */
- for(vmg = vnode->methodgroups.first; vmg; vmg= vmg->next) {
- free_verse_methodgroup(vmg);
- }
- BLI_freelistN(&(vnode->methodgroups));
-
- /* free constraint between VerseNode and Object */
- obj->post_object_free_constraint(vnode);
-
- /* unsubscribe from receiving changes of transformation matrix */
- if(session->flag & VERSE_CONNECTED)
- verse_send_o_transform_unsubscribe(vnode->id, 0);
-}
-
-/*
- * create new object data
- */
-VObjectData *create_object_data(void)
-{
- VObjectData *obj;
-
- obj = (VObjectData*)MEM_mallocN(sizeof(VObjectData), "VerseObjectData");
- obj->object = NULL;
- BLI_dlist_init(&(obj->links));
- obj->queue.first = obj->queue.last = NULL;
- obj->flag = 0;
-
- /* transformation matrix */
- obj->pos[0] = obj->pos[1] = obj->pos[2] = 0.0;
- obj->quat[0] = obj->quat[1] = obj->quat[2] = 0.0; obj->quat[3] = 1;
- obj->scale[0] = obj->scale[1] = obj->scale[2] = 1.0;
-
- /* transformation flags */
- obj->flag |= POS_SEND_READY;
- obj->flag |= ROT_SEND_READY;
- obj->flag |= SCALE_SEND_READY;
-
- /* set up pointers at post callback functions */
-/* obj->post_transform = post_transform;*/
- obj->post_transform_pos = post_transform_pos;
- obj->post_transform_rot = post_transform_rot;
- obj->post_transform_scale = post_transform_scale;
- obj->post_object_free_constraint = post_object_free_constraint;
-
- return obj;
-}
-
-/*
- * callback function:
- */
-static void cb_o_transform_pos_real32(
- void *user_data,
- VNodeID node_id,
- uint32 time_s,
- uint32 time_f,
- const real32 *pos,
- const real32 *speed,
- const real32 *accelerate,
- const real32 *drag_normal,
- real32 drag)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- float vec[3], dt, tmp;
-
- if(!session) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- ((VObjectData*)vnode->data)->flag |= POS_SEND_READY;
-
- /* verse server sends automaticaly some stupid default values ...
- * we have to ignore these values, when we created this object node */
- if( (vnode->owner_id==VN_OWNER_MINE) && !(((VObjectData*)vnode->data)->flag & POS_RECEIVE_READY) ) {
- ((VObjectData*)vnode->data)->flag |= POS_RECEIVE_READY;
- return;
- }
-
- dt = time_s + time_f/(0xffff);
-
- if(pos) {
- vec[0] = pos[0];
- vec[1] = pos[1];
- vec[2] = pos[2];
- }
- else {
- vec[0] = 0.0f;
- vec[1] = 0.0f;
- vec[2] = 0.0f;
- }
-
- if(speed) {
- vec[0] += speed[0]*dt;
- vec[1] += speed[1]*dt;
- vec[2] += speed[2]*dt;
- }
-
- if(accelerate) {
- vec[0] += accelerate[0]*dt*dt/2;
- vec[1] += accelerate[1]*dt*dt/2;
- vec[2] += accelerate[2]*dt*dt/2;
- }
-
- /* we have to do rotation around x axis (+pi/2) to be
- compatible with other verse applications */
- tmp = vec[1];
- vec[1] = -vec[2];
- vec[2] = tmp;
-
- if( (((VObjectData*)vnode->data)->pos[0] != vec[0]) ||
- (((VObjectData*)vnode->data)->pos[1] != vec[1]) ||
- (((VObjectData*)vnode->data)->pos[2] != vec[2]))
- {
- ((VObjectData*)vnode->data)->pos[0] = vec[0];
- ((VObjectData*)vnode->data)->pos[1] = vec[1];
- ((VObjectData*)vnode->data)->pos[2] = vec[2];
-
- ((VObjectData*)vnode->data)->post_transform_pos(vnode);
- }
-}
-
-/*
- * callback function:
- */
-static void cb_o_transform_rot_real32(
- void *user_data,
- VNodeID node_id,
- uint32 time_s,
- uint32 time_f,
- const VNQuat32 *quat,
- const VNQuat32 *speed,
- const VNQuat32 *accelerate,
- const VNQuat32 *drag_normal,
- real32 drag)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- float temp[4]={0, 0, 0, 0}, v[4], dt; /* temporary quaternions */
- float q[4]={cos(M_PI/4), -sin(M_PI/4), 0, 0}; /* conjugate quaternion (represents rotation
- around x-axis +90 degrees) */
-
- if(!session) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- ((VObjectData*)vnode->data)->flag |= ROT_SEND_READY;
-
- /* verse server sends automaticaly some stupid default values ...
- * we have to ignore these values, when we created this object node */
- if( (vnode->owner_id==VN_OWNER_MINE) && !(((VObjectData*)vnode->data)->flag & ROT_RECEIVE_READY) ) {
- ((VObjectData*)vnode->data)->flag |= ROT_RECEIVE_READY;
- return;
- }
-
- dt = time_s + time_f/(0xffff);
-
- if(quat) {
- temp[1] = quat->x;
- temp[2] = quat->y;
- temp[3] = quat->z;
- temp[0] = quat->w;
- }
-
- if(speed) {
- temp[1] += speed->x*dt;
- temp[2] += speed->y*dt;
- temp[3] += speed->z*dt;
- temp[0] += speed->w*dt;
- }
-
- if(accelerate) {
- temp[1] += accelerate->x*dt*dt/2;
- temp[2] += accelerate->y*dt*dt/2;
- temp[3] += accelerate->z*dt*dt/2;
- temp[0] += accelerate->w*dt*dt/2;
- }
-
- /* following matematical operation transform rotation:
- *
- * v' = quaternion * v * conjugate_quaternion
- *
- *, where v is original representation of rotation */
-
- mul_qt_qtqt(v, temp, q);
- q[1]= sin(M_PI/4); /* normal quaternion */
- mul_qt_qtqt(temp, q, v);
-
- if( (((VObjectData*)vnode->data)->quat[0] != temp[0]) ||
- (((VObjectData*)vnode->data)->quat[1] != temp[1]) ||
- (((VObjectData*)vnode->data)->quat[2] != temp[2]) ||
- (((VObjectData*)vnode->data)->quat[3] != temp[3]))
- {
- QUATCOPY(((VObjectData*)vnode->data)->quat, temp);
-
- ((VObjectData*)vnode->data)->post_transform_rot(vnode);
- }
-}
-
-/*
- * callback function:
- */
-static void cb_o_transform_scale_real32(
- void *user_data,
- VNodeID node_id,
- real32 scale_x,
- real32 scale_y,
- real32 scale_z)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- real32 tmp;
-
- if(!session) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- ((VObjectData*)vnode->data)->flag |= SCALE_SEND_READY;
-
- /* verse server sends automaticaly some stupid default values ...
- * we have to ignore these values, when we created this object node */
- if( (vnode->owner_id==VN_OWNER_MINE) && !(((VObjectData*)vnode->data)->flag & SCALE_RECEIVE_READY) ) {
- ((VObjectData*)vnode->data)->flag |= SCALE_RECEIVE_READY;
- return;
- }
-
- /* flip axis (verse spec) */
- tmp = scale_y;
- scale_y = scale_z;
- scale_z = tmp;
-
- /* z and y axis are flipped here too */
- if( (((VObjectData*)vnode->data)->scale[0] != scale_x) ||
- (((VObjectData*)vnode->data)->scale[1] != scale_y) ||
- (((VObjectData*)vnode->data)->scale[2] != scale_z))
- {
- ((VObjectData*)vnode->data)->scale[0] = scale_x;
- ((VObjectData*)vnode->data)->scale[1] = scale_y;
- ((VObjectData*)vnode->data)->scale[2] = scale_z;
-
- ((VObjectData*)vnode->data)->post_transform_scale(vnode);
- }
-}
-
-/*
- * callback function: link between object node and some other node was created
- */
-static void cb_o_link_set(
- void *user_data,
- VNodeID node_id,
- uint16 link_id,
- VNodeID link,
- const char *label,
- uint32 target_id)
-{
- struct VLink *vlink;
- struct VNode *source;
- struct VNode *target;
-
- struct VerseSession *session = (VerseSession*)current_verse_session();
-
- if(!session) return;
-
- source = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
- target = BLI_dlist_find_link(&(session->nodes), (unsigned int)link);
-
- if(!(source && target)) return;
-
- vlink = ((VObjectData*)source->data)->queue.first;
-
- if(vlink && (vlink->source==source) && (vlink->target==target)) {
- /* remove VerseLink from sending queue */
- BLI_remlink(&(((VObjectData*)source->data)->queue), vlink);
- /* add VerseLink to dynamic list of VerseLinks */
- BLI_dlist_add_item_index(&(((VObjectData*)source->data)->links), vlink, (unsigned int)link_id);
- /* send next link from sending queue */
- if(((VObjectData*)source->data)->queue.first)
- send_verse_link(((VObjectData*)source->data)->queue.first);
- /* set up VerseLink variables */
- vlink->flag = 0;
- vlink->id = link_id;
- vlink->target_id = target_id;
- }
- else {
- /* create new VerseLink */
- vlink = create_verse_link(session, source, target, link_id, target_id, label);
- /* add VerseLink to dynamic list of VerseLinks */
- BLI_dlist_add_item_index(&(((VObjectData*)source->data)->links), vlink, (unsigned int)link_id);
- }
-
- target->counter++;
-
- vlink->post_link_set(vlink);
-}
-
-/*
- * callback function: destroy link between two VerseNodes
- */
-static void cb_o_link_destroy(
- void *user_data,
- VNodeID node_id,
- uint16 link_id)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VNode *vnode;
- struct VLink *vlink;
-
- if(!session) return;
-
- vnode = BLI_dlist_find_link(&(session->nodes), (unsigned int)node_id);
-
- vlink = BLI_dlist_find_link(&(((VObjectData*)vnode->data)->links), link_id);
-
- if(vlink) {
- vlink->target->counter--;
- free_verse_link_data(vlink);
- BLI_dlist_free_item(&(((VObjectData*)vnode->data)->links), link_id);
- }
-
- vlink->post_link_destroy(vlink);
-}
-
-void set_object_callbacks(void)
-{
- /* position of object was changed */
- verse_callback_set(verse_send_o_transform_pos_real32, cb_o_transform_pos_real32, NULL);
- /* rotation of object was changed */
- verse_callback_set(verse_send_o_transform_rot_real32, cb_o_transform_rot_real32, NULL);
- /* size of object was changed */
- verse_callback_set(verse_send_o_transform_scale_real32, cb_o_transform_scale_real32, NULL);
- /* new link between nodes was created */
- verse_callback_set(verse_send_o_link_set, cb_o_link_set, NULL);
- /* link between nodes was destroyed */
- verse_callback_set(verse_send_o_link_destroy, cb_o_link_destroy, NULL);
-}
-
-#endif
diff --git a/source/blender/blenkernel/intern/verse_session.c b/source/blender/blenkernel/intern/verse_session.c
deleted file mode 100644
index 64d6b9885fe..00000000000
--- a/source/blender/blenkernel/intern/verse_session.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/**
- * $Id: verse_session.c 12931 2007-12-17 18:20:48Z theeth $
- *
- * ***** BEGIN GPL/BL DUAL 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifdef WITH_VERSE
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_mesh_types.h" /* temp */
-#include "DNA_listBase.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BLI_dynamiclist.h"
-#include "BLI_blenlib.h"
-
-#include "BIF_screen.h"
-#include "BIF_verse.h"
-
-#include "BKE_global.h"
-#include "BKE_verse.h"
-
-struct ListBase session_list={NULL, NULL};
-struct ListBase server_list={NULL, NULL};
-
-static int cb_ping_registered = 0;
-
-/* list of static function prototypes */
-static void cb_connect_terminate(const char *address, const char *bye);
-static void cb_connect_accept(void *user_data, uint32 avatar, void *address, void *connection, const uint8 *host_id);
-static void set_all_callbacks(void);
-static void free_verse_session_data(struct VerseSession *session);
-static void add_verse_server(VMSServer *server);
-static void check_connection_state(struct VerseServer *server);
-
-static void check_connection_state(struct VerseServer *server)
-{
- struct VerseSession *session;
- session = session_list.first;
- while(session) {
- if(strcmp(server->ip,session->address)==0) {
- server->flag = session->flag;
- return;
- }
- session = session->next;
- }
-}
-/*
- * add verse server to server_list. Prevents duplicate
- * entries
- */
-static void add_verse_server(VMSServer *server)
-{
- struct VerseServer *iter, *niter;
- VerseServer *newserver;
- const char *name = verse_ms_field_value(server, "DE");
- iter = server_list.first;
-
- while(iter) {
- niter = iter->next;
- if(strcmp(iter->ip, server->ip)==0) {
- return;
- }
- iter = niter;
- }
-
- newserver = (VerseServer *)MEM_mallocN(sizeof(VerseServer), "VerseServer");
- newserver->ip = (char *)MEM_mallocN(sizeof(char)*(strlen(server->ip)+1), "VerseServer ip");
- strcpy(newserver->ip, server->ip);
-
- if(name) {
- newserver->name = (char *)MEM_mallocN(sizeof(char)*(strlen(name)+strlen(newserver->ip)+4), "VerseServer name");
- strcpy(newserver->name, name);
- strcat(newserver->name, " (");
- strcat(newserver->name, newserver->ip);
- strcat(newserver->name, ")");
- }
-
- newserver->flag = 0;
- check_connection_state(newserver);
-
- printf("Adding new verse server: %s at %s\n", newserver->name, newserver->ip);
-
- BLI_addtail(&server_list, newserver);
- post_server_add();
-}
-
-/*
- * callback function for ping
- */
-static void cb_ping(void *user, const char *address, const char *message)
-{
- VMSServer **servers = verse_ms_list_parse(message);
- if(servers != NULL)
- {
- int i;
-
- for(i = 0; servers[i] != NULL; i++)
- add_verse_server(servers[i]);
-
- free(servers);
- }
-}
-
-/*
- * callback function for connection terminated
- */
-static void cb_connect_terminate(const char *address, const char *bye)
-{
- VerseSession *session = (VerseSession*)current_verse_session();
-
- if(!session) return;
-
- /* remove session from list of session */
- BLI_remlink(&session_list, session);
- /* do post connect operations */
- session->post_connect_terminated(session);
- /* free session data */
- free_verse_session_data(session);
- /* free session */
- MEM_freeN(session);
-}
-
-/*
- * callback function for accepted connection to verse server
- */
-static void cb_connect_accept(
- void *user_data,
- uint32 avatar,
- void *address,
- void *connection,
- const uint8 *host_id)
-{
- struct VerseSession *session = (VerseSession*)current_verse_session();
- struct VerseServer *server = server_list.first;
- uint32 i, mask=0;
-
- if(!session) return;
-
- session->flag |= VERSE_CONNECTED;
- session->flag &= ~VERSE_CONNECTING;
-
- while(server) {
- if(strcmp(session->address, server->ip)==0) {
- server->flag |= VERSE_CONNECTED;
- server->flag &= ~VERSE_CONNECTING;
- server->session = session;
- break;
- }
- server = server->next;
- }
-
- printf("\tBlender is connected to verse server: %s\n", (char*)address);
- printf("\tVerseSession->counter: %d\n", session->counter);
-
- session->avatar = avatar;
-
- session->post_connect_accept(session);
-
- for(i = 0; i < V_NT_NUM_TYPES; i++)
- mask = mask | (1 << i);
- verse_send_node_index_subscribe(mask);
- verse_send_node_subscribe(session->avatar); /* subscribe to avatar node, as well */
-
- /* create our own method group and method */
- /*verse_send_o_method_group_create(session->avatar, ~0, "tawk-client");*/
-}
-
-/*
- * set up all callbacks for sessions
- */
-void set_verse_session_callbacks(void)
-{
- /* connection */
- verse_callback_set(verse_send_connect_accept, cb_connect_accept, NULL);
- /* connection was terminated */
- verse_callback_set(verse_send_connect_terminate, cb_connect_terminate, NULL);
-
-}
-
-/*
- * set all callbacks used in Blender
- */
-static void set_all_callbacks(void)
-{
- /* set up all callbacks for sessions */
- set_verse_session_callbacks();
-
- /* set up callbacks for nodes */
- set_node_callbacks();
-
- /* set up all callbacks for object nodes */
- set_object_callbacks();
-
- /* set up all callbacks for geometry nodes */
- set_geometry_callbacks();
-
- /* set up all callbacks for bitmap nodes */
- set_bitmap_callbacks();
-
- /* set up all callbacks for method groups and methods */
- set_method_callbacks();
-}
-
-/*
- * this function sends and receive all packets for all sessions
- */
-void b_verse_update(void)
-{
- VerseSession *session, *next_session;
-
- session = session_list.first;
- while(session){
- next_session = session->next;
- verse_session_set(session->vsession);
- if((session->flag & VERSE_CONNECTED) || (session->flag & VERSE_CONNECTING)) {
- verse_callback_update(10);
- session->post_connect_update(session);
- }
- session = next_session;
- }
- if(cb_ping_registered>0) {
- verse_callback_update(10);
- }
-}
-
-/*
- * returns VerseSession coresponding to vsession pointer
- */
-VerseSession *versesession_from_vsession(VSession *vsession)
-{
- struct VerseSession *session;
-
- session = session_list.first;
-
- while(session) {
- if(session->vsession==vsession) return session;
- session = session->next;
- }
-
- return session;
-}
-
-/*
- * returns pointer at current VerseSession
- */
-VerseSession *current_verse_session(void)
-{
- struct VerseSession *session;
- VSession vsession = verse_session_get();
-
- session = session_list.first;
-
- while(session){
- if(session->vsession == vsession)
- return session;
- session = session->next;
- }
-
- printf("error: non-existing SESSION occured!\n");
- return NULL;
-}
-
-/*
- * free VerseSession
- */
-static void free_verse_session_data(VerseSession *session)
-{
- struct VNode *vnode;
-
- /* free data of all nodes */
- vnode = session->nodes.lb.first;
- while(vnode){
- free_verse_node_data(vnode);
- vnode = vnode->next;
- }
-
- /* free data of nodes waiting in queue */
- vnode = session->queue.first;
- while(vnode){
- free_verse_node_data(vnode);
- vnode = vnode->next;
- }
-
- /* free all VerseNodes */
- BLI_dlist_destroy(&(session->nodes));
- /* free all VerseNodes waiting in queque */
- BLI_freelistN(&(session->queue));
-
- /* free name of verse host for this session */
- MEM_freeN(session->address);
-}
-
-/*
- * free VerseSession
- */
-void free_verse_session(VerseSession *session)
-{
- /* remove session from session list*/
- BLI_remlink(&session_list, session);
- /* do post terminated operations */
- session->post_connect_terminated(session);
- /* free session data (nodes, layers) */
- free_verse_session_data(session);
- /* free session */
- MEM_freeN(session);
-}
-
-/*
- * create new verse session and return coresponding data structure
- */
-VerseSession *create_verse_session(
- const char *name,
- const char *pass,
- const char *address,
- uint8 *expected_key)
-{
- struct VerseSession *session;
- VSession *vsession;
-
- vsession = verse_send_connect(name, pass, address, expected_key);
-
- if(!vsession) return NULL;
-
- session = (VerseSession*)MEM_mallocN(sizeof(VerseSession), "VerseSession");
-
- session->flag = VERSE_CONNECTING;
-
- session->vsession = vsession;
- session->avatar = -1;
-
- session->address = (char*)MEM_mallocN(sizeof(char)*(strlen(address)+1),"session adress name");
- strcpy(session->address, address);
-
- session->connection = NULL;
- session->host_id = NULL;
- session->counter = 0;
-
- /* initialize dynamic list of nodes and node queue */
- BLI_dlist_init(&(session->nodes));
- session->queue.first = session->queue.last = NULL;
-
- /* set up all client dependent functions */
- session->post_connect_accept = post_connect_accept;
- session->post_connect_terminated = post_connect_terminated;
- session->post_connect_update = post_connect_update;
-
- post_server_add();
-
- return session;
-}
-
-/*
- * end verse session and free all session data
- */
-void end_verse_session(VerseSession *session)
-{
- /* send terminate command to verse server */
- verse_send_connect_terminate(session->address, "blender: bye bye");
- /* update callbacks */
- verse_callback_update(1000);
- /* send destroy session command to verse server */
- verse_session_destroy(session->vsession);
- /* set up flag of verse session */
- session->flag &= ~VERSE_CONNECTED;
- /* do post connect operations */
- session->post_connect_terminated(session);
- /* free structure of verse session */
- free_verse_session(session);
-}
-
-void free_all_servers(void)
-{
- VerseServer *server, *nextserver;
-
- server = server_list.first;
-
- while(server) {
- nextserver = server->next;
- BLI_remlink(&server_list, server);
- MEM_freeN(server->name);
- MEM_freeN(server->ip);
- MEM_freeN(server);
- server = nextserver;
- }
-
- BLI_freelistN(&server_list);
-}
-
-/*
- * end connection to all verse hosts (servers) ... free all VerseSessions
- * free all VerseServers
- */
-void end_all_verse_sessions(void)
-{
- VerseSession *session,*nextsession;
-
- session = session_list.first;
-
- while(session) {
- nextsession= session->next;
- end_verse_session(session);
- /* end next session */
- session = nextsession;
- }
-
- BLI_freelistN(&session_list);
-
- free_all_servers();
-}
-
-/*
- * do a get from ms
- */
-void b_verse_ms_get(void)
-{
- if(cb_ping_registered==0) {
- /* handle ping messages (for master server) */
- verse_callback_set(verse_send_ping, cb_ping, NULL);
- add_screenhandler(G.curscreen, SCREEN_HANDLER_VERSE, 1);
- cb_ping_registered++;
- }
- free_all_servers();
-
- verse_ms_get_send(U.versemaster, VERSE_MS_FIELD_DESCRIPTION, NULL);
- verse_callback_update(10);
-}
-
-/*
- * connect to verse host, set up all callbacks, create session
- */
-void b_verse_connect(char *address)
-{
- VerseSession *session = NULL;
-
- /* if no session was created before, then set up all callbacks */
- if((session_list.first==NULL) && (session_list.last==NULL))
- set_all_callbacks();
-
- /* create new session */
- if(address)
- session = create_verse_session("Blender", "pass", address, NULL);
-
- if(session) {
- /* add new session to the list of sessions */
- BLI_addtail(&session_list, session);
-
- /* add verse handler if this is first session */
- if(session_list.first == session_list.last)
- add_screenhandler(G.curscreen, SCREEN_HANDLER_VERSE, 1);
-
- }
-}
-
-#endif
diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h
deleted file mode 100644
index dd673ff095e..00000000000
--- a/source/blender/blenlib/BLI_arithb.h
+++ /dev/null
@@ -1,569 +0,0 @@
-#undef TEST_ACTIVE
-//#define ACTIVE 1
-/**
- * blenlib/BLI_math.h mar 2001 Nzc
- *
- * $Id$
- *
- * ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * */
-
-#ifndef BLI_ARITHB_H
-#define BLI_ARITHB_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef WIN32
-#define _USE_MATH_DEFINES
-#endif
-
-#include <math.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
-#endif
-#ifndef M_SQRT2
-#define M_SQRT2 1.41421356237309504880
-#endif
-#ifndef M_SQRT1_2
-#define M_SQRT1_2 0.70710678118654752440
-#endif
-#ifndef M_1_PI
-#define M_1_PI 0.318309886183790671538
-#endif
-
-#ifndef M_E
-#define M_E 2.7182818284590452354
-#endif
-#ifndef M_LOG2E
-#define M_LOG2E 1.4426950408889634074
-#endif
-#ifndef M_LOG10E
-#define M_LOG10E 0.43429448190325182765
-#endif
-#ifndef M_LN2
-#define M_LN2 0.69314718055994530942
-#endif
-#ifndef M_LN10
-#define M_LN10 2.30258509299404568402
-#endif
-
-#ifndef sqrtf
-#define sqrtf(a) ((float)sqrt(a))
-#endif
-#ifndef powf
-#define powf(a, b) ((float)pow(a, b))
-#endif
-#ifndef cosf
-#define cosf(a) ((float)cos(a))
-#endif
-#ifndef sinf
-#define sinf(a) ((float)sin(a))
-#endif
-#ifndef acosf
-#define acosf(a) ((float)acos(a))
-#endif
-#ifndef asinf
-#define asinf(a) ((float)asin(a))
-#endif
-#ifndef atan2f
-#define atan2f(a, b) ((float)atan2(a, b))
-#endif
-#ifndef tanf
-#define tanf(a) ((float)tan(a))
-#endif
-#ifndef atanf
-#define atanf(a) ((float)atan(a))
-#endif
-#ifndef floorf
-#define floorf(a) ((float)floor(a))
-#endif
-#ifndef ceilf
-#define ceilf(a) ((float)ceil(a))
-#endif
-#ifndef fabsf
-#define fabsf(a) ((float)fabs(a))
-#endif
-#ifndef logf
-#define logf(a) ((float)log(a))
-#endif
-#ifndef expf
-#define expf(a) ((float)exp(a))
-#endif
-#ifndef fmodf
-#define fmodf(a, b) ((float)fmod(a, b))
-#endif
-
-#ifdef WIN32
- #ifndef FREE_WINDOWS
- #define isnan(n) _isnan(n)
- #define finite _finite
- #endif
-#endif
-
-#define MAT4_UNITY {{ 1.0, 0.0, 0.0, 0.0},\
- { 0.0, 1.0, 0.0, 0.0},\
- { 0.0, 0.0, 1.0, 0.0},\
- { 0.0, 0.0, 0.0, 1.0}}
-
-#define MAT3_UNITY {{ 1.0, 0.0, 0.0},\
- { 0.0, 1.0, 0.0},\
- { 0.0, 0.0, 1.0}}
-
-
-void cent_tri_v3(float *cent, float *v1, float *v2, float *v3);
-void cent_quad_v3(float *cent, float *v1, float *v2, float *v3, float *v4);
-
-void cross_v3_v3v3(float *c, float *a, float *b);
-void project_v3_v3v3(float *c, float *v1, float *v2);
-
-float dot_v3v3(float *v1, float *v2);
-float dot_v2v2(float *v1, float *v2);
-
-float normalize_v3(float *n);
-float normalize_v2(float *n);
-double normalize_dv3(double n[3]);
-
-float Sqrt3f(float f);
-double sqrt3d(double d);
-
-float saacos(float fac);
-float saasin(float fac);
-float sasqrt(float fac);
-float saacosf(float fac);
-float saasinf(float fac);
-float sasqrtf(float fac);
-
-int compare_v3v3(float *v1, float *v2, float limit);
-int compare_v4v4(float *v1, float *v2, float limit);
-float interpf(float target, float origin, float fac);
-
-float normal_tri_v3( float *n,float *v1, float *v2, float *v3);
-float normal_quad_v3( float *n,float *v1, float *v2, float *v3, float *v4);
-
-void CalcNormLong(int *v1, int *v2, int *v3, float *n);
-/* CalcNormShort: is ook uitprodukt - (translates as 'is also out/cross product') */
-void CalcNormShort(short *v1, short *v2, short *v3, float *n);
-float power_of_2(float val);
-
-/**
- * @section Euler conversion routines (With Custom Order)
- */
-
-/* Defines for rotation orders
- * WARNING: must match the eRotationModes in DNA_action_types.h
- * order matters - types are saved to file!
- */
-typedef enum eEulerRotationOrders {
- EULER_ORDER_DEFAULT = 1, /* Blender 'default' (classic) is basically XYZ */
- EULER_ORDER_XYZ = 1, /* Blender 'default' (classic) - must be as 1 to sync with PoseChannel rotmode */
- EULER_ORDER_XZY,
- EULER_ORDER_YXZ,
- EULER_ORDER_YZX,
- EULER_ORDER_ZXY,
- EULER_ORDER_ZYX,
- /* NOTE: there are about 6 more entries when including duplicated entries too */
-} eEulerRotationOrders;
-
-void eulO_to_quat( float quat[4],float eul[3], short order);
-void quat_to_eulO( float eul[3], short order,float quat[4]);
-
-void eulO_to_mat3( float Mat[3][3],float eul[3], short order);
-void eulO_to_mat4( float Mat[4][4],float eul[3], short order);
-
-void mat3_to_eulO( float eul[3], short order,float Mat[3][3]);
-void mat4_to_eulO( float eul[3], short order,float Mat[4][4]);
-
-void mat3_to_compatible_eulO( float eul[3], float oldrot[3], short order,float mat[3][3]);
-
-void rotate_eulO(float beul[3], short order, char axis, float ang);
-
-/**
- * @section Euler conversion routines (Blender XYZ)
- */
-
-void eul_to_mat3( float mat[][3],float *eul);
-void eul_to_mat4( float mat[][4],float *eul);
-
-void mat3_to_eul( float *eul,float tmat[][3]);
-void mat4_to_eul(float *eul,float tmat[][4]);
-
-void eul_to_quat( float *quat,float *eul);
-
-void mat3_to_compatible_eul( float *eul, float *oldrot,float mat[][3]);
-void eulO_to_gimbal_axis(float gmat[][3], float *eul, short order);
-
-
-void compatible_eul(float *eul, float *oldrot);
-void rotate_eul(float *beul, char axis, float ang);
-
-
-/**
- * @section Quaternion arithmetic routines
- */
-
-int is_zero_qt(float *q);
-void quat_to_eul( float *eul,float *quat);
-void unit_qt(float *);
-void mul_qt_qtqt(float *, float *, float *);
-void mul_qt_v3(float *q, float *v);
-void mul_qt_fl(float *q, float f);
-void mul_fac_qt_fl(float *q, float fac);
-
-void normalize_qt(float *);
-void axis_angle_to_quat( float *quat,float *vec, float phi);
-
-void sub_qt_qtqt(float *q, float *q1, float *q2);
-void conjugate_qt(float *q);
-void invert_qt(float *q);
-float dot_qtqt(float *q1, float *q2);
-void copy_qt_qt(float *q1, float *q2);
-
-void print_qt(char *str, float q[4]);
-
-void interp_qt_qtqt(float *result, float *quat1, float *quat2, float t);
-void add_qt_qtqt(float *result, float *quat1, float *quat2, float t);
-
-void quat_to_mat3( float m[][3],float *q);
-void quat_to_mat4( float m[][4],float *q);
-
-/**
- * @section matrix multiplication and copying routines
- */
-
-void mul_m3_fl(float *m, float f);
-void mul_m4_fl(float *m, float f);
-void mul_mat3_m4_fl(float *m, float f);
-
-void transpose_m3(float mat[][3]);
-void transpose_m4(float mat[][4]);
-
-int invert_m4_m4(float inverse[][4], float mat[][4]);
-void invert_m4_m4(float inverse[][4], float mat[][4]);
-void invert_m4_m4(float *m1, float *m2);
-void invert_m4_m4(float out[][4], float in[][4]);
-void invert_m3_m3(float m1[][3], float m2[][3]);
-
-void copy_m3_m4(float m1[][3],float m2[][4]);
-void copy_m4_m3(float m1[][4], float m2[][3]);
-
-void blend_m3_m3m3(float out[][3], float dst[][3], float src[][3], float srcweight);
-void blend_m4_m4m4(float out[][4], float dst[][4], float src[][4], float srcweight);
-
-float determinant_m2(float a,float b,float c, float d);
-
-float determinant_m3(
- float a1, float a2, float a3,
- float b1, float b2, float b3,
- float c1, float c2, float c3
-);
-
-float determinant_m4(float m[][4]);
-
-void adjoint_m3_m3(float m1[][3], float m[][3]);
-void adjoint_m4_m4(float out[][4], float in[][4]);
-
-void mul_m4_m4m4(float m1[][4], float m2[][4], float m3[][4]);
-void subMat4MulMat4(float *m1, float *m2, float *m3);
-#ifndef TEST_ACTIVE
-void mul_m3_m3m3(float m1[][3], float m3[][3], float m2[][3]);
-#else
-void mul_m3_m3m3(float *m1, float *m3, float *m2);
-#endif
-void mul_m4_m3m4(float (*m1)[4], float (*m3)[3], float (*m2)[4]);
-void copy_m4_m4(float m1[][4], float m2[][4]);
-void swap_m4m4(float m1[][4], float m2[][4]);
-void copy_m3_m3(float m1[][3], float m2[][3]);
-
-void mul_serie_m3(float answ[][3],
- float m1[][3], float m2[][3], float m3[][3],
- float m4[][3], float m5[][3], float m6[][3],
- float m7[][3], float m8[][3]
-);
-
-void mul_serie_m4(float answ[][4], float m1[][4],
- float m2[][4], float m3[][4], float m4[][4],
- float m5[][4], float m6[][4], float m7[][4],
- float m8[][4]
-);
-
-void zero_m4(float *m);
-void zero_m3(float *m);
-
-void unit_m3(float m[][3]);
-void unit_m4(float m[][4]);
-
-/* NOTE: These only normalise the matrix, they don't make it orthogonal */
-void normalize_m3(float mat[][3]);
-void normalize_m4(float mat[][4]);
-
-int is_orthogonal_m3(float mat[][3]);
-void orthogonalize_m3(float mat[][3], int axis); /* axis is the one to keep in place (assumes it is non-null) */
-int is_orthogonal_m4(float mat[][4]);
-void orthogonalize_m4(float mat[][4], int axis); /* axis is the one to keep in place (assumes it is non-null) */
-
-void mul_v3_m4v3(float *in, float mat[][4], float *vec);
-void mul_m4_m4m3(float (*m1)[4], float (*m3)[4], float (*m2)[3]);
-void mul_m3_m3m4(float m1[][3], float m2[][3], float m3[][4]);
-
-void Mat4MulVec(float mat[][4],int *vec);
-void mul_m4_v3(float mat[][4], float *vec);
-void mul_mat3_m4_v3(float mat[][4], float *vec);
-void mul_project_m4_v4(float mat[][4],float *vec);
-void mul_m4_v4(float mat[][4], float *vec);
-void Mat3MulVec(float mat[][3],int *vec);
-void mul_m3_v3(float mat[][3], float *vec);
-void mul_m3_v3_double(float mat[][3], double *vec);
-void mul_transposed_m3_v3(float mat[][3], float *vec);
-
-void add_m3_m3m3(float m1[][3], float m2[][3], float m3[][3]);
-void add_m4_m4m4(float m1[][4], float m2[][4], float m3[][4]);
-
-void VecUpMat3old(float *vec, float mat[][3], short axis);
-void VecUpMat3(float *vec, float mat[][3], short axis);
-
-void copy_v3_v3(float *v1, float *v2);
-int VecLen(int *v1, int *v2);
-float len_v3v3(float v1[3], float v2[3]);
-float len_v3(float *v);
-void mul_v3_fl(float *v1, float f);
-void negate_v3(float *v1);
-
-int compare_len_v3v3(float *v1, float *v2, float limit);
-int compare_v3v3(float *v1, float *v2, float limit);
-int equals_v3v3(float *v1, float *v2);
-int is_zero_v3(float *v);
-
-void print_v3(char *str,float v[3]);
-void print_v4(char *str, float v[4]);
-
-void add_v3_v3v3(float *v, float *v1, float *v2);
-void sub_v3_v3v3(float *v, float *v1, float *v2);
-void mul_v3_v3v3(float *v, float *v1, float *v2);
-void interp_v3_v3v3(float *target, const float *a, const float *b, const float t);
-void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3]);
-void mid_v3_v3v3(float *v, float *v1, float *v2);
-
-void ortho_basis_v3v3_v3( float *v1, float *v2,float *v);
-
-float len_v2v2(float *v1, float *v2);
-float len_v2(float *v);
-void mul_v2_fl(float *v1, float f);
-void add_v2_v2v2(float *v, float *v1, float *v2);
-void sub_v2_v2v2(float *v, float *v1, float *v2);
-void copy_v2_v2(float *v1, float *v2);
-void interp_v2_v2v2(float *target, const float *a, const float *b, const float t);
-void interp_v2_v2v2v2(float p[2], const float v1[2], const float v2[2], const float v3[2], const float w[3]);
-
-void axis_angle_to_quat(float q[4], float axis[3], float angle);
-void quat_to_axis_angle( float axis[3], float *angle,float q[4]);
-void axis_angle_to_eulO( float eul[3], short order,float axis[3], float angle);
-void eulO_to_axis_angle( float axis[3], float *angle,float eul[3], short order);
-void axis_angle_to_mat3( float mat[3][3],float axis[3], float angle);
-void axis_angle_to_mat4( float mat[4][4],float axis[3], float angle);
-void mat3_to_axis_angle( float axis[3], float *angle,float mat[3][3]);
-void mat4_to_axis_angle( float axis[3], float *angle,float mat[4][4]);
-
-void mat3_to_vec_rot( float axis[3], float *angle,float mat[3][3]);
-void mat4_to_vec_rot( float axis[3], float *angle,float mat[4][4]);
-void vec_rot_to_mat3( float mat[][3],float *vec, float phi);
-void vec_rot_to_mat4( float mat[][4],float *vec, float phi);
-
-void rotation_between_vecs_to_quat(float *q, float v1[3], float v2[3]);
-void vec_to_quat( float *q,float *vec, short axis, short upflag);
-void mat3_to_quat_is_ok( float *q,float wmat[][3]);
-
-void reflect_v3_v3v3(float *out, float *v1, float *v2);
-void bisect_v3_v3v3v3(float *v, float *v1, float *v2, float *v3);
-float angle_v2v2(float *v1, float *v2);
-float angle_v3v3v3(float *v1, float *v2, float *v3);
-float angle_normalized_v3v3(float *v1, float *v2);
-
-float angle_v2v2v2(float *v1, float *v2, float *v3);
-float angle_normalized_v2v2(float *v1, float *v2);
-
-void normal_short_to_float_v3(float *out, short *in);
-void normal_float_to_short_v3(short *out, float *in);
-
-float dist_to_line_v2(float *v1, float *v2, float *v3);
-float dist_to_line_segment_v2(float *v1, float *v2, float *v3);
-float dist_to_line_segment_v3(float *v1, float *v2, float *v3);
-void closest_to_line_segment_v3(float *closest, float v1[3], float v2[3], float v3[3]);
-float area_tri_v2(float *v1, float *v2, float *v3);
-float area_quad_v3(float *v1, float *v2, float *v3, float *v4);
-float area_tri_v3(float *v1, float *v2, float *v3);
-float area_poly_v3(int nr, float *verts, float *normal);
-
-/* intersect Line-Line
- return:
- -1: colliniar
- 0: no intersection of segments
- 1: exact intersection of segments
- 2: cross-intersection of segments
-*/
-extern short isect_line_line_v2(float *v1, float *v2, float *v3, float *v4);
-extern short isect_line_line_v2_short(short *v1, short *v2, short *v3, short *v4);
-
-/*point in tri, 0 no intersection, 1 intersect */
-int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2]);
-/* point in quad, 0 no intersection, 1 intersect */
-int isect_point_quad_v2(float pt[2], float v1[2], float v2[2], float v3[2], float v4[2]);
-
-/* interpolation weights of point in a triangle or quad, v4 may be NULL */
-void interp_weights_face_v3( float *w,float *v1, float *v2, float *v3, float *v4, float *co);
-/* interpolation weights of point in a polygon with >= 3 vertices */
-void interp_weights_poly_v3( float *w,float v[][3], int n, float *co);
-
-void i_lookat(
- float vx, float vy,
- float vz, float px,
- float py, float pz,
- float twist, float mat[][4]
-);
-
-void i_window(
- float left, float right,
- float bottom, float top,
- float nearClip, float farClip,
- float mat[][4]
-);
-
-#define BLI_CS_SMPTE 0
-#define BLI_CS_REC709 1
-#define BLI_CS_CIE 2
-
-#define RAD2DEG(_rad) ((_rad)*(180.0/M_PI))
-#define DEG2RAD(_deg) ((_deg)*(M_PI/180.0))
-
-void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b);
-void hex_to_rgb(char *hexcol, float *r, float *g, float *b);
-void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv);
-void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb);
-void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb);
-void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr);
-void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv);
-void xyz_to_rgb(float x, float y, float z, float *r, float *g, float *b, int colorspace);
-int constrain_rgb(float *r, float *g, float *b);
-unsigned int hsv_to_cpack(float h, float s, float v);
-unsigned int rgb_to_cpack(float r, float g, float b);
-void cpack_to_rgb(unsigned int col, float *r, float *g, float *b);
-void minmax_rgb(short c[]);
-
-
-
-void star_m3_v3(float mat[][3],float *vec);
-
-short EenheidsMat(float mat[][3]);
-
-void orthographic_m4( float matrix[][4],float left, float right, float bottom, float top, float nearClip, float farClip);
-void polarview_m4( float Vm[][4],float dist, float azimuth, float incidence, float twist);
-void translate_m4( float mat[][4],float Tx, float Ty, float Tz);
-void i_multmatrix(float icand[][4], float Vm[][4]);
-void rotate_m4( float mat[][4], char axis,float angle);
-
-
-
-void minmax_v3_v3v3(float *min, float *max, float *vec);
-void size_to_mat3( float mat[][3],float *size);
-void size_to_mat4( float mat[][4],float *size);
-
-float mat3_to_scale(float mat[][3]);
-float mat4_to_scale(float mat[][4]);
-
-void print_m3(char *str, float m[][3]);
-void print_m4(char *str, float m[][4]);
-
-/* uit Sig.Proc.85 pag 253 */
-void mat3_to_quat( float *q,float wmat[][3]);
-void mat4_to_quat( float *q,float m[][4]);
-
-void mat3_to_size( float *size,float mat[][3]);
-void mat4_to_size( float *size,float mat[][4]);
-
-void tri_to_quat( float *quat,float *v1, float *v2, float *v3);
-
-void loc_eul_size_to_mat4(float mat[4][4], float loc[3], float eul[3], float size[3]);
-void loc_eulO_size_to_mat4(float mat[4][4], float loc[3], float eul[3], float size[3], short rotOrder);
-void loc_quat_size_to_mat4(float mat[4][4], float loc[3], float quat[4], float size[3]);
-
-void map_to_tube( float *u, float *v,float x, float y, float z);
-void map_to_sphere( float *u, float *v,float x, float y, float z);
-
-int isect_line_line_v3(float v1[3], float v2[3], float v3[3], float v4[3], float i1[3], float i2[3]);
-int isect_line_line_strict_v3(float v1[3], float v2[3], float v3[3], float v4[3], float vi[3], float *lambda);
-int isect_line_tri_v3(float p1[3], float p2[3], float v0[3], float v1[3], float v2[3], float *lambda, float *uv);
-int isect_ray_tri_v3(float p1[3], float d[3], float v0[3], float v1[3], float v2[3], float *lambda, float *uv);
-int isect_ray_tri_threshold_v3(float p1[3], float d[3], float v0[3], float v1[3], float v2[3], float *lambda, float *uv, float threshold);
-int isect_sweeping_sphere_tri_v3(float p1[3], float p2[3], float radius, float v0[3], float v1[3], float v2[3], float *lambda, float *ipoint);
-int isect_axial_line_tri_v3(int axis, float co1[3], float co2[3], float v0[3], float v1[3], float v2[3], float *lambda);
-int isect_aabb_aabb_v3(float min1[3], float max1[3], float min2[3], float max2[3]);
-void interp_cubic_v3( float *x, float *v,float *x1, float *v1, float *x2, float *v2, float t);
-void isect_point_quad_uv_v2(float v0[2], float v1[2], float v2[2], float v3[2], float pt[2], float *uv);
-void isect_point_face_uv_v2(int isquad, float v0[2], float v1[2], float v2[2], float v3[2], float pt[2], float *uv);
-int isect_point_tri_v2(float v1[2], float v2[2], float v3[2], float pt[2]);
-int isect_point_tri_v2_int(int x1, int y1, int x2, int y2, int a, int b);
-int isect_point_tri_prism_v3(float p[3], float v1[3], float v2[3], float v3[3]);
-
-float closest_to_line_v3( float cp[3],float p[3], float l1[3], float l2[3]);
-
-float shell_angle_to_dist(const float angle);
-
-typedef struct DualQuat {
- float quat[4];
- float trans[4];
-
- float scale[4][4];
- float scale_weight;
-} DualQuat;
-
-void mat4_to_dquat( DualQuat *dq,float basemat[][4], float mat[][4]);
-void dquat_to_mat4( float mat[][4],DualQuat *dq);
-void add_weighted_dq_dq(DualQuat *dqsum, DualQuat *dq, float weight);
-void normalize_dq(DualQuat *dq, float totweight);
-void mul_v3m3_dq( float *co, float mat[][3],DualQuat *dq);
-void copy_dq_dq(DualQuat *dq1, DualQuat *dq2);
-
-/* Tangent stuff */
-typedef struct VertexTangent {
- float tang[3], uv[2];
- struct VertexTangent *next;
-} VertexTangent;
-
-void sum_or_add_vertex_tangent(void *arena, VertexTangent **vtang, float *tang, float *uv);
-float *find_vertex_tangent(VertexTangent *vtang, float *uv);
-void tangent_from_uv(float *uv1, float *uv2, float *uv3, float *co1, float *co2, float *co3, float *n, float *tang);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index 8f2cd02c35e..dcc71fa1258 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -43,10 +43,6 @@ extern "C" {
#include <stdlib.h>
#include <string.h>
-
-#include "BKE_utildefines.h"
-#include "MEM_guardedalloc.h"
-
#include "BLI_mempool.h"
#include "BLI_blenlib.h"
@@ -79,6 +75,11 @@ typedef struct GHashIterator {
GHash* BLI_ghash_new (GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info);
void BLI_ghash_free (GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
+//BM_INLINE void BLI_ghash_insert (GHash *gh, void *key, void *val);
+//BM_INLINE int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
+//BM_INLINE void* BLI_ghash_lookup (GHash *gh, void *key);
+//BM_INLINE int BLI_ghash_haskey (GHash *gh, void *key);
+
int BLI_ghash_size (GHash *gh);
/* *** */
@@ -153,6 +154,32 @@ int BLI_ghashutil_intcmp(const void *a, const void *b);
/*begin of macro-inlined functions*/
extern unsigned int hashsizes[];
+#if 0
+#define BLI_ghash_insert(gh, _k, _v){\
+ unsigned int _hash= (gh)->hashfp(_k)%gh->nbuckets;\
+ Entry *_e= BLI_mempool_alloc((gh)->entrypool);\
+ _e->key= _k;\
+ _e->val= _v;\
+ _e->next= (gh)->buckets[_hash];\
+ (gh)->buckets[_hash]= _e;\
+ if (++(gh)->nentries>(gh)->nbuckets*3) {\
+ Entry *_e, **_old= (gh)->buckets;\
+ int _i, _nold= (gh)->nbuckets;\
+ (gh)->nbuckets= hashsizes[++(gh)->cursize];\
+ (gh)->buckets= malloc((gh)->nbuckets*sizeof(*(gh)->buckets));\
+ memset((gh)->buckets, 0, (gh)->nbuckets*sizeof(*(gh)->buckets));\
+ for (_i=0; _i<_nold; _i++) {\
+ for (_e= _old[_i]; _e;) {\
+ Entry *_n= _e->next;\
+ _hash= (gh)->hashfp(_e->key)%(gh)->nbuckets;\
+ _e->next= (gh)->buckets[_hash];\
+ (gh)->buckets[_hash]= _e;\
+ _e= _n;\
+ }\
+ }\
+ free(_old); } }
+#endif
+
/*---------inlined functions---------*/
BM_INLINE void BLI_ghash_insert(GHash *gh, void *key, void *val) {
unsigned int hash= gh->hashfp(key)%gh->nbuckets;
@@ -244,4 +271,5 @@ BM_INLINE int BLI_ghash_haskey(GHash *gh, void *key) {
#ifdef __cplusplus
}
#endif
+
#endif
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 167a65f82da..833449aaf24 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -83,6 +83,10 @@ set(SRC
intern/voxel.c
intern/winstuff.c
+ BLI_array.h
+ BLI_cellalloc.h
+ BLI_smallhash.h
+ BLI_sparsemap.h
BLI_args.h
BLI_blenlib.h
BLI_boxpack2d.h
diff --git a/source/blender/blenlib/intern/BLI_cellalloc.c b/source/blender/blenlib/intern/BLI_cellalloc.c
index 88344e26464..43af8045595 100644
--- a/source/blender/blenlib/intern/BLI_cellalloc.c
+++ b/source/blender/blenlib/intern/BLI_cellalloc.c
@@ -40,7 +40,7 @@
#include "MEM_guardedalloc.h"
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index abf7e074a15..bf635042140 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index 3d6734d5368..f98d01099b3 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -37,6 +37,8 @@
#include <string.h>
#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
#include "BLI_edgehash.h"
#include "BLI_mempool.h"
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a5cb20a1352..b3af761d965 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -91,11 +91,11 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_cellalloc.h"
#include "BLI_edgehash.h"
-#include "BLI_utildefines.h"
#include "BKE_anim.h"
#include "BKE_action.h"
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index cee8ec80cb4..0ee9408dea8 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -2,7 +2,8 @@
#include "MEM_guardedalloc.h"
#include "DNA_listBase.h"
-#include "BKE_utildefines.h"
+
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_ghash.h"
diff --git a/source/blender/bmesh/intern/bmesh_newcore.c b/source/blender/bmesh/intern/bmesh_newcore.c
index 008dd201dd9..475dfedc819 100644
--- a/source/blender/bmesh/intern/bmesh_newcore.c
+++ b/source/blender/bmesh/intern/bmesh_newcore.c
@@ -2,10 +2,10 @@
#include "BLI_math_vector.h"
-#include "BKE_utildefines.h"
#include "BKE_customdata.h"
#include "BKE_DerivedMesh.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_listbase.h"
#include "BLI_mempool.h"
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index bdb69f974d2..699e6f96e22 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -1,13 +1,12 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BLI_mempool.h"
#include "BLI_blenlib.h"
#include "BLI_array.h"
-#include "BKE_utildefines.h"
-
#include "bmesh.h"
#include "bmesh_private.h"
#include "stdarg.h"
diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c
index 5c3831343eb..b6dc26fb6a9 100644
--- a/source/blender/bmesh/intern/bmesh_walkers.c
+++ b/source/blender/bmesh/intern/bmesh_walkers.c
@@ -32,12 +32,12 @@
#include <stdio.h>
#include <string.h>
-#include "BKE_utildefines.h"
#include "BKE_customdata.h"
#include "DNA_meshdata_types.h"
#include "DNA_mesh_types.h"
+#include "BLI_utildefines.h"
#include "BLI_mempool.h"
#include "BLI_array.h"
diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index f198d24bee3..9df9c8067ce 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -32,12 +32,12 @@
#include <stdio.h>
#include <string.h>
-#include "BKE_utildefines.h"
#include "BKE_customdata.h"
#include "DNA_meshdata_types.h"
#include "DNA_mesh_types.h"
+#include "BLI_utildefines.h"
#include "BLI_mempool.h"
#include "BLI_array.h"
diff --git a/source/blender/bmesh/operators/bevel.c b/source/blender/bmesh/operators/bevel.c
index a80712884fc..e21bb9398a5 100644
--- a/source/blender/bmesh/operators/bevel.c
+++ b/source/blender/bmesh/operators/bevel.c
@@ -1,7 +1,6 @@
#include "MEM_guardedalloc.h"
-#include "BKE_utildefines.h"
-
+#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_memarena.h"
#include "BLI_blenlib.h"
diff --git a/source/blender/bmesh/operators/bmesh_dupeops.c b/source/blender/bmesh/operators/bmesh_dupeops.c
index b42250d82e5..cb60ea5583c 100644
--- a/source/blender/bmesh/operators/bmesh_dupeops.c
+++ b/source/blender/bmesh/operators/bmesh_dupeops.c
@@ -1,6 +1,6 @@
#include "MEM_guardedalloc.h"
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_memarena.h"
diff --git a/source/blender/bmesh/operators/createops.c b/source/blender/bmesh/operators/createops.c
index 260bc4e292c..6ad85d7d439 100644
--- a/source/blender/bmesh/operators/createops.c
+++ b/source/blender/bmesh/operators/createops.c
@@ -1,6 +1,6 @@
#include "MEM_guardedalloc.h"
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
#include "BLI_memarena.h"
#include "BLI_mempool.h"
diff --git a/source/blender/bmesh/operators/extrudeops.c b/source/blender/bmesh/operators/extrudeops.c
index 8567a350a81..6bd50dab454 100644
--- a/source/blender/bmesh/operators/extrudeops.c
+++ b/source/blender/bmesh/operators/extrudeops.c
@@ -1,6 +1,6 @@
#include "MEM_guardedalloc.h"
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_memarena.h"
diff --git a/source/blender/bmesh/operators/mesh_conv.c b/source/blender/bmesh/operators/mesh_conv.c
index 9f8c421eb43..16e53883008 100644
--- a/source/blender/bmesh/operators/mesh_conv.c
+++ b/source/blender/bmesh/operators/mesh_conv.c
@@ -13,7 +13,6 @@
#include "DNA_windowmanager_types.h"
#include "BKE_customdata.h"
-#include "BKE_utildefines.h"
#include "BKE_mesh.h"
#include "BKE_global.h"
#include "BKE_DerivedMesh.h"
@@ -21,6 +20,7 @@
#include "BKE_key.h"
#include "BKE_main.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
diff --git a/source/blender/bmesh/operators/primitiveops.c b/source/blender/bmesh/operators/primitiveops.c
index c718b6cbbc7..74ca74f86e3 100644
--- a/source/blender/bmesh/operators/primitiveops.c
+++ b/source/blender/bmesh/operators/primitiveops.c
@@ -6,7 +6,7 @@
#include "DNA_scene_types.h"
#include "DNA_windowmanager_types.h"
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_ghash.h"
diff --git a/source/blender/bmesh/operators/removedoubles.c b/source/blender/bmesh/operators/removedoubles.c
index 2e73d0ad91c..3bd894c63b9 100644
--- a/source/blender/bmesh/operators/removedoubles.c
+++ b/source/blender/bmesh/operators/removedoubles.c
@@ -5,7 +5,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_ghash.h"
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 2c40705b3ac..41733bcd29a 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -43,10 +43,10 @@
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_memarena.h"
-#include "BLI_utildefines.h"
#include "BKE_DerivedMesh.h"
#include "BKE_modifier.h"
diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c
index e0c0215bc2b..d9485672492 100644
--- a/source/blender/editors/mesh/bmesh_select.c
+++ b/source/blender/editors/mesh/bmesh_select.c
@@ -50,6 +50,7 @@ BMEditMesh_mods.c, UI level access, no geometry changes
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
@@ -65,7 +66,6 @@ BMEditMesh_mods.c, UI level access, no geometry changes
#include "BKE_mesh.h"
#include "BKE_material.h"
#include "BKE_texture.h"
-#include "BKE_utildefines.h"
#include "BKE_report.h"
#include "BKE_tessmesh.h"
#include "BKE_paint.h"
diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c
index e99066c1d91..93b4fabe80f 100644
--- a/source/blender/editors/mesh/bmesh_tools.c
+++ b/source/blender/editors/mesh/bmesh_tools.c
@@ -51,6 +51,7 @@
#include "RNA_define.h"
#include "RNA_access.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
@@ -71,7 +72,6 @@
#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
-#include "BKE_utildefines.h"
#include "BKE_bmesh.h"
#include "BKE_report.h"
#include "BKE_tessmesh.h"
diff --git a/source/blender/editors/mesh/bmeshutils.c b/source/blender/editors/mesh/bmeshutils.c
index 06ebf1e9df0..228a887a63c 100644
--- a/source/blender/editors/mesh/bmeshutils.c
+++ b/source/blender/editors/mesh/bmeshutils.c
@@ -51,6 +51,7 @@
#include "RNA_define.h"
#include "RNA_access.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
@@ -68,7 +69,6 @@
#include "BKE_key.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
-#include "BKE_utildefines.h"
#include "BKE_bmesh.h"
#include "BKE_report.h"
#include "BKE_tessmesh.h"
diff --git a/source/blender/editors/mesh/editbmesh_add.c b/source/blender/editors/mesh/editbmesh_add.c
index dfb242d7144..7093a6e3298 100644
--- a/source/blender/editors/mesh/editbmesh_add.c
+++ b/source/blender/editors/mesh/editbmesh_add.c
@@ -51,6 +51,7 @@
#include "RNA_define.h"
#include "RNA_access.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
@@ -67,7 +68,6 @@
#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
-#include "BKE_utildefines.h"
#include "BKE_bmesh.h"
#include "BKE_report.h"
#include "BKE_tessmesh.h"
diff --git a/source/blender/editors/mesh/editbmesh_bvh.c b/source/blender/editors/mesh/editbmesh_bvh.c
index d7ab294d877..52e3d1bde6d 100644
--- a/source/blender/editors/mesh/editbmesh_bvh.c
+++ b/source/blender/editors/mesh/editbmesh_bvh.c
@@ -53,6 +53,7 @@
#include "RNA_define.h"
#include "RNA_access.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
@@ -70,7 +71,6 @@
#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
-#include "BKE_utildefines.h"
#include "BKE_bmesh.h"
#include "BKE_report.h"
#include "BKE_tessmesh.h"
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 06eb1f1ead4..5a03d283aea 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -36,6 +36,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_heap.h"
diff --git a/source/blender/editors/mesh/knifetool.c b/source/blender/editors/mesh/knifetool.c
index 73bb49d7667..52d169ee3cb 100755
--- a/source/blender/editors/mesh/knifetool.c
+++ b/source/blender/editors/mesh/knifetool.c
@@ -44,6 +44,7 @@
#include "PIL_time.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h" /*for WM_operator_pystring */
#include "BLI_editVert.h"
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index b6c6570e27d..bdfbc488a06 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -43,6 +43,7 @@
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_edgehash.h"
diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c
deleted file mode 100644
index 92e829c0dbb..00000000000
--- a/source/blender/editors/space_image/image_header.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * $Id$
- *
- * ***** 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.
- *
- * The Original Code is Copyright (C) 2008 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_image/image_header.c
- * \ingroup spimage
- */
-
-
-#include <string.h>
-#include <stdio.h>
-
-#include "DNA_object_types.h"
-#include "DNA_space_types.h"
-#include "DNA_windowmanager_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
-#include "BKE_mesh.h"
-
-#include "ED_image.h"
-
-#include "WM_types.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-
-#include "image_intern.h"
-
-/********************** toolbox operator *********************/
-
-static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
-{
- SpaceImage *sima= CTX_wm_space_image(C);
- Object *obedit= CTX_data_edit_object(C);
- uiPopupMenu *pup;
- uiLayout *layout;
- int show_uvedit;
-
- show_uvedit= ED_space_image_show_uvedit(sima, obedit);
-
- pup= uiPupMenuBegin(C, "Toolbox", ICON_NONE);
- layout= uiPupMenuLayout(pup);
-
- uiItemM(layout, C, "IMAGE_MT_view", NULL, ICON_NONE);
- if(show_uvedit) uiItemM(layout, C, "IMAGE_MT_select", NULL, ICON_NONE);
- uiItemM(layout, C, "IMAGE_MT_image", NULL, ICON_NONE);
- if(show_uvedit) uiItemM(layout, C, "IMAGE_MT_uvs", NULL, ICON_NONE);
-
- uiPupMenuEnd(C, pup);
-
- return OPERATOR_CANCELLED;
-}
-
-void IMAGE_OT_toolbox(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Toolbox";
- ot->idname= "IMAGE_OT_toolbox";
-
- /* api callbacks */
- ot->invoke= toolbox_invoke;
- ot->poll= space_image_main_area_poll;
-}
-
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 66137520a06..1d1c9f10e75 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -35,6 +35,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 6b042b22d74..a317eb3288f 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -47,6 +47,7 @@
#include "DNA_smoke_types.h"
#include "DNA_world_types.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index acdbcb0d06d..805887e3805 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -40,6 +40,7 @@
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
+#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index e6672339cdc..3fc53174447 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -43,6 +43,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_editVert.h"
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index babe6d9c6b0..c152509d413 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -53,7 +53,6 @@
#include "BKE_depsgraph.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
-#include "BKE_utildefines.h"
#include "BKE_tessmesh.h"
#include "WM_api.h"
@@ -362,7 +361,7 @@ static PointerRNA rna_Mesh_active_uv_texture_get(PointerRNA *ptr)
static PointerRNA rna_Mesh_uv_texture_clone_get(PointerRNA *ptr)
{
- PointerRNA pnull = {0,};
+ PointerRNA pnull = {{0}};
#if 0
Mesh *me= (Mesh*)ptr->data;
CustomData *fdata= rna_mesh_fdata(me);
@@ -376,7 +375,7 @@ static PointerRNA rna_Mesh_uv_texture_clone_get(PointerRNA *ptr)
static PointerRNA rna_Mesh_uv_texture_stencil_get(PointerRNA *ptr)
{
- PointerRNA pnull = {0,};
+ PointerRNA pnull = {{0}};
#if 0
Mesh *me= (Mesh*)ptr->data;
CustomData *fdata= rna_mesh_fdata(me);
@@ -897,17 +896,17 @@ static char *rna_VertexGroupElement_path(PointerRNA *ptr)
static char *rna_MeshFace_path(PointerRNA *ptr)
{
- return BLI_sprintfN("faces[%d]", (MFace*)ptr->data - ((Mesh*)ptr->id.data)->mface);
+ return BLI_sprintfN("faces[%d]", (int)((MFace*)ptr->data - ((Mesh*)ptr->id.data)->mface));
}
static char *rna_MeshEdge_path(PointerRNA *ptr)
{
- return BLI_sprintfN("edges[%d]", (MEdge*)ptr->data - ((Mesh*)ptr->id.data)->medge);
+ return BLI_sprintfN("edges[%d]", (int)((MEdge*)ptr->data - ((Mesh*)ptr->id.data)->medge));
}
static char *rna_MeshVertex_path(PointerRNA *ptr)
{
- return BLI_sprintfN("verts[%d]", (MVert*)ptr->data - ((Mesh*)ptr->id.data)->mvert);
+ return BLI_sprintfN("verts[%d]", (int)((MVert*)ptr->data - ((Mesh*)ptr->id.data)->mvert));
}
static char *rna_MeshTextureFaceLayer_path(PointerRNA *ptr)
@@ -950,7 +949,7 @@ static char *rna_MeshColor_path(PointerRNA *ptr)
static char *rna_MeshSticky_path(PointerRNA *ptr)
{
- return BLI_sprintfN("sticky[%d]", (MSticky*)ptr->data - ((Mesh*)ptr->id.data)->msticky);
+ return BLI_sprintfN("sticky[%d]", (int)((MSticky*)ptr->data - ((Mesh*)ptr->id.data)->msticky));
}
static char *rna_MeshIntPropertyLayer_path(PointerRNA *ptr)
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 54b3d12ad01..69163d26cbc 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -34,10 +34,10 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_ghash.h"
#include "BLI_edgehash.h"
-#include "BLI_utildefines.h"
#include "DNA_curve_types.h"
#include "DNA_meshdata_types.h"
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 82731ee69c2..6316a33cbe3 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -31,12 +31,12 @@
#include "DNA_meshdata_types.h"
+#include "BLI_utildefines.h"
#include "BLI_listbase.h"
#include "BLI_memarena.h"
#include "BLI_edgehash.h"
#include "BLI_math.h"
#include "BLI_array.h"
-#include "BLI_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index 38570f2248f..7b86731b5bb 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -38,11 +38,11 @@
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
+#include "BLI_utildefines.h"
#include "BLI_kdtree.h"
#include "BLI_rand.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
-#include "BLI_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_deform.h"
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 8e23abad248..380e55260d8 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -37,9 +37,9 @@
#include "DNA_meshdata_types.h"
+#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
-#include "BLI_utildefines.h"
#include "BLI_array.h"
#include "BLI_smallhash.h"
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index acdbf493267..015087be39a 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -320,7 +320,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
}
}
-static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editData,
+static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = derivedData;
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 2a7c0dc6d4a..d084d55412c 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -376,7 +376,7 @@ int segmentation_handler(int sig)
return 0;
}
-static int nocrashhandler(int argc, char **argv, void *data)
+static int nocrashhandler(int argc, const char **argv, void *data)
{
no_handler = 1;
@@ -877,7 +877,7 @@ static int set_start_frame(int argc, const char **argv, void *data)
}
#ifdef EVENT_RECORDER
-static int set_macro_playback(int argc, char **argv, void *data)
+static int set_macro_playback(int argc, const char **argv, void *data)
{
bContext *C = data;