Commit Graph

602 Commits

Author SHA1 Message Date
320aa33e65 rename MPoly vars called mface or mf, to avoid confusion with MFace types. 2012-04-03 23:40:24 +00:00
3c1b5b5632 stule cleanup: edits for files which were recently cleaned up. 2012-04-02 22:26:00 +00:00
b8a71efeba style cleanup: follow style guide for/with/if spacing 2012-03-24 07:52:14 +00:00
69e6894b15 style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:18:31 +00:00
3c11379e26 code cleanup: move bmesh inline funcs to headers (avoids compiling the C files). 2012-03-24 01:24:58 +00:00
7ff77ed4ea code cleanup: use zero_v3 2012-03-23 20:18:09 +00:00
9751653410 Renaming CD_WEIGHT_MCOL/MLOOPCOL and their masks from WEIGHT to PREVIEW, as this layer is now also used for various preview tasks in Object mode.
“Cleanup” commit, no functional changes.
2012-03-22 08:41:50 +00:00
deea1f38b1 real fix for booleans and face shading this time.
CDDM_tessfaces_to_faces wasbt updating the polyindex (missed incrementing the polyindex pointer).

also added an assert so non release builds will complain when CDDM_calc_edges_tessface() needs to run before CDDM_tessfaces_to_faces().
2012-03-20 01:33:24 +00:00
1362523ce6 CDDM_calc_edges_tessface was being called twice for boolean and explide modifiers, now leave it up to the caller to run. 2012-03-20 00:59:51 +00:00
53b7078343 Fix [#30234] Various problems with CD layers and tesselation, related to modifiers stack.
Should also fix [#30266], [#29451], and partly [#30316].

Here are the changes made by this commit:
* It adds a "dirty" flag to DerivedMesh struct (for now, only DM_DIRTY_TESS_CDLAYERS, but more might be added as needed).
* It adds a new func, DM_update_tessface_data, which assumes tessfaces themselves are valid, but updates tessellated customdata from their poly/loop counter parts.
* At end of modstack, when valid tessellated faces are present in finaldm , but the cdlayers dirty flag is set, call that function (instead of recomputing the whole tessellation).
* Edits to the codes concerned (UVProject, DynamicPaint, and Subsurf modifiers).
* Also add to subsurf dm generation code the creation of a CD_POLYINDEX layer (mandatory for DM_update_tessface_data to work well, and imho all tessellated dm should have one).

Note: some pieces of old code are just #if 0’ed, will clean them later.
2012-03-18 22:06:57 +00:00
4f19c1a995 spelling cleanup 2012-03-18 07:38:51 +00:00
e56f714000 ngons draw with uniform normals in object mode now, I had this code disabled for speed (it was being called when it didnt need to), but for CDDM meshes without face normal layers this should still be called. 2012-03-18 06:49:32 +00:00
91580c0929 swap BMLoopCol r/b color, requires subversion bump.
old mesh MCol 'r' was blue, 'b' was red, but theres no reason to keep this for bmesh with MLoopCol.

Loading old files works, saving legacy format works too.

What wont work is loading a file after this revision and loading it in an older revision since the bmesh merge.
(it wont crash but the blue and red will be swapped on vertex color layers).
2012-03-17 20:39:28 +00:00
1fc345cd32 Make grumpy gcc happy again! :p 2012-03-17 10:23:44 +00:00
3d87c23f4f Reduce poly map memory usage (used by sculpt smooth brush.)
Changed the create_vert_poly_map function to return a more compact
structure. Memory saved will vary depending on the mesh, but typically
it should be about one third of the old size.
2012-03-17 04:41:36 +00:00
38d4848020 Don't wait for sculpt stroke to create PBVH.
This idea is borrowed from the multires modifier, which already
checked if the object was in sculpt mode and, if so, created the
PBVH. That check is now moved higher up the chain into
mesh_build_data(), so that it occurs for CDDerivedMesh too.

This also replaces an assert in cdDM_getPBVH for tesselated mesh faces
with a call to create them if missing.
2012-03-14 06:30:55 +00:00
c21c58f44c style cleanup, also remove unused externs. 2012-03-11 19:09:01 +00:00
89a963fb7f style cleanup: comment blocks 2012-03-09 18:28:30 +00:00
640b0adb98 Code cleanup: use named values for options in DerivedMesh drawing.
The DMSetDrawOptions[Tex] callbacks return 0 (skip), 1 (draw), or 2
(either stipple or skip mcols.) In the CDDM, EDDM, and CCGDM draw
functions, as well as the callbacks in drawmesh/drawobject, replace
these numbers with values from an enum, DMDrawOptions.
2012-03-08 06:47:05 +00:00
e61339a76f code cleanup: duplicate checks and double assignments. 2012-03-08 04:38:35 +00:00
925f213427 Code cleanup: simplify the DerivedMesh.drawMappedFaces interface.
This function pointer's 'setDrawOptions' parameter took a slightly
different type than the other drawing callbacks. In particular, it
could set a 'drawSmooth' value to indicate that smoothing should
always be enabled, overriding the face flag. However, all callbacks
either did not set this value, or set it unconditionally to
1. Replaced this by adding a new 'flag' parameter to drawFacesMapped,
which can be set to DM_DRAW_ALWAYS_SMOOTH where appropriate.

Also removed the 'useColors' parameter and replaced it with another
flag value, DM_DRAW_USE_COLORS.

Removed the 'wpaint__setSolidDrawOptions' callback, was only being
used to set the shading to smooth.
2012-03-07 12:48:52 +00:00
71e5edeb6a Code cleanup: use typedefs for DerivedMesh drawing callbacks.
There are still fairly bewildering set of callbacks being tossed
around, but it's at least a little less verbose now.
2012-03-07 04:41:14 +00:00
919a0d99fb Code cleanup: remove some PBVH material code that isn't needed anymore. 2012-03-06 03:34:27 +00:00
c7ffe7f621 Draw individual face's material and shading correctly in the PBVH.
Previously, the shading and material was set once per PBVHNode when
drawing. This is still the case, but PBVHNodes are now built to
contain only one material and shading mode.

This is done with an extra partitioning step; once the number of
primitives in the node falls below the PBVH leaf limit, it's
primitives are checked for matching materials. If more than one
material or shading mode is present in the node, it is split and
partitioned (partitioned by material rather than 3D location.)

Given a sufficiently 'annoying' input, like a dense mesh with
thousands of materials randomly scattered across it, this could
greatly increase PBVH build time (since nodes might end up containing
a single primitive), but in general this shouldn't come up.

In order to support materials for grids, the CCGDM is building another
grid array (of DMFaceMat structs). This could be used to replace
CCGDM.faceFlag for some small memory savings (TODO).
2012-03-06 02:40:08 +00:00
e2003f9a6c Code cleanup: remove unused drawFacesColored from DerivedMesh.
This function pointer isn't called anymore, so removing it and the
cddm/ccgdm/gpu code associated with it.
2012-03-05 21:27:28 +00:00
7bbf4b7831 style cleanup
- spelling - turns out we had tessellation spelt wrong all over.
- use \directive for doxy (not @directive)
- remove BLI_sparsemap.h - was from bmesh merge IIRC but entire file commented and not used.
2012-03-02 16:05:54 +00:00
ea13ec1699 Spelling Cleanup 2012-03-01 12:20:18 +00:00
7cc206ddca Code Cleanup: remove non existing function declarations.
added some missing functions too - which are not used yep but should be there for api completeness.
* CDDM_set_mloop
* CDDM_set_mpoly
* BLI_mempool_count
2012-02-29 15:00:37 +00:00
79fbd39aab Remove DerivedMesh.getFaceMap and create_vert_face_map().
Not used anymore, both have BMesh replacements (DerivedMesh.getPolyMap
and create_vert_poly_map.)
2012-02-28 04:00:56 +00:00
47c373c7a9 style cleanup (mostly whitespace) 2012-02-27 10:35:39 +00:00
120297734b fix for emitting particles (needed tessfaces).
this fixes the cloud-gen addon.
2012-02-27 09:37:59 +00:00
6ca7d82932 code cleanup: white space, spelling & ';;' end of lines. 2012-02-25 16:04:03 +00:00
53fece44cf style cleanup for blenkernel, no functional changes. 2012-02-23 02:17:50 +00:00
a368e6771a - remove some unused editmesh functions.
- copy & rename EditMesh stricts for use with scanfill (remove unused members)
2012-02-19 22:17:30 +00:00
59d45d0ea6 * remove the MFace parts of join (we only need polygon data)
* other minor cleanups
2012-02-12 19:11:09 +00:00
b6dcdb065d code refactor, function renaming for bmesh.
These changes are to make the bmesh api more consistent and easier to learn, grouping similar functions which is convenient for autocomplete.
This uses similar convention to RNA. 

* use face/loop/edge/vert as a prefix for functions.
* use 'elem' as a prefix too for functions that can take any type with a BMHeader.
* changed from camel case to underscore separated (like RNA).
2012-02-12 10:51:45 +00:00
76ccd3d5ed Code Cleanup:
macro for copying polygon settings
2012-02-08 09:02:10 +00:00
f9a6cb15e8 fix for remesh (infact any modifier that uses tessface's) not displaying geometry in editmode.
the bug was in CDDM_from_BMEditMesh which would create tessfaces even when use_tessface==FALSE.
2012-02-07 03:03:09 +00:00
5f6395d69e Code cleanup for BMesh CDDM access functions, no functional changes.
Renamed CDDM_get_face() to CDDM_get_poly() to match array access
functions. Added function definitions for CDDM_get_loop() and
CDDM_get_poly().
2012-02-07 01:13:04 +00:00
191c160d50 fix [#30083] Sculpt not redrawing with plain mesh 2012-02-06 06:56:54 +00:00
baa843d0d3 Code Cleanup: use vector functions for copying / adding UV's 2012-02-05 13:25:42 +00:00
b0db9df701 fix for error in recent commit. passing totface rather then totpoly, also add asserts if PBVH attempts to build without any faces (but with polys). 2012-02-05 07:09:30 +00:00
776ec0ec61 add function for getting a polygon map: dm->getPolyMap(ob, dm).
polygon version of dm->getFaceMap(ob, dm)

sculpt uses this for checking connectivity.
2012-02-05 06:20:51 +00:00
db785d1656 fix for crash converting a curve into a mesh (Alt+C conversion), this would crash on entering editmode.
now curves convert to polygons directly, rather then faces, and polygons after.
2012-02-03 04:58:55 +00:00
2ea8a3b8ca remove CDDM_copy second argument, added CDDM_copy_from_tessface instead.
this function caused too many conflicts and in most cases was zero anyway.
2012-01-29 21:59:47 +00:00
a928a610e7 for CDDM's dmcalcNormals now call CDDM_calc_normals(), not CDDM_calc_normals_mapping(), this means calculating normals will calculate MPoly and MVert normals but not tesselate the mesh (which is overkill for normal calculation anyway).
use CDDM_calc_normals over CDDM_calc_normals_mapping for editmode and ensure the final dm has tessfaces.
2012-01-19 23:34:53 +00:00
1f84876e89 ensure defoem DM has tessface data for the few places that need it.
also add a workaround for CDDM_recalc_tesselation_ex() which would add a CD_NORMAL to dm->fdata and then overwrite immediate
2012-01-19 19:23:25 +00:00
bc745a32d3 argument to mesh_recalcTesselation to skip copying normals from polygons. 2012-01-19 17:51:52 +00:00
9d782c8a1a argument for CDDM_from_BMEditMesh() so creating tessface data is optional, no functional changes since all callers use this so far. 2012-01-18 15:09:27 +00:00
939c4171c4 fix for editmode bmesh bug - found by testing script.
incorrect flag handling in CDDM_from_BMEditMesh() broke editmode deform verts (they would never be copied), issue was exposed when re-aligning layer values with trunk.
2012-01-18 14:52:47 +00:00