Commit Graph

20 Commits

Author SHA1 Message Date
Brecht Van Lommel 503f7ec248 Fix for bug #4393: initial vertex colors were not created from shaded
mode colors anymore, which also affected python scripts that depend on
this feature. Restored that now.
2006-06-21 15:14:44 +00:00
Campbell Barton cb67cba19a Multiple armatures<>mesh objects now work with name flipping.
previously would only work if the armature was the first in the meshes modifier list,
in that case the armature would be name flipped but the mesh would not)
2006-05-04 00:59:02 +00:00
Ton Roosendaal c648e790be New: CrazySpace [tm] correction
When Modifiers are used in Edit Mode to show the deformed result for
editing, all actual coordinates Blender works with are still the ones from
the original Cage. You can notice that with the Transform Widget or
helper lines while transforming.

Even worse, the actual transformations still happened on the original Cage
as well, making it very hard to edit. That caused the feature to be named
"CrazySpace" (baptized by Andy, afaik?).

This commit calculates the deformation transformation per vertex, and
inverse corrects it, so it's more intuitive editing this way.

Unfortunately all the deformation features of Blender don't use matrices
for defining deform, so the existing code cannot be re-used to retrieve
the correct deformation matrix per vertex. The solution I found is based
on calculating per face the transformation based on its first 3 vertices,
and store this transformation averaged in the face's vertices.
The solution can also only work on entire faces, because the full deform
can only be retrieved using 3 vertices. (using 2 vertices will miss edge-
aligned rotation, using 1 vertex can only retrieve translation).

By deriving the deformations per face, small errors will still happen,
especially on very low-poly Meshes with extreme deformations.

The only alternative I know now, is providing each vertex in
a mesh with 2 extreme small tangent vectors, which get deformed using the
existing code as well. That will mess up the existing deformation code too
much though, this solution has the benefit it works with each deform we can
up with later too.

Last note about CrazySpace: it can only be used to tweak Meshes. Do not
even try to add vertices, extrude, or duplicate. Probably we should disable
this... but preventing user errors isn't always power-user-friendly, eh. :)
2005-10-26 09:56:52 +00:00
Jean-Luc Peurière e2d577de9e initial commit of the fluid simulator.
Ton reviewed and gave his blessing.
Zr, can you have a look ?

see :
http://projects.blender.org/tracker/?func=detail&atid=127&aid=3039&group_id=9

for initial comments.

N_T : the solver itself (elbeem) needs some works to get rid of
warnings
2005-09-18 13:27:12 +00:00
Ton Roosendaal e2944936ac Fix for weight painting errors, as reported by Bassam.
- Undo/Redo didn't work
- Crash on using weightpaint with Armature-modifier (instead of parent).

Note: checking if an object is being deformed cannot be simply done with
checking for a parent anymore... for this a call in modifier.c has been
added; modifiers_isDeformedByArmature(Object *). It even returns the
Armature object pointer.
2005-09-07 18:07:24 +00:00
Daniel Dunbar 3d7ed80ed4 - added modifiers_isDeformedByArmature function 2005-08-22 20:24:59 +00:00
Daniel Dunbar 75bcb4cd98 - added modifiers_getVirtualModifierList, returns pointer to first modifier
but including "virtual" modifiers (for example, an object skel-parented
   to a lattice has a virtual first lattice modifier)
 - removed mesh_modifier(), all functionality has been incorporated into
   modifier stack (well, keys still don't exist as a modifier, but I am
   not sure if they should).
 - added interface option to convert a virtual modifier into a real modifier
 - added option to parent to lattice object or lattice with deform
 - bug fix, patch of hook indices patched all hooks (oops) not just ones
   for edited mesh

NOTE: Files saved with 2.38 that include an object parented to a lattice
will not load correctly, because it will look like the object is parented
only to the object (i.e. without deform). Can be simply fixed by reparenting
or adding a lattice modifier. Older files are handled automatically.
2005-08-11 03:31:33 +00:00
Daniel Dunbar ac3ed0f92a - switch to using softbody modifier, controls enabling but does not have
variables, these are still in same place. enable button automatically
   makes/enables modifier.
 - changed hook to hook modifier conversion to happen on direct link,
   required to make sure we don't forget to free any memory for files
   saved with 2.38 that have hooks.
 - update modifier interface to enforce modifiers with the require-original-
   data flag to not move beyond deforming modifiers.
 - enforce only one softbody modifier allowed

NOTE: Once again, no modifier stack for lattice yet means softbody for
lattice does not work atm.
2005-08-11 02:23:52 +00:00
Daniel Dunbar 9030e5f686 - added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
   indices)
 - added ModifierType.foreachObjectLink for iterating over Object
   links inside modifier data (used for file load, relinking, etc)
 - switched various modifiers_ functions to take object argument
   instead of ListBase
 - added user editable name field to modifiers
 - bug fix, duplicate and make single user didn't relink object
   pointers in modifier data
 - added modifiers to outliner, needs icon
 - added armature, hook, and softbody modifiers (softbody doesn't
   do anything atm). added conversion of old hooks to modifiers.

NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.

NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.

NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
Daniel Dunbar 8319b3d1fa - modifier UI update (aka, find the modifier buttons!!)
- moved back to editing buttons, where life is now cramped... switched
   to constraint style foldout panes, still a WIP. In particular not
   sure what buttons should be in header (and if current toggles stay
   in header if they should also be in an expanded pane). Also need
   new icons for move up/move down (and drag and drop would of course
   be nice). Finally current plane is to make it so modifiers will
   expand out in modifier pane for horizontal orientations instead of
   just going down down down to goblin town.
 - added error field to modifiers that is displayed in UI, need to have
   some way for modifiers to return errors back to interface (esp. important
   for python)
 - tweaked cage determination and handling, currently the editmode cage
   is determined by last modifier with OnCage set that is preceeded completely
   by modifiers that support mapping or are disabled in editmode. it is
   kinda confusing, but the interface only lets you toggle OnCage for modifiers
   that support it - it just might not be clear all the time why you can't
   toggle a certain modifier OnCage.
 - update displistmesh_copy to only copy edges if non-NULL

There is a display bug that already existed but is more obvious with
new modifiers where parts of the pane get drawn in a different area
after toggling editmode. It has to do with drawing parts of the interface
using GL instead of 100% buttons. I try to keep my grubby little toes
out of the interface code so this can wait for Ton to return.
2005-08-04 07:25:43 +00:00
Daniel Dunbar 8a58197cf3 - change modifier applyModifier[EM] function to not free derived argument
- added modifier_supportsMapping function
 - update CCG to set actual vertex normal (and not just
   interior face vertex normal, bla bla bla no one knows
   what this means nevermind).
 - renamed modifierType_get_info to modifierType_getInfo for
   consistency and to increase my commit line count.
 - update EditMeshDerivedMesh to calculate (and use new) normals
   when given deformed vertices
 - added
 - update editmode modifier calculation to also calculate a cage,
   not working 100% atm, in particular if a deformer follows a modifier
   that returns a DerivedMesh the cage is not accurate.
 - added ccg derivedmesh drawMapped{Vert,Face]NormalsEM functions
 - currently UI for selecting the cage mesh is rather irritating,
   will be updated
2005-08-03 04:04:05 +00:00
Daniel Dunbar 4b1588e277 - update storage.c to use standard time codes (should fix issue
with MSVS 8)
 - broke mesh_create_shadedColors out of shadeDispList, used to
   build vertex colors for mesh in vpaint as well (also fixed
   bug where they were not initialized correctly for subsurfs)
 - added modifier_copyData and modifier_findByType functions
 - change editmode modifiers to only calculate if Realtime and
   Editmode bits are both set, makes more sense for copying
   modifiers
 - update object_copy to correctly copy modifiers
 - removed duplicate redefinition of ME_ attributes in python,
   this is a horrible idea, why was it done in the first place?
 - update armature auto vertex group code to check for subsurf
   in modifier stack
 - fixed flip_subdivision to work with move to modifier stack
 - added copymenu_modifiers, can copy all modifiers or just
   data from first modifier of a certain type (not sure how
   to deal with multiple modifiers of same type... not
   a big issue though I think)
2005-07-27 20:16:41 +00:00
Daniel Dunbar e331e68b57 - 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
2005-07-23 19:15:08 +00:00
Daniel Dunbar e546e81762 - added data arguments to deformer modifiers, in case someone wants
to write one that is based on geometry (and not just vertex position)
 - added editmode versions of modifier deform/apply calls and flag
   to tag modifiers that support editmode
 - added isFinalCalc param to applyModifier, basically a switch to let
   subsurf know if it is calc'ng orco or not (so it can deal with cache
   appropriately). This is kinda hacky and perhaps I can come up with
   a better solution (its also a waste to do a complete subdivide just
   to get vertex locations).
 - changed ccgsubsurf to not preallocate hash's to be approximately correct
   size... this was probably not a big performance savings but means that
   the order of faces returned by the iterator can vary after the first
   call, this messes up orco calculation so dropped for time being.
 - minor bug fix, meshes with only key didn't get vertex normals correctly
   calc'd
 - updated editmesh derivedmesh to support auxiliary locations
 - changed mesh_calc_modifiers to alloc deformVerts on demand
 - added editmesh_calc_modifiers for calculating editmesh cage and final
   derivedmesh's
 - bug fix, update shadedisplist to always calc colors (even if totvert==0)
 - changed load_editMesh and make_edge to build me->medge even if totedge==0
   (incremental subsurf checks this)

todo: add drawFacesTex for ccgderivedmesh

