Commit Graph

64991 Commits

Author SHA1 Message Date
Bastien Montagne
406309cd8c Refactor/enhance ntreeMakeLocal().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
Bastien Montagne
ad5918d278 Refactor/enhance BKE_image_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
Bastien Montagne
f35320bddf Refactor/enhance BKE_material_make_local() and BKE_image_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
Bastien Montagne
8932b5945e Refactor/enhance BKE_lamp_make_local() and BKE_camera_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
Bastien Montagne
0f0eeffece Refactor/enhance BKE_brush_make_local() and BKE_speaker_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
Bastien Montagne
c8c00636bf Refactor/enhance BKE_particlesettings_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
Lukas Stockner
bb8bfdd4b6 Cycles: Fix failed assert with isotropic Ashikhmin-Shirley distribution in the Glossy node
The shader sync code used the anisotropic version of the Ashikhmin-Shirley closure for both
Anisotropic and Glossy BSDF, which caused a failed assert because the anisotropic closure
expects an addiitonal SVM node.
2016-07-10 16:41:21 +02:00
Campbell Barton
e0c163661d Add missing braces 2016-07-11 08:45:16 +10:00
Philipp Oeser
885870be51 Fix T48815: Translate node's 'Relative' checkbox has the same tooltip as blur node's 'Relative' checkbox.
Differential Revision: https://developer.blender.org/D2099
2016-07-10 14:57:31 +02:00
Bastien Montagne
87b974caa1 Cleanup/Refactor: pass Main pointer to all ID copy functions.
Also allows us to get rid of a few _copy_ex() versions...
2016-07-10 14:52:00 +02:00
Bastien Montagne
ae2033aca2 Add BKE_key_copy_ex() that takes a Main as parameter. 2016-07-09 15:44:12 +02:00
Bastien Montagne
429394078b Refactor/enhance BKE_lattice_make_local(), and add BKE_lattice_copy_ex() that takes a Main as parameter.
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-09 15:44:12 +02:00
Bastien Montagne
338121e2a0 Refactor/enhance BKE_mball_make_local(), and add BKE_mball_copy_ex() that takes a Main as parameter.
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-09 15:44:12 +02:00
Bastien Montagne
11f64f494b Refactor/enhance BKE_curve_make_local(), and add BKE_curve_copy_ex() that takes a Main as parameter.
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-09 15:44:12 +02:00
Bastien Montagne
9044ccec5f Cleanup to shapekeys' make_local (and copy) functions.
Mostly pass bmain and do not check for NULL key, keys' make_local is
suspiciously simple in fact, but think until those behave like real
full-featured IDs, it's doing enough!
2016-07-09 15:44:12 +02:00
Bastien Montagne
8bb7a339f7 Minor fix/cleanup to object's make_local. 2016-07-09 15:44:12 +02:00
Joshua Leung
1b45c52734 Fix: Apply Scale to Delta Scale was doubling the effect 2016-07-09 12:00:28 +12:00
Joshua Leung
245f97d7dc Clear Transforms and Deltas
* Alt-G, Alt-R, Alt-S  --> These don't clear delta transforms by default anymore,
  making it possible to use these to properly store a "rest" pose

* Alt-Shift-G, Alt-Shift-R, Alt-Shift-S  --> These WILL clear both the normal
  transform and the delta, should you need to do so.
2016-07-09 12:00:28 +12:00
Bastien Montagne
8662f583da Fix (unreported) broken shapekeys after 'make_local' of datablocks used both directly and directly.
At first thought it was own recent work, but think issue is there since ages actually...

Basically, id_make_local() would always localize mesh/curve/lattice shapekeys, even in case
obdata localization actually made a local copy instead of localizing original datablock.

This was causing shapekeys being localized twice, and other odd nasty effects.
2016-07-08 19:53:57 +02:00
Bastien Montagne
282de867d4 Initial fix for proxy issues regarding new libquery/libremap ID handling code.
libquery now passes an extra flag info to the callback, in case that specific
ID usage is considered as indirect.

In most cases, it's just set from ID_IS_LINKED_DATABLOCK() result on datablock owner,
but in proxy object case we also consider ob->data, materials and pose usages as indirect.

Does not fixes all issues yet, but should already make behavior with proxy object saner.
2016-07-08 19:33:22 +02:00
Bastien Montagne
77680abaf9 Refactor/enhance BKE_mesh_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).

