Commit Graph

1047 Commits

Author SHA1 Message Date
Sergey Sharybin
517870a4a1 CMake: Refactor external dependencies handling
This is a more correct fix to the issue Brecht was fixing in D6600.

While the fix in that patch worked fine for linking it broke ASAN
runtime under some circumstances.
For example, `make full debug developer` would compile, but trying
to start blender will cause assert failure in ASAN (related on check
that ASAN is not running already).

Top-level idea: leave it to CMake to keep track of dependency graph.

The root of the issue comes to the fact that target like "blender" is
configured to use a lot of static libraries coming from Blender sources
and to use external static libraries. There is nothing which ensures
order between blender's and external libraries. Only order of blender
libraries is guaranteed.

It was possible that due to a cycle or other circumstances some of
blender libraries would have been passed to linker after libraries
it uses, causing linker errors.

For example, this order will likely fail:

  libbf_blenfont.a libfreetype6.a libbf_blenfont.a

This change makes it so blender libraries are explicitly provided
their dependencies to an external libraries, which allows CMake to
ensure they are always linked against them.

General rule here: if bf_foo depends on an external library it is
to be provided to LIBS for bf_foo.
For example, if bf_blenkernel depends on opensubdiv then LIBS in
blenkernel's CMakeLists.txt is to include OPENSUBDIB_LIBRARIES.

The change is made based on searching for used include folders
such as OPENSUBDIV_INCLUDE_DIRS and adding corresponding libraries
to LIBS ion that CMakeLists.txt. Transitive dependencies are not
simplified by this approach, but I am not aware of any downside of
this: CMake should be smart enough to simplify them on its side.
And even if not, this shouldn't affect linking time.

Benefit of not relying on transitive dependencies is that build
system is more robust towards future changes. For example, if
bf_intern_opensubiv is no longer depends on OPENSUBDIV_LIBRARIES
and all such code is moved to bf_blenkernel this will not break
linking.

The not-so-trivial part is change to blender_add_lib (and its
version in Cycles). The complexity is caused by libraries being
provided as a single list argument which doesn't allow to use
different release and debug libraries on Windows. The idea is:

- Have every library prefixed as "optimized" or "debug" if
  separation is needed (non-prefixed libraries will be considered
  "generic").

- Loop through libraries passed to function and do simple parsing
  which will look for "optimized" and "debug" words and specify
  following library to corresponding category.

This isn't something particularly great. Alternative would be to
use target_link_libraries() directly, which sounds like more code
but which is more explicit and allows to have more flexibility
and control comparing to wrapper approach.

Tested the following configurations on Linux, macOS and Windows:

- make full debug developer
- make full release developer
- make lite debug developer
- make lite release developer

NOTE: Linux libraries needs to be compiled with D6641 applied,
otherwise, depending on configuration, it's possible to run into
duplicated zlib symbols error.

Differential Revision: https://developer.blender.org/D6642
2020-01-23 16:59:18 +01:00
Brecht Van Lommel
ccfe5bf215 Cleanup: remove redundant function 2020-01-20 13:27:19 +01:00
Brecht Van Lommel
6368343da9 Fix T73129: sculpt mode slow on mesh with fake user
We can't use the fast path when the mesh is used by mulitple objects and so
slower sculpting is expected then. But fake users should not affect this. This
also fixes the same type of error in a few other areas.
2020-01-20 09:39:54 +01:00
Campbell Barton
23940ff1e1 Cleanup: conform header guards to Blender's style 2019-12-17 11:42:19 +11:00
Campbell Barton
00e9241d49 Cleanup: header guards 2019-12-10 11:06:38 +11:00
Gaia Clary
0281411b48 fix T69772 Collada importer creates wrong fcurves for skeletal animation 2019-11-27 11:18:38 +01:00
Gaia Clary
fc1a073bcd refactor: collada importer: calculate fcurve index only once when creating an fcurve 2019-11-27 10:50:24 +01:00
Gaia Clary
0a3f0e64c9 fix: T71718 Collada: importer does not release intermediate fcurves when importing matrix animations 2019-11-25 21:19:25 +01:00
Campbell Barton
249f4423ee Cleanup: doxygen comments
Also correct some outdated symbol references,
add missing 'name' commands.
2019-11-25 01:51:11 +11:00
Campbell Barton
047c66279a Cleanup: missing declaration warnings 2019-10-20 16:42:49 +11:00
Campbell Barton
fbc096cf07 Fix expanding paths ignoring data-block libraries
- Image views.
- Sequencer text strip font.
- Text check for modified/reload.
- Collada image export.
- Brush icons.
2019-10-04 07:03:53 +10:00
Alexander Gavrilov
aabd8701e9 Implement a user preference for the default Auto Handle Smoothing mode.
The default was changed with an initial implementation of the feature.