So, modifiers in editmode are back (which means auto-mirror
in edit mode works now) although still not finished. Currently
no cage is computed, the cage is always the base mesh (in
other words, Optimal edge style editing is off), and the final
mesh currently includes all modifiers that work in edit mode
(including lattice and curve). At some point there will be toggles
for which modifiers affect the final/cage editmode derivedmesh's.

Also, very nice new feature is that incremental subsurf in object
mode returns a ccgderivedmesh object instead of copying to a new
displistmesh. This can make a *huge* speed difference, and is very
nice for working with deformed armatures (esp. with only small
per frame changes).
2005-07-22 07:37:15 +00:00
Daniel Dunbar 33709bf6e2 - shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
 - added modifier_{new,free] utility function
 - added ccgSubSurf_getUseAgeCounts to query info
 - removed subsurf modifier faking (ME_SUBSURF flag is no
   longer valid). subsurf modifier gets converted on file load
   although there is obscure linked mesh situation where this
   can go wrong, will fix shortly. this also means that some
   places in the code that test/copy subsurf settings are broken
   for the time being.
 - shuffled modifier calculation to be simpler. note that
   all modifiers are currently disabled in editmode (including
   subsurf). don't worry, will return shortly.
 - bug fix, build modifier didn't randomize meshes with only verts
 - cleaned up subsurf_ccg and adapted for future editmode modifier
   work
 - added editmesh.derived{Cage,Final}, not used yet
 - added SubsurfModifierData.{mCache,emCache}, will be used to cache
   subsurf instead of caching in derivedmesh itself
 - removed old subsurf buttons
 - added do_modifiers_buttons to handle modifier events
 - removed count_object counting of modifier (subsurfed) objects...
   this would be nice to add back at some point but requires care.
   probably requires rewrite of counting system.

New feature: Incremental Subsurf in Object Mode

The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.

However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.

I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
Daniel Dunbar dc232fda47 Wow! A new feature!
- made ModifierData.isDisabled optional
 - Added new modifier type: Mirror
    o modifier system isn't running in editmode yet so still
      don't have mirrored editing, but otherwise it is pretty
      cool. code even goes to tricks to make sure mirror join
      looks nice in degenerate cases.
    o this kind of commit is basically the upshot of all the
      previous commits - in that implementing a new modifier
      changes only about 3 files and still integrates nearly
      completely.
2005-07-20 07:11:26 +00:00
Daniel Dunbar 38e0d79e68 - for some reason mesh_create_derived_no_deform took the raw data (not
an object) but this is not going to work... I can't remember the reason
   I did it this way in the first place either! oops! regardless, switch
   to all mesh_ derived accessors taking object argument. there is still
   a bug in render orco calculation though. (hunt hunt)
 - removed python files that should have been ditched in previous commit
2005-07-20 04:44:02 +00:00
Daniel Dunbar 259c7b6cad - added modifier_dependsOnTime to check if modifier needs updating
based on time change. would be nice if dep graph could handle this.
 - made dep check if modifiers need update on time change
 - fix render crash (access null)
 - added new Build Effect modifier type. compared to old one works as
   a full member of modifier system, means can apply subsurf, etc on
   it, reorder, what have you. and it is all nice and self contained.
 - removed old Build effect, old files convert to new style on load
 - couldn't help myself, added a randomize feature to build effect
 - removed Python BuildEffect support
2005-07-20 04:14:21 +00:00
Daniel Dunbar d18600520e - added ModifierTypeInfo.updateDepgraph function, responsible for building
appropriate relations in dep graph (modifiers respond to scene changes
   correctly now)
 - update modifier buttons to trigger depgraph rebuild if needed
2005-07-19 23:04:34 +00:00
Daniel Dunbar 1df154d140 - split {curve,lattice,armature}_deform_verts out of mesh_deform
- removed mesh_deform (merge into mesh_modifier)
 - switch python lattice_apply function to use object_apply_deform,
   this isn't exactly equivalent but the python system shouldn't
   have been calling that deep into the kernel anyway.

New feature: Modifier stack
 - added Object.modifiers (list of ModifierData elements)
 - added DNA_modifier_types.h
     o contains type definition for the file data for the various
       modifier types
 - added BKE_modifier.h
     o contains modifierType_get_info (access to modifier type registry)
     o structs and defines for runtime modifier usage
 - updated mesh_calc_modifiers to evaluate modifier stack (note that
   for the time being it also evaluates the old style modifiers so files
   should load and work as normal).
 - add file handling modifier code (todo: don't replicate on object copy)
 - add modifier stack UI code (lives in object panel)


Only real new feature at the moment is that you can apply lattices and
curves *after* a subdivision surface which was never possible before.

Todo:
 - DEP graph updating does not work correctly yet, so you generally have
   to tab cycle to see results.
 - editmode calculation does not use modifier stack.
 - bug fixes (there must be a few in there somewhere)
2005-07-19 20:14:17 +00:00