Commit Graph

52 Commits

Author SHA1 Message Date
64c8d72ef1 Modifiers: Use object passed to evaluation
This was wrong and violating design to force modifiers to query
evaluated objects and IDs. It is up to the caller to make sure
the object is properly evaluatable.

Effectively, reverting changes from de491abf99 (and possibly
other related changes).
2019-04-01 14:43:45 +02:00
e31f0fad97 Cleanup: order of modifiers' headers includes.
BLI should always comes first, before DNA, BKE etc. And
`BLI_utildefines.h` should come before any other BLI (since it's some
sort of system include really, among other things...).

Thisi should help to reduce the noise in patches when adding stuff
like uint64_t members to DNA structs... ;)
2019-02-25 11:39:14 +01:00
de13d0a80c doxygen: add newline after \file
While \file doesn't need an argument, it can't have another doxy
command after it.
2019-02-18 08:22:12 +11:00
eef4077f18 Cleanup: remove redundant doxygen \file argument
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
2019-02-06 15:45:22 +11:00
65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
de491abf99 Fix modifiers evaluation outside of depsgraph/CoW context.
Fix T58237: Exporters: Curve Modifier not applied when "apply modifiers" are selected.
Fix T58856: Python: "to_mesh" broken in 2.8.

...And many other cases... ;)

Thing is, we need target IDs to always be evaluated ones (at least I
cannot see any case where having orig ones is desired effect here).
Depsgraph/Cow system ensures us that when modifiers are evaluated by it,
but they can also be called outside of this context, e.g. when doing
binding, or object conversion...

So we need to ensure in modifiers code that we actually are always
working with eval data for those targets.

Note that I did not touch to physics modifiers, those are a bit touchy
and rather not 'fix' something there until proven broken!
2018-12-07 18:55:08 +01:00
0c94528829 Cleanup: naming in MOD_utils. 2018-06-29 19:02:19 +02:00
4a2213dc9a Fix modifiers not using depsgraph time for texture evaluation.
Texture animation seems to be broken anyway currently, but at leat
modifier side it should now be OK.
2018-05-23 15:55:13 +02:00
4dc91ebf81 Merge branch 'master' into blender2.8 2018-05-12 08:22:03 +02:00
c84b8d4801 Cleanup: modifier arg wrapping 2018-05-12 08:04:56 +02:00
0cd3412d4c Mod_util: Add back vcos parameter to get_texture_coords_mesh().
Now we use vcos when provided, and fall back to mesh vertices' co
otherwise.

Deform modifiers usually do not have up-to-date coordinates in Mesh
itself, only in given vcos array!
2018-05-08 12:01:06 +02:00
3800be695b Modifier stack: move vgroup editing modifiers to new Mesh-based system.
Some notes here:
* Proximity with non-mesh objects (like curve, see TEST_2 scene in
weightvg testfile) are not working currently. This is known TODO of COW
depsgraph project.
* Proximity modifier is slower, due to some other TODO pending on
BVHTree creation/caching for Mesh.
2018-05-07 18:18:05 +02:00
e04d7c49dc Fix buffer overflow vulnerabilities in mesh code.
Solves these security issues from T52924:
CVE-2017-12081
CVE-2017-12082
CVE-2017-12086
CVE-2017-12099
CVE-2017-12100
CVE-2017-12101
CVE-2017-12105

While the specific overflow issue may be fixed, loading the repro .blend
files may still crash because they are incomplete and corrupt. The way
they crash may be impossible to exploit, but this is difficult to prove.

Differential Revision: https://developer.blender.org/D3002
2018-01-18 00:54:07 +01:00
66dd9fbf22 Fix (unreported) broken MixWeight modifier in debug builds.
defvert_find_index() & co now assert when '-1' invalid vgroup index is passed.
We used to rely on NULL value returned in this case, but with the assert...

The assert completely stalls blender actually (repeated for every vertex!).
So much better to not call that func when vgroup index is invalid.
2015-07-20 16:55:46 +02:00
b7d053beaa Cleanup: warnings & space 2014-11-30 19:28:59 +01:00
915235c87a Cleanup: unused headers 2014-11-28 22:16:14 +01:00
00b29156e0 Defines: replace ELEM3-16 with ELEM(...), that can take varargs 2014-07-20 01:33:40 +10:00
7199e2288f Code cleanup: use sqrtf when input and output are float 2014-03-28 14:53:37 +11:00
d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
ce741bc223 Code cleanup: de-duplicate implementation of get_texture_value
Expect to be no functional changes :)
2013-10-20 13:01:07 +00:00
d5fae4409a Fix #36417: vertex weight mix modifier crash with texture mask and subsurf modifier
preceding it, was writing past end of array.
2013-08-08 20:35:19 +00:00
1dd7156c4c Fix #36058: Displace Modifier errors using a baked Image and displace baking inconsistency between 2.67/2.68RC and previous versions
This was in fact really nasty bug, caused by multitex_nodes
function using global variable R (which is a copy of current
renderer). this variable is not initialized to anything
meaningful for until first rendering (preview or final)
happened.

Since multitex_nodes might be used outside of render pipeline,
made it so whether CM is on or off as an argument to functions
multitex_ext_safe and multitex_ext. Now multitex_nodes() is
only shall be used for stuff happening from render pipeline!

Also needed to make some changes to other places, so all the
usages of texture sampling knows for the fact whether CM is
on or off.

And one more change is related on behavior of dispalcement,
wave, warp, weightvg modifiers and smoke. They'll be always
using CM off since texture is used for influence, not for
color.

It's rather bigger patch, but it's mostly straightforward
changes, which we really need to be done.

