diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2008-07-22 21:03:44 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2008-07-22 21:03:44 +0400 |
commit | 0fdcf52a47dec9c515cdeab2c4067e2173dbde22 (patch) | |
tree | 1300a87d5a487b5de9b806e1a8ea634e855e3f93 /source/blender/src | |
parent | 609eb7071582c6d584dc93d0c0594fa7ee4d701e (diff) |
Added a reshape button to the multires modifier. It copies the vertices from another selected mesh into the current level. Allows indirect editing of multires levels other than the base in editmode, and more importantly allows for editing multires levels in other programs. Of course, vertex order and overall topology must match. Additionally, the copy is only exact for the first and last level. All other levels will do the usual catmull-clark subdivision.
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/buttons_editing.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 5cbeac2b0ca..c04a5d159a7 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -1671,6 +1671,27 @@ static void multiresModifier_subdivide_button(void *mmd_v, void *ob_v) } } +static void multiresModifier_reshape_button(void *mmd_v, void *ob_v) +{ + MultiresModifierData *mmd = mmd_v; + if(mmd && ob_v) { + Base *base = FIRSTBASE; + if(base && base->object != ob_v) { + Object *src = base->object; + if(src->type == OB_MESH) { + if(multiresModifier_reshape(mmd, ob_v, src)) + error("Vertex count mismatch"); + else + BIF_undo_push("Multires reshape"); + } + else + error("Second selection not a mesh"); + } + else + error("Second selection required"); + } +} + static int modifier_is_fluid_particles(ModifierData *md) { if(md->type == eModifierType_ParticleSystem) { if(((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID) @@ -1841,7 +1862,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco } else if (md->type==eModifierType_Explode) { height = 94; } else if (md->type==eModifierType_Multires) { - height = 48; + height = 72; } /* roundbox 4 free variables: corner-rounding, nop, roundbox type, shade */ uiDefBut(block, ROUNDBOX, 0, "", x-10, y-height-2, width, height-2, NULL, 5.0, 0.0, 12, 40, ""); @@ -2471,6 +2492,10 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco but = uiDefButC(block,NUM,B_MODIFIER_RECALC,"Level: ",lx,(cy-=19),buttonWidth,19, &mmd->lvl, 1.0, mmd->totlvl, 0,0,""); uiButSetFunc(but, multiresModifier_setLevel, mmd, ob); + + uiBlockBeginAlign(block); + but = uiDefBut(block,BUT,B_MODIFIER_RECALC,"Reshape", lx,(cy-=24),buttonWidth/2,19,0,0,0,0,0,"Copy vertices from another selected mesh into the current level"); + uiButSetFunc(but, multiresModifier_reshape_button, mmd, ob); } uiBlockEndAlign(block); |