Note: this enlightened broken case of proxy objects regarding make_local
(and also whole remapping, in fact). Will be fixed in near future.
2016-07-08 18:19:34 +02:00
Bastien Montagne
db79537dbc Fix own very stupid mistake in BKE_library_idtype_can_use_idtype() usage (inverted arguments). 2016-07-08 18:11:20 +02:00
Bastien Montagne
f34fc60aa4 Libquery: fix missing image pointers from Mesh's UV layers.
Not really happy with this, could lead to a **lot** of callback executions...
But libquery foreach looper must go over **all** ID pointers,
otherwise remapping & co is broken!

A possible fix for future would be to have 'image slots' defined at root of poly/facetex layers,
and just a (short) index in each face/poly item - would also save a reasonable amount of memory...
2016-07-08 18:11:20 +02:00
Bastien Montagne
d1a4ae3f39 Refactor/enhance BKE_object_make_local().
Now using modern features from libquery/libremap areas.

Also, it should handle much better cases where localized ID was also indirectly used by non-refcounting users
(typical case: object used as modifier/constraint/whatever target from another linked object, previous
code would not take those into account and just localize original object instead of making a local copy.
Would result in local object used by linked one, which would be partially 'undone' on next file reload... Crappy behavior).

And it fixes some obvious errors too (nullifying all proxy pointers unconditionnaly,
some missing refcounted usages cases in extern_local_object(), etc.).
2016-07-08 18:11:20 +02:00
Bastien Montagne
f3fe1f9c44 Refactor: pass Main to id_make_local.
Totally stupid to not pass it, and then let (some) BKE_foo_make_local() use G.main!

Note: unused for now, much more refactoring still to come in make_local area!
2016-07-08 18:11:20 +02:00
Bastien Montagne
cf19055236 Fix (unreported) missing special updates in case we are remapping obdata (mesh/curve/metaball at least). 2016-07-08 18:11:20 +02:00
Bastien Montagne
ab993e373c Rework/split test_object_materials().
Now test_object_materials only handles one object. New test_all_objects_materials
checks the whole bmain->object list for cases where it is actually needed.

Should avoid some useless looping over all objects!
2016-07-08 18:11:20 +02:00
Bastien Montagne
71f5df9f44 Refactor remapping's pre/post process of special cases.
Main issue was that BKE_libblock_relink_ex was pretty much ignoring all those...
Also, unlinking of objects was not handling correctly indirect-related flags.

Refactored code into helper functions to avoid too much duplicated code.
2016-07-08 18:11:20 +02:00
Sergey Sharybin
3b7bce42d7 Fix T48799: Particles set as objects cast wrong ray shadows in BI 2016-07-08 18:10:47 +02:00
Campbell Barton
8bb69b6157 BMesh: add decimate edit-mode tool
Support applying decimate to the mesh selection.
2016-07-08 23:38:52 +10:00
Campbell Barton
c206b7cbb6 Correct error in non-uniform scale IK commit
Rename arg to avoid confusion
2016-07-08 21:13:19 +10:00
Sergey Sharybin
a62967787c Fix T48808: Regression: Cycles OpenCL broken after Hair BVH commit 2016-07-08 09:41:36 +02:00
Campbell Barton
d5d26338b5 Mesh/Curve Join: remove edit-mode toggle
Toggling edit-node after joining objects is redundant as far as I can see -
(dates back to first revision).

Also caused all edges to be drawn w/ meshes, redundant undo step w/ curves.
2016-07-08 16:52:10 +10:00
Campbell Barton
83fe139b2b Undo: use system memcmp
`my_memcmp` didn't work properly comparing memory sizes not aligned to 4 bytes,
this worked while we used guarded-alloc (which always wrote a guard at the end of each allocation).
Since moving to lockfree allocator it could read uninitialized memory.

It also consistently performed ~10-30% worse then glibc's.
This is typically well optimized, no need to do ourselves.
2016-07-08 15:54:34 +10:00
Campbell Barton
dda96e3472 Fix T48807: Each stroke halves brush size
Missed from c5b2f12b
2016-07-08 14:51:12 +10:00
Campbell Barton
a02915c0f3 writefile: optimize undo memory use
Slop-space on Linux wasted ~20% of memory for undo storage.
2016-07-08 14:36:55 +10:00
Campbell Barton
a92fc348f4 Fix/Workaround non-uniform scaled bones failing w/ IK solver
Scaling a bone on the Y axis (for a stretch effect), wasn't supported by the IK solver.

Support this by solving as uniform scaled bones by matching the X,Z axis to the Y.

