1
1

Compare commits

...

592 Commits

Author SHA1 Message Date
abd2ee4a8d Attribute Compare: Use the most complex data type instead of the least 2020-12-10 09:31:42 -06:00
98b1e09d06 Optimize comparisons by squaring threshold first 2020-12-10 09:09:44 -06:00
4bdb67d5c0 Merge branch 'master' into geometry-nodes-point-separate-node 2020-12-10 08:55:44 -06:00
348bd319d5 Geometry Nodes: Attribute Fill Node
This commit adds a node that fills every element of an attribute
with the same value. Currently it supports float, vector, and color
attributes. An immediate use case is for "billboard" scattering.

Currently people are using the same input to a Random Attribute node's
min and max input to fill every element of a vector with the same value,
which is an unintuitive way to accomplish the same thing.

Differential Revision: https://developer.blender.org/D9790
2020-12-10 07:58:45 -06:00
efb741b280 Geometry Nodes: rename modifyPointCloud to modifyGeometrySet
Since the initial merge of the geometry nodes project, the modifyPointCloud
function already was already modifying a geometry set. The function wasn't
renamed back then, because then the merge would have touched many
more files.

Ref T83357.
2020-12-10 14:35:15 +01:00
2b9eb5eee5 Fix T83361: UV Editor does not draw pinned selected UVs as pinned
Caused by rB4212b6528af.

outlineColor is computed by the vertex shader, so not a uniform.
So outlineColor was undefined.

note: it was still possible to run into the situation that a selected UV
is drawn ontop of a selected pinned UV [you had to disable sticky
selection for this], now also make sure selected-pinned are drawn
topmost, then selected, then unselected UVs.

Maniphest Tasks: T83361

Differential Revision: https://developer.blender.org/D9786
2020-12-10 13:20:15 +01:00
e795ba1529 Geometry Nodes: fix recursive instance transforms
Previously, the transformation of recursive instances did not work as
on would expect. Second-level instances would detach from first-level
instances when the object was moved.
2020-12-10 10:23:54 +01:00
22959dc866 Fix missing custom-property escaping for whole-character keying set
Custom properties with characters that needed escaping
had f-curves created with invalid paths.
2020-12-10 19:31:22 +11:00
83f5a0b972 Fix missing string escaping in RNA_path_append
This was escaping the '[' character, which isn't needed for quoted text.
2020-12-10 17:57:59 +11:00
e21f1136c2 Tests: fix 'ctest -j' running multiple tests at once
bl_blendfile_io & bl_blendfile_liblink shared a filename,
which could make these tests fail.
2020-12-10 17:18:38 +11:00
2fbf9cb551 Cleanup: remove unused function bc_find_bonename_in_path 2020-12-10 17:10:19 +11:00
d97845a693 BLI_string: return NULL from BLI_str_quoted_substrN on failure
This was returning an empty allocated string, however almost
all callers checked if the return value was NULL before freeing,
making for misunderstandings on the intended use of this function.

BCAnimationSampler::initialize_curves for example detected the
f-curves animation type to 'bone' based on a non-NULL return value
which never failed.

Also fixes two leaks where the the result of BLI_str_quoted_substrN
wasn't freed.
2020-12-10 16:56:09 +11:00
3ec7cf64bc Fix BLI_str_quoted_substrN use with escaped strings
BLI_str_quoted_substrN didn't unescape the resulting string,
yet all callers were using this with animation paths which are
created using BLI_str_escape().

- Fix BLI_str_quoted_substrN use with escaped strings by calling
  BLI_str_unescape().

  Note that it's possible we want an a version of this function that
  keeps escape characters. This could be added if it's required.

- Fix end quote detection using BLI_str_escape_find_quote
  checking for `\"` isn't reliable since an even number of back-slashes
  before a quote means it's not escaped.
2020-12-10 16:12:25 +11:00
2814cdbd86 BLI_string: extract quote utility into BLI_str_escape_find_quote
Duplicate logic for this exists in BLI_str_quoted_substrN,
which doesn't properly support escaping.
2020-12-10 15:06:16 +11:00
aef9243ebb Cleanup: remove unnecessary vars in RNA token reading 2020-12-10 14:55:28 +11:00
ed2556e22c Cleanup: declare variables when used (RNA) 2020-12-10 14:55:28 +11:00
c5aaa11c3b Cleanup: declare variables when used (bpy) 2020-12-10 14:55:28 +11:00
51cbd5d91d Cleanup: avoid '_ln' suffix
Use '_len' or '_line_number'.
2020-12-10 14:55:28 +11:00
564ef8279b Cleanup: use snake-case instead of camel-case 2020-12-10 14:55:28 +11:00
b5bc9d80a1 PyAPI: add bpy.utils.unescape_identifier
Utility to perform the reverse of `bpy.utils.escape_identifier`
2020-12-10 14:40:01 +11:00
2f86518ac0 RNA: use BLI_str_unescape utility for parsing escaped strings 2020-12-10 14:40:01 +11:00
82e1b65d91 BLI_string: support escaping additional control character
Add support for escaping \a, \b & \f for completeness,
currently it's not required.
2020-12-10 14:40:01 +11:00
15d801625c BLI_string: add BLI_str_unescape utility function
Performs the reverse of BLI_str_escape.
This allows logic to be removed from RNA path handling.
2020-12-10 14:40:01 +11:00
7fc1d76037 Fix BLI_str_escape with control characters, add unit tests 2020-12-10 14:40:01 +11:00
65f139117d Cleanup: rename BLI_strescape to BLI_str_escape
Prepare for `BLI_str_unescape` which doesn't read well
without the separator.
2020-12-10 14:40:01 +11:00
548e9624d0 Fix T82852: Cycles crashes when editing a mesh with adaptive subdivision
The issue is caused by stale data on the Mesh Node which is not cleared
during synchronizing since the socket API refactor so that we can detect
changes. However, synchronization only updates the sockets of the Mesh,
so other properties were left with outdated values.

This caused an underflow when computing attribute size for undisplaced
coordinates as it was using the current number of vertices minus the
previous count of subdivision vertices, which at this point should be 0.

Added a simple method to clear non socket data. Also modified
Mesh.add_undisplaced to always use an ATTR_PRIM_GEOMETRY as the data is
not subdivided yet and it avoids any further issues regarding computing
attribute sizes.
2020-12-10 02:31:25 +01:00
b379f93484 Cleanup: Use const for filter queries 2020-12-09 23:43:01 +01:00
62953c2bf3 Geometry Nodes: Support equality operations with all data types
Testing equality of vectors can't be done properly if they are implicitly
converted to float before-hand. This adds a lot of boilerplate code to
the node, maybe that can made more elegant in the future, but it's not
so complicated anyway.
2020-12-09 16:42:23 -06:00
0e757da3b5 Geometry Nodes: Add a method to find the lowest complexity attribute
For the attribute comparison node, it makes sense to read both input
attributes implicitly converted to the same data type. But the choice
of which of the two data types to read with is somewhat arbitrary.
This commit adds a utility function to choose the least "complex" data
type as a lowest common denominator, to make that choice less arbitrary
, and to support other needs in the future.
2020-12-09 16:33:09 -06:00
200cbb6adf Geometry Nodes: Add utilities for getting an attribute's data type
With the previous helper function in this file you had to know the data
type you wanted for the input attribute before requesting it. This adds
another utility function for getting the data type without building the
attribute. The attribute's can be requested later after doing some
logic to figure out the right data type to read.

No functional changes in this commit.
2020-12-09 16:29:49 -06:00
d870a60dd9 Sculpt: Elastic deform type for Snake Hook
This adds deformation types to snake hook and the elastic deformation
type. This mode deforms the mesh using a kelvinlet instead of applying
the displacement directly inside the brush radius, which is great for
stylized shapes sketching.

Changes in rake rotation when using elastic are too strong when set
to 1, so I'll add a nicer way to support rake rotations with smoother
transitions in the future.

Reviewed By: sergey, JulienKaspar

Differential Revision: https://developer.blender.org/D9560
2020-12-09 22:25:16 +01:00
19560eef1a Cleanup: Remove unused c popup menu for text editor
This code hase been usused for 10 years and the right click menu is now 
in python.
2020-12-09 16:09:51 -05:00
3b57927651 Fix T82242: creating particle influence textures does not set up DEG
relation immediately

Texture and ParticleSettings have a DEG relation, but
`DEG_relations_tag_update` was not called when the texture changed.
This lead to no updates when e.g. texture size changes, relation only
went into full effect after save/reload or adding/removing keyframes.

Two places were additional relation tagging is needed:
- ParticleSettings `active_texture` changes
- ParticleSettingsTextureSlot (basically any TextureSlots') texture
changes

Maniphest Tasks: T82242

Differential Revision: https://developer.blender.org/D9393
2020-12-09 21:45:36 +01:00
ac7694aee0 UI: Update theme to match Shader nodes category color with socket color
The change to match socket color and category was already done, but it was missing
versioning code to update the theme on load.

Fixes T83500 (already closed as invalid, but this would solve the non-matching colors)

Reviewed by Hans Goudey (HooglyBoogly)
2020-12-09 21:09:37 +01:00
c61c9f61c6 Use new get_input_attribute abstraction 2020-12-09 10:29:29 -06:00
41bca5a3ee Fix T83581: "Only local" ambient occlusion option causes error on OptiX 2.92
The SVM AO node calls "scene_intersect_local" with a NULL pointer for the intersection
information, which caused a crash with OptiX since it was not checking for this case and
always dereferencing this pointer. This fixes that by checking whether any hit information
was requested first (like is done in the BVH2 intersection routines).
2020-12-09 17:06:28 +01:00
9acba6f716 Merge branch 'master' into geometry-nodes-point-separate-node 2020-12-09 09:53:17 -06:00
81fb9720fe Support meshes in addition to point clouds 2020-12-09 09:43:32 -06:00
c93f826661 Cleanup: various clang tidy fixes 2020-12-09 16:29:11 +01:00
4a5f36638b Geometry Nodes: simplify supporting different input socket types for attributes
This is a non-functional change. The functionality introduced in this commit
is not used in master yet. It is used by nodes that are being developed in
other branches though.
2020-12-09 16:20:57 +01:00
96feddd85f Use text for comparison RNA enum items 2020-12-09 09:00:24 -06:00
25e151cc34 Fix T83575: GPencil: VFX Blur is not disabled when samples are zero
Before the number of samples was not checked, only the pixel size.
2020-12-09 15:41:07 +01:00
043926bfd2 Merge branch 'master' into geometry-nodes-point-separate-node 2020-12-09 08:35:24 -06:00
37bf71ad04 Fix T83588: Crash with Shrink/Fatten and Offset Even
`t->keymap` can be `NULL`.

Bug introduced in rBc822f66bb83
2020-12-09 10:30:23 -03:00
Germano Cavalcante
b9eb592133 Fix T83460: Regression in snap for measure tool
Now the gizmo is drawn only when the eventstate located in
`wm->winactive->eventstate` has not changed.

So it doesn't matter if it's "selected" or not.

This commit also removes the use of the private header "wm.h"

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9539
2020-12-09 09:34:44 -03:00
5a8012b6a6 Degraded AMD 20.11.3 driver to limited support. 2020-12-09 12:37:20 +01:00
baf84ecbe4 Workaround for Access Violation startup crash on deprecated Radeon GPUs on Windows
This is a workaround for T80804.

There's a startup crash that happens on 2.91.0 on Windows, an `EXCEPTION_ACCESS_VIOLATION`
on `atio6axx.dll`. It is triggered by `glClear` on the `detect_mip_render_workaround`
function. The workaround moves the function after the device/driver workaround section and
sets the flag to the affected one to avoid running the check.

It is deprecated hardware that has not meet the minimum requirements since 2.79, but is
still usable and this extends its usability a bit before the cards are finally blacklisted.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D9667
2020-12-09 12:15:15 +01:00
1a959e9fa8 Raised AMD/Terascale2 from unsupported to supported.
There is a patch that fixes the crash on startup {D9667}.
2020-12-09 12:12:35 +01:00
55d14210cc Raised AMD CEDAR on Linux from unsupported to limited support
There is a workaround available by setting the environment variable `R600_DEBUG=nosb`.
2020-12-09 12:10:32 +01:00
3a23f18e02 Blender LTS: Download + Release notes CMS scripts
This patch contains 2 scripts that will help with LTS releases

create_download_urls.py

    This python script is used to generate the download urls which we can
    copy-paste directly into the CMS of www.blender.org.

    Usage: create_download_urls.py --version 2.83.7

    Arguments:
      --version VERSION  Version string in the form of {major}.{minor}.{build}
                         (eg 2.83.7)

    The resulting html will be printed to the console.

create_release_notes.py
=======================

    This python script is used to generate the release notes which we can
    copy-paste directly into the CMS of www.blender.org and stores.

    Usage: ./create_release_notes.py --task=T77348 --version=2.83.7

    Arguments:
      --version VERSION  Version string in the form of {major}.{minor}.{build}
                         (e.g. 2.83.7)
      --task TASK        Phabricator ticket that is contains the release notes
                         information (e.g. T77348)
      --format FORMAT    Format the result in `text`, `steam`, `wiki` or `html`

Requirements
============

* Python 3.8 or later
* Python phabricator client version 0.7.0
  https://pypi.org/project/phabricator/

For convenience the python modules can be installed using pip.

    pip3 install -r ./requirements.txt

Differential Revision: https://developer.blender.org/D9055
2020-12-09 09:14:53 +01:00
abddd7d5f9 Fix T83566: bpy.props.CollectionProperty gives incorrect error
Error in commit a7b3047cef.
2020-12-09 18:46:07 +11:00
ebe4bf6286 Fix another id-property name length check
Missed this in 6c9263d817
2020-12-09 17:33:11 +11:00
acc6373939 Fix custom-property UI allowing long names that raised errors
Rename `rna_property` to `rna_custom_property`
to differentiate it from a more general property.
2020-12-09 17:20:44 +11:00
6c9263d817 Fix off by one error in id-property name validation
The Python API accepted a name with 64 bytes, clipping it to 63.
2020-12-09 17:16:43 +11:00
3b5a81936d Fix custom property UI handling names with quotes and back-slashes
Custom property names wasn't escaping strings, causing exceptions
editing custom properties with characters that needed to be escaped.
2020-12-09 17:04:05 +11:00
9d8aefaa5c Fix RNA un-escaping multiple slashes and strings ending with a slash
Fix for T78823 resolved the issue reported but didn't
properly support multiple back-slashes.
2020-12-09 16:56:08 +11:00
ceba6b2c21 Fix T78823: Slash in custom property name does not work
This fixes inserting key-frames for any collection names
containing a back-slash too (bones, modifiers, sequence strips etc).
2020-12-09 16:04:21 +11:00
d1cedf53fa Revert "Fix T78823: Slash in custom property name does not work"
This reverts commit cbae82ba96.

This change introduced the following problems:

- We could no longer reliably duplicate or use an existing
  custom property names.
- We could no longer assume a bone or ID name
  can be used in a custom-property.
- Importers that support custom properties (such as FBX)
  could fail with an exception creating custom properties.
2020-12-09 15:29:28 +11:00
cdfe733e70 Cleanup: use doxy sections for graph_edit.c 2020-12-09 14:34:40 +11:00
9c5d67411a creator: remove reference to SDL_AUDIODRIVER from --help text
This was added when Linux's audio support
often needed to be manually configured.

Further 3rd party libraries have their own environment variables & docs
these need not be part of Blender's help message unless they're likely
to be needed to properly run Blender.
2020-12-09 14:15:24 +11:00
5cdfceaa1a Cleanup: use common 'MOD_WELD_MODE_' prefix 2020-12-09 14:10:30 +11:00
Henrik Dick
9b11a7776f Modifier: Add "Connected" mode to the weld modifier
Implement improvement from T73139 for merging along edges.
It is now called "Connected" mode, while the default is called "All".

With the recent performance improvement, the Connected Mode is in some
cases only double the speed than the usual merge all strategy but in
other cases it may be even faster. The bottleneck is somewhere further
down the line of merging geometry.

The motivation for this patch came from T80897, because the merging in
complex solidify is making it very slow.
Now merging can be removed from solidify without greater consequences,
as this is just a quicker and more advanced algorithm to do the same
thing that solidify currently does slowly.

Reviewed by: mano-wii, campbellbarton

Ref D8966
2020-12-09 12:29:48 +11:00
e17967f890 Fix T83559: File Browser uses wrong operation
When opening a temporary File Browser, we have to make sure the file selection
parameters are refreshed. When opening it in a new Window that would always be
the case, if the File Browser uses a maximized window (as set in the
Preferences), it might reuse space-data from a previous use. So we have to
force the refresh.
Also renamed the relevant function to be more clear about what it's doing.

Mistake in 95b3c4c966.
2020-12-08 21:23:55 +01:00
41fa1fea40 Removing ISC license
Blender actually uses the ICS license, not ISC.
2020-12-08 18:51:56 +01:00
46e66d154c Missing README.blender license files + New BSD cases
I also changed New BSD to BSD 3 Clause.

Differential Revision: https://developer.blender.org/D9791
2020-12-08 18:51:14 +01:00
ae4afcfbee Merge branch 'master' into geometry-nodes-point-separate-node 2020-12-08 11:27:16 -06:00
e08de974c3 Fix T83114: incorrect normals after joining subdivided meshes
This just makes sure that the mesh coming out of the subdivision
surface node has correct normals. Ideally, we would lazily compute
derived data like normals in more cases, but that can be solved later.
Correctness is more important right now.

In order to solve this better, it would be nice if functions like
`BKE_mesh_ensure_normals` would take a `const Mesh *`.
The mesh could be considered to be logically const, because
normals are derived data that is only cached for the current
state of the mesh.
2020-12-08 18:07:50 +01:00
Léo Depoix
40dd70882c Fix T83337: boundary smooth input in subdivision surface node is inverted
Differential Revision: https://developer.blender.org/D9753
2020-12-08 17:49:12 +01:00
Jamell Moore
5b73083d4f Fix T81950: GPencil - Draw - Stoke Placement Stroke Feature Broken
Buffer strokes weren't being the excluded from depth only draw calls
so were being included in depth tests. They are now excluded by
bypassing the creation of the buffer strokes.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9742
2020-12-08 16:48:22 +01:00
d7cf464b49 Cycles: Remove "OptiX support is experimental" notice
OptiX support is not in fact experimental anymore, so it is time for that notice to go.
All Cycles features that are currently supported on the GPU do work now when OptiX is selected.
2020-12-08 16:13:04 +01:00
612b83bbd1 Cycles: Enable baking panel in OptiX and redirect those requests to CUDA for now
This enables support for baking when OptiX is active, but uses CUDA for that behind the scenes, since
the way baking is currently implemented does not work well with OptiX.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9784
2020-12-08 16:06:39 +01:00
9962e5936d Cleanup: Use enum for file selection type definitions
Makes it more clear that these belong together and allows using the enum type
rather than just `int`.
2020-12-08 15:43:15 +01:00
2678953f69 Cleanup: Correct an own earlier commit to use an existing utility function
Didn't know this function existed, better to use it then to avoid verbosity.
2020-12-08 15:00:31 +01:00
95b3c4c966 File Browser: Refactor access to the selection parameters struct
* Avoid direct access to `SpaceFile.params`, use a getter instead. This matters
  because once the asset-browser changes are in, there will be an alternative
  selection parameter object. The getter can return the correct one.
* Rename the function to ensure the parameters. The old name
  `ED_fileselect_get_params()` wasn't a mere getter, it would create the
  parameters if necessary. Now we have an actual getter, so better be clear.
* In some instances, I replaced the old "get" function with the new mere
  getter. So the ensure logic is called less often. However, in these cases we
  should be able to assume the selection parameters were created already as
  part of the editor creation routine.

The term "active" in the new function names may seem a bit odd in the current
context, but that is a preparation for the Asset Browser merge as well. Like
said, there will be two file selection parameter objects in the space.
2020-12-08 14:39:31 +01:00
2a4fe88c13 Cleanup: Use guarded allocator for data-block names returned from file reading
Direcly using the C library allocator functions is usually avoided in favor of
our guarded allocator. It's more useful when debugging.
2020-12-08 12:56:11 +01:00
296bc35638 Fix unexpected "/" path after normalizing empty directory path
Caused problems in the Asset Browser branch when passing an empty path. The
function shouldn't blindly add a slash but sanity-check the input parameters
first.
2020-12-08 12:42:02 +01:00
Bastien Montagne
c0bd240ad0 LibOverride: Add initial support for adding new NLA tracks.
Also makes NLA tracks and strips overridable.

User can either edit existing strips in existing NLA tracks (but not add or remove them), and/or add new NLA tracks after those comming from the linked data.

Most of the work was as usual checking operators and adding protections against illegal operations in override context.

Note that since we can only rely on indices to deal with local added tracks, we forbid any local track being before any linked/original track.

Maniphest Tasks: T72629

Differential Revision: https://developer.blender.org/D9611
2020-12-08 10:55:57 +01:00
78080337f8 PyDoc: expanded documentation for bpy_struct.is_property_set
This patch expands on the `is_property_set` doc-string,
detailing the purpose of the `ghost` argument added in
d3bcbe10c2.

Reviewed By: sybren

Ref D9780
2020-12-08 20:52:31 +11:00
28169cea3d PyDoc: avoid blank lines at the beginning of code-examples 2020-12-08 20:49:28 +11:00
276f6840ed CMake: fix linking with WITH_SDL_DYNLOAD
While this was only needed in 'source/blender/python',
add to ghost to avoid problems in the future.
2020-12-08 20:48:11 +11:00
f43c9499bf Cleanup: use static declarations 2020-12-08 20:44:45 +11:00
d9918e3e53 shaders_test: correct arguments to EEVEE_shaders_cryptomatte_sh_get 2020-12-08 20:44:14 +11:00
922b8abea5 Cleanup: LibOverride: Forgot to update comments in previous commit. 2020-12-08 09:48:20 +01:00
682ccd770c LibOverride: Refactor collection items 'local' helper functions.
It's easier to read and less 'weird' to check that an item is non-local
in a liboverride data-block, than the other way around. Thanks to
@sybren for noticing it.
2020-12-08 09:40:42 +01:00
5f1a155a5e Fix T83117: Curve bevel not handle aligned at end-points
Caused by fix for T80742, 4987b7d347.

Keep the fix that calculates the start/end direction
from adjacent points but only use it as a fallback.
2020-12-08 12:20:27 +11:00
Yevgeny Makarov
ab9952e55f Spelling: Bit Depth Compound Modifiers
Correct usage of compound modifiers like '32-bit'.

Differential Revision: https://developer.blender.org/D9769

Reviewed by Julian Eisel
2020-12-07 14:51:06 -08:00
Yevgeny Makarov
41e236c527 UI: Correct Usage of 'Eevee' Name
Use accepted capitalization of Eevee, not 'EEVEE'.

Differential Revision: https://developer.blender.org/D9770

Reviewed by Julian Eisel
2020-12-07 13:46:01 -08:00
William Reynish
e258dfa421 UI: Add Heading to Curve Deform Toggles
Adds a heading to the three Properties Curve Deform toggles.

Differential Revision: https://developer.blender.org/D9766

Reviewed by Julian Eisel
2020-12-07 13:35:50 -08:00
William Reynish
2b3d85d7d6 IC keymap: Properties and Modifier Changes
Updating Industry Compatible keymap for Property filtering and new Modifier behavior.

Differential Revision: https://developer.blender.org/D9765

Reviewed by Julian Eisel
2020-12-07 13:34:06 -08:00
William Reynish
6858065754 Userprefs: Tooltips Section Layout Tweaks
Small improvements to the layout of the Tooltips section in Preferences.

Differential Revision: https://developer.blender.org/D9772

Reviewed by Pablo Vazquez
2020-12-07 13:29:53 -08:00
c822f66bb8 Fix T83307: Some modal keys of transform operators don't correspond to the expected effect
The transform modes `shrinkfatten` and `seq_slide` have a special way of
handling events.

They use modal events in a different way than expected.

Therefore, this commit adds special event handles for these modes and
removes the keymodal tips from the status bar.

These effects are already described in the header anyway.
2020-12-07 17:36:23 -03:00
29fb12da58 Fix T83510: Convert Gpencil to curve crash when stroke has zero points
If the stroke had zero points the pointer returned NULL.

Also replaced for loop by FOREACH macro.

This is a corner case of "empty" strokes without points.
2020-12-07 19:08:29 +01:00
e0c199a527 Review feedback: Only move pointcloud, use numbers for naming 2020-12-07 11:56:00 -06:00
d6354a7ee2 Merge branch 'master' into geometry-nodes-point-separate-node 2020-12-07 11:15:41 -06:00
3e005a3214 Cleanup: Use LISTBASE_FOREACH in node transform code
Also decrease variable scope.
2020-12-07 11:11:03 -06:00
a61febe739 Add comment to clarify the use of mesh::symmetry
Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9776
2020-12-07 17:17:56 +01:00
4f25e168a2 Fix DPX image output having invalid float metadata
Casting 0xFFFFFFFF to float does not give NaN as is needed here. Found through
compiler warning which is now fixed.
2020-12-07 17:09:34 +01:00
b14b57fc05 Fix failing Eevee render tests after recent changes 2020-12-07 17:09:34 +01:00
Jim Eckerlein
3012446f02 glTF: update Draco library to new version
To support decoding and enhanced encoding of Draco compressed glTF files.

Differential Revision: https://developer.blender.org/D9642
2020-12-07 17:09:34 +01:00
fb82cfb539 Animation: Show Channel Group Colors is now off by default
Change the default for the Show Channel Group Colors preference to OFF.

This option in the user preferences was introduced in rBad85256e7108. It
moved a per-file-per-editor option to the user preferences. As this
option would be frequently turned off by animators, this would now have
to happen only once. This commit takes this one step further, and turns
it off by default, as it can cause major readability issues of the
animation channel list.
2020-12-07 16:58:39 +01:00
bab57550b6 LibOverride: Abstract a bit handling of local items of RNA collections.
RNA collections that support insertion of new items in liboverride
data-block need a special way to distiguish between locale and
orig-from-linked items (since some operations are allowed on the forer,
but no the latter).

In future we want a proper solution to abstract that at the
`BKE_lib_override` level, but for now we need to add some code for each
case.

Note that this commit also fixes a few potential issues with GPencil
modifiers, and constraints, regarding their handling of local overrides.
2020-12-07 16:55:51 +01:00
513578b182 Fix (unreported) LibOverride: GPencil local Modifiers not fully editable.
Missing case in `RNA_property_overridable_get`
2020-12-07 16:55:51 +01:00
c51a70537b Fix T81745: Auto Weights fails with Mirror mod + Vertex Groups X
Fix the Assign Automatic Weights operator in weight paint mode when the
Vertex Groups X option is enabled. This issue was probably introduced in
rB5502517c3c12 where `me->editflag & ME_EDIT_MIRROR_X` was replaced by
either `me->editflag & ME_EDIT_VERTEX_GROUPS_X_SYMMETRY` or
`me->symmetry & ME_SYMMETRY_X`. In this case, the former wasn't working,
so I replaced it with the latter.
2020-12-07 16:30:14 +01:00
e7ec68cd46 Merge branch 'master' into geometry-nodes-point-separate-node 2020-12-07 08:01:00 -06:00
2e221de4ce UI Code Quality: Start refactoring Outliner tree-element building (using C++)
Continuation of the work started with 249e4df110. After all display modes
were ported to this new design, this commit starts the (more complex) work on
the individual tree-element types. More concretely it ports animation
tree-elements (action data-blocks, drivers and NLA data).

The commit above explains motivations. In short, we need a better design that's
easier to reason about and better testable.

Changes done here are pretty straight forward and introduce similar class
hierarchy and building patterns as introduced for the display modes already.
I.e. an abstract base class, `AbstractTreeElement` with derived classes for the
concrete types, and a C-API with a switch to create the needed objects from a
type enum. The latter should be replacable with something nicer later on (RAII
based, and type-safer through meta-programming).
Each tree-element type has its own class, with an own header and source file
(okay some closely related types can share a header and source file, like the
NLA ones).

I added some further temporary bits for the transition to the new design, such
as the `TreeElement.type`. It should entirely replace `TreeElement` eventually,
just as `outliner_add_element()` should be quite small by then and easily
replacable by a `TreeBuilder` helper.
2020-12-07 14:51:15 +01:00
634b10acbb Fix missing type check for Outliner eyedropper query
Mistake in 35a5dee2ef.

Code would simply assume that the element under the cursor is an Object if it
was an ID (but not a collection).

This wouldn't cause any issues in current code, since the only other ID that
set the direct-data were collections, which are special in that they don't have
a `TreeStoreElem.type` of 0, which is already being checked for here. And if
there was no direct-data set, the object lookup in the View-Layer would
correctly fail too.
2020-12-07 14:35:54 +01:00
95734e32bf Cleanup: Avoid setting (unsafe) Outliner tree element data that won't be used
I carefully checked and am quite sure for `TSE_ANIMATION_DATA` and
`TSE_NLA_ACTION` the direct-data isn't used at all. This data is stored and
accessed in unsafe ways based on conventions anyway (`void *`). We should aim
for a safer design but it will be difficult to get there. Any removed
complexity will help.
2020-12-07 14:35:54 +01:00
0c0bc61918 Fix access to invalid data in Outliner tree building
Non-ID tree-elements would cast their data pointer to `ID *` and take the name
and ID-Code from there. The name would actually be overridden a few lines
later, so that didn't cause issues. But the ID-Code stored inside the tree
element kept an undefined value. In practice that probably didn't cause many
issues either, since it's just an undefined value that was very unlikely to
take a valid 16-bit ID-code value, meaning ID-Code checks would simply fail as
they should. Further there typically are other checks to see if the element
actually represents an ID.
However, in theory this may have caused a few random crashes or
data-corruptions.
2020-12-07 14:35:54 +01:00
cf9275dd4e Fix failing Cycles tests after Cryptomatte changes
For old files without Cycles cryptomatte settings, must provide the defaults.
2020-12-07 13:13:49 +01:00
d329a6a937 Fix bug in cleanup commit
Fix a copy-paste error in rB11c4066159e
2020-12-07 12:54:46 +01:00
11c4066159 Cleanup: partial Clang-Tidy modernize-loop-convert
Modernize loops by using the `for(type variable : container)` syntax.

Some loops were trivial to fix, whereas others required more attention
to avoid semantic changes. I couldn't address all old-style loops, so
this commit doesn't enable the `modernize-loop-convert` rule.

Although Clang-Tidy's auto-fixer prefers to use `auto` for the loop
variable declaration, I made as many declarations as possible explicit.
To me this increases local readability, as you don't need to fully
understand the container in order to understand the loop variable type.

No functional changes.
2020-12-07 12:41:17 +01:00
2072134faa UI: Fix mistakes in UI messages. 2020-12-07 10:57:27 +01:00
7d2745f8b3 Fix Cryptomatte panel not visible in EEVEE
Caused by {rB5baae026a86f}
2020-12-07 09:31:05 +01:00
9ac6ef7036 File Subversion Bump: 2.92.5 2020-12-07 08:07:18 +01:00
Jeroen Bakker
5baae026a8 Cycles: Use Blender Cryptomatte Settings.
Blender has now the place to store the Cryptomatte settings. This patch
migrates Cycles to use the new settings.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D9746
2020-12-07 08:01:49 +01:00
Greg Neumiller
3d0b65f89b Fix T83296: Unknown actions no longer perform an undo push
str_len_clip is initialized to 0, so when "Unknown Action"
occurs, set str_len_clip appropriately.
Regression in 0688309988

Ref D9759
2020-12-07 13:44:23 +11:00
Greg Neumiller
c2a01a6c11 Fix T83347: Smart UV project crashes with wire edges
Missing NULL check.
Regression in 9296ba8674

Ref D9757
2020-12-07 13:44:17 +11:00
fff0032a25 Cleanup: spelling 2020-12-07 13:25:53 +11:00
5c3fa5a424 Cleanup: correct enum type 2020-12-07 13:25:49 +11:00
ba740ad2ab GPencil: Enable Layer Onion Skin by default 2020-12-06 22:27:28 +01:00
6f22a536e6 Fluid: Updated Mantaflow source files
Includes outflow optimization - might have been the cause of instabilities.
2020-12-06 21:56:43 +01:00
Yevgeny Makarov
ee70eb96cf UI: Alert Dialog Helper Function
Shared helper function to create a split layout with an alert icon for popup dialogs.

Differential Revision: https://developer.blender.org/D9486

Reviewed by Julian Eisel
2020-12-06 11:17:51 -08:00
Yevgeny Makarov
79eeabafb3 UI: 'About Blender' with Full Logo
New layout for the 'About' dialog featuring the full version of the Blender logo.

Differential Revision: https://developer.blender.org/D9507

Reviewed by Hans Goudey
2020-12-06 10:29:26 -08:00
a90504303e Reorder fields in boolean's ITT_value to save memory. 2020-12-06 10:58:14 -05:00
538f41e949 Doxygen: Increase lookup cache
I could not measure any major speedup/memory usage but this resolves a 
message while running doxygen.
2020-12-05 20:17:32 -05:00
eb4eb07065 Doxygen: Disable HTMLHELP
This feature is intended to generate Microsoft Compiled HTML Help files 
which is not something we use/need.
This also fixes an error in generation because the executable cannot be 
found.
2020-12-05 20:17:32 -05:00
52a6c4f34d Fix crashes with invisible Outliners on fullscreen or window closing
I didn't actually confirm this is caused by invisible Outliners. But I'm pretty
sure the error happens with Outliners that aren't initialized (so were open in
an area before, but another editor is active there currently).
In that case, the runtime data may not be set yet and that is fine.

