Display graph in 3d view

This commit is contained in:
Martin Poirier 2008-06-22 17:06:50 +00:00
parent b5bde6d4dc
commit 39a7a24838
5 changed files with 338 additions and 154 deletions

@ -119,7 +119,7 @@ int weightFromDistance(struct EditMesh *em);
int weightFromLoc(struct EditMesh *me, int axis); int weightFromLoc(struct EditMesh *me, int axis);
void weightToVCol(struct EditMesh *em, int index); void weightToVCol(struct EditMesh *em, int index);
void arcToVCol(struct ReebGraph *rg, struct EditMesh *em, int index); void arcToVCol(struct ReebGraph *rg, struct EditMesh *em, int index);
void angleToVCol(EditMesh *em, int index); void angleToVCol(struct EditMesh *em, int index);
void renormalizeWeight(struct EditMesh *em, float newmax); void renormalizeWeight(struct EditMesh *em, float newmax);
ReebGraph * generateReebGraph(struct EditMesh *me, int subdivisions); ReebGraph * generateReebGraph(struct EditMesh *me, int subdivisions);
@ -155,7 +155,13 @@ void verifyFaces(ReebGraph *rg);
/*********************** PUBLIC *********************************/ /*********************** PUBLIC *********************************/
ReebGraph *BIF_ReebGraphFromEditMesh(void); ReebGraph *BIF_ReebGraphFromEditMesh(void);
void BIF_GlobalReebGraphFromEditMesh(void);
void BIF_GlobalReebFree(void);
void REEB_freeGraph(ReebGraph *rg); void REEB_freeGraph(ReebGraph *rg);
void REEB_exportGraph(ReebGraph *rg, int count); void REEB_exportGraph(ReebGraph *rg, int count);
void REEB_draw();
#endif /*REEB_H_*/ #endif /*REEB_H_*/

@ -180,6 +180,8 @@
#include "butspace.h" // own module #include "butspace.h" // own module
#include "multires.h" #include "multires.h"
#include "reeb.h"
static float editbutweight= 1.0; static float editbutweight= 1.0;
float editbutvweight= 1; float editbutvweight= 1;
static int actmcol= 0, acttface= 0, acttface_rnd = 0, actmcol_rnd = 0; static int actmcol= 0, acttface= 0, acttface_rnd = 0, actmcol_rnd = 0;
@ -4992,6 +4994,16 @@ static void skgen_reorder(void *option, void *arg2)
} }
} }
static void skgen_graphgen(void *arg1, void *arg2)
{
BIF_GlobalReebGraphFromEditMesh();
}
static void skgen_graphfree(void *arg1, void *arg2)
{
BIF_GlobalReebFree();
}
static void editing_panel_mesh_skgen_retarget(Object *ob, Mesh *me) static void editing_panel_mesh_skgen_retarget(Object *ob, Mesh *me)
{ {
uiBlock *block; uiBlock *block;
@ -5035,10 +5047,14 @@ static void editing_panel_mesh_skgen(Object *ob, Mesh *me)
uiNewPanelTabbed("Mesh Tools More", "Editing"); uiNewPanelTabbed("Mesh Tools More", "Editing");
if(uiNewPanel(curarea, block, "Skeleton Generator", "Editing", 960, 0, 318, 204)==0) return; if(uiNewPanel(curarea, block, "Skeleton Generator", "Editing", 960, 0, 318, 204)==0) return;
uiDefBut(block, BUT, B_GEN_SKELETON, "Generate Skeleton", 1025,170,250,19, 0, 0, 0, 0, 0, "Generate Skeleton from Mesh"); uiDefBut(block, BUT, B_GEN_SKELETON, "Generate Skeleton", 1025,170,125,19, 0, 0, 0, 0, 0, "Generate Skeleton from Mesh");
but = uiDefBut(block, BUT, B_DIFF, "Generate", 1150,170,65,19, 0, 0, 0, 0, 0, "Generate Graph from Mesh");
uiButSetFunc(but, skgen_graphgen, NULL, NULL);
but = uiDefBut(block, BUT, B_DIFF, "Free", 1215,170,60,19, 0, 0, 0, 0, 0, "Free Graph from Mesh");
uiButSetFunc(but, skgen_graphfree, NULL, NULL);
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButS(block, NUM, B_DIFF, "Resolution:", 1025,150,225,19, &G.scene->toolsettings->skgen_resolution,10.0,1000.0, 0, 0, "Specifies the resolution of the graph's embedding"); uiDefButS(block, NUM, B_DIFF, "Resolution:", 1025,150,225,19, &G.scene->toolsettings->skgen_resolution,2.0,1000.0, 0, 0, "Specifies the resolution of the graph's embedding");
uiDefButBitS(block, TOG, SKGEN_HARMONIC, B_DIFF, "H", 1250,150, 25,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Apply harmonic smoothing to the weighting"); uiDefButBitS(block, TOG, SKGEN_HARMONIC, B_DIFF, "H", 1250,150, 25,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Apply harmonic smoothing to the weighting");
uiDefButBitS(block, TOG, SKGEN_FILTER_INTERNAL, B_DIFF, "Filter In", 1025,130, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Filter internal small arcs from graph"); uiDefButBitS(block, TOG, SKGEN_FILTER_INTERNAL, B_DIFF, "Filter In", 1025,130, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Filter internal small arcs from graph");
uiDefButF(block, NUM, B_DIFF, "T:", 1111,130,164,19, &G.scene->toolsettings->skgen_threshold_internal,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering internal arcs"); uiDefButF(block, NUM, B_DIFF, "T:", 1111,130,164,19, &G.scene->toolsettings->skgen_threshold_internal,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering internal arcs");

@ -159,6 +159,8 @@
#include "RE_pipeline.h" // make_stars #include "RE_pipeline.h" // make_stars
#include "reeb.h"
#include "multires.h" #include "multires.h"
/* For MULTISAMPLE_ARB #define. /* For MULTISAMPLE_ARB #define.
@ -3146,6 +3148,8 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
BIF_drawSnap(); BIF_drawSnap();
} }
REEB_draw();
if(G.scene->radio) RAD_drawall(v3d->drawtype>=OB_SOLID); if(G.scene->radio) RAD_drawall(v3d->drawtype>=OB_SOLID);
/* Transp and X-ray afterdraw stuff */ /* Transp and X-ray afterdraw stuff */

File diff suppressed because it is too large Load Diff

@ -145,6 +145,8 @@
#include "PIL_time.h" #include "PIL_time.h"
#include "reeb.h"
/***/ /***/
/* define for setting colors in theme below */ /* define for setting colors in theme below */
@ -1048,6 +1050,8 @@ void exit_usiblender(void)
BIF_clear_tempfiles(); BIF_clear_tempfiles();
BIF_GlobalReebFree();
tf= G.ttfdata.first; tf= G.ttfdata.first;
while(tf) while(tf)
{ {