With the feedback from animators, having a behavior which affects curves
outside of a changing range is not convenient for professional animators
working on high quality character animation. On the other hand, automatic
smoothing is better for casual animation of object motion.

This change adds an ability to change the default via User Preferences.

Differential Revision: https://developer.blender.org/D5875
2019-10-02 20:42:37 +03:00
Sergey Sharybin
73a199e96a Depsgraph: Pass bmain to depsgraph object creation
Currently unused, but will allow to keep of an owner of the depsgraph.

Could also simplify other APIs in the future by avoiding to pass bmain
explicitly to relation update functions and things like that.
2019-09-11 10:43:27 +02:00
Campbell Barton
fd05f01be6 Partially revert "Cleanup: use post increment/decrement"
This partially reverts commit 0b2d1badec

Post increment can deep-copy for C++ iterators, while in my own checks
GCC was able to optimize this to get the same output,
better follow C++ best practice and use pre-increment for iterators.
2019-09-08 04:08:10 +10:00
Campbell Barton
0b2d1badec Cleanup: use post increment/decrement
When the result isn't used, prefer post increment/decrement
(already used nearly everywhere in Blender).
2019-09-08 00:23:25 +10:00
Campbell Barton
9821dd72ba Cleanup: rename natural string comparison 2019-08-31 17:32:30 +10:00
Gaia Clary
de0fc96dfe cleanup: collada: removed unused public class variable 2019-08-25 19:38:12 +02:00
Gaia Clary
2f1604cef7 fix: Removed Debug statement from Collada CMakeLists. cmake now silently determines which collada library version it uses 2019-08-25 19:38:12 +02:00
Campbell Barton
6eadd40597 Cleanup: redundant struct declarations 2019-08-25 16:45:47 +10:00
Campbell Barton
03b2371387 Cleanup: move trailing comments to avoid wrapping code
Some statements were split across multiple lines because of their
trailing comments.

In most cases it's clearer to put the comments above.
2019-08-14 23:32:24 +10:00
Campbell Barton
58a2b2dd7e Cleanup: spelling 2019-08-02 12:05:13 +10:00
Campbell Barton
760dbd1cbf Cleanup: misc spelling fixes
T68035 by @luzpaz
2019-08-01 14:02:41 +10:00
Brecht Van Lommel
604fdb6e85 Spelling fixes in comments and descriptions, patch by luzpaz
Differential Revision: https://developer.blender.org/D3744
2019-07-31 14:27:35 +02:00
Gaia Clary
361d578f9d fix: unreported: Collada using incompatible Enumeration types for compare 2019-07-23 15:09:02 +02:00
Gaia Clary
8c61837150 Incompatible usage of the Collada transparency value
Some external tools seem to have issues with the definition
of Collada <transparency> - a float value in range (0,1).
However it is possible to use the <transparent> color as a container
for the <transparency> value. This seems to be a more reliable
method to export transparency values from Blender PBSDF Shaders.

The relevant documentation is in the collada 1.14 reference manual,
page 7-5 about the usage of transparent and transparency.

This fix makes export and import of the <transparency>
and <transparent> values more convenient and more reliable.

Reviewers: brecht, jesterking

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5305
2019-07-22 19:03:56 +02:00
Gaia Clary
dd3e3474ab fix T66899: Collada: Shininess/Reflectivity not handled correct
Fixed: The Collada Exporter only supports export of
Lambert Shaders. But Shininess is not supported with
Lambert Shaders. The exporter must not add Shininess
to the Shader data!

Fixed: The Collada Importer adds an illegal value of -1
for reflectivity when this parameters is not defined in
the imported collada data. Now reflectivity is only
set when the import data contains a valid value.

Discarded: The Collada Importer handles shininess in a
dubious way. I have discarded import for now.
This needs to be reworked carefully in 2.81.

