Commit Graph

133 Commits

Author SHA1 Message Date
aab4f2b762 cleanup: redundant casts & const cast correctness 2015-01-01 23:42:28 +11:00
723f1e950b Fix T42486: Array modifier cap-end crash
Thanks to @PatB for the fix.
2014-11-10 09:55:25 +01:00
1dd428ff6d Fix T41983: Array Modifier "Merge" bug?
We messed up previous fix, in 'simplified' translated merge case... :(
2014-10-05 23:10:44 +02:00
8ac3c3d3ee Fix T42065: Shading issue using Array modifier
Gah... Dirty normal flag should be set on *real* final dm, after merge is done. :/
2014-10-04 12:54:00 +02:00
4c43fcf791 Fix T41983: Array regression with center-verts
Array with rotation and a central pivot would fail.

Thanks to Bastien Montagne for the initial fix.
2014-10-03 14:36:34 +02:00
398ca952ab Fix T41890: Regression in new array modifier code, vnors were no more offset-corrected.
This is not needed when we tag normals as dirty, but in simple cases, if offset has some
rotation (or non-uniform scaling) component, vertex normals has to be corrected.
2014-09-21 10:12:26 +02:00
cba2e0afa7 Fix T41630: Edge Split Modifier don't work anymore when a Array Modifier is after the Edge Split Modifier added.
Dirty normals flag has to be passed to new dm...
2014-08-29 18:07:54 +02:00
ab06ec7a24 Rewritten Array Modifier D443
Patch by PatB with own edits

- replace BMesh with CDDM functions.
- faster remove-vertex merging.
- extend CDDM_merge_verts to be more flexible.
2014-08-12 13:52:17 +10:00
8489b94e07 Math Lib: rename mul_serie_m3 to mul_m3_series & reorder args
Importantly, reversed mul_serie_m3 argument order (so it matches the m4 function)
2014-07-21 18:57:35 +10:00
7c7b7302d3 Math Lib: use variable length args for mul_serie_m3,m4 (instead of trailing NULL's) 2014-07-20 14:01:42 +10:00
4ca67869cc Code cleanup: remove unused includes
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
0b7f581397 Split Normals I (2/5): Add basic BMesh support of split normals.
* Merely a re-implementation of core split algorithm for BMesh, taking advantage of topological data available.
* This code needs valid loop indices, so added BM_LOOP support to BM_mesh_elem_index_ensure() & co.

Reviewers: campbellbarton

Reviewed By: campbellbarton

CC: brecht

Differential Revision: https://developer.blender.org/D366
2014-04-13 12:25:54 +02:00
27e86ed832 Code cleanup: use bools 2014-03-20 22:56:28 +11:00
1130c53cdb Fix T38755: Crash when having cyclic dependency and curve deform
Issue was caused by undefined object update order and in some
cases NULL pointer will be de-referenced.

Added on-demand curve path calculation, just the same creepy call
of BKE_displist_make_curveTypes(). This violates DAG and might
end up in a difficult to troubleshoot race condition if there'll
be some issues with how dependencies are calculated in DAG, but
this is the easiest and safest way to solve the bug at this stage,
2014-02-24 19:15:52 +06:00
a5c35fb27f Code cleanup: use booleans where appropriate 2014-01-28 04:00:04 +11:00
c37e8ecc50 Cleanup: int/short to bool in BKE_cdderivedmesh.h functions (and TRUE/FALSE to true/false in code using them). 2014-01-23 14:52:46 +01:00
ac077f016d Remove direct displist creation from array modifier
First of all, it was needed to have that set scenes fix which
was done recently so curve is being evaluated properly on file
load.

And last but not least, also needed to tag DAG node to evaluate
path regardless to curve datablock settings so curve length is
always known.
2014-01-13 15:57:51 +06:00
709041ed0b Threaded object update and EvaluationContext
Summary:
Made objects update happening from multiple threads. It is a task-based
scheduling system which uses current dependency graph for spawning new
tasks. This means threading happens on object level, but the system is
flexible enough for higher granularity.

Technical details:

- Uses task scheduler which was recently committed to trunk
  (that one which Brecht ported from Cycles).

- Added two utility functions to dependency graph:
  * DAG_threaded_update_begin, which is called to  initialize threaded
    objects update. It will also schedule root DAG node to the queue,
    hence starting evaluation process.

    Initialization will calculate how much parents are to be evaluation
    before current DAG node can be scheduled. This value is used by task
    threads for faster detecting which nodes might be scheduled.

  * DAG_threaded_update_handle_node_updated which is  called from task
    thread function when node was fully handled.

	This function decreases num_pending_parents of node children and
	schedules children with zero valency.

    As it might have become clear, task thread receives DAG nodes and
    decides which callback to call for it.

    Currently only BKE_object_handle_update is called for object nodes.

    In the future it'll call node->callback() from Ali's new DAG.

- This required adding some workarounds to the render pipeline.
  Mainly to stop using get_object_dm() from modifiers' apply callback.
  Such a call was only a workaround for dependency graph glitch when
  rendering scene with, say, boolean modifiers before displaying
  this scene.

  Such change moves workaround from one place to another, so overall
  hackentropy remains the same.

- Added paradigm of EvaluaitonContext. Currently it's more like just a
  more reliable replacement for G.is_rendering which fails in some
  circumstances.

  Future idea of this context is to also store all the local data needed
  for objects evaluation such as local time, Copy-on-Write data and so.

  There're two types of EvaluationContext:

  * Context used for viewport updated and owned by Main. In the future
    this context might be easily moved to Window or Screen to allo
    per-window/per-screen local time.

  * Context used by render engines to evaluate objects for render purposes.
    Render engine is an owner of this context.

  This context is passed to all object update routines.

Reviewers: brecht, campbellbarton

Reviewed By: brecht

CC: lukastoenne

Differential Revision: https://developer.blender.org/D94
2013-12-26 17:24:42 +06:00
c1c26c36f6 Style Cleanup: remove preprocessor indentation (updated wiki style guide too) 2013-12-22 14:12:19 +11:00
158b4e61a0 Mesh Modifiers: refactor copying using a generic function 2013-12-22 04:37:26 +11:00
cee7fbdfaa Fix T37413 - Fit-Curve option for Array Modifier ignores constraint results
Unless I'm missing something here (probably with regards to parenting),
it makes more sense that constraint results are considered here as well
(for example, if Limit Scale constraints get applied on the object),
as this allows for greater flexibility when creating setups with this.
2013-11-18 14:02:49 +13:00
9467d99405 replace sqrt(dot()) with length functions. 2013-09-03 22:32:03 +00:00
54310b8086 bmesh: internal api change, remove BMOElemMapping, its not needed since the values can be stored in the ghash directly.
saves 24 bytes per element (per vertex/edge/face on a 64bit system), for bmesh operators.
2013-09-02 03:13:51 +00:00
75383a79f6 array modifier was adding vertices to the 'targetmap' multiple times.
this is supported by weldop but would prefer not to allow multiple keys in the map.
2013-08-27 23:32:11 +00:00
527ddb0a5b Move bevel list and path from Curve to Object datablock
I know this is not so much nice to have this guys hanging
around in a general Object datablock and ideally they better
be wrapped around into a structure like DerivedMesh or
something like this. But this is pure runtime only stuff and
we could re-wrap them around later.

Main purpose of this is making curves more thread safe,
so no separate threads will ever start freeing the same path
or the same bevel list.

It also makes sense because path and bevel shall include
deformation coming from modifiers which are applying on
pre-tesselation point and different objects could have
different set of modifiers. This used to be really confusing
in the past and now data which depends on object is stored
in an object, making things clear for understanding even.

This doesn't make curve code fully thread-safe due to
pre-tesselation modifiers still modifies actual nurbs and
lock is still needed in makeDispListsCurveTypes, but this
change makes usage of paths safe for threading.

Once modifiers will stop modifying actual nurbs, curves
will be fully safe for threading.

Actually, this commit also contains wrapping runtime curve
members into own structure

This allows easier assignment on file loading, keeps curve-
specific runtime data grouped and saves couple of bytes in
Object for non-curve types.

--
svn merge -r57938:57939 ^/branches/soc-2013-depsgraph_mt
svn merge -r57957:57958^/branches/soc-2013-depsgraph_mt
2013-08-19 09:25:24 +00:00
dfad9b0c09 fix [#35555] Collada: export destroys mesh in some cases
add arguments to calculate normals when converting to bmesh:
  BM_mesh_bm_from_me, DM_to_bmesh

This gives some speedup to undo (which didnt need to re-calculate vertex normals), and array modifier which doesnt need to calculate face normals at all
2013-06-02 23:20:49 +00:00
075a910d72 fix regression in reducing normal recalculation [#35595],
pass the dirty-normal-state from the input dm to the output.
2013-06-02 00:20:26 +00:00
09e11ad6ef modifier stack: lazy initialize normals
many modifiers were calculating normals, when those normals were ignored by the next modifier.
now flag normals as dirty and recalculate for modifiers that set use `dependsOnNormals()` callback.

Quick test on mesh with 12 modifiers (mostly build type), calculated normals 6 times, now it only runs once - so this will give some speedup too.
2013-05-30 17:36:43 +00:00
ec8d277c64 BLI_math rename functions:
- mult_m4_m4m4 -> mul_m4_m4m4
- mult_m3_m3m4 -> mul_m3_m3m4

these temporary names were used to avoid problems when argument order was switched.
2013-05-26 18:36:25 +00:00
698f1b5603 Fix #35317: crash with boolean modifier using an object whose library linked
mesh datablock went missing.
2013-05-12 09:14:07 +00:00
4a4f091155 Fix #35174: dynamic paint displacement missing in render.
A previous bugfix disabled the dynamic paint modifier for orco texture
coordinate evaluation of the modifier stack. However the MOD_APPLY_USECACHE
flag is not a good way to check if the modifier is evaluated for orcos.

Instead I've added a MOD_APPLY_ORCO flag. Also removed a bunch of
applyModifierEM callbacks, none of them served a purpose except for the
subsurf modifier.
2013-05-02 14:42:05 +00:00
0d0291f6e1 code cleanup: incorrect sized array args, remove some redundant code. 2013-03-17 10:26:23 +00:00
3d64381e4d use more rigid type checking for bmesh slot subtypes. 2012-11-26 03:16:29 +00:00
3583686433 Fix #33264: Array MOD First Last option does nothing 2012-11-22 12:03:15 +00:00
ebaf1306b8 bmesh operator api:
avoid per vert/edge/face string lookups in BMO_slot_map_* functions --- used in array modifier, subdivide, remove doubles and other tools.
2012-11-20 13:29:27 +00:00
dbdc76c9d0 code cleanup: make bmesh operator names more consistant since python has access to these as input arguments and return values.
all output values currently have ".out" suffix, this may go in the future, but for now it makes it clear in C code what are inputs and outputs.
2012-11-20 05:50:19 +00:00
48639af5f8 use input and output slots for bmesh operators, needed for the python api to get return values. 2012-11-19 14:58:31 +00:00
a9af563526 bmesh: lazy initialize bmesh tool flag pool, has the advantage that modifiers that dont use bmesh operators can skip allocating it. 2012-11-18 12:14:22 +00:00
eb69d1c1ae style cleanup: also quiet harmless compiler warning. 2012-10-29 15:43:54 +00:00
2de2acc681 add CDDM_from_bmesh(), avoids using BMEditMesh in modifiers. 2012-10-24 07:24:11 +00:00
90d215535e add option so operators can be called with a flag, currently the only flag is to respect hidden geometry.
this is useful for bmesh tools that operate in object mode or for modifiers which would previously use hidden faces in some cases.
2012-07-21 00:58:02 +00:00
32cf7fcdb1 code cleanup: spelling 2012-07-16 23:23:33 +00:00
8b865c01cd style cleanup: comments 2012-06-30 22:49:33 +00:00
2932cded40 fix for own error renaming bmesh operator dupe 2012-06-30 21:19:12 +00:00
69a7e0af02 rename bmesh ops since they are exposed in an api now. 2012-06-30 15:27:13 +00:00
a18b303a76 Fix incorrectly deleted elements in array modifier caps.
Add check for merging vertices into vertices that are themselves
marked for merge, was already done for array eleements but not end
caps.

Fixes bug [#31695] Array Modifier: End Cap fails if all vertices are merged

Also corrected some reversed assert arguments.
2012-06-11 09:41:08 +00:00
318b44fe5d Refactor of modifiers' apply function: now use a single bit-flag parameter to pass options, instead of having one parameter per boolean flag (i.e. replaces current useRenderParams and isFinalCalc by a single ModifierApplyFlag flag. ModifierApplyFlag is an enum defined in BKE_modifier.h). This way we won't anymore have to edit all modifier files when e.g. adding a new control flag!
Should have no effect over modifier behavior.
2012-05-09 15:00:26 +00:00
d20c129a9c style cleanup: whitespace/operators 2012-05-09 09:24:15 +00:00
3ef11693f5 Style cleanup: displist module 2012-05-07 06:58:03 +00:00
3d8e58751c style cleanup: modifiers 2012-05-06 13:38:33 +00:00