Fixes T83420.
2020-12-05 14:56:13 +01:00
237f9da4a0 Fix T83400: GPencil onion skin not visible when Edit Lines is enabled
The Edit Lines flag was not checking if Onion was enabled. In 2D template this is disabled by default, but default template has enabled it.
2020-12-05 13:55:10 +01:00
8982a315b7 Add more timing hooks for boolean. 2020-12-05 07:48:41 -05:00
887a602448 Cleanup: Finish porting outliner tree building to C++
No functional changes. This is a few minor cleanups to the remaining C
code for building the outliner tree after parts have been moved to C++.

Differential Revision: https://developer.blender.org/D9741
2020-12-04 17:58:46 -07:00
48acf15f98 Cleanup: Outliner Data API display mode
No functional changes. Moves the data API display building code to C++.

Differential Revision: https://developer.blender.org/D9741
2020-12-04 17:54:19 -07:00
aaa02984d3 Cleanup: Outliner scenes display mode
No functional changes. The scene display building code has been moved
to C++.

Differential Revision: https://developer.blender.org/D9741
2020-12-04 17:53:42 -07:00
1db40c29e5 Cleanup: Outliner orphan data display mode
No functional changes. Code is ported to C++ with additional cleanups to
the logic and variable names.

Differential Revision: https://developer.blender.org/D9741
2020-12-04 17:51:51 -07:00
1cc0a59be6 Cleanup: Outliner video sequencer display mode
No functional changes. Code is ported to C++. Variable names and logic
are also improved.

Differential Revision: https://developer.blender.org/D9741
2020-12-04 17:50:46 -07:00
ea37e4ea5a Fix incorrect variable name after last commit 2020-12-04 14:46:51 -06:00
67faa85fb0 Cleanup: Use LISTBASE_FOREACH macro in windowmanager intern
Also decrease the scope of variables related to the loops.
2020-12-04 13:50:53 -06:00
3daf28388b Cleanup: Move Outliner runtime hash into internal runtime struct, out of DNA
This way Outliner internal data stays internal, non-Outliner code will not be
able to access and mess with this. Further it allows us to use the real type
(rather than `void *`), change the type to a C++ container if needed and
slightly reduces the size for every Outliner stored in files.

Slightly changed how we set the `SO_TREESTORE_REBUILD` for this, but it should
effectively behave the same way as before.
2020-12-04 20:00:45 +01:00
f5eaf67e34 Atomics: Add 16 bit fetch + AND and fetch + OR signed integer operations
I could use a 16 bit atomic fetch + AND for D9719. The alternative would be to
turn a `short` into a `int` in DNA, which isn't a nice workaround.

Also adds tests for the new functions.
2020-12-04 18:28:46 +01:00
1d2c70d761 Fix API doc generation.
BMesh auto-extracting API info does not support comments inside BMesh
operators parameters definition.
2020-12-04 16:45:10 +01:00
719dfd4088 macOS deps: Support building clang tidy
This patch builds clang-extra-tools on macOS for the
clang-tidy binary. The script "run-clang-tidy.py" is
also harvested because using the `CMAKE_C[XX]_CLANG_TIDY`
option can miss out some files (like makesrna), and using the
script is faster as it does not compile the files.
Thanks to `@LazyDodo` for the base patch D8502.

Reviewed By: LazyDodo, sebbas, #platform_macos
Differential Revision: https://developer.blender.org/D9450
2020-12-04 21:13:15 +05:30
d07009498a Transform: Don't use Automatic Constraint Plane in 2D editors
Technically it shouldn't have any effect on these editors.

The key tips in the header can be misleading.

The effect it previously had was not intended.
2020-12-04 12:31:30 -03:00
b919511607 Cleanup: Deduplicate constraint event code 2020-12-04 12:31:30 -03:00
fe1f05de1b i18n utils CLI: add missing RTL process command. 2020-12-04 15:54:50 +01:00
ca4b809e63 i18n utils: Add first version of the CLI wrapper around i18n tools.
Plan is to use that in new 'buildbot' pipeline to automate generation of
i18n files for Blender.
2020-12-04 15:14:16 +01:00
b3306cf669 i18n utils: Add a helper to list and match po files with languages codes.
This code was previously done in the add-on, but we'll need it for the
CLI tool as well, so now it is a utils generator instead.
2020-12-04 15:14:16 +01:00
06ae2e3a60 i18n utils : Reduce dependency to Blender bpy API, step 2.
Remove some top imports of bpy, only import it in a few specific
functions that only make sense when used whithin Blender anyway.
2020-12-04 15:14:16 +01:00
7bd8b8cdac i18n utils: reduce dependency to Blender bpy API, step 1.
This involves re-implementing some of Blender-defined helpers in utils,
we keep debug code to ensure those are still matching on
behavior/results sides.

This will allow to get more i18n tools independent from blender
executable.
2020-12-04 15:14:16 +01:00
69dd7e42c8 i18n utils: Cleanup. 2020-12-04 15:14:16 +01:00
04d3b54000 Cleanup: Declare variables where initialized 2020-12-04 08:03:14 -06:00
4bb5314754 Cleanup: Use typedef for button string info type
Before, it wasn't clear what the int in `uiStringInfo` was supposed to
store. Using a typedef can make this someone more explicit.
2020-12-04 08:01:54 -06:00
6fda30cc54 Fix T83177: Industry Compatible keymap: MMB-dragging to transform engages axis-constraining on release
With rBc0677b662f4b, we try to track all modal events in order to detect the
one corresponding to the release.

But modifier keys can mask the modal event and thus confirm realease ends up
being skipped.

This resulted in the T83387.

With this commit we now read the actual key drop value in the modal event.

This fixes T83387
2020-12-04 10:49:58 -03:00
2de49d1ff7 Revert "Fix T83177: Industry Compatible keymap: MMB-dragging to transform engages axis-constraining on release"
This reverts commit c0677b662f.
2020-12-04 10:49:58 -03:00
c10546f5e9 Cycles: Add support for shader raytracing in OptiX
Support for the AO and bevel shader nodes requires calling "optixTrace" from within the shading
VM, which is only allowed from inlined functions to the raygen program or callables. This patch
therefore converts the shading VM to use direct callables to make it work. To prevent performance
regressions a separate kernel module is compiled and used for this purpose.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9733
2020-12-04 13:04:11 +01:00
7f2d356a67 Cleanup: Clang-Tidy, modernize-use-using
Replace `typedef` with `using` in C++ code.

In the case of `typedef struct SomeName { ... } SomeName;` I removed the
`typedef` altogether, as this is unnecessary in C++. Such cases have been
rewritten to `struct SomeName { ... };`

No functional changes.
2020-12-04 12:46:43 +01:00
10a8286a26 Cleanup: Clang-tidy, actually enable the modernize-use-override rule
Forgot this in rB168909d9741.

No functional changes.
2020-12-04 12:31:49 +01:00
168909d974 Cleanup: Clang-Tidy, modernize-use-override
No functional changes.
2020-12-04 12:02:52 +01:00
1166110a9d Cleanup: clang-format
Rerun `make format`.

No functional changes.
2020-12-04 11:28:56 +01:00
958df2ed1b Cleanup: Clang-Tidy, modernize-deprecated-headers
No functional changes.
2020-12-04 11:28:09 +01:00
f0df46287a Cleanup: replace NULL with nullptr in C++ code
No functional changes.
2020-12-04 10:50:06 +01:00
6ed6741ee3 Point users to new location of "Show Group Colors" option
In ad85256e71 the "Show Group Colors" option was changed from a
per-editor option to a user preference. Since so many people wanted to
turn this option off, this makes sense. However, this move caused some
confusion because the option was just gone from the menu.

This commit adds a dummy menu item. It's disabled, and the tooltip
explains that the option can now be found in Preferences.

T83390 was created to track the removal of these hints.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D9735
2020-12-04 10:14:44 +01:00
Jeroen Bakker
76a0b322e4 EEVEE Cryptomatte
Cryptomatte is a standard to efficiently create mattes for compositing. The
renderer outputs the required render passes, which can then be used in the
compositor to create masks for specified objects. Unlike the Material and Object
Index passes, the objects to isolate are selected in compositing, and mattes
will be anti-aliased.

Cryptomatte was already available in Cycles this patch adds it to the EEVEE
render engine. Original specification can be found at
https://raw.githubusercontent.com/Psyop/Cryptomatte/master/specification/IDmattes_poster.pdf

**Accurate mode**

Following Cycles, there are two accuracy modes. The difference between the two
modes is the number of render samples they take into account to create the
render passes. When accurate mode is off the number of levels is used. When
accuracy mode is active, the number of render samples is used.

**Deviation from standard**

Cryptomatte specification is based on a path trace approach where samples and
coverage are calculated at the same time. In EEVEE a sample is an exact match on
top of a prepared depth buffer. Coverage is at that moment always 1. By sampling
multiple times the number of surface hits decides the actual surface coverage
for a matte per pixel.

**Implementation Overview**

When drawing to the cryptomatte GPU buffer the depth of the fragment is matched
to the active depth buffer. The hashes of each cryptomatte layer is written in
the GPU buffer. The exact layout depends on the active cryptomatte layers. The
GPU buffer is downloaded and integrated into an accumulation buffer (stored in
CPU RAM).

The accumulation buffer stores the hashes + weights for a number of levels,
layers per pixel. When a hash already exists the weight will be increased. When
the hash doesn't exists it will be added to the buffer.

After all the samples have been calculated the accumulation buffer is processed.
During this phase the total pixel weights of each layer is mapped to be in a
range between 0 and 1. The hashes are also sorted (highest weight first).

Blender Kernel now has a `BKE_cryptomatte` header that access to common
functions for cryptomatte. This will in the future be used by the API.

* Alpha blended materials aren't supported. Alpha blended materials support in
  render passes needs research how to implement it in a maintainable way for any
  render pass.

This is a list of tasks that needs to be done for the same release that this
patch lands on (Blender 2.92)

* T82571 Add render tests.
* T82572 Documentation.
* T82573 Store hashes + Object names in the render result header.
* T82574 Use threading to increase performance in accumulation and post
  processing.
* T82575 Merge the cycles and EEVEE settings as they are identical.
* T82576 Add RNA to extract the cryptomatte hashes to use in python scripts.

Reviewed By: Clément Foucault

Maniphest Tasks: T81058

Differential Revision: https://developer.blender.org/D9165
2020-12-04 08:46:34 +01:00
Jeroen Bakker
2bae11d5c0 EEVEE: Arbitrary Output Variables
This patch adds support for AOVs in EEVEE. AOV Outputs can be defined in the
render pass tab and used in shader materials. Both Object and World based
shaders are supported. The AOV can be previewed in the viewport using the
renderpass selector in the shading popover.

AOV names that conflict with other AOVs are automatically corrected. AOV
conflicts with render passes get a warning icon. The reason behind this is that
changing render engines/passes can change the conflict, but you might not notice
it. Changing this automatically would also make the materials incorrect, so best
to leave this to the user.

**Implementation**

The patch adds a copies the AOV structures of Cycles into Blender. The goal is
that the Cycles will use Blenders AOV defintions. In the Blender kernel
(`layer.c`) the logic of these structures are implemented.

The GLSL shader of any GPUMaterial can hold multiple outputs (the main output
and the AOV outputs) based on the renderPassUBO the right output is selected.
This selection uses an hash that encodes the AOV structure. The full AOV needed
to be encoded when actually drawing the material pass as the AOV type changes
the behavior of the AOV. This isn't known yet when the GLSL is compiled.

**Future Developments**

* The AOV definitions in the render layer panel isn't shared with Cycles.
  Cycles should be migrated to use the same viewlayer aovs. During a previous
  attempt this failed as the AOV validation in cycles and in Blender have
  implementation differences what made it crash when an aov name was invalid.
  This could be fixed by extending the external render engine API.
* Add support to Cycles to render AOVs in the 3d viewport.
* Use a drop down list for selecting AOVs in the AOV Output node.
* Give user feedback when multiple AOV output nodes with the same AOV name
  exists in the same shader.
* Fix viewing single channel images in the image editor [T83314]
* Reduce viewport render time by only render needed draw passes. [T83316]

Reviewed By: Brecht van Lommel, Clément Foucault

Differential Revision: https://developer.blender.org/D7010
2020-12-04 08:14:07 +01:00
2bd0263fbf Fix T83346: Scrolling doesn't work with mouse over panel header
Just a misplaced assignment to the return value from the panel handler
in rB600fb28b6295.
2020-12-03 23:37:16 -06:00
e902379764 Geometry Nodes: Attribute compare node
This node reads two input attributes as floats and allows for basic
element-wise comparison operations. Like the attribute math node,
it's also possible to switch to using floats as inputs. This node can
be combined with the point separate node for more flexibility on which
points to separate out.

I used the same abstractions that the attribute math node uses in this
commit, assuming that makes sense.
2020-12-03 22:50:45 -06:00
Yevgeny Makarov
a88e6261db UI: Remove Decorators from Keymap Preferences
Improvements to the layout of the Keymaps section of Preferences by removing unneeded Decorator columns.

Differential Revision: https://developer.blender.org/D9726

Reviewed by Hans Goudey
2020-12-03 17:23:13 -08:00
be3bb4da03 Geometry Nodes: Refactor and change point separate node
The threshold input is unecessary with an "attribute compare"
node before this one, or with attribute rounding. So to remove some
complexity it is removed, and a boolean input attribute is used instead.

For the implementation, the existing code becomes a bit more specific
to point cloud data, because I'm realizing that mesh separate is quite a
different problem, and it doesn't make sense to force the same code
to be able to solve that too.
2020-12-03 18:31:10 -06:00
6505f9c09a Geometry Nodes: Add boolean type to random attribute node 2020-12-03 18:27:20 -06:00
d9b8ddd883 Geometry Nodes: Add a boolean attribute data type 2020-12-03 18:23:21 -06:00
cc6ec71b19 Sculpt: Wet paint area radius
This adds a new property to the sculpt vertex color paint brush to limit
the area of the brush that is going to be used to sample the wet paint
color. This is exactly the same concept as normal radius and area radius
that exist for sculpting brushes for sampling the surface depth and
orientation.

When working near color hard edges, this allows to prevent the color
from the other side of the edge to blend into the wet paint.

With 1.0 (the previous default) wet paint radius, as soon as the brush touches
one vertex of the other color, the wet paint mix color changes, making it
impossible to maintain the border between the two colors.

Reviewed By: sergey, dbystedt, JulienKaspar

Differential Revision: https://developer.blender.org/D9587
2020-12-03 22:55:35 +01:00
9234a6a619 Fix T82872: Add design task link for tilt support
Reviewed By: sergey, Blendify

Maniphest Tasks: T82872

Differential Revision: https://developer.blender.org/D9615
2020-12-03 22:50:02 +01:00
1bc75dfa4a Sculpt: Allow inverting the Erase Displacement mesh filter
When inverting erase displacement the filter can increase the
displacement over the limit surface. After using apply base, this can be
used as an alternative intensify details as it usually gives better
results.

This is the same concept as smoothing inverting to intensify details.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9679
2020-12-03 22:48:12 +01:00
92e44ce67c UI: Add sculpt stats to statusbar
This was missing from D9623. Now the same sculpt scene stats are also
displayed in the status bar.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9700
2020-12-03 22:46:32 +01:00
82e401031f UI: Fix Node Groups color in Geometry Nodes
Node Groups didn't have a category assigned so they looked like inputs (red)
instead of the Node Group theme color (green by default).
2020-12-03 20:21:09 +01:00
f3b08af24c Fix T83352: Move with constraint showing an incorrect value in the header
The displayed value was always that of the x axis.
2020-12-03 15:29:32 -03:00
f637b47064 MSVC: Enable clang-tidy analyser
This enables the use of clang-tidy in the VS IDE.

To use it:

1 - Enable WITH_CLANG_TIDY in your cmake configuration
2 - From the Analyse pull down menu select Run Code Analysis on...

The analyser is currently not enabled by default on build
given it is quite slow and there are quite a few problems
it reports that we still need to deal with.
2020-12-03 11:00:58 -07:00
f58d9d7500 Merge branch 'master' into geometry-nodes-point-separate-node 2020-12-03 11:31:18 -06:00
920edc358c Merge branch 'geometry-nodes' into geometry-nodes-point-separate-node 2020-12-03 11:31:05 -06:00
769818f7f4 GPencil: Reduce UI range for Simplify Adaptive factor
The old range was too big, so now the soft limit is between 0 and 5
2020-12-03 17:42:12 +01:00
c821aa8ca7 GPencil: Fix unreported refresh of stroke after using Arrange operator
When change the order of the stroke using the arrange operator, the arrange was done, but the viewport did not display the result until you refresh the viewport.
2020-12-03 17:18:01 +01:00
986955a2d5 GPencil: Add Vertex Paint operators to Paint menu
These operators existed since 2.83, but the menu was hidden by error.

Also the operators have been cleanup and make multiframe compatible.

Reviewed By: mendio

Differential Revision: https://developer.blender.org/D9671
2020-12-03 16:49:40 +01:00
570a16da18 Fix: remove show_group_colors from graph editor menu
The `show_group_colors` option was moved to the user preferences in
ad85256e71, but accidentally remained in the graph editor menu.
2020-12-03 16:32:58 +01:00
107231eb95 Geometry Nodes: improve support for Color attributes
* Add typed attribute accessors for color attributes.
* Support implicit conversions between colors and floats.
2020-12-03 16:25:48 +01:00
2c181521ec Geometry Nodes: add custom data type getter for attribute accessor
This is just an utility method, that avoids that the caller has to do
the conversion every time it is necessary.
2020-12-03 16:20:09 +01:00
675d84826e Fix T83315: Crash showing animation channel context menu after baking sound
Fix a crash when right-clicking in the Graph Editor animation channel
list. The code for getting selected keyframes was not checking for baked
curves.
2020-12-03 15:28:14 +01:00
a3c4091215 Fix Cycles device kernels containing debug assertation code
NanoVDB includes "assert.h" and makes use of "assert" in several places and since the compile
pipeline for CUDA/OptiX kernels does not define "NDEBUG" for release builds, those debug
checks were always added. This is not intended, so this patch disables "assert" for CUDA/OptiX
by defining "NDEBUG" before including NanoVDB headers.
This also fixes a warning about unknown pragmas in NanoVDB thrown by the CUDA compiler.
2020-12-03 15:20:50 +01:00
5d13082622 Tracking: Improve multithreading of tracking many markers
This change solves a bottleneck which was caused by attempt to cache
postprocessed search areas used for tracking. It was a single cache
used by all threads, which required to have some synchronization
mechanism. This synchronization turned out to be making all threads
to idle while one thread is accessing the cache. The access was not
cheap, so the multi-threading did not provide expected speedup.

Current solution is to remove the cache of search areas. This avoids
any threading synchronization overhead because there is no need for
it anymore. The downside is that for certain configurations tracking
became slower when comparing to master branch. There is no expected
slowdown compared to 2.91 release.

The slowdown is mainly experienced when using big search area and
keyframe matching strategy. Other cases should still be within a
ballpark of performance of single-threaded code prior to this change.
The reason why is it so is because while this change makes it so the
image accessors needs to process images multiple times the complexity
of this process is almost the same as all the overhead for the cache
lookup and maintenance.

Here are Some numbers gained on different configurations.

CPU: Intel Xeom CPU E5-2699 v4
OS: Linux
Footage: Old_Factory MVI_4005.mov from the first part of Track Match
Blend training which can be found on the Blender Cloud.

Tracking 443 markers across 250 frames. The unit is seconds.
File: F9433209

  2.91: 401.520874
before: 358.650055
 after:  14.966302

Tracking single marker across 250 frames. The unit is seconds.
File: F9433211

                         2.91      before     after
        Big keyframe   1.307203   1.005324   1.227300
  Big previous frame   1.144055   0.881139   0.944044
      Small keyframe   0.434015   0.197760   0.224982
Small previous frame   0.463207   0.218058   0.234172
         All at once   2.338268   1.481220   1.518060
2020-12-03 14:51:11 +01:00
Henrik Dick
a6c4e39876 Add Custom Object Space to Constraints
Add Custom Space to the list of space conversions for constraints.

Constraints can use World Space, Local Space, Pose Space, Local with
Parent, and now also Custom Space with a custom object to define the
evaluation space.

The Custom Space option uses the Local Space of an other
object/bone/vertex group. If selected on owner or target it will show a
box for object selection. If an armature is selected, then it will also
show a box for bone selection. If a mesh object is selected it will show
the option for using the local space of a vertex group.

Reviewed By: #animation_rigging, sybren, Severin, angavrilov

Differential Revision: https://developer.blender.org/D7437
2020-12-03 11:20:21 +01:00
899dcc5f60 Fix linker errors when building without Cycles
Fix linker errors by explicitly linking PugiXML when OpenImageIO is
used.

PugiXML has been separated from OpenImageIO (D8628). This means that any
time OpenImageIO libraries are linked, the PugiXML libraries have to be
linked as well. This was set up correctly for Cycles, but not for imbuf.
Because of this, building without Cycles but with OIIO would produce
linker errors.
2020-12-03 11:07:06 +01:00
acaee97c2f Fix accendental copy/paste errors after last commit 2020-12-02 22:26:14 -05:00
fc05e2c0e0 Bmesh: Improve documentation of op parameters
These comments are used to generate Py API docs.
Most of the comments are just copies of the mesh operator counterparts.

More improvements can be made here in the future.

Thanks to Jon Denning on twitter:

https://twitter.com/gfxcoder/status/1334178566993555459
2020-12-02 22:01:00 -05:00
dc4feed59d Cleanup: view-port --> 2D/3D Viewport 2020-12-02 18:16:23 -05:00
cba5137f32 Fix crash in outliner on cursor hover
The previous commit surfaced a bug introduced in rBab4654cdfe8f in which
a boolean wasn't initialized to false.
2020-12-02 09:25:45 -07:00
390c4efa0c Merge branch 'master' into geometry-nodes 2020-12-02 16:58:44 +01:00
3fc178b19e Outliner: Highlight icons on cursor hover
The icons for collapsed children already draw highlighted when hovered.
Because the item icons are now select targets (for outliner to properties
editor tab switching) this adds highlights on hover for all outliner
element icons.
2020-12-02 08:58:32 -07:00
3d0c5455ed Cleanup: Store "is_active" instead of pointer property in panel type
This is consistent with the way other panel type fields are stored.
2020-12-02 16:44:40 +01:00
9281a1f4eb UI: Add new node colors for geometry nodes
During the development of the new nodes in the `geometry-nodes` branch
the color of the new nodes wasn't considered, so all of the nodes ended
up red, the color for "input" nodes. This patch introduces two new
colors, one for "Geometry" and one for "Attributes". There are only two
attribute nodes currently, but the next sprint will add two more,
attribute mix, and sample from texture. The attribute nodes are
conceptually different enough from the nodes that modify the geometry
that they deserve their own color.

Differential Revision: https://developer.blender.org/D9682
2020-12-02 16:34:06 +01:00
8522b1b6fb Geometry Nodes: automatically reconnect when swapping inputs
This makes it easier to swap the inputs to the Join Geometry node.
The behavior is the same as in the Math node.
2020-12-02 16:34:06 +01:00
074de755e9 Geometry Nodes: correct modifier name when creating from node editor
The name should be the same as when the modifier is created in the
modifier tab of the properties editor.
2020-12-02 16:34:06 +01:00
58cc8938e1 Fix T83309: Hide metadata when overlays are off.
Inconsistency between overlay popover and implementation. Now the
metadata will not be visible when the overlays are turned off.
2020-12-02 16:19:15 +01:00
60760bd470 Geometry Nodes: unify icons -> use ICON_NODETREE for everything
Until there is a icon made specially for this, the nodetree icon is up
for grabs. Using it in the nodegroup + modifier + editor helps the users
to make a connection on where to edit those modifiers.
2020-12-02 15:38:47 +01:00
ea74ed5a7a Cleanup: remove all of "#ifdef WITH_POINT_CLOUD"
Since Point Cloud was removed from experimental this is no longer needed.
2020-12-02 15:38:47 +01:00
3d3a20d6d1 Cleanup: remove most of "#ifdef WITH_GEOMETRY_NODES"
The ones around the simulation datablock are still there, since they are not
needed for the features planned for master yet.
2020-12-02 15:38:47 +01:00
dc614c68ef Preferences: remove Point Cloud object from experimental
The point cloud object is the only one that will support instancing at
first. So we can expose it as a regular object.

It is limited since it has no edit mode. But this is not different than
the volume object.
2020-12-02 15:38:47 +01:00
56931f63c6 Preferences: remove Geometry Nodes from experimental 2020-12-02 15:38:47 +01:00
b1d1a58c77 Geometry Nodes: improve operators for node editor header
This allows users to create new modifiers directly from the
Geometry Nodes Editor.
2020-12-02 15:38:47 +01:00
600fb28b62 Geometry Nodes: active modifier + geometry nodes editor
This commit adds functions to set and get the object's active
modifier, which is stored as a flag in the ModifierData struct,
similar to constraints. This will be used to set the context in
the node editor. There are no visible changes in this commit.

Similar to how the node editor context works for materials, this commit
makes the node group displayed in the node editor depend on the active
object and its active modifier. To keep the node group from changing,
just pin the node group in the header.

* Shortcuts performed while there is an active modifier will affect
  only that modifier (the exception is the A to expand the modifiers).
* Clicking anywhere on the empty space in a modifier's panel will make it active.

These changes require some refactoring of object modifier code. First
is splitting up the modifier property invoke callback, which now needs
to be able to get the active modifier separately from the hovered
modifier for the different operators.

Second is a change to removing modifiers, where there is now a separate
function to remove a modifier from an object's list, in order to handle
changing the active.

Finally, the panel handler needs a small tweak so that this "click in panel"
event can be handled afterwards.
2020-12-02 15:38:47 +01:00
fc4a853846 Geometry Nodes: support muted nodes
The handling of muted nodes is handled at the derived node tree
level now. This is also where expanding node groups is handled.
Muted nodes are relinked and removed from the derived tree
during construction. The geometry node evaluation code does
not have to know about muted nodes this way.
2020-12-02 15:38:47 +01:00
ae0aa4b94c Geometry Nodes: support geometry components in depsgraph object iterator
Objects can evaluate to a geometry set instead of a single ID (only point cloud
objects for now). In the depsgraph object iterator, the evaluated geometry
components are expanded into temporary objects.

It's important to note that instanced objects can also contain geometry
components. Therefore, they have to be split up into multiple objects
as well in some cases.

At a high level the iterator works like so:

```
for object in depsgraph:
    for component in object:
        yield object_from_component(component)
    for dupli in make_duplis_list(object):
        for component in dupli:
            yield object_from_component(component)
```

DEG_iterator_objects_next has been cleaned up, to make this structure
a bit more apparent.

This should not change anything for objects that are not point clouds.
2020-12-02 15:38:47 +01:00
6be56c13e9 Geometry Nodes: initial scattering and geometry nodes
This is the initial merge from the geometry-nodes branch.
Nodes:
* Attribute Math
* Boolean
* Edge Split
* Float Compare
* Object Info
* Point Distribute
* Point Instance
* Random Attribute
* Random Float
* Subdivision Surface
* Transform
* Triangulate

It includes the initial evaluation of geometry node groups in the Geometry Nodes modifier.

Notes on the Generic attribute access API

The API adds an indirection for attribute access. That has the following benefits:
* Most code does not have to care about how an attribute is stored internally.
  This is mainly necessary, because we have to deal with "legacy" attributes
  such as vertex weights and attributes that are embedded into other structs
  such as vertex positions.
* When reading from an attribute, we generally don't care what domain the
  attribute is stored on. So we want to abstract away the interpolation that
  that adapts attributes from one domain to another domain (this is not
  actually implemented yet).

Other possible improvements for later iterations include:
* Actually implement interpolation between domains.
* Don't use inheritance for the different attribute types. A single class for read
  access and one for write access might be enough, because we know all the ways
  in which attributes are stored internally. We don't want more different internal
  structures in the future. On the contrary, ideally we can consolidate the different
  storage formats in the future to reduce the need for this indirection.
* Remove the need for heap allocations when creating attribute accessors.

It includes commits from:
* Dalai Felinto
* Hans Goudey
* Jacques Lucke
* Léo Depoix
2020-12-02 15:38:47 +01:00
ddbe3274ef BLI: add missing const 2020-12-02 15:38:47 +01:00
d65628466a Functions: add float2 cpp type
This also adds a hash function for `float2`, because `CPPType`
expects that currently.
2020-12-02 15:38:47 +01:00
8268b9827a Theme: update shader node color to match socket color
Reviewed by Brecht

Ref T82689.
2020-12-02 15:38:47 +01:00
96e131f246 UI: update node socket colors
Note: This also changes the Shader socket color, to match "Shading" in the Outliner.

Theme update for shader nodes will be committed separately.

Ref T82689.
2020-12-02 15:38:47 +01:00
69f57550bc Nodes: add geometry socket type
We still have to pick a color for this socket.

Ref T81848.
2020-12-02 15:38:47 +01:00
1d6284a6d5 Functions: add generic pointer class
This class represents a pointer whose type is only known at runtime.
2020-12-02 15:38:47 +01:00
c7f518fe35 Functions: add move operations to CPPType
Those are sometimes needed when dealing with c++ types in a generic way.
2020-12-02 15:38:47 +01:00
85f9d319a4 Fix T83293: crash when selecting bone
This partially reverts rBe922dd7d8a307c54d49bc01649a12610b022192b.
The issues fixed by that commit is still fixed.

Reviewers: fclem
2020-12-02 15:33:51 +01:00
13c3ad7e76 GPU: Show Limited support message for polaris + 20.11.2 drivers.
See T82856 for details.
2020-12-02 15:30:00 +01:00
f8d1378b84 Deps: Additional changes for PugiXML on macOS
This commit expands the Windows-specific code in rBdca9aa0053f7 and Linux-specific code in rB33b7d53df08a.

