diff options
author | Daniel Dunbar <daniel@zuster.org> | 2005-07-23 23:15:08 +0400 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2005-07-23 23:15:08 +0400 |
commit | e331e68b571b0b72de1c4636209d038c4f679631 (patch) | |
tree | d66238bfebcfd7b92d96621d4b4d56803f1c43a0 /source/blender/blenkernel | |
parent | fb651ddb4a47d86312a4afafaa48e1bf4e48447f (diff) |
- added ModifierData flag, is modifier enabled in editmode
- added modifier type flag: should modifier be enabled by default for
active in editmode
- added subsurf "debug incremental" option instead of G.rt==52 (it becomes
a slightly useful feature now for debugging how well a modifier works
with incremental subsurf... maybe important for future python modifier
developers)
- shuffled modifier button layout just to keep people guessing
- switched back to drawing editmesh face centers not through derivedmesh,
I didn't think this one through, forgot that centers were also used for
selection. have to think about what to do about this, should be either
(a) don't draw centers with a cage active (optimal mode) or (b) come up
with api to draw centers through derivedmesh and also handle selection.
- changed recalc_editnormals to also follow the len(no)==0.0 use vertex
co convention
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 13 |
4 files changed, 28 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index e079b2f2e30..e407c04159c 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -59,6 +59,14 @@ typedef enum { eModifierTypeFlag_AcceptsCVs = (1<<1), eModifierTypeFlag_SupportsMapping = (1<<2), eModifierTypeFlag_SupportsEditmode = (1<<3), + + /* For modifiers that support editmode this determines if the + * modifier should be enabled by default in editmode. This should + * only be used by modifiers that are relatively speedy and + * also generally used in editmode, otherwise let the user enable + * it. + */ + eModifierTypeFlag_EnableInEditmode = (1<<4), } ModifierTypeFlag; typedef struct ModifierTypeInfo { diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 89b6f1458a4..ce3573366ba 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -34,6 +34,8 @@ #include <config.h> #endif +#include "PIL_time.h" + #include "MEM_guardedalloc.h" #include "DNA_effect_types.h" @@ -1234,6 +1236,7 @@ typedef float vec3f[3]; static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3], DerivedMesh **deform_r, DerivedMesh **final_r, int useRenderParams, int useDeform) { +// double startTime = PIL_check_seconds_timer(); Mesh *me = ob->data; ModifierData *md= ob->modifiers.first; float (*deformedVerts)[3]; @@ -1351,6 +1354,8 @@ static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3], DerivedM if (deformedVerts && deformedVerts!=inputVertexCos) { MEM_freeN(deformedVerts); } + +// printf("mesh_calc_modifiers(%p, %p, %p, %p, %d) : %6.3fs\n", ob, inputVertexCos, deform_r, final_r, useRenderParams, PIL_check_seconds_timer()-startTime); } static vec3f *editmesh_getVertexCos(EditMesh *em, int *numVerts_r) @@ -1387,7 +1392,7 @@ static void editmesh_calc_modifiers(DerivedMesh **cage_r, DerivedMesh **final_r) for (; md; md=md->next) { ModifierTypeInfo *mti = modifierType_get_info(md->type); - if (!(md->mode&1)) continue; + if (!(md->mode&eModifierMode_Editmode)) continue; if (mti->isDisabled && mti->isDisabled(md)) continue; if (!(mti->flags&eModifierTypeFlag_SupportsEditmode)) continue; diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 1730c339651..27289c2fc4c 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -754,7 +754,7 @@ ModifierTypeInfo *modifierType_get_info(ModifierType type) mti = INIT_TYPE(Subsurf); mti->type = eModifierTypeType_Constructive; - mti->flags = eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsMapping | eModifierTypeFlag_SupportsEditmode; + mti->flags = eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsMapping | eModifierTypeFlag_SupportsEditmode | eModifierTypeFlag_EnableInEditmode; mti->initData = subsurfModifier_initData; mti->freeData = subsurfModifier_freeData; mti->applyModifier = subsurfModifier_applyModifier; @@ -769,7 +769,7 @@ ModifierTypeInfo *modifierType_get_info(ModifierType type) mti = INIT_TYPE(Mirror); mti->type = eModifierTypeType_Constructive; - mti->flags = eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsEditmode; + mti->flags = eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_SupportsEditmode | eModifierTypeFlag_EnableInEditmode; mti->initData = mirrorModifier_initData; mti->applyModifier = mirrorModifier_applyModifier; mti->applyModifierEM = mirrorModifier_applyModifierEM; @@ -791,7 +791,10 @@ ModifierData *modifier_new(int type) ModifierData *md = MEM_callocN(mti->structSize, mti->structName); md->type = type; - md->mode = eModifierMode_RealtimeAndRender; + md->mode = eModifierMode_Realtime|eModifierMode_Render; + + if (mti->flags&eModifierTypeFlag_EnableInEditmode) + md->mode |= eModifierMode_Editmode; if (mti->initData) mti->initData(md); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index adc2d90bb24..ca2690a5177 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -92,6 +92,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAgin if (prevSS) { int oldUseAging; + useAging = !!useAging; ccgSubSurf_getUseAgeCounts(prevSS, &oldUseAging, NULL, NULL, NULL); if (oldUseAging!=useAging) { @@ -1291,8 +1292,9 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, int fromEditmesh, Mesh DerivedMesh *subsurf_make_derived_from_editmesh(EditMesh *em, SubsurfModifierData *smd, float (*vertCos)[3]) { int useSimple = smd->subdivType==ME_SIMPLE_SUBSURF; - - smd->emCache = _getSubSurf(smd->emCache, smd->levels, G.rt==52, 0, 0, useSimple); + int useAging = smd->flags&eSubsurfModifierFlag_DebugIncr; + + smd->emCache = _getSubSurf(smd->emCache, smd->levels, useAging, 0, 0, useSimple); ss_sync_from_editmesh(smd->emCache, em, vertCos, useSimple); return (DerivedMesh*) getCCGDerivedMesh(smd->emCache, 1, NULL, NULL); @@ -1316,7 +1318,8 @@ DerivedMesh *subsurf_make_derived_from_mesh(Mesh *me, DispListMesh *dlm, Subsurf return derivedmesh_from_displistmesh(ndlm); } else { int useEdgeCreation = !(dlm?dlm->medge:me->medge); - int useIncremental = smd->useIncrementalMesh && !useEdgeCreation; + int useIncremental = (smd->flags&eSubsurfModifierFlag_Incremental) && !useEdgeCreation; + int useAging = smd->flags&eSubsurfModifierFlag_DebugIncr; CCGSubSurf *ss; /* It is quite possible there is a much better place to do this. It @@ -1333,7 +1336,7 @@ DerivedMesh *subsurf_make_derived_from_mesh(Mesh *me, DispListMesh *dlm, Subsurf } if (useIncremental && isFinalCalc) { - smd->mCache = ss = _getSubSurf(smd->mCache, smd->levels, G.rt==52, 0, 0, useSimple); + smd->mCache = ss = _getSubSurf(smd->mCache, smd->levels, useAging, 0, 0, useSimple); ss_sync_from_mesh(ss, me, dlm, vertCos, useSimple); @@ -1344,7 +1347,7 @@ DerivedMesh *subsurf_make_derived_from_mesh(Mesh *me, DispListMesh *dlm, Subsurf smd->mCache = NULL; } - ss = _getSubSurf(NULL, smd->levels, G.rt==52, 1, useEdgeCreation, useSimple); + ss = _getSubSurf(NULL, smd->levels, 0, 1, useEdgeCreation, useSimple); ss_sync_from_mesh(ss, me, dlm, vertCos, useSimple); ndlm = ss_to_displistmesh(ss, 0, me, dlm); |