Commit Graph

333 Commits

Author SHA1 Message Date
8695bedda2 svn merge ^/trunk/blender -r40644:40720 2011-10-06 16:59:58 +00:00
f65c72afaf Commented and tagged some unused vars, added some var init (gcc warnings...).
Won’t go further, most other warnings are from GE or intern/extern lib code...
2011-09-29 15:28:22 +00:00
9494340dae svn merge ^/trunk/blender -r40432:40491 2011-09-23 13:04:01 +00:00
86d528afa7 comment some unused vars / assignments. 2011-09-22 03:14:50 +00:00
ff7bde2a2f brought back some unused variables removed from previous commit, commented out, in case need their values later 2011-08-28 21:20:10 +00:00
fe98769877 Cleaned up unused variables 2011-08-25 16:47:47 +00:00
fd4575b2e3 svn merge -r39493:39664 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2011-08-24 02:29:45 +00:00
ba4fd78fac fix [#28344] for this file, the multires smiley has 2 materials, but only 1 loads 2011-08-23 11:46:16 +00:00
de92597967 fix for last merge 2011-07-29 02:15:01 +00:00
73dde4e26f svn merge -r38718:38804 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2011-07-29 02:03:53 +00:00
2dc826f083 New option for multires modifier: Subdivide UVs
Enabled by default and also enabled for older filesm so
there should be no regressions.

In some cases it's useful to not use subdivided uvs for multires.
2011-07-28 11:16:10 +00:00
97d0846d2c svn merge -r37335:37500 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2011-07-24 13:03:48 +00:00
73a545b0d5 =bmesh=
Removed the DerivedMesh face iterators (they sucked).
This should make subsurf faster.  Also sped up multires
a bit (not sure if it's strictly correct, need to look
at it later).
2011-06-14 03:16:08 +00:00
f122a74b1e svn merge -r37078:37335 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2011-06-09 15:20:29 +00:00
15d0d3f41e replace log() calls with constants 2011-06-09 14:27:51 +00:00
a1c22262fe Bake from multires mesh
=======================

Added option to baked named "Bake From Multires" which is avaliable for
normals baking and displacement baking.

If this option is enabled, then no additional hi-res meshes and render
structures would be created . This saves plenty of memory and meshes
with millions of faces could be successfully baked in few minutes.

Baking happens from highest level against viewport subdivision level,
so workflow is following:
  - Set viewport level to level at which texture would be applied
    during final rendering.
  - Choose Displacement/Normals baking.
  - Enable "Bake From Multires" option.
  - You're ready to bake.

Displacement baker had aditional option named "Low Resolution Mesh".
This option is used to set if you want texture for realtime (games)
usage.

Internally it does the following:
  - If it's disabled, displacement is calculated from subdivided
    viewport level, so texture looks "smooth" (it's how default
    baked works).
  - If it's enabled, dispalcement is calculated against unsubdivided
    viewport levels. This leads to "scales". This isn;t useful for
    offline renders much, but very useful for creating game textures.

Special thanks to Morten Mikkelsen (aka sparky) for all mathematics
and other work he've done fr this patch!
2011-06-05 20:54:04 +00:00
211cd99cbc Fix #27539: Sculpt data is lost after editing base mesh
Face's totdisp was set to correct value, but memory hasn't been
allocated for disps. Handle this in multires_topology_changed(),
so the whole MDISPS layer wouldn't be totally re-allocated when
applying displacement.
2011-06-02 04:58:27 +00:00
88f4087a57 svn merge -r36725:36801 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2011-05-20 16:52:10 +00:00
ae0c552bd1 Fix crash when accessing mesh from python while a mesh with a subsurf modifier
is in editmode.
2011-05-19 11:24:56 +00:00
068c627013 remove unused vars 2011-05-13 13:17:30 +00:00
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