Commit Graph

213 Commits

Author SHA1 Message Date
c98148a963 =bmesh= merge from trunk at r36153 2011-04-15 01:19:13 +00:00
90fa130a69 =bmesh= various bugfixes 2011-03-31 00:52:12 +00:00
f4a2008441 =bmesh=
Multires interpolation is now nearly perfect, but has some
issues on faces whose angle to each other isn't relatively
shallow (probably need to use some sort of fast spatial structure 
to more accurately project multires points). 

It also doesn't work super well with bevel (mostly due to a
flipped normals bug in bevel I need to get around to fixing).
And, for some reason extrude tends to explode the multires
geometry (it should just be copying it).

Since edge cut doesn't do anything yet with face interpolation, 
cuts that arn't exactly centered will move the underlying multires 
geometry around a bit..
2011-03-30 01:36:42 +00:00
7d43a48993 =bmesh=
Multires interpolation is considerably better
now, though it still has a problem with occasionally
producing little random tangent spikes.  Still, it's
far better then it was.

Also fixed a bug in dissolve faces.
2011-03-29 05:48:18 +00:00
93fa307712 =bmesh=
Multires interpolation.  It's quite usable yet; I wanted to avoid
subsurfing the multires data and ray tracing original/new
topology.  The result is kindof like trunk's interpolation.

I'll see how much better I can get it.  I might have to go with 
the full-on ray tracing solution.  Right now, it's not very good.

Also made it so trunk files with multires open correctly.
2011-03-27 02:56:41 +00:00
a147a91899 =bmesh=
Fixed view selected code.  Made MDisps->disps use the
special allocation library I wrote as a
temporary fix to MDeformGroup->dw problems.

Why was the vgroup solution reused?  It's really slow,
and its hard to tie in something like mempool or memarena.
The hackish allocator I wrote really needs to go, eventually,
or be folded into guardedalloc.

Also fixed a customdata bug with modifiers.
2011-03-03 07:10:42 +00:00
Nathan Letwory
0ff06e21cd doxygen: blender/blenkernel tagged. 2011-02-27 20:40:57 +00:00
f01261d040 merge with/from trunk at r35190 2011-02-27 06:19:40 +00:00
0955c664aa fix for warnings from Sparse static source code checker, mostly BKE/BLI and python functions.
- use NULL rather then 0 where possible (makes code & function calls more readable IMHO).
- set static variables and functions (exposed some unused vars/funcs).
- use func(void) rather then func() for definitions.
2011-02-13 10:52:18 +00:00
9e9e028f05 access past array bounds in layerInterp_mdisps, also make some vars const. 2011-02-12 10:18:21 +00:00
329e2d8037 Todo issue: sculpting on deformed mesh
Used a crazyspace approach (like in edit mode), but only modifiers with
deformMatricies are allowed atm (currently shapekeys and armature modifiers only).
All the rest modifiers had an warning message that they aren't applied because
of sculpt mode. Deformation of multires is also unsupported.

With all this restictions users will always see the actual "layer" (or maybe
mesh state would be more correct word) they are sculpting on.

Internal changes:
- All modifiers could have deformMatricies callback (the same as deformMatriciesEM but
  for non-edit mode usage)
- Added function to build crazyspace for sculpting (sculpt_get_deform_matrices), but it
  could be generalized for usage in other painting modes (particle edit mode, i.e)

Todo:
- Implement crazyspace correction to support all kinds of deformation modifiers
- Maybe deformation of multires isn't so difficult?
- And maybe we could avoid extra bad-level-stub for ED_sculpt_modifiers_changed
  without code duplicating?
