[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17213] trunk/blender/source/blender: merging harmonic-skeleton branch into trunk.

Campbell Barton ideasman42 at gmail.com
Wed Oct 29 04:51:22 CET 2008


Would it be possible to remove "int hash" from the EditVert struct?
Quite a few times I would have found it useful to add members to
vert/edge/face scructs when writing spesific tools, but I dont think
its necessary in this case and looses a bit of memory.

Since reeb.c is the only file that uses this, you could work around by
storing an extra array for pointers and then store the index in tmp.l

On Wed, Oct 29, 2008 at 9:53 AM, Martin Poirier <theeth at yahoo.com> wrote:
> Revision: 17213
>          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17213
> Author:   theeth
> Date:     2008-10-28 23:53:48 +0100 (Tue, 28 Oct 2008)
>
> Log Message:
> -----------
> merging harmonic-skeleton branch into trunk. All changes are hidden behind a disabled define, nothing to see here
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/blenkernel/intern/scene.c
>    trunk/blender/source/blender/blenlib/BLI_arithb.h
>    trunk/blender/source/blender/blenlib/BLI_ghash.h
>    trunk/blender/source/blender/blenlib/BLI_threads.h
>    trunk/blender/source/blender/blenlib/intern/BLI_ghash.c
>    trunk/blender/source/blender/blenlib/intern/arithb.c
>    trunk/blender/source/blender/blenlib/intern/threads.c
>    trunk/blender/source/blender/blenloader/intern/readfile.c
>    trunk/blender/source/blender/include/BIF_editarmature.h
>    trunk/blender/source/blender/include/butspace.h
>    trunk/blender/source/blender/include/reeb.h
>    trunk/blender/source/blender/makesdna/DNA_scene_types.h
>    trunk/blender/source/blender/src/buttons_editing.c
>    trunk/blender/source/blender/src/drawview.c
>    trunk/blender/source/blender/src/editarmature.c
>    trunk/blender/source/blender/src/reeb.c
>    trunk/blender/source/blender/src/usiblender.c
>
> Added Paths:
> -----------
>    trunk/blender/source/blender/blenlib/BLI_graph.h
>    trunk/blender/source/blender/blenlib/intern/graph.c
>    trunk/blender/source/blender/src/autoarmature.c
>
> Modified: trunk/blender/source/blender/blenkernel/intern/scene.c
> ===================================================================
> --- trunk/blender/source/blender/blenkernel/intern/scene.c      2008-10-28 20:26:38 UTC (rev 17212)
> +++ trunk/blender/source/blender/blenkernel/intern/scene.c      2008-10-28 22:53:48 UTC (rev 17213)
> @@ -259,6 +259,21 @@
>        sce->toolsettings->select_thresh= 0.01f;
>        sce->toolsettings->jointrilimit = 0.8f;
>
> +       sce->toolsettings->skgen_resolution = 100;
> +       sce->toolsettings->skgen_threshold_internal     = 0.01f;
> +       sce->toolsettings->skgen_threshold_external     = 0.01f;
> +       sce->toolsettings->skgen_angle_limit                    = 45.0f;
> +       sce->toolsettings->skgen_length_ratio                   = 1.3f;
> +       sce->toolsettings->skgen_length_limit                   = 1.5f;
> +       sce->toolsettings->skgen_correlation_limit              = 0.98f;
> +       sce->toolsettings->skgen_symmetry_limit                 = 0.1f;
> +       sce->toolsettings->skgen_postpro = SKGEN_SMOOTH;
> +       sce->toolsettings->skgen_postpro_passes = 1;
> +       sce->toolsettings->skgen_options = SKGEN_FILTER_INTERNAL|SKGEN_FILTER_EXTERNAL|SKGEN_FILTER_SMART|SKGEN_HARMONIC|SKGEN_SUB_CORRELATION|SKGEN_STICK_TO_EMBEDDING;
> +       sce->toolsettings->skgen_subdivisions[0] = SKGEN_SUB_CORRELATION;
> +       sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH;
> +       sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE;
> +
>        pset= &sce->toolsettings->particle;
>        pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER;
>        pset->emitterdist= 0.25f;
>
> Modified: trunk/blender/source/blender/blenlib/BLI_arithb.h
> ===================================================================
> --- trunk/blender/source/blender/blenlib/BLI_arithb.h   2008-10-28 20:26:38 UTC (rev 17212)
> +++ trunk/blender/source/blender/blenlib/BLI_arithb.h   2008-10-28 22:53:48 UTC (rev 17213)
> @@ -245,6 +245,7 @@
>  int VecLenCompare(float *v1, float *v2, float limit);
>  int VecCompare(float *v1, float *v2, float limit);
>  int VecEqual(float *v1, float *v2);
> +int VecIsNull(float *v);
>
>  void printvecf(char *str,float v[3]);
>  void printvec4f(char *str, float v[4]);
> @@ -265,6 +266,7 @@
>  void Vec2Lerpf(float *target, float *a, float *b, float t);
>
>  void AxisAngleToQuat(float *q, float *axis, float angle);
> +void RotationBetweenVectorsToQuat(float *q, float v1[3], float v2[3]);
>  void vectoquat(float *vec, short axis, short upflag, float *q);
>
>  float VecAngle2(float *v1, float *v2);
>
> Modified: trunk/blender/source/blender/blenlib/BLI_ghash.h
> ===================================================================
> --- trunk/blender/source/blender/blenlib/BLI_ghash.h    2008-10-28 20:26:38 UTC (rev 17212)
> +++ trunk/blender/source/blender/blenlib/BLI_ghash.h    2008-10-28 22:53:48 UTC (rev 17213)
> @@ -34,8 +34,13 @@
>
>  struct GHash;
>  typedef struct GHash GHash;
> -typedef struct GHashIterator GHashIterator;
>
> +typedef struct GHashIterator {
> +       GHash *gh;
> +       int curBucket;
> +       struct Entry *curEntry;
> +} GHashIterator;
> +
>  typedef unsigned int   (*GHashHashFP)          (void *key);
>  typedef int                            (*GHashCmpFP)           (void *a, void *b);
>  typedef        void                    (*GHashKeyFreeFP)       (void *key);
> @@ -63,6 +68,15 @@
>         */
>  GHashIterator* BLI_ghashIterator_new           (GHash *gh);
>        /**
> +        * Init an already allocated GHashIterator. The hash table must not
> +        * be mutated while the iterator is in use, and the iterator will
> +        * step exactly BLI_ghash_size(gh) times before becoming done.
> +        *
> +        * @param ghi The GHashIterator to initialize.
> +        * @param gh The GHash to iterate over.
> +        */
> +void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh);
> +       /**
>         * Free a GHashIterator.
>         *
>         * @param ghi The iterator to free.
>
> Added: trunk/blender/source/blender/blenlib/BLI_graph.h
> ===================================================================
> --- trunk/blender/source/blender/blenlib/BLI_graph.h                            (rev 0)
> +++ trunk/blender/source/blender/blenlib/BLI_graph.h    2008-10-28 22:53:48 UTC (rev 17213)
> @@ -0,0 +1,125 @@
> +#ifndef BLI_GRAPH_H_
> +#define BLI_GRAPH_H_
> +
> +#include "DNA_listBase.h"
> +
> +struct BGraph;
> +struct BNode;
> +struct BArc;
> +
> +struct RadialArc;
> +
> +typedef void (*FreeArc)(struct BArc*);
> +typedef void (*FreeNode)(struct BNode*);
> +typedef void (*RadialSymmetry)(struct BNode* root_node, struct RadialArc* ring, int total);
> +typedef void (*AxialSymmetry)(struct BNode* root_node, struct BNode* node1, struct BNode* node2, struct BArc* arc1, struct BArc* arc2);
> +
> +/* IF YOU MODIFY THOSE TYPES, YOU NEED TO UPDATE ALL THOSE THAT "INHERIT" FROM THEM
> + *
> + * RigGraph, ReebGraph
> + *
> + * */
> +
> +typedef struct BGraph {
> +       ListBase        arcs;
> +       ListBase        nodes;
> +
> +       float length;
> +
> +       /* function pointer to deal with custom fonctionnality */
> +       FreeArc                 free_arc;
> +       FreeNode                free_node;
> +       RadialSymmetry  radial_symmetry;
> +       AxialSymmetry   axial_symmetry;
> +} BGraph;
> +
> +typedef struct BNode {
> +       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];
> +} BNode;
> +
> +typedef struct BArc {
> +       void *next, *prev;
> +       struct BNode *head, *tail;
> +       int flag;
> +
> +       float length;
> +
> +       int symmetry_level;
> +       int symmetry_group;
> +       int symmetry_flag;
> +} BArc;
> +
> +/* Helper structure for radial symmetry */
> +typedef struct RadialArc
> +{
> +       struct BArc *arc;
> +       float n[3]; /* normalized vector joining the nodes of the arc */
> +} RadialArc;
> +
> +BNode *BLI_otherNode(BArc *arc, BNode *node);
> +
> +void BLI_freeNode(BGraph *graph, BNode *node);
> +void BLI_removeNode(BGraph *graph, BNode *node);
> +
> +void BLI_removeArc(BGraph *graph, BArc *arc);
> +
> +void BLI_flagNodes(BGraph *graph, int flag);
> +void BLI_flagArcs(BGraph *graph, int flag);
> +
> +int BLI_hasAdjacencyList(BGraph *rg);
> +void BLI_buildAdjacencyList(BGraph *rg);
> +void BLI_rebuildAdjacencyList(BGraph* rg);
> +void BLI_rebuildAdjacencyListForNode(BGraph* rg, BNode *node);
> +void BLI_freeAdjacencyList(BGraph *rg);
> +
> +int BLI_FlagSubgraphs(BGraph *graph);
> +void BLI_ReflagSubgraph(BGraph *graph, int old_subgraph, int new_subgraph);
> +
> +#define SHAPE_RADIX 10 /* each shape level is encoded this base */
> +
> +int BLI_subtreeShape(BGraph *graph, BNode *node, BArc *rootArc, int include_root);
> +float BLI_subtreeLength(BNode *node);
> +void BLI_calcGraphLength(BGraph *graph);
> +
> +void BLI_replaceNode(BGraph *graph, BNode *node_src, BNode *node_replaced);
> +void BLI_replaceNodeInArc(BGraph *graph, BArc *arc, BNode *node_src, BNode *node_replaced);
> +void BLI_removeDoubleNodes(BGraph *graph, float limit);
> +BNode * BLI_FindNodeByPosition(BGraph *graph, float *p, float limit);
> +
> +BArc * BLI_findConnectedArc(BGraph *graph, BArc *arc, BNode *v);
> +
> +int    BLI_isGraphCyclic(BGraph *graph);
> +
> +/*------------ Symmetry handling ------------*/
> +void BLI_markdownSymmetry(BGraph *graph, BNode *root_node, float limit);
> +
> +void BLI_mirrorAlongAxis(float v[3], float center[3], float axis[3]);
> +
> +/* BNode symmetry flags */
> +#define SYM_TOPOLOGICAL        1
> +#define SYM_PHYSICAL   2
> +
> +/* the following two are exclusive */
> +#define SYM_AXIAL              4
> +#define SYM_RADIAL             8
> +
> +/* BArc symmetry flags
> + *
> + * axial symetry sides */
> +#define SYM_SIDE_POSITIVE              1
> +#define SYM_SIDE_NEGATIVE              2
> +/* Anything higher is the order in radial symmetry */
> +#define SYM_SIDE_RADIAL                        3
> +
> +#endif /*BLI_GRAPH_H_*/
>
> Modified: trunk/blender/source/blender/blenlib/BLI_threads.h
> ===================================================================
> --- trunk/blender/source/blender/blenlib/BLI_threads.h  2008-10-28 20:26:38 UTC (rev 17212)
> +++ trunk/blender/source/blender/blenlib/BLI_threads.h  2008-10-28 22:53:48 UTC (rev 17213)
> @@ -39,17 +39,41 @@
>  #define BLENDER_MAX_THREADS            8
>
>  struct ListBase;
> -
>  void   BLI_init_threads        (struct ListBase *threadbase, void *(*do_thread)(void *), int tot);
>  int            BLI_available_threads(struct ListBase *threadbase);
>  int            BLI_available_thread_index(struct ListBase *threadbase);
>  void   BLI_insert_thread       (struct ListBase *threadbase, void *callerdata);
>  void   BLI_remove_thread       (struct ListBase *threadbase, void *callerdata);
> +void   BLI_remove_thread_index(struct ListBase *threadbase, int index);
> +void   BLI_remove_threads(struct ListBase *threadbase);
>  void   BLI_end_threads         (struct ListBase *threadbase);
>
>  void   BLI_lock_thread         (int type);
>  void   BLI_unlock_thread       (int type);
>
>  int            BLI_system_thread_count( void ); /* gets the number of threads the system can make use of */
> +
> +/* ThreadedWorker is a simple tool for dispatching work to a limited number of threads in a transparent
> + * fashion from the caller's perspective
> + * */
> +
> +struct ThreadedWorker;
> +
> +/* Create a new worker supporting tot parallel threads.
> + * When new work in inserted and all threads are busy, sleep(sleep_time) before checking again
> + */
> +struct ThreadedWorker *BLI_create_worker(void *(*do_thread)(void *), int tot, int sleep_time);
> +
> +/* join all working threads */
> +void BLI_end_worker(struct ThreadedWorker *worker);
> +
> +/* also ends all working threads */
> +void BLI_destroy_worker(struct ThreadedWorker *worker);
> +
> +/* Spawns a new work thread if possible, sleeps until one is available otherwise
> + * NOTE: inserting work is NOT thread safe, so make sure it is only done from one thread */
> +void BLI_insert_work(struct ThreadedWorker *worker, void *param);
> +
> +
>  #endif
>
>
> Modified: trunk/blender/source/blender/blenlib/intern/BLI_ghash.c
> ===================================================================
> --- trunk/blender/source/blender/blenlib/intern/BLI_ghash.c     2008-10-28 20:26:38 UTC (rev 17212)
> +++ trunk/blender/source/blender/blenlib/intern/BLI_ghash.c     2008-10-28 22:53:48 UTC (rev 17213)
> @@ -200,12 +200,6 @@
>
>  /***/
>
> -struct GHashIterator {
> -       GHash *gh;
> -       int curBucket;
> -       Entry *curEntry;
> -};
> -
>  GHashIterator *BLI_ghashIterator_new(GHash *gh) {
>        GHashIterator *ghi= malloc(sizeof(*ghi));
>        ghi->gh= gh;
> @@ -219,6 +213,17 @@
>        }
>        return ghi;
>  }
> +void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) {
> +       ghi->gh= gh;
> +       ghi->curEntry= NULL;
> +       ghi->curBucket= -1;
> +       while (!ghi->curEntry) {
> +               ghi->curBucket++;
> +               if (ghi->curBucket==ghi->gh->nbuckets)
> +                       break;
> +               ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
> +       }
> +}
>  void BLI_ghashIterator_free(GHashIterator *ghi) {
>        free(ghi);
>  }
>
> Modified: trunk/blender/source/blender/blenlib/intern/arithb.c
> ===================================================================
> --- trunk/blender/source/blender/blenlib/intern/arithb.c        2008-10-28 20:26:38 UTC (rev 17212)
> +++ trunk/blender/source/blender/blenlib/intern/arithb.c        2008-10-28 22:53:48 UTC (rev 17213)
> @@ -1371,6 +1371,18 @@
>        }
>  }
>
> +void RotationBetweenVectorsToQuat(float *q, float v1[3], float v2[3])
> +{
> +       float axis[3];
> +       float angle;
> +
>
> @@ Diff output truncated at 10240 characters. @@
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>



-- 
- Campbell


More information about the Bf-committers mailing list