Requested by @pepeland, see D2088 for details.
2016-07-08 10:28:07 +10:00
Campbell Barton
7a3ea87bbf Cleanup: use normalize_v#_length 2016-07-08 10:14:49 +10:00
Campbell Barton
6035cf05bf BLI_math: add normalize functions which fit to a length
Convenient since its common to normalize then scale,
since these are inlined, use for regular normalize w/ 1.0 length.
2016-07-08 09:52:29 +10:00
Campbell Barton
30d951ce34 Cleanup: spelling 2016-07-08 09:49:01 +10:00
Bastien Montagne
3fb2c1e4a2 Make use of new 'idtype can use idtype' check (in ID usages code, and ID remapping one too).
Reduces calls to BKE_library_foreach_ID_link() from 312 to 105 when relocating a library in a
rather simple lib reload test...
2016-07-07 21:21:33 +02:00
Bastien Montagne
e2d469f878 libquery: add new 'BKE_library_idtype_can_use_idtype()' helper.
This should allow us to avoid a lot of useless processing when iterating over the
whole main database (unlink/remap/usages checks/etc.).

Note that some ID types report they can use any type for now, due to
fuzzyness/indefined nature of some usages (like constraints/modifiers/game logic,
or ID pointer of nodes...). Maybe we could address this (like e.g. adding defines
in relevant headers to restrict ID types used by constraints, by modifiers, etc.).
But don’t think this is top priority for now.
2016-07-07 21:21:33 +02:00
Bastien Montagne
b651812721 Cleanup/fix animsys 'id_type_can_have_animdata()'.
This func now actually takes an ID type as argument, added new 'id_can_have_animdata()'
to check whether a datablock may be animated or not.
2016-07-07 21:21:33 +02:00
Bastien Montagne
25e3657970 Extend libquery checks to test wether an ID is used locally and/or indirectly. 2016-07-07 21:21:33 +02:00
Campbell Barton
f36741c2eb Fix T48793: Bilinear filter clamps at edge pixels 2016-07-08 02:14:54 +10:00
Campbell Barton
1bb145e023 Fix single threaded compositor define 2016-07-08 01:41:36 +10:00
Sergey Sharybin
4beae09bae Cycles: Enable unaligned BVH builder for scenes with hair
This commit enables new unaligned BVH builder and traversal for scenes
with hair. This happens automatically, no need of manual control over
this.

There are some possible optimization still to happen here and there,
but overall there's already nice speedup:

                      Master                 Hair BVH
  bunny.blend         8:06.54                 5:57.14
  victor.blend       16:07.44                15:37.35

Unfortunately, such more complexity is not really coming for free,
so there's some downsides, but those are within acceptable range:

                      Master                Hair BVH
  classroom.blend     5:31.79                5:35.11
  barcelona.blend     4:38.58                4:44.51

Memory usage is also somewhat bigger for hairy scenes, but speed
benefit pays well for that. Additionally as was mentioned in one
of previous commits we can add an option to disable hair BVH and
have similar render time but have memory saving.

Reviewers: brecht, dingto, lukasstockner97, juicyfruit, maiself

Differential Revision: https://developer.blender.org/D2086
2016-07-07 17:25:48 +02:00
Sergey Sharybin
a08e2179f1 Cycles: Implement unaligned nodes BVH traversal
This commit implements traversal of unaligned BVH nodes.

QBVH traversal is fully SIMD optimized and calculates orientation
for all 4 children at a time, regular BVH might probably be optimized
a bit more.
2016-07-07 17:25:48 +02:00
Sergey Sharybin
b03e66e75f Cycles: Implement unaligned nodes BVH builder
This is a special builder type which is allowed to orient nodes to
strands direction, hence minimizing their surface area in comparison
with axis-aligned nodes. Such nodes are much more efficient for hair
rendering.

Implementation of BVH builder is based on Embree, and generally idea
there is to calculate axis-aligned SAH and oriented SAH and if SAH
of oriented node is smaller than axis-aligned SAH we create unaligned
node.

We store both aligned and unaligned nodes in the same tree (which
seems to be different from what Embree is doing) so we don't have
any any extra calculations needed to set up hair ray for BVH
traversal, hence avoiding any possible negative effect of this new
BVH nodes type.

This new builder is currently not in use, still need to make BVH
traversal code aware of unaligned nodes.
2016-07-07 17:25:48 +02:00
Sergey Sharybin
1a2012145d Cycles: Switch node address to absolute values in BVH tree
This seems to be straightforward way to support heterogeneous nodes
in the same tree.

There is some penalty related on 4gig limit of the address space now,
but here's are the thing:

Traversal code was already using ints to store final offset, so
there can't be regressions really.

This is a required commit to make it possible to encode both aligned
and unaligned nodes in the same array. Also, in the future we can use
this to get rid of __leaf_nodes array (which is a bit tricky to do since
trickery in pack_instances().
2016-07-07 17:25:48 +02:00