[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17223] branches/etch-a-ton/source/blender : moving stuff home.
Martin Poirier
theeth at yahoo.com
Wed Oct 29 22:49:58 CET 2008
Revision: 17223
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17223
Author: theeth
Date: 2008-10-29 22:49:58 +0100 (Wed, 29 Oct 2008)
Log Message:
-----------
moving stuff home. first draft for template retargetting
Modified Paths:
--------------
branches/etch-a-ton/source/blender/src/editarmature_sketch.c
Added Paths:
-----------
branches/etch-a-ton/source/blender/include/BIF_retarget.h
branches/etch-a-ton/source/blender/src/editarmature_retarget.c
Removed Paths:
-------------
branches/etch-a-ton/source/blender/src/autoarmature.c
Added: branches/etch-a-ton/source/blender/include/BIF_retarget.h
===================================================================
--- branches/etch-a-ton/source/blender/include/BIF_retarget.h (rev 0)
+++ branches/etch-a-ton/source/blender/include/BIF_retarget.h 2008-10-29 21:49:58 UTC (rev 17223)
@@ -0,0 +1,133 @@
+/**
+ * $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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_RETARGET_H
+#define BIF_RETARGET_H
+
+#include "DNA_listBase.h"
+
+#include "BLI_graph.h"
+#include "BLI_ghash.h"
+#include "BLI_threads.h"
+
+#include "reeb.h"
+
+struct EditBone;
+
+struct RigJoint;
+struct RigGraph;
+struct RigNode;
+struct RigArc;
+struct RigEdge;
+
+#define USE_THREADS
+
+typedef struct RigGraph {
+ ListBase arcs;
+ ListBase nodes;
+ ListBase controls;
+
+ ListBase* editbones;
+
+ float length;
+
+ FreeArc free_arc;
+ FreeNode free_node;
+ RadialSymmetry radial_symmetry;
+ AxialSymmetry axial_symmetry;
+ /*********************************/
+
+ struct RigNode *head;
+ ReebGraph *link_mesh;
+
+
+ struct ThreadedWorker *worker;
+
+ GHash *bones_map; /* map of editbones by name */
+ GHash *controls_map; /* map of rigcontrols by bone pointer */
+
+ Object *ob;
+} RigGraph;
+
+typedef struct RigNode {
+ void *next, *prev;
+ float p[3];
+ int flag;
+
+ int degree;
+ struct BArc **arcs;
+
+ int subgraph_index;
+
+ int symmetry_level;
+ int symmetry_flag;
+ float symmetry_axis[3];
+ /*********************************/
+
+ ReebNode *link_mesh;
+} RigNode;
+
+typedef struct RigArc {
+ void *next, *prev;
+ RigNode *head, *tail;
+ int flag;
+
+ float length;
+
+ int symmetry_level;
+ int symmetry_group;
+ int symmetry_flag;
+ /*********************************/
+
+ ListBase edges;
+ int count;
+ ReebArc *link_mesh;
+} RigArc;
+
+typedef struct RigEdge {
+ struct RigEdge *next, *prev;
+ float head[3], tail[3];
+ float length;
+ float angle;
+ EditBone *bone;
+ float up_axis[3];
+} RigEdge;
+
+/* Control flags */
+#define RIG_CTRL_DONE 1
+#define RIG_CTRL_PARENT_DEFORM 2
+#define RIG_CTRL_FIT_ROOT 4
+#define RIG_CTRL_FIT_BONE 8
+
+typedef struct RigControl {
+ struct RigControl *next, *prev;
+ float head[3], tail[3];
+ EditBone *bone;
+ EditBone *link;
+ float up_axis[3];
+ float offset[3];
+ int flag;
+} RigControl;
+
+void BIF_retargetArc(ReebArc *earc);
+
+#endif /* BIF_RETARGET_H */
Deleted: branches/etch-a-ton/source/blender/src/autoarmature.c
===================================================================
--- branches/etch-a-ton/source/blender/src/autoarmature.c 2008-10-29 19:14:59 UTC (rev 17222)
+++ branches/etch-a-ton/source/blender/src/autoarmature.c 2008-10-29 21:49:58 UTC (rev 17223)
@@ -1,2968 +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contributor(s): Martin Poirier
- *
- * ***** END GPL LICENSE BLOCK *****
- * autoarmature.c: Interface for automagically manipulating armature (retarget, created, ...)
- */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "DNA_ID.h"
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-#include "BLI_editVert.h"
-#include "BLI_ghash.h"
-#include "BLI_graph.h"
-#include "BLI_rand.h"
-#include "BLI_threads.h"
-
-#include "BDR_editobject.h"
-
-#include "BKE_global.h"
-#include "BKE_utildefines.h"
-#include "BKE_constraint.h"
-#include "BKE_armature.h"
-
-#include "BIF_editarmature.h"
-#include "BIF_space.h"
-
-#include "PIL_time.h"
-
-#include "mydevice.h"
-#include "reeb.h" // FIX ME
-#include "blendef.h"
-
-/************ RIG RETARGET DATA STRUCTURES ***************/
-
-struct RigJoint;
-struct RigGraph;
-struct RigNode;
-struct RigArc;
-struct RigEdge;
-
-//#define USE_THREADS
-
-typedef struct RigGraph {
- ListBase arcs;
- ListBase nodes;
-
- float length;
-
- FreeArc free_arc;
- FreeNode free_node;
- RadialSymmetry radial_symmetry;
- AxialSymmetry axial_symmetry;
- /*********************************/
-
- struct RigNode *head;
- ReebGraph *link_mesh;
-
- ListBase editbones;
-
- ListBase controls;
- struct ThreadedWorker *worker;
-
- GHash *bones_map; /* map of editbones by name */
- GHash *controls_map; /* map of rigcontrols by bone pointer */
-
- Object *ob;
-} RigGraph;
-
-typedef struct RigNode {
- void *next, *prev;
- float p[3];
- int flag;
-
- int degree;
- struct BArc **arcs;
-
- int subgraph_index;
-
- int symmetry_level;
- int symmetry_flag;
- float symmetry_axis[3];
- /*********************************/
-
- ReebNode *link_mesh;
-} RigNode;
-
-typedef struct RigArc {
- void *next, *prev;
- RigNode *head, *tail;
- int flag;
-
- float length;
-
- int symmetry_level;
- int symmetry_group;
- int symmetry_flag;
- /*********************************/
-
- ListBase edges;
- int count;
- ReebArc *link_mesh;
-} RigArc;
-
-typedef struct RigEdge {
- struct RigEdge *next, *prev;
- float head[3], tail[3];
- float length;
- float angle;
- EditBone *bone;
- float up_axis[3];
-} RigEdge;
-
-/* Control flags */
-#define RIG_CTRL_DONE 1
-#define RIG_CTRL_PARENT_DEFORM 2
-#define RIG_CTRL_FIT_ROOT 4
-#define RIG_CTRL_FIT_BONE 8
-
-typedef struct RigControl {
- struct RigControl *next, *prev;
- float head[3], tail[3];
- EditBone *bone;
- EditBone *link;
- float up_axis[3];
- float offset[3];
- int flag;
-} RigControl;
-
-typedef struct MemoNode {
- float weight;
- int next;
-} MemoNode;
-
-typedef struct RetargetParam {
- RigGraph *rigg;
- RigArc *iarc;
- RigNode *inode_start;
-} RetargetParam;
-
-typedef enum
-{
- RETARGET_LENGTH,
- RETARGET_AGGRESSIVE
-} RetargetMode;
-
-typedef enum
-{
- METHOD_BRUTE_FORCE = 0,
- METHOD_MEMOIZE = 1,
- METHOD_ANNEALING = 2
-} RetargetMethod;
-
-typedef enum
-{
- ARC_FREE = 0,
- ARC_TAKEN = 1,
- ARC_USED = 2
-} ArcUsageFlags;
-
-
-RigGraph *GLOBAL_RIGG = NULL;
-
-/*******************************************************************************************************/
-
-void *exec_retargetArctoArc(void *param);
-
-static void RIG_calculateEdgeAngle(RigEdge *edge_first, RigEdge *edge_second);
-
-/* two levels */
-#define SHAPE_LEVELS (SHAPE_RADIX * SHAPE_RADIX)
-
-/*********************************** EDITBONE UTILS ****************************************************/
-
-int countEditBoneChildren(ListBase *list, EditBone *parent)
-{
- EditBone *ebone;
- int count = 0;
-
- for (ebone = list->first; ebone; ebone = ebone->next)
- {
- if (ebone->parent == parent)
- {
- count++;
- }
- }
-
- return count;
-}
-
-EditBone* nextEditBoneChild(ListBase *list, EditBone *parent, int n)
-{
- EditBone *ebone;
-
- for (ebone = list->first; ebone; ebone = ebone->next)
- {
- if (ebone->parent == parent)
- {
- if (n == 0)
- {
- return ebone;
- }
- n--;
- }
- }
-
- return NULL;
-}
-
-void getEditBoneRollUpAxis(EditBone *bone, float roll, float up_axis[3])
-{
- float mat[3][3], nor[3];
-
- VecSubf(nor, bone->tail, bone->head);
-
- vec_roll_to_mat3(nor, roll, mat);
- VECCOPY(up_axis, mat[2]);
-}
-
-float getNewBoneRoll(EditBone *bone, float old_up_axis[3], float quat[4])
-{
- float mat[3][3];
- float nor[3], up_axis[3], new_up_axis[3], vec[3];
- float roll;
-
- VECCOPY(new_up_axis, old_up_axis);
- QuatMulVecf(quat, new_up_axis);
-
- VecSubf(nor, bone->tail, bone->head);
-
- vec_roll_to_mat3(nor, 0, mat);
- VECCOPY(up_axis, mat[2]);
-
- roll = NormalizedVecAngle2(new_up_axis, up_axis);
-
- Crossf(vec, up_axis, new_up_axis);
-
- if (Inpf(vec, nor) < 0)
- {
- roll = -roll;
- }
-
- return roll;
-}
-
-/************************************ DESTRUCTORS ******************************************************/
-
-void RIG_freeRigArc(BArc *arc)
-{
- BLI_freelistN(&((RigArc*)arc)->edges);
-}
-
-void RIG_freeRigGraph(BGraph *rg)
-{
- BNode *node;
- BArc *arc;
-
-#ifdef USE_THREADS
- BLI_destroy_worker(((RigGraph*)rg)->worker);
-#endif
-
- REEB_freeGraph(((RigGraph*)rg)->link_mesh);
-
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- RIG_freeRigArc(arc);
- }
- BLI_freelistN(&rg->arcs);
-
- for (node = rg->nodes.first; node; node = node->next)
- {
- BLI_freeNode(rg, (BNode*)node);
- }
- BLI_freelistN(&rg->nodes);
-
- BLI_freelistN(&((RigGraph*)rg)->controls);
-
- BLI_ghash_free(((RigGraph*)rg)->bones_map, NULL, NULL);
- BLI_ghash_free(((RigGraph*)rg)->controls_map, NULL, NULL);
-
- BLI_freelistN(&((RigGraph*)rg)->editbones);
-
- MEM_freeN(rg);
-}
-
-/************************************* ALLOCATORS ******************************************************/
-
-static RigGraph *newRigGraph()
-{
- RigGraph *rg;
- int totthread;
-
- rg = MEM_callocN(sizeof(RigGraph), "rig graph");
-
- rg->head = NULL;
-
- rg->bones_map = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp);
- rg->controls_map = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp);
-
- rg->free_arc = RIG_freeRigArc;
- rg->free_node = NULL;
-
-#ifdef USE_THREADS
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list