It also fixes a capitalization issue in FindPugiXML.cmake
2020-12-02 15:18:05 +01:00
d40f5d41af GPU: Blacklist unsupported GPUs that crash during startup.
Since Blender 2.91 the TeraScale 2 based cards crash during startup.
This patch will show the user a screen that the platform they are using
isn't supported.

The GPUs have been carefully handpicked from dozens of reports. T83124,
T83127, T83103, T83091, T83045, T83065, T82750, T82889, T82925, T82640,
T82429, T82436, T82446.
2020-12-02 15:17:13 +01:00
2f0f269684 Point Separate Node: Change has_attribute function 2020-12-02 09:08:33 -05:00
c576d65c2f Fix T83161: Crash when moving ruler endpoints and opening or closing the toolshelf
`invert_snap` could be called before `snap_gizmo->keymap` was found.

Use the lazy initialization in `invert_snap` then.
2020-12-02 10:27:41 -03:00
Henrik Dick
ec39d8de4a Transform: Correct Mirror for Object Mode along arbitrary axis
This fixes T68521, T82334.

The object are not properly mirrored in object mode.

For mirroring an object that has an arbitrary rotation along the X axis
this is the procedure:
1. mirror x location.
2. negate x scale of the
3. negate y and z component of the rotation (independent of which rotation mode is used).

This knowledge applies now for all angles and axes to finally make the
mirror operation work in object mode.

The new mirror function has the downside that it can not (in this form)
be used with proportional editing.

This is no problem since the old behavior can still be replicated by
scaling with -1 along any axis.

The solution to get perfect mirrors can not work for scaling in general,
because in that case there could be scew created.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D9625
2020-12-02 09:22:37 -03:00
da8dc204bd Fix T83119: Crash with topology mirror affecting a hidden vertex
Caused by rBba97da21acf2.

For non-topology mirror hidden verts were never respected/included in
EDBM_verts_mirror_cache_begin (they were excluded from the kdtree).

Prior to said commit, hidden mirrored verts that were still in the map
would have been excluded in a separate loop over vertices in
'editmesh_mirror_data_calc()' by checking BM_ELEM_HIDDEN. Due to the new
nature of this function this check was now moved to
EDBM_verts_mirror_cache_begin.

Maniphest Tasks: T83119

Differential Revision: https://developer.blender.org/D9673
2020-12-02 12:35:51 +01:00
Christian Friedrich
e4204a3979 Add Custom Falloff Curve to the Vertex Weight Proximity Modifier.
The Vertex Weight Edit Modifier already got the Custom Curve, there was no
real reason for the proximity not to have it as well.

With some fixes by Bastien Montagne (@mont29).

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9594
2020-12-02 11:20:03 +01:00
84451f89f5 Fix T83300: constant scene refreshing in Cycles with empty volumes
This infinite loop is caused by a conflict between the volume mesh
creation which unintentionally clears the shaders before early exiting
when no grid is found, and the Blender exporter which adds back the
shaders causing us to reupdate as the shaders changed.

To fix this simply preserve the shaders on the Volume node.
2020-12-02 11:18:45 +01:00
67353ae630 Fix build error on builds without audaspace
This was caused by incorrect argument type in dummy function
`rna_Sequences_new_sound()`

Caused by 13ca11ac52
2020-12-02 10:13:45 +01:00
2afc508eb4 Fix T83090: Multiple warnings accessing brush enum data.
We already have generic enums for empty and default 'none' value.
2020-12-02 09:29:37 +01:00
da22ec1254 Cleanup: Fix CMake syntax error in the last commit. 2020-12-02 13:55:52 +05:30
6535135ef7 CMake/macOS: consider MinSizeRel too for ASan. 2020-12-02 13:23:25 +05:30
a715839a55 Cleanup: add commits to .git-blame-ignore-revs. 2020-12-02 13:20:43 +05:30
13ca11ac52 VSE: Unify sequences collections API
Use RNA_api_sequences() for SequenceEditor and MetaSequence
sequences member.

Defines pair of dispatch functions rna_Sequences_editing_* and
rna_Sequences_meta_* that pass pointer to seqbase to
rna_Sequences_* function.

Downside of this implementation is, that it defines 2 seemingly
different RNA collections - SequencesMeta and SequencesTopLevel

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9601
2020-12-02 05:51:22 +01:00
267ba329ec Point separate node: Refactor, add comments, clean up
Make more of the logic generic so that it can more easily work on more
component types in the future. Basically anything that handles attributes
can be generic.
2020-12-01 22:33:47 -05:00
bce42fbfe4 Attribute Access: Add a "has_attribute" method 2020-12-01 22:31:00 -05:00
59414e6a6f Point Separate Node: Revert earlier change to point cloud creation
I'm not quite sure creating the "radius" attribute in here is necessary
when any other attribute can be created later, but without this the
original radius attribute didn't pass to the new point cloud components
properly.

This should be investigated though, because the "radius" attribute
of pointclouds currently exists in some "semi-built-in" space that
doesn't really make sense.
2020-12-01 22:29:55 -05:00
4eef1d2edc Geometry Nodes: Point separate node
This node takes an input geometry and ouputs two geometries, moving
some points to the first and other points to the second depending on a
mask attribute input and a threshold.

The implementation tries to be "attribute component agnostic", meaning
it should be relatively easy to add "separate" functionality for more
component types in the future when they need to support it. (Then the
node could be renamed "Separate Geometry").

There is still an error carrying over the values for some attributes to
the output geometries.
2020-12-01 16:05:35 -05:00
1176591574 Codesign: Allo non-zero exit code for signtool on Windows 2020-12-01 17:16:48 +01:00
f14c9444c8 UI: Add new node colors for geometry nodes
During the development of the new nodes in the `geometry-nodes` branch
the color of the new nodes wasn't considered, so all of the nodes ended
up red, the color for "input" nodes. This patch introduces two new
colors, one for "Geometry" and one for "Attributes". There are only two
attribute nodes currently, but the next sprint will add two more,
attribute mix, and sample from texture. The attribute nodes are
conceptually different enough from the nodes that modify the geometry
that they deserve their own color.

Differential Revision: https://developer.blender.org/D9682
2020-12-01 10:28:29 -05:00
33b7d53df0 Deps: Add PugiXML as an official dependency
PugiXML was historically shipped hidden embedded into OIIO, the Grease
Pencil team had a requirement for an XML library recently so pugi seems
like a natural choice since it's not really a 'new' library, we just
turn an implicit dependency into an explicit one.

This commit expands the Windows-specific code in rBdca9aa0053f7 to
include Linux. macOS support will be handled in a later commit.

NOTE: run `cmake -U'*PUGIXML*' .` in the build directory to ensure CMake
finds PugiXML in the new location.

For details see D8628
2020-12-01 16:25:51 +01:00
29401d38d1 Tracking: Refactor autotrack tracking implementation
The idea is to avoid any synchronization needed in the worker threads
and make them to operate on a local data. From implementation detail
this is achieved by keeping track of "wavefront" of markers which are
to be tracked and the tracking result. Insertion of results to the
AutoTrack context happens from main thread, which avoids need in the
lock when accessing AutoTrack.

This change makes tracking of many (300+) about 10% faster on the
Xeon) CPU E5-2699 v4. More speedup will be gained by minimizing
threading overhead in the frame cache.

Another important aspect of this change is that it fixes non-thread
safe access which was often causing crashes. Quite surprising the
crash was never reported.
2020-12-01 15:24:34 +01:00
399e5cc069 Geometry Nodes: support swapping inputs in function nodes
This is the same fix as in rB5ae666c2cc67be0e5ffb897c1ff48fe434d7dbc6.
2020-12-01 15:11:49 +01:00
5ae666c2cc Geometry Nodes: automatically reconnect when swapping inputs
This makes it easier to swap the inputs to the Join Geometry node.
The behavior is the same as in the Math node.
2020-12-01 15:04:45 +01:00
4c92fb6715 Libmv: Tweak default logging verbosity level
Log to verbosity level 1 rather than INFO severity.

Avoids a lot of overhead coming from construction of the INFO stream
and improves performance and threadability of code which uses logging.

This makes tracking of 250 frames of a track of default settings to
drop down from 0.6sec to 0.4sec.
2020-12-01 14:55:22 +01:00
c21265b29e Libmv: Cleanup, remove unused logging macros
Unused and was not entirely happy with such short abbreviations.
2020-12-01 14:46:35 +01:00
b9525e3279 Geometry Nodes: correct modifier name when creating from node editor
The name should be the same as when the modifier is created in the
modifier tab of the properties editor.
2020-12-01 11:32:46 +01:00
01b94c5d8a Cleanup: De-duplicate object mullptr checks
Makes it more clear whether object is allowed or not allowed to be NULL.
Also, avoids possible access to the different object mode enumerator.

Should be no functional changes.
2020-12-01 10:45:02 +01:00
edf1095176 Fix T83275: Crash with scene statics and empty scene
ob can be NULL, so it needs to be checked before accessing ob->mode

Differential Revision: https://developer.blender.org/D9680
2020-12-01 10:27:51 +01:00
1bb2c7dda3 Cleanup: Store "is_active" instead of pointer property in panel type
This is consistent with the way other panel type fields are stored.
2020-11-30 17:43:14 -05:00
645c2bd4d0 Fix sculpt transform incorrently flipping displacement in Y and Z axis
These functions were only checking the X axis for flipping the
displacement for a symmetry area depending on the initial position of
the pivot.
This affects transform and any other tools that transform vertices and
applies symmetry based on areas (the pose brush, for example).

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9654
2020-11-30 23:40:06 +01:00
a0f41a4fd1 Merge branch 'master' into geometry-nodes 2020-11-30 17:36:14 -05:00
ea064133e5 UI: Add Sculpt Session info to stats
This adds the vertex and face count info to the scene stats in sculpt
mode. These stats count the active vertices and faces in the
sculptsession for the active object. This has the following advantages:
- It is possible to know how many vertices the sculptsession has active
comparted to the vertex count of the entire scene from sculpt mode
- When sculpting with constructive modifiers, these stats will report the
number of vertices that you can actually sculpt with, instead of the
vertex count of the modified mesh and the entire scene.

Reviewed By: sergey, dbystedt

Differential Revision: https://developer.blender.org/D9623
2020-11-30 23:35:39 +01:00
6b12dad190 Cleanup: Use LISTBASE_FOREACH for node tree sockets RNA code 2020-11-30 16:39:07 -05:00
7aa47cd6ff Merge remote-tracking branch 'origin/master' into geometry-nodes 2020-11-30 20:25:59 +01:00
007a0e43a0 Cleanup: Reduce variable scope in node drawing code
Also use LISTBASE_FOREACH in a few places and generally clean up
the code for the two sidebar panels "Sockets" and "Interface".
2020-11-30 13:56:46 -05:00
5a35e56bcb Cleanup: Remove unecessary code.
We already `memset` the whole mesh runtime to zero, no need to set some
of its pointer explicitly to NULL afterward.
2020-11-30 19:47:42 +01:00
814b2787ca Fix T83196: bad matrix to quaternion precision near 180 degrees rotation.
Adjust the threshold for switching from the base case to trace > 0,
based on very similar example code from www.euclideanspace.com to
avoid float precision issues when trace is close to -1.

Also, remove conversions to and from double, because using double
here doesn't really have benefit, especially with the new threshold.

Finally, add quaternion-matrix-quaternion round trip tests with
full coverage for all 4 branches.

Differential Revision: https://developer.blender.org/D9675
2020-11-30 21:46:45 +03:00
6022103264 Cleanup: Clang tidy void argument 2020-11-30 13:44:58 -05:00
c0677b662f Fix T83177: Industry Compatible keymap: MMB-dragging to transform engages axis-constraining on release
Release confirm did not consider modal keymap events.
2020-11-30 14:50:35 -03:00
3bdc42f97a Fix T82996: Library Overrides: Duplicate of overridden collection on Resync
Properly use given reference pointer in
`lib_override_library_create_post_process` when it is a Collection one
too.
2020-11-30 17:19:27 +01:00
a7cf6ad547 Fix (unreported) broken logic in BKE_collection_add_from_collection.
That function was adding given new collection to all ancestors of the
reference one, instead of only to its immediate parents.
2020-11-30 17:19:27 +01:00
c760ab0dda Cleanup: Graph Editor, refactor selection operators
Extract initialisation code of box selection into separate functions.

No functional changes.

Reviewed By: zeddb, sybren

Differential Revision: https://developer.blender.org/D9196
2020-11-30 17:14:55 +01:00
1ecc2b305d Cleanup: add a comment 2020-11-30 16:43:08 +01:00
f7d9ec6a40 Merge branch 'master' into geometry-nodes 2020-11-30 16:34:16 +01:00
7c4c6809b9 Cleanup: correct function name 2020-11-30 16:33:37 +01:00
8c74c35ecb Fix T81628: Moving Python-made channels freezes Blender
Fix various problems in the Action Group rearranging code. All fixes are
necessary to resolve the bug.

- Before groups are rearranged, the channels are moved into their
  respective groups (so no longer referenced by `action->channels`). A
  temporary group is made for ungrouped channels. The code made
  assumptions about the channels being in the same order as the groups;
  that assumption has been removed.
- Looping over channels in an Action Group should stop when reaching the
  last channel, and not until `NULL`.
- After all the reshuffling is done, the `action->channels` linked list
  wasn't terminated properly. Now `first.prev` and `last.next` are set
  to `NULL` to avoid infinite loops.
2020-11-30 16:30:44 +01:00
ed9b70393c Cleanup: Animation, clean up action group rearranging code
Some minor cleanups to make an upcoming bugfix easier.

No functional changes.
2020-11-30 16:30:44 +01:00
0f30edc20c Tracking: Make image accessor own what it needs
Previously image accessor was sharing array pointer for tracks access.
Now it is possible to pass a temporary array valid only during the
initialization process.

Should be no functional changes.
2020-11-30 16:24:11 +01:00
13ce25d24c Tracking: Clarify tracks and options storage once again
This is something not-so-trivial to see from just reading code, which
shown an important of proper comments and clear naming.

Main source of confusion was that it is not immediately clear that
AutoTrack context is to see all tracks, but tracking to only operate on
selected ones.
2020-11-30 16:24:11 +01:00
69f4088ba1 Geometry Nodes: Change modifier name
The modifier was called "Empty", which reflects the fact that the modifier
doesn't do anything when you add it. However, that is not true after you
change the modifier's node group, and the fact that the modifier uses
nodes is the one thing that distinguishes it at this point. This commit
changes the name to "Geometry Nodes", which is simple and consistent
with the "Geometry Node Editor" and the naming of the project so far.
2020-11-30 10:23:57 -05:00
83c872085d Windows/Ninja: allow parameters for rebuild.cmd
The windows build leaves a convenience helper script
in the build folder called, rebuild.cmd. This change
passes any parameters you give rebuild.cmd to ninja
so you can easily pass it additional parameters without
having to edit the batch file manually.
2020-11-30 08:22:50 -07:00
9081b80d15 GPencil: New operator to reset Vertex Colors
This operators reset the vertex color information of the strokes.

If nothing is selected, all strokes are reset. If any is selected, only selected strokes are reset.

Also added a new menu Paint in Vertex Color mode.

Differential Revision: https://developer.blender.org/D9647
2020-11-30 15:52:44 +01:00
f280300b6a Tracking: Cleanup, remove unused argument from image accessor 2020-11-30 15:50:21 +01:00
ba3bf822a1 Tracking: Cleanup, remove unused field
Was re-introduced after previous round of cleanups when was merging
refactor and master branches.
2020-11-30 15:44:42 +01:00
ecfacb7706 Tracking: Cleanup, use explicit frame match option
No functional changes, just allows to potentially extend the options
in the future, and also makes code more explicit.
2020-11-30 15:03:31 +01:00
c949062c6e Tracking: Cleanup pattern match DNA definition
Wrong comment was used for enumerator.

Also made it a real typed enumerator to ease use in the implementation
code.

Should be no functional changes.
2020-11-30 14:58:12 +01:00
f61ad0e101 Fix T83203 BGL: shader.program wrongly always returns 0
This was a leftover from the 2.91 GPU module refactor.

This is an exception that should be removed when we remove BGL.
2020-11-30 14:55:46 +01:00
6fba2726c7 Tracking: Cleanup, finish pass of comments in the context
Some fields are still not really documented, but they are subject of
refactor/fix which will happen shortly.
2020-11-30 14:48:48 +01:00
2f08906c47 Tracking: Cleanup, replace clip user with frame number
Makes it more clear from intent and usage point of view.
The user was not used for anything else than frame number.
2020-11-30 14:44:51 +01:00
9d3b6f75a1 Tracking: Cleanup, more clear variable naming
A no-functional-followup of the previous commit.
2020-11-30 14:40:00 +01:00
d61a6a8cc3 Tracking: Fix missing frame remap for plane tracks
Tracking track which is used for plane track and movie clip having
a scene frame offset would have trigger re-calculation from a wrong
frame.
2020-11-30 14:36:03 +01:00
88289d8f84 Tracking: Cleanup, clear variable names and indentation
Should be no functional changes.
2020-11-30 14:25:42 +01:00
8dac88b54a Tracking: Cleanup, unused field in autotrack context
Was only assigned to truth, always. Never read back.
2020-11-30 14:13:34 +01:00
Yevgeny Makarov
9306e01b10 Fix T82870: on macOS, continuous grab jumps when crossing editor border
The event queue can contain events from before pointer warping, ignore those
now. This is an old issue, but became more common now that we disabled event
coalescing and started using the event mouse location rather than the current
mouse location.

Thanks to Yevgeny Makarov and Nicholas Rishel for helping solve this.

Ref D9662
2020-11-30 13:41:38 +01:00
2a430a670c Tests: blacklist failing tests for Cycles CUDA and OptiX devices
Blacklist a bunch of tests on the GPU, which are known to currently have
differences with CPU. These can be enabled as they are fixed or the test
is modified to give compatible results when there are known limitations.

OSL tests were also moved to their own directory since those are not
supported on the GPU.

Ref T82193
2020-11-30 13:40:33 +01:00
dd391d38f6 Tests: add CMake option to run Cycles regression tests on GPU devices
CYCLES_TEST_DEVICES is a list of devices (CPU, CUDA, OPTIX, OPENCL). It is set
to CPU only by default.

Test output is now writen to build/tests/cycles/<device>, and the HTML report
has separate report pages for the different devices, with option to compare
between CPU and GPU renders.

Various GPU tests are still failing due to CPU/GPU differences, these are to be
fixed or blacklisted still.

Ref T82193
2020-11-30 13:40:33 +01:00
c986e46be7 Cleanup: avoid harmless but unnecessary float division by zero 2020-11-30 13:40:33 +01:00
057c15b549 Libmv: Add threading primitives
Allows to use mutex, scoped_lock, and conditional_variable from within
the libmv namespace.

Implementation is coming from C++11. Other configurations are easy to
implement, but currently C++11 is the way to go.
2020-11-30 12:12:39 +01:00
0f0c982ff4 Libmv: Add build configuration header
Allows to easily access build platform information, such as bitness,
compiler, supported C++ version and so on.
2020-11-30 12:12:39 +01:00
d3dd61aab3 Libmv: add missing files to bundler
Bundler wouldn't be able to pull changes form upstream until all the
changes are upstreamed, but is better to have information consistent.
2020-11-30 12:12:39 +01:00
eb9402996e Merge branch 'master' into geometry-nodes 2020-11-30 10:27:15 +01:00
Monique Dewanchand
c751d40e07 Cleanup hardcoded render percentage to factor conversion
During revision of {D8952} one of the comments was to make a function that converts the render percentage to a factor. This to avoid code duplication. However the duplicated code was already all over the compositor code. So in order to avoid this code duplication for {D8952} I propose to first cleanup the duplicated code and build patch {D8952} based on this clean up.

The method that converts the render percentage to a factor is put in the CompositorContext. Why? The CompositorContext keeps DNA information like the renderdata. DNA, and thus the CompositorContext, keeps the size of the render resolution in percentage (user oriented). The compositor needs the size of the render resolution as a factor. So the CompositorContext seems like the obvious place to have this conversion method.

Why not in de NodeBase? The method could've been added to the nodebase, but I wanted to keep the nodebase as clean as possible and not put simple "conversion" methods into this base class. Also I didn't really like the call flow: you'd always have to get the renderdata size from the context and then convert.
Putting it in the CompositorContext avoids this extra invoke of a call.

Why not in the Converter? See nodebase. And the Converter seems more like a class for "structural" and complex node tree conversions. Not the simple conversions.

Reviewed By: Sergey Sharybin

Differential Revision: https://developer.blender.org/D9566
2020-11-30 08:00:40 +01:00
f38cd7e188 RNA Manual Reference: Update 2020-11-29 22:01:23 -05:00
dc40bea003 Cleanup: Use LISTBASE_FOREACH macro in screen.c
This commit replaces while loops and for loops with the equivalent
macro. This results in much more readable code in some places,
and it's now more apparent when the situation is more complicated
than just iterating through a linked list.
2020-11-29 20:30:11 -05:00
748f468fdc Cleanup: Use "region" for ARegion variable names
As proposed in T74432 and already implemented in several commits,
"region" is the preferred name for `ARegion` variables, rather than
any variant of "ar". This commit changes a few "ar" variables that have
popped up over time and also adjusted names of variants like "arnew".
2020-11-29 18:10:47 -05:00
dca9aa0053 Deps: PugiXML 1.10
This separates out PugiXML that was previously
bundled by OIIO.

As this linux/mac libs are not available
this commit only contains the builder and windows
changes, and the option to enable pugixml is
guarded by a platform if, this can be removed
once all platforms have committed the svn libs.

For details see D8628
2020-11-29 14:01:33 -07:00
176324aa5c QuadriFlow: Fix std::allocator deprecation warnings
https://en.cppreference.com/w/cpp/memory/allocator/construct
"(deprecated in C++17) (removed in C++20)"
Same for `destroy`.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D9657
2020-11-30 00:46:27 +05:30
11f0169e88 Run clang-format to fix line length after D8915. 2020-11-29 17:26:33 +03:00
Rebecca Dengate
13c820d87b CMake/macOS: Use custom LIBDIR if set on CLI
Reviewed By: ankitm
Maniphest Tasks: T83174
Differential Revision: https://developer.blender.org/D9664
2020-11-29 13:34:33 +05:30
458d8a423a Speed up finding patch components in new boolean.
By checking if a cell has already been processed in the finding patch
component code, an enormous speedup happens. This only will be
noticeable if there are lots of patches, and some cells with a
large number of patches.
2020-11-28 14:27:10 -05:00
1169507308 Speedups for finding cells in new boolean.
In case where there are coplanar instersections where
each part has a lot of triangles, the finding-cells algorithm was
very inefficient. This uses a Set instead of a Vector to keep track
of a cell's patches, avoids going through all patch x patch combinations,
avoids going through all patches to renumber after a merge, and
merges smaller patch-sixe cells into larger ones.
All this reduces the time to find cells in the cited case by a factor of 10.
2020-11-28 13:26:52 -05:00
566e7e6145 Fix Auto Clamped limits when smoothing the transition of cyclic curves.
The value of l[count-1] should be ready by the time hmin/hmax is computed.
Otherwise the left limit for the transition key would be scaled wrong.
2020-11-28 15:54:18 +03:00
c99d767735 Fix some naming and comments in F-Curve smoothing code. 2020-11-28 15:54:18 +03:00
b3f20eed6e Fix T83023: incorrect shape of cyclic F-Curve with only two points.
The equation solver didn't handle the one unknown case correctly.
2020-11-28 15:54:17 +03:00
f8553de2cd GPencil: Fix unreported vertex size for Bezier handles
By error, the Bezier points were using the mesh vertex size, not the grease pencil vertex size.
2020-11-28 11:10:35 +01:00
a7680e2bcf Merge branch 'master' into geometry-nodes 2020-11-27 19:44:56 +01:00
bc3b48400d Geometry Nodes: do not create geometry depsgraph relation for empty object
This resulted in a warning.
2020-11-27 19:44:06 +01:00
659ef4938b Geometry Nodes: support muted nodes
The handling of muted nodes is handled at the derived node tree
level now. This is also where expanding node groups is handled.
Muted nodes are relinked and removed from the derived tree
during construction. The geometry node evaluation code does
not have to know about muted nodes this way.
2020-11-27 19:38:14 +01:00
683041fd48 Theme: Update shader node color to match socket color
Related to T82689

Reviewed by Brecht
2020-11-27 19:25:44 +01:00
39ee0a5484 UI: Update node socket colors
Note: This also changes the Shader socket color, to match "Shading" in the Outliner.

Theme update for shader nodes will be committed separately.

Related to T82689
2020-11-27 19:07:50 +01:00
45e2c12124 Geometry Nodes: Fix building in Mac 2020-11-27 19:06:19 +01:00
c19b363256 Geometry Nodes: Support exposing string sockets to the modifier
Create a string IDProperty in the modifier initialized with the socket's
default value.
2020-11-27 12:21:08 -05:00
fbdf1af355 Fix T82758: Convert Proxy to Override: Local constraints aren't saved.
Ensure consistent order of pose bones. Now it should always match the
one from bones in armature obdata (as exposed by e.g. RNA, i.e.
children-first).

Previously when some pose bones would need to be added or removed from a
pose due to changes in the bone armature, or if bones in armature were
re-ordered, the bones order in pose would not match anymore the one from
armature, and could even become different between e.g. a proxy and its
linked source.

This was not really nice, but not a big issue before either. But with
diffing process of override, consistent order of items between reference
linked collection and local override one is crucial.

Reviewed By: #animation_rigging, sybren

Maniphest Tasks: T82758

Differential Revision: https://developer.blender.org/D9646
2020-11-27 16:18:59 +01:00
e4e7dfc1d8 Fix transform snap mixed with incremental
The incremental was taking priority but the other elements are mandatory.
2020-11-27 10:51:33 -03:00
f9e994d0f4 Fix T83092: Direction of rotation with View orientation changed in 2.91
The change was intentional so that the orientation matrices match
(`rv3d->viewinv` becomes equal to the orientation matrix).

But, although in a projection matrix the Z axis is negative, this
should not be so from the user's point of view.

So the solution here is to negate the Z axis when the View orientation
is chosen.

This affects all modes, but is only evident for rotation.

---
Another change here is to use the final rotation value (`values_final`)
for the gizmo drawing since this value can be changed by the mode.
2020-11-27 10:41:33 -03:00
24e57eea43 Fix T82156: Object with constraints translates when parented
Avoid the evaluation of constraints when computing the parent-inverse
matrix.

Constraints are meant to be evaluated last; object transforms are
computed this order:

1. `parent->obmat` (the parent object's world matrix)
2. `ob->parentinv` (the object's parent-inverse matrix)
3. Object's loc/rot/scale
4. Object's constraint evaluation

When the constraints are used to compute the parent-inverse matrix,
their effect is moved from step 4 to step 2 in this list, potentially
rotating or scaling the object's local transform. This causes unwanted
movement as reported in T82156.

Reviewed By: looch

Differential Revision: https://developer.blender.org/D9413
2020-11-27 12:11:43 +01:00
e4b6afbe6b Cleanup: Animation, clean up FCurve Cycles modifier
Simplify conditions and declare variables `const` where possible.

No functional changes.
2020-11-27 10:15:20 +01:00
45dca05b1c Cleanup: Add r_ to return parameter
Prefix a return parameter with `r_` to follow the style guide. No
functional changes.
2020-11-26 20:37:54 -07:00
ab4654cdfe Cleanup: Move logic to outliner_find_item_at_x_in_row
Move the logic for determining if the item at a given x position is an
icon into the function. This is used for determining selection over an
icon, and will be used in a later commit for checking for hover over an
icon. No functional changes.
2020-11-26 20:37:21 -07:00
1709bc5164 Add performance timing to mesh_boolean.cc.
You can uncomment the PERFDEBUG define to get timings.
2020-11-26 18:29:11 -05:00
64b58888fb Sculpt: Refactor transform code to allow incremental updates
This adds support for incremental updates in the sculpt transform
code. Now tools can define if they need the displacement applied
for the original coordinates or incrementally.

This is needed for features like elastic transform or cloth deformation
target in the transform tool.

No functional changes.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9547
2020-11-27 00:18:41 +01:00
abe38ee033 Geometry Nodes: fix when vertex group exists but there are no MDeformVerts yet
The `mesh->dvert` array is only allocated when needed. Just creating a new vertex
group without any vertices in it, does not trigger the allocation.
2020-11-26 22:52:16 +01:00
26eb8d6aa0 UI: Use decorators in volume modifiers
This is consistent with the UI for other modifier types.
2020-11-26 12:56:12 -05:00
d40126d636 Geometry Nodes: Use ID template node group selector in the modifier
This puts the same controls as in the node editor header
in the modifier panel.
2020-11-26 12:49:09 -05:00
1bb864e40a Geometry Nodes: use attribute span api in Join Geometry node
Copying over attributes from the original geometries to the new
geometry only takes ca. a third of the time compared to before.
2020-11-26 18:37:39 +01:00
0d97c0dfa6 Geometry Nodes: use attribute span api in random attribute node
This results in a ~30% speedup. The execution time is bounded
by the random number generator here.
2020-11-26 18:22:21 +01:00
76d78c9212 Cleanup: correct comment 2020-11-26 18:20:46 +01:00
d1eec74c56 Geometry Nodes: use attribute span api in attribute math node
For a simple add operation, this results in a 3-4x speedup.
2020-11-26 18:12:31 +01:00
ac257864a6 Geometry Nodes: support accessing attributes with spans
Before, attributes could only be accessed via setter and getter functions.
While this works well, it can be cumbersome and slow.
It would be better if most code could just operate on the underlying
attribute array directly. The issue is that some attributes are currently
not stored in plain arrays (e.g. vertex positions, vertex groups, ...).

This patch implements a solution where these "special" attributes are
converted into a temporary array for easy access and then copied
back into their correct form after all modifications are done.

Attribute accessors now have a `get_span` and `apply_span` method,
which can be used exactly for that purpose. In the case of attributes
that are plain arrays internally, only small constant overhead is added.
2020-11-26 18:11:03 +01:00
6d0e92cf0a Geometry Nodes: protect object from instancing itself directly
This is not a perfect check, because it does not check instances recursivly.
However, it helps protect us from the most common mistake.
2020-11-26 18:03:10 +01:00
226b028523 GPencil: Cleanup - Remove unused old shaders
These fill shaders were used with the old draw engine.
2020-11-26 17:44:43 +01:00
9add12ff05 Transform: Improve event detection for AutoConstrain
The event "value" is not really required since this operation works as a toogle.

This change cleans and simplifies the code.
2020-11-26 13:42:56 -03:00
dd0e2da00e Cleanup unintentional change in rB8a2270efc52a
Note that the whole thing need to be redone/properly fixed, but this is
a bit more complicated so for now fix in  rB8a2270efc52a is 'good
enough'.
2020-11-26 17:30:20 +01:00
841ae18605 Fix T83055: setting rna pointer properties can create bogus custom properties
This was reported in the form of the eyedropper of the 'Parent' property
creating a custom property 'parent' if self was picked.

Problem arises when certain checks for setting rna pointer properties
failed (for example: the PROP_ID_SELF_CHECK check) and then a different
code path was entered (which was only meant for IDProperties).

Problem was introduced in rBa7b3047cefcb.

To solve, now first enter the branch for rna-based pointer properties,
then perform the sanity-checks (and if these fail: dont enter the other
unrelated codepath but instead do nothing)

Maniphest Tasks: T83055

Differential Revision: https://developer.blender.org/D9652
2020-11-26 17:18:48 +01:00
4b248c1658 Fix T82729: Crash in rna_EffectorWeight_path when object has fluid and
dynamic paint modifiers

Looks like prior to the introduction of mantaflow, the former
SmokeModifierData always had a domain initialized (even if its type was
set to None). Since mataflow, the FluidModifierData type needs to be set
to MOD_FLUID_TYPE_DOMAIN (otherwise domain is invalid)

Maniphest Tasks: T82729

Differential Revision: https://developer.blender.org/D9644
2020-11-26 16:57:02 +01:00
87030d8be5 Fix T83046: Material change not updating in the link of an override.
Code was actually not applying any override operation over linked data.

Reasonn behind that was that if library file is saved with latest
override applied then this is not needed, since data saved for the
override in the lib file is already up to date.

But this is actually fully breaking in case someone update the lib file
of the lib file, without re-saving the libfile itself.

So now we alwaya apply overrides also on linked data.

Note that this will not fix the case where a resync is needed.
2020-11-26 16:43:31 +01:00
4705fafa7e UI: Fix incorrect offset for panel label when zooming in
The panel title text intersected any buttons in the header because
the label offset retrieved from the layout code was not scaled by
the block's zoom level. Error in rB0d93bd8d63980.
2020-11-26 10:29:03 -05:00
44f5d99cbf Fix T83020: Transform: AutoConstraint being confirmed without releasing the MMB
The transform modifiers are confirmed by releasing any button.

Thus, the operation can be falsely confirmed if the button that launched
the operation is released after the modifier has been activated.

Previously the events that confirmed the modifiers were hardcoded.

An option to fix this would be to add custom confirmation keyitens for
specific modifiers. But this can be a bit confusing and would make the
modal keymap even bigger.

So the solution here is to skip the button that launched the operation
when confirming the modifier.
2020-11-26 11:42:28 -03:00
881e148cc5 Geometry Nodes: maintain some more data in the Join node
Material indices and smooth states are not destroyed anymore.
If the two incoming meshes use different materials, the materials of
the first input will be used. This is obviously not ideal, because the
second input might change its material.

In the future we want to handle that differently and keep both materials,
but for now this is consistent with the boolean node.
2020-11-26 15:33:59 +01:00
4a647ee188 Geometry Nodes: update normals after transforming mesh
This is not done in `BKE_mesh_transform`.
2020-11-26 13:46:50 +01:00
Joseph Brandenburg
849debe36c Fix T80970: Copy Rotation constraint incorrect under shear
Orthogonalize the constraint target's matrix before decomposing it into
Euler angles. This removes sheer, and is actually a requirement for
correct decomposition.

It's conceivable that someone has used the incorrect behaviour in a rig.
As the shear caused unpredictable flipping of the constrained object,
this is unlikely.

Reviewed By: angavrilov, sybren

Differential Revision: https://developer.blender.org/D8915
2020-11-26 13:12:13 +01:00
781429a8b0 Cleanup: clearer marking of what was changed in GTestAddTests.cmake
Replace `Blender` with `BLENDER` so that it's more clearly a marker, and
not just the name.

No functional changes.
2020-11-26 13:05:46 +01:00
622b7fff15 Geometry Nodes: fix computing bounding box of evaluated point cloud
Currently, the bounding box does not include instances. This is consistent
with other object types.
2020-11-26 12:32:08 +01:00
Stefan Werner
0062b34e94 macOS: Patch OpenImageIO's ustring for ARM.
OpenImageIO's ustring makes assumptions about the interals of
std::string which aren't true on macOS/ARM. A patch for OpenImageIO
addresses this for macOS/ARM builds only, at the expense of potentially
duplicated allocations of strings.
2020-11-26 12:22:56 +01:00
Stefan Werner
05f410dd84 macOS: Added new location for Homebrew.
The build script for macOS dependencies expects to find bison provided
by Homebrew under /usr/local. Since the default install location for
Homebrew changes on macOS/ARM, the script now looks at the host
architecture and switches to /opt/homebrew on Macs with Apple Silicon.
2020-11-26 11:30:53 +01:00
8a2270efc5 Fix T81265: Animation is not evaluated when collection is included into view layer.
Just tag objects in un-excluded viewlayer for animation update.
2020-11-26 11:08:51 +01:00
774d18804f Fix T82452: Outliner: Cyclic "Original ID" panel in Data API.
I cannot think of any case where we'd want to show this pointer in UI
anyway, so just tag it with `PROP_HIDDEN`.
2020-11-26 10:46:35 +01:00
e09d0c0d07 Fluid: Updated Mantaflow source files
This update introduces two improvements from the Mantaflow repository:

(1) Improved particle sampling:
- Liquid and secondary particles are sampled more predictably. With all parameters being equal, baked particles will be computed at the exact same position during every bake.
- Before, this was not guaranteed.

(2) Sparse grid caching:
- While saving grid data to disk, grids will from now on be saved in a sparse structure whenever possible (e.g. density, flame but not levelsets).
- With the sparse optimization grid cells with a value under the 'Empty Space' value (already present in domain settings) will not be cached.
- The main benefits of this optimization are: Smaller cache sizes and faster playback of simulation data in the viewport.
- This optimization works 'out-of-the-box'. There is no option in the UI to enable it.
- For now, only smoke simulation grids will take advantage of this optimization.
2020-11-25 23:18:12 +01:00
Erik Abrahamsson
f7223d5f72 UI: Allow theming the alternate row color in the sequencer
Previously, the alternate row color in the Video Sequence Editor was
just a shaded version of the editor's background color. This makes it
theme-able just like in the file browser and outliner, although the
default color is very slightly different.

Differential Revision: https://developer.blender.org/D9634
2020-11-25 16:37:33 -05:00
05c4efc9b1 Fix Edit Face Set operator not being cancelled when the cursor is not over the mesh
If the cursor is not over the mesh, the operator was still using the
last Face Set ID updated by the drawing cursor code when the cursor was
over the mesh.

This now cancels the operator instead of modifying a Face Set that will
look random to the user.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9545
2020-11-25 22:22:12 +01:00
8b9b3d98e0 Rename use paint symmetry to use mesh symmetry in quadriflow
The original name was chosen because symmetry was a property of
the Paint struct. Now symmetry is a property of meshes, which
also makes the name of the property easier to understand.

Reviewed By: sergey, dbystedt

Differential Revision: https://developer.blender.org/D9618
2020-11-25 22:21:02 +01:00
6c241b2dd7 Geometry Nodes: Node editor header interaction with active modifier
This commit makes the way the selector in the middle of the node editor
header interacts with the active modifier much more intuitive.

 - With no active modifier, or when the active modifier is a non-node
   modifier, the "new" operator adds a new nodes modifier.
 - With an active node modifier, the drop-down affects the modifier's
   selected node group.
 - With no active object, there is no drop-down in the header.
 - The node editor's node group always updates, even when there is no
   active modifier.
 - Pinning disables the drop-down and keeps the same node group
   selected, regardless of the context.

This is designed to work similarly to materials and material slots,
which should be familiar to any Blender user. One workflow not allowed
by this design is editing any geometry node group, regardless of the
context, but if that turns out to be an issue it should be solved in a
similar way for all node editors.
2020-11-25 15:34:29 -05:00
41a73909de Cleanup: Typo in print_default_info function name. 2020-11-25 20:45:47 +01:00
02a0f6b04a Fluid Particles: fix viscoelastic spring threading crash again after D7394.
Since D6133 fluid particle code uses thread local storage to collect
springs created during a time step before adding them to the actual
spring array.

Prior to the switch to TBB there was a single finalize callback which
was called on the main thread, so it could use psys_sph_flush_springs
and insert the new entries into the final buffer. However in D7394 it
was replaced with a reduce callback, which is supposed to be thread
safe and have no side effects. This means that the only thing it can
safely do is copy entries to the other temporary buffer.

In addition, careful checking reveals that the 'classical' solver
doesn't actually add springs, so reduce isn't needed there.

Differential Revision: https://developer.blender.org/D9632
2020-11-25 22:31:47 +03:00
c1b655c06a Geometry Nodes: Improve wording of modifier error messages
- Don't use contractions
- Remove unecessary words
2020-11-25 13:32:36 -05:00
8330e19cb2 RNA Armature: Improve the description of AxisRollFromMatrix
The roll value may not be as expected when a matrix is not orthogonal
or has a negative determinant.

This can lead to confusion as seen in T82930.

Therefore, make it clear that this is a limitation and that a value for
the roll is somewhat indeterminable in these cases.

This fixes T82930
2020-11-25 13:55:05 -03:00
b4f3c3cca0 Geometry Nodes: Use context for active modifier operators
This adds "modifier" as a new context variable in the property editor.
It is used instead of getting the active modifier directly. This way it
displays in the breadcrumbs panel, and the variable can be set only
in the modifier tab, meaning it won't work from the shortcut even
when the modifiers aren't visible.
2020-11-25 11:46:02 -05:00
e3f8ffc482 Cleanup: avoid very generic using-namespace statements 2020-11-25 16:47:09 +01:00
559999b2f5 Cleanup: minor changes 2020-11-25 16:17:58 +01:00
f67f895770 GPencil: Disable vertex color when use holdout
If the material has the holdout enabled, the value of the vertex color must not be used.
2020-11-25 16:01:30 +01:00
257725f829 Geometry Nodes: hide domain enum from random attribute node
While we can support different domains already in this node, there is not
really anything you could do with that data yet. It can be added back when
there is a use case for it.
2020-11-25 15:57:41 +01:00
b356288a75 Geometry Nodes: change builtin attribute names based on T82693 2020-11-25 15:55:29 +01:00
d344d25b7b Geometry Nodes: simplify Attribute Math node by using a new abstraction 2020-11-25 15:40:33 +01:00
8742bbd607 Nodes: simplify Math code by using new abstraction layer 2020-11-25 15:39:42 +01:00
3576e669cb Nodes: initial abstraction to simplify math node implementations
Currently, implementing a node that supports math operations requires
you to write a long switch statement. The goal of this abstraction
is to reduce the number of these switch statements.

Note, this commit adds new such long switch cases. However, in the upcoming
commits existing math nodes are updated to use this abstraction, resulting in
less code overall.
2020-11-25 15:38:08 +01:00
044def82b9 Geometry Nodes: add utility method to create a dummy attribute reader
This can be used when instead of an actual attribute, a constant value
should be used.
2020-11-25 15:31:56 +01:00
436fd5663e Fix T82988: Div by zero with curve deform modifier
In `calc_curve_deform` a factor is calculated without checking if
the divisior is zero or close to zero. This patch adds the missing
checks and sets the factor to zero if the division shouldn't be
computed.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9645
2020-11-25 15:18:18 +01:00
4a179e8e3e Atomics: Fix missing 64bit implementation for 32bit platforms
Blender uses 64bit atomics to manipulate SessionUUID, and these atomics
were not defined on any of 32bit platforms.

While official support is limited to 64bit platforms only, the code
should not make assumptions about bitness or endianess, in terms that
there should be codepaths and fallback (or provision of them) for 32bit
platforms.

This change makes 64bit atomic functions defined for all platforms.
The atomic_test was compiled and successfully tested on i686 and armv7l
platforms. The rest of compilation process of Blender will be very
tedious, so that was not done.

This change is essential, but not necessarily enough to make Blender
compilable on i686 (ability to compile Blender on 32bit platforms was
lost during the 2.91 development).

This is a functional part of original fix done by Brecht in D9577.
2020-11-25 12:43:43 +01:00
4323886123 Atomics: Cleanup, move defines closer to usage
There is a special defines block needed for ARM on Linux. Move it from
public header to an implementation file.

No functional changes.

This is a non-functional part of original fix done by Brecht in D9577.
2020-11-25 12:43:43 +01:00
92d12741a5 Merge branch 'master' into geometry-nodes 2020-11-25 12:27:44 +01:00
1c86d32fa7 Nodes: deduplicate ping pong math operation
The formula did not change. The only side effect of this change should be
that the compositor node now does not divide by zero in some cases.
2020-11-25 12:24:44 +01:00
9e77fc533c Cleanup: remove useless cast. 2020-11-25 11:19:28 +01:00
b1533f8fa4 Tracking: Cleanup, de-duplicate implementation of marker lookup
The logic was duplicated.

Should be no functional changes. The modified function is expected
to give same exact results for all inputs.

On the "caching last-used track" topic. The code was using last_marker
to allow faster lookup of marker closest to the frame. With this
change it is still the case since the BKE_tracking_marker_get() does
cache last used marker.
2020-11-25 09:37:24 +01:00
41a74159c3 Geometry Nodes: Fix missing node editor redraw for active modifier
When the active modifier changes, or when its node group changes, the
node editor should redraw, because these actions change its context.
2020-11-24 17:38:53 -05:00
8a2b329a21 Geometry Nodes: Always use the active modifier for shortcuts
Based on discussion with the team, summarized in T82691, it makes sense
to simplify the shortcut behavior and remove the way the shortcuts
currently activate on hover if there is no active modifier. This commit
also removes the behavior of clearing the active modifier when you
click on blank space in the modifier tab.
2020-11-24 16:57:45 -05:00
268508d2b0 Geometry Nodes: Make next modifier active when deleting
Previously it was the previous modifier, but this change keeps the index
of the object's active modifier consistent when deleting a modifier.
2020-11-24 13:52:20 -05:00
ce08a2bd48 Merge: fix after merge
This was part of rBe922dd7d8a307c54d49bc01649a12610b022192b.
2020-11-24 18:12:47 +01:00
7585f55a4c Merge branch 'master' into geometry-nodes 2020-11-24 18:05:31 +01:00
e922dd7d8a Viewport: cannot select object by clicking on its instances
Selecting an object by clicking on its instances only worked,
when the object itself is visible. However, it is possible to hide
the object and still keep the instances visible.

The solution is to give every object the correct `select_id` in the
depsgraph object iterator right before rendering.

Reviewers: fclem, brecht

Differential Revision: https://developer.blender.org/D9640
2020-11-24 17:32:56 +01:00
256a9d983d Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-24 16:05:58 +01:00
49f1c8ebec Geometry Nodes: remove attribute name inputs from Instancer node
The node now assumes that the data is found in the
"Position", "Rotation" and "Scale" attribute.
Those names might change soon.
2020-11-24 14:30:37 +01:00
9831362243 Geometry Nodes: rename Join to Join Geometry 2020-11-24 14:21:54 +01:00
278011e44d Fix T80748: Render Emissive Colors in Compositor Backdrop
This change will use the image engine to draw the backdrop of the compositor. With this patch the alpha blending will be done in Linear Scene Reference space and shows pure emissive colors.

See differential for an example image.

**Technical changes**

As only the backdrop drawing is done using the draw manager there are some technical changes.
1. The overlay buffer is partly drawn outside the draw manager. When drawing the backdrop image the overlay buffer needs to be masked to simulate premultiplied alpha under.
2. The backdrop of the node editor is done in region pixel space. A `DRWView` is constructed with this space.
3. UDIM textures uses world position to generate the UV coordinates. This has been implemented more strict by the `IMAGE_DRAW_FLAG_USE_WORLD_POS`. When the flag isn't used the local coordinates are used to generate the UV coordinates what is image space.
4. The draw manager now checks the actual `eSpaceType` of the space data to use different code paths. In the future the movie clip editor will be added.

NOTE: The preview images in nodes are drawn in display space and cannot show pure emissive colors. As preview images are used on more locations it is best to fix this in a separate patch.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9451
2020-11-24 13:22:17 +01:00
82cc21d5e4 Fix T77261: Multires creates spikes when subdividing ngons
The spikes were caused by non-initialized tangent matrix used during
smoothing process. The reason tangent matrix was not initialized was
because wrong usage of API: n-gons should pass corner of 0 to the
matrix construction function.

Corrected usage of the API and added assert() to help catching such
kind of non-initialized issues easier.
2020-11-24 12:40:42 +01:00
31bf8307af Graph Editor: fix keyframe not activating in certain cases
When clicking on an already-selected keyframe, mark it as active if the
click caused the previously-active keyframe to become deselected.

When clicking on a key in the graph editor, it is selected and all other
keys are deselected. If that key was already selected before the click,
it would not become the active keyframe. This is now fixed.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D9639
2020-11-24 12:27:43 +01:00
710842cd1d Geometry Nodes: only output new data from Distribute and Instance nodes
This can be recombined with the original data using a
Join node if necessary.
2020-11-24 11:50:49 +01:00
bb5c4de009 Fix T82962: Crash changing lattice resolution with Vertex Group
Regression introduced by {rB042143440d76}. The deform group lookup was
performed on the wrong object. Before the lookup was performed on
the lattice object. This patch changes this back.

Reviewed By: Bastien Montagne

Differential Revision: https://developer.blender.org/D9638
2020-11-24 11:46:38 +01:00
433fcbec1a Cleanup: clang tidy 2020-11-24 11:42:57 +01:00
aca8eadb63 Animation: Remove debug prints
Remove accidentally-commited debug prints.

No functional changes.

Reviewed by: sergey

Differential Revision: https://developer.blender.org/D9637
2020-11-24 11:13:43 +01:00
e74f61b49a Fix Python API docs for the render API
The API doc for free_blender_memory() was used in
get_preview_pixel_size()

Issue introduced in 5494683651.
2020-11-24 10:42:28 +01:00
ef1ee262ad Fix Compilation Error
GCC showed this as a warning, MSVC as an error.
2020-11-24 08:45:32 +01:00
037ce662e5 Outliner: Switch properties tabs only on icon click
According to feedback the outliner to properties editor tab switching
was annoying when it always changed tabs on selection, especially for
selecting individual objects. This limits the tab switching behavior to
only when the icons in the outliner are selected.
2020-11-23 22:21:02 -07:00
72386c64ef UI: Improvements to interaction with active modifier
This commit includes these improvements to operators and how they
relate to the active modifier:

 - Shortcuts performed while there is an active modifier will affect
   only that modifier.
 - Clicking anywhere on the empty space in a modifier's panel will make
   it active.
 - Clicking anywhere in the empty properties space will clear the
   active.

These changes require some refactoring of object modifier code. First
is splitting up the modifier property invoke callback, which now needs
to be able to get the active modifier separately from the hovered
modifier for the different operators. Second is a change to removing
modifiers, where there is now a separate function to remove a modifier
from an object's list, in order to handle changing the active. Finally
the panel handler neeeds a small tweak so that this "click in panel"
event can be handled afterwards.
2020-11-23 22:38:12 -05:00
Yevgeny Makarov
d86fcde39c UI: Batch Rename Layout Improvements
Improvements to the layout of the Batch Rename dialog.

Differential Revision: https://developer.blender.org/D9496

Reviewed by Reviewed by Hans Goudey
2020-11-23 17:27:01 -08:00
Yevgeny Makarov
df31ecf0c3 UI: Add Trackpad Smooth Scrolling for Popovers
Adds smooth scrolling with the trackpad for popovers. Also fixes the position of the scroll arrows on high-DPI.

Differential Revision: https://developer.blender.org/D9533

Reviewed by Brecht Van Lommel
2020-11-23 17:22:20 -08:00
Yevgeny Makarov
b6a50b5dcb UI: Block Safety Not Scaled Correctly
Layout block safety sizes were not scaled correctly with interface scale.

Differential Revision: https://developer.blender.org/D9569

Reviewed by Brecht Van Lommel
2020-11-23 16:56:01 -08:00
246c11634f Speedups for new boolean. Better hash function for verts.
The existing hash function didn't work well with Set's method of
masking to the lower bits, because many verts have zeros in the
lower bits.
Also, replaced VectorSet with Set for Vert deduping.
2020-11-23 19:30:40 -05:00
e68e897077 Cleanup: Correct node name in definition function 2020-11-23 18:32:36 -05:00
52c6d36e4e Geometry Nodes: Initial implementation for attribute math node
This provide a simple implementation for basic math operations. Add,
subtract, multiple, and divide are implemented so far. Domain
interpolation is not implemented yet either.

This commit also adds two "Type" options to the node for choosing
explicitly whether to use an attribute or a float value as one of the
inputs. It is not possible to use two floats as inputs, because that
would be a regular math node.

Some cleanup to avoid some code duplication will come in a future
commit.
2020-11-23 17:01:53 -05:00
75a92d451e Geometry Nodes: new Join node
This node creates a new geometry based on two incoming geometries.
In the future the node ui can be extended to support more than two inputs.

The output geometry will have all the attributes of the inputs.
If both inputs have non-matching set of attributes, missing data is either
interpolated, type cast or zeroed.

Ref T82786.
2020-11-23 19:13:25 +01:00
d84bf961f8 Geometry Nodes: improve geometry component
* It now knows its own component type.
* Add virtual method to check if the component is empty.
* Add virtual methods to find all attribute names.
* Support adding existing components to a geometry set.
2020-11-23 19:05:27 +01:00
02d61faab0 Geometry Nodes: disable random attribute node when name is empty 2020-11-23 19:02:44 +01:00
7f4eb529c4 Geometry Nodes: duplicate referenced data layers in attribute api 2020-11-23 16:47:11 +01:00
Jeroen Bakker
b0a9081883 Fix T82884: Cycles Compilation Error OpenCL/NanoVDB
Recent changes introduced `acc` parameter into the texture read
functions. When nanovdb isn't enabled this leads to compilation errors
as the `acc` variable wasn't defined. OpenCL only compiles needed
features what made it more prominent.

Reviewed By: Patrick Mours

Differential Revision: https://developer.blender.org/D9629
2020-11-23 16:42:48 +01:00
Jeroen Bakker
8351760ed0 Cycles: Remove Compilation Warning
ROCm 3.9 already defined `NULL`. This patch will first check if it was
already defined to remove compilation warnings.

NOTE: This doesn't add official support for ROCm as it still fails to
render correctly (crashes with default cube).

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D9610
2020-11-23 16:36:15 +01:00
Christoph Lendenfeld
1f09dcc121 Cleanup: Animation, split graph_edit.c into separate files
Split some of the code of `graph_edit.c` into:
* `graph_view.c`: preview range, view all, view selected etc.
* `graph_slider_ops.c`: the decimate modal operator code.

The latter file will be extended later with more slider-based operators.

Maniphest Tasks: T81785

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9312
2020-11-23 15:26:54 +01:00
152754a477 Tracking: Cleanup, typos and spelling in DNA comments 2020-11-23 15:25:55 +01:00
e4ca1fc4ea Animation: New Euler filter implementation
This new discontinuity filter performs actions on the entire Euler
rotation, rather than only on the individual X/Y/Z channels. This makes
it fix a wider range of discontinuities, for example those in T52744.

The filter now runs twice on the selected channels, in this order:
- New: Convert X+Y+Z rotation to matrix, then back to Euler angles.
- Old: Add/remove factors of 360° to minimize jumps.

The messaging is streamlined; it now reports how many channels were
filtered, and only warns (instead of errors) when there was an actual
problem with the selected channels (like selecting three or more
channels, but without X/Y/Z triplet).

A new kernel function `BKE_fcurve_keyframe_move_value_with_handles()` is
introduced, to make it possible to move a keyframe's value and move its
handles at the same time.

Manifest Task: T52744

Reviewed By: looch

Differential Revision: https://developer.blender.org/D9602
2020-11-23 12:48:04 +01:00
1318eaf166 Cleanup: CMake: use string(APPEND..), not set(..)
Left out in {rB7f28a99dd5a57216fb477d844ae1fec5510ad5d5}
2020-11-23 16:34:17 +05:30
36426b0a68 CMake/macOS: Replace -Xlinker with -Wl.
Causes link issues on Xcode's "New Build System" which was introduced
in Xcode 10 and is default on Xcode 12.
https://devtalk.blender.org/t/16273

Differential Revision: https://developer.blender.org/D9624
Reviewed by: brecht, #platform_macos
2020-11-23 16:34:17 +05:30
18e768c78e Cleanup: improve naming convention for geometry node exec functions 2020-11-23 12:03:29 +01:00
64513df8b6 Fix T82849: Assert When Unlinking "Edit Source" Text Data-block.
Simplify and sanitize handling of usercounts for Text IDs generated
trhough `BKE_text_load_ex`.
2020-11-23 11:56:40 +01:00
26c7be27b7 Geometry Nodes: Add boilerplate code for attribute math node
This code doesn't actually do anything, but it provides a base for an
 implementation and exposes the the necessary interface to the UI.
2020-11-22 22:17:08 -05:00
e72b235fce Cleanup: Doxygen section formatting
Generally doxygen headers are title case and are styled like prose
rather than code.
2020-11-22 20:55:31 -05:00
8aea0e8ac2 Merge branch 'master' into geometry-nodes 2020-11-22 15:01:42 -05:00
2ce1b89d75 Merge branch 'master' into geometry-nodes 2020-11-20 16:01:32 -05:00
0649131be7 Geometry Nodes: Switch boolean node inputs
This changes the meaning of the order of the two geometry input sockets
to match the existing boolean modifier. The first socket is now the base
mesh and the second socket is the "cutter" geometry.
2020-11-20 15:20:03 -05:00
1bebd12eaf Cleanup: Use nullptr instead of NULL in C++ code 2020-11-20 15:10:51 -05:00
797c8f6d75 Geomtetry Nodes: Set node editor context from the active modifier
Similar to how the node editor context works for materials, this commit
makes the node group displayed in the node editor depend on the active
object and its active modifier. To keep the node group from changing,
just pin the node group in the header.

There are still missing updates when switching the modifier's node group.
2020-11-20 14:29:52 -05:00
1a67617631 Geometry Nodes: Expose the active modifier to the UI
This exposes the operator to set the active modifier as the type icon
in the header of the modifier panels. Tweaks to the widget drawing
code were necessary to use the red alert for non-emboss operator
buttons. Then, the panel for the active modifier gets a border around it
(which currently uses the property search theme color), requiring
an "active property" field in the PanelType struct.
2020-11-20 14:22:08 -05:00
c2359ff4aa Geometry Nodes: improve boolean node when not both inputs are connected
Previously, it was always outputting an empty geometry in that case.
This was confusing because e.g. the output of a union operation
with a single non-empty mesh is also non-empty.
2020-11-20 19:02:01 +01:00
763ebc3156 Geometry Nodes: use attribute name inputs in point instance node
This will probably not stay exactly like this, because it looks a bit ugly.
Adding this now, because it increases flexibility a lot and allows me
to test the attribute api a bit more.
2020-11-20 18:47:55 +01:00
f7d9bfafd9 Geometry Nodes: combine Vertex and Point domains
Originally, there were technical reasons for why two different domains
were used. Those reasons have been lost unfortunately, and there
don't seem to be any issues with combining the domains now.

This reduces confusion when users have to select the domain type
in enums.
2020-11-20 18:23:07 +01:00
088e6a5282 Geometry Nodes: initial support for implicitly type casting attributes
Those allows e.g. float attributes to be accessed as if they were vector attributes.
2020-11-20 18:10:24 +01:00
9798d68cc1 Geometry Nodes: simplify point instancer node 2020-11-20 17:45:12 +01:00
323335f076 Geometry Nodes: iterate on attributes api and improve random attribute node
Attributes can now be accessed through a GeometryComponent.
MeshComponent and PointCloudComponent implement the specific
attribute access mechanisms using virtual methods.

This simplifies code that should work on different geometry components
quite a bit, because it only has to be written once without using templates.
The Random Attribute node benefits from that a lot.
2020-11-20 17:35:45 +01:00
70d493e5ee Geometry Nodes: allow getting inputs without removing them
This is useful when one wants to get an input value multiple times.
2020-11-20 17:31:46 +01:00
87366baaed Functions: support lookup without extract in generic value map 2020-11-20 17:29:52 +01:00
8e1d7d9e8c BLI: add missing const 2020-11-20 17:29:21 +01:00
Léo Depoix
baa79dc805 Geometry Nodes: Add "Edge Angle" option to edge split node
Although disabling this option is equivalent to setting the edge angle
to 180 degrees, there is no great reason to change the settings from what
is exposed in the modifier.

Differential Revision: https://developer.blender.org/D9564
2020-11-20 09:45:45 -05:00
3736a7cadd Geometry Nodes: Add ability to clear object's active modifier
`object.modifiers.active = None` will just clear the active flag
from every modifier.
2020-11-20 09:32:46 -05:00
66ea03e908 Geometry Nodes: Add object.modifiers.active to RNA
This is a RNA only pointer property used to set and get the active
modifier without using an operator.
2020-11-20 09:25:01 -05:00
2781e51cda Fix T82762: linked but unavailable output handled incorrectly 2020-11-20 12:06:26 +01:00
1f2ce121a3 Fix T82773: node with unavailable output is handled incorrectly 2020-11-20 11:50:13 +01:00
9524019d58 Geometry Nodes: Rename category Scattering to Point and sort
The Geometry category should come before Input.
2020-11-20 00:05:13 +01:00
61e0f22945 Geometry Nodes: Hide unsupported attribute types and domains
The random attribute node currently doesn't support every attribute
domain or data type. With a bit of boilerplate code we can remove these
unsupported enum items from the UI for now, and also get a system to
remove unsupported items from the UI in the future. If all attribute
creation nodes end up always supporting all attibute types and domains,
this can be removed.
2020-11-19 17:13:56 -05:00
b7d7051dc3 Geometry Nodes: Add an operator to set the active modifer
Also make new modifiers active, and properly set the active
state when duplicating a modifier.
2020-11-19 14:47:43 -05:00
e0516d4d8e Geometry Nodes: Disallow editing and animating modifier active property
There will be an operator to access this property instead, which provides
a better name and tooltip to expose in the UI, and makes it more clear
that the property is dependent on the other modifiers.
2020-11-19 14:44:20 -05:00
097e1ca1a1 Geometry Nodes: Add the concept of an active modifier
This commit adds functions to set and get the object's active
modifier, which is stored as a flag in the ModifierData struct,
similar to constraints. This will be used to set the context in
the node editor. There are no visible changes in this commit.
2020-11-19 14:35:48 -05:00
dc628e7c38 Cleanup: use struct instead of class 2020-11-19 17:41:40 +01:00
bb960c85a5 Merge branch 'master' into geometry-nodes 2020-11-19 17:38:48 +01:00
eb25446b9d Geometry Nodes: Categories for the nodes
See T82367. There is some ongoing discussion about Attributes vs
Attribute. But it is settle to Attribute, so it matches Color, Vector
and Geometry.
2020-11-19 17:21:39 +01:00
0c7df205a5 Geometry Nodes: T82701 Name for initial Node Groups
Rename it from "Geometry Node Group" to "Geometry Nodes". This is
shorter and equality descriptive.
2020-11-19 16:59:51 +01:00
0f1fe96e0b Geometry Nodes - Internal rename + API change: NODES for anything but UI
Most of the times the nodes will be non-empty. Empty is really only what
shows in the UI.
2020-11-19 16:11:24 +01:00
417924d840 Geometry Nodes: transform geometry in Object Info node 2020-11-19 13:40:38 +01:00
a581367a2b Geometry Nodes: give nodes access to object that is being modified 2020-11-19 13:38:39 +01:00
00928f7826 Geometry Nodes: simplify attributes api and support deletion
The main difference is that the functions to access attributes have
been moved to MeshComponent and PointCloudComponent.
2020-11-19 13:17:11 +01:00
91971093bb Geometry Nodes: support controlling instance scale in point instancer node 2020-11-18 13:41:08 +01:00
96beb711e3 Geometry Nodes: support point cloud component in random attribute node 2020-11-18 13:40:28 +01:00
7e930f4e8b Geometry Nodes: support rotation and scale in instances component 2020-11-18 13:39:56 +01:00
aa780a4c17 Geometry Nodes: fix memory leak 2020-11-18 13:27:36 +01:00
5c3496f3cd Geometry Nodes: initial Random Attribute node
This adds some ui boilerplate code for the Random Attribute node and
provides an initial implementation.

Note, while the implementation can already randomize attributes, it might
not behave as expected under all circumstances yet. It's still work in progress.
2020-11-18 12:28:57 +01:00
425b15e23f Geometry Nodes: use attribute api in point instance node 2020-11-18 12:25:47 +01:00
5c2730f64d Geometry Nodes: use attribute api in point distribute node 2020-11-18 12:25:17 +01:00
866a56f76e Geometry Nodes: initial generic attribute access API
I will have to do a couple more iterations on this api in the upcoming weeks,
but for now it should be good enough.

The API adds an indirection for attribute access. That has the following benefits:
* Most code does not have to care about how an attribute is stored internally.
  This is mainly necessary, because we have to deal with "legacy" attributes
  such as vertex weights and attributes that are embedded into other structs
  such as vertex positions.
* When reading from an attribute, we generally don't care what domain the
  attribute is stored on. So we want to abstract away the interpolation that
  that adapts attributes from one domain to another domain (this is not
  actually implemented yet).

Accessing attributes through this indirection does have a performance penalty.
In later iterations of this API I want to reduce this penalty and extend the API
so that performance critical code does not have to go through the indirection
for every attribute access.

Other possible improvements for later iterations include:
* Actually implement interpolation between domains.
* Don't use inheritance for the different attribute types. A single class for read
  access and one for write access might be enough, because we know all the ways
  in which attributes are stored internally. We don't want more different internal
  structures in the future. On the contrary, ideally we can consolidate the different
  storage formats in the future to reduce the need for this indirection.
* Remove the need for heap allocations when creating attribute accessors.
2020-11-18 12:20:54 +01:00
63a286e4ce Functions: add float2 cpp type 2020-11-18 12:00:45 +01:00
15c6390960 Merge remote-tracking branch 'origin/master' into geometry-nodes 2020-11-18 02:03:02 +01:00
083cde0b43 Geometry Nodes: Unify icons -> use ICON_NODETREE for everything
Until there is a icon made specially for this, the nodetree icon is up
for grabs. Using it in the nodegroup + modifier + editor helps the users
to make a connection on where to edit those modifiers.
2020-11-18 02:02:32 +01:00
0783a9a194 Cleanup: Remove all of "#ifdef WITH_POINT_CLOUD"
Since Point Cloud was removed from experimental this is no longer needed.
2020-11-18 02:02:32 +01:00
b05f841c3a Cleanup: Remove most of "#ifdef WITH_GEOMETRY_NODES"
The ones around the simulation datablock are still there, since they are not
needed for the features planned for master yet.
2020-11-18 02:02:32 +01:00
4db4177587 Remove Point Cloud object from experimental
The point cloud object is the only one that will support instancing at
first. So we can expose it as a regular object.

It is limited since it has no edit mode. But this is not different than
the volume object.
2020-11-18 00:31:23 +01:00
c0f3d31998 Remove Geometry Nodes Editor from experimental
As part of preparing this work for master, with an initial subset of
working functionalities the Geometry Nodes Editor can be exposed for
everyone.

(it also helps people that are testing the branch)
2020-11-18 00:30:23 +01:00
b26cbb5d53 Merge branch 'master' into geometry-nodes 2020-11-16 12:03:01 -05:00
52e3608fe9 Geometry Nodes: simplify GeometrySet ownership handling
Previously, GeometrySets and GeometryComponents has reference
counters and could be shared. This commit changes it so that
only GeometryComponents are shared. A GeometrySet is a fairly
small type that is cheap to copy.

A lot of code simplifies when we can assume that GeometrySet
is cheap to copy.
2020-11-16 13:48:33 +01:00
6ba6e97407 Geometry Nodes: Move GeometrySet classes to global namespace
Brecht and I decided to move the GeometrySet classes
to the global namespace for now. This way we can use
the same type in C and C++ and don't have to use
reinterpret_cast as often.
2020-11-16 12:07:51 +01:00
4913b624d8 Merge branch 'master' into geometry-nodes 2020-11-16 11:49:14 +01:00
96ce1e9a95 Geometry Nodes: Improve node group output modifier error
More than output for the modifier's node group is fine, because the
node group may be used in other situations, but the modifier will
not work if there is no geometry output socket.
2020-11-14 20:09:27 -05:00
a3efa1d798 Merge branch 'master' into geometry-nodes 2020-11-14 15:17:46 -05:00
e50553c61a Empty Modifier: Fix build and put in the right order
Bypassing the macro that creates modifiers to allow the enum to be
referring to the Empty modifier, but the internal struct in the code to
be Nodes.

Also fix the name of the new created modifiers to be "Empty".

Fix was built with rBb458ea6b23381a9acb90dbbd73ced678e1d404c5.
2020-11-14 01:51:06 +01:00
b458ea6b23 Rename: "Nodes" modifier to "Empty" (take 2)
Leave the internal DNA data struct as "Nodes", and only rename the
modifier and user interface to Empty.

See 4a2734a835 for the original take and the reasoning
for renaming from Nodes to Empty.
2020-11-13 23:29:09 +01:00
056d7bb175 Revert "Rename: "Nodes" modifier to "Empty""
This reverts commit 4a2734a835.

Reverting this so that all we change is the UI name, not the DNA struct
and the internal variable names.
2020-11-13 23:19:40 +01:00
Léo Depoix
9769cf1ee6 Geometry Nodes : Removing "Combine Strings" and Group Instance ID from UI
This diff remove "Combine Strings" and "Group Instance ID" nodes from the UI (but keep them in the source code to be able to bring them back if needed).

This is part of "Cleanup 1st Sprint Nodes" (https://developer.blender.org/T82370).

Differential Revision: https://developer.blender.org/D9558
2020-11-13 22:23:37 +01:00
4a2734a835 Rename: "Nodes" modifier to "Empty"
This introduces a regression. Users need to re-create their modifiers
and set their values again. The NodeGroups are intact so all they need
is to create new "Empty" modifiers and set the node group.

---

Original problem: Eventually most modifiers will be node-based, so naming
this new modifier "Nodes" will get outdated pretty quickly.

Calling it "Empty" it's fairly descriptive, since the node tree simply connects
the modifier Input to an Output, without any effect.

There is a potential problem, that it could be associated with the
Empty object type. Like some sort of Hook.

This is the task T82700, and the design task T82537.
2020-11-13 22:16:28 +01:00
1ddd717803 Geometry Nodes: Improve error messages for property mismatches
Related to T82438. This adds some basic checks for common errors and
currently unsupported socket types in the modifier.
2020-11-13 12:35:10 -05:00
0066e59f2d Merge branch 'master' into geometry-nodes 2020-11-13 11:54:29 -05:00
ec7fffb033 Cleanup: Remove unused variable 2020-11-12 20:38:51 -05:00
956cf9a48d Cleanup: Clang Tidy 2020-11-12 16:06:12 -05:00
c27095b5cb Cleanup: Spelling
Also move some input extraction after the special case check.
2020-11-12 16:04:45 -05:00
Léo Depoix
8ef8cb7e34 Geometry Nodes: Add method enums to mesh triangulate node
This commit adds the remaining "method" enums from the triangulate modifier.

Differential Revision: https://developer.blender.org/D9502
2020-11-12 15:49:59 -05:00
0f6bee8e54 Merge branch 'master' into geometry-nodes 2020-11-12 15:19:09 -05:00
3093f89498 Geometry Nodes: Add null check for modifier property UI functions
An ID IDProperty exposed to the modifier  (object, material, etc) does not
have min, max, etc. values, so they should not be required.
2020-11-12 14:47:17 -05:00
f211030344 Cleanup: Fix typo 2020-11-12 12:19:44 -05:00
b277025d8e Geometry Nodes: Add modifier disabled check 2020-11-12 12:16:32 -05:00
94572a4e30 Geometry Nodes: use density attribute name instead of index as node input
This implements a workaround for the issue that (for historical reasons)
the names of vertex groups are stored on the object while the actual vertex
group data is stored on the mesh.

The solution is to copy the vertex group names from the object into
the `MeshComponent` so that the information is not lost, when the
object cannot be accessed.
2020-11-12 16:58:30 +01:00
bc2230df71 Geometry Nodes: cleanup geometry node interface
Previously, the execution function of a geometry node has three parameters.
Now it has only one. This makes it easier to pass more information to the
execution function, that might only be used by a few nodes, because we
don't have to add more parameters that are unused in most cases.
2020-11-12 16:31:32 +01:00
caa942b033 Geometry Nodes: actually create instances in Point Instance node 2020-11-12 13:28:33 +01:00
5dff952b67 Geometry Nodes: support instances in Transform node 2020-11-12 13:27:56 +01:00
5877e34eb4 Geometry Nodes: new DupliGenerator for instances component
With this, instances generated in a node tree can be rendered.
2020-11-12 13:27:20 +01:00
770bcfac9b Geometry Nodes: improve point distribute node
* Support vertex weights to control density.
* O(n) performance instead of O(n^2).
* More stable when density weights are changed.

The vertex group has to be specified using an index for now.
This is a technical limitation that will resolved a bit later.
2020-11-12 13:24:46 +01:00
b081108819 Geometry Nodes: support geometry components in depsgraph object iterator
Objects can evaluate to a geometry set instead of a single ID (only point cloud
objects for now). In the depsgraph object iterator, those geometry components
are expanded into temporary objects.

It's important to note that instanced objects can also contain geometry
components. Therefore, they have to be split up into multiple objects
as well in some cases.

At a high level the iterator works like so:
```
for object in depsgraph:
    for component in object:
        yield object_from_component(component)
    for dupli in make_duplis_list(object):
        for component in dupli:
            yield object_from_component(component)
```

DEG_iterator_objects_next has been cleaned up, to make this structure
a bit more apparent.
2020-11-12 13:20:23 +01:00
2be7b2aaf9 Geometry Nodes: better handle link cycles 2020-11-12 12:58:27 +01:00
912b38001f Geometry Nodes: use GeometrySet when evaluating pointcloud modifiers
This changes the signature of the modifyPointCloud function.
I'm doing that instead of making a new callback, because it requires
changes to significantly fewer files. Eventually it would be good
combine modifyMesh, modifyHair, modifyPointCloud and modifyVolume
into one modifyGeometrySet.

I temporarily disabled the displacement only modifiers for point clouds.
Support can be added back a bit later. I assume those have not been
used anywhere anyway.

The output of point cloud modifiers can not only be another point cloud,
but also a mesh and/or some instances. I added a new geometry_set_eval
field to Object_Runtime. For point cloud objects, the final geometry is
now referenced by that pointer instead of data_eval. The data_eval field
is still initialized after modifier evaluation to make some other code happy.

The evaluated geometry set is not yet passed to the renderer, so a point
cloud is currently rendered empty.
2020-11-12 12:57:52 +01:00
c4352f44bc Geometry Nodes: initial Object Info node
This node takes an object as input and outputs its location, rotation,
scale and geometry. Right now the loc/rot/scale are extracted from the
objects `obmat`. The geometry is just the mesh in the local space of the
source object.

We will likely need some more control over space transformations
using enums in the node, but those can be added a bit later.
2020-11-12 12:24:07 +01:00
0feca5f07d Geometry Nodes: initial object socket support
The fundamental difference between object sockets and the
other existing data sockets is that an object is an ID data block.
Changing the value of an object socket also changes the depsgraph.

The modifier has to analyse the node tree to figure out which other
objects it depends on. Currently, this is done very simply by just
looping over all sockets and collecting the objects. In the future
this can be improved by also figuring out what components of
an object are needed.

Instead of passing object pointers around in the node tree, we actually
use a handle. This handle is just a number internally that identifies
a specific object. The conversion between handles and object pointers
is done using a map that is provided by the modifier.

This approach has a couple of benefits. It protects us a bit from passing
around pointers that are not known to the modifier and therefore are
not in the depsgraph. Furthermore, the object pointer can change
while the handle stays the same. This is not important right now, but
is not unlikely to become useful in the future.

The API for how nodes access object pointers is not ideal yet and
will be improved in the future.
2020-11-12 12:20:59 +01:00
2984fb2b49 Geometry Nodes: crash when using Vector Math node 2020-11-12 11:51:12 +01:00
9e6553c0d4 Geometry Nodes: change color of object socket 2020-11-12 11:50:23 +01:00
107a0894cc Geometry Nodes: improve GeometrySet
This commits implements multiple changes:
* Adds a simple C API.
* Improves the ownership handling by introducing GeometryOwnershipType.
* Adds an InstancesComponent that stores positions and Object pointers.
2020-11-12 11:47:48 +01:00
8ecc1bea4c Nodes: add utility to check for link cycles in derived node trees 2020-11-12 11:35:46 +01:00
91ad33ef8f Merge branch 'master' into geometry-nodes 2020-11-12 11:25:25 +01:00
fa5190e742 fix after merge 2020-11-09 15:55:24 +01:00
74ed591f62 Merge branch 'master' into geometry-nodes 2020-11-09 15:48:18 +01:00
3d5efb4335 Geometry Nodes: rename Geometry type to GeometrySet
This should not change any functionality.

After talking to Brecht, we agreed that it might be good
not to have a class called Geometry for now. In the future
we might want to use a Geometry class as base class for
meshes, curves, etc.

This commit renames the Geometry class to GeometrySet,
because it is essentially a container that can contain
multiple geometries of different types.
2020-11-09 13:08:17 +01:00
Léo Depoix
140b7cfe0d Geometry Nodes: cleanup Subdivision Surface node inputs
Ref T82370.

Differential Revision: https://developer.blender.org/D9487
2020-11-09 12:49:33 +01:00
af7cc3f8bb Fix merge issues 2020-11-09 12:46:04 +01:00
d2c4af9865 Merge branch 'master' into geometry-nodes 2020-11-09 12:44:45 +01:00
e5c637f5fe Merge remote-tracking branch 'origin/master' into geometry-nodes 2020-11-06 18:22:36 +01:00
11d12d543d Fix build error on windows: Don't use designated initializers in C++ 2020-11-02 08:20:54 -06:00
2c6114b238 Merge branch 'master' into geometry-nodes 2020-11-02 08:15:15 -06:00
152bd43ae1 Merge branch 'master' into geometry-nodes 2020-11-02 11:44:46 +01:00
45012c3309 Geometry Nodes: Fix property values reset when input socket is added
The names of the IDProperties are the socket identifiers, not their names.
2020-10-31 23:24:06 -05:00
5177c35498 Merge branch 'master' into geometry-nodes 2020-10-31 22:58:39 -05:00
49c8042f29 Merge branch 'master' into geometry-nodes 2020-10-31 14:21:14 +01:00
Léo Depoix
f8c52590c0 Geometry Nodes: new Subdivision Surface node
This node is similar to the subdivision surface modifier. It subdivides
the mesh component of a geometry. The options have the same meaning
as in the modifier.

Differential Revision: https://developer.blender.org/D9364
2020-10-31 10:51:09 +01:00
0b897e0308 Merge branch 'master' into geometry-nodes 2020-10-31 10:43:52 +01:00
c34438dd78 Geometry Nodes: Rename node category based on functionality
Naming based on supported geometry components only works in some cases.
For nodes that work with multiple data types, it's better to categorize
them based on their functionality.
2020-10-31 00:37:04 -05:00
e0a4dc9396 Merge branch 'master' into geometry-nodes 2020-10-31 00:30:10 -05:00
51fa44522f Geometry Nodes: Add errors for out of sync sockets and properties
Theoretically the modifier's properties could be changed or removed by
Python, so it may be useful to have errors printed and added to the
modifier in that case.

I kept the check as a separate step from the `compute_geometry`
pass because the object is needed to set the modifier error message.
But it could easily be moved there in the future.
2020-10-30 11:42:11 -05:00
343e13f464 Geometry Nodes: change geometry socket color
Ref T81848.
2020-10-30 17:29:36 +01:00
1103809fab Merge branch 'master' into geometry-nodes 2020-10-30 16:40:41 +01:00
5b89d49b0d Geometry Nodes: Allow node group inputs with the same name
If we add the "name" label manually with uiItemR, we can use the socket
identifier instead of the name for the IDProperty name. This will also
allow us more flexibility in how to draw the settings in the future, and
removes the empty _RNA_UI proprety that was drawn before.
2020-10-30 09:57:54 -05:00
e805bfc768 Cleanup: Return early in edge split node 2020-10-29 15:53:32 -05:00
67cb4fdbdc Cleanup: Don't use unsupported struct initialization
Although this worked for me, it appears this isn't supported until C++20.
2020-10-29 15:48:38 -05:00
8ed74c9daf Geometry Nodes: Use UI settings for properties in modifier
The system for exposing property settings like min, max, default, subtype,
etc. for ID properties is quite convoluted currently, so I won't give a
full description here, but this commit creates the tree of ID properties
needed to store that information. This means that property subtypes like
"angle" or "XYZ" will affect the display in the modifier.

Limitations:
 - The _RNA_UI property is displayed in the modifier. This may require a
   modification to uiDefAutoButsRNA to fix.
 - IDProperties must have unique names, but node sockets don't have
   that limitation. This can be solved by adding a "UI name" field to
   IDProperties.
2020-10-29 14:11:32 -05:00
d7cb25e028 Fixup for cmake header cleanup
Issue introduced on f73a420e5a.
2020-10-29 18:27:31 +01:00
e3395093ff Geometry Nodes: Create the node group when adding a new Nodes modifier 2020-10-29 17:36:16 +01:00
f73a420e5a Cleanup: Nodes Modifier header to its proper location 2020-10-29 17:36:16 +01:00
b8b240b329 Geometry Nodes: do not reference custom data layers when copying mesh
We can't use that for now, because the original mesh might be freed
before the new copied mesh. When the original mesh is freed, the shared
layers will be freed as well.

This can probably be improved in the future, so that we can actually
share attribute arrays between meshes. An approach similar to how
geometries and components are shared should work as well.
2020-10-29 15:47:19 +01:00
ae2827bb52 Geometry Nodes: add comment mentioning that custom data might be shared 2020-10-29 15:42:01 +01:00
bb97284f8a Geometry Nodes: refactor Geometry type
A geometry now contains zero or more geometry components.
A geometry component is a subclass off GeometryComponent.
Currently, there is a MeshComponent and PointCloudComponent.

A geometry contains at most one component of each type.
Individual components can be shared between multiple geometries
to avoid unnecessary copies. For that, each component has a user
count that determines when the component will be freed and whether
it is mutable.

Code working with geometries can either work with the components
directly, or use the utility functions on the geometry that cover the
most common operations.

In the future, additional component types can be added. For example,
we'll probably need components for curves and volumes.
Furthermore, something like an InstancesComponent can be added,
which contains points with attributes and references a geometry/object/collection
that is instanced on all the points.
2020-10-29 15:38:15 +01:00
209e82da45 Merge branch 'master' into geometry-nodes 2020-10-29 15:22:59 +01:00
e63d43e6b9 Merge branch 'master' into geometry-nodes 2020-10-29 11:31:55 +01:00
802ba35654 Geometry Nodes: make default group output node active
Otherwise some updates were missing when sockets are changed.
2020-10-28 20:27:57 +01:00
79c9c11b35 Merge branch 'master' into geometry-nodes 2020-10-28 20:21:52 +01:00
e1d0ab2dbc Geometry Nodes: fix missing update when inserting a node between two nodes 2020-10-28 14:53:06 +01:00
687f994251 Geometry Nodes: improve api for nodes
The execute callback of a geometry node gets more domain specific
types as parameters now: GeoNodeInputs and GeoNodeOutputs.

Those types are also aware of what node is being executed and can
provide better error messages when they are used incorrectly.
2020-10-28 14:05:07 +01:00
5c7767e0e0 Merge branch 'master' into geometry-nodes 2020-10-28 14:01:05 +01:00
af9ee8e2bc Merge branch 'master' into geometry-nodes 2020-10-28 10:40:35 +01:00
562f2e604a Merge branch 'master' into geometry-nodes 2020-10-27 21:21:03 -05:00
84e81b8cc3 Merge branch 'master' into geometry-nodes 2020-10-27 14:01:48 -05:00
5ae9527770 Geometry Nodes: Support pointcloud in transform node
This is likely not the final implementation of the transform node, but
it's  a good trivial case for supporting multiple geometry data types.
2020-10-27 12:59:58 -05:00
082c17a2d2 Fix group input is resetting in modifier 2020-10-27 17:01:03 +01:00
09677d737c Fix missing null check in recent commit 2020-10-27 15:53:17 +01:00
bec7248178 Cleanup: Use proper C++ types 2020-10-27 09:43:38 -05:00
0103cb2051 Geometry Nodes: initial support for bool group inputs
Still need to work on the uilayout inside the modifier.
2020-10-27 14:59:26 +01:00
9f38ebefcb Geometry Nodes: support vector inputs to geometry group 2020-10-27 14:54:41 +01:00
8f934852f0 Geometry Nodes: initial support for displaying group inputs in modifier
This uses the previously added id properties on the nodes modifier
to store values that are passed into the geometry node group.
2020-10-27 13:44:46 +01:00
cb16db7803 Geometry Nodes: enable nodes modifier in edit mode 2020-10-27 12:09:13 +01:00
f8965f12a1 Geometry Nodes: Fix memory leak 2020-10-26 23:15:05 -05:00
7f2a20f89b Merge branch 'master' into geometry-nodes 2020-10-26 23:12:45 -05:00
5566818603 Geometry Nodes: Add initial scattering nodes
The first is a "Point Distribute" node, which takes a mesh and outputs a
pointcloud, scattering points randomly on the surface based on the input
density. The distribution algorithm is extremely basic at this point, and
doesn't take into account an attribute weight at each vertex.

The second node is a "Point Instance" node, which is mainly a placeholder
until the engineering design for how to work with instancing in geometry
nodes is decided. For now it just runs the same code that the convert
pointcloud to mesh operator uses.
2020-10-26 23:00:31 -05:00
9a06c6a040 Geometry Nodes: Add function to create a temporary pointcloud
We needed a "nomain" funciton similar to the one we have for meshes in
order to add a working pointcloud for the geometry nodes.
2020-10-26 22:54:55 -05:00
e097116072 Geometry Nodes: Add utility to position point randomly on 3D triangle 2020-10-26 22:44:35 -05:00
b844caca6d Geometry Nodes: Add pointcloud support to geometry class
This adds another set of the same mesh functions but for pointclouds.
There are probably better ways to generalize this functionality, but that
may have to be rethought in the future anyway if we want to store
multiple of each type. And anyway it's handy to have a specific set of
"pointcloud" functions available in the node implementations.
2020-10-26 22:41:57 -05:00
046ac5fccd Geometry Nodes: Initial mesh boolean node
This uses the code from the rewritten boolean modifier from 2.91 as a node.
The implementation is about as minimal as it can get, since for now the use
case of this node is mostly to test multiple geometry outputs and inputs.

The boolean code requires a BMesh, so the node converts the input meshes
to BMesh, so the bmesh is added as a dependency to the nodes module.
2020-10-26 14:27:19 -05:00
ef4fbba596 Cleanup: remove unused modifier property 2020-10-26 18:27:44 +01:00
aa8360d0fa Geometry Nodes: initial test trying to use id properties to initialize group inputs
The settings can only be set via Python currently. The matching between properties
and group inputs is based on the socket identifier (which is e.g. `Input_5`).
Maybe we'll have to use a different matching strategy in the future, will see.
2020-10-26 18:23:51 +01:00
76c356c12e Geometry Nodes: store id properties in nodes modifier
The properties are not used yet, but can already be accessed with Python
using `modifier.settings['setting name']`.

The plan is to use id properties to store the parameters that the modifier
passes into the geometry node group.
2020-10-26 17:53:51 +01:00
e04491073d Geometry Nodes: support evaluation with more than one group input
Group inputs are not yet exposed in the modifier. For now I just added
a simple float setting that will be passed to every float input of the group.
Inputs of other types have some default value.
2020-10-26 14:16:26 +01:00
a5dda5996e Geometry Nodes: connect group input and output by default 2020-10-26 13:29:03 +01:00
c48e4b7a44 Geometry Nodes: improve node tree evaluation
This change reduces the number of unnecessary copies of data
and avoids computing the same value more than once.
2020-10-26 13:27:02 +01:00
4ae2d6206a Geometry Nodes: initial Transform node
Most of this code has been written by @HooglyBoogly.
I just changed the exec funtion so that it does not have to make
a copy of the mesh.
2020-10-26 12:27:51 +01:00
47f5a635da Geometry Nodes: add utility method to check if a geometry has a mesh 2020-10-26 12:25:46 +01:00
eb8574bc8b Merge branch 'master' into geometry-nodes 2020-10-26 12:10:12 +01:00
bc4e31afb6 Merge branch 'master' into geometry-nodes 2020-10-24 14:38:00 +02:00
9d7672be71 Merge branch 'master' into geometry-nodes 2020-10-23 15:18:20 +02:00
994e7178bb Geometry Nodes: make some function nodes available
We might not want to have all those nodes in a final version.
Some of them have been added with particle nodes in mind.
However, to test the evaluation system it is useful to have a
couple of nodes available.

Those nodes should "just" work, because their implementation
is reused from the particle nodes project.
2020-10-23 15:13:19 +02:00
1719743066 Geometry Nodes: improve node group evaluation
This adds support for nodes that have a multi-function implementation.
That includes various function nodes like Math, Combine Vector, ...

Furthermore, there is support for implicit conversions now. So it should
work when one connects e.g. a float to an integer and vice versa.
2020-10-23 15:09:55 +02:00
8910033f57 Nodes: add utility methods 2020-10-23 15:05:01 +02:00
2a4c6c612a Functions: add utility method 2020-10-23 15:01:07 +02:00
b062b922f9 Geometry Nodes: Resolve some missing 3D viewport updates
These two functions "snode_notify" and "ED_node_tag_update_id" appear to
be mostly duplicates. However, there is already a case for each type of
built-in node tree, so it makes sense to add one for the geometry node
tree as well. This doesn't solve the update issues for changing number
in buttons, that must be handled somewhere else.
2020-10-22 22:59:40 -05:00
895f4620a0 Merge branch 'master' into geometry-nodes 2020-10-22 22:03:28 -05:00
fafed6234b Geometry Nodes: Add edge split node functionality 2020-10-22 13:48:56 -05:00
7ff8094a8b Geometry Nodes: expose minimum vertices input of Triangulate node 2020-10-22 18:24:05 +02:00
5aabf67a9c Fix error in previous commit
That should not have happened -.-
2020-10-22 18:23:39 +02:00
ab8c7fe946 Fix previous comment 2020-10-22 18:20:17 +02:00
a05012d500 Geometry Nodes: simplify and deduplicate callbacks on sockets
This adds a layer of abstraction between the code calling callbacks
on sockets and the implementation of those callbacks.
This abstraction layer allows some sockets to not implement all
callbacks when those can be derived from some other callback.
2020-10-22 18:08:27 +02:00
97a93566e9 Geometry Nodes: change "Node Tree" to "Node Group" 2020-10-22 15:52:15 +02:00
da4d697772 Geometry Nodes: initial support for evaluating geometry node groups
This is still very basic and does quite a few unnecessary computations.
Also the error handling is quite weak currently, so when invalid things are
connected, it will probably just crash.

Also the interface that individual nodes have to implement will have to change,
but the current solution is a good starting point.

Only the triangulate node is implemented for now.
2020-10-22 15:05:41 +02:00
87218899be Geometry Nodes: add an initial geometry class 2020-10-22 15:02:27 +02:00
ffa0a6df9d Functions: add generic pointer class
This class represents a pointer whose type is only known at runtime.
2020-10-22 15:01:31 +02:00
706fa5ad76 Functions: add move operations to CPPType 2020-10-22 15:00:07 +02:00
b7f6de490d Geometry Nodes: Add initial node definition for edge split
This is just based on rBa7dba81aab22, and contains no funcionality at all.
2020-10-21 16:11:09 -05:00
7e485b4620 Merge branch 'master' into geometry-nodes 2020-10-21 08:54:39 -05:00
a7dba81aab Nodes: add initial UI for Triangulate node 2020-10-21 14:14:09 +02:00
4606e83a75 Merge branch 'master' into geometry-nodes 2020-10-21 14:00:32 +02:00
1d28de57a4 Nodes: improve dependency between modifier and node group 2020-10-21 13:16:19 +02:00
3cfcfb938d Nodes: support creating geometry node groups 2020-10-21 12:32:02 +02:00
bcdc6910a0 Nodes: show header in geometry node editor 2020-10-21 12:16:57 +02:00
7793e8c884 Modifiers: add node_tree to NodesModifierData 2020-10-21 12:13:13 +02:00
05d9bd7c4a Modifiers: rename Simulation to Nodes modifier 2020-10-21 12:03:06 +02:00
9255ce9247 Nodes: rename Simulation to Geometry node tree 2020-10-21 11:39:42 +02:00
a0ce0154e7 Merge branch 'master' into geometry-nodes 2020-10-21 11:11:16 +02:00
0cd7f7ddd1 Nodes: add geometry socket type
We still have to pick a color for this socket.

Ref T81848.
2020-10-20 15:31:59 +02:00
1104 changed files with 26124 additions and 18663 deletions

View File

@@ -34,17 +34,14 @@ Checks: >
modernize-*,
-modernize-use-auto,
-modernize-use-trailing-return-type,
-modernize-deprecated-headers,
-modernize-avoid-c-arrays,
-modernize-use-equals-default,
-modernize-use-nodiscard,
-modernize-use-using,
-modernize-loop-convert,
-modernize-pass-by-value,
-modernize-use-default-member-init,
-modernize-raw-string-literal,
-modernize-avoid-bind,
-modernize-use-override,
-modernize-use-transparent-functors,
WarningsAsErrors: '*'

View File

@@ -91,3 +91,79 @@ c42a6b77b52560d257279de2cb624b4ef2c0d24c
# Cleanup: use doxy sections for imbuf
c207f7c22e1439e0b285fba5d2c072bdae23f981
# Cleanup: Clang-Tidy, modernize-use-bool-literals
af35ada2f3fa8da4d46b3a71de724d353d716820
# Cleanup: Use nullptr everywhere in fluid code
311031ecd03dbfbf43e1df672a395f24b2e7d4d3
# Cleanup: Clang-Tidy, modernize-redundant-void-arg
a331d5c99299c4514ca33c843b1c79b872f2728d
# Cleanup: Clang-Tidy modernize-use-nullptr
16732def37c5a66f3ea28dbe247b09cc6bca6677
# Cleanup: Clang-tidy, modernize-concat-nested-namespaces
4525049aa0cf818f6483dce589ac9791eb562338
# Cleanup: Clang-tidy else-after-return
ae342ed4511cf2e144dcd27ce2c635d3d536f9ad
# Cleanup: Clang-Tidy, readability-redundant-member-init
190170d4cc92ff34abe1744a10474ac4f1074086
# Cleanup: use 'filepath' instead of 'name' for ImBuf utilities
99f56b4c16323f96c0cbf54e392fb509fcac5bda
# Cleanup: clang-format
c4d8f6a4a8ddc29ed27311ed7578b3c8c31399d2
b5d310b569e07a937798a2d38539cfd290149f1c
8c846cccd6bdfd3e90a695fabbf05f53e5466a57
40d4a4cb1a6b4c3c2a486e8f2868f547530e0811
4eac03d821fa17546f562485f7d073813a5e5943
# Cleanup: use preprocessor version check for PyTypeObject declaration
cd9acfed4f7674b84be965d469a367aef96f8af3
# Cycles: fix compilation of OSL shaders following API change
b980cd163a9d5d77eeffc2e353333e739fa9e719
# Cleanup: clang-tidy suppress warnings for PyTypeObject.tp_print
efd71aad4f22ec0073d80b8dd296015d3f395aa8
# Cleanup: fix wrong merge, remove extra unique_ptr.
6507449e54a167c63a72229e4d0119dd2af68ae5
# Cleanup: fix some clang tidy issues
525a042c5c7513c41240b118acca002f6c60cc12
# Fix T82520: error building freestyle with Python3.8
e118426e4695a97d67e65d69677f3c4e2db50a56
# Cleanup: Clang-tidy, readability-else-after-return
7be47dadea5066ae095c644e0b4f1f10d75f5ab3
# Cleanup: Add `r_` to return parameter
45dca05b1cd2a5ead59144c93d790fdfe7c35ee6
# Cleanup: Typo in `print_default_info` function name.
41a73909dec716642f044e60b40a28335c9fdb10
# Cleanup: Reduce indentation
1cc3a0e2cf73a5ff4f9e0a7f5338eda77266b300
# Build-system: Force C linkage for all DNA type headers
ad4b7741dba45a2be210942c18af6b6e4438f129
# Cleanup: Move function to proper section
c126e27cdc8b28365a9d5f9fafc4d521d1eb83df
# Cleanup: remove break after return statements
bbdfeb751e16d939482d2e4b95c4d470f53f18a5
# Cleanup: clang-tidy
af013ff76feef7e8b8ba642279c62a5dc275d59f
# Cleanup: Make panel type flag names more clear
9d28353b525ecfbcca1501be72e4276dfb2bbc2a

View File

@@ -178,6 +178,7 @@ mark_as_advanced(BUILDINFO_OVERRIDE_TIME)
option(WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON)
option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke, ocean sim, and audio effects)" ON)
option(WITH_PUGIXML "Enable PugiXML support (Used for OpenImageIO, Grease Pencil SVG export)" ON)
option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
mark_as_advanced(WITH_SYSTEM_BULLET)
@@ -377,6 +378,7 @@ option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX OPENCL)" )
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
@@ -425,8 +427,8 @@ mark_as_advanced(WITH_CXX_GUARDEDALLOC)
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
mark_as_advanced(WITH_ASSERT_ABORT)
if(UNIX AND NOT APPLE)
option(WITH_CLANG_TIDY "Use Clang Tidy to analyze the source code (only enable for development on Linux using Clang)" OFF)
if((UNIX AND NOT APPLE) OR (CMAKE_GENERATOR MATCHES "^Visual Studio.+"))
option(WITH_CLANG_TIDY "Use Clang Tidy to analyze the source code (only enable for development on Linux using Clang, or Windows using the Visual Studio IDE)" OFF)
mark_as_advanced(WITH_CLANG_TIDY)
endif()
@@ -697,6 +699,8 @@ set_and_warn_dependency(WITH_BOOST WITH_OPENCOLORIO OFF)
set_and_warn_dependency(WITH_BOOST WITH_QUADRIFLOW OFF)
set_and_warn_dependency(WITH_BOOST WITH_USD OFF)
set_and_warn_dependency(WITH_BOOST WITH_ALEMBIC OFF)
set_and_warn_dependency(WITH_PUGIXML WITH_CYCLES_OSL OFF)
set_and_warn_dependency(WITH_PUGIXML WITH_OPENIMAGEIO OFF)
if(WITH_BOOST AND NOT (WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_USD OR WITH_ALEMBIC))
@@ -875,9 +879,11 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Release")
if(APPLE AND COMPILER_ASAN_LIBRARY)
string(REPLACE " " ";" _list_COMPILER_ASAN_CFLAGS ${COMPILER_ASAN_CFLAGS})
add_compile_options("$<$<NOT:$<CONFIG:Release>>:${_list_COMPILER_ASAN_CFLAGS}>")
add_link_options("$<$<NOT:$<CONFIG:Release>>:-fno-omit-frame-pointer;-fsanitize=address>")
set(_is_CONFIG_DEBUG "$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>")
add_compile_options("$<${_is_CONFIG_DEBUG}:${_list_COMPILER_ASAN_CFLAGS}>")
add_link_options("$<${_is_CONFIG_DEBUG}:-fno-omit-frame-pointer;-fsanitize=address>")
unset(_list_COMPILER_ASAN_CFLAGS)
unset(_is_CONFIG_DEBUG)
elseif(COMPILER_ASAN_LIBRARY)
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")

View File

@@ -94,11 +94,7 @@ include(cmake/usd.cmake)
include(cmake/potrace.cmake)
# Boost needs to be included after python.cmake due to the PYTHON_BINARY variable being needed.
include(cmake/boost.cmake)
if(UNIX)
# Rely on PugiXML compiled with OpenImageIO
else()
include(cmake/pugixml.cmake)
endif()
include(cmake/pugixml.cmake)
if((NOT APPLE) OR ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
include(cmake/ispc.cmake)
include(cmake/openimagedenoise.cmake)

View File

@@ -42,7 +42,13 @@ if(UNIX)
endforeach()
if(APPLE)
if(NOT EXISTS "/usr/local/opt/bison/bin/bison")
# Homebrew has different default locations for ARM and Intel macOS.
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
set(HOMEBREW_LOCATION "/opt/homebrew")
else()
set(HOMEBREW_LOCATION "/usr/local")
endif()
if(NOT EXISTS "${HOMEBREW_LOCATION}/opt/bison/bin/bison")
string(APPEND _software_missing " bison")
endif()
endif()

View File

@@ -17,13 +17,14 @@
# ***** END GPL LICENSE BLOCK *****
set(CLANG_EXTRA_ARGS
-DCLANG_PATH_TO_LLVM_SOURCE=${BUILD_DIR}/ll/src/ll
-DCLANG_PATH_TO_LLVM_BUILD=${LIBDIR}/llvm
-DLLVM_DIR="${LIBDIR}/llvm/lib/cmake/llvm/"
-DLLVM_USE_CRT_RELEASE=MD
-DLLVM_USE_CRT_DEBUG=MDd
-DLLVM_CONFIG=${LIBDIR}/llvm/bin/llvm-config
)
set(BUILD_CLANG_TOOLS OFF)
if(WIN32)
set(CLANG_GENERATOR "Ninja")
else()
@@ -31,11 +32,32 @@ else()
endif()
if(APPLE)
set(BUILD_CLANG_TOOLS ON)
set(CLANG_EXTRA_ARGS ${CLANG_EXTRA_ARGS}
-DLIBXML2_LIBRARY=${LIBDIR}/xml2/lib/libxml2.a
)
endif()
if(BUILD_CLANG_TOOLS)
# ExternalProject_Add does not allow multiple tarballs to be
# downloaded. Work around this by having an empty build action
# for the extra tools, and referring the clang build to the location
# of the clang-tools-extra source.
ExternalProject_Add(external_clang_tools
URL ${CLANG_TOOLS_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${CLANG_TOOLS_HASH}
INSTALL_DIR ${LIBDIR}/clang_tools
PREFIX ${BUILD_DIR}/clang_tools
CONFIGURE_COMMAND echo "."
BUILD_COMMAND echo "."
INSTALL_COMMAND echo "."
)
list(APPEND CLANG_EXTRA_ARGS
-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=${BUILD_DIR}/clang_tools/src/external_clang_tools/
)
endif()
ExternalProject_Add(external_clang
URL ${CLANG_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -65,6 +87,14 @@ add_dependencies(
ll
)
if(BUILD_CLANG_TOOLS)
# `external_clang_tools` is for downloading the source, not compiling it.
add_dependencies(
external_clang
external_clang_tools
)
endif()
# We currently do not build libxml2 on Windows.
if(NOT WIN32)
add_dependencies(

View File

@@ -98,6 +98,10 @@ harvest(jpg/include jpeg/include "*.h")
harvest(jpg/lib jpeg/lib "libjpeg.a")
harvest(lame/lib ffmpeg/lib "*.a")
harvest(clang/bin llvm/bin "clang-format")
if(BUILD_CLANG_TOOLS)
harvest(clang/bin llvm/bin "clang-tidy")
harvest(clang/share/clang llvm/share "run-clang-tidy.py")
endif()
harvest(clang/include llvm/include "*")
harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config")
@@ -156,6 +160,8 @@ harvest(osl/lib osl/lib "*.a")
harvest(osl/shaders osl/shaders "*.h")
harvest(png/include png/include "*.h")
harvest(png/lib png/lib "*.a")
harvest(pugixml/include pugixml/include "*.hpp")
harvest(pugixml/lib pugixml/lib "*.a")
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}m")
harvest(python/include python/include "*h")
harvest(python/lib python/lib "*")

View File

@@ -25,8 +25,13 @@ if(WIN32)
elseif(APPLE)
# Use bison installed via Homebrew.
# The one which comes which Xcode toolset is too old.
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
set(HOMEBREW_LOCATION "/opt/homebrew")
else()
set(HOMEBREW_LOCATION "/usr/local")
endif()
set(ISPC_EXTRA_ARGS_APPLE
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
-DBISON_EXECUTABLE=${HOMEBREW_LOCATION}/opt/bison/bin/bison
)
elseif(UNIX)
set(ISPC_EXTRA_ARGS_UNIX

View File

@@ -112,6 +112,9 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DSTOP_ON_WARNING=OFF
-DUSE_EXTERNAL_PUGIXML=ON
-DPUGIXML_LIBRARY=${LIBDIR}/pugixml/lib/${LIBPREFIX}pugixml${LIBEXT}
-DPUGIXML_INCLUDE_DIR=${LIBDIR}/pugixml/include/
${WEBP_FLAGS}
${OIIO_SIMD_FLAGS}
)
@@ -134,6 +137,7 @@ add_dependencies(
external_jpeg
external_boost
external_tiff
external_pugixml
external_openjpeg${OPENJPEG_POSTFIX}
${WEBP_DEP}
)

View File

@@ -78,14 +78,10 @@ set(OSL_EXTRA_ARGS
-DINSTALL_DOCS=OFF
${OSL_SIMD_FLAGS}
-DPARTIO_LIBRARIES=
-DPUGIXML_HOME=${LIBDIR}/pugixml
)
if(WIN32)
set(OSL_EXTRA_ARGS
${OSL_EXTRA_ARGS}
-DPUGIXML_HOME=${LIBDIR}/pugixml
)
elseif(APPLE)
if(APPLE)
# Make symbol hiding consistent with OIIO which defaults to OFF,
# avoids linker warnings on macOS
set(OSL_EXTRA_ARGS
@@ -114,17 +110,9 @@ add_dependencies(
external_zlib
external_flexbison
external_openimageio
external_pugixml
)
if(UNIX)
# Rely on PugiXML compiled with OpenImageIO
else()
add_dependencies(
external_osl
external_pugixml
)
endif()
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_osl after_install

View File

@@ -30,13 +30,13 @@ ExternalProject_Add(external_pugixml
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_pugixml after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pugixml/lib/pugixml.lib ${HARVEST_TARGET}/osl/lib/pugixml.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pugixml ${HARVEST_TARGET}/pugixml
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_pugixml after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pugixml/lib/pugixml.lib ${HARVEST_TARGET}/osl/lib/pugixml_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pugixml/lib/pugixml.lib ${HARVEST_TARGET}/pugixml/lib/pugixml_d.lib
DEPENDEES install
)
endif()

View File

@@ -120,6 +120,9 @@ set(LLVM_HASH 31eb9ce73dd2a0f8dcab8319fb03f8fc)
set(CLANG_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang-${LLVM_VERSION}.src.tar.xz)
set(CLANG_HASH 13468e4a44940efef1b75e8641752f90)
set(CLANG_TOOLS_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang-tools-extra-${LLVM_VERSION}.src.tar.xz)
set(CLANG_TOOLS_HASH c76293870b564c6a7968622b475b7646)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)

View File

@@ -34,3 +34,24 @@ diff -Naur orig/src/include/OpenImageIO/platform.h external_openimageio/src/incl
# include <windows.h>
#endif
diff -Naur orig/src/libutil/ustring.cpp external_openimageio/src/libutil/ustring.cpp
--- orig/src/libutil/ustring.cpp 2020-05-11 05:43:52.000000000 +0200
+++ external_openimageio/src/libutil/ustring.cpp 2020-11-26 12:06:08.000000000 +0100
@@ -337,6 +337,8 @@
// the std::string to make it point to our chars! In such a case, the
// destructor will be careful not to allow a deallocation.
+ // Disable internal std::string for Apple silicon based Macs
+#if !(defined(__APPLE__) && defined(__arm64__))
#if defined(__GNUC__) && !defined(_LIBCPP_VERSION) \
&& defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI
// NEW gcc ABI
@@ -382,7 +384,7 @@
return;
}
#endif
-
+#endif
// Remaining cases - just assign the internal string. This may result
// in double allocation for the chars. If you care about that, do
// something special for your platform, much like we did for gcc and

View File

@@ -64,7 +64,12 @@ class WindowsCodeSigner(BaseCodeSigner):
def run_codesign_tool(self, filepath: Path) -> None:
command = self.get_sign_command_prefix() + [filepath]
codesign_output = self.check_output_or_mock(command, util.Platform.WINDOWS)
try:
codesign_output = self.check_output_or_mock(command, util.Platform.WINDOWS)
except subprocess.CalledProcessError as e:
raise SigntoolException(f'Error running signtool {e}')
logger_server.info(f'signtool output:\n{codesign_output}')
got_number_of_success = False

View File

@@ -49,7 +49,7 @@ FIND_LIBRARY(PUGIXML_LIBRARY
# handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PUGIXML DEFAULT_MSG
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PugiXML DEFAULT_MSG
PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
IF(PUGIXML_FOUND)

View File

@@ -1,7 +1,10 @@
# Distributed under the OSI-approved BSD 3-Clause License,
# see accompanying file BSD-3-Clause-license.txt for details.
# Blender: disable ASAN leak detection when trying to discover tests.
# Changes made to this script have been marked with "BLENDER".
# BLENDER: disable ASAN leak detection when trying to discover tests.
set(ENV{ASAN_OPTIONS} "detect_leaks=0")
cmake_minimum_required(VERSION ${CMAKE_VERSION})

View File

@@ -73,9 +73,6 @@ endif()
if(NOT DEFINED LIBDIR)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
# Prefer lib directory paths
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
endif()
@@ -83,6 +80,10 @@ if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
endif()
# Prefer lib directory paths
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
# -------------------------------------------------------------------------
# Find precompiled libraries, and avoid system or user-installed ones.
@@ -269,6 +270,14 @@ if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
string(APPEND PLATFORM_LINKFLAGS " -liconv") # boost_locale and ffmpeg needs it !
endif()
if(WITH_PUGIXML)
find_package(PugiXML)
if(NOT PUGIXML_FOUND)
message(WARNING "PugiXML not found, disabling WITH_PUGIXML")
set(WITH_PUGIXML OFF)
endif()
endif()
if(WITH_OPENIMAGEIO)
find_package(OpenImageIO)
list(APPEND OPENIMAGEIO_LIBRARIES
@@ -337,7 +346,7 @@ if(WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)
# Increase stack size for Embree, only works for executables.
if(NOT WITH_PYTHON_MODULE)
string(APPEND PLATFORM_LINKFLAGS " -Xlinker -stack_size -Xlinker 0x100000")
string(APPEND PLATFORM_LINKFLAGS " -Wl,-stack_size,0x100000")
endif()
# Embree static library linking can mix up SSE and AVX symbols, causing
@@ -449,8 +458,8 @@ endif()
# Avoid conflicts with Luxrender, and other plug-ins that may use the same
# libraries as Blender with a different version or build options.
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker '${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'"
string(APPEND PLATFORM_LINKFLAGS
" -Wl,-unexported_symbols_list,'${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'"
)
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++")

View File

@@ -350,15 +350,12 @@ if(WITH_BOOST)
endif()
endif()
if(WITH_PUGIXML)
find_package_wrapper(PugiXML)
endif()
if(WITH_OPENIMAGEIO)
find_package_wrapper(OpenImageIO)
if(NOT OPENIMAGEIO_PUGIXML_FOUND AND WITH_CYCLES_STANDALONE)
find_package_wrapper(PugiXML)
else()
set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}")
set(PUGIXML_LIBRARIES "")
endif()
set(OPENIMAGEIO_LIBRARIES
${OPENIMAGEIO_LIBRARIES}
${PNG_LIBRARIES}

View File

@@ -239,9 +239,24 @@ if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "\n\nWindows requires pre-compiled libs at: '${LIBDIR}'. Please run `make update` in the blender source folder to obtain them.")
endif()
if(CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND # Only supported in the VS IDE
MSVC_VERSION GREATER_EQUAL 1924 AND # Supported for 16.4+
WITH_CLANG_TIDY # And Clang Tidy needs to be on
)
set(CMAKE_VS_GLOBALS
"RunCodeAnalysis=false"
"EnableMicrosoftCodeAnalysis=false"
"EnableClangTidyCodeAnalysis=true"
)
set(VS_CLANG_TIDY On)
endif()
# Mark libdir as system headers with a lower warn level, to resolve some warnings
# that we have very little control over
if(MSVC_VERSION GREATER_EQUAL 1914 AND NOT MSVC_CLANG AND NOT WITH_WINDOWS_SCCACHE)
if(MSVC_VERSION GREATER_EQUAL 1914 AND # Available with 15.7+
NOT MSVC_CLANG AND # But not for clang
NOT WITH_WINDOWS_SCCACHE AND # And not when sccache is enabled
NOT VS_CLANG_TIDY) # Clang-tidy does not like these options
add_compile_options(/experimental:external /external:templates- /external:I "${LIBDIR}" /external:W0)
endif()
@@ -253,6 +268,11 @@ foreach(child ${children})
endif()
endforeach()
if(WITH_PUGIXML)
set(PUGIXML_LIBRARIES optimized ${LIBDIR}/pugixml/lib/pugixml.lib debug ${LIBDIR}/pugixml/lib/pugixml_d.lib)
set(PUGIXML_INCLUDE_DIR ${LIBDIR}/pugixml/include)
endif()
set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz_st.lib)
set(ZLIB_INCLUDE_DIR ${LIBDIR}/zlib/include)
@@ -651,11 +671,10 @@ if(WITH_CYCLES_OSL)
optimized ${OSL_LIB_COMP}
optimized ${OSL_LIB_EXEC}
optimized ${OSL_LIB_QUERY}
optimized ${CYCLES_OSL}/lib/pugixml.lib
debug ${OSL_LIB_EXEC_DEBUG}
debug ${OSL_LIB_COMP_DEBUG}
debug ${OSL_LIB_QUERY_DEBUG}
debug ${CYCLES_OSL}/lib/pugixml_d.lib
${PUGIXML_LIBRARIES}
)
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)

View File

@@ -92,5 +92,5 @@ echo if "%%VSCMD_VER%%" == "" ^( >> %BUILD_DIR%\rebuild.cmd
echo call "%VCVARS%" %BUILD_ARCH% >> %BUILD_DIR%\rebuild.cmd
echo ^) >> %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
echo ninja install >> %BUILD_DIR%\rebuild.cmd
echo ninja install %%* >> %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd

View File

@@ -453,7 +453,7 @@ TYPEDEF_HIDES_STRUCT = NO
# the optimal cache size from a speed point of view.
# Minimum value: 0, maximum value: 9, default value: 0.
LOOKUP_CACHE_SIZE = 0
LOOKUP_CACHE_SIZE = 3
#---------------------------------------------------------------------------
# Build related configuration options
@@ -1321,7 +1321,7 @@ DOCSET_PUBLISHER_NAME = Publisher
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_HTMLHELP = YES
GENERATE_HTMLHELP = NO
# The CHM_FILE tag can be used to specify the file name of the resulting .chm
# file. You can add a path in front of the file if the result should not be

View File

@@ -0,0 +1,30 @@
"""
.. note::
Properties defined at run-time store the values of the properties as custom-properties.
This method checks if the underlying data exists, causing the property to be considered *set*.
A common pattern for operators is to calculate a value for the properties
that have not had their values explicitly set by the caller
(where the caller could be a key-binding, menu-items or Python script for example).
In the case of executing operators multiple times, values are re-used from the previous execution.
For example: subdividing a mesh with a smooth value of 1.0 will keep using
that value on subsequent calls to subdivision, unless the operator is called with
that property set to a different value.
This behavior can be disabled using the ``SKIP_SAVE`` option when the property is declared (see: :mod:`bpy.props`).
The ``ghost`` argument allows detecting how a value from a previous execution is handled.
- When true: The property is considered unset even if the value from a previous call is used.
- When false: The existence of any values causes ``is_property_set`` to return true.
While this argument should typically be omitted, there are times when
it's important to know if a value is anything besides the default.
For example, the previous value may have been scaled by the scene's unit scale.
In this case scaling the value multiple times would cause problems, so the ``ghost`` argument should be false.
"""

View File

@@ -551,7 +551,7 @@ def example_extract_docstring(filepath):
file.close()
return "", 0
for line in file.readlines():
for line in file:
line_no += 1
if line.startswith('"""'):
break
@@ -559,6 +559,13 @@ def example_extract_docstring(filepath):
text.append(line.rstrip())
line_no += 1
# Skip over blank lines so the Python code doesn't have blank lines at the top.
for line in file:
if line.strip():
break
line_no += 1
file.close()
return "\n".join(text), line_no

5
extern/audaspace/README.blender vendored Normal file
View File

@@ -0,0 +1,5 @@
Project: Audaspace
URL: https://audaspace.github.io/
License: Apache 2.0
Upstream version: 1.3 (Last Release)
Local modifications: None

5
extern/bullet2/README.blender vendored Normal file
View File

@@ -0,0 +1,5 @@
Project: Bullet Continuous Collision Detection and Physics Library
URL: http://bulletphysics.org
License: zlib
Upstream version: 3.07
Local modifications: Fixed inertia

View File

@@ -1,4 +1,5 @@
Project: Ceres Solver
URL: http://ceres-solver.org/
License: BSD 3-Clause
Upstream version 2.0.0
Local modifications: None

View File

@@ -1,5 +1,5 @@
Project: Curve-Fit-nD
URL: https://github.com/ideasman42/curve-fit-nd
License: BSD 3-Clause
Upstream version: Unknown (Last Release)
Upstream version: ddcd5bd (Last Release)
Local modifications: None

View File

@@ -19,20 +19,24 @@
# ***** END GPL LICENSE BLOCK *****
# Build Draco library.
add_subdirectory(dracoenc)
add_subdirectory(draco)
# Build blender-draco-exporter module.
# Build Draco-Blender bridging module.
set(SRC
src/draco-compressor.cpp
src/draco-compressor.h
src/common.cpp
src/common.h
src/decoder.cpp
src/decoder.h
src/encoder.cpp
src/encoder.h
)
set(INC
dracoenc/src
draco/src
)
set(LIB
dracoenc
draco
)
add_library(extern_draco SHARED "${SRC}")

5
extern/draco/README.blender vendored Normal file
View File

@@ -0,0 +1,5 @@
Project: Draco
URL: https://google.github.io/draco/
License: Apache 2.0
Upstream version: 1.3.6
Local modifications: None

View File

@@ -2,103 +2,165 @@ remove_strict_flags()
set(SRC
src/draco/animation/keyframe_animation.cc
src/draco/animation/keyframe_animation.h
src/draco/animation/keyframe_animation_decoder.cc
src/draco/animation/keyframe_animation_decoder.h
src/draco/animation/keyframe_animation_encoder.cc
src/draco/animation/keyframe_animation_encoder.h
src/draco/animation/keyframe_animation.h
src/draco/attributes/attribute_octahedron_transform.cc
src/draco/attributes/attribute_octahedron_transform.h
src/draco/attributes/attribute_quantization_transform.cc
src/draco/attributes/attribute_quantization_transform.h
src/draco/attributes/attribute_transform.cc
src/draco/attributes/attribute_transform_data.h
src/draco/attributes/attribute_transform.h
src/draco/attributes/attribute_transform_data.h
src/draco/attributes/attribute_transform_type.h
src/draco/attributes/geometry_attribute.cc
src/draco/attributes/geometry_attribute.h
src/draco/attributes/geometry_indices.h
src/draco/attributes/point_attribute.cc
src/draco/attributes/point_attribute.h
src/draco/compression/attributes/attributes_decoder.cc
src/draco/compression/attributes/attributes_decoder.h
src/draco/compression/attributes/attributes_decoder_interface.h
src/draco/compression/attributes/attributes_encoder.cc
src/draco/compression/attributes/attributes_encoder.h
src/draco/compression/attributes/kd_tree_attributes_decoder.cc
src/draco/compression/attributes/kd_tree_attributes_decoder.h
src/draco/compression/attributes/kd_tree_attributes_encoder.cc
src/draco/compression/attributes/kd_tree_attributes_encoder.h
src/draco/compression/attributes/kd_tree_attributes_shared.h
src/draco/compression/attributes/linear_sequencer.h
src/draco/compression/attributes/mesh_attribute_indices_encoding_data.h
src/draco/compression/attributes/normal_compression_utils.h
src/draco/compression/attributes/point_d_vector.h
src/draco/compression/attributes/points_sequencer.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_encoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_shared.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_data.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_encoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_decoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_encoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_area.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_base.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_decoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_encoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_decoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_encoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_decoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_encoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_decoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_encoder.h
src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_predictor.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_factory.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_interface.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_decoding_transform.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_decoder.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_encoder.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_factory.cc
src/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_factory.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_interface.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_encoding_transform.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_factory.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_interface.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_decoding_transform.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_encoding_transform.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_transform_base.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_decoding_transform.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_encoding_transform.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_decoding_transform.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_encoding_transform.h
src/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h
src/draco/compression/attributes/sequential_attribute_decoder.cc
src/draco/compression/attributes/sequential_attribute_decoder.h
src/draco/compression/attributes/sequential_attribute_decoders_controller.cc
src/draco/compression/attributes/sequential_attribute_decoders_controller.h
src/draco/compression/attributes/sequential_attribute_encoder.cc
src/draco/compression/attributes/sequential_attribute_encoder.h
src/draco/compression/attributes/sequential_attribute_encoders_controller.cc
src/draco/compression/attributes/sequential_attribute_encoders_controller.h
src/draco/compression/attributes/sequential_integer_attribute_decoder.cc
src/draco/compression/attributes/sequential_integer_attribute_decoder.h
src/draco/compression/attributes/sequential_integer_attribute_encoder.cc
src/draco/compression/attributes/sequential_integer_attribute_encoder.h
src/draco/compression/attributes/sequential_normal_attribute_decoder.cc
src/draco/compression/attributes/sequential_normal_attribute_decoder.h
src/draco/compression/attributes/sequential_normal_attribute_encoder.cc
src/draco/compression/attributes/sequential_normal_attribute_encoder.h
src/draco/compression/attributes/sequential_quantization_attribute_decoder.cc
src/draco/compression/attributes/sequential_quantization_attribute_decoder.h
src/draco/compression/attributes/sequential_quantization_attribute_encoder.cc
src/draco/compression/attributes/sequential_quantization_attribute_encoder.h
src/draco/compression/bit_coders/adaptive_rans_bit_coding_shared.h
src/draco/compression/bit_coders/adaptive_rans_bit_decoder.cc
src/draco/compression/bit_coders/adaptive_rans_bit_decoder.h
src/draco/compression/bit_coders/adaptive_rans_bit_encoder.cc
src/draco/compression/bit_coders/adaptive_rans_bit_encoder.h
src/draco/compression/bit_coders/direct_bit_decoder.cc
src/draco/compression/bit_coders/direct_bit_decoder.h
src/draco/compression/bit_coders/direct_bit_encoder.cc
src/draco/compression/bit_coders/direct_bit_encoder.h
src/draco/compression/bit_coders/folded_integer_bit_decoder.h
src/draco/compression/bit_coders/folded_integer_bit_encoder.h
src/draco/compression/bit_coders/rans_bit_decoder.cc
src/draco/compression/bit_coders/rans_bit_decoder.h
src/draco/compression/bit_coders/rans_bit_encoder.cc
src/draco/compression/bit_coders/rans_bit_encoder.h
src/draco/compression/bit_coders/symbol_bit_decoder.cc
src/draco/compression/bit_coders/symbol_bit_decoder.h
src/draco/compression/bit_coders/symbol_bit_encoder.cc
src/draco/compression/bit_coders/symbol_bit_encoder.h
src/draco/compression/config/compression_shared.h
src/draco/compression/config/decoder_options.h
src/draco/compression/config/draco_options.h
src/draco/compression/config/encoder_options.h
src/draco/compression/config/encoding_features.h
src/draco/compression/encode_base.h
src/draco/compression/decode.cc
src/draco/compression/decode.h
src/draco/compression/encode.cc
src/draco/compression/encode.h
src/draco/compression/encode_base.h
src/draco/compression/entropy/ans.h
src/draco/compression/entropy/rans_symbol_coding.h
src/draco/compression/entropy/rans_symbol_decoder.h
src/draco/compression/entropy/rans_symbol_encoder.h
src/draco/compression/entropy/shannon_entropy.cc
src/draco/compression/entropy/shannon_entropy.h
src/draco/compression/entropy/symbol_decoding.cc
src/draco/compression/entropy/symbol_decoding.h
src/draco/compression/entropy/symbol_encoding.cc
src/draco/compression/entropy/symbol_encoding.h
src/draco/compression/expert_encode.cc
src/draco/compression/expert_encode.h
src/draco/compression/mesh/mesh_decoder.cc
src/draco/compression/mesh/mesh_decoder.h
src/draco/compression/mesh/mesh_edgebreaker_decoder.cc
src/draco/compression/mesh/mesh_edgebreaker_decoder.h
src/draco/compression/mesh/mesh_edgebreaker_decoder_impl.cc
src/draco/compression/mesh/mesh_edgebreaker_decoder_impl.h
src/draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h
src/draco/compression/mesh/mesh_edgebreaker_encoder.cc
src/draco/compression/mesh/mesh_edgebreaker_encoder.h
src/draco/compression/mesh/mesh_edgebreaker_encoder_impl.cc
src/draco/compression/mesh/mesh_edgebreaker_encoder_impl.h
src/draco/compression/mesh/mesh_edgebreaker_encoder_impl_interface.h
src/draco/compression/mesh/mesh_edgebreaker_shared.h
src/draco/compression/mesh/mesh_edgebreaker_traversal_decoder.h
src/draco/compression/mesh/mesh_edgebreaker_traversal_encoder.h
src/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_decoder.h
src/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_encoder.h
src/draco/compression/mesh/mesh_edgebreaker_traversal_valence_decoder.h
src/draco/compression/mesh/mesh_edgebreaker_traversal_valence_encoder.h
src/draco/compression/mesh/mesh_encoder.cc
src/draco/compression/mesh/mesh_encoder.h
src/draco/compression/mesh/mesh_encoder_helpers.h
src/draco/compression/mesh/mesh_sequential_decoder.cc
src/draco/compression/mesh/mesh_sequential_decoder.h
src/draco/compression/mesh/mesh_sequential_encoder.cc
src/draco/compression/mesh/mesh_sequential_encoder.h
src/draco/compression/mesh/traverser/depth_first_traverser.h
@@ -106,18 +168,32 @@ set(SRC
src/draco/compression/mesh/traverser/mesh_attribute_indices_encoding_observer.h
src/draco/compression/mesh/traverser/mesh_traversal_sequencer.h
src/draco/compression/mesh/traverser/traverser_base.h
src/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_decoder.cc
src/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_decoder.h
src/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_encoder.cc
src/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_encoder.h
src/draco/compression/point_cloud/algorithms/float_points_tree_decoder.cc
src/draco/compression/point_cloud/algorithms/float_points_tree_decoder.h
src/draco/compression/point_cloud/algorithms/float_points_tree_encoder.cc
src/draco/compression/point_cloud/algorithms/float_points_tree_encoder.h
src/draco/compression/point_cloud/algorithms/integer_points_kd_tree_decoder.cc
src/draco/compression/point_cloud/algorithms/integer_points_kd_tree_decoder.h
src/draco/compression/point_cloud/algorithms/integer_points_kd_tree_encoder.cc
src/draco/compression/point_cloud/algorithms/integer_points_kd_tree_encoder.h
src/draco/compression/point_cloud/algorithms/point_cloud_compression_method.h
src/draco/compression/point_cloud/algorithms/point_cloud_types.h
src/draco/compression/point_cloud/algorithms/quantize_points_3.h
src/draco/compression/point_cloud/algorithms/queuing_policy.h
src/draco/compression/point_cloud/point_cloud_decoder.cc
src/draco/compression/point_cloud/point_cloud_decoder.h
src/draco/compression/point_cloud/point_cloud_encoder.cc
src/draco/compression/point_cloud/point_cloud_encoder.h
src/draco/compression/point_cloud/point_cloud_kd_tree_decoder.cc
src/draco/compression/point_cloud/point_cloud_kd_tree_decoder.h
src/draco/compression/point_cloud/point_cloud_kd_tree_encoder.cc
src/draco/compression/point_cloud/point_cloud_kd_tree_encoder.h
src/draco/compression/point_cloud/point_cloud_sequential_decoder.cc
src/draco/compression/point_cloud/point_cloud_sequential_decoder.h
src/draco/compression/point_cloud/point_cloud_sequential_encoder.cc
src/draco/compression/point_cloud/point_cloud_sequential_encoder.h
src/draco/core/bit_utils.cc
@@ -128,12 +204,15 @@ set(SRC
src/draco/core/cycle_timer.h
src/draco/core/data_buffer.cc
src/draco/core/data_buffer.h
src/draco/core/decoder_buffer.cc
src/draco/core/decoder_buffer.h
src/draco/core/divide.cc
src/draco/core/divide.h
src/draco/core/draco_index_type.h
src/draco/core/draco_index_type_vector.h
src/draco/core/draco_types.cc
src/draco/core/draco_types.h
src/draco/core/draco_version.h
src/draco/core/encoder_buffer.cc
src/draco/core/encoder_buffer.h
src/draco/core/hash_utils.cc
@@ -145,20 +224,21 @@ set(SRC
src/draco/core/quantization_utils.cc
src/draco/core/quantization_utils.h
src/draco/core/status.h
src/draco/core/statusor.h
src/draco/core/status_or.h
src/draco/core/varint_decoding.h
src/draco/core/varint_encoding.h
src/draco/core/vector_d.h
src/draco/mesh/corner_table.cc
src/draco/mesh/corner_table.h
src/draco/mesh/corner_table_iterators.h
src/draco/mesh/mesh.cc
src/draco/mesh/mesh.h
src/draco/mesh/mesh_are_equivalent.cc
src/draco/mesh/mesh_are_equivalent.h
src/draco/mesh/mesh_attribute_corner_table.cc
src/draco/mesh/mesh_attribute_corner_table.h
src/draco/mesh/mesh.cc
src/draco/mesh/mesh_cleanup.cc
src/draco/mesh/mesh_cleanup.h
src/draco/mesh/mesh.h
src/draco/mesh/mesh_misc_functions.cc
src/draco/mesh/mesh_misc_functions.h
src/draco/mesh/mesh_stripifier.cc
@@ -169,13 +249,15 @@ set(SRC
src/draco/metadata/geometry_metadata.cc
src/draco/metadata/geometry_metadata.h
src/draco/metadata/metadata.cc
src/draco/metadata/metadata.h
src/draco/metadata/metadata_decoder.cc
src/draco/metadata/metadata_decoder.h
src/draco/metadata/metadata_encoder.cc
src/draco/metadata/metadata_encoder.h
src/draco/metadata/metadata.h
src/draco/point_cloud/point_cloud_builder.cc
src/draco/point_cloud/point_cloud_builder.h
src/draco/point_cloud/point_cloud.cc
src/draco/point_cloud/point_cloud.h
src/draco/point_cloud/point_cloud_builder.cc
src/draco/point_cloud/point_cloud_builder.h
)
set(LIB
@@ -185,4 +267,5 @@ set(INC
src
)
blender_add_lib(dracoenc "${SRC}" "${INC}" "" "${LIB}")
blender_add_lib(draco "${SRC}" "${INC}" "" "${LIB}")

View File

@@ -29,8 +29,9 @@ bool KeyframeAnimation::SetTimestamps(
} else {
// Check if the number of frames is consistent with
// the existing keyframes.
if (num_frames != num_points())
if (num_frames != num_points()) {
return false;
}
}
} else {
// This is the first attribute.
@@ -40,10 +41,8 @@ bool KeyframeAnimation::SetTimestamps(
// Add attribute for time stamp data.
std::unique_ptr<PointAttribute> timestamp_att =
std::unique_ptr<PointAttribute>(new PointAttribute());
timestamp_att->Init(GeometryAttribute::GENERIC, nullptr, 1, DT_FLOAT32, false,
sizeof(float), 0);
timestamp_att->SetIdentityMapping();
timestamp_att->Reset(num_frames);
timestamp_att->Init(GeometryAttribute::GENERIC, 1, DT_FLOAT32, false,
num_frames);
for (PointIndex i(0); i < num_frames; ++i) {
timestamp_att->SetAttributeValue(timestamp_att->mapped_index(i),
&timestamp[i.value()]);

View File

@@ -71,30 +71,29 @@ int32_t KeyframeAnimation::AddKeyframes(DataType data_type,
uint32_t num_components,
const std::vector<T> &data) {
// TODO(draco-eng): Verify T is consistent with |data_type|.
if (num_components == 0)
if (num_components == 0) {
return -1;
}
// If timestamps is not added yet, then reserve attribute 0 for timestamps.
if (!num_attributes()) {
// Add a temporary attribute with 0 points to fill attribute id 0.
std::unique_ptr<PointAttribute> temp_att =
std::unique_ptr<PointAttribute>(new PointAttribute());
temp_att->Init(GeometryAttribute::GENERIC, nullptr, num_components,
data_type, false, DataTypeLength(data_type), 0);
temp_att->Reset(0);
temp_att->Init(GeometryAttribute::GENERIC, num_components, data_type, false,
0);
this->AddAttribute(std::move(temp_att));
set_num_frames(data.size() / num_components);
}
if (data.size() != num_components * num_frames())
if (data.size() != num_components * num_frames()) {
return -1;
}
std::unique_ptr<PointAttribute> keyframe_att =
std::unique_ptr<PointAttribute>(new PointAttribute());
keyframe_att->Init(GeometryAttribute::GENERIC, nullptr, num_components,
data_type, false, DataTypeLength(data_type), 0);
keyframe_att->SetIdentityMapping();
keyframe_att->Reset(num_frames());
keyframe_att->Init(GeometryAttribute::GENERIC, num_components, data_type,
false, num_frames());
const size_t stride = num_components;
for (PointIndex i(0); i < num_frames(); ++i) {
keyframe_att->SetAttributeValue(keyframe_att->mapped_index(i),

View File

@@ -21,8 +21,9 @@ Status KeyframeAnimationDecoder::Decode(const DecoderOptions &options,
KeyframeAnimation *animation) {
const auto status = PointCloudSequentialDecoder::Decode(
options, in_buffer, static_cast<PointCloud *>(animation));
if (!status.ok())
if (!status.ok()) {
return status;
}
return OkStatus();
}

View File

@@ -25,8 +25,9 @@ bool AttributeOctahedronTransform::InitFromAttribute(
const AttributeTransformData *const transform_data =
attribute.GetAttributeTransformData();
if (!transform_data ||
transform_data->transform_type() != ATTRIBUTE_OCTAHEDRON_TRANSFORM)
transform_data->transform_type() != ATTRIBUTE_OCTAHEDRON_TRANSFORM) {
return false; // Wrong transform type.
}
quantization_bits_ = transform_data->GetParameterValue<int32_t>(0);
return true;
}
@@ -68,8 +69,9 @@ AttributeOctahedronTransform::GeneratePortableAttribute(
float att_val[3];
int32_t dst_index = 0;
OctahedronToolBox converter;
if (!converter.SetQuantizationBits(quantization_bits_))
if (!converter.SetQuantizationBits(quantization_bits_)) {
return nullptr;
}
for (uint32_t i = 0; i < point_ids.size(); ++i) {
const AttributeValueIndex att_val_id = attribute.mapped_index(point_ids[i]);
attribute.GetValue(att_val_id, att_val);

View File

@@ -25,8 +25,9 @@ bool AttributeQuantizationTransform::InitFromAttribute(
const AttributeTransformData *const transform_data =
attribute.GetAttributeTransformData();
if (!transform_data ||
transform_data->transform_type() != ATTRIBUTE_QUANTIZATION_TRANSFORM)
transform_data->transform_type() != ATTRIBUTE_QUANTIZATION_TRANSFORM) {
return false; // Wrong transform type.
}
int32_t byte_offset = 0;
quantization_bits_ = transform_data->GetParameterValue<int32_t>(byte_offset);
byte_offset += 4;
@@ -80,22 +81,30 @@ bool AttributeQuantizationTransform::ComputeParameters(
++i) {
attribute.GetValue(i, att_val.get());
for (int c = 0; c < num_components; ++c) {
if (min_values_[c] > att_val[c])
if (min_values_[c] > att_val[c]) {
min_values_[c] = att_val[c];
if (max_values[c] < att_val[c])
}
if (max_values[c] < att_val[c]) {
max_values[c] = att_val[c];
}
}
}
for (int c = 0; c < num_components; ++c) {
if (std::isnan(min_values_[c]) || std::isinf(min_values_[c]) ||
std::isnan(max_values[c]) || std::isinf(max_values[c])) {
return false;
}
const float dif = max_values[c] - min_values_[c];
if (dif > range_)
if (dif > range_) {
range_ = dif;
}
}
// In case all values are the same, initialize the range to unit length. This
// will ensure that all values are quantized properly to the same value.
if (range_ == 0.f)
if (range_ == 0.f) {
range_ = 1.f;
}
return true;
}

View File

@@ -14,8 +14,6 @@
//
#include "draco/attributes/geometry_attribute.h"
using std::array;
namespace draco {
GeometryAttribute::GeometryAttribute()
@@ -45,8 +43,9 @@ void GeometryAttribute::Init(GeometryAttribute::Type attribute_type,
}
bool GeometryAttribute::CopyFrom(const GeometryAttribute &src_att) {
if (buffer_ == nullptr || src_att.buffer_ == nullptr)
if (buffer_ == nullptr || src_att.buffer_ == nullptr) {
return false;
}
buffer_->Update(src_att.buffer_->data(), src_att.buffer_->data_size());
num_components_ = src_att.num_components_;
data_type_ = src_att.data_type_;
@@ -55,27 +54,35 @@ bool GeometryAttribute::CopyFrom(const GeometryAttribute &src_att) {
byte_offset_ = src_att.byte_offset_;
attribute_type_ = src_att.attribute_type_;
buffer_descriptor_ = src_att.buffer_descriptor_;
unique_id_ = src_att.unique_id_;
return true;
}
bool GeometryAttribute::operator==(const GeometryAttribute &va) const {
if (attribute_type_ != va.attribute_type_)
if (attribute_type_ != va.attribute_type_) {
return false;
}
// It's OK to compare just the buffer descriptors here. We don't need to
// compare the buffers themselves.
if (buffer_descriptor_.buffer_id != va.buffer_descriptor_.buffer_id)
if (buffer_descriptor_.buffer_id != va.buffer_descriptor_.buffer_id) {
return false;
}
if (buffer_descriptor_.buffer_update_count !=
va.buffer_descriptor_.buffer_update_count)
va.buffer_descriptor_.buffer_update_count) {
return false;
if (num_components_ != va.num_components_)
}
if (num_components_ != va.num_components_) {
return false;
if (data_type_ != va.data_type_)
}
if (data_type_ != va.data_type_) {
return false;
if (byte_stride_ != va.byte_stride_)
}
if (byte_stride_ != va.byte_stride_) {
return false;
if (byte_offset_ != va.byte_offset_)
}
if (byte_offset_ != va.byte_offset_) {
return false;
}
return true;
}

View File

@@ -91,8 +91,9 @@ class GeometryAttribute {
// Byte address of the attribute index.
const int64_t byte_pos = byte_offset_ + byte_stride_ * att_index.value();
// Check we are not reading past end of data.
if (byte_pos + sizeof(*out) > buffer_->data_size())
if (byte_pos + sizeof(*out) > buffer_->data_size()) {
return false;
}
buffer_->Read(byte_pos, &((*out)[0]), sizeof(*out));
return true;
}
@@ -118,6 +119,13 @@ class GeometryAttribute {
buffer_->Read(byte_pos, out_data, byte_stride_);
}
// Sets a value of an attribute entry. The input value must be allocated to
// cover all components of a single attribute entry.
void SetAttributeValue(AttributeValueIndex entry_index, const void *value) {
const int64_t byte_pos = entry_index.value() * byte_stride();
buffer_->Write(byte_pos, value, byte_stride());
}
// DEPRECATED: Use
// ConvertValue(AttributeValueIndex att_id,
// int out_num_components,
@@ -139,8 +147,9 @@ class GeometryAttribute {
template <typename OutT>
bool ConvertValue(AttributeValueIndex att_id, int8_t out_num_components,
OutT *out_val) const {
if (out_val == nullptr)
if (out_val == nullptr) {
return false;
}
switch (data_type_) {
case DT_INT8:
return ConvertTypedValue<int8_t, OutT>(att_id, out_num_components,
@@ -191,6 +200,26 @@ class GeometryAttribute {
return ConvertValue<OutT>(att_index, num_components_, out_value);
}
// Utility function. Returns |attribute_type| as std::string.
static std::string TypeToString(Type attribute_type) {
switch (attribute_type) {
case INVALID:
return "INVALID";
case POSITION:
return "POSITION";
case NORMAL:
return "NORMAL";
case COLOR:
return "COLOR";
case TEX_COORD:
return "TEX_COORD";
case GENERIC:
return "GENERIC";
default:
return "UNKNOWN";
}
}
bool operator==(const GeometryAttribute &va) const;
// Returns the type of the attribute indicating the nature of the attribute.
@@ -285,8 +314,8 @@ struct GeometryAttributeHasher {
size_t hash = HashCombine(va.buffer_descriptor_.buffer_id,
va.buffer_descriptor_.buffer_update_count);
hash = HashCombine(va.num_components_, hash);
hash = HashCombine((int8_t)va.data_type_, hash);
hash = HashCombine((int8_t)va.attribute_type_, hash);
hash = HashCombine(static_cast<int8_t>(va.data_type_), hash);
hash = HashCombine(static_cast<int8_t>(va.attribute_type_), hash);
hash = HashCombine(va.byte_stride_, hash);
return HashCombine(va.byte_offset_, hash);
}

View File

@@ -32,20 +32,32 @@ PointAttribute::PointAttribute(const GeometryAttribute &att)
num_unique_entries_(0),
identity_mapping_(false) {}
void PointAttribute::Init(Type attribute_type, int8_t num_components,
DataType data_type, bool normalized,
size_t num_attribute_values) {
attribute_buffer_ = std::unique_ptr<DataBuffer>(new DataBuffer());
GeometryAttribute::Init(attribute_type, attribute_buffer_.get(),
num_components, data_type, normalized,
DataTypeLength(data_type) * num_components, 0);
Reset(num_attribute_values);
SetIdentityMapping();
}
void PointAttribute::CopyFrom(const PointAttribute &src_att) {
if (buffer() == nullptr) {
// If the destination attribute doesn't have a valid buffer, create it.
attribute_buffer_ = std::unique_ptr<DataBuffer>(new DataBuffer());
ResetBuffer(attribute_buffer_.get(), 0, 0);
}
if (!GeometryAttribute::CopyFrom(src_att))
if (!GeometryAttribute::CopyFrom(src_att)) {
return;
}
identity_mapping_ = src_att.identity_mapping_;
num_unique_entries_ = src_att.num_unique_entries_;
indices_map_ = src_att.indices_map_;
if (src_att.attribute_transform_data_) {
attribute_transform_data_ = std::unique_ptr<AttributeTransformData>(
new AttributeTransformData(*src_att.attribute_transform_data_.get()));
new AttributeTransformData(*src_att.attribute_transform_data_));
} else {
attribute_transform_data_ = nullptr;
}
@@ -56,14 +68,20 @@ bool PointAttribute::Reset(size_t num_attribute_values) {
attribute_buffer_ = std::unique_ptr<DataBuffer>(new DataBuffer());
}
const int64_t entry_size = DataTypeLength(data_type()) * num_components();
if (!attribute_buffer_->Update(nullptr, num_attribute_values * entry_size))
if (!attribute_buffer_->Update(nullptr, num_attribute_values * entry_size)) {
return false;
}
// Assign the new buffer to the parent attribute.
ResetBuffer(attribute_buffer_.get(), entry_size, 0);
num_unique_entries_ = static_cast<uint32_t>(num_attribute_values);
return true;
}
void PointAttribute::Resize(size_t new_num_unique_entries) {
num_unique_entries_ = static_cast<uint32_t>(new_num_unique_entries);
attribute_buffer_->Resize(new_num_unique_entries * byte_stride());
}
#ifdef DRACO_ATTRIBUTE_VALUES_DEDUPLICATION_SUPPORTED
AttributeValueIndex::ValueType PointAttribute::DeduplicateValues(
const GeometryAttribute &in_att) {
@@ -100,8 +118,9 @@ AttributeValueIndex::ValueType PointAttribute::DeduplicateValues(
default:
return -1; // Unsupported data type.
}
if (unique_vals == 0)
if (unique_vals == 0) {
return -1; // Unexpected error.
}
return unique_vals;
}
@@ -181,8 +200,9 @@ AttributeValueIndex::ValueType PointAttribute::DeduplicateFormattedValues(
++unique_vals;
}
}
if (unique_vals == num_unique_entries_)
if (unique_vals == num_unique_entries_) {
return unique_vals.value(); // Nothing has changed.
}
if (is_mapping_identity()) {
// Change identity mapping to the explicit one.
// The number of points is equal to the number of old unique values.

View File

@@ -17,13 +17,12 @@
#include <memory>
#include "draco/draco_features.h"
#include "draco/attributes/attribute_transform_data.h"
#include "draco/attributes/geometry_attribute.h"
#include "draco/core/draco_index_type_vector.h"
#include "draco/core/hash_utils.h"
#include "draco/core/macros.h"
#include "draco/draco_features.h"
namespace draco {
@@ -41,6 +40,12 @@ class PointAttribute : public GeometryAttribute {
PointAttribute(PointAttribute &&attribute) = default;
PointAttribute &operator=(PointAttribute &&attribute) = default;
// Initializes a point attribute. By default the attribute will be set to
// identity mapping between point indices and attribute values. To set custom
// mapping use SetExplicitMapping() function.
void Init(Type attribute_type, int8_t num_components, DataType data_type,
bool normalized, size_t num_attribute_values);
// Copies attribute data from the provided |src_att| attribute.
void CopyFrom(const PointAttribute &src_att);
@@ -49,15 +54,17 @@ class PointAttribute : public GeometryAttribute {
size_t size() const { return num_unique_entries_; }
AttributeValueIndex mapped_index(PointIndex point_index) const {
if (identity_mapping_)
if (identity_mapping_) {
return AttributeValueIndex(point_index.value());
}
return indices_map_[point_index];
}
DataBuffer *buffer() const { return attribute_buffer_.get(); }
bool is_mapping_identity() const { return identity_mapping_; }
size_t indices_map_size() const {
if (is_mapping_identity())
if (is_mapping_identity()) {
return 0;
}
return indices_map_.size();
}
@@ -65,10 +72,14 @@ class PointAttribute : public GeometryAttribute {
return GetAddress(mapped_index(point_index));
}
// Sets the new number of unique attribute entries for the attribute.
void Resize(size_t new_num_unique_entries) {
num_unique_entries_ = static_cast<uint32_t>(new_num_unique_entries);
}
// Sets the new number of unique attribute entries for the attribute. The
// function resizes the attribute storage to hold |num_attribute_values|
// entries.
// All previous entries with AttributeValueIndex < |num_attribute_values|
// are preserved. Caller needs to ensure that the PointAttribute is still
// valid after the resizing operation (that is, each point is mapped to a
// valid attribute value).
void Resize(size_t new_num_unique_entries);
// Functions for setting the type of mapping between point indices and
// attribute entry ids.
@@ -92,13 +103,6 @@ class PointAttribute : public GeometryAttribute {
indices_map_[point_index] = entry_index;
}
// Sets a value of an attribute entry. The input value must be allocated to
// cover all components of a single attribute entry.
void SetAttributeValue(AttributeValueIndex entry_index, const void *value) {
const int64_t byte_pos = entry_index.value() * byte_stride();
buffer()->Write(byte_pos, value, byte_stride());
}
// Same as GeometryAttribute::GetValue(), but using point id as the input.
// Mapping to attribute value index is performed automatically.
void GetMappedValue(PointIndex point_index, void *out_data) const {
@@ -165,7 +169,7 @@ struct PointAttributeHasher {
hash = HashCombine(attribute.identity_mapping_, hash);
hash = HashCombine(attribute.num_unique_entries_, hash);
hash = HashCombine(attribute.indices_map_.size(), hash);
if (attribute.indices_map_.size() > 0) {
if (!attribute.indices_map_.empty()) {
const uint64_t indices_hash = FingerprintString(
reinterpret_cast<const char *>(attribute.indices_map_.data()),
attribute.indices_map_.size());

View File

@@ -33,31 +33,42 @@ bool AttributesDecoder::DecodeAttributesDecoderData(DecoderBuffer *in_buffer) {
#ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
if (point_cloud_decoder_->bitstream_version() <
DRACO_BITSTREAM_VERSION(2, 0)) {
if (!in_buffer->Decode(&num_attributes))
if (!in_buffer->Decode(&num_attributes)) {
return false;
}
} else
#endif
{
if (!DecodeVarint(&num_attributes, in_buffer))
if (!DecodeVarint(&num_attributes, in_buffer)) {
return false;
}
}
if (num_attributes == 0)
if (num_attributes == 0) {
return false;
}
point_attribute_ids_.resize(num_attributes);
PointCloud *pc = point_cloud_;
for (uint32_t i = 0; i < num_attributes; ++i) {
// Decode attribute descriptor data.
uint8_t att_type, data_type, num_components, normalized;
if (!in_buffer->Decode(&att_type))
if (!in_buffer->Decode(&att_type)) {
return false;
if (!in_buffer->Decode(&data_type))
}
if (!in_buffer->Decode(&data_type)) {
return false;
if (!in_buffer->Decode(&num_components))
}
if (!in_buffer->Decode(&num_components)) {
return false;
if (!in_buffer->Decode(&normalized))
}
if (!in_buffer->Decode(&normalized)) {
return false;
if (data_type <= DT_INVALID || data_type >= DT_TYPES_COUNT)
}
if (att_type >= GeometryAttribute::NAMED_ATTRIBUTES_COUNT) {
return false;
}
if (data_type == DT_INVALID || data_type >= DT_TYPES_COUNT) {
return false;
}
const DataType draco_dt = static_cast<DataType>(data_type);
// Add the attribute to the point cloud
@@ -70,8 +81,9 @@ bool AttributesDecoder::DecodeAttributesDecoderData(DecoderBuffer *in_buffer) {
if (point_cloud_decoder_->bitstream_version() <
DRACO_BITSTREAM_VERSION(1, 3)) {
uint16_t custom_id;
if (!in_buffer->Decode(&custom_id))
if (!in_buffer->Decode(&custom_id)) {
return false;
}
// TODO(draco-eng): Add "custom_id" to attribute metadata.
unique_id = static_cast<uint32_t>(custom_id);
ga.set_unique_id(unique_id);
@@ -87,8 +99,10 @@ bool AttributesDecoder::DecodeAttributesDecoderData(DecoderBuffer *in_buffer) {
point_attribute_ids_[i] = att_id;
// Update the inverse map.
if (att_id >= static_cast<int32_t>(point_attribute_to_local_id_map_.size()))
if (att_id >=
static_cast<int32_t>(point_attribute_to_local_id_map_.size())) {
point_attribute_to_local_id_map_.resize(att_id + 1, -1);
}
point_attribute_to_local_id_map_[att_id] = i;
}
return true;

View File

@@ -17,11 +17,10 @@
#include <vector>
#include "draco/draco_features.h"
#include "draco/compression/attributes/attributes_decoder_interface.h"
#include "draco/compression/point_cloud/point_cloud_decoder.h"
#include "draco/core/decoder_buffer.h"
#include "draco/draco_features.h"
#include "draco/point_cloud/point_cloud.h"
namespace draco {
@@ -54,12 +53,15 @@ class AttributesDecoder : public AttributesDecoderInterface {
// Decodes attribute data from the source buffer.
bool DecodeAttributes(DecoderBuffer *in_buffer) override {
if (!DecodePortableAttributes(in_buffer))
if (!DecodePortableAttributes(in_buffer)) {
return false;
if (!DecodeDataNeededByPortableTransforms(in_buffer))
}
if (!DecodeDataNeededByPortableTransforms(in_buffer)) {
return false;
if (!TransformAttributesToOriginalFormat())
}
if (!TransformAttributesToOriginalFormat()) {
return false;
}
return true;
}
@@ -67,8 +69,9 @@ class AttributesDecoder : public AttributesDecoderInterface {
int32_t GetLocalIdForPointAttribute(int32_t point_attribute_id) const {
const int id_map_size =
static_cast<int>(point_attribute_to_local_id_map_.size());
if (point_attribute_id >= id_map_size)
if (point_attribute_id >= id_map_size) {
return -1;
}
return point_attribute_to_local_id_map_[point_attribute_id];
}
virtual bool DecodePortableAttributes(DecoderBuffer *in_buffer) = 0;

View File

@@ -48,15 +48,18 @@ class AttributesEncoder {
// Encode attribute data to the target buffer.
virtual bool EncodeAttributes(EncoderBuffer *out_buffer) {
if (!TransformAttributesToPortableFormat())
if (!TransformAttributesToPortableFormat()) {
return false;
if (!EncodePortableAttributes(out_buffer))
}
if (!EncodePortableAttributes(out_buffer)) {
return false;
}
// Encode data needed by portable transforms after the attribute is encoded.
// This corresponds to the order in which the data is going to be decoded by
// the decoder.
if (!EncodeDataNeededByPortableTransforms(out_buffer))
if (!EncodeDataNeededByPortableTransforms(out_buffer)) {
return false;
}
return true;
}
@@ -87,8 +90,9 @@ class AttributesEncoder {
void AddAttributeId(int32_t id) {
point_attribute_ids_.push_back(id);
if (id >= static_cast<int32_t>(point_attribute_to_local_id_map_.size()))
if (id >= static_cast<int32_t>(point_attribute_to_local_id_map_.size())) {
point_attribute_to_local_id_map_.resize(id + 1, -1);
}
point_attribute_to_local_id_map_[id] =
static_cast<int32_t>(point_attribute_ids_.size()) - 1;
}
@@ -127,8 +131,9 @@ class AttributesEncoder {
int32_t GetLocalIdForPointAttribute(int32_t point_attribute_id) const {
const int id_map_size =
static_cast<int>(point_attribute_to_local_id_map_.size());
if (point_attribute_id >= id_map_size)
if (point_attribute_id >= id_map_size) {
return -1;
}
return point_attribute_to_local_id_map_[point_attribute_id];
}

View File

@@ -13,6 +13,7 @@
// limitations under the License.
//
#include "draco/compression/attributes/kd_tree_attributes_decoder.h"
#include "draco/compression/attributes/kd_tree_attributes_shared.h"
#include "draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_decoder.h"
#include "draco/compression/point_cloud/algorithms/float_points_tree_decoder.h"
@@ -92,7 +93,7 @@ class PointAttributeVectorOutputIterator {
const uint32_t &data_size = std::get<3>(att);
const uint32_t &num_components = std::get<4>(att);
const uint32_t *data_source = val.data() + offset;
if (data_size != 4) { // handle uint16_t, uint8_t
if (data_size < 4) { // handle uint16_t, uint8_t
// selectively copy data bytes
uint8_t *data_counter = data_;
for (uint32_t index = 0; index < num_components;
@@ -103,8 +104,9 @@ class PointAttributeVectorOutputIterator {
data_source = reinterpret_cast<uint32_t *>(data_);
}
const AttributeValueIndex avi = attribute->mapped_index(point_id_);
if (avi >= static_cast<uint32_t>(attribute->size()))
if (avi >= static_cast<uint32_t>(attribute->size())) {
return *this;
}
attribute->SetAttributeValue(avi, data_source);
}
return *this;
@@ -134,8 +136,9 @@ bool KdTreeAttributesDecoder::DecodePortableAttributes(
return true;
}
uint8_t compression_level = 0;
if (!in_buffer->Decode(&compression_level))
if (!in_buffer->Decode(&compression_level)) {
return false;
}
const int32_t num_points = GetDecoder()->point_cloud()->num_points();
// Decode data using the kd tree decoding into integer (portable) attributes.
@@ -197,44 +200,51 @@ bool KdTreeAttributesDecoder::DecodePortableAttributes(
switch (compression_level) {
case 0: {
DynamicIntegerPointsKdTreeDecoder<0> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 1: {
DynamicIntegerPointsKdTreeDecoder<1> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 2: {
DynamicIntegerPointsKdTreeDecoder<2> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 3: {
DynamicIntegerPointsKdTreeDecoder<3> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 4: {
DynamicIntegerPointsKdTreeDecoder<4> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 5: {
DynamicIntegerPointsKdTreeDecoder<5> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 6: {
DynamicIntegerPointsKdTreeDecoder<6> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
default:
@@ -256,22 +266,26 @@ bool KdTreeAttributesDecoder::DecodeDataNeededByPortableTransforms(
if (att->data_type() == DT_FLOAT32) {
const int num_components = att->num_components();
min_value.resize(num_components);
if (!in_buffer->Decode(&min_value[0], sizeof(float) * num_components))
if (!in_buffer->Decode(&min_value[0], sizeof(float) * num_components)) {
return false;
}
float max_value_dif;
if (!in_buffer->Decode(&max_value_dif))
if (!in_buffer->Decode(&max_value_dif)) {
return false;
}
uint8_t quantization_bits;
if (!in_buffer->Decode(&quantization_bits) || quantization_bits > 31)
if (!in_buffer->Decode(&quantization_bits) || quantization_bits > 31) {
return false;
}
AttributeQuantizationTransform transform;
transform.SetParameters(quantization_bits, min_value.data(),
num_components, max_value_dif);
const int num_transforms =
static_cast<int>(attribute_quantization_transforms_.size());
if (!transform.TransferToAttribute(
quantized_portable_attributes_[num_transforms].get()))
quantized_portable_attributes_[num_transforms].get())) {
return false;
}
attribute_quantization_transforms_.push_back(transform);
}
}
@@ -299,6 +313,10 @@ bool KdTreeAttributesDecoder::DecodeDataNeededByPortableTransforms(
const DataType data_type = att->data_type();
const uint32_t data_size = (std::max)(0, DataTypeLength(data_type));
const uint32_t num_components = att->num_components();
if (data_size > 4) {
return false;
}
atts[attribute_index] = std::make_tuple(
att, total_dimensionality, data_type, data_size, num_components);
// everything is treated as 32bit in the encoder.
@@ -310,24 +328,30 @@ bool KdTreeAttributesDecoder::DecodeDataNeededByPortableTransforms(
att->SetIdentityMapping();
// Decode method
uint8_t method;
if (!in_buffer->Decode(&method))
if (!in_buffer->Decode(&method)) {
return false;
}
if (method == KdTreeAttributesEncodingMethod::kKdTreeQuantizationEncoding) {
uint8_t compression_level = 0;
if (!in_buffer->Decode(&compression_level))
if (!in_buffer->Decode(&compression_level)) {
return false;
}
uint32_t num_points = 0;
if (!in_buffer->Decode(&num_points))
if (!in_buffer->Decode(&num_points)) {
return false;
}
att->Reset(num_points);
FloatPointsTreeDecoder decoder;
decoder.set_num_points_from_header(num_points);
PointAttributeVectorOutputIterator<float> out_it(atts);
if (!decoder.DecodePointCloud(in_buffer, out_it))
if (!decoder.DecodePointCloud(in_buffer, out_it)) {
return false;
}
} else if (method == KdTreeAttributesEncodingMethod::kKdTreeIntegerEncoding) {
uint8_t compression_level = 0;
if (!in_buffer->Decode(&compression_level))
if (!in_buffer->Decode(&compression_level)) {
return false;
}
if (6 < compression_level) {
LOGE("KdTreeAttributesDecoder: compression level %i not supported.\n",
compression_level);
@@ -335,8 +359,9 @@ bool KdTreeAttributesDecoder::DecodeDataNeededByPortableTransforms(
}
uint32_t num_points;
if (!in_buffer->Decode(&num_points))
if (!in_buffer->Decode(&num_points)) {
return false;
}
for (auto attribute_index = 0;
static_cast<uint32_t>(attribute_index) < attribute_count;
@@ -353,44 +378,51 @@ bool KdTreeAttributesDecoder::DecodeDataNeededByPortableTransforms(
switch (compression_level) {
case 0: {
DynamicIntegerPointsKdTreeDecoder<0> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 1: {
DynamicIntegerPointsKdTreeDecoder<1> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 2: {
DynamicIntegerPointsKdTreeDecoder<2> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 3: {
DynamicIntegerPointsKdTreeDecoder<3> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 4: {
DynamicIntegerPointsKdTreeDecoder<4> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 5: {
DynamicIntegerPointsKdTreeDecoder<5> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
case 6: {
DynamicIntegerPointsKdTreeDecoder<6> decoder(total_dimensionality);
if (!decoder.DecodePoints(in_buffer, out_it))
if (!decoder.DecodePoints(in_buffer, out_it)) {
return false;
}
break;
}
default:
@@ -445,16 +477,19 @@ bool KdTreeAttributesDecoder::TransformAttributesToOriginalFormat() {
// Values are stored as unsigned in the attribute, make them signed again.
if (att->data_type() == DT_INT32) {
if (!TransformAttributeBackToSignedType<int32_t>(
att, num_processed_signed_components))
att, num_processed_signed_components)) {
return false;
}
} else if (att->data_type() == DT_INT16) {
if (!TransformAttributeBackToSignedType<int16_t>(
att, num_processed_signed_components))
att, num_processed_signed_components)) {
return false;
}
} else if (att->data_type() == DT_INT8) {
if (!TransformAttributeBackToSignedType<int8_t>(
att, num_processed_signed_components))
att, num_processed_signed_components)) {
return false;
}
}
num_processed_signed_components += att->num_components();
} else if (att->data_type() == DT_FLOAT32) {
@@ -491,8 +526,9 @@ bool KdTreeAttributesDecoder::TransformAttributesToOriginalFormat() {
int quant_val_id = 0;
int out_byte_pos = 0;
Dequantizer dequantizer;
if (!dequantizer.Init(transform.range(), max_quantized_value))
if (!dequantizer.Init(transform.range(), max_quantized_value)) {
return false;
}
const uint32_t *const portable_attribute_data =
reinterpret_cast<const uint32_t *>(
src_att->GetAddress(AttributeValueIndex(0)));

View File

@@ -13,6 +13,7 @@
// limitations under the License.
//
#include "draco/compression/attributes/kd_tree_attributes_encoder.h"
#include "draco/compression/attributes/kd_tree_attributes_shared.h"
#include "draco/compression/attributes/point_d_vector.h"
#include "draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_encoder.h"
@@ -50,8 +51,9 @@ bool KdTreeAttributesEncoder::TransformAttributesToPortableFormat() {
AttributeQuantizationTransform attribute_quantization_transform;
const int quantization_bits = encoder()->options()->GetAttributeInt(
att_id, "quantization_bits", -1);
if (quantization_bits < 1)
if (quantization_bits < 1) {
return false;
}
if (encoder()->options()->IsAttributeOptionSet(att_id,
"quantization_origin") &&
encoder()->options()->IsAttributeOptionSet(att_id,
@@ -91,8 +93,9 @@ bool KdTreeAttributesEncoder::TransformAttributesToPortableFormat() {
++avi) {
att->ConvertValue<int32_t>(avi, &act_value[0]);
for (int c = 0; c < att->num_components(); ++c) {
if (min_value[c] > act_value[c])
if (min_value[c] > act_value[c]) {
min_value[c] = act_value[c];
}
}
}
for (int c = 0; c < att->num_components(); ++c) {
@@ -167,8 +170,9 @@ bool KdTreeAttributesEncoder::EncodePortableAttributes(
return false;
}
if (source_att == nullptr)
if (source_att == nullptr) {
return false;
}
// Copy source_att to the vector.
if (source_att->data_type() == DT_UINT32) {
@@ -233,50 +237,57 @@ bool KdTreeAttributesEncoder::EncodePortableAttributes(
case 6: {
DynamicIntegerPointsKdTreeEncoder<6> points_encoder(num_components_);
if (!points_encoder.EncodePoints(point_vector.begin(), point_vector.end(),
num_bits, out_buffer))
num_bits, out_buffer)) {
return false;
}
break;
}
case 5: {
DynamicIntegerPointsKdTreeEncoder<5> points_encoder(num_components_);
if (!points_encoder.EncodePoints(point_vector.begin(), point_vector.end(),
num_bits, out_buffer))
num_bits, out_buffer)) {
return false;
}
break;
}
case 4: {
DynamicIntegerPointsKdTreeEncoder<4> points_encoder(num_components_);
if (!points_encoder.EncodePoints(point_vector.begin(), point_vector.end(),
num_bits, out_buffer))
num_bits, out_buffer)) {
return false;
}
break;
}
case 3: {
DynamicIntegerPointsKdTreeEncoder<3> points_encoder(num_components_);
if (!points_encoder.EncodePoints(point_vector.begin(), point_vector.end(),
num_bits, out_buffer))
num_bits, out_buffer)) {
return false;
}
break;
}
case 2: {
DynamicIntegerPointsKdTreeEncoder<2> points_encoder(num_components_);
if (!points_encoder.EncodePoints(point_vector.begin(), point_vector.end(),
num_bits, out_buffer))
num_bits, out_buffer)) {
return false;
}
break;
}
case 1: {
DynamicIntegerPointsKdTreeEncoder<1> points_encoder(num_components_);
if (!points_encoder.EncodePoints(point_vector.begin(), point_vector.end(),
num_bits, out_buffer))
num_bits, out_buffer)) {
return false;
}
break;
}
case 0: {
DynamicIntegerPointsKdTreeEncoder<0> points_encoder(num_components_);
if (!points_encoder.EncodePoints(point_vector.begin(), point_vector.end(),
num_bits, out_buffer))
num_bits, out_buffer)) {
return false;
}
break;
}
// Compression level and/or encoding speed seem wrong.

View File

@@ -32,8 +32,9 @@ class LinearSequencer : public PointsSequencer {
protected:
bool GenerateSequenceInternal() override {
if (num_points_ < 0)
if (num_points_ < 0) {
return false;
}
out_point_ids()->resize(num_points_);
for (int i = 0; i < num_points_; ++i) {
out_point_ids()->at(i) = PointIndex(i);

View File

@@ -39,6 +39,7 @@
#define DRACO_COMPRESSION_ATTRIBUTES_NORMAL_COMPRESSION_UTILS_H_
#include <inttypes.h>
#include <algorithm>
#include <cmath>
@@ -55,8 +56,9 @@ class OctahedronToolBox {
center_value_(-1) {}
bool SetQuantizationBits(int32_t q) {
if (q < 2 || q > 30)
if (q < 2 || q > 30) {
return false;
}
quantization_bits_ = q;
max_quantized_value_ = (1 << quantization_bits_) - 1;
max_value_ = max_quantized_value_ - 1;
@@ -157,8 +159,9 @@ class OctahedronToolBox {
int_vec[2] = 0;
}
// Take care of the sign.
if (scaled_vector[2] < 0)
if (scaled_vector[2] < 0) {
int_vec[2] *= -1;
}
IntegerVectorToQuantizedOctahedralCoords(int_vec, out_s, out_t);
}
@@ -189,6 +192,8 @@ class OctahedronToolBox {
}
}
// TODO(b/149328891): Change function to not use templates as |T| is only
// float.
template <typename T>
void OctaherdalCoordsToUnitVector(T in_s, T in_t, T *out_vector) const {
DRACO_DCHECK_GE(in_s, 0);
@@ -304,18 +309,21 @@ class OctahedronToolBox {
// For correction values.
int32_t ModMax(int32_t x) const {
if (x > this->center_value())
if (x > this->center_value()) {
return x - this->max_quantized_value();
if (x < -this->center_value())
}
if (x < -this->center_value()) {
return x + this->max_quantized_value();
}
return x;
}
// For correction values.
int32_t MakePositive(int32_t x) const {
DRACO_DCHECK_LE(x, this->center_value() * 2);
if (x < 0)
if (x < 0) {
return x + this->max_quantized_value();
}
return x;
}

View File

@@ -19,6 +19,7 @@
#include <cstring>
#include <memory>
#include <vector>
#include "draco/core/macros.h"
namespace draco {
@@ -42,8 +43,9 @@ class PseudoPointD {
// Specifically copies referenced memory
void swap(PseudoPointD &other) noexcept {
for (internal_t dim = 0; dim < dimension_; dim += 1)
for (internal_t dim = 0; dim < dimension_; dim += 1) {
std::swap(mem_[dim], other.mem_[dim]);
}
}
PseudoPointD(const PseudoPointD &other)
@@ -59,9 +61,11 @@ class PseudoPointD {
}
bool operator==(const PseudoPointD &other) const {
for (auto dim = 0; dim < dimension_; dim += 1)
if (mem_[dim] != other.mem_[dim])
for (auto dim = 0; dim < dimension_; dim += 1) {
if (mem_[dim] != other.mem_[dim]) {
return false;
}
}
return true;
}
bool operator!=(const PseudoPointD &other) const {

View File

@@ -18,13 +18,12 @@
#include <algorithm>
#include <cmath>
#include "draco/draco_features.h"
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_shared.h"
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h"
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h"
#include "draco/compression/bit_coders/rans_bit_decoder.h"
#include "draco/core/varint_decoding.h"
#include "draco/draco_features.h"
namespace draco {
@@ -123,8 +122,9 @@ bool MeshPredictionSchemeConstrainedMultiParallelogramDecoder<
++num_parallelograms;
// Stop processing when we reach the maximum number of allowed
// parallelograms.
if (num_parallelograms == kMaxNumParallelograms)
if (num_parallelograms == kMaxNumParallelograms) {
break;
}
}
// Proceed to the next corner attached to the vertex. First swing left
@@ -154,8 +154,9 @@ bool MeshPredictionSchemeConstrainedMultiParallelogramDecoder<
for (int i = 0; i < num_parallelograms; ++i) {
const int context = num_parallelograms - 1;
const int pos = is_crease_edge_pos[context]++;
if (is_crease_edge_[context].size() <= pos)
if (is_crease_edge_[context].size() <= pos) {
return false;
}
const bool is_crease = is_crease_edge_[context][pos];
if (!is_crease) {
++num_used_parallelograms;
@@ -206,12 +207,15 @@ bool MeshPredictionSchemeConstrainedMultiParallelogramDecoder<
// Encode selected edges using separate rans bit coder for each context.
for (int i = 0; i < kMaxNumParallelograms; ++i) {
uint32_t num_flags;
DecodeVarint<uint32_t>(&num_flags, buffer);
if (!DecodeVarint<uint32_t>(&num_flags, buffer)) {
return false;
}
if (num_flags > 0) {
is_crease_edge_[i].resize(num_flags);
RAnsBitDecoder decoder;
if (!decoder.StartDecoding(buffer))
if (!decoder.StartDecoding(buffer)) {
return false;
}
for (uint32_t j = 0; j < num_flags; ++j) {
is_crease_edge_[i][j] = decoder.DecodeNextBit();
}

View File

@@ -108,10 +108,12 @@ class MeshPredictionSchemeConstrainedMultiParallelogramEncoder
int residual_error;
bool operator<(const Error &e) const {
if (num_bits < e.num_bits)
if (num_bits < e.num_bits) {
return true;
if (num_bits > e.num_bits)
}
if (num_bits > e.num_bits) {
return false;
}
return residual_error < e.residual_error;
}
};
@@ -231,8 +233,9 @@ bool MeshPredictionSchemeConstrainedMultiParallelogramEncoder<
++num_parallelograms;
// Stop processing when we reach the maximum number of allowed
// parallelograms.
if (num_parallelograms == kMaxNumParallelograms)
if (num_parallelograms == kMaxNumParallelograms) {
break;
}
}
// Proceed to the next corner attached to the vertex. First swing left
@@ -304,8 +307,9 @@ bool MeshPredictionSchemeConstrainedMultiParallelogramEncoder<
}
uint8_t configuration = 0;
for (int j = 0; j < num_parallelograms; ++j) {
if (exluded_parallelograms[j])
if (exluded_parallelograms[j]) {
continue;
}
for (int c = 0; c < num_components; ++c) {
multi_pred_vals[c] += pred_vals[j][c];
}

View File

@@ -15,11 +15,10 @@
#ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_GEOMETRIC_NORMAL_DECODER_H_
#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_GEOMETRIC_NORMAL_DECODER_H_
#include "draco/draco_features.h"
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h"
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_area.h"
#include "draco/compression/bit_coders/rans_bit_decoder.h"
#include "draco/draco_features.h"
namespace draco {
@@ -52,12 +51,15 @@ class MeshPredictionSchemeGeometricNormalDecoder
}
bool IsInitialized() const override {
if (!predictor_.IsInitialized())
if (!predictor_.IsInitialized()) {
return false;
if (!this->mesh_data().IsInitialized())
}
if (!this->mesh_data().IsInitialized()) {
return false;
if (!octahedron_tool_box_.IsInitialized())
}
if (!octahedron_tool_box_.IsInitialized()) {
return false;
}
return true;
}
@@ -70,10 +72,12 @@ class MeshPredictionSchemeGeometricNormalDecoder
}
bool SetParentAttribute(const PointAttribute *att) override {
if (att->attribute_type() != GeometryAttribute::POSITION)
if (att->attribute_type() != GeometryAttribute::POSITION) {
return false; // Invalid attribute type.
if (att->num_components() != 3)
}
if (att->num_components() != 3) {
return false; // Currently works only for 3 component positions.
}
predictor_.SetPositionAttribute(*att);
return true;
}
@@ -137,23 +141,28 @@ bool MeshPredictionSchemeGeometricNormalDecoder<
DataTypeT, TransformT, MeshDataT>::DecodePredictionData(DecoderBuffer
*buffer) {
// Get data needed for transform
if (!this->transform().DecodeTransformData(buffer))
if (!this->transform().DecodeTransformData(buffer)) {
return false;
}
#ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
if (buffer->bitstream_version() < DRACO_BITSTREAM_VERSION(2, 2)) {
uint8_t prediction_mode;
buffer->Decode(&prediction_mode);
if (!buffer->Decode(&prediction_mode)) {
return false;
}
if (!predictor_.SetNormalPredictionMode(
NormalPredictionMode(prediction_mode)))
NormalPredictionMode(prediction_mode))) {
return false;
}
}
#endif
// Init normal flips.
if (!flip_normal_bit_decoder_.StartDecoding(buffer))
if (!flip_normal_bit_decoder_.StartDecoding(buffer)) {
return false;
}
return true;
}

View File

@@ -50,10 +50,12 @@ class MeshPredictionSchemeGeometricNormalEncoder
}
bool IsInitialized() const override {
if (!predictor_.IsInitialized())
if (!predictor_.IsInitialized()) {
return false;
if (!this->mesh_data().IsInitialized())
}
if (!this->mesh_data().IsInitialized()) {
return false;
}
return true;
}
@@ -66,10 +68,12 @@ class MeshPredictionSchemeGeometricNormalEncoder
}
bool SetParentAttribute(const PointAttribute *att) override {
if (att->attribute_type() != GeometryAttribute::POSITION)
if (att->attribute_type() != GeometryAttribute::POSITION) {
return false; // Invalid attribute type.
if (att->num_components() != 3)
}
if (att->num_components() != 3) {
return false; // Currently works only for 3 component positions.
}
predictor_.SetPositionAttribute(*att);
return true;
}
@@ -162,8 +166,9 @@ template <typename DataTypeT, class TransformT, class MeshDataT>
bool MeshPredictionSchemeGeometricNormalEncoder<
DataTypeT, TransformT, MeshDataT>::EncodePredictionData(EncoderBuffer
*buffer) {
if (!this->transform().EncodeTransformData(buffer))
if (!this->transform().EncodeTransformData(buffer)) {
return false;
}
// Encode normal flips.
flip_normal_bit_encoder_.EndEncoding(buffer);

View File

@@ -45,10 +45,12 @@ class MeshPredictionSchemeGeometricNormalPredictorBase {
entry_to_point_id_map_ = map;
}
bool IsInitialized() const {
if (pos_attribute_ == nullptr)
if (pos_attribute_ == nullptr) {
return false;
if (entry_to_point_id_map_ == nullptr)
}
if (entry_to_point_id_map_ == nullptr) {
return false;
}
return true;
}

View File

@@ -16,10 +16,9 @@
#ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_MULTI_PARALLELOGRAM_DECODER_H_
#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_MULTI_PARALLELOGRAM_DECODER_H_
#include "draco/draco_features.h"
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h"
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h"
#include "draco/draco_features.h"
namespace draco {

View File

@@ -47,8 +47,9 @@ inline bool ComputeParallelogramPrediction(
const std::vector<int32_t> &vertex_to_data_map, const DataTypeT *in_data,
int num_components, DataTypeT *out_prediction) {
const CornerIndex oci = table->Opposite(ci);
if (oci == kInvalidCornerIndex)
if (oci == kInvalidCornerIndex) {
return false;
}
int vert_opp, vert_next, vert_prev;
GetParallelogramEntries<CornerTableT>(oci, table, vertex_to_data_map,
&vert_opp, &vert_next, &vert_prev);

View File

@@ -18,12 +18,11 @@
#include <math.h>
#include "draco/draco_features.h"
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h"
#include "draco/compression/bit_coders/rans_bit_decoder.h"
#include "draco/core/varint_decoding.h"
#include "draco/core/vector_d.h"
#include "draco/draco_features.h"
#include "draco/mesh/corner_table.h"
namespace draco {
@@ -60,10 +59,12 @@ class MeshPredictionSchemeTexCoordsDecoder
}
bool IsInitialized() const override {
if (pos_attribute_ == nullptr)
if (pos_attribute_ == nullptr) {
return false;
if (!this->mesh_data().IsInitialized())
}
if (!this->mesh_data().IsInitialized()) {
return false;
}
return true;
}
@@ -76,12 +77,15 @@ class MeshPredictionSchemeTexCoordsDecoder
}
bool SetParentAttribute(const PointAttribute *att) override {
if (att == nullptr)
if (att == nullptr) {
return false;
if (att->attribute_type() != GeometryAttribute::POSITION)
}
if (att->attribute_type() != GeometryAttribute::POSITION) {
return false; // Invalid attribute type.
if (att->num_components() != 3)
}
if (att->num_components() != 3) {
return false; // Currently works only for 3 component positions.
}
pos_attribute_ = att;
return true;
}
@@ -144,22 +148,27 @@ bool MeshPredictionSchemeTexCoordsDecoder<DataTypeT, TransformT, MeshDataT>::
// Decode the delta coded orientations.
uint32_t num_orientations = 0;
if (buffer->bitstream_version() < DRACO_BITSTREAM_VERSION(2, 2)) {
if (!buffer->Decode(&num_orientations))
if (!buffer->Decode(&num_orientations)) {
return false;
}
} else {
if (!DecodeVarint(&num_orientations, buffer))
if (!DecodeVarint(&num_orientations, buffer)) {
return false;
}
}
if (num_orientations == 0)
if (num_orientations == 0) {
return false;
}
orientations_.resize(num_orientations);
bool last_orientation = true;
RAnsBitDecoder decoder;
if (!decoder.StartDecoding(buffer))
if (!decoder.StartDecoding(buffer)) {
return false;
}
for (uint32_t i = 0; i < num_orientations; ++i) {
if (!decoder.DecodeNextBit())
if (!decoder.DecodeNextBit()) {
last_orientation = !last_orientation;
}
orientations_[i] = last_orientation;
}
decoder.EndDecoding();

View File

@@ -16,6 +16,7 @@
#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_TEX_COORDS_ENCODER_H_
#include <math.h>
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_encoder.h"
#include "draco/compression/bit_coders/rans_bit_encoder.h"
#include "draco/core/varint_encoding.h"
@@ -55,10 +56,12 @@ class MeshPredictionSchemeTexCoordsEncoder
}
bool IsInitialized() const override {
if (pos_attribute_ == nullptr)
if (pos_attribute_ == nullptr) {
return false;
if (!this->mesh_data().IsInitialized())
}
if (!this->mesh_data().IsInitialized()) {
return false;
}
return true;
}
@@ -71,10 +74,12 @@ class MeshPredictionSchemeTexCoordsEncoder
}
bool SetParentAttribute(const PointAttribute *att) override {
if (att->attribute_type() != GeometryAttribute::POSITION)
if (att->attribute_type() != GeometryAttribute::POSITION) {
return false; // Invalid attribute type.
if (att->num_components() != 3)
}
if (att->num_components() != 3) {
return false; // Currently works only for 3 component positions.
}
pos_attribute_ = att;
return true;
}

View File

@@ -48,10 +48,12 @@ class MeshPredictionSchemeTexCoordsPortableDecoder
}
bool IsInitialized() const override {
if (!predictor_.IsInitialized())
if (!predictor_.IsInitialized()) {
return false;
if (!this->mesh_data().IsInitialized())
}
if (!this->mesh_data().IsInitialized()) {
return false;
}
return true;
}
@@ -64,10 +66,12 @@ class MeshPredictionSchemeTexCoordsPortableDecoder
}
bool SetParentAttribute(const PointAttribute *att) override {
if (!att || att->attribute_type() != GeometryAttribute::POSITION)
if (!att || att->attribute_type() != GeometryAttribute::POSITION) {
return false; // Invalid attribute type.
if (att->num_components() != 3)
}
if (att->num_components() != 3) {
return false; // Currently works only for 3 component positions.
}
predictor_.SetPositionAttribute(*att);
return true;
}
@@ -84,6 +88,10 @@ bool MeshPredictionSchemeTexCoordsPortableDecoder<
DataTypeT *out_data, int /* size */,
int num_components,
const PointIndex *entry_to_point_id_map) {
if (num_components != MeshPredictionSchemeTexCoordsPortablePredictor<
DataTypeT, MeshDataT>::kNumComponents) {
return false;
}
predictor_.SetEntryToPointIdMap(entry_to_point_id_map);
this->transform().Init(num_components);
@@ -92,8 +100,9 @@ bool MeshPredictionSchemeTexCoordsPortableDecoder<
for (int p = 0; p < corner_map_size; ++p) {
const CornerIndex corner_id = this->mesh_data().data_to_corner_map()->at(p);
if (!predictor_.template ComputePredictedValue<false>(corner_id, out_data,
p))
p)) {
return false;
}
const int dst_offset = p * num_components;
this->transform().ComputeOriginalValue(predictor_.predicted_value(),
@@ -109,16 +118,19 @@ bool MeshPredictionSchemeTexCoordsPortableDecoder<
*buffer) {
// Decode the delta coded orientations.
int32_t num_orientations = 0;
if (!buffer->Decode(&num_orientations) || num_orientations < 0)
if (!buffer->Decode(&num_orientations) || num_orientations < 0) {
return false;
}
predictor_.ResizeOrientations(num_orientations);
bool last_orientation = true;
RAnsBitDecoder decoder;
if (!decoder.StartDecoding(buffer))
if (!decoder.StartDecoding(buffer)) {
return false;
}
for (int i = 0; i < num_orientations; ++i) {
if (!decoder.DecodeNextBit())
if (!decoder.DecodeNextBit()) {
last_orientation = !last_orientation;
}
predictor_.set_orientation(i, last_orientation);
}
decoder.EndDecoding();

View File

@@ -51,10 +51,12 @@ class MeshPredictionSchemeTexCoordsPortableEncoder
}
bool IsInitialized() const override {
if (!predictor_.IsInitialized())
if (!predictor_.IsInitialized()) {
return false;
if (!this->mesh_data().IsInitialized())
}
if (!this->mesh_data().IsInitialized()) {
return false;
}
return true;
}
@@ -67,10 +69,12 @@ class MeshPredictionSchemeTexCoordsPortableEncoder
}
bool SetParentAttribute(const PointAttribute *att) override {
if (att->attribute_type() != GeometryAttribute::POSITION)
if (att->attribute_type() != GeometryAttribute::POSITION) {
return false; // Invalid attribute type.
if (att->num_components() != 3)
}
if (att->num_components() != 3) {
return false; // Currently works only for 3 component positions.
}
predictor_.SetPositionAttribute(*att);
return true;
}

View File

@@ -16,6 +16,7 @@
#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_TEX_COORDS_PORTABLE_PREDICTOR_H_
#include <math.h>
#include "draco/attributes/point_attribute.h"
#include "draco/core/math_utils.h"
#include "draco/core/vector_d.h"
@@ -28,6 +29,8 @@ namespace draco {
template <typename DataTypeT, class MeshDataT>
class MeshPredictionSchemeTexCoordsPortablePredictor {
public:
static constexpr int kNumComponents = 2;
explicit MeshPredictionSchemeTexCoordsPortablePredictor(const MeshDataT &md)
: pos_attribute_(nullptr),
entry_to_point_id_map_(nullptr),
@@ -71,7 +74,6 @@ class MeshPredictionSchemeTexCoordsPortablePredictor {
private:
const PointAttribute *pos_attribute_;
const PointIndex *entry_to_point_id_map_;
static constexpr int kNumComponents = 2;
DataTypeT predicted_value_[kNumComponents];
// Encoded / decoded array of UV flips.
// TODO(ostava): We should remove this and replace this with in-place encoding
@@ -203,14 +205,16 @@ bool MeshPredictionSchemeTexCoordsPortablePredictor<
}
} else {
// When decoding the data, we already know which orientation to use.
if (orientations_.empty())
if (orientations_.empty()) {
return false;
}
const bool orientation = orientations_.back();
orientations_.pop_back();
if (orientation)
if (orientation) {
predicted_uv = (x_uv + cx_uv) / pn_norm2_squared;
else
} else {
predicted_uv = (x_uv - cx_uv) / pn_norm2_squared;
}
}
predicted_value_[0] = static_cast<int>(predicted_uv[0]);
predicted_value_[1] = static_cast<int>(predicted_uv[1]);

View File

@@ -46,8 +46,9 @@ class PredictionSchemeDecoder : public PredictionSchemeTypedDecoderInterface<
: attribute_(attribute), transform_(transform) {}
bool DecodePredictionData(DecoderBuffer *buffer) override {
if (!transform_.DecodeTransformData(buffer))
if (!transform_.DecodeTransformData(buffer)) {
return false;
}
return true;
}

View File

@@ -18,9 +18,8 @@
#ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_FACTORY_H_
#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_DECODER_FACTORY_H_
#include "draco/draco_features.h"
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h"
#include "draco/draco_features.h"
#ifdef DRACO_NORMAL_ENCODING_SUPPORTED
#include "draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_decoder.h"
#endif
@@ -154,8 +153,9 @@ std::unique_ptr<PredictionSchemeDecoder<DataTypeT, TransformT>>
CreatePredictionSchemeForDecoder(PredictionSchemeMethod method, int att_id,
const PointCloudDecoder *decoder,
const TransformT &transform) {
if (method == PREDICTION_NONE)
if (method == PREDICTION_NONE) {
return nullptr;
}
const PointAttribute *const att = decoder->point_cloud()->attribute(att_id);
if (decoder->GetGeometryType() == TRIANGULAR_MESH) {
// Cast the decoder to mesh decoder. This is not necessarily safe if there
@@ -170,8 +170,9 @@ CreatePredictionSchemeForDecoder(PredictionSchemeMethod method, int att_id,
MeshDecoder, PredictionSchemeDecoder<DataTypeT, TransformT>,
MeshPredictionSchemeDecoderFactory<DataTypeT>>(
mesh_decoder, method, att_id, transform, decoder->bitstream_version());
if (ret)
if (ret) {
return ret;
}
// Otherwise try to create another prediction scheme.
}
// Create delta decoder.

View File

@@ -46,8 +46,9 @@ class PredictionSchemeEncoder : public PredictionSchemeTypedEncoderInterface<
: attribute_(attribute), transform_(transform) {}
bool EncodePredictionData(EncoderBuffer *buffer) override {
if (!transform_.EncodeTransformData(buffer))
if (!transform_.EncodeTransformData(buffer)) {
return false;
}
return true;
}

View File

@@ -62,10 +62,12 @@ PredictionSchemeMethod GetPredictionMethodFromOptions(
int att_id, const EncoderOptions &options) {
const int pred_type =
options.GetAttributeInt(att_id, "prediction_scheme", -1);
if (pred_type == -1)
if (pred_type == -1) {
return PREDICTION_UNDEFINED;
if (pred_type < 0 || pred_type >= NUM_PREDICTION_SCHEMES)
}
if (pred_type < 0 || pred_type >= NUM_PREDICTION_SCHEMES) {
return PREDICTION_NONE;
}
return static_cast<PredictionSchemeMethod>(pred_type);
}

View File

@@ -86,8 +86,9 @@ CreatePredictionSchemeForEncoder(PredictionSchemeMethod method, int att_id,
if (method == PREDICTION_UNDEFINED) {
method = SelectPredictionMethod(att_id, encoder);
}
if (method == PREDICTION_NONE)
if (method == PREDICTION_NONE) {
return nullptr; // No prediction is used.
}
if (encoder->GetGeometryType() == TRIANGULAR_MESH) {
// Cast the encoder to mesh encoder. This is not necessarily safe if there
// is some other encoder decides to use TRIANGULAR_MESH as the return type,
@@ -100,8 +101,9 @@ CreatePredictionSchemeForEncoder(PredictionSchemeMethod method, int att_id,
MeshEncoder, PredictionSchemeEncoder<DataTypeT, TransformT>,
MeshPredictionSchemeEncoderFactory<DataTypeT>>(
mesh_encoder, method, att_id, transform, kDracoMeshBitstreamVersion);
if (ret)
if (ret) {
return ret;
}
// Otherwise try to create another prediction scheme.
}
// Create delta encoder.

View File

@@ -61,8 +61,9 @@ std::unique_ptr<PredictionSchemeT> CreateMeshPredictionScheme(
&encoding_data->vertex_to_encoded_attribute_value_index_map);
MeshPredictionSchemeFactoryT factory;
auto ret = factory(method, att, transform, md, bitstream_version);
if (ret)
if (ret) {
return ret;
}
} else {
typedef MeshPredictionSchemeData<CornerTable> MeshData;
MeshData md;
@@ -71,8 +72,9 @@ std::unique_ptr<PredictionSchemeT> CreateMeshPredictionScheme(
&encoding_data->vertex_to_encoded_attribute_value_index_map);
MeshPredictionSchemeFactoryT factory;
auto ret = factory(method, att, transform, md, bitstream_version);
if (ret)
if (ret) {
return ret;
}
}
}
return nullptr;

View File

@@ -44,18 +44,23 @@ class PredictionSchemeNormalOctahedronCanonicalizedDecodingTransform
bool DecodeTransformData(DecoderBuffer *buffer) {
DataTypeT max_quantized_value, center_value;
if (!buffer->Decode(&max_quantized_value))
if (!buffer->Decode(&max_quantized_value)) {
return false;
if (!buffer->Decode(&center_value))
}
if (!buffer->Decode(&center_value)) {
return false;
}
(void)center_value;
if (!this->set_max_quantized_value(max_quantized_value))
if (!this->set_max_quantized_value(max_quantized_value)) {
return false;
}
// Account for reading wrong values, e.g., due to fuzzing.
if (this->quantization_bits() < 2)
if (this->quantization_bits() < 2) {
return false;
if (this->quantization_bits() > 30)
}
if (this->quantization_bits() > 30) {
return false;
}
return true;
}

Some files were not shown because too many files have changed in this diff Show More