Reviewed by Brecht, thanks!
2013-07-15 14:47:58 +00:00
afb4b65167 Random number generator: replace a bunch of usage of the global random number
generator with a local one. It's not thread safe and will not give repeatable
results, so in most cases it should not be used.

Also fixes #34992 where the noise texture of a displacement modifier was not
properly random in opengl animation render, because the seed got reset to a
fixed value by an unrelated function while for final render it changed each
frame.
2013-04-15 23:12:40 +00:00
8bd7c3fba2 change curve evaluation functions never to modify curve data (ensures thread safety), now initializations has to be done outside evaluation. 2012-08-21 14:43:51 +00:00
63788b47d6 add vector versions of hsv_to_rgb, rgb_to_hsv & rgb_to_hsv_compat 2012-05-26 11:01:01 +00:00
3d8e58751c style cleanup: modifiers 2012-05-06 13:38:33 +00:00
b340f930ec style cleanup: changes to brace placement / newlines - for/while/if/switch 2012-04-28 06:31:57 +00:00
b56aabf815 style cleanup: multi-line if statements. 2012-04-21 15:11:03 +00:00
5eca59cf0d Fix #30882: using an image sequence in the displace modifier did not update
properly in animation rendering.
2012-04-10 14:11:45 +00:00
5a90ea77bc style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:24:53 +00:00
4f19c1a995 spelling cleanup 2012-03-18 07:38:51 +00:00
f6ae27daef style cleanup - comment spelling + translate some dutch. 2012-03-04 04:35:12 +00:00
ea13ec1699 Spelling Cleanup 2012-03-01 12:20:18 +00:00
51bada696f Longer names support for all ID and other object names
This commit extends limit of ID and objects to 64 (it means 63 meaning
characters and 1 for zero-terminator). CustomData layers names are also
extended.
Changed DNA structures and all places where length constants were hardcoded.

All names which are "generating" from ID block should be limited by MAX_ID_NAME-2,
all non-id names now has got own define called MAX_NAME which should be used all
over for non-id names to make further name migration stuff easier.

All name fields in DNA now have comment with constant which corresponds to
hardcoded numeric value which should make it easier to further update this
limits or even switch to non-hardcoded values in DNA.

Special thanks to Campbell who helped figuring out some issues and helped a lot
in finding all cases where hardcoded valued were still used in code.

Both of forwards and backwards compatibility is stored with blender versions newer
than January 5, 2011. Older versions had issue with placing null-terminator to
DNA strings on file load which will lead to some unpredictable behavior or even
crashes.
2012-01-11 08:51:06 +00:00
2b82498544 minor refactor of vertex group functions,
- defvert_remove_index's index wasnt used anywhere, rename to defvert_remove_group
- defvert_add_to_group was local in MOD_weightvg_util.c, moved to deform.c and renamed to defvert_add_index_notest

real fix coming next...
2011-12-08 03:47:45 +00:00
064d46eef0 use consistent naming for deform.c, also moved defvert_remove_index into deform.c, was local in modifier code. 2011-11-30 07:39:54 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
018fa1540e whitespace edits, make formatting for functions consustent at least within the file. 2011-09-28 05:53:40 +00:00
b6bf57e2b0 Minor: Added doxygen file's doc comments in weightvg modifiers. 2011-09-22 11:52:42 +00:00
2222f536f8 use replace 0 with NULL for pointers, set some functions static
also fixed own errors in recent static check commit.
2011-09-16 08:20:21 +00:00
2f50579d9a WeightVG utils, weightvg_update_vg func updates.
* Added an optional array of MDeformModifier pointers, to avoid another search based on defgrp_idx.
* Split out "add/remove verts from vgroup" functions, preparing their move to deform.c (if their current form is validated!).
2011-09-15 16:06:00 +00:00
ae7401751c SVN maintenance. 2011-09-09 00:46:00 +00:00
520778163d interface + naming improvements to vertex wright modifier
- WeightVG -> Vertex Weight
- mapping_mode -> falloff_type
- nicer layout for VertexWeightModifiers add/remove options
2011-09-07 07:46:26 +00:00
f6a64f4d79 SVN maintenance. 2011-09-07 07:06:43 +00:00
4393df9320 VGroup Modifiers: added mapping options to proximity and edit.
*Added Smooth/Sharp/Root/etc. mappings to WeightVGEdit modifier, in addition to custom curve one.
*Added Smooth/Sharp/Root/etc. mappings to WeightVGProximity modifier, without the custom curve one!
*Factorized the common mapping code into MOD_weightvg_util.
2011-09-05 16:16:00 +00:00
cc906e0e2a correct float -> double promotion warnings 2011-09-05 05:43:01 +00:00
e5209c2059 - vertex group modifiers isDisabled functions were incorrect, need to check if the string is set: == NULL will never be true.
- was doing NULL checks on freeing memory in cases where the values were already accessed (blender would have crashed anyway), so remove the NULL checks.
- use deform.c api weight functions to replace inline weight lookups in some cases.
- change if checks in weightvg_do_mask() so its more obvious whats going on.
2011-09-05 05:28:32 +00:00
5fd8ffd242 - mask_tex_map_obj --> mask_tex_map_object
- dont allow negative min distances
2011-09-05 03:26:49 +00:00
57411d1c5f minor edits.
- init proximity to 1.0f
- min/max proximity dist were not being copied.
- minor edits to comments - use ascii chars in a few places.
2011-09-05 03:09:49 +00:00
e2c24bac6c vgroup_modifiers: Now clamping output values to [0.0, 1.0] range (and added min/max mapping values for Prowimity modif). 2011-08-08 21:12:51 +00:00