- add comments to BKE_DerivedMesh.h about which functions are called in editmode
- gcc warning fixes - start work to make CCGDerivedMesh able to run in object mode (hint: more speed improvements) - fix modifier move down tooltip
This commit is contained in:
@@ -57,7 +57,9 @@ typedef struct DerivedMesh DerivedMesh;
|
||||
struct DerivedMesh {
|
||||
/* Misc. Queries */
|
||||
|
||||
/* Also called in Editmode */
|
||||
int (*getNumVerts)(DerivedMesh *dm);
|
||||
/* Also called in Editmode */
|
||||
int (*getNumFaces)(DerivedMesh *dm);
|
||||
|
||||
void (*getMappedVertCoEM)(DerivedMesh *dm, void *vert, float co_r[3]);
|
||||
@@ -65,7 +67,10 @@ struct DerivedMesh {
|
||||
/* Convert to new DispListMesh, should be free'd by caller */
|
||||
struct DispListMesh* (*convertToDispListMesh)(DerivedMesh *dm);
|
||||
|
||||
/* Iterate over all vertex points, calling DO_MINMAX with given args */
|
||||
/* Iterate over all vertex points, calling DO_MINMAX with given args.
|
||||
*
|
||||
* Also called in Editmode
|
||||
*/
|
||||
void (*getMinMax)(DerivedMesh *dm, float min_r[3], float max_r[3]);
|
||||
|
||||
/* Direct Access Operations */
|
||||
@@ -100,6 +105,8 @@ struct DerivedMesh {
|
||||
* o Set face normal or vertex normal based on inherited face flag
|
||||
* o Use inherited face material index to call setMaterial
|
||||
* o Only if setMaterial returns true
|
||||
*
|
||||
* Also called in Editmode
|
||||
*/
|
||||
void (*drawFacesSolid)(DerivedMesh *dm, int (*setMaterial)(int));
|
||||
|
||||
|
||||
@@ -1060,7 +1060,7 @@ static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3], DerivedM
|
||||
if (!deformedVerts) {
|
||||
if (dm) {
|
||||
/* Deforming a derived mesh, read the vertex locations out of the mesh and
|
||||
* deform them. Once done with this run of deformers will be written back.
|
||||
* deform them. Once done with this run of deformers verts will be written back.
|
||||
*/
|
||||
numVerts = dm->getNumVerts(dm);
|
||||
deformedVerts = MEM_mallocN(sizeof(*deformedVerts)*numVerts, "dfmv");
|
||||
|
||||
@@ -66,6 +66,8 @@
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "BIF_editdeform.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
@@ -103,8 +103,9 @@ static void subsurfModifier_freeData(ModifierData *md)
|
||||
}
|
||||
}
|
||||
|
||||
static void *subsurfModifier_applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int useRenderParams)
|
||||
static void *subsurfModifier_applyModifier(ModifierData *md, Object *ob, void *derivedData, float (*vertexCos)[3], int useRenderParams)
|
||||
{
|
||||
DerivedMesh *dm = derivedData;
|
||||
SubsurfModifierData *smd = (SubsurfModifierData*) md;
|
||||
Mesh *me = ob->data;
|
||||
|
||||
@@ -145,8 +146,9 @@ static int buildModifier_dependsOnTime(ModifierData *md)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void *buildModifier_applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int useRenderParams)
|
||||
static void *buildModifier_applyModifier(ModifierData *md, Object *ob, void *derivedData, float (*vertexCos)[3], int useRenderParams)
|
||||
{
|
||||
DerivedMesh *dm = derivedData;
|
||||
BuildModifierData *bmd = (BuildModifierData*) md;
|
||||
DispListMesh *dlm=NULL, *ndlm = MEM_callocN(sizeof(*ndlm), "build_dlm");
|
||||
MVert *mvert;
|
||||
@@ -368,8 +370,9 @@ static void mirrorModifier_initData(ModifierData *md)
|
||||
mmd->tolerance = 0.001;
|
||||
}
|
||||
|
||||
static void *mirrorModifier_applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int useRenderParams)
|
||||
static void *mirrorModifier_applyModifier(ModifierData *md, Object *ob, void *derivedData, float (*vertexCos)[3], int useRenderParams)
|
||||
{
|
||||
DerivedMesh *dm = derivedData;
|
||||
MirrorModifierData *mmd = (MirrorModifierData*) md;
|
||||
DispListMesh *dlm=NULL, *ndlm = MEM_callocN(sizeof(*dlm), "mm_dlm");
|
||||
MVert *mvert;
|
||||
@@ -470,8 +473,8 @@ static void *mirrorModifier_applyModifier(ModifierData *md, Object *ob, DerivedM
|
||||
for (i=0; i<totface; i++) {
|
||||
MFace *mf = &ndlm->mface[i];
|
||||
MFace *nmf = &ndlm->mface[ndlm->totface];
|
||||
TFace *tf, *ntf;
|
||||
MCol *mc, *nmc;
|
||||
TFace *tf=NULL, *ntf=NULL; /* gcc's mother is uninitialized! */
|
||||
MCol *mc=NULL, *nmc=NULL; /* gcc's mother is uninitialized! */
|
||||
|
||||
memcpy(nmf, mf, sizeof(*mf));
|
||||
if (tface) {
|
||||
|
||||
@@ -573,6 +573,7 @@ typedef struct {
|
||||
DerivedMesh dm;
|
||||
|
||||
CCGSubSurf *ss;
|
||||
int fromEditmesh;
|
||||
} CCGDerivedMesh;
|
||||
|
||||
static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) {
|
||||
@@ -662,11 +663,13 @@ static void ccgDM_drawEdges(DerivedMesh *dm) {
|
||||
|
||||
for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
|
||||
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
|
||||
EditEdge *eed = ccgSubSurf_getEdgeEdgeHandle(ss, e);
|
||||
VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
|
||||
|
||||
if (ccgdm->fromEditmesh) {
|
||||
EditEdge *eed = ccgSubSurf_getEdgeEdgeHandle(ss, e);
|
||||
if (eed->h!=0)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (useAging && !(G.f&G_BACKBUFSEL)) {
|
||||
int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4;
|
||||
@@ -687,11 +690,13 @@ static void ccgDM_drawEdges(DerivedMesh *dm) {
|
||||
|
||||
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
|
||||
CCGFace *f = ccgFaceIterator_getCurrent(fi);
|
||||
EditFace *efa = ccgSubSurf_getFaceFaceHandle(ss, f);
|
||||
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
|
||||
|
||||
if (ccgdm->fromEditmesh) {
|
||||
EditFace *efa = ccgSubSurf_getFaceFaceHandle(ss, f);
|
||||
if (efa->h!=0)
|
||||
continue;
|
||||
}
|
||||
|
||||
for (S=0; S<numVerts; S++) {
|
||||
VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
|
||||
@@ -770,15 +775,24 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, int (*setMaterial)(int)) {
|
||||
|
||||
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
|
||||
CCGFace *f = ccgFaceIterator_getCurrent(fi);
|
||||
EditFace *efa = ccgSubSurf_getFaceFaceHandle(ss, f);
|
||||
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f);
|
||||
int isSmooth = efa->flag&ME_SMOOTH;
|
||||
int isSmooth;
|
||||
|
||||
if (ccgdm->fromEditmesh) {
|
||||
EditFace *efa = ccgSubSurf_getFaceFaceHandle(ss, f);
|
||||
isSmooth = efa->flag&ME_SMOOTH;
|
||||
if (efa->h!=0)
|
||||
continue;
|
||||
|
||||
if (!setMaterial(efa->mat_nr+1))
|
||||
continue;
|
||||
} else {
|
||||
// XXX, can't do these correctly, handle info could have been
|
||||
// free'd if came from a dlm
|
||||
isSmooth = 0;
|
||||
// if (!setMaterial(efa->mat_nr+1))
|
||||
// continue;
|
||||
}
|
||||
|
||||
|
||||
glShadeModel(isSmooth?GL_SMOOTH:GL_FLAT);
|
||||
for (S=0; S<numVerts; S++) {
|
||||
@@ -965,7 +979,7 @@ static void ccgDM_release(DerivedMesh *dm) {
|
||||
MEM_freeN(ccgdm);
|
||||
}
|
||||
|
||||
static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss) {
|
||||
static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, int fromEditmesh) {
|
||||
CCGDerivedMesh *ccgdm = MEM_mallocN(sizeof(*ccgdm), "ccgdm");
|
||||
|
||||
ccgdm->dm.getMinMax = ccgDM_getMinMax;
|
||||
@@ -974,6 +988,8 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss) {
|
||||
ccgdm->dm.getMappedVertCoEM = ccgDM_getMappedVertCoEM;
|
||||
ccgdm->dm.convertToDispListMesh = ccgDM_convertToDispListMesh;
|
||||
|
||||
//ccgdm->dm.getVertCos = ccgdm_getVertCos; // XXX fixme
|
||||
|
||||
ccgdm->dm.drawVerts = ccgDM_drawVerts;
|
||||
ccgdm->dm.drawEdges = ccgDM_drawEdges;
|
||||
ccgdm->dm.drawMappedEdges = ccgDM_drawMappedEdges;
|
||||
@@ -991,6 +1007,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss) {
|
||||
ccgdm->dm.release = ccgDM_release;
|
||||
|
||||
ccgdm->ss = ss;
|
||||
ccgdm->fromEditmesh = fromEditmesh;
|
||||
|
||||
return ccgdm;
|
||||
}
|
||||
@@ -1003,7 +1020,7 @@ DerivedMesh *subsurf_make_derived_from_editmesh(EditMesh *em, SubsurfModifierDat
|
||||
|
||||
ss_sync_from_editmesh(ss, em, useSimple);
|
||||
|
||||
return (DerivedMesh*) getCCGDerivedMesh(ss);
|
||||
return (DerivedMesh*) getCCGDerivedMesh(ss, 1);
|
||||
}
|
||||
|
||||
DerivedMesh *subsurf_make_derived_from_mesh(Mesh *me, DispListMesh *dlm, SubsurfModifierData *smd, int useRenderParams, float (*vertCos)[3]) {
|
||||
|
||||
@@ -1831,7 +1831,7 @@ static void object_panel_modifiers(Object *ob)
|
||||
|
||||
but = uiDefBut(block, BUT, B_MAKEDISP, "Move Up", 760, 380, 80, 19, 0, 0, 0, 0, 0, "Move modifier up in stack");
|
||||
uiButSetFunc(but, modifiers_moveUp, ob, md);
|
||||
but = uiDefBut(block, BUT, B_MAKEDISP, "Move Down", 840, 380, 80, 19, 0, 0, 0, 0, 0, "Move modifier up in stack");
|
||||
but = uiDefBut(block, BUT, B_MAKEDISP, "Move Down", 840, 380, 80, 19, 0, 0, 0, 0, 0, "Move modifier down in stack");
|
||||
uiButSetFunc(but, modifiers_moveDown, ob, md);
|
||||
|
||||
sprintf(str, "Modifier: %s", mti->name);
|
||||
|
||||
Reference in New Issue
Block a user