Differential Revision: https://developer.blender.org/D5262
2019-07-16 13:28:40 +02:00
Campbell Barton
cd6b49f995 Cleanup: spelling 2019-07-07 15:38:41 +10:00
Campbell Barton
163996b681 Cleanup: move comments onto own lines to avoid breaking lines 2019-07-02 22:17:22 +10:00
Campbell Barton
a1ef2e4b16 Cleanup: comment, RNA spelling 2019-06-17 12:52:20 +10:00
Campbell Barton
e85635b882 Cleanup: comment spelling 2019-06-17 08:05:58 +10:00
Gaia Clary
4419dd3bfd fix T65576 collada exporter duplicates node tree when exported material already uses nodes 2019-06-11 13:56:43 +02:00
Gaia Clary
94e6526ed0 fix T65480: Collada exporter did not export image texture for Base Color 2019-06-05 21:15:32 +02:00
Gaia Clary
eda377c223 update Collada Importer: reworked export and import of Materials
- added import of transparency and emission into principled BSDF Shader
- added support for importing all default collada material parameters

  * diffuse
  * emission
  * index_of_refraction
  * shininess (mapped to BSDF Roughness)
  * reflectivity (mapped to BSDF Metallic)
  * transparency + transparent mapped to BSDF Alpha)
  * ambient (creates unconnected texture node)
  * specular (creates unconnected texture node)
  * reflective(creates unconnected texture node)

- added support for exporting collada material parameters:

  * diffuse
  * emission
  * index_of_refraction
  * shininess (mapped to BSDF Roughness)
  * reflectivity (mapped to BSDF Metallic)
  * transparency + transparent mapped to BSDF Alpha)

- prepared support for exporting the following parameters
  but currently commented out:

  * ambient (creates unconnected texture node)
  * specular (creates unconnected texture node)
  * reflective(creates unconnected texture node)

  Problem: For now we only allow export of principled BSDF based
  materials. I am not sure from where to get ambient, specular
  and reflective as those values are not included in the
  principled BSDF Shader (wip).
2019-06-05 12:42:54 +02:00
Campbell Barton
0dbd05ffdd Cleanup: Cleanup: style, use braces for collada (BCMath) 2019-06-04 11:14:59 +10:00
Campbell Barton
c13e10a740 Cleanup: clang-format, remove tabs 2019-06-04 10:52:20 +10:00
Gaia Clary
97e53d2385 fix collada: get Alpha and Emission from principled BSDF Shader 2019-06-03 16:35:01 +02:00
Campbell Barton
e3f2034e7b Cleanup: Cleanup: style, use braces for collada 2019-06-04 00:18:35 +10:00
Gaia Clary
19dcb22a88 fix collada Importer: Set bone transformation type when importing unskinned skeleton 2019-06-02 23:33:22 +02:00
Gaia Clary
b7bd8d813f feature collada: Allow export/import of skeletal animations as curves 2019-06-02 23:00:57 +02:00
Gaia Clary
0731b88ddb refactor collada: Added utility functions bc_string_before() and bc_string_after() 2019-06-02 23:00:57 +02:00
Gaia Clary
820e4d4303 fix T34062 Collada exporter: changed order of export for decomposed transformation.
1.) The Blender order of applying transforms is:

 Scale
 Rotation
 Transformation

Reasoning: This order ensures there is no shearing, which happens
when you do scaling after rotation, see also:

https://blender.stackexchange.com/questions/1806

The Collada exporter now exports in the order how the transforms
need to be applied upon import.

2.) Also removed obsolete #if 0 lines
2019-06-02 23:00:57 +02:00
Gaia Clary
0bcf29b8cd refactor: use Quat and BCQuat instead of float[4] arrays for Quaternions (wip) 2019-06-02 23:00:57 +02:00
Gaia Clary
d04622e427 fix: enforce transform export as <matrix> when exporting animated armature"
Currently we can not export Decompsed Transforms in combination with
Armature asnimations. As a temporary workaround enforce export
of transformations as Matrix for armature objects.
2019-06-02 23:00:57 +02:00
Gaia Clary
b646da8d85 fix: add back changes after last pull from master 2019-06-02 23:00:56 +02:00
Gaia Clary
122b9478c6 refactor collada: replace bc_sanitize_mat() by static class method in BCMatrix 2019-06-02 23:00:56 +02:00
Gaia Clary
70bc179c45 refactor Collada: rename BCMatrix.* class files to BCMath.* 2019-06-02 23:00:56 +02:00
Gaia Clary
e17990bab7 refactor Collada: Add new class Quat (wip) 2019-06-02 23:00:56 +02:00
Gaia Clary
692edf4301 refactor collada: Moved BCMatrix to its own file 2019-06-02 23:00:56 +02:00
Gaia Clary
345304058f refactor collada: Moved basic typedefs in own file 2019-06-02 23:00:56 +02:00
Gaia Clary
a591424268 refactor collada: reorganize class methods in file 2019-06-02 23:00:55 +02:00