2011-01-31 20:02:51 +00:00
14d8921fff Total displacement levels should be set in multires_topology_changed 2011-01-30 17:55:48 +00:00
8227b3d463 remove/comment unused vars
also removed unnecessary NULL checks (where the pointer was used later without checking).
2011-01-13 04:53:55 +00:00
fded5e5ce5 comment/remove unused vars from particle and multires code.
also remove calls to dm->getFaceDataArray() within a loop for particle grid distribution,
instead call this once at the start and reuse the result.
2011-01-11 07:38:16 +00:00
473838aec9 Fix for bug [#21534] Multires modifier strange deformations
This adds the "Apply Base" feature from my gsoc2010 branch.

Apply Base partially applies the modifier, in that the mesh is
reshaped to more closely match the deformed mesh. The upper-level
displacements are recalculated so that the highest multires level
appears unchanged.

Multires does not currently deal well with too large displacements.
An easy-to-reproduce example: create any mesh type, add multires,
subdivide a few times, then use the sculpt grab brush to drag the
entire mesh over a few units. At the highest level, and at level 0,
the mesh looks fine, but all of the intervening levels will have ugly
spikes on them.

This patch doesn't help with situations where you can't modify the
base mesh, but otherwise works around the problem fairly well (albeit
with a heuristic, not an exact solution.)
2011-01-07 21:12:47 +00:00
89c9aaaa25 remove references to BKE_utildefines where its not needed.
- move GS() define into DNA_ID.h
- add BLI_utildefines as an automatic include with makesrna generated files.
2011-01-07 19:18:31 +00:00
8f21a43535 split BKE_utildefines.h, now it only has blender specific defines like GS() MAKE_ID, FILE_MAXDIR, moved the generic defines to BLI_utildefines.h.
no functional changes.
2011-01-07 18:36:47 +00:00
91d352024b Get rid of uninitialized variable and malicios derived mesh relising.
Pointer by llvn analyzer.
2011-01-05 15:58:44 +00:00
78162fa793 Splitting quad into triangles and merging triangles into quad should
work correct with sculpting data now.

Joining two triangles could give incorrect sculpting result for
special topologies, but it's that case that can't be nicely handled
with our layers architecture.
2011-01-02 17:38:22 +00:00
76f0569a86 Multires math function used for layer interpolation moved from customdata.c to multires.c
No functional changes
2011-01-02 16:43:28 +00:00
991eac85ff Initial implementation of mdisps layer interpolation
Sculpt data shouldn't be lost when making topology changes without
quads<->tris face converison.

General idea:
- Go through all grid points of each corner and convert per-corner
  coordiante to per-face cooredinate
- Apply weights and convert new point to per-corner coordinate
- Use bilinear interpolation to get needed displacement vector

Some additional work was necessery:
- Two neighbour corners could have different displacements along common
  boundary. multires_mdisp_smooth_bounds() makes displacement "symmetrical"
- Point could change it's corner, so displacement vector should be flipped
  in some way. In some cases it's not only flipping, because corner could
  be mapped with some rotation. It's not solved for triangular faces yet,
  so only z-axis displacement would be interpolated for tris.

More limitations:
- Interpolation will give incorrect result after quad<->triangle
  face conversion.
- When face normal was fillped displacement would change it's direction too.
2010-12-13 21:22:30 +00:00
c85adcc2e4 Use mdisps layer from edit_mesh when adding/removing multires modifier
when object is in edit mode.
2010-12-13 10:24:05 +00:00
bf14b21481 == Multires ==
Fixed bug #20620, "VertColors and Flat/Soft imported from 2.49 are wrong
(MultiRes)" reported by Manuel R.

* Added function to load level-0 vertex colors
* Added function to load level-0 face flags
* Warning: the 2.5 multires modifier doesn't support multires vertex colors
  or multires face flags; that data will be lost if you import it into 2.5.
2010-11-20 18:54:58 +00:00
4b45a42b48 Removed unused code from multires module 2010-11-10 08:24:15 +00:00
f9487fba39 Fixed own mistake from previous commit -- get_levels_from_disps can't be used
when handling topology changes.
Added grid size detection based on totdisp and corners count.
2010-11-08 14:39:36 +00:00
8647dbc0a6 Fix crash when creating new faces in edit mode
- Do not check corners count if totdisp is set to 0
- Allocate memory for such mdisps to prevent the whole disp layer erasing
2010-11-08 14:00:23 +00:00
e8501edae2 Read external mdisp when hamdling topology changes 2010-11-05 14:00:31 +00:00
66b274766a minor c90 compat edits. (no functional changes). 2010-11-05 13:37:18 +00:00
f478cef43b Fix #24388: multires base mesh
- MDisp should be re-allocated if face changed amount of vertices
- Allocate disps array in layerSwap_mdisps to prevent loosing all highres data
2010-11-04 16:00:28 +00:00
5fb6c942b7 Fix #24485: Applying scale to multires object end up in a blender crash
Fixed multires_apply_smat to work properly with different current and
total subdivision levels.
2010-11-02 10:55:49 +00:00
3367ef8b65 initialize structs to zero rather then using memset(). 2010-10-31 15:39:37 +00:00
d327f08f9a Fix #24255: Multires object gets modified when joining it to another multires object.
Fix #22018: joining objects with different multires levels loses levesl from the higher multires object

- Synchronyze mulires subdivision level when joining objects
- Apply scale on MDISP layer when applying scale
- Re-calculate MDISP when joining scaled objects
2010-10-25 08:03:05 +00:00
Nathan Letwory
c9d16d0ddb /WX enabled for MSVC in CMake too.
Warning fixes.
2010-10-21 08:32:53 +00:00
8268a4be71 most unused arg warnings corrected.
- removed deprecated bitmap arg from IMB_allocImBuf (plugins will need updating).
- mostly tagged UNUSED() since some of these functions look like they may need to have the arguments used later.
2010-10-16 14:32:17 +00:00
4eaa10aa02 == Multires ==
Fixed bug #23657, "Modifiers dosen't work when you select diffrent mesh for object"

Multires modifier now adds empty mdisps if they're missing, rather than displaying a warning
Switching an object's mesh will now check for a multires modifier; if found the modifier's total number of levels are reset to match the mesh's mdisps
Switching the mesh also forces a multires update so that sculpted changes aren't lost
2010-09-09 00:14:51 +00:00
c11c196efa part 1 of merge from trunk at r30358; it compiles, but doesn't link quite yet :) 2010-07-19 04:44:37 +00:00
efeb8148c8 Fix #22213: applying deform modifier in front of multires modifier crashes,
should not do multires reshape in this case, but just regular apply.
2010-07-05 12:20:49 +00:00
c28aec9ae1 Fix #22589: pressing subdivide or updating displacements after sculpting
on multire would unnecessarily subdivide vertex groups and other layers,
making the operation slower than necessary.
2010-06-22 16:46:13 +00:00
e0368d31a5 Enabled openmp multithreading for multires/subsurf again, but only
if there are >= 1 million faces estimated in the resulting mesh.

(merge from render25 branch)
2010-06-22 15:09:41 +00:00
0a7d036f32 Fixed bug #22293, v2.49b to v2.5alpha2 incompatibility
* UV data on multires meshes wasn't getting imported properly. Fixed by separately loading in all "first-level" data from the old multires data type into mesh. Note that an "incorrect" data layers might still be loaded and be active on the mesh, but the correct layers should now also show up in the UV layer selector.
2010-06-07 04:48:22 +00:00
640fb84bed - Added checking if modifier is active in find_multires_modifier
- Pass MultiresModifierData to reshape functions
2010-06-06 15:22:27 +00:00
89320c911e Sculpt & modifiers: patch by Sergey Sharybin, with modifications by me.
Fixes various crashes and redraw problems, most noticeable new feature
is that you can now sculpt on a multires mesh with deforming modifiers
preceding it.

I've left out support for sculpting on multires with enabled modifiers
following it, in this case only the base mesh can be sculpted now. The
code changes needed to do this are just too ugly in my opinion, would
need a more torough redesign which I don't think we should try now. In
my opinion this is also not really an important case, since it's going
to be incredibly slow anyway to run a modifier on a high res mesh while
sculpting.


So, to summarize current state:

* Fastest sculpting: base mesh with no modifiers or multires with only
  modifiers preceding it.
* Slower sculpting: base mesh with modifiers, depends on the speed of
  the modifiers.
* Not supported: multires mesh with modifiers following it.
2010-06-02 18:04:31 +00:00
3961793292 Fix #22239: external btx won't load. 2010-06-01 19:26:35 +00:00
db96d4972f Workaround #20467: disabled OpenMP multithreading on subsurf/multires/sculpt
for now, it's too fine grained and so becomes a performance bottleneck on some
platforms, while only providing a modest speedup on others. Couldn't find a
simple enough solution to solve this, so for now no multithreading here.
2010-06-01 19:01:54 +00:00
9f7c04944a Removed unused argument mmd from multires reshape functions. 2010-05-21 14:18:07 +00:00
50b4129398 Recommit fix that I seem to have uncommitted accidentally, had the fix
still in my source tree but svn wasn't showing any diffs.. weird.
2010-05-10 15:02:37 +00:00
008863daec Merge image related changes from the render branch. This includes the image
tile cache code in imbuf, but it is not hooked up to the render engine.


Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).

* Added a ImFileType struct with callbacks to make adding an file format type,
  or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
  a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
  editing the code directly.
* Functions removed that were only used for sequencer plugin API:
  IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
  IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
  IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
  line utility 'exrheader'

For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
2010-05-07 15:18:04 +00:00
9bd3f08b65 Multires: fix for "failed to read" error message with external displacements. 2010-05-07 09:48:40 +00:00
403c1e2a8e Todo #21831: Deform modifier is applied to base mesh instead of
multires modifier if both are in the stack (patch #21965)

This patch also removes limitation of multires reshaping when
destination object has got modifiers after multires modifier.
2010-04-13 06:06:49 +00:00
09b1c681e1 Sculpt Mode Bugfixes:
* #20833: layer brush doesn't work with multires.
* #20946: sculpt mode partially removes parts of the mesh in the viewport.
* #20420: grab brush stops after moving some distance.
* #20906: sculpt grab tool moves in wrong direction.
* #21132 and #21272: undo on object with subdivision surface modifier crashes.
* #21115: subsurf + multires + sculpting + undo causes crash.
* #20683: sculpt + multires apply + undo crash.
* #19094: wrong outline in solid mode.
2010-03-22 11:59:36 +00:00