1
1

Compare commits

..

903 Commits

Author SHA1 Message Date
13de8b171e Changes from D7978 and D7499 2020-06-10 11:48:57 -04:00
fcbd53c3b0 Merge branch 'master' into modifier-panels-ui 2020-06-10 11:46:00 -04:00
2d695367a7 UI: More specific modifier move to index operator description 2020-06-10 11:23:03 -04:00
a9dfad831b Fix T77694: Start panel animation when expansion data changes
During normal drawing there is a rather complicated method to check
whether the panels should be animating. It's not set up to deal with
the panel expansion changing from outside the UI, which is now possible
with the panel expansion connected to the modifier's show_expanded
property.

The solution is to activate panel animation if setting the expansion
property has changed.
2020-06-10 11:16:55 -04:00
b0ac7a89b0 UI: Only set first bit of modifier expansion fag with Python
Only the flag for the top level panels is exposed with RNA, so this adds
a set method to only change that bit.
2020-06-10 11:08:58 -04:00
9b784668ae Cleanup: use proper enum type in parameter of BKE_scene_copy. 2020-06-10 17:01:15 +02:00
74ec37b70c Enable (deep) copy of overrides.
This commit enables basic copy of overrides on generic ID level, as well
as from (deep) copy operators for objects and collections.

So e.g. if your linked overridden caracter is in a collection, you can
now (from the outliner) Duplicate that override collection to get a new
overriding copy of the character.

We still need operators (new or modifying existing ones) to handle that
from 3DView e.g.

Note that deep copy code for objects/collections (and incidently
animdata) had to be modified to avoid duplicating/making local IDs that
remain linked ones being used by overrides ones.
2020-06-10 16:48:49 +02:00
1d0017089c Fix (unreported) disapearance of some overrides after save & reload.
The override operations generated from 'do not follow' RNA pointer
properties (i.e. pointers to other IDs) were not properly clearing their
'no more used' flag, and hence were incorrectly deleted on second save.
2020-06-10 16:48:49 +02:00
3ea04d3e11 Blenloader: Don't just crash when a struct name is not known
Related to T77524.

This brings back the old way of handling corrupted data.
2020-06-10 16:31:41 +02:00
6fe32d7fd6 Fix T77524: Don't try to write storage of node with undefined node
This cannot work, because the storagename is the empty string.
2020-06-10 16:16:03 +02:00
d62bbf4079 UI: Show library names grayed out and right-aligned in menus
Should separate the data-block name better from the library name and improve
readability.
2020-06-10 15:52:10 +02:00
93c8955a72 Mesh Edit: preserve Custom Normal vectors in topology operators.
Custom Loop Normals are normally encoded relative to the default
normals, similar to normal maps, allowing them to naturally follow
mesh deformations. Changes to mesh topology however often result
in nonsensical effects that are not desired.

The Remove Doubles operation especially (now known as Merge By
Distance) is intended as a purely topological operation, and
definitely should not change the vector of the custom normals.

This patch implements that behavior by converting the relative
encoding into an absolute vector layer for the duration of the
operation. It also modifies other Merge types in this way for
consistency, the Rip operator as their inverse counterpart;
and also Delete, Dissolve, Connect Path and Knife operators
as other examples more related to topology than shape.

On the technical side, this ports mesh_normals_loop_custom_set
to BMesh, and then uses a temporary Custom Data layer to store
the normals as vectors for the duration of the above mentioned
operations. When the normals are converted back to custom data,
the caller can choose whether to mark edges as sharp to preserve
distinct normals, or just average them instead. All but Remove
Doubles choose to average for now.

Differential Revision: https://developer.blender.org/D4994
2020-06-10 16:51:22 +03:00
a58dc25b07 Cleanup: improve custom data type names
This is related to T76659.

This just renames data type names to `CD_PROP_STRING`, `CD_PROP_FLOAT`
and `CD_PROP_INT32`. It makes them a bit more specific and removes
unnecessary abbreviations.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7980
2020-06-10 15:47:31 +02:00
cc26041d36 Depsgraph: use blender::Set instead of std::set
We decided that `blender::Set` should be the default choice for a set
data structure in Blender.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D7982
2020-06-10 15:42:35 +02:00
a7ea07c677 Depsgraph: use blender::Vector instead of std::vector
We decided that `blender::Vector` should be the default choice for
a vector data structure in Blender.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D7981
2020-06-10 15:33:50 +02:00
0852d13bbd Depsgraph: use native Set data structure
Differential Revision: https://developer.blender.org/D7982
2020-06-10 15:24:03 +02:00
044b824c9d Cleanup: remove unused MBALL_NOSEL flag 2020-06-10 23:01:57 +10:00
eda58c47b8 Cleanup: asan warning with bit-shifting flag 2020-06-10 23:01:57 +10:00
4fefe3ac3b BLI: rename tests from "array_ref" to "span"
This was missing in an earlier commit.
2020-06-10 14:50:29 +02:00
a71f073dfb BLI: add Map.pop_try method
I found this pattern in depsgraph code more than once.
2020-06-10 14:47:22 +02:00
75ce20a000 Cleanup: redundant headers 2020-06-10 22:34:11 +10:00
0ca0ad5318 Cleanup: move BKE_mesh_wrapper functions into own header 2020-06-10 22:34:11 +10:00
84a0a6d16c BLI: update behavior of Map.lookup_or_add
Previously, this function would expect a callback function as parameter.
This behavior is now in Map.lookup_or_add_cb. The new version just
takes the key and value directly.
2020-06-10 14:15:04 +02:00
f367f1e5a5 Cycles: Improve OptiX viewport denoising performance with CUDA rendering
With this patch Cycles recognizing when a logical OptiX and CUDA device represent the same
physical GPU and attempts to eliminate unnecessary tile copies for viewport rendering if that
is the case for all active devices. In addition, denoising is now no longer performed on the first
available OptiX device only, but instead it will try to match CUDA and OptiX
rendering/denoising devices exactly to maximize utilization.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7975
2020-06-10 14:12:13 +02:00
d12f6a90b1 Fix T77599 Image UV editor use linear interpolation 2020-06-10 13:37:04 +02:00
d4315040ad Cycles: Fix CUDA compilation after cone sampling fix 2020-06-10 13:02:43 +02:00
146473f083 GPencil: Include new Bevel parameters when convert stroke to Curve
These new parameters allow to define bevel depth and resolution.

Related to T77631
2020-06-10 11:42:35 +02:00
82f51fe913 Fix T77356: Texture Preview not taking alpha into account
Since rB329b4c3363e4 a texture preview is not rendered through the
preview.blend and a renderengine anymore [unlike materials etc.]

Alpha wasnt handled in that commit, take that into account now.

sidenote: not sure if we should be looking into drawing alpha with a
checkerboard in the background for texture previews (see texture
previews elsewhere)?

sidenote 2: might also be good to document where the "calculate" and
"invert" alpha options are still used? [looks a bit inconsistent:
compositor uses it, Image Editor as well as Render Engines dont?]

Maniphest Tasks: T77356

Differential Revision: https://developer.blender.org/D7929
2020-06-10 11:07:20 +02:00
df50104e1c Fix T77068: UV Proportional Edit "Connected Only" option affects UV
clipping (even if the proportional edit itself is disabled)

Checking T_PROP_EDIT_ALL returns true for _any_ of the options, so just
check for T_PROP_EDIT.

Note: this might expand to other similar checks (e.g. header text)

Maniphest Tasks: T77068

Differential Revision: https://developer.blender.org/D7927
2020-06-10 11:02:09 +02:00
fc8a7a44b2 Fix T77560: Bone selection crashes
The was caused by 8b347fc2cd as the old BONESEL_NOSEL flag
handled the -1 case (used for none).

Instead of checking for -1, remove these elements from the array
as selection code makes decisions based on the number of hits detected.
2020-06-10 18:04:01 +10:00
edb4e553f5 LibOverride: Fix issues related to ID name differences.
Local datablocks (including overrides) need to have a unique name, which
can then differ from the reference linked one (especially when there are
several local overrides of a same linked data).

Issue is, ID name is a 'rna name property', and as such used as
reference when dealing with override of collections of IDs, so we cannot
have a changing name.

The solution implemented here should work and is simple, but it may have
some issues in corner cases (time will say), it is not really robust.

Alternative solution would be to store ID pointers as reference in
override operations, instead of there name. But that would potentially
add quiet a lot of overhead to foreach looping in `lib_query.c`.
2020-06-10 09:38:34 +02:00
2d1b560a4e Fix T77632: Deform modifier auto-binding not working
Regression in deaff945d0
2020-06-10 15:54:05 +10:00
a4bb4b6e65 Mesh: utility functions to access wrapped mesh coordinates 2020-06-10 15:54:00 +10:00
48ca66cfe7 Fix T77195: Crash with edit-mesh viewport measurements enabled
Simplify looping over faces & tessellation data.

Regression in 6526c3ced8, the index accessed wasn't valid.
2020-06-10 13:46:10 +10:00
46e0ec05ef Cleanup: Move each special_aftertrans_update to their respective TransData file 2020-06-09 20:27:51 -03:00
9e76a641af Apply changes from constraints patch and modifiers patch 2020-06-09 17:52:57 -04:00
5ecc239c0a Merge branch 'master' into modifier-panels-ui 2020-06-09 17:31:59 -04:00
63a40ed422 Cycles: Fix uniform cone sampling
This code is currently only used for the Glossy Toon BSDF, but it's a generic
building block that might be used for other things in the future.

To see why the current code does not give a uniform distribution, consider that
it chooses both angles uniformly, but the smaller the angle from the center of
the cone is, the smaller the differential solid angle is (similar to how
sampling disks by choosing radius and phi uniformly does not work).

Differential Revision: https://developer.blender.org/D7948
2020-06-09 22:19:15 +02:00
d3f83d9f95 UI: Remove extra separator in some cases 2020-06-09 15:11:14 -04:00
d1932a8ed6 Fix missing animation decorators for pointer buttons
Also, remove manually placed decorator for vertex groups in modifiers. This was
only needed because of this bug, and the layout was slightly misaligned.
2020-06-09 20:42:22 +02:00
819ebc9901 UI: Set modifier panel expansion on every redraw
This will fix situations where the modifier epansion was set elsewhere
besides the UI, like from the python console, solving the drawing part
of T77502.

Also adds  update tags to the show_expanded property, which means
the properties window redraws when the property changes.
2020-06-09 13:41:50 -04:00
cb9de95d61 Sculpt: Face Set Edit Operator
This operator performs an edit operation in the active face set defined
by the cursor position and updates the visibility. For now, it has a
Grow and Shrink operations, similar to Select More/Less in edit mode or
to the mask filter Grow/Shrink modes. More operations can be added in
the future.

In multires, this updates the visibility of an entire face from the base
mesh at once, which makes it very convenient to edit the visible area
without manipulating the face set directly.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7367
2020-06-09 19:09:50 +02:00
77789a1904 Sculpt: Pose Squash and Stretch deform mode
This implements squash and stretch as a deform mode for the Pose Brush.
It is similar to scale, but it applies different scale values in different
axis. To achieve this, the pivot local space of the transform needs to
be aligned to the segment when using this deform mode to apply the scale
in the correct direction.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7934
2020-06-09 18:49:10 +02:00
075156de9f Voxel Size Edit: Fix text not readable when zooming in the viewport
Previously the scale of the text was using object space, so when working
with scaled objects or small meshes the size of the text was wrong. Now
it calculates a scale in screen space, so the text size should be much
more predictable

Reviewed By: sergey, Severin

Differential Revision: https://developer.blender.org/D7941
2020-06-09 18:28:41 +02:00
69b67d4f07 Fix Edit Voxel Size label in preview
The format string was wrong so it was rendering an extra % character

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7942
2020-06-09 18:27:18 +02:00
53d1a729cc UI: Avoid rebuilding Outliner tree on simple button interactions
E.g. simply on button hover changes, the tree would be needlessly rebuilt.

I wouldn't be surprised if this causes side-effects, for some state changes we
may still have to do a full rebuild.
2020-06-09 18:12:56 +02:00
ee64b595da Fix T77504: Operator search gives wrong results
Regression in e8ab0137f8
2020-06-10 01:18:17 +10:00
e1cc9aa7f2 Nodes: efficient node tree queries and inlining
This adds two data structures that wrap a node tree. However, they work
on different abstraction levels.

`NodeTreeRef` is an immutable structure that makes working with a node
tree in C++ much more efficient and convenient. It supports various
queries efficiently, that are not easily possible using just `bNodeTree`.

`DerivedNodeTree` builds on top of `NodeTreeRef`. It contains a flattened
view on the node tree, i.e. with node groups being inlined. Every inlined
node still knows its "call stack". It supports pretty much the same queries
as `NodeTreeRef`.

Both data structures come with a dot graph exporter for debugging purposes.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7628
2020-06-09 17:08:41 +02:00
b37fca650e Cleanup: Move pointcache dna to separate file
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7965
2020-06-09 17:01:54 +02:00
0cb59866af Cleanup: extract function for common function call sequence 2020-06-09 16:43:34 +02:00
4622434c34 Fix T76894: Disable clipping region selection in material/rendered mode
In this case the draw engine isn't responsible for the selection, but
the editor is.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7955
2020-06-09 16:31:40 +02:00
Evan Wilson
84a5bd9135 Fix T76984: Normal node not drawing properly in compositor
Differential Revision: https://developer.blender.org/D7827
2020-06-09 16:29:31 +02:00
4e9efa80ca Cleanup: correct enum names in comments 2020-06-09 16:23:27 +02:00
9d75f23566 BLI: remove incorrect const 2020-06-09 16:23:27 +02:00
37d68871b7 GPencil: Keep original stroke when reproject
When reproject a stroke sometimes is good to keep the copy of the original stroke to create volume effects

Related to T77639

{F8603513}

Reviewed By: mendio, pepeland

Maniphest Tasks: T77639

Differential Revision: https://developer.blender.org/D7963
50258
2020-06-09 15:46:55 +02:00
c23b1de2cf Fix T72936: Incorrect gizmo orientation with inherit rotation disabled 2020-06-09 22:35:11 +10:00
3ffb52d114 Fix T77448: Camera Solver constraint can't be converted to f-curve
A regression caused by c57f65c088 as a fix of another issue.

Added an exception for camera solver as that is always pointing
to camera object.

Since this is a regression which happened in 2.83.0 this change is
a candidate to be ported to the 2.83.1.
2020-06-09 14:06:35 +02:00
b7150183e7 Cleanup: Silence some overflow warnings in transform code 2020-06-09 08:51:51 -03:00
8522b429b5 Transform: Fixes after recent refactor
Pointed by strict compiler warnings, but some of the reports were
actually a real bugs:

- Access uninitialized memory of td_mirror_iter.

  Assuming that iterator is to point to the first element of the
  data array.

- Lattice's recalc data was never called.

There is also a fix for redundant declaration of recalcData() and
missing declaration of recalcData_lattice().
2020-06-09 12:19:44 +02:00
5620a09e0d Cleanup: move hashing of OperationIDKey to member function 2020-06-09 12:08:32 +02:00
f7c0f1b8b8 BLI: rename ArrayRef to Span
This also renames `MutableArrayRef` to `MutableSpan`.
The name "Span" works better, because `std::span` will provide
similar functionality in C++20. Furthermore, a shorter, more
concise name for a common data structure is nice.
2020-06-09 11:58:47 +02:00
7d2b4ae9c6 Fix menu operator/search clipping the last character
Noted in T77504
2020-06-09 19:25:59 +10:00
128296129a GPencil: Cleanup doxygen comments 2020-06-09 11:17:21 +02:00
74b0713d8a Fix warning-as-error about int to uint conversion in new BLI CPP code.
Was breaking build for me here...
2020-06-09 11:16:32 +02:00
874a078d86 GPencil: Improve viewlayer masking check
Check if the mask layer is used in a layer that is going to be used in the current viewlayer.

Related to T77667
2020-06-09 11:13:23 +02:00
d68e29b62c Workbench: Fix missing NULL pointer check 2020-06-09 10:59:31 +02:00
9bb7d6ed68 BLI: put C++ data structures in "blender" namespace instead of "BLI"
We plan to use the "blender" namespace in other modules as well.
2020-06-09 10:27:24 +02:00
d8678e02ec BLI: generally improve C++ data structures
The main focus here was to improve the docs significantly. Furthermore,
I reimplemented `Set`, `Map` and `VectorSet`. They are now (usually)
faster, simpler and more customizable. I also rewrote `Stack` to make
it more efficient by avoiding unnecessary copies.

Thanks to everyone who helped with constructive feedback.

Approved by brecht and sybren.

Differential Revision: https://developer.blender.org/D7931
2020-06-09 10:15:43 +02:00
50258d55e7 Cleanup: remove debug prints in py.ops.nla.bake() 2020-06-09 17:57:50 +10:00
7a0ad20e5f Fix mistake in recent fix for text editor overflow 2020-06-09 17:39:43 +10:00
1355d9cc8c Sequencer: restore behavior removed from recent refactor 2020-06-09 16:49:33 +10:00
f88d59ecf8 Fix T77148: Crash changing multiple values for sequencer strips
This was caused by assuming all strips were the same type.
2020-06-09 16:24:50 +10:00
0c4bc09092 Docs: comment text scale behavior
Avoid misunderstanding that caused T77609.
2020-06-09 15:19:31 +10:00
70a27d0a63 Fix T77609: Scale to Fit Text Box fails when text is too narrow
Caused by error in fix for T75965 (83d9ba341e).
2020-06-09 15:07:59 +10:00
f326b6a18e Cleanup: avoid addition with large strings in Python
This is known to be inefficient, use a second write call instead.
2020-06-09 13:40:51 +10:00
9f7d84b656 Cycles: Add support for P2P memory distribution (e.g. via NVLink)
This change modifies the multi-device implementation to support memory distribution
across devices, to reduce the overall memory footprint of large scenes and allow scenes to
fit entirely into combined GPU memory that previously had to fall back to host memory.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7426
2020-06-08 17:55:49 +02:00
0a907657d4 Functions: Run-time type system and index mask
This adds a new `CPPType` that encapsulates information about how to handle
instances of a specific data type. This is necessary for the function evaluation
system, which will be used to evaluate most of the particle node trees.

Furthermore, this adds an `IndexMask` class which offers a surprisingly useful
abstraction over an array containing unsigned integers. It makes two assumptions
about the underlying integer array:
* The integers are in ascending order.
* There are no duplicates.

`IndexMask` will be used to "select" certain particles that will be
processed in a data-oriented way. Sometimes, operations don't have to
be applied to all particles, but only some, those that are in the indexed by
the `IndexMask`. The two limitations imposed by an `IndexMask` allow for
better performance.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7957
2020-06-08 17:37:43 +02:00
b5846ebce7 Fix T77603: OSL parser fails when script ends with comment without newline
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7958
2020-06-08 17:01:47 +02:00
6f96dfabe5 Simulations: initial simulation state and cache
The current particle state is stored in a `CustomData` instance and
the cache is stored in `PointCache`.

The current state exists on the copy-on-write copies of the simulation,
while the cache only exists in the original data block.

This patch implements a temporary trivial particle simulation that does not
use the node system yet. It is used for testing and will be replaced soon.

`PointCache` still has some limitations that need to be overcome using
separate refactorings. For example, we need to be able to store the number
of particles in the point cache. Also we need to change which attributes
are stored for a particle system more dynamically than is currently possible afaik.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7836
2020-06-08 15:49:17 +02:00
bf4198cdaf Fix crash running "Edit Voxel Size" operator outside of a main 3D View region
Accessed `RegionView3D` data from context, which of course would only be set if
actually executed from a main 3D View region.
2020-06-08 15:45:00 +02:00
e3396d8bfc Installdeps: better handling of python versions.
now that we stick to some outdated py version, some distro (like current
debian testing) will feature several python3 dev package, but other
dependant libs like numpy are only built against current default version
of python (3.8 now in deb testing)...

In order to be able to use distro packages we need to allow using higher
versions of python, and set relevant CMake option accordingly.
2020-06-08 15:38:11 +02:00
1c189aa70a Fix T70873: Pivot Center doesn't compute mirror elements 2020-06-08 08:23:37 -03:00
335c1e48ee Cleanup: Create a header for TransData declarations 2020-06-08 08:23:37 -03:00
4f4141c8f4 Cleanup: Move TransDataSeq declaration to its TransData file 2020-06-08 08:23:37 -03:00
6e53b28898 Cleanup: Move TransDataNla declaration to its TransData file 2020-06-08 08:23:37 -03:00
e54fb1b819 Cleanup: Move each recalcData to their respective TransData file 2020-06-08 08:23:37 -03:00
826769d1c7 Cleanup: Split transform conversion of edge and uv to their own files 2020-06-08 08:23:37 -03:00
34b4dca9f1 Cleanup: Move TransSeq declaration to tansform_convert 2020-06-08 08:23:37 -03:00
0e040ef3fb Cleanup: Rename function
I forgot to remove the "_access" suffix in a previous rename.
2020-06-08 12:44:33 +02:00
f71a2fc6c3 Fix T76273 Glitches caused by glCopyImageSubData on windows + intel gpu
We limit this fix to Windows Intel GPU whose driver reports at most GL 4.4
support. This limits the fix to the range of reported GPU.
2020-06-08 12:09:51 +02:00
460c1d8e20 Revert "UI: Bevel: Show Offset type before offset amount"
This reverts commit f50222ba2e.
2020-06-08 05:40:19 -04:00
4d168e0b8c Modifiers: fix copy paste mistake in recent refactor 2020-06-08 11:01:32 +02:00
1f6d1213d2 Workbench: Use eGPUSamplerState to change texture sampling behavior
This removes some fragment shader hacks and improve the support of
different repeat & filtering modes.

This fix T77453 Image texture not repeating in viewport
2020-06-08 10:58:45 +02:00
11ba9eec70 GPencil: Show only first frame if current frame is equals or greater than current frame
Previously, the first frame was displayed from frame 0, but now, the first frame is only displayed when the current frame is equal or greater than the keyframe number.

The previous system was logical when the grease pencil was not an object, but now it seems more logical to display the keyframe if the current frame is equal to or greater than the keyframe number.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D7851
2020-06-08 09:04:25 +02:00
917ab4fbf9 UI: use term 'Merge Distance' instead of 'Merge Limit' 2020-06-07 23:40:14 -04:00
c175ff19d8 UI: Fix Wrong UI Label after recent modifier changes 2020-06-07 23:37:17 -04:00
f50222ba2e UI: Bevel: Show Offset type before offset amount
Because this controls how the amount is used in should be set first and 
is more important therefor place it at the top.

This is also consistent with other areas in Blender
2020-06-07 21:03:26 -04:00
b4ef87afb6 UI: Modifiers: Use Falloff subpanel for Weight Proximity
This makes the UI consitent with the weight edit modifier
2020-06-07 20:17:19 -04:00
24904301e5 Fix: Wrong UI Label for mesh cache play mode 2020-06-07 19:09:35 -04:00
112c86fd5d UI: Use Proper Title Case 2020-06-07 19:00:47 -04:00
281319653e UI: Do Use term 'Subsurf' 2020-06-07 18:16:56 -04:00
ccbf858bb8 Fix T77487: Only disable Multires Buttons in Edit Mode
Previously the operator buttons were disabled in every mode but
edit mode and sculpt mode.
2020-06-07 11:49:38 -04:00
00961d062a GPencil: Fix unreported Shift+F OPacity key not working
This wa snot working since the new scale thickness was included.
2020-06-07 16:18:02 +02:00
dc6cee4724 Fix T77520: GPencil viewlayer filter produce crash with masking layers
If a layer is used for masking, it cannot be filtered by viewlayer because the masked layer needs to have the mask layers in the draw pipeline.

This check is only done in final render.
2020-06-07 13:06:39 +02:00
8f25cfdbfd Refactor: use new api for some remaining functions in writefile 2020-06-07 12:22:19 +02:00
3e07d958f1 Cleanup: remove unused functions 2020-06-07 12:14:17 +02:00
561a81eb24 Refactor: use new api in remaining direct linking code 2020-06-07 12:12:48 +02:00
f6524032ca Refactor: use new api for direct linking pointcache and particle system 2020-06-07 12:05:30 +02:00
a7de01aaa9 Refactor: use new api for direct linking customdata 2020-06-07 11:58:58 +02:00
5f7007a962 Refactor: use new api for direct linking packedfile and dverts 2020-06-07 11:55:27 +02:00
1626c526f8 Refactor: use new api to check if endian switch is required 2020-06-07 11:51:07 +02:00
ab2b9821fc Cleanup: remove unused test_pointer_array function 2020-06-07 11:48:18 +02:00
eb31037503 Refactor: use new api for direct linking movie clip data 2020-06-07 11:47:37 +02:00
01132d4a83 Refactor: use new api for direct linking id properties 2020-06-07 11:42:58 +02:00
5ff8a2ca0e Refactor: use new api to simplify IDP_DirectLinkGroup_OrFree 2020-06-07 11:34:23 +02:00
b8afd4e8bb Refactor: use new api for direct linking bones, view layer and userdef 2020-06-07 11:30:32 +02:00
f0f666541e Refactor: use new api for direct_link_id_common 2020-06-07 11:16:14 +02:00
959267ffcc Refactor: use new api for direct linking preview image 2020-06-07 11:08:38 +02:00
766b3037eb Refactor: use new api for direct linking curvemapping and its callers 2020-06-07 11:07:08 +02:00
ee4732ca22 Refactor: use new api for direct linking gpencil modifiers and shaderfxs 2020-06-07 11:00:48 +02:00
ce9a64c454 Refactor: use new api for direct linking modifiers 2020-06-07 10:56:06 +02:00
a99a8061ae Refactor: use new api for direct linking keying sets, node sockets and pose 2020-06-07 10:35:34 +02:00
6c6658ccc0 Refactor: use new api for direct linking animdata 2020-06-07 10:27:42 +02:00
aed11c673e Fix T77456: Broken vertex paint undo on high-poly objects.
This is a critical fix that should also be backported to 2.83.1

Fairly stupid bug in fact, code detecting changes across undo steps was
assuming that each BHEAD (a block of data in blendfiles) would not be larger
than one memory chunk... Which is the case in alsmost every situation,
besides some super-heavy geometries, and other similar things (images
would also be affected e.g.).
2020-06-06 16:18:39 +02:00
03a693922d Cleanup: Fix typo and other issues in some comment. 2020-06-06 16:18:39 +02:00
5198cb1813 Fix typo in recent bone selection refactor
Thanks to @jbakker for pointing this out.
2020-06-06 23:32:46 +10:00
6c114a139b Refactor: use new api for direct linking paint curve, cachefile and workspace 2020-06-06 14:46:27 +02:00
033b6a7fb4 Refactor: use new api for direct linking particlesettings, movieclip, mask, linestyle and palette 2020-06-06 14:43:06 +02:00
9b3fda0357 Refactor: use new api for direct linking armature, action, nodetree and brush 2020-06-06 14:34:57 +02:00
a5e56efc98 Refactor: use new api for direct linking lattice, world, camera, speaker, sound, lightprobe and collection 2020-06-06 14:25:34 +02:00
18b57d3e2c Refactor: use new api for direct linking light, vfong, text, ipo and key 2020-06-06 14:17:27 +02:00
9a3d54943a Refactor: use new api for direct linking mball, material, texture and image 2020-06-06 14:10:43 +02:00
1800127355 Refactor: use new api for direct linking mesh and curve 2020-06-06 14:02:03 +02:00
cf3e617913 Refactor: use new api for direct linking scene and object 2020-06-06 13:55:59 +02:00
125acdf933 Refactor: use new api for direct linking hair, pointcloud, volume and simulation 2020-06-06 13:28:00 +02:00
0eb969dd99 Refactor: use new api for direct linking screen and gpencil 2020-06-06 13:20:20 +02:00
1d066050b6 Refactor: use new api in direct_link_windowmanager 2020-06-06 12:53:59 +02:00
5146034aa9 Blenloader: simplify list reading api 2020-06-06 12:53:36 +02:00
Marcelo Demian Gómez
7bd73f562a Fix T77473: Removing GPencil vertex group mix data
When removing a vertex group from a Grease Pencil object, if the vertex group is not the last one that was added, the information for the remaining groups weights gets mixed up.

Minor edit of the patch for clang format.

Differential Revision: https://developer.blender.org/D7943
2020-06-06 10:19:26 +02:00
f5781384ae GPencil: Fix unreported fill helper lines not displayed
When use the helper lines (red lines) with fill tool, the lines were not displayed in some situations.
2020-06-06 10:04:56 +02:00
a39cc5ae4d Fix for T77478: Quiet Conversion Error/Warning
Quiet warning/error about int and float multiplication.

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

Reviewed by Ray Molenkamp
2020-06-05 17:05:06 -07:00
b74cc23dc4 UI: Ability to Print Bold and Italics
Adds the ability to print text in bold or italics style, synthesized from a single base UI font.

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

Reviewed by Brecht Van Lommel
2020-06-05 15:39:17 -07:00
fc672ce8e2 Refactor: use new api for remaining direct data writing 2020-06-05 21:55:45 +02:00
60b8db587f Blenloader: new write_struct_at_address api functions 2020-06-05 21:55:45 +02:00
f0047e6754 Refactor: use new api for write_movieclip and write_keyingsets 2020-06-05 21:55:45 +02:00
0f1361bbc3 UI: Apply Latest Changes to Multires Modifier
These changes didn't make it through the transition to the new UI layout.
- Add "has_displacement" check
- Add "sculpt_levels" property
- Give subdivide operators the operator name so they work
2020-06-05 15:31:04 -04:00
5340556710 Refactor: remove temporary IDP_WriteProperty_new_api 2020-06-05 21:22:43 +02:00
7949953b1e Refactor: use new api in write_userdef 2020-06-05 21:19:03 +02:00
a77350cce2 Cleanup: remove unused functions 2020-06-05 20:56:36 +02:00
69c9204026 Refactor: use new api for write_curvemapping and its users 2020-06-05 20:55:42 +02:00
26fb0d4258 Refactor: use new api to finish write_object 2020-06-05 20:46:27 +02:00
c3e88fdd03 Refactor: use new api for write_pointcaches 2020-06-05 20:40:38 +02:00
a943b65f1b Refactor: use new api in write_area_map 2020-06-05 20:34:59 +02:00
4df20c058d Refactor: use new api in write_bone 2020-06-05 20:34:59 +02:00
2ee95e91f7 Remove context check from constraint and shaderfx edit poll
This mirrors 1f78e86070 from 2018 for mesh modifiers.

Differential Revision: https://developer.blender.org/D7940
2020-06-05 14:30:15 -04:00
70ad18b94d Fix T77335: Circle Select tool selects faces perpendicular to the view
Internally the face dots are being drawn when the Edges option of the
overlay (not the selection mode) is disabled.
2020-06-05 14:49:57 -03:00
b91b90f0dd Fluid: Cleanup internal Python object names
Manta Python objects should not carry the global ID in their names.
2020-06-05 18:52:33 +02:00
b6764b9a31 Update for latest master, small cleanup and renaming 2020-06-05 12:46:24 -04:00
76e9cdc90a Merge branch 'master' into modifier-panels-ui 2020-06-05 11:34:10 -04:00
b16a85fe0b Cleanup: use 'r_' prefix for return arguments in math_color 2020-06-06 00:46:25 +10:00
9b099c8612 UI: Drag and Drop Modifiers, Layout Updates
This patch implements the list panel system D7490 for modifiers.
It also moves modifier drawing to a callback in ModifierTypeInfo
in line with the extensible architecture refactoring goal T75724.

This adds a PanelRegister callback and utilities for registering
panels and subpanels. It also adds the callbacks for expansion saving
and drag and drop reordering described in D7490.

These utilities, callbacks, and other common UI elements shared
between modifiers live in MOD_ui_common.c.

Because modifier buttons are now in panels, we can make use of
subpanels for organization. The UI layouts also use the single
column layout style consistently used elsewhere in Blender.
Additionally, the mode-setting buttons are aligned and ordered
consistently with the outliner.

However, the large number of UI changes in this patch may mean
that additional polishing is required in master.

Thanks to William Reynish (@billreynish) who did a fair amount of the
layout work and to Julian Eisel (@Severin) for consistent help.

Differential Revision: https://developer.blender.org/D7498
2020-06-05 10:41:03 -04:00
4e70e0e384 LibOverride: RNA: Cleanup no more needed property-specific override flags. 2020-06-05 16:37:40 +02:00
846dde590f Cleanup: use doxy sections for sequencer edit, select 2020-06-06 00:12:31 +10:00
0f64de6b9b Cleanup: compiler warning 2020-06-06 00:12:28 +10:00
e9659d0e6e Fix failing assert when dragging panel close to region edge
Forgot to include this change from Julian Eisel @Severin in the
previous commit.
2020-06-05 10:05:47 -04:00
859505a3da UI: Pan 2D Region When Dragging to Boundary
This adds a modal operator called Edge Pan, which is meant to run invisibly
while something inside a region is being dragged. This patch applies this
to dragging panels, but it can be used elsewhere too.

The speed (which is defined relative to how far the mouse is beyond the
boundary) and delay are easily adjustible. and the speed also increases
smoothly from a start value to a max to make it feel more interactive
and less robotic.

Differential Revision: https://developer.blender.org/D7465
2020-06-05 10:01:20 -04:00
1270984e13 Refactor: use new api in write_customdata 2020-06-05 15:54:19 +02:00
b77834ceb1 Refactor: use new api for writing modifiers 2020-06-05 15:38:36 +02:00
a8afe509da Refactor: use new api in write_nodetree_nolib 2020-06-05 15:22:43 +02:00
0ee98c654e Refactor: use new api in write_animdata 2020-06-05 15:15:28 +02:00
abeda01ac6 GPencil: Improve Vertex Paint in filled areas
When use the Tint tool, it was very difficult to tint the filled areas if the strokes had very few points or the area was big.

Differential Revision: https://developer.blender.org/D7936
2020-06-05 15:11:08 +02:00
67b17684e6 Fix T77396: crash in memfile undo code after recent optimizations.
Optimizations in rBcda15408582e8de5b405 do not guarantee anymore that
consecutive memchunks in two consecutive undo steps are actually about
the same data (and hence can share the same buffer when unchanged).

This buffer sharing can now happen without any particular order, so we
need to change the process when 'merging' two undo memfiles together.

Note that existing code was not logically correct either, even with
previous undo storage code, since it would blindly transfer ownership of
the buffer to the second memchunk, without checking whether the first
one was actually the owner of it or not (a same buffer can be shared by
matching memchunks in many consecutive memfiles/undo steps).
2020-06-05 14:54:54 +02:00
ff5d24f8be Refactor: use new api in write_iddata 2020-06-05 14:45:32 +02:00
f797a5406d Refactor: use new api for writing object, mesh and particlesettings 2020-06-05 14:41:42 +02:00
a6cd77bad1 Refactor: use new api for writing camera, lattice, vfont and key 2020-06-05 14:32:26 +02:00
0a41a85bf3 Refactor: use new api for writing curve, mball, image, light, world, material and texture 2020-06-05 14:25:07 +02:00
b78fb8b987 Cleanup: remove unused sequencer marker code from 2.4x 2020-06-05 22:18:58 +10:00
74fa600ede Sequencer: split select side of frame out of the select operator
The select operator was getting overloaded with functionality
unrelated to selecting the strip at the mouse position.

- Don't save settings, allowing the keymap only to include
  non-default options.

- Fix selecting strips overlapping the current frame
  overwrite all flags.
2020-06-05 22:14:02 +10:00
d850daf416 Refactor: use new api for writing collection, action and gpencil 2020-06-05 14:09:35 +02:00
43294e5f49 Refactor: use new api in write_scene 2020-06-05 13:55:45 +02:00
60a786e711 Refactor: use compile time dna struct ids in blenloader api 2020-06-05 13:55:45 +02:00
5ed2ed28ab CodeCleanup: Supressed warning 2020-06-05 13:40:22 +02:00
dc69747f72 Refactor: use new api for writing linestyle, cachefile, hair, pointcloud, volume and simulation 2020-06-05 13:29:46 +02:00
e4e8259d39 Refactor: use new api for writing movieclip, mask, probe, nodetree, brush, palette and paintcurve 2020-06-05 13:14:39 +02:00
2396daf921 Refactor: use new api for writing screen, armature, text and speaker 2020-06-05 12:53:39 +02:00
a1d55bdd53 Refactor: use new api in write_workspace 2020-06-05 12:35:20 +02:00
473aaa389c Cycles: Enable OptiX on all Maxwell+ GPUs 2020-06-05 12:33:00 +02:00
56da8dae67 Refactor: use new api in write_windowmanager 2020-06-05 12:29:40 +02:00
0e6c648f3f Refactor: Move IDProperty writing to new API 2020-06-05 12:21:19 +02:00
7d32a259bf Installdeps: make embree use TBB.
Following changes done to makedeps in rBc7329da14b22.
2020-06-05 12:01:18 +02:00
1c5479167f Cleanup: Strict compiler warning 2020-06-05 11:59:45 +02:00
48075b2c05 Blenloader: New API that will be used for blenloader decentralization
Design Task: T76372

This part of a larger refactoring towards a more extensible architecture
in Blender: T75724

The API is defined in `BLO_read_write.h`. It adds the small data structures
`BlendWriter`, `BlendDataReader`, `BlendLibReader` and `BlendExpander`.
Those contain context about the current read/write operation. Furthermore,
it adds many functions with the prefixes `BLO_write_*`, `BLO_read_*` and
`BLO_expand_*`.

Lib linking and expanding will probably be handled by the more generic libquery
system eventually. The corresponding parts of the API can be removed then.
2020-06-05 11:44:36 +02:00
ce7409fd13 Cleanup: use ED_object_ prefix for constraint functions
- ED_object_constraint_list_from_constraint was get_constraint_lb
- ED_object_constraint_list_from_context    was get_active_constraints
- ED_object_constraint_active_get   was get_active_constraint
- ED_object_constraint_active_set   was ED_object_constraint_set_active
2020-06-05 18:59:47 +10:00
5e55153c89 LibOverride: Cleanup: remove useless per-property override flag.
now that we have more 'global' ways to control that, we can save us
quiet a fwe calls....
2020-06-05 10:57:21 +02:00
191edd224a Cleanup: rename suffix 'conv' to 'convert' 2020-06-05 18:27:38 +10:00
f2d5c53966 Fix accessing online manual for PropertyGroups
Alternate fix for the issue raised in D7837
2020-06-05 18:09:00 +10:00
e8b8e16b24 Code Cleanup: fcurve function naming 2020-06-05 09:30:15 +02:00
fe6be70875 CleanUp: Introduce BKE_fcurve_create 2020-06-05 08:41:35 +02:00
e3a32a22bf GPencil: Channel Lock tooltip
After talking with UI team, we decided to change the tooltip.
2020-06-05 08:27:52 +02:00
0aa2c10ad1 Cleanup: remove braces from previous commit (no functional changes) 2020-06-05 16:12:22 +10:00
8b347fc2cd Armature: increase maximum delectable bones from 4096 to 8192
Remove BONESEL_NOSEL which isn't needed.

Addresses issue raised in T77378.
2020-06-05 16:04:35 +10:00
fd63220a35 Cleanup: maybe uninitialized variable warning 2020-06-05 14:55:15 +10:00
9e96c6d054 Cleanup: spelling 2020-06-05 14:34:00 +10:00
b2d1c4873f Cleanup: remove unnecessary inline header
Caused by lsp/clang applying *fixes* automatically, tsk.
2020-06-05 14:33:59 +10:00
c7329da14b Build: use TBB as Embree tasking system
This avoids launching additional threads and solves some console warnings on
Linux + AMD Ryzen CPU.
2020-06-05 00:58:31 +02:00
0b28f0410c Fix make deps build errors with conflicting Boost system packages 2020-06-05 00:58:31 +02:00
b168c255aa GPUTexture: Make GPU_texture_unbind_all faster on newer opengl version 2020-06-04 21:28:19 +02:00
ba5b303c88 DRW: Fix T77370: Redundant anti aliasing/blur effect 2020-06-04 21:28:19 +02:00
1d72fc5a1a LibOverride: Add Pointer properties to 'overridable by default'.
There is in fact no reason not to do so, RNA pointers are either to
other IDs (which is properly handled by default diffing code), or to
sub-structures that should almost always  be diffed as well.

Exceptions (like backward ID pointers or strictly runtime caches and
data) are to be handled with proper 'no comparison' flag in any case.
2020-06-04 18:06:47 +02:00
d71f9b9886 LibOverride: cleanup Collection case.
This should not give any real difference, those were already
overridable.
2020-06-04 18:06:47 +02:00
f2a0532111 Disable gravity in Draw Face Sets brush
Applying gravity to this brush does not make much sense and undo/redo
won't work correctly as it uses a different undo type.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7925
2020-06-04 18:05:46 +02:00
15ed2f841c Fix Sharpen mesh filter in Multires
Instead of accumulating displacement for each vertex into the neighbors, accumulate the opposite displacement from each neighbor into the vertex. I think this is the same and it does not produce artifacts in Multires.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D7508
2020-06-04 18:04:07 +02:00
caca3d9c97 installdeps: fix bad FFMPEG official version number.
re T77035.
2020-06-04 17:35:33 +02:00
c7a2ed69be GPencil: Fix Lock Frame Dopesheet tooltip
The old tooltip was not clear enough
2020-06-04 16:55:19 +02:00
c604d2762f Fix T77358: Gpencil can't select geometry within transparent layers
This was an old check of opacity for editable layers, but with new system it's not needed because you can use the edit lines.
2020-06-04 16:41:46 +02:00
733a3e3a70 Fix T77164: scaling/rotation fails for 3 selected NURB points 2020-06-05 00:40:14 +10:00
3da4724f72 Fix T77367: Blender's snap package ignores command line options 2020-06-05 00:39:45 +10:00
fd061f61c7 GPUShaderInterface: Reduce creation time on some drivers.
Querying GL_UNIFORM_BLOCK_INDEX seems to be a problem on apple drivers.
2020-06-04 15:28:45 +02:00
3b4ef08d68 Fix Grease Pencil panel showing as first panel in render properties
Move it lower next to the Freestyle panel.
2020-06-04 14:44:00 +02:00
41866070d3 Cleanup: remove unused flag 2020-06-04 14:37:20 +02:00
953c232db3 Fix T77276: Generating Python API docs raises many warnings 2020-06-04 22:31:54 +10:00
10b34ad697 GPUShaderInterface: Change builtin array to array of location/bind
This reduce the base size of the shaderinterface from 400 to 136 bytes.
Improves memory usage and cache coherency when querying a lot of uniforms
at once.
2020-06-04 14:17:06 +02:00
5837de6879 Cleanup: DRW: Add comment and remove bitfields. 2020-06-04 14:17:06 +02:00
7534bbfa34 GPUShaderInterface: Add Builtin Uniform blocks query
This makes the query of theses mandatory uniforms faster.
2020-06-04 14:17:06 +02:00
1438c1cfd5 Merge branch 'blender-v2.83-release' 2020-06-04 13:49:50 +02:00
30395a491f Fix T77073: Objects cannot be activated after collection exclude
When excluding a collection containing the active object in either
texture paint or particle edit mode, the object could not be reactivated
when the collection was re-enabled. This is because the object's mode
was left in TEXTURE_PAINT or PARTICLE_EDIT, and the activation code did
not have cases to handle these modes.

This moves the code that is run when toggling out of texture paint or
particle edit modes to functions so activation can properly toggle off
the respective interaction mode.
2020-06-04 21:48:04 +10:00
c7c3908b8e Cleanup: split particle & texture paint mode switching into utility functions 2020-06-04 21:36:33 +10:00
0f32029522 Fix T77315 Overlay: Selection Highlighting not working with complex scene
Was caused by a UBO bind to the wrong slot.
2020-06-04 12:57:26 +02:00
78017916f7 Fix error removing the image paint cursor
Mix up with imapaint.paintcursor & imapaint.paint.paint_cursor
Remove imapaint.paintcursor since it wasn't used.

Also rename paint_cursor_start_explicit() to paint_cursor_start(),
removing the existing paint_cursor_start() since it took the paint
struct from the context, a value that's known by all callers.
2020-06-04 20:24:57 +10:00
465a9f65de Cleanup: remove window manager argument for paint cursor API
This caused an additional argument when exiting object modes
and many other low level functions which don't need to access context.

This simplifies fixing T77073.
2020-06-04 18:41:16 +10:00
1a23b0be97 LibOverride: Make all modifiers properties overridable.
This is second and last part of T77083.
2020-06-04 10:26:05 +02:00
f9892bd6cf Fix T77264: Mantaflow: Liquid checkbox doesn't turn on while switching
between fluid types

When switching to gas, the fluids were not actually destroyed, leading to
the situation that they were then destroyed when actually switching to
liquid.

Maniphest Tasks: T77264

Differential Revision: https://developer.blender.org/D7907
2020-06-04 09:49:05 +02:00
244ed645e0 GPencil: Improve selection in Fill areas
Now when use selection if the selection area is inside a filled area, the stroke is selected. Before it was necessary to select the border of the stroke.
2020-06-04 09:37:12 +02:00
fe13f3db81 UV: use selection for 'Seams from Islands'
Use bmesh connectivity data to simplify logic.
2020-06-04 17:10:45 +10:00
67a617e196 Cleanup: move auto-execute operators into userpref_ops.c 2020-06-04 16:23:07 +10:00
7aa47083d0 Cleanup: update sections for wm_files.c 2020-06-04 16:10:01 +10:00
Johan Walles
e723ec04fb UI: more informative light energy description based on light type 2020-06-04 13:23:47 +10:00
67b10fcc22 Fix error in recent fix for T77290 2020-06-04 12:40:17 +10:00
b94ab93dfb Eyedropper: Support get samples from other windows
This fix T77226

Differential Revision: https://developer.blender.org/D7910
2020-06-03 15:45:57 -03:00
a4e0bccb87 Cleanup: Use ELEM Macro 2020-06-03 13:34:24 -04:00
0849af4591 Linux: update appdata for 2.83 release 2020-06-03 19:10:51 +02:00
86385d7ebd Fix build error for Cycles standalone
This does not affect the Blender release.

Ref D7915
2020-06-03 19:10:51 +02:00
bd68312cb6 LibOverride: Make camera data-block properties overrideable.
Note that you still have to make overrides of obdata IDs by hand (and
deal with remapping of pointers yourself) for now.
2020-06-03 18:57:49 +02:00
2cdfc1b4af LibOverride: Make constraints fully overrideable.
All settings of constraints should be overrideable now.
Modifiers will follow tomorrow.

Part of T77083.
2020-06-03 18:46:36 +02:00
fc1bb36668 LibOverride: fix debug timing code. 2020-06-03 18:46:18 +02:00
26aa64b688 Fix broken split layout in encoding options
The "Max B-frames" options were misplaced. Uses the usual layout of a checkbox
together with the number button now.
Reported by Peter Fog (@tintwotin), thanks!
2020-06-03 18:12:29 +02:00
ef0ff4aaf2 GPencil: Fix unreported error in Dots Strokes material initialization
The materials was not initializated in the right mode.
2020-06-03 18:01:34 +02:00
dbb1f56e55 Fix T77290: Crash displaying vertex colors in edit mode
Regression from deaff945d0, follow logic from d98ae27f02.
2020-06-04 01:52:33 +10:00
de9c04c287 Cleanup: clang format, warning 2020-06-04 01:18:39 +10:00
51cd6d22c5 Cleanup: GPUMaterilal: Texture Node: Remove unused functions 2020-06-03 16:43:31 +02:00
15a24f3d7f GPUMaterial: Fix shader compilation when using UDIM textures 2020-06-03 16:42:54 +02:00
Nathan Letwory
211b6c29f7 Remove trailing space 2020-06-03 17:38:22 +03:00
96eab08755 DRW: Always unbind texture after drawing
This fix issues with the image editor
2020-06-03 16:24:04 +02:00
b2dcff4c21 GPUMaterial: Rework/simplify image texture filtering
This use the latest GPUTexture change to use the sampler state to avoid
the pole issues instead of using GLSL hacks.

This should fix T73942: Eevee mipmaps not respecting border mode.

Note that this also fix some discrepencies between cycles and eevee (like
boxmapping + clip).
2020-06-03 16:18:50 +02:00
054923c860 GPUMaterial: Rework/simplify environment texture filtering
This use the latest GPUTexture change to use the sampler state to avoid
the pole issues instead of using GLSL hacks.
2020-06-03 16:18:50 +02:00
47bdb28841 GPUTexture: Fix samplers configuration typo 2020-06-03 16:18:50 +02:00
91cc1f38ae GPUMaterial: Add support for different sampler state per image sampler
This bridge between the new sampler state support from GPUTexture and
draw material handling.

The Sampler State is just the one from the texture for now. No change in
logic.
2020-06-03 16:18:50 +02:00
866e067d65 GPUTexture: Add support for binding textures with custom sampler states 2020-06-03 16:18:50 +02:00
4184371fb0 Fix T77156: GPencil view layer filter by layer not working
This was removed by error during the refactor done in 2.83.

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

Reviewers: @fclem
2020-06-03 15:57:09 +02:00
df17ee202b Fix T77203: Mantaflow Bake All cannot be resumed
The manual is also more explicit about this now (rBM6725).
2020-06-03 14:54:40 +02:00
Nathan Letwory
82e3bd4bbb Ensure submodules are at correct commits for 2.83 2020-06-03 15:23:39 +03:00
Nathan Letwory
3c9f80c898 Move 2.83 from beta to release 2020-06-03 15:21:51 +03:00
Nathan Letwory
dc8475ec6a Splash: new image for 2.83 by Ian Hubert 2020-06-03 15:19:34 +03:00
cda1540858 Undo: Detect/find proper memchunk for a given ID during undo step writing.
Most of the time current (based on order) system works fine, but when you add
or rename (i.e. re-sort) some ID, every data/memchunk afterwards would be out
of sync and hence re-stored in memory (and reported as changed).

Now we are storing the ID's session_uuid in the memchunks, which allows to
actually always find the first memchunk for an already existing ID stored in
previous undo steps, and compare the right memory.

Note that current, based-on-order system is still used almost all of the time,
search in the new ghash is only performed for a few data-blocks (when needed at all).

Reviewed By: brecht

Maniphest Tasks: T60695

Differential Revision: https://developer.blender.org/D7877
2020-06-03 12:07:45 +02:00
Bastien Montagne
3384bb2c66 RNA: add option to enable by default lib overridale flag of defined properties.
Similar to the one allowing to deactivate DNA check, etc.

Will helps reduce verbosity when making many new properties overridable.

Note that pointer properties always remain non-overridable by default,
since basically only ID pointers should be.

Reviewed By: brecht

Maniphest Tasks: T77083

Differential Revision: https://developer.blender.org/D7906
2020-06-03 11:18:11 +02:00
0e14eb7b31 Cleanup: DRW: Remove support for ModelViewProjectionMatrix
This has been replace by manual model+viewproj transform inside the shader.
2020-06-03 11:02:56 +02:00
75015f27ba Cleanup: DRW: Remove support for builtin matrices 2020-06-03 11:02:56 +02:00
d4f1efad00 DRW: Remove use of builtin matrices and replace by common_view_lib 2020-06-03 11:02:56 +02:00
3e4c8d48aa Cleanup: DRW: Remove builtin 3D only shader usage 2020-06-03 11:02:56 +02:00
55f8758b87 GPUImmediate: Fix array uniform not working 2020-06-03 11:02:56 +02:00
59bfcd8c5d Cleanup: DRW: Remove persistent uniform functions 2020-06-03 11:02:56 +02:00
9b0543389b Fix domain voxel size indicator drawing
Use already calculated cell_size directly.

Part of T77030.
2020-06-03 10:58:42 +02:00
6f21137722 Object: refactor mode switching
Functionality here has become confusing over time,
this removes duplicate, similar functions, preferring to set the mode
instead of toggle, enter, exit.

Mode switching utility function behaved differently regarding undo,
'ED_object_mode_toggle' for example didn't skip the undo push
where 'ED_object_mode_set' did.
Some callers chose these functions based on the intended undo behavior,
even when toggling didn't make sense.

There was also ED_object_mode_generic_enter which was similar to
ED_object_mode_set, instead of the reverse of ED_object_mode_generic_exit.

Simplify object mode switching internals:

- Replace ED_object_mode_generic_enter with ED_object_mode_set.
- Remove ED_object_mode_toggle as nearly all callers needed to check
  the current mode so toggling would set the mode argument correctly.
- Use ED_object_mode_set for the object mode switching operator
  to simplify logic.
- Add ED_object_mode_set_ex which has an argument to disable undo,
  needed when loading undo data needs to set the mode.
- Remove unused ED_object_mode_exit.
2020-06-03 18:29:06 +10:00
53cb1a32db Cleanup: remove ED_gpencil_setup_modes from object mode set
Grease pencil mode switching functions already call this.
2020-06-03 18:26:02 +10:00
3b6e223a03 Fix app-template warning disabling a template without a Python module 2020-06-03 14:46:52 +10:00
f0df4d6c35 Fix T67577: Add-on unregister can't access preferences on factory reset 2020-06-03 14:46:52 +10:00
2749e6a639 Cleanup: remove redundant call to addon_utils.reset_all()
This is already called by wm_homefile_read
2020-06-03 14:46:52 +10:00
2004f9a342 Cleanup: move shared functionality to wm_file_read_pre
This matches wm_file_read_post.
2020-06-03 14:46:52 +10:00
45b5f4e3df Cleanup: minor changes to wm_homefile_read
Move app_template assignment to the top of the function,
this simplifies further changes.
2020-06-03 14:46:52 +10:00
a5e9f024f2 Fix T77289: Crash when typing negative numbers
This was caused by an oversight in rB45dbc38a8b15. When the next operation
character is found the offset is shifted in the original string. The remaining
length has to be recalculated with that offset before shifting the remaining
characters to make room for the ")".
2020-06-03 00:37:26 -04:00
2e52b3206c PyDoc: Fix warnings from out of bounds include statement 2020-06-02 18:21:42 -04:00
650dedfd10 Cleanup: GPUTexture: Remove uneeded bind 2020-06-02 23:44:22 +02:00
a1f9eebc0b DRW: Remove automatic bind locations and use hardcoded locations for textures
This cleanup use the recent changes in shader interface to allow querying
the binding location a texture should use.

This should aleviate all issue we have with texture state change recompiling
the shaders at drawtime.

All binds are now treated like persistent binds and will stick until a new
shading group bind a different shader. The only difference is that you can
still change it with a new subgroup or same shader shgroup.

Since unbinding can be heavy we only do it when using `--debug-gpu`.
2020-06-02 23:44:22 +02:00
47eccac21c GPUShaderInterface: Fix out of bound reads 2020-06-02 23:44:22 +02:00
ee4bafc63a GPU: Texture: Remove multibind tracking
This is more of a limitation than it is a solution.
2020-06-02 23:44:22 +02:00
beef67d1df GPUShader: Bind shader for interface creation
This will fix the bindpoints not being set at interface creation
2020-06-02 23:44:22 +02:00
ea92f8207a Revert "UI: Fix T77173: Report Background Colors for 2.83 Release"
This reverts commit 7fc0053c27.
2020-06-02 15:59:37 -04:00
e391b3e0fb Merge branch 'blender-v2.83-release' 2020-06-02 15:58:38 -04:00
a87eee65fc Fix T76196: Curve Display hides wires as soon as any part has faces [due
to filling/extrude/etc]

Caused by rB6da097136cf4.

The file in the report has some parts of the curve object generate faces
[due to success in filling] and some others dont [where filling isnt
possible].

rB6da097136cf4 disabled the wires/curves drawing whenever any faces
would be generated (but the only way to see all wires was to set the
Fill Mode to None then).

So now only skip the wires/curves drawing if we are _not_ in wireframe
viewport shading and the object's viewport display options is above
'WIRE'.

This is an alternative fix to D7594 (and I think the better alternative,
thx @stevewarner suggesting this).

Maniphest Tasks: T76196

Differential Revision: https://developer.blender.org/D7874
2020-06-02 21:42:34 +02:00
7fc0053c27 UI: Fix T77173: Report Background Colors for 2.83 Release
This is a temporary solution for T77173 for the 2.83 release. D7203
provides a more long term solution for future releases.

This adds theme colors for the three report backgrounds, setting them
to the color used in 2.82. A separate commit in the addons repository
will follow for changes to the bundled themes.

Differential Revision: https://developer.blender.org/D7908
2020-06-02 15:04:46 -04:00
85098bdb89 Fix T76776: Implement vertex_visibility_get for PBVH_GRIDS
This was missing from when Face Sets were enabled in Multires, so it was
always considering that all vertices in the grids are visible. This
should also fix other unreported bugs.

Reviewed By: sergey

Maniphest Tasks: T76776

Differential Revision: https://developer.blender.org/D7809
2020-06-02 20:52:46 +02:00
071cc71fb0 Cleanup: Use const context for some UI templates
- uiTemplateID: Straightforward, just const for the template
    and the functions it calls
  - uiTemplateCacheFile: Create a function in rna_ui.c because
    the generated RNA callback doesn't have const context.

Differential Revision: https://developer.blender.org/D7895
2020-06-02 14:09:01 -04:00
dcdbcf1ec1 Fix: Crash Edit Mode Selection RCS 2020-06-02 19:57:02 +02:00
Tautvydas Andrikys
ffb3365fb2 Fix T63588: Cycles unnecessarily updates background importance sampling map
With modifications by Brecht to solve T77273, crash enabling portal lights.
2020-06-02 19:48:51 +02:00
0465086223 Merge branch 'blender-v2.83-release' 2020-06-02 19:48:45 +02:00
52cc412e0f Revert "Fix T63588: Cycles unnecessarily updates background importance sampling map"
This reverts commit 33ce0cb5a1.

Fix T77273: crash enabling portal lights. The optimization for background
updates can be added back later for 2.90 and 2.83.1.
2020-06-02 19:44:12 +02:00
572c472754 Cleanup: Always use pbvh in PBVH BKE files
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7889
2020-06-02 19:40:08 +02:00
4153606edd Fix: Crash When Selecting In Edit Mode
TaskGraph wasn't initialized in `DRW_draw_select_id`
2020-06-02 19:09:38 +02:00
b08caeb92b Sculpt: Improve twist axis in Pose FK mode
Previously, the twist rotation was aligned using the stroke location.
This was causing unexpected results when rotating some Face Sets rigs.
Now the intersection with the first Face Set in the flood fill is used,
which produces much better results.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7900
2020-06-02 18:39:41 +02:00
ca09625dcc Cleanup: Remove unused grab delta in Pose Brush
The grab delta is not used in do_pose_brush_task_cb_ex, so there is no
reason to add it to SculptThreadedTaskData

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7901
2020-06-02 18:38:20 +02:00
417ebc3845 UI: Expand linked/overriden collections by default in the Outliner
When linking or overriding an instanced collection, the new collection item in
the Outliner is now un-collapsed by default.
Linking and overriding is typically used in production scenes, where
collections tend to contain many items (children, grand-children, etc.). If all
collections in that hierarchy are expanded by default, the Outliner gets
flooded with items. So users ended up manually collapsing the collections.

Part of T76555.

Reviewed by: Andy Goralczyk, Bastien Montange.

Differential Revision: https://developer.blender.org/D7626
2020-06-02 17:59:08 +02:00
bd3ab27410 Library Overrides: Don't move collections to Scene Collection when overriding
When using the "Make Library Override" operator on instance collections, keep
the overriden collection in the parent collection of the instance empty.
Previoulsy the collection would be added to the scene collection, which was
confusing and not what users expected. It was placed there for a reason after
all.

Part of T76555.

Reviewed by: Andy Goralczyk, Bastien Montange.

Differential Revision: https://developer.blender.org/D7626
2020-06-02 17:59:08 +02:00
1743326889 Library Overrides: Unlink instance empty after "Make Library Override"
Unlink (delete if single-user) collection instance empty once an override is
added to the collection through the "Make Library Override" operator. It isn't
used as a collection instance anymore then so the emtpy is an annoying left
over that has no purpose.

Part of T76555.

Reviewed by: Andy Goralczyk, Bastien Montange.

Differential Revision: https://developer.blender.org/D7626
2020-06-02 17:59:08 +02:00
cdf0d95a50 Fix T77126: Documented frame_change_pre and frame_change_post handlers
The documentation for the `frame_change_pre` and `frame_change_post`
handlers was really sparse, and suggested that `frame_change_pre` is
called before the frame changes. This is not the case; it's called after
the frame has changed, but before the dependency graph has been updated
for it.

No functional changes, just updated documentation.

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

Reviewed by: sergey
2020-06-02 17:31:45 +02:00
6a70d7e09f Fix utterly broken versionning code for weight modifier.
Own fault in some recent patch rewiew/commit...
2020-06-02 17:30:02 +02:00
9d9f35d946 Cleanup: factorize duplicated code in WVG modifiers' RNA. 2020-06-02 17:30:02 +02:00
5ef44dd83f Cleanup: unused argument 2020-06-03 01:05:25 +10:00
9713df4e92 Merge branch 'blender-v2.83-release' 2020-06-03 00:59:56 +10:00
2c204432df Merge branch 'blender-v2.83-release' 2020-06-03 00:59:52 +10:00
e69f70e11f Revert "Fix T67577: Add-on unregister can't access preferences on factory reset"
This reverts commit f18ed7ad89.

Better leave the fix for 2.9 series.
2020-06-03 00:59:45 +10:00
50994eace6 Fix T66967: skin modifier crash scaling skin radius to zero 2020-06-03 00:59:44 +10:00
b18c2a3c41 EEVEE: Refactor of eevee_material.c
These are the modifications:

-With DRW modification we reduce the number of passes we need to populate.
-Rename passes for consistent naming.
-Reduce complexity in code compilation
-Cleanup how renderpass accumulation passes are setup, using pass instances.
-Make sculpt mode compatible with shadows
-Make hair passes compatible with SSS
-Error shader and lookdev materials now use standalone materials.
-Support default shader (world and material) using a default nodetree internally.
-Change BLEND_CLIP to be emulated by gpu nodetree. Making less shader variations.
-Use BLI_memblock for cache memory allocation.
-Renderpasses are handled by switching a UBO ref bind.

One major hack in this patch is the use of modified pointer as ghash keys.
This rely on the assumption that the keys will never overlap because the
number of options per key will never be bigger than the pointed struct.

The use of one single nodetree to support default material is also a bit hacky
since it won't support concurent usage of this nodetree.
(see EEVEE_shader_default_surface_nodetree)

Another change is that objects with shader errors now appear solid magenta instead
of shaded magenta. This is only because of code reuse purpose but could be changed
if really needed.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7642
2020-06-02 16:58:07 +02:00
eba3aa1837 Revert "Fix T67577: Add-on unregister can't access preferences on factory reset"
This reverts commit f18ed7ad89.

Better leave the fix for 2.9 series.
2020-06-03 00:54:29 +10:00
b82cb0ad32 Cleanup: GPU: Remove GPU_shaderinterface_uniform_ensure 2020-06-02 16:46:38 +02:00
38cfcdd51b DRW: Remove defered uniform creation 2020-06-02 16:46:38 +02:00
cb59ef1032 OCIO: GLSL: Avoid undefined behavior
Set ubo binding after shaderinterface creation as GPU_shaderinterface_create
will call glUniformBlockBinding.
2020-06-02 16:46:38 +02:00
Jeroen Bakker
0749cff957 Depsgraph: Remove unneeded RNA_path_resolve
Found during research of {T77124}. In `build_driver_data` an identical
 RNA_path is resolved twice. In stead of resolving it twice this patch
will construct the `property_exit_key` based on the resolution of
`property_entry_key`.

This change isn't noticeable for users. Just a cleanup as it isn't
needed to do the same logic twice.

Reviewed By: Sergey Sharybin

Differential Revision: https://developer.blender.org/D7872
2020-06-02 16:02:59 +02:00
Jeroen Bakker
752139556f BVHCache: Performance
This patch changes the BVHCache implementation. It will use
a primitive array in stead of the ListBase. The locking is also
changed from a global lock to a per cache instance lock.

The performance of `gabby.blend` available on the cloud increased from 9.7
fps to 10.5 fps.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7817
2020-06-02 16:01:14 +02:00
Jeroen Bakker
bf34b0c8f4 DrawManager: Graph Task Scheduling
This patch uses a graph flow scheduler for creating all mesh batches.
On a Ryzen 1700 the framerate of Spring/020_02A.anim.blend went from 10 fps to 11.5 fps.

For each mesh where batches needs to be updated a sub-graph will be added to the task_graph.
This sub-graph starts with an extract_render_data_node. This fills/converts the required data
from Mesh.

Small extractions and extractions that can't be multi-threaded are grouped in a single
`extract_single_threaded_task_node`.

Other extractions will create a node for each loop exceeding 4096 items. these nodes are
linked to the `user_data_init_task_node`. the `user_data_init_task_node` prepares the userdata
needed for the extraction based on the data extracted from the mesh.

Note: If the `lines` and `lines_loose` are requested, the `lines_loose` sub-buffer is created
as part of the lines extraction. When the lines_loose is only requested the sub-buffer is
created from the existing `lines` buffer. It is assumed that the lines buffer is always
requested before or together with the lines_loose what is always the case (see
`DRW_batch_requested(cache->batch.loose_edges, GPU_PRIM_LINES)` in `draw_cache_impl_mesh.c`).

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7618
2020-06-02 15:54:45 +02:00
0a00fbd265 Fix T66967: skin modifier crash scaling skin radius to zero 2020-06-02 23:45:51 +10:00
21443056b7 Turn most flags in BlenderDefRNA into proper bool. 2020-06-02 15:18:14 +02:00
43ec8c287f Cleanup: RNA: use BlenderDefRNAtruct named members initialization. 2020-06-02 15:14:10 +02:00
cecda64e2e GPU: ShaderInterface: Refactor to setup all uniform at creation time
This remove the complexity of queriying the locations at runtime and
allows for more performance and upfront binding specifications.

The benefit of doing everything at creation time is that we can assign binding
points in a predictable order which is going to be somewhat the same for
every similar shader.

This also rewrite GPU_vertformat_from_shader to not use shaderface.

This is to keep the shaderface simple. If it becomes necessary to not query
the shader after creation (i.e: vulkan?) we could just create the vert
format in advance at compilation for PyGPU shaders.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7879
2020-06-02 12:11:39 +02:00
bdda53fdb2 GPU: Texture: Replace internal sampler state by explicit state object
This makes it easier to track as well as allowing us to sample the same
texture with different sampling parameters (which should fix the related
T73942 in the long run).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7831
2020-06-02 10:47:56 +02:00
074d469165 Merge branch 'blender-v2.83-release' 2020-06-02 18:39:28 +10:00
ae2f21f378 Fix T76533: Gizmo uses active face center in edge selection mode
Only use the active face when it's selected.
2020-06-02 18:38:58 +10:00
ea516bed72 Merge branch 'blender-v2.83-release' 2020-06-02 10:33:26 +02:00
6aef27602a Cleanup: use C++'s nullptr instead of our own C NULL define, in C++ code. 2020-06-02 10:32:21 +02:00
b724922f1a Merge branch 'blender-v2.83-release' 2020-06-02 10:26:14 +02:00
428c0f9ad5 Fix T77192: Crash when opening bunny.blend file.
New depsgraph code handling drivers was not checking for possible NULL
rna_path, as done everywhere else in code...
2020-06-02 10:21:19 +02:00
c6957e50e8 Merge branch 'blender-v2.83-release' 2020-06-02 18:06:31 +10:00
81f817e7b4 Fix T72088: Missing header redraw when transform changes snap 2020-06-02 18:05:00 +10:00
17d8e7f833 Merge branch 'blender-v2.83-release' 2020-06-02 16:24:30 +10:00
de6c935261 Cleanup: code comments for mode switching
Comment on mode switching cases that are supported,
including the issue from recent regression T77217
which is easy to miss since it's not used in the default key-map.
2020-06-02 16:12:36 +10:00
Johan Walles
9c410c77eb UI: rename Cycles point light Size to Radius, for consistency and clarity
Differential Revision: https://developer.blender.org/D7888
2020-06-02 08:08:59 +02:00
59e793d3bd Cycles: add missing light angle for distant lights in XML reading
Contributed by howetuft.

Differential Revision: https://developer.blender.org/D7891
2020-06-02 08:08:52 +02:00
a8907e409a Merge branch 'blender-v2.83-release' 2020-06-02 08:08:43 +02:00
Stefan Werner
c7280ce65b Cycles: Added shadow terminator offset parameter.
A new user parameter can be used to shift the shadow terminator
towards the light source. With it, one can hide some of the
artifacts that appear on coarse meshes with smooth shading.

Note that this technique is not engery conserving.

This is based on the work by the Appleseed renderer team.

Differential Revision: https://developer.blender.org/D7634
2020-06-02 07:27:14 +02:00
7881c251f3 Fix build error in Cycles standalone without guarded allocator
Solution suggested by howetuft.

Differential Revision: https://developer.blender.org/D7892
2020-06-02 06:27:39 +02:00
Garry R. Osgood
389d550412 Fix T77106: Cycles crash baking with AO shader node
Differential Revision: https://developer.blender.org/D7890
2020-06-02 06:25:08 +02:00
18cda8be87 Cycles: change perspective depth pass to be more standard
Now it matches Eevee, OpenGL and other renderers. Panoramic camera depth passes
are unchanged, and are still distance from the camera center.
2020-06-02 04:54:44 +02:00
98c301d25e Fix NaN in Cycles environment texture importance sampling in some scenes
Cause identified by Ray Molenkamp.
2020-06-02 04:54:39 +02:00
f58e76119a Fix T77239: snap 3D cursor in edit-mode 2020-06-02 12:19:35 +10:00
4f3e686cad Cleanup: Remove Obsolete Current Frame Indicator Drawing Code
This code was made obsolete by the changes to the animation editor
scrubbing areas in D4654.

Differential Revision: https://developer.blender.org/D7898
2020-06-01 22:12:09 -04:00
8b63c6241d Fix snap3d crash (missing NULL check) 2020-06-02 10:50:53 +10:00
1d4bae8566 Sculpt: Cloth Filter
This tool is similar to the cloth brush, but it applies the cloth
simulation deformation to the whole mesh in an uniform way. The
simulation can be controlled using the mask to pin vertices and the face
sets to define force action areas.

It uses the same solver as the cloth brush which now no longer depends
on StrokeCache.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7857
2020-06-01 22:37:06 +02:00
3778f168f6 Sculpt: Pose Brush Face Sets FK mode
This Pose Brush origin mode simulates an FK deformation in the entire
model when clicking on the face sets, as they were controls of a fully
rigged character. Combined with the previous Face Sets modes that allow
creating IK chains, the pose brush should now be able to simulate most
of the common rigs deformations.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7839
2020-06-01 22:30:01 +02:00
5c54a609a9 Cleanup: Remove unused flag 2020-06-01 17:20:28 -03:00
91fb07f361 Fix mesh filter using the wrong face set as active
This was returning the wrong face set in cases where the active vertex
has more than one available face set.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7858
2020-06-01 22:18:59 +02:00
3cce8afe2c UI: Rename "View Camera Center" Op to "Frame Camera Bounds"
The current name isn't very specific about what the operator does.
The operation is more about lining up the edges with the viewport
edges than centering the view.

Differential Revision: https://developer.blender.org/D7866
2020-06-01 11:35:16 -04:00
b0038b8d73 Fix T77139: UI: Add "View Camera Center" to View Menu
The "View Camera Center" operator was not accessible by the new menu search.

Differential Revision: https://developer.blender.org/D7865
2020-06-01 11:34:07 -04:00
45dbc38a8b Fix T74552: Distribute negatives in number input
This applies a relatively simple solution for fixing some unintuitive
cases in unit handling.

Currently entering -1m50cm evaluates to -0.5m, and similarly 1'6"
evaulates to just half a foot. So effectively there's an implied + just
between the numbers, which is quite confusing.

This works by adding parentheses so the negative distributes to the
block of values before the next operator.

For example:
|         Before         |           After            |
| `-1m50cm + 1m -2m50cm` | `-(1m50cm) + 1m -(2m50cm)` |
|   `-4m + 0.5 / -1.1`   |   `-(4m) + 0.5 / -(1.1)`   |
|         `-1'6"`        |         `-(1'6")`          |
|        `-1e-2cm`       |        `-(1e-2cm) `        |

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D7813
2020-06-01 08:22:27 -04:00
8d670546f9 Merge branch 'blender-v2.83-release' 2020-06-01 12:12:57 +02:00
31cf87a29e Fix py api doc gen script after recent versionning changes. 2020-06-01 12:10:56 +02:00
19f3f6cd85 Merge branch 'blender-v2.83-release' 2020-06-01 19:00:23 +10:00
c204e3348c Fix T77217: Object mode toggle doesn't work
Toggling object mode to the previous wasn't working, also resolves a
case when toggling modes would cause an extra, unnecessary mode switch.
Own regression in 5159b8e1ea.
2020-06-01 18:56:43 +10:00
9936e23b85 Merge branch 'blender-v2.83-release' 2020-06-01 16:27:23 +10:00
10966926ce Merge branch 'blender-v2.83-release' 2020-06-01 16:27:18 +10:00
520f08aa56 Fix T77241: NDOF navigation doesn't work with the knife tool
Also allow NDOF with loop-cut.
2020-06-01 16:21:30 +10:00
49bd44f5c8 Cleanup: unused variable warning
Also remove unnecessary function return value.
2020-06-01 15:04:47 +10:00
81c33f0ba7 Cleanup: clang-format 2020-06-01 15:04:30 +10:00
c71be9a552 UI: rename "Select Playhead" to "Select -> Side of Current Frame"
Make this consistent with meshes select side of active,
also rename "Under" to "Overlap" as this is confusing since
strips can be considered above/under each other
relative to their channels.
2020-06-01 15:00:25 +10:00
946ae26349 UI: use term current frame instead of playhead
Avoid mixing different terminologies up,
current frame is used in a majority of Blender.
2020-06-01 15:00:25 +10:00
c315e56434 Cleanup: warning 2020-06-01 15:00:25 +10:00
89cd9f110b Fix T77043: Incorrect cache invalidation when changing resolution.
Invalidate cache of scene, not scene strips using said scene.
2020-06-01 06:25:36 +02:00
d4483b6d15 Cleanup: error building on Linux 2020-06-01 14:14:21 +10:00
f18ed7ad89 Fix T67577: Add-on unregister can't access preferences on factory reset 2020-06-01 14:06:55 +10:00
Peter Fog
b5cfb23fa7 VSE UI: Text panel adjustments
This patch adjusts a number of text panel elements:

- The text entry widget has become larger in order to distinguish it from the strip name.
- Wrap has been moved up under the text, since this doesn't relate to bounding box.
- Alignment X/Y has been renamed to Anchor X/Y, since this is the achor point of the text point, and not the Alignment of the text.
- Offset and Crop was completely missing from the Text strip panel, these has been added.

Reviewed By: billreynish

Differential Revision: https://developer.blender.org/D7869
2020-06-01 05:41:09 +02:00
Peter Fog
adf9ff6359 VSE UI: Add a proxy menu to Preview/View menu
Add Proxy Setup, Build and View to a menu in the Preview View menu.

Reviewed By: ISS, billreynish, pablovazquez

Differential Revision: https://developer.blender.org/D7734
2020-06-01 05:32:36 +02:00
Peter Fog
42dcb1090b VSE: Use color picker for color strip.
Reviewed By: billreynish, ISS

Differential Revision: https://developer.blender.org/D6114
2020-06-01 05:17:20 +02:00
Peter Fog
102a7ae2d9 VSE: Add warnings for failed proxy encoding
Add more descriptive warnings if building proxy fails.
Prevent progressbar from showing if no valid strip is selected.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D7689
2020-06-01 05:12:06 +02:00
Peter Fog
95e3356a27 VSE: Add select under playhead, and shortcuts for left, right, under.
Add `UNDER` option for `left_right` property of `sequencer.select` operator.
Add Equal as shortcut for select under playhead, and move Insert Gaps to backspace + ctrl.
Add extend shortcut for left, right under options.
The function is added to Select > Playhead menu.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D7679
2020-06-01 04:39:40 +02:00
d0e028a78e Merge branch 'blender-v2.83-release' 2020-06-01 12:12:06 +10:00
d5a92b188b Cleanup: warnings 2020-06-01 12:06:34 +10:00
fcccee0c33 Cleanup: Remove unnecessary step in calling snap callback 2020-05-31 18:28:52 -03:00
14af27e63d Fix T77194: Force global orientation on select constraint (Shift MMB) not working
This feature was a hack to prevent mmb select to print the orientation from menu in pre 2.80 versions.
Removing this feature as it is no longer an issue.
2020-05-31 18:28:52 -03:00
4cb883b6b2 Deps: Update OIIO + ImageLibs + OSL + Helpers
This is the cluster of OIIO and friends , since they are all kinda tangled best to deal with this as a single unit

OIIO 2.1.15.0
png 1.6.37
jpeg 2.0.4
opencolorio 1.1.1
tiff 4.1.0
OSL 1.10.10
pugixml 1.10
openjpeg 2.3.1

Differential Revision: https://developer.blender.org/D7727
Reviewed by: brecht
2020-05-31 13:15:40 -06:00
6f1056ae63 Deps: iconv 1.16 2020-05-31 10:33:11 -06:00
ba711824b3 Fix T77206: G + MMB Doesn't work in Graph Editor if the transform orientation is set to 'Local'
Scene orientation is used only for 3DView.
2020-05-30 18:11:50 -03:00
347c191292 Remove leftover debugging code 2020-05-30 18:11:50 -03:00
9d725fc0cf Merge branch 'blender-v2.83-release' 2020-05-30 17:33:34 +02:00
ec26260132 GPencil: Fix unreported wrong Sculpt brushes initialization in Templates
The Sculpt brushes were not properly initialized when use 2D template or other templates.

Also, using the default template (not factory settings) could be situations where the brushes were not updated.

This problem was introduced when some versioning code was removed in order to avoid duplicated brush creation.
2020-05-30 17:33:09 +02:00
515e8e4f7c Fix T77166: Transforming bone with constraint does not follow mouse position
Bug introduced in rBc75a665c442e
2020-05-30 12:12:36 -03:00
55598269d2 Cleanup: Deduplicate code 2020-05-30 11:28:53 -03:00
a574478d90 Fix T77183: Axis moves with object when constraint movement and using local transform 2020-05-30 11:10:07 -03:00
3d014fa815 Cleanup: Initialize gizmo snap keymap before using 2020-05-30 10:59:27 -03:00
63bcee81f6 GHOST/wayland: use 'is_dialog' flag to prevent drawing into same window 2020-05-30 12:23:39 +01:00
2ee94c954d Fix LayerTypeInfo for CD_PROP_COL
This was introduced in rBd7282537f016 and had the wrong struct name
specified, leading to errors in writing/saving.

Stumbled over this when testing a color layer for pointclouds.

Differential Revision: https://developer.blender.org/D7882
2020-05-29 20:08:38 +02:00
a9689737b3 Cleanup: Use Consistent Capitalization of "Anti-Aliasing" 2020-05-29 13:57:40 -04:00
664c608fb7 Merge branch 'blender-v2.83-release' 2020-05-29 19:43:32 +02:00
691a1e3357 EEVEE: Fix memory leak when using SSS render pass.
Differential Revision: https://developer.blender.org/D7876
2020-05-29 19:42:53 +02:00
D. O
907cab45ff Modifiers: add invert vgroup weights options to operands of Mix modifier.
Please note that vertices which are in a vgroup are not affected by this
option (which means that affected vertices from 'selection' modes remain
the same). Only the weights of selected vertices get inverted.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7811
2020-05-29 18:55:28 +02:00
c93a88413d Merge branch 'blender-v2.83-release' 2020-05-29 18:05:04 +02:00
Cody Winchester
43853d0528 Fix: Array modifier start cap not updating with object changes
When setting the start cap of the array modifier it does not update when
updating the start cap objects geometry.

This patch switches the property update to rna_Modifier_dependency_update,
the same as the end cap which works properly.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7584
2020-05-29 17:56:42 +02:00
Brecht Van Lommel
a86b5df005 Blender: change bugfix release versioning from a/b/c to .1/.2/.3
The file subversion is no longer used in the Python API or user interface,
and is now internal to Blender.

User interface, Python API and file I/O metadata now use more consistent
formatting for version numbers. Official releases use "2.83.0", "2.83.1",
and releases under development use "2.90.0 Alpha", "2.90.0 Beta".

Some Python add-ons may need to lower the Blender version in bl_info to
(2, 83, 0) or (2, 90, 0) if they used a subversion number higher than 0.
https://wiki.blender.org/wiki/Reference/Release_Notes/2.83/Python_API#Compatibility

This change is in preparation of LTS releases, and also brings us more
in line with semantic versioning.

Fixes T76058.

Differential Revision: https://developer.blender.org/D7748
2020-05-29 17:48:26 +02:00
Peter Fog
67795c90fc VSE: Remove delete confirmation pop-up
It is not needed with the current undo system.

Differential Revision: https://developer.blender.org/D7807
2020-05-29 09:53:52 -04:00
d1bc233ffe Undo: Writefile: fix 'id changed' detected when resorting IDs.
The ListBase next/prev pointers will change everytime you add or rename
an ID, also for 'neighbors' data-blocks in the list, causing unnecessary
'changed' detection.

This info is not needed in blendfile anyway, so just NULLify it.
2020-05-29 14:30:02 +02:00
1d2b89304a Fix T77130: Visually broken/stepped wireframe in object mode (regression)
Create a new shader for the selection fix.

Differential Revision: https://developer.blender.org/D7873
2020-05-29 11:59:40 +02:00
Manuel Castilla
582d3153a1 Fix T73972: Collection in outliner grayed out when all collection children are disabled
There is no reason to have the children enable/disable state to
influence the parent collection. Specially considering that the parent
collection itself can have objects that would be visible.

Reviewed by: dfelinto, brecht

Differential Revision: http://developer.blender.org/D7864
2020-05-29 11:31:49 +02:00
7022c73249 Keymap: remove explicit 3D cursor entry for add tool
Passing through events to place the cursor, as other tools do.
2020-05-29 18:13:44 +10:00
8ec59757d1 Gizmo: fix crash in recent snap gizmo addition 2020-05-29 16:12:44 +10:00
654fde2dd2 PyAPI: use bpy_rna_types_capi.c to set type methods
Remove use of '_bpy' as an intermediate module to store functions
which were then assigned in bpy_types.py.
2020-05-29 15:55:25 +10:00
e115b7b06d PyAPI: support static & class methods for C RNA API methods
Previously the static/class flag was ignored,
always using class methods.
2020-05-29 15:55:20 +10:00
5510d5825b Keymap: swap shift and alt for interactive add tool
Match original proposal.
2020-05-29 13:18:50 +10:00
d1f4adab24 Cleanup: spelling, correct reference to 'Mesh.mcol' 2020-05-29 12:58:29 +10:00
dbdb8a3355 Cleanup: line length, single quote enums, invalid URL 2020-05-29 12:45:46 +10:00
5ec18ae4ab Docs: replace warnings with note for complexity information
Reserve warnings for situations such as corrupt data which can
cause crashes.
2020-05-29 12:42:09 +10:00
2deb6c5177 Fix for T77111: Joins Areas Without Creating Invalid Edges
Properly align every involved edge when performing 'tolerant' area joins.

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

Reviewed by Brecht Van Lommel
2020-05-28 11:34:31 -07:00
Peter Fog
1be79dc2a0 VSE UI: Add buttons for swap Effect strip inputs
The feature where the active strip determines what strip will be the
first input in effect strips can be quite a puzzle for users.
The operator to swap the inputs is hidden in the Strip menu.

This adds the swapping to the Effect sidebar panel.

Differential Revision: https://developer.blender.org/D7849
2020-05-28 14:17:22 -04:00
Peter Fog
155cd03599 VSE UI: Move Scene strip and Mask strip above Adjustment in Sidebar
This is consistent with the other strip specific properties.

Differential Revision: https://developer.blender.org/D7677
2020-05-28 12:53:06 -04:00
Peter Fog
b8bcbaaf0e VSE UI: Rename Scene Strip Panel and Move View Panel Up
- Rename "Scene Preview/Render" to "Scene Strip Display",
   since this relates to Scene Strips.
 - Move the "Scene Strip Display" down, so the view settings are on top.

Differential Revision: https://developer.blender.org/D7676
2020-05-28 12:42:44 -04:00
Peter Fog
82cbf93f20 VSE UI: Group Show Elements in View Menu, Use Consistent Naming
Use the "Show..." syntax for Show elements in View menu.

Differential Revision: https://developer.blender.org/D7344
2020-05-28 12:23:11 -04:00
Peter Fog
6cbb56418f VSE UI: rename Trim Offset to Slip Offset
The operator was at some point renamed from Trim to Slip,
but not yet in the header text.

Differential Revision: https://developer.blender.org/D7712
2020-05-28 12:15:41 -04:00
Peter Fog
a099478cad UI: Use Heading to Remove Text strip Shadow Subpanel
The new "heading=" option allows for a more simple way to expose the
Text strip Shadow operator.

Differential Revision: https://developer.blender.org/D7535
2020-05-28 12:11:53 -04:00
3923062d13 Cleanup: GPU: Fix warning 2020-05-28 14:04:52 +02:00
a9073ccb68 Merge branch 'blender-v2.83-release' 2020-05-28 13:43:57 +02:00
ff1040c6fe GPencil: Reduce aliasing for subpixel lines 2020-05-28 13:42:39 +02:00
59b730b643 GPU: Fix compilation warning about uninitialized values 2020-05-28 13:42:11 +02:00
c7a7dc743d Cleanup: DRW: Remove array suffix from uniform name 2020-05-28 13:42:11 +02:00
bf690ecd39 DRW: Add DRW_shgroup_uniform_vec4_array_copy 2020-05-28 13:42:11 +02:00
68d6b73fde Readfile: move all calls to 'id_us_ensure_real' to direct_link functions.
That kind of 'own' ID management has really nothing to do in lib_link
code.
2020-05-28 12:13:16 +02:00
1335f2d272 Fix T65889: Hair Particles not updating when using image sequence 2020-05-28 10:47:01 +02:00
806db47fd8 Depsgraoh: Fix missing texture node allocation
It was causing wrong binding for image animation: since there was no
ID node for texture at the moment of build_animdata original texture
ID was passed to the callback. This is not what is supposed to happen.

This is part of fix for T65889.
2020-05-28 10:47:01 +02:00
3d2f143000 Cleanup: remove unused struct members from RenderStats 2020-05-28 16:57:19 +10:00
4ddb7a33a4 Cleanup: spelling 2020-05-28 16:42:31 +10:00
5c8ccad652 Fix cone primitive creating duplicate vertices
Using remove double wasn't reliable as the matrix argument
could cause vertices to be further apart than the threshold allowed for.

This happened when adding cones using the new add tool.
2020-05-28 16:17:00 +10:00
122cb1aea8 Object: new add object tool, currently for primitive types
- Interactively adding primitives with two clicks.
- Scene orientation used for new objects.
- Depth [view-plane, axis-plane, surface]
- Origin [base, center]
- Primitive types [cube, cylinder, cone, uv-sphere, ico-sphere ]
- Settings for object types in the top-bar.

Shortcuts:

- Snapping (Ctrl).
- Constrain 1:1 aspect (Shift).
- Toggle center (Alt).

Part of T57210 design task.
2020-05-28 15:08:58 +10:00
16943c0146 Object: add scale argument to creation operators
Needed for to create objects of a specific size.
2020-05-28 14:34:00 +10:00
d35a33ef72 Gizmo: add flag for gizmos to ignore keymap events
Needed for the snap gizmo not to steal mouse events from the tool.
2020-05-28 14:34:00 +10:00
cdcbcca25e Cleanup: missing braces warning 2020-05-28 14:34:00 +10:00
d7282537f0 CD_PROP_COL datalayer
This implements a generic color datalayer and its functions. Based on
D5975.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7838
2020-05-27 20:04:46 +02:00
80d6421f28 Ruler: Remove highlight hack 2020-05-27 14:27:37 -03:00
0b793514fa Cleanup: Use bitmaps insteand of bool and char arrays
This was propsed in D7059, so I applied it to the rest of the code

Reviewed By: campbellbarton, sergey

Differential Revision: https://developer.blender.org/D7480
2020-05-27 18:36:05 +02:00
79e529c5ec Fix T77109: Cycles viewport render crash after object add and undo 2020-05-27 18:03:17 +02:00
7e80aa7ca6 Update the default Face Set when creating Face Sets from visible
If all vertices in the sculpt are visible create the new face set and
update the default face set. This is the same as disabling the overlay,
so it will not have the extra performance cost of rendering a colored
face set twice that gives no information.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7530
2020-05-27 17:35:54 +02:00
735119dd0f Fix T75096: Crash when using liquid simulation as dynamic paint brush
Reviewers: sergey

Differential Revision: https://developer.blender.org/D7853
2020-05-27 16:15:06 +02:00
49c295813b Merge branch 'blender-v2.83-release' 2020-05-27 15:31:03 +02:00
28d9368538 Fix T76947: Optix realtime denoiser progressively reduces brightness of very bright objects
The input data to the OptiX denoiser was clamped to 0..10000 as required, but it could easily
exceed that range with a high number of samples (since the data contains the overall sum). To
fix that, divide by the number of samples first and multiply it back in after the denoiser ran.
2020-05-27 15:17:47 +02:00
efa4ae17f0 OpenSubdiv: Only store edges topology for non-smooth edges
This change makes it so vertices of edge are only stored when edge
has non-zero crease. This allows to lower memory footprint of 1.5M
faces from 78 MiB to 54 MiB in the case all creases are zero.

Meshes with crease are more hard to predict due to array-based
storage, so it all depends on index of edge with crease. Worst case
(all edges are creased) still stays at 78 MiB.
2020-05-27 12:07:16 +02:00
8cd17a9529 OpenSubdiv: Allow any order of edge topology/sharpness assignment
Makes it possible to set adjacent vertices after edge sharpness.

Initially it seemed like useful sanity check, but with time it
became rather a burden.
2020-05-27 12:07:16 +02:00
42cb1e3a2c OpenSubdiv: Optimize faces storage in mesh topology
Avoid per-face pointer and allocation: store everything as continuous
arrays.

Memory footprint for 1.5M faces:

- Theoretical worst case (all vertices and edges have crease) memory
  goes down from 114 MiB to 96 MiB (15% improvement).

  This case is not currently achievable since Blender does not expose
  vertex crease yet.

- Current real life worst case (all edges have crease) memory goes
  down from 108 MiB to 90 MiB (17% improvement).

- Best case (no creases at all) memory goes down from 96 MiB to 78 MiB
  (19% improvement).
2020-05-27 12:07:16 +02:00
c971731b8f OpenSubdiv: Add regression tests for mesh topology
While this looks trivial it already allowed to catch issues in one
of previous attempt to optimize memory usage. It will totally be
useful for an upcoming refactor of face topology storage.
2020-05-27 12:07:16 +02:00
38b50fe393 OpenSubdiv: Hide individual topology elements
Move all API to happen via MeshTopology.

This is a preparation for an upcoming memory optimization.
2020-05-27 12:07:16 +02:00
15bcfc5b19 OpenSubdiv: Cleanup, remove unused code
There is no need in edge map anymore.
2020-05-27 12:07:16 +02:00
12c42738f3 OpenSubdiv: Add TODO avoid checking face-varying topology for equality 2020-05-27 12:07:16 +02:00
8e9fdd2f31 OpenSubdiv: Move preliminary geometry counters check to mesh topology 2020-05-27 12:07:16 +02:00
a444400900 OpenSubdiv: Keep explicit storage of base mesh faces
Allows to perform comparison by doing linear comparison of indices.

Before cyclic match was used to deal with possibly changed winding from
OpenSubdiv side.

Speeds up comparison (and hence improves FPS), makes code more reliable
nut uses more memory.
2020-05-27 12:07:16 +02:00
1e0de7c2ea OpenSubdiv: Compare edge topology
This change makes it so topology refiner comparison will check vertices
of all existing/provided edges.

The initial claim that due to manifold nature of mesh there is no need
in "deep" edges check was wrong: some areas might only provide edges
with non-zero creases. So if crease of one edge goes changes from 1.0
to 0.0 and crease of other edge goes from 0.0 to 1.0 the old comparison
code would not have caught it.
2020-05-27 12:07:16 +02:00
6a8193e505 OpenSubdiv: Refactor, move mesh topology comparison to own file
Makes it easier to follow and extend.
2020-05-27 12:07:16 +02:00
ece54172d0 OpenSubdiv: Use explicit storage for edge sharpness
Similar to previous change in vertex sharpness, explicitly store value
provided by the converter.

Allows to avoid rather fragile check for boundary edges.

Also allows to avoid need in constructing edge map. This lowers memory
footprint of the comparison process and avoids memory allocations
during the comparison (which is an extra benefit from the performance
point of view).
2020-05-27 12:07:16 +02:00
16aef5dc4a OpenSubdiv: Allow use of regular ordered map 2020-05-27 12:07:16 +02:00
ad4cef38e3 OpenSubdiv: Refactor, move comparison to own file 2020-05-27 12:07:16 +02:00
614d70a87d OpenSubdiv: Compare sharpness based on converter
This change starts the transition of topology refiner comparison
to compare actual values given by the converter, which will not be
affected by the refinement or face winding synchronization steps.

Currently is only implemented for vertex sharpness, but will be
extended further as followup development.

Fixes T71908: Subdiv: Incorrect topology comparison, leading to poor performance
2020-05-27 12:07:16 +02:00
717d968fb9 OpenSubdiv: Add explicit storage for mesh topology
The idea is to use this explicit storage for topology comparison rather
than using base level. While this will have memory overhead it allows
to simplify comparison of such things as:

- Vertex sharpness (where base level from topology refiner will have it
  refined, meaning it will be different from what application requested
  for non-manifold and corner vertices).

- It will allow to simplify face-vertices comparison, where currently
  O(N^2) algorithm is used due to possible difference in face winding.

- It will also allow to avoid comparison-time allocation of edge map.

Currently no functional changes, just preparing for development which
will happen next.
2020-05-27 12:07:16 +02:00
5d8515ed86 OpenSubdiv: Add move semantic to the namespace 2020-05-27 12:07:16 +02:00
b5ef644ef6 OpenSubdiv: Refactor, pass higher level object through comparison 2020-05-27 12:07:16 +02:00
444ca1a117 OpenSubdiv: Refactor, move utils to base
Also split them across utilities and types.
2020-05-27 12:07:16 +02:00
39cf673132 OpenSubdiv: Refactor, move base C-API file to base folder 2020-05-27 12:07:16 +02:00
98197343e8 OpenSubdiv: Cleanup, use C++ range based loop
Avoid indirection via define.
2020-05-27 12:07:16 +02:00
be03a756e5 OpenSubdiv: Cleanup, move utility function to base type conversion 2020-05-27 12:07:16 +02:00
0ff665e4ce OpenSubdiv: Refactor, move type conversion to base fodler 2020-05-27 12:07:16 +02:00
4886a704b3 OpenSubdiv: Refactor, move evaluator to own folder 2020-05-27 12:07:16 +02:00
6fc9d106ad OpenSubdiv: Completely disable topology verification
Previously it was enabled for debug builds, now it is to be enabled
explicitly.

The reason for this is to reduce overhead when debugging other areas
which might involve subdivision surface. When conversion is to be
debugged set this manually in the code.
2020-05-27 12:07:16 +02:00
0d089ce881 OpenSubdiv: Refactor, move edge map to base folder 2020-05-27 12:07:16 +02:00
4ab36c4393 OpenSubdiv: Refactor creation of topology refiner
Consolidate it inside of the topology refiner implementation class,
which would allow to store extra data acquired during construction
of the OpenSubdiv's object.
2020-05-27 12:07:15 +02:00
57aae2a355 OpenSubdiv: Refactor, use C++ allocation for internal classes
Only use OBJECT_GUARDED_{NEW. DELETE} for structures which are part of
public C-API (and hence can not have new/delete operators overloaded).

Could try being brave and override new/delete from under C++ ifdef.
2020-05-27 12:07:15 +02:00
c81a5f58f8 OpenSubdiv: Refactor, move topology refiner factory to topology folder 2020-05-27 12:07:15 +02:00
67fe31d751 OpenSubdiv: Refactor, move topology refiner to own folder
In the future factory will also be moved there.
2020-05-27 12:07:15 +02:00
7c0bea0d65 OpenSubdiv: Refactor, move device specific code to own files
Also, move all device files to own folder.

Makes it so checks for device availability are done in a localized
place.
2020-05-27 12:07:15 +02:00
Konrad Puklicki
e490dc4346 UI: Skip unnecessary cursor setting
Currently, in sculpting, weight paint and vertex paint modes every cursor
movement triggers redraw of a brush. During that redraw, native cursor is set.
Under the hood, setting the cursor causes freeing of previous cursor and
allocating a new one. In most cases, in previously mentioned modes, recreating
cursor is unnecessary since cursor stays the same.

This patch adds a check which skips cursor change if requested cursor is
already set. The check could be added in pain_cursor.c, but I felt adding it
inside WM_cursor_set function would hopefully skip more unnecessary cursor
reallocations.

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

Reviewed by: Julian Eisel
2020-05-27 12:06:35 +02:00
bab5fbb66c Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-27 12:01:04 +02:00
1c3b2b5dd8 Fix T77105: Crashes when clicking "new scene" button
This was introduced on ecc395e473.

Effectively this is reverting that commit for cases when
scene->toolsettings->sculpt is NULL. But since the facesets are only
working for sculpting this should be fine.
2020-05-27 12:00:00 +02:00
Stefan Werner
ecc15c55d4 Cycles: Upgraded Embree to version 3.10.0
Enabled round linear hair in Embree.

Differential Revision: https://developer.blender.org/D7623
2020-05-27 10:10:18 +02:00
7836242065 Cleanup: remove unused Main struct from snap context 2020-05-27 16:54:34 +10:00
355d129965 Gizmo: lazy initialize snap context
ED_gizmotypes_snap_3d_context_get could have returned NULL,
rename _get(..) to _ensure(..) and initialize the snap context
in this function.
2020-05-27 16:47:30 +10:00
1f7a791a53 Ruler: Implement Snap Gizmo
The snap point can now be viewed when activating the tool.
2020-05-27 00:16:32 -03:00
2e73e1390e Gizmo Library: New Snap Gizmo
Generic snap gizmo to be used for different tools.

The Gizmo can be configured initially by the following properties:
- `"snap_elements_force"`, `"prev_point"`

The following properties can be read as return:
- `"location"`, `"normal"`, `"snap_elem_index"`

This property can be linked to another (tool_setting.snap_elements):
- `"snap_elements"`

And this 3 extra utilities have been added:
- `ED_gizmotypes_snap_3d_draw_util`,
- `ED_gizmotypes_snap_3d_context_get`,
- `ED_gizmotypes_snap_3d_update`.

Differential Revision: https://developer.blender.org/D7071
2020-05-27 00:14:11 -03:00
7ed7901c00 Gizmo: add flag to disable tooltip
For some gizmos that follow the mouse cursor, this gets in the way.
2020-05-27 12:24:29 +10:00
43af0f4d16 Cleanup: pass const wm for WM_keymap_active 2020-05-27 12:09:52 +10:00
6c1cf395f2 Cleanup: remove unnecessary copy constructor
Caused deprecated-copy warnings as it wasn't used.
2020-05-27 11:50:54 +10:00
a739dc67ef Cleanup: sort file, structs 2020-05-27 10:52:07 +10:00
e5458fa4e5 Cleanup: warning 2020-05-27 10:52:00 +10:00
a8551f93e6 Merge branch 'blender-v2.83-release' 2020-05-26 16:52:15 -06:00
f772a4b8fa Fix: A few missing outliner selection sync tags
Add selection syncing for object add named (e.g. drag and drop from
outliner to 3D view), outliner right click (a sync when the context menu
is cancelled), and for object selection from Python.
2020-05-26 16:42:21 -06:00
eb5422828a Cleanup: Quiet unused variable warning in non-debug builds 2020-05-26 16:02:08 -04:00
5171d86806 UI: List Panel System
This implements a general system to implement drag and drop, subpanels,
and UI animation for the stack UIs in Blender. There are NO functional
changes in this patch, but it makes it relatively trivial to implement
these features for stacks.

The biggest complication to using panels to implement the UI for lists
is that there can be multiple modifiers of the same type. Currently there
is an assumed 1 to 1 relationship between every panel and its type, but
there can be multiple list items of the same type, so we have to break
this relationship. The mapping between panels and their data is stored
with an index in the panel's runtime struct.

To make use the system for a list like modifiers, four components
must be added:
1. A panel type defined and registered for each list data type, with a
    known mapping between list data types and panel idnames.
1. A function called by interface code to build the add the panel
    layouts with the provided helper functions.
    - UI_panel_list_matches_data will check if the panel list needs to
      be rebuilt.
    - UI_panels_free_instanced will remove the existing list panels
    - UI_panel_add_instanced adds a list panel of a given type.
3. An expand flag for the list data and implementations of
    get_list_data_expand_flag and set_list_data_expand_flag.
4. For reordering, the panel type's reorder callback. This is called
   when the instanced panels are drag-dropped. This requires
   implementing a "move to index" operator for the list data.

Reviewed By: Severin, brecht

Differential Revision: https://developer.blender.org/D7490
2020-05-26 15:39:49 -04:00
Cody Winchester
de257b6366 Modifiers: Add normalize weights option to vertex weight modifiers
Original patch by Cody Winchester (@CodyWinch), several fixes and
cleanup by Bastien Montagne (@mont29).

Differential revision: https://developer.blender.org/D7656
2020-05-26 20:56:27 +02:00
00674c12cc Merge branch 'blender-v2.83-release' 2020-05-26 20:49:53 +02:00
18f33f293b Fix Cloth Brush grab deformation mode
The grab mode was not correctly implemented, so the way it was working
was confusing for users.
- Grab delta was calculated in increments from the last stroke position, so it did not match the behavior of a grab brush. I refactored the grab delta calculation to make this change more explicit.
- Grab displacement was not calculated from the original coordinates
- Grab was using an incorrect strength

Grab is now setting the position of the affected vertices directly and
the constraints solve the rest of the cloth. I also tried to implement
an alternative version based on applying forces to move the vertices to
the grab position, but I think this is more controllable and the grab
falloff can be adjusted by tweaking the simulation falloff.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7756
2020-05-26 20:48:46 +02:00
9aea7dc7c6 Fix Pose Brush origin position with large brush size
When the brush size is bigger than the entire mesh, fdata.tot_co can be
0, so the pose origin will default to (0,0,0), which does not make much
sense. After this patch, the pose origin will be set to the farthest
vertex from the pose origin, which at least should be in the surface of
the mesh and in most cases in the direction the pose brush was already
detecting the origin.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7773
2020-05-26 20:45:20 +02:00
9b0f65c4a6 Fix naming in the PBVH neighbor iterator macro
The only possible name for the iterator was ni, this should fix that.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7774
2020-05-26 20:43:14 +02:00
5f63344e84 Fix PBVH API returning wrong normal when using shape keys and modifiers
The implementation of this function should match the one in
SCULPT_vertex_co_get. This does not solve the issue when sculpting with
modifiers active but I think this code is wrong

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D7805
2020-05-26 20:40:27 +02:00
a2baf50242 Cleanup/refactor: Workspace API, boilerplate code, early exit
* Simplify workspace API a bit
* Comment on behavior of workspace-layout relations where exposed in API
* Remove annoying getters/setters
* Avoid lookups if we can early exit
* A NULL check is removed in `direct_link_workspace()` that I don't see
  a need for. Am not 100% sure though, fingers crossed.

In general these changes should improve readability and make things
easier to reason about.
2020-05-26 20:32:21 +02:00
1f223b9a1f UI: Windows Shell Links & Improved Mac Aliases
Adds support for Windows Shell Links (shortcuts) to the File Browser. Extended Mac Alias usage. Better visualization of linked items.

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

Reviewed by Campbell Barton
2020-05-26 08:15:50 -07:00
78eae89c39 Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-26 16:44:35 +02:00
a1c9d42584 Fix T77021: Alembic export of animated mesh with multiple UV maps fails
This was caused by a side-effect of our exporting code's memory
management (Alembic considers data "written" and "final" when its C++
objects go out of scope) in combination with my change in
rB65574463fa2d. I removed an "only export UVs on the first frame" clause
because it was unclear why this restriction was there. As it turns out,
it breaks the export of the 2nd and subsequent UV maps on an animated
mesh. Effectively, on every frame the Alembic library thought we want to
create a new UV map, instead of continuing to write a new frame of data
to the existing one.

This is resolved by keeping a reference to the C++ objects for the UV
maps in memory while the exporter is running.
2020-05-26 16:42:01 +02:00
4102e7ed81 Fix T77032: Crash when creating GPUOffscreen without GPUContext in Python 2020-05-26 11:38:19 -03:00
d8733539b7 Merge branch 'blender-v2.83-release' 2020-05-26 16:26:16 +02:00
f3cf29ac96 Fix T77074: Collections: Exclude From ViewLayer toggle crashes
Consider this a bandaid fix (similar to rBe2724abc22d5).

Real issue seems to be that object is still in OB_MODE_PARTICLE_EDIT
whereas it should be in OB_MODE_OBJECT after toggling 'Exclude From
ViewLayer'. So while this patch prevents the crash, it leaves the object
in a weird state (it cannot be selected for example), needs further
investigation.

Maniphest Tasks: T77074

Differential Revision: https://developer.blender.org/D7843
2020-05-26 16:22:41 +02:00
4114e89020 Fix overlapping tabs placement when used in right Top-bar split
Didn't respect alignment rules for split layouts.

Reported in T77075.
2020-05-26 15:42:50 +02:00
14b1c55e11 Cleanup: Remove uneeded NULL checks on ed_screen_context
view_layer should never be NULL.
2020-05-26 15:08:45 +02:00
299682bde7 Merge branch 'blender-v2.83-release' 2020-05-26 15:04:17 +02:00
d3275178fe Fix T77082: Greasepencil error accessing material dropdown on an object without materials
Differential Revision: https://developer.blender.org/D7841
2020-05-26 14:55:37 +02:00
35bd596876 Merge branch 'blender-v2.83-release' 2020-05-26 14:53:19 +02:00
2299f6b5a7 Fix T77049: VSE Image cache is not refreshed when strip are muted/
unmuted in metastrip

Maniphest Tasks: T77049

Differential Revision: https://developer.blender.org/D7834
2020-05-26 14:49:19 +02:00
e790f1a8dc Merge branch 'blender-v2.83-release' 2020-05-26 14:24:50 +02:00
23520cbd13 Cleanup: Avoid mixing unlink-operator and menu name for ID-templates
The context menu name for `UILayout.template_ID_tabs()` would be passed
through multiple functions as `unlinkop`.
2020-05-26 13:28:21 +02:00
2a692e05c8 Fix T77075: Crash omitting optional UILayout.template_ID_tabs parameter 2020-05-26 12:56:53 +02:00
13e17cbd47 Cleanup: remove unused includes from lib_query.c 2020-05-26 12:33:28 +02:00
b44c3ac1e9 Fix/Cleanup: Move some animdata versioning code out of liblinking process.
This was propably added way before we had the after-lib-link versionning
code, but now doing that sort of fixes at liblink time is bad.
2020-05-26 12:33:28 +02:00
4835a09bb1 Cleanup: Create afterliblink doversion for 2.90... and move relevant code there.
Seriously... Please comply with design and do not add 2.9x versionning
code to 2.8x versioning functions!
2020-05-26 12:33:28 +02:00
13b10ab852 Fix/refactor foreach_id handling of animdata.
Now callbacks for animdata, nla strip and fcurve are in their own proper
BKE files (mimicking `foreach_id` callback of `IDTypeInfo`).

This commit also fixes some missing handling of ID pointers (text ID and
IDProperties of script fcurve modifier...).
2020-05-26 12:33:28 +02:00
fc2bb44e94 Fix T68209: Crash opening pre 2.8 file with maximized area
Versioning for workspaces didn't update the map used to determine which
layout is active for a workspace in a specific window. Library code now
called the function to make a workspace active (even if it already was
active), which would also use this map to determine the active layout --
the wrong one.

Error in initial workspace integration, but only uncovered recently.
Likely through 0d8a8ce03b.
2020-05-26 12:19:27 +02:00
5a1ab3e9ae Fix T77067: GPencil Object without materials cannot use Vertex Color mode 2020-05-26 12:13:25 +02:00
825d5c9992 Fix T76522: Grease Pencil transform fill and Adjust Last Operation panel issue
The exec method was totally wrong and also the UI panel was not logic. 

Also changes to make the transformation smoother and the code more simple.

Reviewed By: lichtwerk, mendio

Maniphest Tasks: T76522

Differential Revision: https://developer.blender.org/D7741
2020-05-26 11:22:32 +02:00
2dd6d0ce4b Fix T76926: Crash with Full Screen file browser window preference
Alternative fix for T75292 & T73579 (see b75ce05c3b), that does not
cause this crash.

The crash happened because cancelling the file browser removes its
screen (as in bScreen). Before rBb75ce05c3b0f, the file browser event
wouldn't be handled any further then. After it, it would still be passed
to other areas, while the screen pointer was dangling.
Now the event is only skipped for UI handlers.

Reviewed by: Julian Eisel
2020-05-26 10:38:46 +02:00
49f59092e7 Curves: Implement Handles for selected points only
When editing a complex curve is very annoying to have all handles at a time. Also, this is a requirement for the current GSoC Edit Grease Pencil using curves.
I have seen that this improvement can be used in any other area of blender, so I have decided to publish the option in the overlay panel..

Reviewed By: fclem, #user_interface, billreynish, Severin

Differential Revision: https://developer.blender.org/D7754
2020-05-26 10:37:47 +02:00
ecc395e473 Fix T76902: face sets checkbox broken
Due to recent changes the face sets checkbox broke. The cause is that
{7d38f5036794} changed the responsibility of drawing and updating sculpt GPU
buffers to fix render glitches.

This patch moves the checkboxes evaluation to the overlay engine.
2020-05-26 08:48:57 +02:00
77fdd189e4 Fix T76970: Unneccessary update calls viewport
Due to recent changes clicks in the node editor would trigger a
depsgraph update resulting in too many redraws. This patch limits
the updates to when workbench shown in texture mode in any visible
screen.

There are still cases where too many updates are created. For example when
there are a Cycles render viewport and a Workbench texture viewport on the
same screen.

This fix is meant as a workaround. The actual fix should add a mechanism
to the depsgraph and the viewports should check if they need to be redrawn.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7830
2020-05-26 08:29:24 +02:00
495a98d623 BLI_assert: prevent abort from suppressing return-type warning
Recent commit deaff945d0 broke release builds but not debug builds,
with this change the warning happens in both cases.
2020-05-26 13:40:21 +10:00
4e8693ffcd Improved Area Border Selection and Dragging
Allow use of the full width of visible borders when dragging to resize areas.

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

Reviewed by Brecht Van Lommel
2020-05-25 16:29:21 -07:00
5254ffa17b Fix T77051: IC keymap hotkey conflict in mode switching with GP object 2020-05-25 21:50:07 +02:00
39aa122a0e DRW: Selection: Extend small object selection workaround to all overlays
Fix T77015 box select doesnt select cameras when zoomed out, lasso and circle select do work.
2020-05-25 19:35:07 +02:00
4a9a8611f2 Fix T72121: Measurements are being drawn incorrectly if one end is off screen
The solution is to distribute the drawing for part to be done in 3d
(dashed lines, arc) and another part in 2d (text and caps).

Ref T72121

Reviewed By: fclem

Maniphest Tasks: T72121

Differential Revision: https://developer.blender.org/D6361
2020-05-25 19:17:59 +02:00
4464a9425b Calculate epsilon values for interp_weights_poly to improve accuracy
interp_weights_poly_v2 would have too large epsilon values for small
polygons. To solve this we now calculate the appropriate epsilon value
so it can gracefully handle big and small values.

To make sure there was no regression, these changes were tested with the
files in T36105, T31581. Also with a surface deform modifier test file
attached in the differential below.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D7772
2020-05-25 18:59:14 +02:00
c19cc7ef81 GPUTexture: Make GPU_texture_clear workaround fast.
This way we have a convenient way to clear individual textures.
2020-05-25 18:37:44 +02:00
6fbeded285 Fix T76926: Crash with Full Screen file browser window preference
Alternative fix for T75292 & T73579 (see b75ce05c3b), that does not
cause this crash.

The crash happened because cancelling the file browser removes its
screen (as in bScreen). Before rBb75ce05c3b0f, the file browser event
wouldn't be handled any further then. After it, it would still be passed
to other areas, while the screen pointer was dangling.
Now the event is only skipped for UI handlers.

Reviewed by: Julian Eisel
2020-05-25 18:33:12 +02:00
31cb4133b9 Fix T77009: texture baking crash on Windows
Only happens in master, but DynamicArray implementation is wrong also in 2.83.
Thanks to Jesse Y and Ray Molenkamp for investigating.
2020-05-25 18:17:30 +02:00
52c356c199 Cleanup wrong format specifier in a debug printf. 2020-05-25 17:49:58 +02:00
396bf6ca78 Fix T73164: Undo does not always properly clear no-more-used library data.
Solution is actually very simple, and even makes existing code simpler:
just write all lib IDs when storing and undo step. That way we do not
have to guess which indirectly used library should be kept or not after
an undo step reading.
2020-05-25 17:44:27 +02:00
6d4dc22e17 Sculpt: Pose Brush Scale/Transform deform mode
This is an alternative deformation brush for the Pose Brush intended
quickly change the proportions of the mesh. The regular mode scales
using the segment's origin as a pivot. The inverted mode drags the
entire segment using the grab delta.

The only difference with the regular pose brush is that it is not
compatible with IK, so the option is disabled and set to 1 segment. The
rest of the options should work as expected.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7374
2020-05-25 17:35:39 +02:00
28d81f7b24 Fix T76957: Rigid body "Animated" text cutoff
Removes the flow layout from the panel. No reason to use that here,
surrounding code doesn't either. Probably an unintentional left-over.
2020-05-25 17:26:22 +02:00
9f1f7ba2bb Fix T76925: more Cycles OpenCL compile errors with some drivers on Linux 2020-05-25 17:06:10 +02:00
f53ae843b3 Fix T76267: Stencil texture with negative scale dissapears after
clicking Image Aspect

Calculate with positive areas here and ensure stencil_dimension stays
positive.

Maniphest Tasks: T76267

Differential Revision: https://developer.blender.org/D7821
2020-05-25 16:57:36 +02:00
ce0db0d329 UI: Fix T76918: 3D Mouse Inconsistent / Inaccessible UI
This consolidates the UI code for NDOF input settings, making all
settings accessible from the preferences. This works around an issue
where the Space Navigator's "Menu" button doesn't trigger the settings
menu in Blender.

I also took the opportunity to redo the UI layout.

Note: Separate commit for 2.83 because UI layouts features
have diverged.

Differential Revision: https://developer.blender.org/D7806
2020-05-25 10:53:17 -04:00
2ba3214a21 UI/Physics: Show error enabling Rigid Body if compiled without Bullet
Would just silently fail, which is confusing.
Should only impact custom builds.
2020-05-25 16:49:18 +02:00
7a51eb5340 Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-25 16:37:43 +02:00
219ce574b5 Revert "UI: View3D Cursor Changes"
This change is yet to be followed by a more comprehensive design
proposal including:

* How to differentiate the modes apart.
* More clear definition of tools and the rules for their components (gizmo, cursor).
* Selection as a non-tool vs drag option.

This can be revisited for 2.90 with more time. For now the UI team
agrees to revert this.

--
This reverts commit 4aa703aa14.
2020-05-25 16:28:55 +02:00
1b06d5742e Fix building after rBdeaff945d0b9... sic. 2020-05-25 16:07:37 +02:00
ec0ba8e3b5 VR: Fix big performance bottleneck for simple scenes
Blender's main loop puts the main thread to sleep for 5ms if no user input was
received from the OS. We never want that to happen while the VR session is
running, which runs on the main thread too.

For simpler scenes, where the viewport already draws fast, this may have quite
some impact. E.g. in my tests, the classroom scene went from ~55 to quite
stable 90 FPS in solid mode (total render time as measured and averaged by
Windows Mixed Reality utilities). With Eevee, it only went from 41 to 47 FPS.
In complex files, there's barely a difference. E.g. less than 1 FPS increase in
a Spring file (both Solid mode and Eevee).
2020-05-25 15:52:24 +02:00
026eba8523 Fix T76941: "Set Inverse" in Child Of constraint broken with armatures
When the Child Of constraint is owned by a bone, before the constraint is
run the matrix is converted from world to pose space. However, setting the
inverse should also take the armature object's transform into account.
2020-05-25 15:46:08 +02:00
8b849f39e8 Merge branch 'blender-v2.83-release'
Conflicts:
	source/blender/blenkernel/intern/lib_id.c
2020-05-25 15:43:54 +02:00
849f5bee19 Cleanup: ID makelocal code: remove useless and confusing debug code.
Thing is, user code should not have the responsibility to check that
libquery is valid. Such checks are only source of confusion and errors
as nobody will think about finding and updating them in some obscure
specific area of the code...
2020-05-25 15:38:36 +02:00
b01d2ea72a Libquery: Refactor: add bmain to data passed to callback.
No reason to enforce defining own callback user data for something that
controlling has already available...
2020-05-25 15:28:15 +02:00
e0ff032711 Fix T76997: bad handling of embedded IDs in partial append.
Code dealing with embedded data was pre-existing proper generic
handling of those by `BKE_library_foreach_ID_link()` - and was never
updated for scene's master collection it would seem...

Note that such fix/refactor is a bit risky at this point in the release
cycle, but on the other end previous situation was really broken. So
finger crossed. :|
2020-05-25 15:28:15 +02:00
7a37db6125 Fix T76997: bad handling of embedded IDs in partial append.
Code dealing with embedded data was pre-existing proper generic
handling of those by `BKE_library_foreach_ID_link()` - and was never
updated for scene's master collection it would seem...

Note that such fix/refactor is a bit risky at this point in the release
cycle, but on the other end previous situation was really broken. So
finger crossed. :|
2020-05-25 15:11:36 +02:00
deaff945d0 Mesh: skip conversion from edit-mesh to mesh in edit-mode
This resolves a performance regression in 2.8x where every edit-mode
update performed an edit-mesh to mesh conversion.

Now the conversion will be lazily initialized if/when it's required.

New BKE_mesh_wrapper_* functions abstract over mesh data access.
Currently only edit-mesh and regular meshes are supported.
In the future sub-surface meshes may be supported too.
2020-05-25 23:07:30 +10:00
df8cbdc696 Merge branch 'blender-v2.83-release' 2020-05-25 14:10:20 +02:00
a8a6b3627a Fix autokeyframing masks not updating properly
Spotted while looking into T76872

Maniphest Tasks: T76872

Differential Revision: https://developer.blender.org/D7786
2020-05-25 13:56:49 +02:00
0270941b70 Merge branch 'blender-v2.83-release' 2020-05-25 21:43:54 +10:00
7e9480b6cd Tests: correct the blender path for non-portable installations 2020-05-25 21:28:03 +10:00
dc3f404a70 Cleanup: unused variable warnings 2020-05-25 21:03:45 +10:00
3c40d2485f Merge branch 'blender-v2.83-release' 2020-05-25 21:01:38 +10:00
1a60aba46f Merge branch 'blender-v2.83-release' 2020-05-25 21:01:34 +10:00
d65f60764b GTest: BLI_ghash_performance_test was failing
Change the seed from 0 to 1, so BLI_ghash_performance_test doesn't
assert with duplicate keys.
2020-05-25 20:52:10 +10:00
baa1886791 Fix T76990: Crash shortest path select with 'face stepping' when no faces.
Note that this sometimes gives no solution when there is a mix of edges
with and without faces... But at leat this should be safe fix.
2020-05-25 12:44:10 +02:00
9ef272bae3 Task: Graph Flow Task Scheduling
Add TBB::flow graph scheduling to BLI_task.

Using flow graphs, a graph of nodes (tasks) and links can be defined.
Work can flow though the graph. During this process the execution of the nodes will be
scheduled among the available threads.

We are planning to use this to improve the threading in the draw manager.

The implemented API is still limited it only supports sequential flows. Joins and buffers
are not supported. We could eventually support them as part of an CPP API. These features
from uses compile time templates and are hard to make a clean C-API for this.

Reviewed By: Sergey Sharybin, Brecht van Lommel

Differential Revision: https://developer.blender.org/D7578
2020-05-25 12:38:12 +02:00
87e9557cd1 Simulations: pass simulation data block to update function 2020-05-25 12:23:55 +02:00
60bed34f16 install_deps: update libraries versions.
- FFMPEG: 4.3.2
- OpenSubDiv: 3.4.3
- OpenXR SDK: 1.0.8
- Switch form SDL 1.2 to SDL 2.0

Re T77035, T77007, T77010 and T77011
2020-05-25 11:54:30 +02:00
1c467d77de Cleanup: typo 2020-05-25 11:39:52 +02:00
8a971c9d91 Cleanup: Remove unused variables 2020-05-21 23:15:33 -04:00
09feff781c Gpencil build modifier: Re-label panel 2020-05-21 23:15:22 -04:00
fb7cc1d275 Fix another crash when built without cycles 2020-05-21 23:15:02 -04:00
0e18ea5b9c Attempt at warning for Gpencil material problem 2020-05-21 21:00:02 -04:00
e7076c6d95 Add recently added gpencil build property 2020-05-21 20:03:17 -04:00
7961d27fdf Match recent renaming of modifier functions 2020-05-21 19:50:37 -04:00
bda924385f Fix errors with last merge 2020-05-21 19:45:42 -04:00
8eca2b4a1b Merge branch 'panel-list-patch-3' into modifier-panels-ui-local 2020-05-21 19:25:53 -04:00
686eaad84c Fix error with merge 2020-05-21 19:07:21 -04:00
5094397dab Merge branch 'panel-list-patch-2' into panel-list-patch-3 2020-05-21 18:59:57 -04:00
e57458470d Merge branch 'panel-list-patch' into panel-list-patch-2 2020-05-21 18:57:45 -04:00
dde592e622 Merge branch 'master' into panel-list-patch 2020-05-21 18:57:34 -04:00
1d8b4e4023 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-05-21 11:05:40 -04:00
8b9ae6bc91 Fix instanced panel list order when loading existing files
This just requires a small change to solve this situation: the panel
sort order needs to be set to the max sort order when it's added.

We recently got rid of similar behavior, but it turns out it's necessary
when loading existing files, and it doesn't hurt in other cases.
2020-05-21 10:07:09 -04:00
56e40dd168 Fix crash in subsurf modifier UI when built without cycles 2020-05-21 09:35:10 -04:00
e0efec00db Merge branch 'panel-list-patch' into panel-list-patch-2 2020-05-20 19:01:15 -04:00
d91adcf8b7 Merge branch 'master' into panel-list-patch 2020-05-20 19:00:57 -04:00
60a14bd8ef Merge branch 'panel-list-patch' into panel-list-patch-2 2020-05-15 17:58:12 -04:00
eefbd92981 Fix previous commit 2020-05-15 17:57:38 -04:00
6e577f8236 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-05-15 17:55:24 -04:00
d86e97c757 Fix box ymax changing when panel opens 2020-05-15 17:55:04 -04:00
49a5422500 Remove flag in python as well 2020-05-15 17:47:22 -04:00
deef89c17c Add new simulation modifier UI 2020-05-15 17:37:26 -04:00
1359bd34ce Add new mirror UDIM property 2020-05-15 17:32:47 -04:00
9063269462 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-05-15 17:32:12 -04:00
1784982498 Remove instanced list start flag 2020-05-15 17:26:29 -04:00
c14878923b Merge branch 'master' into panel-list-patch 2020-05-15 17:16:54 -04:00
cbc380d252 Two small fixes in interface_panel, slightly increase margin 2020-05-08 17:41:58 -04:00
caae7fe9ef Update for naming changes in master, various small changes 2020-05-08 17:40:09 -04:00
cf261540e6 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-05-08 17:39:26 -04:00
7969a3384e Merge branch 'master' into panel-list-patch 2020-05-08 16:44:50 -04:00
bedf3550b1 Merge branch 'master' into panel-list-patch 2020-05-08 11:09:03 -04:00
a9e822484c Review feedback 2020-05-08 11:06:53 -04:00
d1b2dd6492 Merge branch 'master' into panel-list-patch 2020-05-07 14:57:03 -04:00
e8d028c0af Use "Duplicate" Instead of "Copy" 2020-05-05 10:26:12 -04:00
6d3af8e647 Merge branch 'master' into modifier-panels-ui 2020-05-05 10:25:53 -04:00
37b3f18fec Merge branch 'panel-list-patch' into panel-list-patch-2 2020-05-04 17:43:17 -04:00
6a32b744b4 Merge branch 'master' into panel-list-patch 2020-05-04 17:41:54 -04:00
c7bc1e7778 Merge changes from patches and master 2020-05-01 15:58:07 -05:00
9867d84628 Merge branch 'panel-list-patch-2' into panel-list-patch-3 2020-05-01 15:20:52 -05:00
6222f6a22c Merge branch 'panel-list-patch' into panel-list-patch-2 2020-05-01 15:20:31 -05:00
2e4d8aea50 Merge branch 'master' into panel-list-patch 2020-05-01 15:20:19 -05:00
75d676a089 Merge branch 'master' into modifier-panels-ui 2020-05-01 15:19:28 -05:00
d8f9baa063 Merge branch 'panel-list-patch-2' into panel-list-patch-3 2020-05-01 11:14:27 -05:00
342ef4e678 Finish last changes 2020-05-01 11:09:29 -05:00
81b7dbc0a7 Simplify subpanel registration arguments 2020-05-01 11:04:21 -05:00
deed16e4b6 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-05-01 10:22:53 -05:00
ab6afef863 Merge branch 'master' into panel-list-patch 2020-05-01 10:22:34 -05:00
17f03611ac Avoid redundant label 2020-05-01 10:19:40 -05:00
91877e71df Merge changes from patch review 2020-04-30 18:24:04 -05:00
917d7a6cea Merge branch 'master' into modifier-panels-ui 2020-04-30 16:19:06 -05:00
29d40872c3 - Merge changes from patch 2
- Move panel type lookup to constraints.c
2020-04-30 16:14:05 -05:00
2beed7cbf7 Merge branch 'panel-list-patch-2' into panel-list-patch-3 2020-04-30 15:08:01 -05:00
ecb4861a78 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-04-30 15:03:36 -05:00
b13e9f8147 Merge branch 'master' into panel-list-patch 2020-04-30 15:00:44 -05:00
7a2cd6f14b Merge branch 'panel-list-patch-2' into panel-list-patch-3 2020-04-30 13:20:19 -05:00
42cbeca9ec Review update 2020-04-30 13:12:23 -05:00
f33ed9b0b4 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-04-30 11:51:34 -05:00
481315be8b Merge branch 'master' into panel-list-patch 2020-04-30 11:50:30 -05:00
b7cd5ffe84 Use "instanced" naming 2020-04-30 11:48:03 -05:00
71962eb62e Merge branch 'panel-list-patch' into panel-list-patch-2 2020-04-30 11:24:22 -05:00
2c88153ba6 Cleanup: Naming 2020-04-30 11:24:10 -05:00
d4de4ae278 Use void * for uiListPanelIDFromDataFunc 2020-04-30 11:21:09 -05:00
a41c86bdce Merge branch 'panel-list-patch' into panel-list-patch-2 2020-04-30 11:12:22 -05:00
1de1dc4fe4 Naming: list panel to recreate list panel 2020-04-30 11:11:24 -05:00
07237c9b7f Fix shaderFX panel default expansion 2020-04-30 10:52:08 -05:00
1429fc674d ShaderFX UI updates 2020-04-30 10:48:43 -05:00
c62aa8c0e7 Correct horizonal size offset 2020-04-29 18:43:27 -05:00
4469d44ea2 Adjust from review for part 1 2020-04-29 18:39:03 -05:00
02036767f2 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-04-29 18:34:20 -05:00
d30f334e9b Remove unecessary argument, change variable name 2020-04-29 18:33:37 -05:00
405180192a Fix returning local variable 2020-04-29 18:29:03 -05:00
098b43769e Merge branch 'panel-list-patch' into panel-list-patch-2 2020-04-29 18:24:41 -05:00
faed15c2be Finish review changes 2020-04-29 18:24:27 -05:00
2ba8002b36 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-04-29 18:15:10 -05:00
57e8e174ff Cleanup: Address various review comments 2020-04-29 18:14:26 -05:00
c5aa7f2c6e Use wt->wcol directly 2020-04-29 18:12:37 -05:00
cf87438414 Revert unrelated change 2020-04-29 18:12:19 -05:00
ec07b2f496 Fix comment 2020-04-29 18:11:25 -05:00
da0f59f55a Merge branch 'master' into panel-list-patch 2020-04-29 16:34:26 -05:00
6d49335137 Array: Avoid redundant label 2020-04-29 16:03:16 -05:00
391b4dfd37 ShaderFX UI Panels 2020-04-29 14:35:29 -05:00
33edd753dc Gpencil modifier: copy expand flag 2020-04-29 14:35:00 -05:00
57fc9ef717 Fix location of gpencil color mode selector 2020-04-29 10:15:58 -05:00
8ef0a9fdea Layouts for great pencil modifiers
Worked out the layouts with Matias Mendiola and implemented them here.
2020-04-28 14:52:59 -05:00
4464b99465 Grease pencil modifier drag and drop, expansion saving 2020-04-27 19:06:53 -05:00
854461002c Naming of modifier move to index operator 2020-04-27 18:52:32 -05:00
eac08d6562 Merge branch 'panel-list-patch-2' into panel-list-patch-3 2020-04-27 18:44:48 -05:00
c055fbf557 Naming of move to index operator 2020-04-27 18:42:51 -05:00
24da365d1c Empty grease pencil modifier panels 2020-04-27 18:41:26 -05:00
4f1aa83683 Merge branch 'panel-list-patch-3' into modifier-panels-ui 2020-04-27 16:35:34 -05:00
65ab18bc59 Merge branch 'panel-list-patch-2' into panel-list-patch-3 2020-04-27 16:32:24 -05:00
2972b185a5 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-04-27 16:30:14 -05:00
45e46267a8 Merge branch 'master' into panel-list-patch 2020-04-27 16:28:42 -05:00
2000c3ed7a "Axis" instead of "Use" 2020-04-27 10:57:27 -05:00
f9744e1153 Merge branch 'panel-list-patch-2' into panel-list-patch-3 2020-04-26 19:35:50 -05:00
f45d7e3fee Array Modifier: Move relative offset subpanel upRelative offset is on by default, so it makes more sense for it to beat the top. Also add XYZ labels to the relative offset and label theproperty "factor" instead. 2020-04-26 19:35:02 -05:00
e55a870430 Merge branch 'panel-list-patch' into panel-list-patch-2 2020-04-26 19:08:20 -05:00
25898b9799 Merge branch 'master' into panel-list-patch 2020-04-26 19:06:19 -05:00
4571ea1bdd Cleanup: Synchronize more changes with patches 2020-04-23 09:41:44 -05:00
5c19f23635 Patch 3 2020-04-22 17:22:31 -05:00
1fb95a08f9 Remove print statement 2020-04-22 16:59:53 -05:00
07c55e2543 More cleanup, versioning 2020-04-22 16:58:21 -05:00
2c34d44d28 Add versioning code 2020-04-22 15:53:33 -05:00
e9d8259d13 Patch 2 2020-04-22 15:39:35 -05:00
c4cbb499d5 Pre-review cleanup
- Remove the idea of "active modifier"
- Remove UIList. This can always be added later easily
- Cleanup various comments, unused headers, and unrelated changes
2020-04-22 15:14:47 -05:00
a7e3bbabd2 Cleanup: Rearrange code 2020-04-22 14:34:59 -05:00
726585cb37 Only draw modifier name when panels are wide 2020-04-22 13:27:25 -05:00
6c05aa60c4 Finish subsurf modifier UI 2020-04-22 12:54:32 -05:00
4c7c8efd0b Patch 1 2020-04-21 21:59:36 -05:00
909d497107 Merge branch 'master' into modifier-panels-ui 2020-04-21 17:27:15 -05:00
39555526ae Remove panel-grid snapping
Makes draggin feel unresponsive, there's no need for this really.
Was there since before 2.5 I think. Maybe to avoid too many redraws or
make stacked panels (removed in 2.5) work better.
2020-04-21 22:22:22 +02:00
d882ec322a Constraints UI: Add separator after the X to match modifiers 2020-04-21 20:50:21 +02:00
7229f9a99e Make buttons in constraint headers extpand to full layout width 2020-04-21 12:32:36 +02:00
20da3ae1c5 Fix typo in previous commit.... 2020-04-21 12:31:31 +02:00
a81b558d48 Cleanup: Rename panel type flag from extend to expand
Not sure why I used extend, probably just because of brain dead
programming :)
Also, expose the flag to python panel options.
2020-04-21 12:28:33 +02:00
18cc24ded7 Merge branch 'modifier-panels-ui' of git.blender.org:blender into modifier-panels-ui 2020-04-20 12:44:01 -05:00
b3f7eb4a07 Deduplicate code, fix crash moving panels quickly
The method to check if the panel list represents data is now generalized.
Also actate EXIT panel state when freeing list panels when there is still
a handler attached.
2020-04-20 12:43:55 -05:00
80446f237b Constraints UI: Layout tweaks
Increase consistency between constraints layouts.
2020-04-20 10:53:28 +02:00
b5a46211f4 First pass of layout updates for remaining constraints 2020-04-19 18:47:06 -05:00
f12a66817d Implement expansion saving, drag drop for constraints
The move constraint to index operator still needs a proper poll function.
2020-04-19 12:44:35 -05:00
f787b7f1ca Rework UI layouts for Transform Constraints
Update layouts to 2.8 style, which is generally a huge improvement
for legibility and consistency. Doesn't touch decorators, there are still
issues there.

Also deduplicate some code by using a class for all parent
constraint panel and all constraint subpanels.
2020-04-19 00:45:09 -05:00
aa369d9e4f Cleanup: Fix mispelled "constraints" 2020-04-19 00:41:31 -05:00
f4636b0965 Add list subpanel to UI 2020-04-19 00:41:16 -05:00
c45e1ef21b Merge branch 'modifier-panels-ui' of git.blender.org:blender into modifier-panels-ui 2020-04-18 15:12:04 -05:00
d9f542bbb0 Initial implementation of constraint panels
The layouts are still defined in python, but they are each in a separate
panel. They are named and searched for with the constraint type info
struct names.

This commit does not change the layout for any of the constraints.
2020-04-18 15:11:57 -05:00
94fb309372 Add list panel index to RNA
Needed to support creating list panel layouts in python.

Also check for unimplemented list panel functions before calling.
2020-04-18 15:01:46 -05:00
dec9349a75 UI: Rename Cast Type to Shape
Clearer naming
2020-04-18 19:25:29 +02:00
110c148773 Merge branch 'master' into modifier-panels-ui 2020-04-17 17:20:57 -05:00
3aef74bc1f Merge branch 'panel-drag-scroll-region' into modifier-panels-ui 2020-04-17 17:16:45 -05:00
6fa3e4151e Fix, add comments 2020-04-17 16:56:00 -05:00
e8a6759c1d Initial implementation, not quite working 2020-04-17 16:30:44 -05:00
1a2bca63ef Use simpler solution 2020-04-17 12:52:35 -05:00
54ac90625f UI: Fix last panel dragging affecting region scroll
When finding the total height of the region's panels for scrolling, we
should use starting position of the drag, because a drag and drop doesn't
change the resulting height of the region.
2020-04-17 12:01:50 -05:00
460318257c Use expanding buttons layout for modifier box headers
Had to fix a crash in the alignment code for too small areas.
Also changed panel type flag defines to use an enum.
2020-04-17 16:36:16 +02:00
330300659c Remove redundant leading 'Bevel' header in Bevel Geometry sub-panel 2020-04-17 13:05:16 +02:00
bd5f7f7429 Bevel modifier: Group Profile and Custom Profile together 2020-04-17 10:17:49 +02:00
84eb739a0e Fix layout issue in Bevel modifier Limit Method 2020-04-17 07:13:12 +02:00
55a385620e Cleanup: Consistent code formatting 2020-04-16 17:33:34 -05:00
e46f4a7e45 Merge branch 'master' into modifier-panels-ui 2020-04-16 17:08:11 -05:00
ac943796d4 Draw list panels with box widget colors and code
This solves the transparency and theming issues by reusing the theming
from the box widget. This requires a new drawing function in order to
use box drawing with an opaque inner color, alpha blended with the
region's background color.
2020-04-16 17:04:22 -05:00
87ef42419d Minor tweaks to decimate modifier layout code
Should not have any visible impact.
2020-04-16 21:29:38 +02:00
66eee8ca6e Fix expanded enums using columns within split layout 2020-04-16 21:29:38 +02:00
187c65becb UI: Remove old hacks for dynamic scrollbar hiding
Although we still dynamically hide scrollbars, they don't change the
region size anymore. They are simply drawn on top of the region content.
Because of this, some hacks introduced by fa28e50ac2 are no longer
necessary.
Without these hacks, the scrollbar visibility is evaluated much more
often (cheap operation) which should be more reliable and possibly solve
some glitches.

Also replaces integers passed as booleans.

Fixes T75782.
2020-04-16 21:29:38 +02:00
bc252b3b1a Fix T75675: Unlinking [with setting users to zero] not clearing
LIB_TAG_EXTRAUSER_SET flag

For example in the Image Editor, an assert would be triggered after
unlinking an image [with setting users to zero] and then setting the
image for the Image Editor again.

Whenever we set an Image for Image Editor, the Image ID is flagged
LIB_TAG_EXTRAUSER_SET, when we unlink [with setting users to zero] this
flag was not cleared.

quote @mont29: "a proper fix would be to move this to modern code, and
actually delete the ID..." but that is for later.

Maniphest Tasks: T75675

Differential Revision: https://developer.blender.org/D7452
2020-04-16 21:29:38 +02:00
bdeb0c310b Fix T75680: Nodegroup user count increased when file saved in edit group mode.
This editor's code was a bit schizophrenic, some parts considering its
nodetree usages as real refcounted ones, others, as shallow 'user one'
ones...

Editors should not be real ID users anyway, unless there are *very* good
reasons for it, so swich it to fully 'shallow' usage now.
2020-04-16 21:29:38 +02:00
6b44e0e71a Fix T74964 Stereo 3D anaglyph and interlace not working
Caused by framebuffer initialized in the wrong context.
2020-04-16 21:29:38 +02:00
86309bd7f8 Fix Memory Leak in Shader Interface 2020-04-16 21:29:38 +02:00
04111faf67 Fix T75730: Properly remove unused override properties/operations.
While code is supposed to handle gracefully invalid override operations,
it is much cleaner to avoid those completely.
2020-04-16 21:29:38 +02:00
38031a4a24 Fix (unreported) crash on use-after-free in liboverride deletion code. 2020-04-16 21:29:38 +02:00
d83b93c1e1 Refactor/strengthen a bit invalid operands checks when applying an override operation. 2020-04-16 21:29:38 +02:00
df7407e451 Fix T75730: Crash on read of liboverride data when missing source modifier.
While this should not happen, we still want to handle those errors
gracefully from user perspective (i.e. assert for devs, no crash for
users).

Actual fix of root cause of the issue will come later.
2020-04-16 21:29:38 +02:00
Brecht Van Lommel
1d4411d1fd Fix T73977, T73825: ignore Python user site-packages directory by default
This goes along with the existing changes to ignore PYTHONPATH by default.
--python-use-system-env now controls both.

Differential Revision: https://developer.blender.org/D6962
2020-04-16 21:29:38 +02:00
16a350cd49 GPU: Fix Negative Shift
glAttributes also include `gl_` names. These don't have a location and
should be ignored during shader interface creation. Those internal names
received a location of -1 and therefore the bitmasking was undefined.

Users wouldn't notice this, but ASAN warned developers of this situation.
ASAN could quit making ASAN un-usable as most shaders have this issue.

Reviewed By: Clément Foucault`

Differential Revision: https://developer.blender.org/D7448
2020-04-16 21:29:38 +02:00
a22a7f78a4 Fix T75780: Gpencil Sculpt brushes not working with old files
The patching of brushes was not done.
2020-04-16 21:29:38 +02:00
47b85fb664 Fix T75785: "Extrude Faces Along Normals" throws error 2020-04-16 21:29:38 +02:00
e7fcfe7d64 Fix memcpy overlapping buffers
This crashes with ASAN enabled.
```
==39366==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x6230000ae848,0x6230000ae85a) and [0x6230000ae851, 0x6230000ae863) overlap
```
2020-04-16 21:29:38 +02:00
6fe7bb5754 UI: Move node socket icons to the left of node input buttons
Node input buttons (e.g. in the material properties) used to draw their
icons on the right of the buttons. However since they represent inputs,
it makes more sense conceptually to have them on the left.
Further, we might want to add the usual decorator buttons (to control
keyframes or display other states) to the material properties as well.
Having two circle icons next to each other would be confusing.

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

Reviewed by: Brecht Van Lommel, William Reynish
2020-04-16 21:29:38 +02:00
5ede1bea5e UI: Draw real node sockets for node input buttons
For buttons representing node inputs (e.g. in the material properties)
rather than drawing some generic socket icon, the actual sockets are
drawn now. That includes color, shape and the selection outline.

This should make it easier to understand what these buttons relate to.

Screenshots: {F8469252}, {F8469248} (The left alignment will be done in
a follow-up commit.)

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

Reviewed by: Brecht Van Lommel, Clément Foucault, William Reynish
2020-04-16 21:29:38 +02:00
cc24695be7 Cleanup: typo in comment 2020-04-16 21:28:08 +02:00
ce8808ec07 Cleanup: unused variable warning
Not needed since rB1685f5824d91.
2020-04-16 21:28:08 +02:00
b36e8b0d55 Fix (unreported) Image Editor UI drawing too dark
Caused by rBf0221ff6674f.

Only draw the Image buffer itself in display space.

Differential Revision: https://developer.blender.org/D7449
2020-04-16 21:28:08 +02:00
352b72791a Cleanup: Deduplicate getting node tree from id
Differential Revision: https://developer.blender.org/D7438

Reviewers: mont29
2020-04-16 21:28:08 +02:00
c9feac0afb Theme: adjust active UV face color in the theme
This color had it's alpha reduced in the drawing code,
as the active face is no longer stippled.

Now the color is used from the theme without adjusting the alpha.
2020-04-16 21:28:08 +02:00
77a8f89a50 UV: support changing the opacity of the UV overlay
Add this option as it's useful to adjust how much UV's
cover the image when UV mapping.

D5348 by @EitanSomething with edits
2020-04-16 21:28:08 +02:00
Jeroen Bakker
2909c0e56f GPUImmediate: Use 2 Buffers For (Un)Strict
We used to have a single buffer that was shared between strict and
unstrict draw calls. This leads to many recreation events for the draw
buffers. This patch separates the Unstrict draw buffer from the strict
draw buffer.

This improves performance on Windows Intel 10th gen platform.
On a reference platfor before the patch I got 10 FPS, after this patch
it became 34fps. Note that the same test normally on a low end GPU can
get to 60fps so this does not solve all teh bottlenecks yet.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7421
2020-04-16 21:28:08 +02:00
Jeroen Bakker
02caa87e52 GPUViewport: Use GPUBatch for viewport drawing
When drawing the viewport to the screen the draw calls were not batched.
This resulted in measurable slowdown on Windows Intel 10th gen
platforms.

This patch would cache the last draw calls per viewport. Our API does
support partial redrawing of the viewport, but that isn't used anywhere.

This patch does not include stereoscopy rendering. This still uses the
imm approach and would still be slow on certain hardware.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7357
2020-04-16 21:28:08 +02:00
4bbfa924ad Fix T75567: Paint Mode Wireframe Incorrect
The loop normal VBO is used in two manners. In edit mode to draw the
edge normals. And in paint mode to draw the wireframe. This commit
checks which VBO is needed and build the correct one.

This allows show the wireframe correct in paint mode, when the object is
subdivided.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7419
2020-04-16 21:28:08 +02:00
7f9131bcc5 Fix T75455: High World Space Cavity Samples Crash
When setting the number of cavity samples to a high number blender could
write out of bounds.

This patch will harmonize the number of iterations in the same way how
it is done during execution.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7425
2020-04-16 21:28:08 +02:00
4566f08679 Fix T75620: Lamp gizmo flips direction for negative scaled objects 2020-04-16 21:28:08 +02:00
25f854552e UI: disable shade flat/smooth in sculpt mode 2020-04-16 21:28:08 +02:00
c392903942 Object: only apply smooth/flat to the active object in paint modes
Also some minor improvements:

- Only run once per object data instance.
- Correction for mesh smooth flag being used on curves.
- Move curve operation into utility function.
2020-04-16 21:28:08 +02:00
01ef0eba9a Cleanup: remove unused scene argument 2020-04-16 21:28:08 +02:00
3679a1f601 Cleanup: use sections for object_edit.c 2020-04-16 21:28:08 +02:00
f8b6a2faad Logging: log warnings which had been disabled since 2.4x 2020-04-16 21:28:08 +02:00
062d7c8e96 Fix T75750 Image Editor: Rendered result is much brighter than in viewport 2020-04-16 21:28:08 +02:00
b05dadea6b Fix T75751 Overlay: Clipping Region crashes Blender 2020-04-16 21:28:08 +02:00
b39e9bfca0 Fix T75443 Color Management: Use after free crash when using curve mapping
The root cause is that viewport can draw cached version of themself but
the scene can have been updated and the pointed curvemapping could have
been freed.

To workaround this we just keep a copy of the curvemap at the viewport
level.
2020-04-16 21:28:08 +02:00
7a9aa8ad27 Mantaflow: Change Defaults to Improve Instantaneous Playback
- Change the default cache method to replay
- Change the default resolution to 32 (The same as old smoke)
  which have a speedup of about 4x (~4 FPS vs. ~16 FPS on initial 
playback)

Peformance was tested with 3700x and RTX 2070

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

Fixes T73799
2020-04-16 21:28:08 +02:00
b2a4eb75ab Update RNA Manual References 2020-04-16 21:28:08 +02:00
202bdf1e99 Operator: Add 'dissolve_and_intersect' option for 'Extrude and Move on Normals'
This allows easy choice of operators when editing keymaps
2020-04-16 21:28:08 +02:00
57cbedf602 Cleanup: Remove unused operator 2020-04-16 21:28:08 +02:00
759da271df Cleanup: PEP8 for python changes 2020-04-16 21:28:08 +02:00
1e7e94588d Cleanup: PEP8 for python changes 2020-04-16 21:28:08 +02:00
00b45c3dce Don't use split layout for operator properties if all are checkboxes
Having a split layout looks broken if all items are checkboxes and there
is no heading text, because it only uses half the width then.
So this checks if all visible properties are booleans and if so,
disables the split layout. A bit hacky but this should generally work.
If needed we can add more control in future (e.g. default layout hints
for operators).
2020-04-16 21:28:08 +02:00
0af8fcee76 Support using property split for menu items & use for output FPS setting
We could add an extra parameter for the label string, for now we can
just use the headings. So if a layout heading is available (set and not
already added) use that to enable the split layout.
2020-04-16 21:28:08 +02:00
0dc1873477 UI: Draw real node sockets for node-input buttons and left-align them
Couple of reasons for this:
* Makes it easier to understand that and how these buttons map to nodes.
* These buttons represent node inputs, so it makes more sense to have the icons
  on the left.
* We'd like to show the usual decorators on the right, but having two circles
  for different purposes next to each other would be confusing.

Also respects the socket shape. So if a diamond shape is used for example, the
properties show that too.

I'm not sure if the previous icon textures were cached, either way this method
doesn't use the caching. So this adds a draw call for every socket icon which
is a bit annoying, but probably neglectable. Would be better if we'd use proper
icon textures or batches, but that's a separate change.

Differential Revision: https://developer.blender.org/D7409
2020-04-16 21:28:08 +02:00
17db2e69e9 Draw node socket icons in properties using real node socket shape/color 2020-04-16 21:28:08 +02:00
93f8363516 Fix wrong use of heading in Preferences 2020-04-16 21:28:08 +02:00
9ced07fa76 Use row headings and correct alignment for more Symmetry panels 2020-04-16 21:28:08 +02:00
c3475ebe61 Use column header for Armature Viewport Display panel. 2020-04-16 21:28:08 +02:00
e654a7d67f Fix error in previous commit
I unintentionally changed the size of checkboxes, should be back to the
old size now.
2020-04-16 21:28:08 +02:00
d191723756 Change padding around checkboxes
Two changes:
* Reduce padding between checkbox and text. That makes it clearer what
  the checkbox belongs to if there's also a column heading in front of
  the checkbox.
* Don't add padding on the left side of checkboxes. That makes them line
  up better with items above and below it.
2020-04-16 21:28:08 +02:00
c9fd25b070 Use row header for strip proxy resolutions 2020-04-16 21:28:08 +02:00
1ac55cad30 Use heading row for the Sequencer Flip X/Y controls 2020-04-16 21:28:08 +02:00
966431c2dc Use column header for Transform Affect Only toggles 2020-04-16 21:28:08 +02:00
5588497639 Fix error in prior commit 2020-04-16 21:28:08 +02:00
fbe9ee62cd Use new layout features throughout all Cycles properties 2020-04-16 21:28:08 +02:00
3e43c5f2cc Better alignment in Experimental Preferences 2020-04-16 21:28:07 +02:00
5b14027f54 Use checkbox+value for Sculpt Plane Trim & fix column headers 2020-04-16 21:28:07 +02:00
8383fc55d5 UI: Tweaks to modifier layouts
- Use checkbox + values configuration and expand 3-axis enums.
2020-04-16 21:15:34 +02:00
482334aa98 Various small tweaks to modifier layouts 2020-04-15 15:13:36 -05:00
7447c2ecaf Merge branch 'master' into modifier-panels-ui 2020-04-15 13:35:57 -05:00
d91078bb6e Merge branch 'master' into modifier-panels-ui 2020-04-15 13:19:03 -05:00
915fd3d088 Simplify Edge Split Modifier Layout 2020-04-15 09:47:44 -05:00
338232c294 Rename RECREATE panels to LIST panels 2020-04-15 09:15:59 -05:00
5eac872627 Use layout row with heading
Also use the new uiItemR flag to clear decorators
2020-04-14 17:25:21 -05:00
adad62e8d6 Add new options to solidify modifier
The subpanel organization might need to be rethought here, some of the
new items don't fit perfectly into the categories.
2020-04-14 16:54:08 -05:00
1035184c15 Merge branch 'master' into modifier-panels-ui 2020-04-14 15:36:03 -05:00
f3a2f735a2 Add margin and rounded corners to list panels
This helps differentiate them from regular panels and makes it clearer
that they are separate from each other.

Also added a list panel subpanel flag to avoid always searching parents to
see if a panel belongs to a list panel.
2020-04-14 15:29:37 -05:00
a284ac3213 Use PNL_ prefix for new panel type flags
This prefix should be changed, but it's best to be consistent for now
2020-04-13 15:00:53 -05:00
c128c65345 Tweaks to layout for many modifiers
Bevel: Move to two new panels
Data Transfer: Add advanced panel for rarely used inputs
Mesh Sequence Cache: Don't use useless subpanels
Mirror: Clip in main panel, data panel instead of UVs
Multires: Advanced panel and add missing properties
Normal Edit: Offset in subpanel
Simple Deform: Orientation panel to restrictions panel
Solidify: Add normals subpanel
Subdivision Surface: Add advanced subpanel
UVWarp: Add transform subpanel
Wave: use_x and use_y as toggles on the same row
Wireframe: Don't use split layout
2020-04-13 12:57:06 -05:00
cdb0449e91 Merge branch 'temp-checkbox-layout-tweaks' into modifier-panels-ui 2020-04-11 23:56:33 +02:00
7fb4010137 Option to insert blank dummy decorator for uiItemFullR
When there are multiple items in a property split row (e.g. mirror axes
in the mirror modifier) the decorator would only apply to the first
element. A dummy decorator could be inserted manually by using
`uiItemL_respect_property_split()`, but it's better to let the UI code
have an option for that, the case is common enough.
2020-04-11 23:50:43 +02:00
513de8eaf6 Mirror modifier: Avoid manual placement of dummy decorators for alignment
There's an option to let interface code do this now.
2020-04-11 23:45:12 +02:00
db06fd9a01 Fix use-after-free again 2020-04-11 23:43:31 +02:00
2c19926cc2 Merge branch 'temp-checkbox-layout-tweaks' into modifier-panels-ui 2020-04-11 23:00:47 +02:00
01900f5e6c Use row headings for sculpt symmetry options
Also removed redundant columns.
2020-04-11 22:59:17 +02:00
7714746e5c Support heading in row layouts too - uiLayout.row(heading="FOO") 2020-04-11 22:50:57 +02:00
ce54157417 Use property split layout for sculpt symmetry options
Meant as an example of how to do this with Python. Wasn't possible
without a broken layout until the previous commit.
2020-04-11 22:19:52 +02:00
d20886e98d Fix more cases of recursive property splitting
A bit hacky, but we have to disable the `use_property_split` flag for a
row after adding the split layout to prevent it from further splitting
when adding more items. If these new items actually add multiple buttons
(vector items), these should be placed in a column like before (by
accident?). E.g. that's how the translate buttons (a vector item) is
aligned with the lock icons (another vector item).
2020-04-11 22:19:52 +02:00
dfc62af147 Use column heading for Bevel tool settings 2020-04-11 17:03:27 +02:00
a8036cc2a1 Use checkbox+value for Text Editor 2020-04-11 17:03:03 +02:00
ac01b80221 Modifier UI: separate the Apply/Shape/Copy buttons visually from the modifier controls
Also make these items smaller, to de-emphasize them.
2020-04-11 14:40:05 +02:00
191a565600 Use checkbox+value configuration for Decimate modifier UI layout 2020-04-11 14:30:30 +02:00
1651a5e52c Revert mistake in Sculpt Symmetry panel 2020-04-11 10:58:29 +02:00
24dfb057bd Add checkbox+value configuration many places where applicable 2020-04-11 10:55:18 +02:00
2fecab55f9 Update Vertex Weight Edit modifier UI layout 2020-04-11 09:06:53 +02:00
50154a52cb Add UI for recently added bone properties 2020-04-10 14:57:58 -05:00
e60ad2867a Merge branch 'master' into modifier-panels-ui 2020-04-10 14:35:44 -05:00
4f5c607622 Resolve crash when switching to grease pencil object 2020-04-10 14:30:32 -05:00
31690ad463 Small tweaks to bevel modifier UI 2020-04-10 14:15:04 -05:00
0f95127d1a Merge branch 'modifier-panels-ui' of git.blender.org:blender into modifier-panels-ui 2020-04-10 12:57:33 -05:00
5bf61c9d74 Refactor saving and setting list panel expansion
The public functions are named more sanely and their requirements are
much simpler, with more of the logic handled internally by interface_panel.c.

Also solves a bug saving and loading sub-subpanel expansion.
2020-04-10 12:57:18 -05:00
26b9436975 Merge branch 'temp-checkbox-layout-tweaks' into modifier-panels-ui 2020-04-10 17:53:40 +02:00
61dafc1afb Fix pointer properties breaking column layouts 2020-04-10 17:52:48 +02:00
6fb4816956 Merge branch 'master' into temp-checkbox-layout-tweaks 2020-04-10 17:34:36 +02:00
0c927243d0 Resolve const warning for panel data reordering 2020-04-10 10:14:23 -05:00
5e0b359ac5 Merge branch 'master' into temp-checkbox-layout-tweaks 2020-04-10 15:09:00 +02:00
3b0f241e72 Use checkbox+value in split layout for mirror modifier UV offset
See previous commits.
Meant as an example for how this can be done in C.
2020-04-10 02:07:26 +02:00
5a33f291f4 Use checkbox+value in split layout for object bounds type
See previous commit.
Meant as an example for how this can be done in .py.
2020-04-10 02:03:44 +02:00
9d1c9e86c4 Support displaying single checkbox for a value in split layouts
Mockup: F7430498.

This is technically quite difficult to support, due to how we create the
split layouts for each item. With this commit, layout creators should be
able to do it, even though it involves some boilerplate code. The
followup commit will demonstrate how it can be done.
2020-04-10 02:03:44 +02:00
fc4d2d1e16 Use checkbox+value in split layout for object bounds type
See previous commit.
Meant as an example for how this can be done in .py.
2020-04-10 02:01:52 +02:00
f8347075d0 Support displaying single checkbox for a value in split layouts
Mockup: F7430498.

This is technically quite difficult to support, due to how we create the
split layouts for each item. With this commit, layout creators should be
able to do it, even though it involves some boilerplate code. The
followup commit will demonstrate how it can be done.
2020-04-10 02:01:09 +02:00
184dbb396d Merge branch 'master' into modifier-panels-ui 2020-04-09 16:15:23 -05:00
fb58cc8dc9 Revert "Add Modifier Apply Button Extras Menu"
This reverts commit 824f80a5d7.

After some discussion, it's clear this isn't really an improvement.
2020-04-09 12:23:39 -05:00
824f80a5d7 Add Modifier Apply Button Extras Menu
- Apply as shape key if supported
- Move up and down
Makes room for other convenient operations in the future too.
2020-04-09 11:59:55 -05:00
e4043bb908 Use simpler method to create split labels for toggles 2020-04-09 11:17:56 -05:00
40dbb7fc31 Boolean: Better layout for debug options 2020-04-09 09:12:53 -05:00
1974b5b903 Fix misalignment of items added with uiItemPointerR()
The split layout flag is changed in-between.
2020-04-09 15:41:31 +02:00
c5500b6af8 Merge branch 'temp-checkbox-layout-tweaks' into modifier-panels-ui 2020-04-09 15:37:33 +02:00
27717c5d0a Merge branch 'master' into temp-checkbox-layout-tweaks 2020-04-09 15:37:15 +02:00
bbeb31f4ce Trying new checkbox+value configuration for Mirror UVs 2020-04-09 14:16:44 +02:00
820350ac80 Fix layout when using uiItemFullR() after uiItemL_respect_property_split()
Also make the decorator layout as return value easier to understand.
2020-04-09 02:41:13 +02:00
18f1d80a6c Mirror modifier: Fix layout misalignments and simplify code
Meant as an example for changes to be applied everywhere.
2020-04-09 02:39:41 +02:00
4884d9cd52 Fix layout when using uiItemFullR() after uiItemL_respect_property_split()
Also make the decorator layout as return value easier to understand.
2020-04-09 02:36:19 +02:00
beeb650940 Merge branch 'master' into temp-checkbox-layout-tweaks 2020-04-09 01:49:23 +02:00
0dcc4fd780 Fix broken split layout for operator properties popups
Was creating multiple nested split layouts. `uiDefAutoButsRNA()` used to
do it's own layout splitting, that's redundant now, so I removed it.
2020-04-09 01:40:37 +02:00
6c655d6a50 Solidify UI checkbox layout update 2020-04-09 00:30:26 +02:00
014a575129 Image empty checkbox layout updates 2020-04-09 00:12:42 +02:00
7cca282052 Sequencer checkbox layout updates 2020-04-08 23:53:52 +02:00
1e889f2705 Sculpt & paint UI checkbox layout updates 2020-04-08 23:53:32 +02:00
45b6f746a3 Camera and Curve obdata properties layout updates 2020-04-08 23:19:48 +02:00
dd723f5f89 Change manually split layouts to 40% 2020-04-08 14:38:19 -05:00
8d2128009d Mask modifier layout
C++ needs workaround for including BKE_screen.h and a
PanelDrawFn definition.
2020-04-08 14:37:49 -05:00
bcf9daf155 Update Preferences and Physics UI layouts for new checkboxes 2020-04-08 20:45:30 +02:00
cdfd743c93 Update Mesh obdata properties 2020-04-08 19:40:21 +02:00
2692ec06d1 Data transfer modifier UI update 2020-04-08 11:48:10 -05:00
105b0b7f6a Object properties layout update 2020-04-08 18:10:07 +02:00
babb028b84 Fix debug mode crash adding and deleting modifier 2020-04-08 10:38:09 -05:00
1f669db7ae Cleanup: Doxygen secionts, rename re_order -> reorder 2020-04-08 10:38:09 -05:00
5071288adb Update View Layer properties layout 2020-04-08 17:34:30 +02:00
53a3e88175 Layout updates for Output Properties 2020-04-08 17:23:09 +02:00
f2792cff11 Use 40/50% properties split layout 2020-04-08 17:22:27 +02:00
63db01cd58 Bevel modifier layout update 2020-04-08 15:57:17 +02:00
2bae660703 Armature and Wave modifier UI updates 2020-04-08 15:52:26 +02:00
88ff68f011 UI: set the prop seperation divide to 40/60 2020-04-08 15:30:58 +02:00
5fc13d1112 Support multiple panels of the same type
The name for the uiBlock associated with a panel was just the panel type's
idname, so the old block found at the start of drawing was the same for
every panel of a certain type.

Panel blocks for list panels are now named with the list index appended
to the end of the name. The panel list is also rebuilt when reordering
panels of the same type.
2020-04-07 15:57:37 -05:00
274481620b Merge branch 'master' into modifier-panels-ui 2020-04-07 12:53:00 -05:00
98c289f5d8 Free panelsort panels from recreate list reordering 2020-04-07 11:54:03 -05:00
a5184a82cb Merge branch 'temp-checkbox-layout-tweaks' into modifier-panels-ui 2020-04-07 17:17:12 +02:00
e21fc05b35 Initial changes to checkbox layout: Use split layout & better section headings
See T65965.
Checkboxes now use the split layout as proposed in the design task and
columns can define headings now (`uiLayout.column(heading="Foo")`).
These headings are placed in the left column of the first item if that
doesn't add its own label there. Otherwise an own row is inserted for
the heading.
2020-04-07 17:08:37 +02:00
21a313eec2 Always add recreate list panels in the correct place.
This requires adding a start type in case we're adding the first
recreate panel.
2020-04-06 15:07:38 -05:00
50c747d234 Explode, Particle Instance modifier layouts 2020-04-06 11:08:58 -05:00
4e8532c145 Remove emboss around modifier remove button. 2020-04-06 12:55:08 +02:00
27a40b880e Remove modifier list for now 2020-04-05 22:02:06 -05:00
191ddaf577 New layouts for more modifiers
- Armature
- Corrective Smooth
- Laplacian Smooth
- Multiresolution
And progress for data transfer modifier
2020-04-05 21:38:18 -05:00
92541ba2ad Add remove button to modifier panel header
Also make sub-subpanels possible for datatransfer modifier layout
2020-04-05 21:35:55 -05:00
240fb4d8d1 Remove unused variables and leftover comments 2020-04-05 21:33:31 -05:00
e7458db4b4 Update UI layouts for Lattice, Mesh Deform, Shrinkwrap and Simple Deform modifiers 2020-04-05 23:32:47 +02:00
172ac7896b Updates to Skin, Subsurf and Wireframe modifier layouts 2020-04-05 22:59:08 +02:00
aed38c2207 Initial update to Bevel modifier layout 2020-04-05 20:26:02 +02:00
d9787141da Update Smooth modifier layout 2020-04-05 19:21:23 +02:00
3bd124d78e Update Warp modifier layout 2020-04-05 19:13:43 +02:00
b47e8c1b94 Merge branch 'modifier-panels-ui' of git.blender.org:blender into modifier-panels-ui 2020-04-05 11:48:27 -05:00
e19f83294a Cast modifier layout, no decorators for vgroup invert 2020-04-05 11:34:14 -05:00
29344fca44 Update Decimate, Solidify and Surface Deform layouts. 2020-04-05 18:17:19 +02:00
fb22ae2387 Initial 2.8 style layouts for more modifiers 2020-04-05 09:57:38 -05:00
23199693f9 Fix build error 2020-04-05 09:07:16 -05:00
2dc5d82ba8 Merge branch 'master' into modifier-panels-ui 2020-04-05 08:44:54 -05:00
d37df1a39d Merge branch 'modifier-panels-ui' of git.blender.org:blender into modifier-panels-ui 2020-04-04 19:30:03 -05:00
adb989768d First pass on 2.8 style UI for more modifers 2020-04-04 19:29:20 -05:00
fa9e1a5873 Modifier UI: Standardize naming and order of functions 2020-04-04 19:28:12 -05:00
f60d614c5f Fix use-after-free 2020-04-05 01:44:55 +02:00
42a030ccac Triangulate Modifier UI update 2020-04-04 13:27:31 -05:00
c0f481c7f2 Remove open parameter from subpanel register 2020-04-04 13:22:47 -05:00
2814a1316f Update Ocean, Remesh, Build modifier UI layouts 2020-04-04 13:22:13 -05:00
25f72d1d17 Screw modifier layout 2020-04-04 19:24:58 +02:00
c4672ff3a8 Array modifier layout 2020-04-04 17:35:33 +02:00
fce2c12ca6 Merge branch 'master' into modifier-panels-ui 2020-04-03 17:00:53 -05:00
b5233a4f74 Merge branch 'modifier-panels-ui' of git.blender.org:blender into modifier-panels-ui 2020-04-03 16:46:26 -05:00
4d5a9b7755 Tweak apply button, fix its location for a few modifiers 2020-04-03 16:46:04 -05:00
cd9a64b9c0 Merge branch 'modifier-panels-ui' of git.blender.org:blender into modifier-panels-ui 2020-04-03 16:35:28 -05:00
3d9af1de8d Ocean: move spectrum to subpanel 2020-04-03 16:17:48 -05:00
c0d187d434 UV Project and UV Warp panel layouts 2020-04-03 23:17:19 +02:00
d0ba75544a Miscellaneous cleanup 2020-04-03 16:17:16 -05:00
94f986edd4 Generalize recreate panel lists, add functionality
The recreate panel list concept should be MUCH easier to use
in different situations, as now it makes use of callbacks for any
modifier-specific functionality.

This commit also enables storing the panel expansion in modifiers
so it is remembered even when the panels are replaced.
2020-04-03 16:15:45 -05:00
ecfae8a55b Use 2.8-compliant layouts for some modifiers 2020-04-03 22:52:26 +02:00
4ac54cf6b0 Add apply / copy buttons
They're not working yet, but it's one possibility for
the location of these buttons.

Also make the order of statements in the panel_draw
functions more consistent.
2020-04-02 18:52:10 -05:00
3221187dd5 Add settings recently added to modifiers, tweak UI 2020-04-02 15:57:07 -05:00
f4d70b686d Re-order modifier mode settings for right align 2020-04-02 14:28:02 -05:00
2c5795618b Merge branch 'master' into modifier-panels-ui 2020-04-02 12:59:25 -05:00
0b75c41afe Cleanup: Remove print statements and comment 2020-04-02 12:57:28 -05:00
5699058e54 Drag and drop modifiers from panels
When the panel animation finishes, a new move modifier to index
operator is called, reordering the modifier stack. Then on the next
draw, the panel types mismatch and the stack is redrawn (or new
indices are set if the types match).
2020-04-02 12:56:33 -05:00
8b073594d9 Don't lower the active modifier index past 0 2020-04-02 10:50:06 -05:00
932f974532 Fix panel header drawing
- Use the preset callback to draw the modifier mode buttons.
- Don't draw empty panel label strings.
2020-04-02 09:57:57 -05:00
8709a46e96 Add modifier move to index API function 2020-04-01 14:04:04 -05:00
270b3d1a04 Small tweaks to modifier panels 2020-04-01 13:58:00 -05:00
6e7873e54a Implement panels for remaining modifiers 2020-04-01 11:41:05 -05:00
042fab271f Implement 13 more modifier panels 2020-03-31 17:31:41 -05:00
2d20d11b01 Merge branch 'master' into modifier-panels-ui 2020-03-31 12:11:29 -05:00
249c5663d8 Implement more modifier panels
Alphabetically to MOD_screw.c
2020-03-31 12:10:10 -05:00
bdabb02ee6 Implement panels for more modifiers
UI layouts WIP
2020-03-30 19:49:40 -05:00
520b7b2887 Rename panel to panelRegister 2020-03-30 16:01:02 -05:00
bd307afbbe Merge branch 'master' into modifier-panels-ui 2020-03-30 15:51:21 -05:00
2374237762 Only rebuild panels when modifier list changes
Benefits of this:
- Epanding and collapsing modifier panels works
- Efficiency
- Solves other handler crashes

Also renamed modifier_index to list_index for more generality
2020-03-30 15:49:51 -05:00
b5ec14af68 Remove unecessary changes 2020-03-30 15:24:00 -05:00
f0e7dba4ff Fix more build errors, remove old property from UI
Test before pushing...
2020-03-28 00:35:49 -05:00
802be17ce7 Fix build error (typo) 2020-03-28 00:29:47 -05:00
4f4f08cee4 Add commented out C drawing code for modifiers.
Left over from an earlier patch, this layout drawing code still
needs to be converted to be panels.
2020-03-27 23:29:54 -05:00
51ea1eea48 Use a panel based UI to draw modifiers
Currently an interface template creates a RECREATE panel for each
modifier, which is then drawn with the rest of the panels. The python
 based modifier drawing is removed.

 This also adds a UIList and the idea of an active modifier, along with
 object operations to add and move it.
2020-03-27 23:28:33 -05:00
68c96b8bb2 Add a modifier callback to register UI panels
The modifier UI is defined in each modifier file. This commit only
implements the callback for a few modifiers, with work in progress UI.

New common UI functions handle the common parts of registering panels
and retrieving modifier pointers from them.
2020-03-27 23:18:08 -05:00
a8bb0af673 Add a RECREATE panel type
Panels built from types with this flag don't have a 1 to 1 correspondence
with their types-- there can be many panels built from a single type. That
can be used to tie each panel to a modifier instead.
2020-03-27 23:07:06 -05:00
914 changed files with 47216 additions and 26581 deletions

View File

@@ -257,6 +257,10 @@ ForEachMacros:
- SURFACE_QUAD_ITER_BEGIN
- foreach
- ED_screen_areas_iter
- SLOT_PROBING_BEGIN
- SET_SLOT_PROBING_BEGIN
- MAP_SLOT_PROBING_BEGIN
- VECTOR_SET_SLOT_PROBING_BEGIN
# Use once we bump the minimum version to version 8.
# # Without this string literals that in-line 'STRINGIFY' behave strangely (a bug?).

View File

@@ -38,6 +38,7 @@ set(ALEMBIC_EXTRA_ARGS
-DBoost_DEBUG=ON
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DILMBASE_ROOT=${LIBDIR}/openexr
-DALEMBIC_ILMBASE_INCLUDE_DIRECTORY=${LIBDIR}/openexr/include/OpenEXR
-DALEMBIC_ILMBASE_HALF_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${OPENEXR_VERSION_POSTFIX}${LIBEXT}

View File

@@ -26,10 +26,20 @@ set(EMBREE_EXTRA_ARGS
-DEMBREE_RAY_MASK=ON
-DEMBREE_FILTER_FUNCTION=ON
-DEMBREE_BACKFACE_CULLING=OFF
-DEMBREE_TASKING_SYSTEM=INTERNAL
-DEMBREE_MAX_ISA=AVX2
-DEMBREE_TASKING_SYSTEM=TBB
-DEMBREE_TBB_ROOT=${LIBDIR}/tbb
-DTBB_STATIC_LIB=${TBB_STATIC_LIBRARY}
)
if(TBB_STATIC_LIBRARY)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
-DEMBREE_TBB_LIBRARY_NAME=tbb_static
-DEMBREE_TBBMALLOC_LIBRARY_NAME=tbbmalloc_static
)
endif()
if(WIN32)
set(EMBREE_BUILD_DIR ${BUILD_MODE}/)
else()
@@ -44,6 +54,12 @@ ExternalProject_Add(external_embree
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${DEFAULT_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/embree
)
add_dependencies(
external_embree
external_tbb
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)

View File

@@ -31,10 +31,6 @@ if(BUILD_MODE STREQUAL Release)
COMMAND # jpeg rename libfile + copy include
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
# OpenImageIO
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/include ${HARVEST_TARGET}/OpenImageIO/include &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/lib ${HARVEST_TARGET}/OpenImageIO/lib &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/idiff.exe ${HARVEST_TARGET}/OpenImageIO/bin/idiff.exe &&
# png
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
@@ -55,9 +51,7 @@ endif()
if(BUILD_MODE STREQUAL Debug)
add_custom_target(Harvest_Debug_Results
# OpenImageIO
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib &&
COMMAND
# hdf5
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hdf5/lib ${HARVEST_TARGET}/hdf5/lib &&
DEPENDS Package_Python

View File

@@ -42,20 +42,17 @@ if(WIN32)
set(JPEG_LIBRARY jpeg-staticd${LIBEXT})
endif()
else(WIN32)
# autoconf for unix
if(APPLE)
set(JPEG_EXTRA_ARGS --host x86_64-apple-darwin --with-jpeg8)
else()
set(JPEG_EXTRA_ARGS --with-jpeg8)
endif()
# cmake for unix
set(JPEG_EXTRA_ARGS
-DWITH_JPEG8=ON
-DENABLE_STATIC=ON
-DENABLE_SHARED=OFF
-DCMAKE_INSTALL_LIBDIR=${LIBDIR}/jpg/lib)
ExternalProject_Add(external_jpeg
URL ${JPEG_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${JPEG_HASH}
CONFIGURE_COMMAND ${CONFIGURE_ENV} && autoreconf -fiv && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/jpg NASM=yasm ${JPEG_EXTRA_ARGS}
BUILD_IN_SOURCE 1
BUILD_COMMAND ${CONFIGURE_ENV} && make install
PREFIX ${BUILD_DIR}/jpg
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/jpg

View File

@@ -32,7 +32,7 @@ endif()
if(WIN32)
set(PNG_LIBNAME libpng16_static${LIBEXT})
set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2 -DOPJ_STATIC=1)
set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2)
set(OPENJPEG_POSTFIX _msvc)
else()
set(PNG_LIBNAME libpng${LIBEXT})
@@ -49,23 +49,17 @@ endif()
if(MSVC)
set(OPENJPEG_FLAGS
-DOPENJPEG_HOME=${LIBDIR}/openjpeg_msvc
-DOPENJPEG_INCLUDE_DIR=${LIBDIR}/openjpeg_msvc/include/openjpeg-${OPENJPEG_SHORT_VERSION}
-DOPENJPEG_LIBRARY=${LIBDIR}/openjpeg_msvc/lib/openjp2${LIBEXT}
-DOPENJPEG_LIBRARY_DEBUG=${LIBDIR}/openjpeg_msvc/lib/openjp2${LIBEXT}
-DOpenJpeg_ROOT=${LIBDIR}/openjpeg_msvc
)
else()
set(OPENJPEG_FLAGS
-DOPENJPEG_INCLUDE_DIR=${LIBDIR}/openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION}
-DOPENJPEG_LIBRARY=${LIBDIR}/openjpeg/lib/${OPENJPEG_LIBRARY}
-DOpenJpeg_ROOT=${LIBDIR}/openjpeg
)
endif()
set(OPENIMAGEIO_EXTRA_ARGS
-DBUILDSTATIC=ON
-DBUILD_SHARED_LIBS=OFF
${OPENIMAGEIO_LINKSTATIC}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/openexr/
-DOPENEXR_ILMIMF_LIBRARIES=${LIBDIR}/openexr/lib/IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
@@ -73,7 +67,16 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DBOOST_ROOT=${LIBDIR}/boost
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-OIIO_BUILD_CPP11=ON
-DUSE_LIBSQUISH=OFF
-DUSE_QT5=OFF
-DUSE_NUKE=OFF
-DUSE_OPENVDB=OFF
-DUSE_BZIP2=OFF
-DUSE_FREETYPE=OFF
-DUSE_DCMTK=OFF
-DUSE_LIBHEIF=OFF
-DUSE_OPENGL=OFF
-DUSE_TBB=OFF
-DUSE_FIELD3D=OFF
@@ -81,15 +84,12 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_PYTHON=OFF
-DUSE_GIF=OFF
-DUSE_OPENCV=OFF
-DUSE_OPENSSL=OFF
-DUSE_OPENJPEG=ON
-DUSE_FFMPEG=OFF
-DUSE_PTEX=OFF
-DUSE_FREETYPE=OFF
-DUSE_LIBRAW=OFF
-DUSE_PYTHON=OFF
-DUSE_PYTHON3=OFF
-DUSE_OCIO=OFF
-DUSE_OPENCOLORIO=OFF
-DUSE_WEBP=${WITH_WEBP}
-DOIIO_BUILD_TOOLS=${OIIO_TOOLS}
-DOIIO_BUILD_TESTS=OFF
@@ -103,17 +103,13 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DJPEG_LIBRARY=${LIBDIR}/jpg/lib/${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpg/include
${OPENJPEG_FLAGS}
-DOCIO_PATH=${LIBDIR}/opencolorio/
-DOpenEXR_USE_STATIC_LIBS=On
-DOPENEXR_HOME=${LIBDIR}/openexr/
-DILMBASE_INCLUDE_PATH=${LIBDIR}/openexr/
-DILMBASE_PACKAGE_PREFIX=${LIBDIR}/openexr/
-DILMBASE_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_HALF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IMATH_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DSTOP_ON_WARNING=OFF
${WEBP_FLAGS}
@@ -125,27 +121,38 @@ ExternalProject_Add(external_openimageio
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${OPENIMAGEIO_HASH}
PREFIX ${BUILD_DIR}/openimageio
PATCH_COMMAND
${PATCH_CMD} -p 0 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/src/include < ${PATCH_DIR}/openimageio_gdi.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio_static_libs.diff
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimageio ${DEFAULT_CMAKE_FLAGS} ${OPENIMAGEIO_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openimageio
)
add_dependencies(
external_openimageio
external_png external_zlib
external_png
external_zlib
external_openexr
external_jpeg
external_boost
external_tiff
external_opencolorio
external_openjpeg${OPENJPEG_POSTFIX}
${WEBP_DEP}
)
if(NOT WIN32)
add_dependencies(
external_openimageio
external_opencolorio_extra
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_openimageio after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/include ${HARVEST_TARGET}/OpenImageIO/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/lib ${HARVEST_TARGET}/OpenImageIO/lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/idiff.exe ${HARVEST_TARGET}/OpenImageIO/bin/idiff.exe
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_openimageio after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib
DEPENDEES install
)
endif()
endif()

View File

@@ -27,6 +27,7 @@ set(OPENVDB_EXTRA_ARGS
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBlosc_INCLUDE_DIR=${LIBDIR}/blosc/include/

View File

@@ -44,6 +44,7 @@ set(OSL_EXTRA_ARGS
-DBOOST_ROOT=${LIBDIR}/boost
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DLLVM_DIRECTORY=${LIBDIR}/llvm
-DLLVM_INCLUDES=${LIBDIR}/llvm/include
-DLLVM_LIB_DIR=${LIBDIR}/llvm/lib

View File

@@ -25,7 +25,7 @@ set(PNG_EXTRA_ARGS
ExternalProject_Add(external_png
URL ${PNG_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${PNG_HASH}
URL_HASH SHA256=${PNG_HASH}
PREFIX ${BUILD_DIR}/png
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/png ${DEFAULT_CMAKE_FLAGS} ${PNG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/png

View File

@@ -22,6 +22,8 @@ set(USD_EXTRA_ARGS
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}

View File

@@ -24,13 +24,13 @@ set(OPENAL_VERSION 1.20.1)
set(OPENAL_URI http://openal-soft.org/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2)
set(OPENAL_HASH 556695068ce8375b89986083d810fd35)
set(PNG_VERSION 1.6.35)
set(PNG_VERSION 1.6.37)
set(PNG_URI http://prdownloads.sourceforge.net/libpng/libpng-${PNG_VERSION}.tar.xz)
set(PNG_HASH 678b7e696a62a193ed3503b04bf449d6)
set(PNG_HASH 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca)
set(JPEG_VERSION 1.5.3)
set(JPEG_VERSION 2.0.4)
set(JPEG_URI https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_VERSION}.tar.gz)
set(JPEG_HASH 5b7549d440b86c98a517355c102d155e)
set(JPEG_HASH 44c43e4a9fb352f47090804529317c88)
set(BOOST_VERSION 1.70.0)
set(BOOST_VERSION_NODOTS 1_70_0)
@@ -113,9 +113,9 @@ set(OPENCOLLADA_VERSION v1.6.68)
set(OPENCOLLADA_URI https://github.com/KhronosGroup/OpenCOLLADA/archive/${OPENCOLLADA_VERSION}.tar.gz)
set(OPENCOLLADA_HASH ee7dae874019fea7be11613d07567493)
set(OPENCOLORIO_VERSION 1.1.0)
set(OPENCOLORIO_URI https://github.com/imageworks/OpenColorIO/archive/v${OPENCOLORIO_VERSION}.tar.gz)
set(OPENCOLORIO_HASH 802d8f5b1d1fe316ec5f76511aa611b8)
set(OPENCOLORIO_VERSION 1.1.1)
set(OPENCOLORIO_URI https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v${OPENCOLORIO_VERSION}.tar.gz)
set(OPENCOLORIO_HASH 23d8b9ac81599305539a5a8674b94a3d)
set(LLVM_VERSION 9.0.1)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz)
@@ -127,17 +127,17 @@ set(CLANG_HASH 13468e4a44940efef1b75e8641752f90)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
set(OPENIMAGEIO_VERSION 1.8.13)
set(OPENIMAGEIO_VERSION 2.1.15.0)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH f5526c3c9878029ee900d84856683f93)
set(OPENIMAGEIO_HASH f03aa5e3ac4795af04771ee4146e9832)
set(TIFF_VERSION 4.0.9)
set(TIFF_VERSION 4.1.0)
set(TIFF_URI http://download.osgeo.org/libtiff/tiff-${TIFF_VERSION}.tar.gz)
set(TIFF_HASH 54bad211279cc93eb4fca31ba9bfdc79)
set(TIFF_HASH 2165e7aba557463acc0664e71a3ed424)
set(OSL_VERSION 1.10.9)
set(OSL_VERSION 1.10.10)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH a94f1e8506f7e8f5e993653de5c5fa00)
set(OSL_HASH 00dec08a93c8084e53848b9ad047889f)
set(PYTHON_VERSION 3.7.4)
set(PYTHON_SHORT_VERSION 3.7)
@@ -199,12 +199,10 @@ set(XVIDCORE_VERSION 1.3.7)
set(XVIDCORE_URI https://downloads.xvid.com/downloads/xvidcore-${XVIDCORE_VERSION}.tar.gz)
set(XVIDCORE_HASH abbdcbd39555691dd1c9b4d08f0a031376a3b211652c0d8b3b8aa9be1303ce2d)
# This has to be in sync with the version in blenders /extern folder.
set(OPENJPEG_VERSION 2.3.0)
set(OPENJPEG_VERSION 2.3.1)
set(OPENJPEG_SHORT_VERSION 2.3)
# Use slightly newer commit after release which includes a cmake fix
set(OPENJPEG_URI https://github.com/uclouvain/openjpeg/archive/66297f07a43.zip)
set(OPENJPEG_HASH 8242b18d908c7c42174e4231a741cfa7ce7c26b6ed5c9644feb9df7b3054310b)
set(OPENJPEG_URI https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz)
set(OPENJPEG_HASH 63f5a4713ecafc86de51bfad89cc07bb788e9bba24ebbf0c4ca637621aadb6a9)
set(FFMPEG_VERSION 4.2.3)
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
@@ -214,9 +212,9 @@ set(FFTW_VERSION 3.3.8)
set(FFTW_URI http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz)
set(FFTW_HASH 8aac833c943d8e90d51b697b27d4384d)
set(ICONV_VERSION 1.15)
set(ICONV_VERSION 1.16)
set(ICONV_URI http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz)
set(ICONV_HASH ace8b5f2db42f7b3b3057585e80d9808)
set(ICONV_HASH 7d2a800b952942bb2880efb00cfd524c)
set(LAPACK_VERSION 3.6.0)
set(LAPACK_URI http://www.netlib.org/lapack/lapack-${LAPACK_VERSION}.tgz)
@@ -263,9 +261,9 @@ set(LCMS_VERSION 2.9)
set(LCMS_URI https://nchc.dl.sourceforge.net/project/lcms/lcms/${LCMS_VERSION}/lcms2-${LCMS_VERSION}.tar.gz)
set(LCMS_HASH 8de1b7724f578d2995c8fdfa35c3ad0e)
set(PUGIXML_VERSION 1.9)
set(PUGIXML_URI https://github.com/zeux/pugixml/archive/v1.9.tar.gz)
set(PUGIXML_HASH 9346ca1dce2c48f1748c12fdac41a714)
set(PUGIXML_VERSION 1.10)
set(PUGIXML_URI https://github.com/zeux/pugixml/archive/v${PUGIXML_VERSION}.tar.gz)
set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
set(FLEXBISON_VERSION 2.5.5)
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison//win_flex_bison-2.5.5.zip)
@@ -295,9 +293,9 @@ set(SQLITE_VERSION 3.24.0)
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
set(EMBREE_VERSION 3.8.0)
set(EMBREE_VERSION 3.10.0)
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
set(EMBREE_HASH ac504d5426945fe25dec1267e0c39d52)
set(EMBREE_HASH 4bbe29e7eaa46417efc75fc5f1e8eb87)
set(USD_VERSION 19.11)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)

View File

@@ -378,6 +378,7 @@ CLANG_FORMAT_VERSION_MIN="6.0"
PYTHON_VERSION="3.7.4"
PYTHON_VERSION_MIN="3.7"
PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_MIN
PYTHON_FORCE_BUILD=false
PYTHON_FORCE_REBUILD=false
PYTHON_SKIP=false
@@ -436,7 +437,7 @@ OSL_FORCE_REBUILD=false
OSL_SKIP=false
# OpenSubdiv needs to be compiled for now
OSD_VERSION="3.4.0_RC2"
OSD_VERSION="3.4.3"
OSD_VERSION_MIN=$OSD_VERSION
OSD_FORCE_BUILD=false
OSD_FORCE_REBUILD=false
@@ -468,7 +469,7 @@ OPENCOLLADA_FORCE_BUILD=false
OPENCOLLADA_FORCE_REBUILD=false
OPENCOLLADA_SKIP=false
EMBREE_VERSION="3.8.0"
EMBREE_VERSION="3.10.0"
EMBREE_FORCE_BUILD=false
EMBREE_FORCE_REBUILD=false
EMBREE_SKIP=false
@@ -478,14 +479,14 @@ OIDN_FORCE_BUILD=false
OIDN_FORCE_REBUILD=false
OIDN_SKIP=false
FFMPEG_VERSION="4.0.2"
FFMPEG_VERSION="4.2.3"
FFMPEG_VERSION_MIN="2.8.4"
FFMPEG_FORCE_BUILD=false
FFMPEG_FORCE_REBUILD=false
FFMPEG_SKIP=false
_ffmpeg_list_sep=";"
XR_OPENXR_VERSION="1.0.6"
XR_OPENXR_VERSION="1.0.8"
XR_OPENXR_FORCE_BUILD=false
XR_OPENXR_FORCE_REBUILD=false
XR_OPENXR_SKIP=false
@@ -1029,7 +1030,7 @@ Those libraries should be available as packages in all recent distributions (opt
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
* libsdl1.2, libglew, [libglewmx].\""
* libsdl2, libglew, [libglewmx].\""
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -1535,11 +1536,13 @@ _update_deps_tbb() {
OSD_FORCE_REBUILD=true
OPENVDB_FORCE_REBUILD=true
USD_FORCE_REBUILD=true
EMBREE_FORCE_REBUILD=true
OIDN_FORCE_REBUILD=true
if [ "$_is_building" = true ]; then
OSD_FORCE_BUILD=true
OPENVDB_FORCE_BUILD=true
USD_FORCE_BUILD=true
EMBREE_FORCE_BUILD=true
OIDN_FORCE_BUILD=true
fi
}
@@ -2985,7 +2988,7 @@ compile_Embree() {
fi
# To be changed each time we make edits that would modify the compiled results!
embree_magic=9
embree_magic=10
_init_embree
# Clean install if needed!
@@ -3039,9 +3042,13 @@ compile_Embree() {
cmake_d="$cmake_d -D EMBREE_RAY_MASK=ON"
cmake_d="$cmake_d -D EMBREE_FILTER_FUNCTION=ON"
cmake_d="$cmake_d -D EMBREE_BACKFACE_CULLING=OFF"
cmake_d="$cmake_d -D EMBREE_TASKING_SYSTEM=INTERNAL"
cmake_d="$cmake_d -D EMBREE_MAX_ISA=AVX2"
cmake_d="$cmake_d -D EMBREE_TASKING_SYSTEM=TBB"
if [ -d $INST/tbb ]; then
make_d="$make_d EMBREE_TBB_ROOT=$INST/tbb"
fi
cmake $cmake_d ../
make -j$THREADS && make install
@@ -3421,7 +3428,7 @@ compile_XR_OpenXR_SDK() {
# Install on DEB-like
get_package_version_DEB() {
dpkg-query -W -f '${Version}' $1 | sed -r 's/([0-9]+:)?(([0-9]+\.?)+([0-9]+)).*/\2/'
dpkg-query -W -f '${Version}' $1 | sed -r 's/([0-9]+:)?(([0-9]+\.?){$2}([0-9]+)).*/\2/'
}
check_package_DEB() {
@@ -3517,7 +3524,7 @@ install_DEB() {
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev"
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev"
# libglewmx-dev (broken in deb testing currently...)
VORBIS_USE=true
@@ -3624,7 +3631,7 @@ install_DEB() {
# Check cmake/glew versions and disable features for older distros.
# This is so Blender can at least compile.
PRINT ""
_cmake=`get_package_version_DEB cmake`
_cmake=`get_package_version_DEB cmake 3`
version_ge $_cmake "2.8.10"
if [ $? -eq 1 ]; then
version_ge $_cmake "2.8.8"
@@ -3639,7 +3646,7 @@ install_DEB() {
fi
PRINT ""
_glew=`get_package_version_DEB libglew-dev`
_glew=`get_package_version_DEB libglew-dev 3`
if [ -z $_glew ]; then
# Stupid virtual package in Ubuntu 12.04 doesn't show version number...
_glew=`apt-cache showpkg libglew-dev|tail -n1|awk '{print $2}'|sed 's/-.*//'`
@@ -3668,9 +3675,12 @@ install_DEB() {
INFO "Forced Python/NumPy building, as requested..."
_do_compile_python=true
else
check_package_DEB python$PYTHON_VERSION_MIN-dev
check_package_version_ge_DEB python3-dev $PYTHON_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_DEB python$PYTHON_VERSION_MIN-dev
PYTHON_VERSION_INSTALLED=$(echo `get_package_version_DEB python3-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
PRINT $(echo `get_package_version_DEB python3-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
install_packages_DEB python3-dev
clean_Python
PRINT ""
if [ "$NUMPY_SKIP" = true ]; then
@@ -4163,7 +4173,7 @@ install_RPM() {
THEORA_DEV="libtheora-devel"
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison \
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL-devel \
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
@@ -4290,8 +4300,11 @@ install_RPM() {
INFO "Forced Python/NumPy building, as requested..."
_do_compile_python=true
else
check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN
check_package_version_ge_RPM python3-devel $PYTHON_VERSION_MIN
if [ $? -eq 0 ]; then
get_package_version_RPM python3-devel
PYTHON_VERSION_INSTALLED=`echo $? | sed -r 's/([0-9]+:)?(([0-9]+\.?)?([0-9]+)).*/\2/'`
install_packages_RPM python3-devel
clean_Python
PRINT ""
@@ -4724,7 +4737,7 @@ install_ARCH() {
_packages="$BASE_DEVEL git cmake \
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \
libxml2 yaml-cpp tinyxml python-requests jemalloc"
OPENJPEG_USE=true
@@ -4815,6 +4828,9 @@ install_ARCH() {
else
check_package_version_ge_ARCH python $PYTHON_VERSION_MIN
if [ $? -eq 0 ]; then
get_package_version_ARCH python
PYTHON_VERSION_INSTALLED=`echo $? | sed -r 's/([0-9]+:)?(([0-9]+\.?)?([0-9]+)).*/\2/'`
install_packages_ARCH python
clean_Python
PRINT ""
@@ -5405,11 +5421,11 @@ print_info() {
PRINT " $_1"
_buildargs="$_buildargs $_1"
_1="-D PYTHON_VERSION=$PYTHON_VERSION_MIN"
_1="-D PYTHON_VERSION=$PYTHON_VERSION_INSTALLED"
PRINT " $_1"
_buildargs="$_buildargs $_1"
if [ -d "$INST/python-$PYTHON_VERSION_MIN" ]; then
_1="-D PYTHON_ROOT_DIR=$INST/python-$PYTHON_VERSION_MIN"
if [ -d "$INST/python-$PYTHON_VERSION_INSTALLED" ]; then
_1="-D PYTHON_ROOT_DIR=$INST/python-$PYTHON_VERSION_INSTALLED"
PRINT " $_1"
_buildargs="$_buildargs $_1"
fi

View File

@@ -0,0 +1,36 @@
diff -Naur orig/CMakeLists.txt external_openimageio/CMakeLists.txt
--- orig/CMakeLists.txt 2020-05-10 21:43:52 -0600
+++ external_openimageio/CMakeLists.txt 2020-05-13 17:03:35 -0600
@@ -170,7 +170,7 @@
add_subdirectory (src/iinfo)
add_subdirectory (src/maketx)
add_subdirectory (src/oiiotool)
- add_subdirectory (src/testtex)
+ #add_subdirectory (src/testtex)
add_subdirectory (src/iv)
endif ()
diff -Naur orig/src/cmake/compiler.cmake external_openimageio/src/cmake/compiler.cmake
--- orig/src/cmake/compiler.cmake 2020-05-10 21:43:52 -0600
+++ external_openimageio/src/cmake/compiler.cmake 2020-05-13 17:02:54 -0600
@@ -172,6 +172,7 @@
add_definitions (-D_CRT_NONSTDC_NO_WARNINGS)
add_definitions (-D_SCL_SECURE_NO_WARNINGS)
add_definitions (-DJAS_WIN_MSVC_BUILD)
+ add_definitions (-DOPJ_STATIC)
endif (MSVC)
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"
diff -Naur orig/src/include/OpenImageIO/platform.h external_openimageio/src/include/OpenImageIO/platform.h
--- orig/src/include/OpenImageIO/platform.h 2020-05-10 21:43:52 -0600
+++ external_openimageio/src/include/OpenImageIO/platform.h 2020-05-13 17:04:36 -0600
@@ -41,6 +41,9 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
+# ifndef NOGDI
+# define NOGDI
+# endif
# include <windows.h>
#endif

View File

@@ -1,26 +0,0 @@
Index: OpenImageIO/osdep.h
===================================================================
--- OpenImageIO/osdep.h (revision 61595)
+++ OpenImageIO/osdep.h (working copy)
@@ -34,6 +34,7 @@
# define WIN32_LEAN_AND_MEAN
# define VC_EXTRALEAN
# define NOMINMAX
+# define NOGDI
# include <windows.h>
#endif
Index: OpenImageIO/platform.h
===================================================================
--- OpenImageIO/platform.h (revision 61595)
+++ OpenImageIO/platform.h (working copy)
@@ -77,6 +77,9 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
+# ifndef NOGDI
+# define NOGDI
+# endif
# include <windows.h>
#endif

View File

@@ -1,22 +0,0 @@
diff -Naur external_openimageio.orig/src/cmake/compiler.cmake external_openimageio/src/cmake/compiler.cmake
--- external_openimageio.orig/src/cmake/compiler.cmake 2018-07-31 23:45:19 -0600
+++ external_openimageio/src/cmake/compiler.cmake 2018-08-16 12:50:12 -0600
@@ -152,6 +152,7 @@
add_definitions (-D_CRT_NONSTDC_NO_WARNINGS)
add_definitions (-D_SCL_SECURE_NO_WARNINGS)
add_definitions (-DJAS_WIN_MSVC_BUILD)
+ add_definitions (-DOPJ_STATIC)
endif (MSVC)
# Use ccache if found
--- external_openimageio.orig/CMakeLists.txt 2018-07-31 23:45:19 -0600
+++ external_openimageio/CMakeLists.txt 2018-08-17 15:22:56 -0600
@@ -169,7 +169,7 @@
add_subdirectory (src/iinfo)
add_subdirectory (src/maketx)
add_subdirectory (src/oiiotool)
- add_subdirectory (src/testtex)
+# add_subdirectory (src/testtex)
add_subdirectory (src/iv)
endif ()

View File

@@ -48,3 +48,22 @@ diff -Naur OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp extern
size_t
LLVM_Util::total_jit_memory_held ()
diff -Naur OpenShadingLanguage-Release-1.9.9/CMakeLists.txt external_osl/CMakeLists.txt
--- orig/CMakeLists.txt 2020-01-27 16:22:31 -0700
+++ external_osl/CMakeLists.txt 2020-05-13 18:04:52 -0600
@@ -102,10 +102,11 @@
set (OPTIX_EXTRA_LIBS CACHE STRING "Extra lib targets needed for OptiX")
set (CUDA_TARGET_ARCH "sm_35" CACHE STRING "CUDA GPU architecture (e.g. sm_35)")
-# set (USE_OIIO_STATIC ON CACHE BOOL "If OIIO is built static")
-# if (USE_OIIO_STATIC)
-# add_definitions ("-DOIIO_STATIC_BUILD=1")
-# endif ()
+set (USE_OIIO_STATIC ON CACHE BOOL "If OIIO is built static")
+if (USE_OIIO_STATIC)
+ add_definitions ("-DOIIO_STATIC_BUILD=1")
+ add_definitions ("-DOIIO_STATIC_DEFINE=1")
+endif ()
set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
if (OSL_NO_DEFAULT_TEXTURESYSTEM)

View File

@@ -78,27 +78,26 @@ class VersionInfo:
blender_h = os.path.join(builder.blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h")
version_number = int(self._parse_header_file(blender_h, 'BLENDER_VERSION'))
self.version = "%d.%d" % (version_number // 100, version_number % 100)
self.version_char = self._parse_header_file(blender_h, 'BLENDER_VERSION_CHAR')
version_number_patch = int(self._parse_header_file(blender_h, 'BLENDER_VERSION_PATCH'))
version_numbers = (version_number // 100, version_number % 100, version_number_patch)
self.short_version = "%d.%02d" % (version_numbers[0], version_numbers[1])
self.version = "%d.%02d.%d" % version_numbers
self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE')
self.version_cycle_number = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE_NUMBER')
self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]
if self.version_cycle == "release":
# Final release
self.full_version = self.version + self.version_char
self.full_version = self.version
self.is_development_build = False
elif self.version_cycle == "rc":
# Release candidate
version_cycle = self.version_cycle + self.version_cycle_number
if len(self.version_char) == 0:
self.full_version = self.version + version_cycle
else:
self.full_version = self.version + self.version_char + '-' + version_cycle
self.full_version = self.version + version_cycle
self.is_development_build = False
else:
# Development build
self.full_version = self.version + self.version_char + '-' + self.hash
self.full_version = self.version + '-' + self.hash
self.is_development_build = True
def _parse_header_file(self, filename, define):

View File

@@ -167,7 +167,7 @@ def pack_linux(builder):
buildbot_utils.call(builder.command_prefix + ['strip', '--strip-all', blender_executable])
print("Stripping python...")
py_target = os.path.join(builder.install_dir, info.version)
py_target = os.path.join(builder.install_dir, info.short_version)
buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';'])
# Construct package name

View File

@@ -756,8 +756,7 @@ function(get_blender_version)
# - BLENDER_VERSION (major.minor)
# - BLENDER_VERSION_MAJOR
# - BLENDER_VERSION_MINOR
# - BLENDER_SUBVERSION (used for internal versioning mainly)
# - BLENDER_VERSION_CHAR (a, b, c, ...or empty string)
# - BLENDER_VERSION_PATCH
# - BLENDER_VERSION_CYCLE (alpha, beta, rc, release)
# So cmake depends on BKE_blender.h, beware of inf-loops!
@@ -767,25 +766,15 @@ function(get_blender_version)
file(STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h _contents REGEX "^#define[ \t]+BLENDER_.*$")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION[ \t]+([0-9]+).*" "\\1" _out_version "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_SUBVERSION[ \t]+([0-9]+).*" "\\1" _out_subversion "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CHAR[ \t]+([a-z]+).*" "\\1" _out_version_char "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_PATCH[ \t]+([0-9]+).*" "\\1" _out_version_patch "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CYCLE[ \t]+([a-z]+).*" "\\1" _out_version_cycle "${_contents}")
if(NOT ${_out_version} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION")
endif()
if(NOT ${_out_subversion} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_SUBVERSION")
endif()
# clumsy regex, only single char are ok but it could be unset
string(LENGTH "${_out_version_char}" _out_version_char_len)
if(NOT _out_version_char_len EQUAL 1)
set(_out_version_char "")
elseif(NOT ${_out_version_char} MATCHES "[a-z]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CHAR")
if(NOT ${_out_version_patch} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_PATCH")
endif()
if(NOT ${_out_version_cycle} MATCHES "[a-z]+")
@@ -795,23 +784,11 @@ function(get_blender_version)
math(EXPR _out_version_major "${_out_version} / 100")
math(EXPR _out_version_minor "${_out_version} % 100")
# for packaging, alpha to numbers
string(COMPARE EQUAL "${_out_version_char}" "" _out_version_char_empty)
if(${_out_version_char_empty})
set(_out_version_char_index "0")
else()
set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z)
list(FIND _char_ls ${_out_version_char} _out_version_char_index)
math(EXPR _out_version_char_index "${_out_version_char_index} + 1")
endif()
# output vars
set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE)
set(BLENDER_VERSION_MINOR "${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_SUBVERSION "${_out_subversion}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR "${_out_version_char}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index}" PARENT_SCOPE)
set(BLENDER_VERSION_PATCH "${_out_version_patch}" PARENT_SCOPE)
set(BLENDER_VERSION_CYCLE "${_out_version_cycle}" PARENT_SCOPE)
endfunction()

View File

@@ -7,7 +7,7 @@ set(PROJECT_VENDOR "Blender Foundation")
set(MAJOR_VERSION ${BLENDER_VERSION_MAJOR})
set(MINOR_VERSION ${BLENDER_VERSION_MINOR})
set(PATCH_VERSION ${BLENDER_VERSION_CHAR_INDEX})
set(PATCH_VERSION ${BLENDER_VERSION_PATCH})
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
set(CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION})

View File

@@ -478,7 +478,7 @@ if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
add_definitions(-DOIIO_STATIC_BUILD)
add_definitions(-DOIIO_STATIC_DEFINE)
add_definitions(-DOIIO_NO_SSE=1)
endif()

View File

@@ -7,15 +7,14 @@ BASE_DIR="$PWD"
blender_srcdir=$(dirname -- $0)/../..
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_patch=$(grep "BLENDER_VERSION_PATCH\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100).$blender_version_patch
if [ "$blender_version_cycle" = "release" ] ; then
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char
SUBMODULE_EXCLUDE="^\(release/scripts/addons_contrib\)$"
else
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)_$blender_subversion
VERSION=$VERSION-$blender_version_cycle
SUBMODULE_EXCLUDE="^$" # dummy regex
fi

View File

@@ -119,4 +119,24 @@ Examples
To try these examples, just copy them into Blenders text editor and execute them.
To keep the examples relatively small, they just register a draw function that can't easily be removed anymore.
Blender has to be restarted in order to delete the draw handlers.
3D Lines with Single Color
--------------------------
"""
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
coords = [(1, 1, 1), (-2, 0, 0), (-2, -1, 3), (0, 1, 1)]
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords})
def draw():
shader.bind()
shader.uniform_float("color", (1, 1, 0, 1))
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -1,41 +1,65 @@
"""
Rendering the 3D View into a Texture
------------------------------------
Custom Shader for dotted 3D Line
--------------------------------
The scene has to have a camera for this example to work.
You could also make this independent of a specific camera,
but Blender does not expose good functions to create view and projection matrices yet.
In this example the arc length (distance to the first point on the line) is calculated in every vertex.
Between the vertex and fragment shader that value is automatically interpolated
for all points that will be visible on the screen.
In the fragment shader the ``sin`` of the arc length is calculated.
Based on the result a decision is made on whether the fragment should be drawn or not.
"""
import bpy
import bgl
import gpu
from gpu_extras.presets import draw_texture_2d
from random import random
from mathutils import Vector
from gpu_extras.batch import batch_for_shader
WIDTH = 512
HEIGHT = 256
vertex_shader = '''
uniform mat4 u_ViewProjectionMatrix;
offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT)
in vec3 position;
in float arcLength;
out float v_ArcLength;
void main()
{
v_ArcLength = arcLength;
gl_Position = u_ViewProjectionMatrix * vec4(position, 1.0f);
}
'''
fragment_shader = '''
uniform float u_Scale;
in float v_ArcLength;
void main()
{
if (step(sin(v_ArcLength * u_Scale), 0.5) == 1) discard;
gl_FragColor = vec4(1.0);
}
'''
coords = [Vector((random(), random(), random())) * 5 for _ in range(5)]
arc_lengths = [0]
for a, b in zip(coords[:-1], coords[1:]):
arc_lengths.append(arc_lengths[-1] + (a - b).length)
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(
shader, 'LINE_STRIP',
{"position": coords, "arcLength": arc_lengths},
)
def draw():
context = bpy.context
scene = context.scene
view_matrix = scene.camera.matrix_world.inverted()
projection_matrix = scene.camera.calc_matrix_camera(
context.evaluated_depsgraph_get(), x=WIDTH, y=HEIGHT)
offscreen.draw_view3d(
scene,
context.view_layer,
context.space_data,
context.region,
view_matrix,
projection_matrix)
bgl.glDisable(bgl.GL_DEPTH_TEST)
draw_texture_2d(offscreen.color_texture, (10, 10), WIDTH, HEIGHT)
shader.bind()
matrix = bpy.context.region_data.perspective_matrix
shader.uniform_float("u_ViewProjectionMatrix", matrix)
shader.uniform_float("u_Scale", 10)
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -1,65 +0,0 @@
"""
Custom Shader for dotted 3D Line
--------------------------------
In this example the arc length (distance to the first point on the line) is calculated in every vertex.
Between the vertex and fragment shader that value is automatically interpolated
for all points that will be visible on the screen.
In the fragment shader the ``sin`` of the arc length is calculated.
Based on the result a decision is made on whether the fragment should be drawn or not.
"""
import bpy
import gpu
from random import random
from mathutils import Vector
from gpu_extras.batch import batch_for_shader
vertex_shader = '''
uniform mat4 u_ViewProjectionMatrix;
in vec3 position;
in float arcLength;
out float v_ArcLength;
void main()
{
v_ArcLength = arcLength;
gl_Position = u_ViewProjectionMatrix * vec4(position, 1.0f);
}
'''
fragment_shader = '''
uniform float u_Scale;
in float v_ArcLength;
void main()
{
if (step(sin(v_ArcLength * u_Scale), 0.5) == 1) discard;
gl_FragColor = vec4(1.0);
}
'''
coords = [Vector((random(), random(), random())) * 5 for _ in range(5)]
arc_lengths = [0]
for a, b in zip(coords[:-1], coords[1:]):
arc_lengths.append(arc_lengths[-1] + (a - b).length)
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(
shader, 'LINE_STRIP',
{"position": coords, "arcLength": arc_lengths},
)
def draw():
shader.bind()
matrix = bpy.context.region_data.perspective_matrix
shader.uniform_float("u_ViewProjectionMatrix", matrix)
shader.uniform_float("u_Scale", 10)
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -1,19 +1,45 @@
"""
3D Lines with Single Color
--------------------------
Triangle with Custom Shader
---------------------------
"""
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
coords = [(1, 1, 1), (-2, 0, 0), (-2, -1, 3), (0, 1, 1)]
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords})
vertex_shader = '''
uniform mat4 viewProjectionMatrix;
in vec3 position;
out vec3 pos;
void main()
{
pos = position;
gl_Position = viewProjectionMatrix * vec4(position, 1.0f);
}
'''
fragment_shader = '''
uniform float brightness;
in vec3 pos;
void main()
{
gl_FragColor = vec4(pos * brightness, 1.0);
}
'''
coords = [(1, 1, 1), (2, 0, 0), (-2, -1, 3)]
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(shader, 'TRIS', {"position": coords})
def draw():
shader.bind()
shader.uniform_float("color", (1, 1, 0, 1))
matrix = bpy.context.region_data.perspective_matrix
shader.uniform_float("viewProjectionMatrix", matrix)
shader.uniform_float("brightness", 0.5)
batch.draw(shader)

View File

@@ -1,45 +1,29 @@
"""
Triangle with Custom Shader
---------------------------
Wireframe Cube using Index Buffer
---------------------------------
"""
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
vertex_shader = '''
uniform mat4 viewProjectionMatrix;
coords = (
(-1, -1, -1), (+1, -1, -1),
(-1, +1, -1), (+1, +1, -1),
(-1, -1, +1), (+1, -1, +1),
(-1, +1, +1), (+1, +1, +1))
in vec3 position;
out vec3 pos;
indices = (
(0, 1), (0, 2), (1, 3), (2, 3),
(4, 5), (4, 6), (5, 7), (6, 7),
(0, 4), (1, 5), (2, 6), (3, 7))
void main()
{
pos = position;
gl_Position = viewProjectionMatrix * vec4(position, 1.0f);
}
'''
fragment_shader = '''
uniform float brightness;
in vec3 pos;
void main()
{
gl_FragColor = vec4(pos * brightness, 1.0);
}
'''
coords = [(1, 1, 1), (2, 0, 0), (-2, -1, 3)]
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(shader, 'TRIS', {"position": coords})
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords}, indices=indices)
def draw():
shader.bind()
matrix = bpy.context.region_data.perspective_matrix
shader.uniform_float("viewProjectionMatrix", matrix)
shader.uniform_float("brightness", 0.5)
shader.uniform_float("color", (1, 0, 0, 1))
batch.draw(shader)

View File

@@ -1,30 +1,39 @@
"""
Wireframe Cube using Index Buffer
---------------------------------
Mesh with Random Vertex Colors
------------------------------
"""
import bpy
import gpu
import bgl
import numpy as np
from random import random
from gpu_extras.batch import batch_for_shader
coords = (
(-1, -1, -1), (+1, -1, -1),
(-1, +1, -1), (+1, +1, -1),
(-1, -1, +1), (+1, -1, +1),
(-1, +1, +1), (+1, +1, +1))
mesh = bpy.context.active_object.data
mesh.calc_loop_triangles()
indices = (
(0, 1), (0, 2), (1, 3), (2, 3),
(4, 5), (4, 6), (5, 7), (6, 7),
(0, 4), (1, 5), (2, 6), (3, 7))
vertices = np.empty((len(mesh.vertices), 3), 'f')
indices = np.empty((len(mesh.loop_triangles), 3), 'i')
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords}, indices=indices)
mesh.vertices.foreach_get(
"co", np.reshape(vertices, len(mesh.vertices) * 3))
mesh.loop_triangles.foreach_get(
"vertices", np.reshape(indices, len(mesh.loop_triangles) * 3))
vertex_colors = [(random(), random(), random(), 1) for _ in range(len(mesh.vertices))]
shader = gpu.shader.from_builtin('3D_SMOOTH_COLOR')
batch = batch_for_shader(
shader, 'TRIS',
{"pos": vertices, "color": vertex_colors},
indices=indices,
)
def draw():
shader.bind()
shader.uniform_float("color", (1, 0, 0, 1))
bgl.glEnable(bgl.GL_DEPTH_TEST)
batch.draw(shader)
bgl.glDisable(bgl.GL_DEPTH_TEST)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -1,39 +1,26 @@
"""
Mesh with Random Vertex Colors
------------------------------
2D Rectangle
------------
"""
import bpy
import gpu
import bgl
import numpy as np
from random import random
from gpu_extras.batch import batch_for_shader
mesh = bpy.context.active_object.data
mesh.calc_loop_triangles()
vertices = (
(100, 100), (300, 100),
(100, 200), (300, 200))
vertices = np.empty((len(mesh.vertices), 3), 'f')
indices = np.empty((len(mesh.loop_triangles), 3), 'i')
indices = (
(0, 1, 2), (2, 1, 3))
mesh.vertices.foreach_get(
"co", np.reshape(vertices, len(mesh.vertices) * 3))
mesh.loop_triangles.foreach_get(
"vertices", np.reshape(indices, len(mesh.loop_triangles) * 3))
vertex_colors = [(random(), random(), random(), 1) for _ in range(len(mesh.vertices))]
shader = gpu.shader.from_builtin('3D_SMOOTH_COLOR')
batch = batch_for_shader(
shader, 'TRIS',
{"pos": vertices, "color": vertex_colors},
indices=indices,
)
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)
def draw():
bgl.glEnable(bgl.GL_DEPTH_TEST)
shader.bind()
shader.uniform_float("color", (0, 0.5, 0.5, 1.0))
batch.draw(shader)
bgl.glDisable(bgl.GL_DEPTH_TEST)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')

View File

@@ -1,25 +1,36 @@
"""
2D Rectangle
------------
2D Image
--------
To use this example you have to provide an image that should be displayed.
"""
import bpy
import gpu
import bgl
from gpu_extras.batch import batch_for_shader
vertices = (
(100, 100), (300, 100),
(100, 200), (300, 200))
IMAGE_NAME = "Untitled"
image = bpy.data.images[IMAGE_NAME]
indices = (
(0, 1, 2), (2, 1, 3))
shader = gpu.shader.from_builtin('2D_IMAGE')
batch = batch_for_shader(
shader, 'TRI_FAN',
{
"pos": ((100, 100), (200, 100), (200, 200), (100, 200)),
"texCoord": ((0, 0), (1, 0), (1, 1), (0, 1)),
},
)
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)
if image.gl_load():
raise Exception()
def draw():
bgl.glActiveTexture(bgl.GL_TEXTURE0)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, image.bindcode)
shader.bind()
shader.uniform_float("color", (0, 0.5, 0.5, 1.0))
shader.uniform_int("image", 0)
batch.draw(shader)

View File

@@ -1,37 +1,86 @@
"""
2D Image
--------
Generate a texture using Offscreen Rendering
--------------------------------------------
To use this example you have to provide an image that should be displayed.
#. Create an :class:`gpu.types.GPUOffScreen` object.
#. Draw some circles into it.
#. Make a new shader for drawing a planar texture in 3D.
#. Draw the generated texture using the new shader.
"""
import bpy
import gpu
import bgl
from mathutils import Matrix
from gpu_extras.batch import batch_for_shader
from gpu_extras.presets import draw_circle_2d
IMAGE_NAME = "Untitled"
image = bpy.data.images[IMAGE_NAME]
# Create and fill offscreen
##########################################
shader = gpu.shader.from_builtin('2D_IMAGE')
offscreen = gpu.types.GPUOffScreen(512, 512)
with offscreen.bind():
bgl.glClear(bgl.GL_COLOR_BUFFER_BIT)
with gpu.matrix.push_pop():
# reset matrices -> use normalized device coordinates [-1, 1]
gpu.matrix.load_matrix(Matrix.Identity(4))
gpu.matrix.load_projection_matrix(Matrix.Identity(4))
amount = 10
for i in range(-amount, amount + 1):
x_pos = i / amount
draw_circle_2d((x_pos, 0.0), (1, 1, 1, 1), 0.5, 200)
# Drawing the generated texture in 3D space
#############################################
vertex_shader = '''
uniform mat4 modelMatrix;
uniform mat4 viewProjectionMatrix;
in vec2 position;
in vec2 uv;
out vec2 uvInterp;
void main()
{
uvInterp = uv;
gl_Position = viewProjectionMatrix * modelMatrix * vec4(position, 0.0, 1.0);
}
'''
fragment_shader = '''
uniform sampler2D image;
in vec2 uvInterp;
void main()
{
gl_FragColor = texture(image, uvInterp);
}
'''
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(
shader, 'TRI_FAN',
{
"pos": ((100, 100), (200, 100), (200, 200), (100, 200)),
"texCoord": ((0, 0), (1, 0), (1, 1), (0, 1)),
"position": ((-1, -1), (1, -1), (1, 1), (-1, 1)),
"uv": ((0, 0), (1, 0), (1, 1), (0, 1)),
},
)
if image.gl_load():
raise Exception()
def draw():
bgl.glActiveTexture(bgl.GL_TEXTURE0)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, image.bindcode)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, offscreen.color_texture)
shader.bind()
shader.uniform_int("image", 0)
shader.uniform_float("modelMatrix", Matrix.Translation((1, 2, 3)) @ Matrix.Scale(3, 4))
shader.uniform_float("viewProjectionMatrix", bpy.context.region_data.perspective_matrix)
shader.uniform_float("image", 0)
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -1,23 +1,28 @@
"""
Generate a texture using Offscreen Rendering
--------------------------------------------
Copy Offscreen Rendering result back to RAM
-------------------------------------------
#. Create an :class:`gpu.types.GPUOffScreen` object.
#. Draw some circles into it.
#. Make a new shader for drawing a planar texture in 3D.
#. Draw the generated texture using the new shader.
This will create a new image with the given name.
If it already exists, it will override the existing one.
Currently almost all of the execution time is spent in the last line.
In the future this will hopefully be solved by implementing the Python buffer protocol
for :class:`bgl.Buffer` and :class:`bpy.types.Image.pixels` (aka ``bpy_prop_array``).
"""
import bpy
import gpu
import bgl
import random
from mathutils import Matrix
from gpu_extras.batch import batch_for_shader
from gpu_extras.presets import draw_circle_2d
# Create and fill offscreen
##########################################
IMAGE_NAME = "Generated Image"
WIDTH = 512
HEIGHT = 512
RING_AMOUNT = 10
offscreen = gpu.types.GPUOffScreen(512, 512)
offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT)
with offscreen.bind():
bgl.glClear(bgl.GL_COLOR_BUFFER_BIT)
@@ -26,61 +31,20 @@ with offscreen.bind():
gpu.matrix.load_matrix(Matrix.Identity(4))
gpu.matrix.load_projection_matrix(Matrix.Identity(4))
amount = 10
for i in range(-amount, amount + 1):
x_pos = i / amount
draw_circle_2d((x_pos, 0.0), (1, 1, 1, 1), 0.5, 200)
for i in range(RING_AMOUNT):
draw_circle_2d(
(random.uniform(-1, 1), random.uniform(-1, 1)),
(1, 1, 1, 1), random.uniform(0.1, 1), 20)
buffer = bgl.Buffer(bgl.GL_BYTE, WIDTH * HEIGHT * 4)
bgl.glReadBuffer(bgl.GL_BACK)
bgl.glReadPixels(0, 0, WIDTH, HEIGHT, bgl.GL_RGBA, bgl.GL_UNSIGNED_BYTE, buffer)
offscreen.free()
# Drawing the generated texture in 3D space
#############################################
vertex_shader = '''
uniform mat4 modelMatrix;
uniform mat4 viewProjectionMatrix;
in vec2 position;
in vec2 uv;
out vec2 uvInterp;
void main()
{
uvInterp = uv;
gl_Position = viewProjectionMatrix * modelMatrix * vec4(position, 0.0, 1.0);
}
'''
fragment_shader = '''
uniform sampler2D image;
in vec2 uvInterp;
void main()
{
gl_FragColor = texture(image, uvInterp);
}
'''
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(
shader, 'TRI_FAN',
{
"position": ((-1, -1), (1, -1), (1, 1), (-1, 1)),
"uv": ((0, 0), (1, 0), (1, 1), (0, 1)),
},
)
def draw():
bgl.glActiveTexture(bgl.GL_TEXTURE0)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, offscreen.color_texture)
shader.bind()
shader.uniform_float("modelMatrix", Matrix.Translation((1, 2, 3)) @ Matrix.Scale(3, 4))
shader.uniform_float("viewProjectionMatrix", bpy.context.region_data.perspective_matrix)
shader.uniform_float("image", 0)
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')
if not IMAGE_NAME in bpy.data.images:
bpy.data.images.new(IMAGE_NAME, WIDTH, HEIGHT)
image = bpy.data.images[IMAGE_NAME]
image.scale(WIDTH, HEIGHT)
image.pixels = [v / 255 for v in buffer]

View File

@@ -1,50 +1,41 @@
"""
Copy Offscreen Rendering result back to RAM
-------------------------------------------
Rendering the 3D View into a Texture
------------------------------------
This will create a new image with the given name.
If it already exists, it will override the existing one.
Currently almost all of the execution time is spent in the last line.
In the future this will hopefully be solved by implementing the Python buffer protocol
for :class:`bgl.Buffer` and :class:`bpy.types.Image.pixels` (aka ``bpy_prop_array``).
The scene has to have a camera for this example to work.
You could also make this independent of a specific camera,
but Blender does not expose good functions to create view and projection matrices yet.
"""
import bpy
import gpu
import bgl
import random
from mathutils import Matrix
from gpu_extras.presets import draw_circle_2d
import gpu
from gpu_extras.presets import draw_texture_2d
IMAGE_NAME = "Generated Image"
WIDTH = 512
HEIGHT = 512
RING_AMOUNT = 10
HEIGHT = 256
offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT)
with offscreen.bind():
bgl.glClear(bgl.GL_COLOR_BUFFER_BIT)
with gpu.matrix.push_pop():
# reset matrices -> use normalized device coordinates [-1, 1]
gpu.matrix.load_matrix(Matrix.Identity(4))
gpu.matrix.load_projection_matrix(Matrix.Identity(4))
for i in range(RING_AMOUNT):
draw_circle_2d(
(random.uniform(-1, 1), random.uniform(-1, 1)),
(1, 1, 1, 1), random.uniform(0.1, 1), 20)
def draw():
context = bpy.context
scene = context.scene
buffer = bgl.Buffer(bgl.GL_BYTE, WIDTH * HEIGHT * 4)
bgl.glReadBuffer(bgl.GL_BACK)
bgl.glReadPixels(0, 0, WIDTH, HEIGHT, bgl.GL_RGBA, bgl.GL_UNSIGNED_BYTE, buffer)
view_matrix = scene.camera.matrix_world.inverted()
offscreen.free()
projection_matrix = scene.camera.calc_matrix_camera(
context.evaluated_depsgraph_get(), x=WIDTH, y=HEIGHT)
offscreen.draw_view3d(
scene,
context.view_layer,
context.space_data,
context.region,
view_matrix,
projection_matrix)
bgl.glDisable(bgl.GL_DEPTH_TEST)
draw_texture_2d(offscreen.color_texture, (10, 10), WIDTH, HEIGHT)
if not IMAGE_NAME in bpy.data.images:
bpy.data.images.new(IMAGE_NAME, WIDTH, HEIGHT)
image = bpy.data.images[IMAGE_NAME]
image.scale(WIDTH, HEIGHT)
image.pixels = [v / 255 for v in buffer]
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')

View File

@@ -403,32 +403,21 @@ MODULE_GROUPING = {
# -------------------------------BLENDER----------------------------------------
blender_version_strings = [str(v) for v in bpy.app.version]
is_release = bpy.app.version_cycle in {"rc", "release"}
# converting bytes to strings, due to T30154
BLENDER_REVISION = str(bpy.app.build_hash, 'utf_8')
if is_release:
# '2.62a'
BLENDER_VERSION_DOTS = ".".join(blender_version_strings[:2]) + bpy.app.version_char
else:
# '2.62.1'
BLENDER_VERSION_DOTS = ".".join(blender_version_strings)
# '2.83.0 Beta' or '2.83.0' or '2.83.1'
BLENDER_VERSION_DOTS = bpy.app.version_string
if BLENDER_REVISION != "Unknown":
# '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release)
# SHA1 Git hash
BLENDER_VERSION_HASH = BLENDER_REVISION
else:
# Fallback: Should not be used
BLENDER_VERSION_HASH = "Hash Unknown"
if is_release:
# '2_62a_release'
BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), bpy.app.version_char)
else:
# '2_62_1'
BLENDER_VERSION_PATH = "_".join(blender_version_strings)
# '2_83'
BLENDER_VERSION_PATH = "%d_%d" % (bpy.app.version[0], bpy.app.version[1])
# --------------------------DOWNLOADABLE FILES----------------------------------
@@ -699,11 +688,13 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):
doc = undocumented_message(module_name, type_name, identifier)
if type(descr) == GetSetDescriptorType:
fw(ident + ".. attribute:: %s\n\n" % identifier)
fw(ident + ".. attribute:: %s\n" % identifier)
fw(ident + " :noindex:\n\n")
write_indented_lines(ident + " ", fw, doc, False)
fw("\n")
elif type(descr) == MemberDescriptorType: # same as above but use 'data'
fw(ident + ".. data:: %s\n\n" % identifier)
fw(ident + ".. data:: %s\n" % identifier)
fw(ident + " :noindex:\n\n")
write_indented_lines(ident + " ", fw, doc, False)
fw("\n")
elif type(descr) in {MethodDescriptorType, ClassMethodDescriptorType}:
@@ -743,11 +734,14 @@ def pyprop2sphinx(ident, fw, identifier, py_prop):
'''
# readonly properties use "data" directive, variables use "attribute" directive
if py_prop.fset is None:
fw(ident + ".. data:: %s\n\n" % identifier)
fw(ident + ".. data:: %s\n" % identifier)
fw(ident + " :noindex:\n\n")
else:
fw(ident + ".. attribute:: %s\n\n" % identifier)
fw(ident + ".. attribute:: %s\n" % identifier)
fw(ident + " :noindex:\n\n")
write_indented_lines(ident + " ", fw, py_prop.__doc__)
if py_prop.fset is None:
fw("\n")
fw(ident + " (readonly)\n\n")
else:
fw("\n")
@@ -913,7 +907,8 @@ def pymodule2sphinx(basepath, module_name, module, title):
elif issubclass(value_type, (bool, int, float, str, tuple)):
# constant, not much fun we can do here except to list it.
# TODO, figure out some way to document these!
fw(".. data:: %s\n\n" % attribute)
fw(".. data:: %s\n" % attribute)
fw(" :noindex:\n\n")
write_indented_lines(" ", fw, "constant value %s" % repr(value), False)
fw("\n")
else:
@@ -1121,7 +1116,8 @@ def pycontext2sphinx(basepath):
type_descr = prop.get_type_description(
class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
fw(".. data:: %s\n\n" % prop.identifier)
fw(".. data:: %s\n" % prop.identifier)
fw(" :noindex:\n\n")
if prop.description:
fw(" %s\n\n" % prop.description)
@@ -1166,7 +1162,8 @@ def pycontext2sphinx(basepath):
i = 0
while char_array[i] is not None:
member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
fw(".. data:: %s\n\n" % member)
fw(".. data:: %s\n" % member)
fw(" :noindex:\n\n")
member_type, is_seq = context_type_map[member]
fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))
unique.add(member)
@@ -1310,7 +1307,7 @@ def pyrna2sphinx(basepath):
fw(title_string(title, "="))
fw(".. module:: %s\n\n" % struct_module_name)
fw(".. module:: %s.%s\n\n" % (struct_module_name, struct_id))
# docs first?, ok
write_example_ref("", fw, "%s.%s" % (struct_module_name, struct_id))
@@ -1369,9 +1366,11 @@ def pyrna2sphinx(basepath):
type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
# readonly properties use "data" directive, variables properties use "attribute" directive
if 'readonly' in type_descr:
fw(" .. data:: %s\n\n" % prop.identifier)
fw(" .. data:: %s\n" % prop.identifier)
fw(" :noindex:\n\n")
else:
fw(" .. attribute:: %s\n\n" % prop.identifier)
fw(" .. attribute:: %s\n" % prop.identifier)
fw(" :noindex:\n\n")
if prop.description:
fw(" %s\n\n" % prop.description)
@@ -1541,7 +1540,7 @@ def pyrna2sphinx(basepath):
fw(title_string(class_name, "="))
fw(".. module:: %s\n" % class_module_name)
fw(".. module:: %s.%s\n" % (class_module_name, class_name))
fw("\n")
if use_subclasses:

View File

@@ -36,16 +36,10 @@ fi
blender_srcdir=$(dirname -- $0)/../..
blender_version_header="$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h"
blender_version=$(grep "BLENDER_VERSION\s" "$blender_version_header" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_version_header" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_version_header" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_version_header" | awk '{print $3}')
unset blender_version_header
if [ "$blender_version_cycle" = "release" ] ; then
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release"
else
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion
fi
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)
SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION

View File

@@ -127,11 +127,10 @@ def main():
" f.write('%d\\n' % is_release)\n"
" f.write('%d\\n' % is_beta)\n"
" f.write('%s\\n' % branch)\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char))\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" f.write('%d.%d\\n' % (bpy.app.version[0], bpy.app.version[1]))\n"
" f.write('%d.%d\\n' % (bpy.app.version[0], bpy.app.version[1])\n"
" if (is_release or is_beta) else '%s\\n' % branch)\n"
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" if is_release else '%d_%d_%d' % bpy.app.version)\n"
" f.write('%d_%d' % (bpy.app.version[0], bpy.app.version[1]))\n"
)
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
"--python-expr", getver_script, "--", getver_file)

View File

@@ -26,6 +26,7 @@
#include "util/util_args.h"
#include "util/util_foreach.h"
#include "util/util_function.h"
#include "util/util_image.h"
#include "util/util_logging.h"
#include "util/util_path.h"
#include "util/util_progress.h"

View File

@@ -85,6 +85,7 @@ def update_script_node(node, report):
# write text datablock contents to temporary file
osl_file = tempfile.NamedTemporaryFile(mode='w', suffix=".osl", delete=False)
osl_file.write(script.as_string())
osl_file.write("\n")
osl_file.close()
ok, oso_path = osl_compile(osl_file.name, report)

View File

@@ -1205,6 +1205,13 @@ class CyclesObjectSettings(bpy.types.PropertyGroup):
default=1.0,
)
shadow_terminator_offset: FloatProperty(
name="Shadow Terminator Offset",
description="Push the shadow terminator towards the light to hide artifacts on low poly geometry",
min=0.0, max=1.0,
default=0.0,
)
is_shadow_catcher: BoolProperty(
name="Shadow Catcher",
description="Only render shadows on this object, for compositing renders into real footage",
@@ -1528,6 +1535,12 @@ class CyclesPreferences(bpy.types.AddonPreferences):
devices: bpy.props.CollectionProperty(type=CyclesDeviceSettings)
peer_memory: BoolProperty(
name="Distribute memory across devices",
description="Make more room for large scenes to fit by distributing memory across interconnected devices (e.g. via NVLink) rather than duplicating it",
default=False,
)
def find_existing_device_entry(self, device):
for device_entry in self.devices:
if device_entry.id == device[2] and device_entry.type == device[1]:
@@ -1625,14 +1638,21 @@ class CyclesPreferences(bpy.types.AddonPreferences):
row = layout.row()
row.prop(self, "compute_device_type", expand=True)
devices = self.get_devices_for_type(self.compute_device_type)
if self.compute_device_type == 'NONE':
return
row = layout.row()
if self.compute_device_type == 'CUDA':
self._draw_devices(row, 'CUDA', devices)
elif self.compute_device_type == 'OPTIX':
self._draw_devices(row, 'OPTIX', devices)
elif self.compute_device_type == 'OPENCL':
self._draw_devices(row, 'OPENCL', devices)
devices = self.get_devices_for_type(self.compute_device_type)
self._draw_devices(row, self.compute_device_type, devices)
import _cycles
has_peer_memory = 0
for device in _cycles.available_devices(self.compute_device_type):
if device[3] and self.find_existing_device_entry(device).use:
has_peer_memory += 1
if has_peer_memory > 1:
row = layout.row()
row.use_property_split = True
row.prop(self, "peer_memory")
def draw(self, context):
self.draw_impl(self.layout, context)

View File

@@ -1209,6 +1209,27 @@ def has_geometry_visibility(ob):
return ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or
(ob.instance_type == 'COLLECTION' and ob.instance_collection))
class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel):
bl_label = "Shading"
bl_context = "object"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
return CyclesButtonsPanel.poll(context) and (context.object)
def draw(self, context):
layout = self.layout
layout.use_property_split = True
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
layout = self.layout
ob = context.object
cob = ob.cycles
if has_geometry_visibility(ob):
col = flow.column()
col.prop(cob, "shadow_terminator_offset")
class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
bl_label = "Visibility"
@@ -1367,7 +1388,7 @@ class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
col.separator()
if light.type in {'POINT', 'SPOT'}:
col.prop(light, "shadow_soft_size", text="Size")
col.prop(light, "shadow_soft_size", text="Radius")
elif light.type == 'SUN':
col.prop(light, "angle")
elif light.type == 'AREA':
@@ -2268,6 +2289,7 @@ classes = (
CYCLES_CAMERA_PT_dof_aperture,
CYCLES_PT_context_material,
CYCLES_OBJECT_PT_motion_blur,
CYCLES_OBJECT_PT_shading,
CYCLES_OBJECT_PT_visibility,
CYCLES_OBJECT_PT_visibility_ray_visibility,
CYCLES_OBJECT_PT_visibility_culling,

View File

@@ -113,6 +113,10 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scen
device = Device::get_multi_device(used_devices, threads, background);
}
/* Else keep using the CPU device that was set before. */
if (!get_boolean(cpreferences, "peer_memory")) {
device.has_peer_memory = false;
}
}
}
@@ -137,10 +141,25 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scen
device.multi_devices.push_back(device);
}
/* Simply use the first available OptiX device. */
const DeviceInfo optix_device = optix_devices.front();
device.id += optix_device.id; /* Uniquely identify this special multi device. */
device.denoising_devices.push_back(optix_device);
/* Try to use the same physical devices for denoising. */
for (const DeviceInfo &cuda_device : device.multi_devices) {
if (cuda_device.type == DEVICE_CUDA) {
for (const DeviceInfo &optix_device : optix_devices) {
if (cuda_device.num == optix_device.num) {
device.id += optix_device.id;
device.denoising_devices.push_back(optix_device);
break;
}
}
}
}
if (device.denoising_devices.empty()) {
/* Simply use the first available OptiX device. */
const DeviceInfo optix_device = optix_devices.front();
device.id += optix_device.id; /* Uniquely identify this special multi device. */
device.denoising_devices.push_back(optix_device);
}
}
}

View File

@@ -238,6 +238,12 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
object_updated = true;
}
float shadow_terminator_offset = get_float(cobject, "shadow_terminator_offset");
if (shadow_terminator_offset != object->shadow_terminator_offset) {
object->shadow_terminator_offset = shadow_terminator_offset;
object_updated = true;
}
/* sync the asset name for Cryptomatte */
BL::Object parent = b_ob.parent();
ustring parent_name;

View File

@@ -416,10 +416,11 @@ static PyObject *available_devices_func(PyObject * /*self*/, PyObject *args)
for (size_t i = 0; i < devices.size(); i++) {
DeviceInfo &device = devices[i];
string type_name = Device::string_from_type(device.type);
PyObject *device_tuple = PyTuple_New(3);
PyObject *device_tuple = PyTuple_New(4);
PyTuple_SET_ITEM(device_tuple, 0, pyunicode_from_string(device.description.c_str()));
PyTuple_SET_ITEM(device_tuple, 1, pyunicode_from_string(type_name.c_str()));
PyTuple_SET_ITEM(device_tuple, 2, pyunicode_from_string(device.id.c_str()));
PyTuple_SET_ITEM(device_tuple, 3, PyBool_FromLong(device.has_peer_memory));
PyTuple_SET_ITEM(ret, i, device_tuple);
}

View File

@@ -168,9 +168,13 @@ void BlenderSession::create_session()
void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsgraph)
{
/* Update data, scene and depsgraph pointers. These can change after undo. */
this->b_data = b_data;
this->b_depsgraph = b_depsgraph;
this->b_scene = b_depsgraph.scene_eval();
if (sync) {
sync->reset(this->b_data, this->b_scene);
}
if (preview_osl) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");

View File

@@ -78,6 +78,14 @@ BlenderSync::~BlenderSync()
{
}
void BlenderSync::reset(BL::BlendData &b_data, BL::Scene &b_scene)
{
/* Update data and scene pointers in case they change in session reset,
* for example after undo. */
this->b_data = b_data;
this->b_scene = b_scene;
}
/* Sync */
void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d)

View File

@@ -61,6 +61,8 @@ class BlenderSync {
Progress &progress);
~BlenderSync();
void reset(BL::BlendData &b_data, BL::Scene &b_scene);
/* sync */
void sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d);
void sync_data(BL::RenderSettings &b_render,

View File

@@ -229,8 +229,6 @@ void BVH::refit_primitives(int start, int end, BoundBox &bbox, uint &visibility)
curve.bounds_grow(k, &hair->curve_keys[0], &hair->curve_radius[0], bbox);
visibility |= PATH_RAY_CURVE;
/* Motion curves. */
if (hair->use_motion_blur) {
Attribute *attr = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
@@ -327,9 +325,6 @@ void BVH::pack_primitives()
pack.prim_tri_index[i] = -1;
}
pack.prim_visibility[i] = ob->visibility_for_tracing();
if (pack.prim_type[i] & PRIMITIVE_ALL_CURVE) {
pack.prim_visibility[i] |= PATH_RAY_CURVE;
}
}
else {
pack.prim_tri_index[i] = -1;

View File

@@ -439,8 +439,6 @@ void BVH8::refit_node(int idx, bool leaf, BoundBox &bbox, uint &visibility)
curve.bounds_grow(k, &hair->curve_keys[0], &hair->curve_radius[0], bbox);
visibility |= PATH_RAY_CURVE;
/* Motion curves. */
if (hair->use_motion_blur) {
Attribute *attr = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);

View File

@@ -885,9 +885,6 @@ BVHNode *BVHBuild::create_leaf_node(const BVHRange &range, const vector<BVHRefer
bounds[type_index].grow(ref.bounds());
visibility[type_index] |= objects[ref.prim_object()]->visibility_for_tracing();
if (ref.prim_type() & PRIMITIVE_ALL_CURVE) {
visibility[type_index] |= PATH_RAY_CURVE;
}
++num_new_prims;
}
else {

View File

@@ -16,11 +16,6 @@
/* This class implements a ray accelerator for Cycles using Intel's Embree library.
* It supports triangles, curves, object and deformation blur and instancing.
* Not supported are thick line segments, those have no native equivalent in Embree.
* They could be implemented using Embree's thick curves, at the expense of wasted memory.
* User defined intersections for Embree could also be an option, but since Embree only uses
* aligned BVHs for user geometry, this would come with reduced performance and/or higher memory
* usage.
*
* Since Embree allows object to be either curves or triangles but not both, Cycles object IDs are
* mapped to Embree IDs by multiplying by two and adding one for curves.
@@ -775,6 +770,21 @@ void BVHEmbree::update_curve_vertex_buffer(RTCGeometry geom_id, const Hair *hair
}
}
}
# if RTC_VERSION >= 30900
if (!use_curves) {
unsigned char *flags = (unsigned char *)rtcSetNewGeometryBuffer(geom_id,
RTC_BUFFER_TYPE_FLAGS,
0,
RTC_FORMAT_UCHAR,
sizeof(unsigned char),
num_keys_embree);
flags[0] = RTC_CURVE_FLAG_NEIGHBOR_RIGHT;
::memset(flags + 1,
RTC_CURVE_FLAG_NEIGHBOR_RIGHT | RTC_CURVE_FLAG_NEIGHBOR_RIGHT,
num_keys_embree - 2);
flags[num_keys_embree - 1] = RTC_CURVE_FLAG_NEIGHBOR_LEFT;
}
# endif
}
void BVHEmbree::add_curves(const Object *ob, const Hair *hair, int i)
@@ -810,10 +820,18 @@ void BVHEmbree::add_curves(const Object *ob, const Hair *hair, int i)
size_t prim_tri_index_size = pack.prim_index.size();
pack.prim_tri_index.resize(prim_tri_index_size + num_segments);
# if RTC_VERSION >= 30900
enum RTCGeometryType type = (!use_curves) ?
(use_ribbons ? RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE :
RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE) :
(use_ribbons ? RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE :
RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE);
# else
enum RTCGeometryType type = (!use_curves) ?
RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE :
(use_ribbons ? RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE :
RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE);
# endif
RTCGeometry geom_id = rtcNewGeometry(rtc_shared_device, type);
rtcSetGeometryTessellationRate(geom_id, curve_subdivisions);

View File

@@ -51,6 +51,7 @@ class CUDADevice : public Device {
size_t map_host_used;
size_t map_host_limit;
int can_map_host;
int pitch_alignment;
int cuDevId;
int cuDevArchitecture;
bool first_error;
@@ -111,6 +112,8 @@ class CUDADevice : public Device {
bool support_device(const DeviceRequestedFeatures & /*requested_features*/);
bool check_peer_access(Device *peer_device);
bool use_adaptive_compilation();
bool use_split_kernel();

View File

@@ -207,6 +207,7 @@ CUDADevice::CUDADevice(DeviceInfo &info, Stats &stats, Profiler &profiler, bool
map_host_limit = 0;
map_host_used = 0;
can_map_host = 0;
pitch_alignment = 0;
functions.loaded = false;
@@ -224,6 +225,9 @@ CUDADevice::CUDADevice(DeviceInfo &info, Stats &stats, Profiler &profiler, bool
cuda_assert(
cuDeviceGetAttribute(&can_map_host, CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, cuDevice));
cuda_assert(cuDeviceGetAttribute(
&pitch_alignment, CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT, cuDevice));
unsigned int ctx_flags = CU_CTX_LMEM_RESIZE_TO_MAX;
if (can_map_host) {
ctx_flags |= CU_CTX_MAP_HOST;
@@ -286,6 +290,49 @@ bool CUDADevice::support_device(const DeviceRequestedFeatures & /*requested_feat
return true;
}
bool CUDADevice::check_peer_access(Device *peer_device)
{
if (peer_device == this) {
return false;
}
if (peer_device->info.type != DEVICE_CUDA && peer_device->info.type != DEVICE_OPTIX) {
return false;
}
CUDADevice *const peer_device_cuda = static_cast<CUDADevice *>(peer_device);
int can_access = 0;
cuda_assert(cuDeviceCanAccessPeer(&can_access, cuDevice, peer_device_cuda->cuDevice));
if (can_access == 0) {
return false;
}
// Ensure array access over the link is possible as well (for 3D textures)
cuda_assert(cuDeviceGetP2PAttribute(&can_access,
CU_DEVICE_P2P_ATTRIBUTE_ARRAY_ACCESS_ACCESS_SUPPORTED,
cuDevice,
peer_device_cuda->cuDevice));
if (can_access == 0) {
return false;
}
// Enable peer access in both directions
{
const CUDAContextScope scope(this);
if (cuda_error(cuCtxEnablePeerAccess(peer_device_cuda->cuContext, 0))) {
return false;
}
}
{
const CUDAContextScope scope(peer_device_cuda);
if (cuda_error(cuCtxEnablePeerAccess(cuContext, 0))) {
return false;
}
}
return true;
}
bool CUDADevice::use_adaptive_compilation()
{
return DebugFlags().cuda.adaptive_compile;
@@ -674,6 +721,12 @@ void CUDADevice::load_texture_info()
void CUDADevice::move_textures_to_host(size_t size, bool for_texture)
{
/* Break out of recursive call, which can happen when moving memory on a multi device. */
static bool any_device_moving_textures_to_host = false;
if (any_device_moving_textures_to_host) {
return;
}
/* Signal to reallocate textures in host memory only. */
move_texture_to_host = true;
@@ -687,6 +740,12 @@ void CUDADevice::move_textures_to_host(size_t size, bool for_texture)
device_memory &mem = *pair.first;
CUDAMem *cmem = &pair.second;
/* Can only move textures allocated on this device (and not those from peer devices).
* And need to ignore memory that is already on the host. */
if (!mem.is_resident(this) || cmem->use_mapped_host) {
continue;
}
bool is_texture = (mem.type == MEM_TEXTURE || mem.type == MEM_GLOBAL) &&
(&mem != &texture_info);
bool is_image = is_texture && (mem.data_height > 1);
@@ -696,11 +755,6 @@ void CUDADevice::move_textures_to_host(size_t size, bool for_texture)
continue;
}
/* Already in host memory. */
if (cmem->use_mapped_host) {
continue;
}
/* For other textures, only move image textures. */
if (for_texture && !is_image) {
continue;
@@ -723,26 +777,30 @@ void CUDADevice::move_textures_to_host(size_t size, bool for_texture)
static thread_mutex move_mutex;
thread_scoped_lock lock(move_mutex);
/* Preserve the original device pointer, in case of multi device
* we can't change it because the pointer mapping would break. */
device_ptr prev_pointer = max_mem->device_pointer;
size_t prev_size = max_mem->device_size;
any_device_moving_textures_to_host = true;
mem_copy_to(*max_mem);
/* Potentially need to call back into multi device, so pointer mapping
* and peer devices are updated. This is also necessary since the device
* pointer may just be a key here, so cannot be accessed and freed directly.
* Unfortunately it does mean that memory is reallocated on all other
* devices as well, which is potentially dangerous when still in use (since
* a thread rendering on another devices would only be caught in this mutex
* if it so happens to do an allocation at the same time as well. */
max_mem->device_copy_to();
size = (max_size >= size) ? 0 : size - max_size;
max_mem->device_pointer = prev_pointer;
max_mem->device_size = prev_size;
any_device_moving_textures_to_host = false;
}
else {
break;
}
}
/* Unset flag before texture info is reloaded, since it should stay in device memory. */
move_texture_to_host = false;
/* Update texture info array with new pointers. */
load_texture_info();
move_texture_to_host = false;
}
CUDADevice::CUDAMem *CUDADevice::generic_alloc(device_memory &mem, size_t pitch_padding)
@@ -808,9 +866,6 @@ CUDADevice::CUDAMem *CUDADevice::generic_alloc(device_memory &mem, size_t pitch_
map_host_used += size;
status = " in host memory";
}
else {
status = " failed, out of host memory";
}
}
if (mem_alloc_result != CUDA_SUCCESS) {
@@ -906,7 +961,7 @@ void CUDADevice::generic_free(device_memory &mem)
}
else {
/* Free device memory. */
cuMemFree(mem.device_pointer);
cuda_assert(cuMemFree(mem.device_pointer));
}
stats.mem_free(mem.device_size);
@@ -1032,18 +1087,17 @@ void CUDADevice::const_copy_to(const char *name, void *host, size_t size)
void CUDADevice::global_alloc(device_memory &mem)
{
CUDAContextScope scope(this);
generic_alloc(mem);
generic_copy_to(mem);
if (mem.is_resident(this)) {
generic_alloc(mem);
generic_copy_to(mem);
}
const_copy_to(mem.name, &mem.device_pointer, sizeof(mem.device_pointer));
}
void CUDADevice::global_free(device_memory &mem)
{
if (mem.device_pointer) {
CUDAContextScope scope(this);
if (mem.is_resident(this) && mem.device_pointer) {
generic_free(mem);
}
}
@@ -1112,7 +1166,19 @@ void CUDADevice::tex_alloc(device_texture &mem)
size_t src_pitch = mem.data_width * dsize * mem.data_elements;
size_t dst_pitch = src_pitch;
if (mem.data_depth > 1) {
if (!mem.is_resident(this)) {
cmem = &cuda_mem_map[&mem];
cmem->texobject = 0;
if (mem.data_depth > 1) {
array_3d = (CUarray)mem.device_pointer;
cmem->array = array_3d;
}
else if (mem.data_height > 0) {
dst_pitch = align_up(src_pitch, pitch_alignment);
}
}
else if (mem.data_depth > 1) {
/* 3D texture using array, there is no API for linear memory. */
CUDA_ARRAY3D_DESCRIPTOR desc;
@@ -1156,10 +1222,7 @@ void CUDADevice::tex_alloc(device_texture &mem)
}
else if (mem.data_height > 0) {
/* 2D texture, using pitch aligned linear memory. */
int alignment = 0;
cuda_assert(
cuDeviceGetAttribute(&alignment, CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT, cuDevice));
dst_pitch = align_up(src_pitch, alignment);
dst_pitch = align_up(src_pitch, pitch_alignment);
size_t dst_size = dst_pitch * mem.data_height;
cmem = generic_alloc(mem, dst_size - mem.memory_size());
@@ -1251,7 +1314,11 @@ void CUDADevice::tex_free(device_texture &mem)
cuTexObjectDestroy(cmem.texobject);
}
if (cmem.array) {
if (!mem.is_resident(this)) {
/* Do not free memory here, since it was allocated on a different device. */
cuda_mem_map.erase(cuda_mem_map.find(&mem));
}
else if (cmem.array) {
/* Free array. */
cuArrayDestroy(cmem.array);
stats.mem_free(mem.device_size);

View File

@@ -602,6 +602,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
info.has_adaptive_stop_per_sample = true;
info.has_osl = true;
info.has_profiling = true;
info.has_peer_memory = false;
foreach (const DeviceInfo &device, subdevices) {
/* Ensure CPU device does not slow down GPU. */
@@ -645,6 +646,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
info.has_adaptive_stop_per_sample &= device.has_adaptive_stop_per_sample;
info.has_osl &= device.has_osl;
info.has_profiling &= device.has_profiling;
info.has_peer_memory |= device.has_peer_memory;
}
return info;

View File

@@ -82,6 +82,7 @@ class DeviceInfo {
bool has_osl; /* Support Open Shading Language. */
bool use_split_kernel; /* Use split or mega kernel. */
bool has_profiling; /* Supports runtime collection of profiling info. */
bool has_peer_memory; /* GPU has P2P access to memory of another GPU. */
int cpu_threads;
vector<DeviceInfo> multi_devices;
vector<DeviceInfo> denoising_devices;
@@ -99,6 +100,7 @@ class DeviceInfo {
has_osl = false;
use_split_kernel = false;
has_profiling = false;
has_peer_memory = false;
}
bool operator==(const DeviceInfo &info)
@@ -435,6 +437,17 @@ class Device {
{
}
virtual bool is_resident(device_ptr /*key*/, Device *sub_device)
{
/* Memory is always resident if this is not a multi device, regardless of whether the pointer
* is valid or not (since it may not have been allocated yet). */
return sub_device == this;
}
virtual bool check_peer_access(Device * /*peer_device*/)
{
return false;
}
/* static */
static Device *create(DeviceInfo &info,
Stats &stats,

View File

@@ -131,6 +131,15 @@ void device_cuda_info(vector<DeviceInfo> &devices)
info.has_volume_decoupled = false;
info.has_adaptive_stop_per_sample = false;
/* Check if the device has P2P access to any other device in the system. */
for (int peer_num = 0; peer_num < count && !info.has_peer_memory; peer_num++) {
if (num != peer_num) {
int can_access = 0;
cuDeviceCanAccessPeer(&can_access, num, peer_num);
info.has_peer_memory = (can_access != 0);
}
}
int pci_location[3] = {0, 0, 0};
cuDeviceGetAttribute(&pci_location[0], CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, num);
cuDeviceGetAttribute(&pci_location[1], CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, num);

View File

@@ -125,6 +125,11 @@ void device_memory::restore_device()
device_pointer = original_device_ptr;
}
bool device_memory::is_resident(Device *sub_device) const
{
return device->is_resident(device_pointer, sub_device);
}
/* Device Sub Ptr */
device_sub_ptr::device_sub_ptr(device_memory &mem, int offset, int size) : device(mem.device)

View File

@@ -230,6 +230,8 @@ class device_memory {
void swap_device(Device *new_device, size_t new_device_size, device_ptr new_device_ptr);
void restore_device();
bool is_resident(Device *sub_device) const;
protected:
friend class CUDADevice;
friend class OptiXDevice;

View File

@@ -34,37 +34,88 @@ CCL_NAMESPACE_BEGIN
class MultiDevice : public Device {
public:
struct SubDevice {
explicit SubDevice(Device *device_) : device(device_)
{
}
Stats stats;
Device *device;
map<device_ptr, device_ptr> ptr_map;
int peer_island_index = -1;
};
list<SubDevice> devices, denoising_devices;
device_ptr unique_key;
vector<vector<SubDevice *>> peer_islands;
bool matching_rendering_and_denoising_devices;
MultiDevice(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background_)
: Device(info, stats, profiler, background_), unique_key(1)
{
foreach (DeviceInfo &subinfo, info.multi_devices) {
Device *device = Device::create(subinfo, sub_stats_, profiler, background);
/* Always add CPU devices at the back since GPU devices can change
* host memory pointers, which CPU uses as device pointer. */
SubDevice *sub;
if (subinfo.type == DEVICE_CPU) {
devices.push_back(SubDevice(device));
devices.emplace_back();
sub = &devices.back();
}
else {
devices.push_front(SubDevice(device));
devices.emplace_front();
sub = &devices.front();
}
/* The pointer to 'sub->stats' will stay valid even after new devices
* are added, since 'devices' is a linked list. */
sub->device = Device::create(subinfo, sub->stats, profiler, background);
}
foreach (DeviceInfo &subinfo, info.denoising_devices) {
Device *device = Device::create(subinfo, sub_stats_, profiler, background);
denoising_devices.emplace_front();
SubDevice *sub = &denoising_devices.front();
denoising_devices.push_back(SubDevice(device));
sub->device = Device::create(subinfo, sub->stats, profiler, background);
}
/* Build a list of peer islands for the available render devices */
foreach (SubDevice &sub, devices) {
/* First ensure that every device is in at least once peer island */
if (sub.peer_island_index < 0) {
peer_islands.emplace_back();
sub.peer_island_index = (int)peer_islands.size() - 1;
peer_islands[sub.peer_island_index].push_back(&sub);
}
if (!info.has_peer_memory) {
continue;
}
/* Second check peer access between devices and fill up the islands accordingly */
foreach (SubDevice &peer_sub, devices) {
if (peer_sub.peer_island_index < 0 &&
peer_sub.device->info.type == sub.device->info.type &&
peer_sub.device->check_peer_access(sub.device)) {
peer_sub.peer_island_index = sub.peer_island_index;
peer_islands[sub.peer_island_index].push_back(&peer_sub);
}
}
}
/* Try to re-use memory when denoising and render devices use the same physical devices
* (e.g. OptiX denoising and CUDA rendering device pointing to the same GPU).
* Ordering has to match as well, so that 'DeviceTask::split' behaves consistent. */
matching_rendering_and_denoising_devices = denoising_devices.empty() ||
(devices.size() == denoising_devices.size());
if (matching_rendering_and_denoising_devices) {
for (list<SubDevice>::iterator device_it = devices.begin(),
denoising_device_it = denoising_devices.begin();
device_it != devices.end() && denoising_device_it != denoising_devices.end();
++device_it, ++denoising_device_it) {
const DeviceInfo &info = device_it->device->info;
const DeviceInfo &denoising_info = denoising_device_it->device->info;
if ((info.type != DEVICE_CUDA && info.type != DEVICE_OPTIX) ||
(denoising_info.type != DEVICE_CUDA && denoising_info.type != DEVICE_OPTIX) ||
info.num != denoising_info.num) {
matching_rendering_and_denoising_devices = false;
break;
}
}
}
#ifdef WITH_NETWORK
@@ -175,11 +226,11 @@ class MultiDevice : public Device {
bool build_optix_bvh(BVH *bvh)
{
// Broadcast acceleration structure build to all render devices
foreach (SubDevice &sub, devices)
/* Broadcast acceleration structure build to all render devices */
foreach (SubDevice &sub, devices) {
if (!sub.device->build_optix_bvh(bvh))
return false;
}
return true;
}
@@ -191,17 +242,82 @@ class MultiDevice : public Device {
return devices.front().device->osl_memory();
}
bool is_resident(device_ptr key, Device *sub_device) override
{
foreach (SubDevice &sub, devices) {
if (sub.device == sub_device) {
return find_matching_mem_device(key, sub)->device == sub_device;
}
}
return false;
}
SubDevice *find_matching_mem_device(device_ptr key, SubDevice &sub)
{
assert(key != 0 && (sub.peer_island_index >= 0 || sub.ptr_map.find(key) != sub.ptr_map.end()));
/* Get the memory owner of this key (first try current device, then peer devices) */
SubDevice *owner_sub = &sub;
if (owner_sub->ptr_map.find(key) == owner_sub->ptr_map.end()) {
foreach (SubDevice *island_sub, peer_islands[sub.peer_island_index]) {
if (island_sub != owner_sub &&
island_sub->ptr_map.find(key) != island_sub->ptr_map.end()) {
owner_sub = island_sub;
}
}
}
return owner_sub;
}
SubDevice *find_suitable_mem_device(device_ptr key, const vector<SubDevice *> &island)
{
assert(!island.empty());
/* Get the memory owner of this key or the device with the lowest memory usage when new */
SubDevice *owner_sub = island.front();
foreach (SubDevice *island_sub, island) {
if (key ? (island_sub->ptr_map.find(key) != island_sub->ptr_map.end()) :
(island_sub->device->stats.mem_used < owner_sub->device->stats.mem_used)) {
owner_sub = island_sub;
}
}
return owner_sub;
}
inline device_ptr find_matching_mem(device_ptr key, SubDevice &sub)
{
return find_matching_mem_device(key, sub)->ptr_map[key];
}
void mem_alloc(device_memory &mem)
{
device_ptr key = unique_key++;
foreach (SubDevice &sub, devices) {
mem.device = sub.device;
mem.device_pointer = 0;
mem.device_size = 0;
if (mem.type == MEM_PIXELS) {
/* Always allocate pixels memory on all devices
* This is necessary to ensure PBOs are registered everywhere, which FILM_CONVERT uses */
foreach (SubDevice &sub, devices) {
mem.device = sub.device;
mem.device_pointer = 0;
mem.device_size = 0;
sub.device->mem_alloc(mem);
sub.ptr_map[key] = mem.device_pointer;
sub.device->mem_alloc(mem);
sub.ptr_map[key] = mem.device_pointer;
}
}
else {
assert(mem.type == MEM_READ_ONLY || mem.type == MEM_READ_WRITE ||
mem.type == MEM_DEVICE_ONLY);
/* The remaining memory types can be distributed across devices */
foreach (const vector<SubDevice *> &island, peer_islands) {
SubDevice *owner_sub = find_suitable_mem_device(key, island);
mem.device = owner_sub->device;
mem.device_pointer = 0;
mem.device_size = 0;
owner_sub->device->mem_alloc(mem);
owner_sub->ptr_map[key] = mem.device_pointer;
}
}
mem.device = this;
@@ -215,13 +331,36 @@ class MultiDevice : public Device {
device_ptr key = (existing_key) ? existing_key : unique_key++;
size_t existing_size = mem.device_size;
foreach (SubDevice &sub, devices) {
mem.device = sub.device;
mem.device_pointer = (existing_key) ? sub.ptr_map[existing_key] : 0;
mem.device_size = existing_size;
/* The tile buffers are allocated on each device (see below), so copy to all of them */
if (strcmp(mem.name, "RenderBuffers") == 0) {
foreach (SubDevice &sub, devices) {
mem.device = sub.device;
mem.device_pointer = (existing_key) ? sub.ptr_map[existing_key] : 0;
mem.device_size = existing_size;
sub.device->mem_copy_to(mem);
sub.ptr_map[key] = mem.device_pointer;
sub.device->mem_copy_to(mem);
sub.ptr_map[key] = mem.device_pointer;
}
}
else {
foreach (const vector<SubDevice *> &island, peer_islands) {
SubDevice *owner_sub = find_suitable_mem_device(existing_key, island);
mem.device = owner_sub->device;
mem.device_pointer = (existing_key) ? owner_sub->ptr_map[existing_key] : 0;
mem.device_size = existing_size;
owner_sub->device->mem_copy_to(mem);
owner_sub->ptr_map[key] = mem.device_pointer;
if (mem.type == MEM_GLOBAL || mem.type == MEM_TEXTURE) {
/* Need to create texture objects and update pointer in kernel globals on all devices */
foreach (SubDevice *island_sub, island) {
if (island_sub != owner_sub) {
island_sub->device->mem_copy_to(mem);
}
}
}
}
}
mem.device = this;
@@ -238,10 +377,11 @@ class MultiDevice : public Device {
int sy = y + i * sub_h;
int sh = (i == (int)devices.size() - 1) ? h - sub_h * i : sub_h;
mem.device = sub.device;
mem.device_pointer = sub.ptr_map[key];
SubDevice *owner_sub = find_matching_mem_device(key, sub);
mem.device = owner_sub->device;
mem.device_pointer = owner_sub->ptr_map[key];
sub.device->mem_copy_from(mem, sy, w, sh, elem);
owner_sub->device->mem_copy_from(mem, sy, w, sh, elem);
i++;
}
@@ -255,23 +395,47 @@ class MultiDevice : public Device {
device_ptr key = (existing_key) ? existing_key : unique_key++;
size_t existing_size = mem.device_size;
foreach (SubDevice &sub, devices) {
mem.device = sub.device;
mem.device_pointer = (existing_key) ? sub.ptr_map[existing_key] : 0;
mem.device_size = existing_size;
sub.device->mem_zero(mem);
sub.ptr_map[key] = mem.device_pointer;
}
/* This is a hack to only allocate the tile buffers on denoising devices
* Similarily the tile buffers also need to be allocated separately on all devices so any
* overlap rendered for denoising does not interfer with each other */
if (strcmp(mem.name, "RenderBuffers") == 0) {
foreach (SubDevice &sub, denoising_devices) {
vector<device_ptr> device_pointers;
device_pointers.reserve(devices.size());
foreach (SubDevice &sub, devices) {
mem.device = sub.device;
mem.device_pointer = (existing_key) ? sub.ptr_map[existing_key] : 0;
mem.device_size = existing_size;
sub.device->mem_zero(mem);
sub.ptr_map[key] = mem.device_pointer;
device_pointers.push_back(mem.device_pointer);
}
foreach (SubDevice &sub, denoising_devices) {
if (matching_rendering_and_denoising_devices) {
sub.ptr_map[key] = device_pointers.front();
device_pointers.erase(device_pointers.begin());
}
else {
mem.device = sub.device;
mem.device_pointer = (existing_key) ? sub.ptr_map[existing_key] : 0;
mem.device_size = existing_size;
sub.device->mem_zero(mem);
sub.ptr_map[key] = mem.device_pointer;
}
}
}
else {
foreach (const vector<SubDevice *> &island, peer_islands) {
SubDevice *owner_sub = find_suitable_mem_device(existing_key, island);
mem.device = owner_sub->device;
mem.device_pointer = (existing_key) ? owner_sub->ptr_map[existing_key] : 0;
mem.device_size = existing_size;
owner_sub->device->mem_zero(mem);
owner_sub->ptr_map[key] = mem.device_pointer;
}
}
@@ -285,17 +449,9 @@ class MultiDevice : public Device {
device_ptr key = mem.device_pointer;
size_t existing_size = mem.device_size;
foreach (SubDevice &sub, devices) {
mem.device = sub.device;
mem.device_pointer = sub.ptr_map[key];
mem.device_size = existing_size;
sub.device->mem_free(mem);
sub.ptr_map.erase(sub.ptr_map.find(key));
}
if (strcmp(mem.name, "RenderBuffers") == 0) {
foreach (SubDevice &sub, denoising_devices) {
/* Free memory that was allocated for all devices (see above) on each device */
if (strcmp(mem.name, "RenderBuffers") == 0 || mem.type == MEM_PIXELS) {
foreach (SubDevice &sub, devices) {
mem.device = sub.device;
mem.device_pointer = sub.ptr_map[key];
mem.device_size = existing_size;
@@ -303,6 +459,39 @@ class MultiDevice : public Device {
sub.device->mem_free(mem);
sub.ptr_map.erase(sub.ptr_map.find(key));
}
foreach (SubDevice &sub, denoising_devices) {
if (matching_rendering_and_denoising_devices) {
sub.ptr_map.erase(key);
}
else {
mem.device = sub.device;
mem.device_pointer = sub.ptr_map[key];
mem.device_size = existing_size;
sub.device->mem_free(mem);
sub.ptr_map.erase(sub.ptr_map.find(key));
}
}
}
else {
foreach (const vector<SubDevice *> &island, peer_islands) {
SubDevice *owner_sub = find_matching_mem_device(key, *island.front());
mem.device = owner_sub->device;
mem.device_pointer = owner_sub->ptr_map[key];
mem.device_size = existing_size;
owner_sub->device->mem_free(mem);
owner_sub->ptr_map.erase(owner_sub->ptr_map.find(key));
if (mem.type == MEM_TEXTURE) {
/* Free texture objects on all devices */
foreach (SubDevice *island_sub, island) {
if (island_sub != owner_sub) {
island_sub->device->mem_free(mem);
}
}
}
}
}
mem.device = this;
@@ -330,6 +519,8 @@ class MultiDevice : public Device {
bool transparent,
const DeviceDrawParams &draw_params)
{
assert(rgba.type == MEM_PIXELS);
device_ptr key = rgba.device_pointer;
int i = 0, sub_h = h / devices.size();
int sub_height = height / devices.size();
@@ -358,7 +549,7 @@ class MultiDevice : public Device {
foreach (SubDevice &sub, devices) {
if (sub.device == sub_device) {
tile.buffer = sub.ptr_map[tile.buffer];
tile.buffer = find_matching_mem(tile.buffer, sub);
return;
}
}
@@ -400,7 +591,7 @@ class MultiDevice : public Device {
device_vector<float> &mem = tiles[i].buffers->buffer;
tiles[i].buffer = mem.device_pointer;
if (mem.device == this && denoising_devices.empty()) {
if (mem.device == this && matching_rendering_and_denoising_devices) {
/* Skip unnecessary copies in viewport mode (buffer covers the
* whole image), but still need to fix up the tile device pointer. */
map_tile(sub_device, tiles[i]);
@@ -444,7 +635,7 @@ class MultiDevice : public Device {
{
device_vector<float> &mem = tiles[9].buffers->buffer;
if (mem.device == this && denoising_devices.empty()) {
if (mem.device == this && matching_rendering_and_denoising_devices) {
return;
}
@@ -518,17 +709,22 @@ class MultiDevice : public Device {
tasks.pop_front();
if (task.buffer)
subtask.buffer = sub.ptr_map[task.buffer];
subtask.buffer = find_matching_mem(task.buffer, sub);
if (task.rgba_byte)
subtask.rgba_byte = sub.ptr_map[task.rgba_byte];
if (task.rgba_half)
subtask.rgba_half = sub.ptr_map[task.rgba_half];
if (task.shader_input)
subtask.shader_input = sub.ptr_map[task.shader_input];
subtask.shader_input = find_matching_mem(task.shader_input, sub);
if (task.shader_output)
subtask.shader_output = sub.ptr_map[task.shader_output];
subtask.shader_output = find_matching_mem(task.shader_output, sub);
sub.device->task_add(subtask);
if (task.buffers && task.buffers->buffer.device == this) {
/* Synchronize access to RenderBuffers, since 'map_neighbor_tiles' is not thread-safe. */
sub.device->task_wait();
}
}
}
}
@@ -548,9 +744,6 @@ class MultiDevice : public Device {
foreach (SubDevice &sub, denoising_devices)
sub.device->task_cancel();
}
protected:
Stats sub_stats_;
};
Device *device_multi_create(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background)

View File

@@ -924,7 +924,8 @@ class OptiXDevice : public CUDADevice {
&rtiles[9].h,
&rtiles[9].offset,
&rtiles[9].stride,
&task.pass_stride};
&task.pass_stride,
&rtile.sample};
launch_filter_kernel(
"kernel_cuda_filter_convert_from_rgb", rtiles[9].w, rtiles[9].h, output_args);
# endif
@@ -1536,34 +1537,22 @@ bool device_optix_init()
void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo> &devices)
{
devices.reserve(cuda_devices.size());
// Simply add all supported CUDA devices as OptiX devices again
for (const DeviceInfo &cuda_info : cuda_devices) {
DeviceInfo info = cuda_info;
for (DeviceInfo info : cuda_devices) {
assert(info.type == DEVICE_CUDA);
int major;
cuDeviceGetAttribute(&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, info.num);
if (major < 5) {
continue; // Only Maxwell and up are supported by OptiX
}
info.type = DEVICE_OPTIX;
info.id += "_OptiX";
// Figure out RTX support
CUdevice cuda_device = 0;
CUcontext cuda_context = NULL;
unsigned int rtcore_version = 0;
if (cuDeviceGet(&cuda_device, info.num) == CUDA_SUCCESS &&
cuDevicePrimaryCtxRetain(&cuda_context, cuda_device) == CUDA_SUCCESS) {
OptixDeviceContext optix_context = NULL;
if (optixDeviceContextCreate(cuda_context, nullptr, &optix_context) == OPTIX_SUCCESS) {
optixDeviceContextGetProperty(optix_context,
OPTIX_DEVICE_PROPERTY_RTCORE_VERSION,
&rtcore_version,
sizeof(rtcore_version));
optixDeviceContextDestroy(optix_context);
}
cuDevicePrimaryCtxRelease(cuda_device);
}
// Only add devices with RTX support
if (rtcore_version != 0 || getenv("CYCLES_OPTIX_TEST")) {
devices.push_back(info);
}
devices.push_back(info);
}
}

View File

@@ -44,7 +44,8 @@ DeviceTask::DeviceTask(Type type_)
shader_eval_type(0),
shader_filter(0),
shader_x(0),
shader_w(0)
shader_w(0),
buffers(nullptr)
{
last_update_time = time_dt();
}

View File

@@ -300,7 +300,9 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals *kg,
// Is set to zero on miss or if ray is aborted, so can be used as return value
uint p5 = max_hits;
local_isect->num_hits = 0; // Initialize hit count to zero
if (local_isect) {
local_isect->num_hits = 0; // Initialize hit count to zero
}
optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0,
ray->P,
ray->D,
@@ -323,7 +325,9 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals *kg,
return p5;
# else /* __KERNEL_OPTIX__ */
if (!scene_intersect_valid(ray)) {
local_isect->num_hits = 0;
if (local_isect) {
local_isect->num_hits = 0;
}
return false;
}

View File

@@ -97,6 +97,18 @@ ccl_device_inline float bump_shadowing_term(float3 Ng, float3 N, float3 I)
return -g2 * g + g2 + g;
}
/* Shadow terminator workaround, taken from Appleseed.
* Original code is under the MIT License
* Copyright (c) 2019 Francois Beaune, The appleseedhq Organization */
ccl_device_inline float shift_cos_in(float cos_in, const float frequency_multiplier)
{
cos_in = min(cos_in, 1.0f);
const float angle = fast_acosf(cos_in);
const float val = max(cosf(angle * frequency_multiplier), 0.0f) / cos_in;
return val;
}
ccl_device_inline int bsdf_sample(KernelGlobals *kg,
ShaderData *sd,
const ShaderClosure *sc,
@@ -444,9 +456,17 @@ ccl_device_inline int bsdf_sample(KernelGlobals *kg,
}
}
}
else if (label & LABEL_DIFFUSE) {
if (!isequal_float3(sc->N, sd->N)) {
*eval *= bump_shadowing_term((label & LABEL_TRANSMIT) ? -sd->N : sd->N, sc->N, *omega_in);
else {
/* Shadow terminator offset. */
const float frequency_multiplier =
kernel_tex_fetch(__objects, sd->object).shadow_terminator_offset;
if (frequency_multiplier > 1.0f) {
*eval *= shift_cos_in(dot(*omega_in, sc->N), frequency_multiplier);
}
if (label & LABEL_DIFFUSE) {
if (!isequal_float3(sc->N, sd->N)) {
*eval *= bump_shadowing_term((label & LABEL_TRANSMIT) ? -sd->N : sd->N, sc->N, *omega_in);
}
}
}
@@ -561,6 +581,12 @@ ccl_device_inline
eval *= bump_shadowing_term(sd->N, sc->N, omega_in);
}
}
/* Shadow terminator offset. */
const float frequency_multiplier =
kernel_tex_fetch(__objects, sd->object).shadow_terminator_offset;
if (frequency_multiplier > 1.0f) {
eval *= shift_cos_in(dot(omega_in, sc->N), frequency_multiplier);
}
}
else {
switch (sc->type) {

View File

@@ -185,19 +185,19 @@ ccl_device bool kernel_do_adaptive_filter_x(KernelGlobals *kg, int y, ccl_global
ccl_global float *buffer = tile->buffer + index * kernel_data.film.pass_stride;
ccl_global float4 *aux = (ccl_global float4 *)(buffer +
kernel_data.film.pass_adaptive_aux_buffer);
if (aux->w == 0.0f) {
if ((*aux).w == 0.0f) {
any = true;
if (x > tile->x && !prev) {
index = index - 1;
buffer = tile->buffer + index * kernel_data.film.pass_stride;
aux = (ccl_global float4 *)(buffer + kernel_data.film.pass_adaptive_aux_buffer);
aux->w = 0.0f;
(*aux).w = 0.0f;
}
prev = true;
}
else {
if (prev) {
aux->w = 0.0f;
(*aux).w = 0.0f;
}
prev = false;
}
@@ -214,19 +214,19 @@ ccl_device bool kernel_do_adaptive_filter_y(KernelGlobals *kg, int x, ccl_global
ccl_global float *buffer = tile->buffer + index * kernel_data.film.pass_stride;
ccl_global float4 *aux = (ccl_global float4 *)(buffer +
kernel_data.film.pass_adaptive_aux_buffer);
if (aux->w == 0.0f) {
if ((*aux).w == 0.0f) {
any = true;
if (y > tile->y && !prev) {
index = index - tile->stride;
buffer = tile->buffer + index * kernel_data.film.pass_stride;
aux = (ccl_global float4 *)(buffer + kernel_data.film.pass_adaptive_aux_buffer);
aux->w = 0.0f;
(*aux).w = 0.0f;
}
prev = true;
}
else {
if (prev) {
aux->w = 0.0f;
(*aux).w = 0.0f;
}
prev = false;
}

View File

@@ -441,8 +441,22 @@ ccl_device_inline float camera_distance(KernelGlobals *kg, float3 P)
float3 camD = make_float3(cameratoworld.x.z, cameratoworld.y.z, cameratoworld.z.z);
return fabsf(dot((P - camP), camD));
}
else
else {
return len(P - camP);
}
}
ccl_device_inline float camera_z_depth(KernelGlobals *kg, float3 P)
{
if (kernel_data.cam.type != CAMERA_PANORAMA) {
Transform worldtocamera = kernel_data.cam.worldtocamera;
return transform_point(&worldtocamera, P).z;
}
else {
Transform cameratoworld = kernel_data.cam.cameratoworld;
float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
return len(P - camP);
}
}
ccl_device_inline float3 camera_direction_from_point(KernelGlobals *kg, float3 P)

View File

@@ -249,13 +249,13 @@ ccl_device float3 background_map_sample(KernelGlobals *kg, float randu, float ra
float u = (index_u + du) / res_x;
/* compute pdf */
float denom = cdf_last_u.x * cdf_last_v.x;
float sin_theta = sinf(M_PI_F * v);
float denom = (M_2PI_F * M_PI_F * sin_theta) * cdf_last_u.x * cdf_last_v.x;
if (sin_theta == 0.0f || denom == 0.0f)
*pdf = 0.0f;
else
*pdf = (cdf_u.x * cdf_v.x) / (M_2PI_F * M_PI_F * sin_theta * denom);
*pdf = (cdf_u.x * cdf_v.x) / denom;
/* compute direction */
return equirectangular_to_direction(u, v);
@@ -284,7 +284,7 @@ ccl_device float background_map_pdf(KernelGlobals *kg, float3 direction)
index_v * cdf_width + res_x);
float2 cdf_last_v = kernel_tex_fetch(__light_background_marginal_cdf, res_y);
float denom = cdf_last_u.x * cdf_last_v.x;
float denom = (M_2PI_F * M_PI_F * sin_theta) * cdf_last_u.x * cdf_last_v.x;
if (denom == 0.0f)
return 0.0f;
@@ -294,7 +294,7 @@ ccl_device float background_map_pdf(KernelGlobals *kg, float3 direction)
index_v * cdf_width + index_u);
float2 cdf_v = kernel_tex_fetch(__light_background_marginal_cdf, index_v);
return (cdf_u.x * cdf_v.x) / (M_2PI_F * M_PI_F * sin_theta * denom);
return (cdf_u.x * cdf_v.x) / denom;
}
ccl_device_inline bool background_portal_data_fetch_and_check_side(

View File

@@ -85,8 +85,9 @@ ccl_device_inline void sample_uniform_hemisphere(
ccl_device_inline void sample_uniform_cone(
const float3 N, float angle, float randu, float randv, float3 *omega_in, float *pdf)
{
float z = cosf(angle * randu);
float r = sqrtf(max(0.0f, 1.0f - z * z));
float zMin = cosf(angle);
float z = zMin - zMin * randu + randu;
float r = safe_sqrtf(1.0f - sqr(z));
float phi = M_2PI_F * randv;
float x = r * cosf(phi);
float y = r * sinf(phi);
@@ -94,7 +95,7 @@ ccl_device_inline void sample_uniform_cone(
float3 T, B;
make_orthonormals(N, &T, &B);
*omega_in = x * T + y * B + z * N;
*pdf = 0.5f * M_1_PI_F / (1.0f - cosf(angle));
*pdf = M_1_2PI_F / (1.0f - zMin);
}
/* sample uniform point on the surface of a sphere */

View File

@@ -194,7 +194,7 @@ ccl_device_inline void kernel_write_data_passes(KernelGlobals *kg,
average(shader_bsdf_alpha(kg, sd)) >= kernel_data.film.pass_alpha_threshold) {
if (state->sample == 0) {
if (flag & PASSMASK(DEPTH)) {
float depth = camera_distance(kg, sd->P);
float depth = camera_z_depth(kg, sd->P);
kernel_write_pass_float(buffer + kernel_data.film.pass_depth, depth);
}
if (flag & PASSMASK(OBJECT_ID)) {

View File

@@ -662,7 +662,7 @@ ccl_device void kernel_path_trace(
if (kernel_data.film.pass_adaptive_aux_buffer) {
ccl_global float4 *aux = (ccl_global float4 *)(buffer +
kernel_data.film.pass_adaptive_aux_buffer);
if (aux->w > 0.0f) {
if ((*aux).w > 0.0f) {
return;
}
}

View File

@@ -526,7 +526,7 @@ ccl_device void kernel_branched_path_trace(
if (kernel_data.film.pass_adaptive_aux_buffer) {
ccl_global float4 *aux = (ccl_global float4 *)(buffer +
kernel_data.film.pass_adaptive_aux_buffer);
if (aux->w > 0.0f) {
if ((*aux).w > 0.0f) {
return;
}
}

View File

@@ -273,6 +273,7 @@ enum SamplingPattern {
/* these flags values correspond to raytypes in osl.cpp, so keep them in sync! */
enum PathRayFlag {
/* Ray visibility. */
PATH_RAY_CAMERA = (1 << 0),
PATH_RAY_REFLECT = (1 << 1),
PATH_RAY_TRANSMIT = (1 << 2),
@@ -281,6 +282,7 @@ enum PathRayFlag {
PATH_RAY_SINGULAR = (1 << 5),
PATH_RAY_TRANSPARENT = (1 << 6),
/* Shadow ray visibility. */
PATH_RAY_SHADOW_OPAQUE_NON_CATCHER = (1 << 7),
PATH_RAY_SHADOW_OPAQUE_CATCHER = (1 << 8),
PATH_RAY_SHADOW_OPAQUE = (PATH_RAY_SHADOW_OPAQUE_NON_CATCHER | PATH_RAY_SHADOW_OPAQUE_CATCHER),
@@ -292,8 +294,11 @@ enum PathRayFlag {
PATH_RAY_SHADOW_TRANSPARENT_NON_CATCHER),
PATH_RAY_SHADOW = (PATH_RAY_SHADOW_OPAQUE | PATH_RAY_SHADOW_TRANSPARENT),
PATH_RAY_CURVE = (1 << 11), /* visibility flag to define curve segments */
PATH_RAY_VOLUME_SCATTER = (1 << 12), /* volume scattering */
/* Unused, free to reuse. */
PATH_RAY_UNUSED = (1 << 11),
/* Ray visibility for volume scattering. */
PATH_RAY_VOLUME_SCATTER = (1 << 12),
/* Special flag to tag unaligned BVH nodes. */
PATH_RAY_NODE_UNALIGNED = (1 << 13),
@@ -1480,6 +1485,9 @@ typedef struct KernelObject {
float cryptomatte_object;
float cryptomatte_asset;
float shadow_terminator_offset;
float pad1, pad2, pad3;
} KernelObject;
static_assert_align(KernelObject, 16);

View File

@@ -99,7 +99,7 @@ ccl_device bool get_next_work(KernelGlobals *kg,
ccl_global float *buffer = kernel_split_params.tile.buffer + buffer_offset;
ccl_global float4 *aux = (ccl_global float4 *)(buffer +
kernel_data.film.pass_adaptive_aux_buffer);
if (aux->w == 0.0f) {
if ((*aux).w == 0.0f) {
break;
}
}

View File

@@ -57,9 +57,9 @@ kernel_cuda_filter_convert_to_rgb(float *rgb, float *buf, int sw, int sh, int st
if (num_inputs > 0) {
float *in = buf + x * pass_stride + (y * stride + pass_offset.x) / sizeof(float);
float *out = rgb + (x + y * sw) * 3;
out[0] = clamp(in[0], 0.0f, 10000.0f);
out[1] = clamp(in[1], 0.0f, 10000.0f);
out[2] = clamp(in[2], 0.0f, 10000.0f);
out[0] = clamp(in[0] / num_samples, 0.0f, 10000.0f);
out[1] = clamp(in[1] / num_samples, 0.0f, 10000.0f);
out[2] = clamp(in[2] / num_samples, 0.0f, 10000.0f);
}
if (num_inputs > 1) {
float *in = buf + x * pass_stride + (y * stride + pass_offset.y) / sizeof(float);
@@ -80,16 +80,16 @@ kernel_cuda_filter_convert_to_rgb(float *rgb, float *buf, int sw, int sh, int st
extern "C" __global__ void
CUDA_LAUNCH_BOUNDS(CUDA_THREADS_BLOCK_WIDTH, CUDA_KERNEL_MAX_REGISTERS)
kernel_cuda_filter_convert_from_rgb(float *rgb, float *buf, int ix, int iy, int iw, int ih, int sx, int sy, int sw, int sh, int offset, int stride, int pass_stride)
kernel_cuda_filter_convert_from_rgb(float *rgb, float *buf, int ix, int iy, int iw, int ih, int sx, int sy, int sw, int sh, int offset, int stride, int pass_stride, int num_samples)
{
int x = blockDim.x*blockIdx.x + threadIdx.x;
int y = blockDim.y*blockIdx.y + threadIdx.y;
if(x < sw && y < sh) {
float *in = rgb + ((ix + x) + (iy + y) * iw) * 3;
float *out = buf + (offset + (sx + x) + (sy + y) * stride) * pass_stride;
out[0] = in[0];
out[1] = in[1];
out[2] = in[2];
out[0] = in[0] * num_samples;
out[1] = in[1] * num_samples;
out[2] = in[2] * num_samples;
}
}

View File

@@ -120,6 +120,7 @@ NODE_DEFINE(Light)
SOCKET_VECTOR(dir, "Dir", make_float3(0.0f, 0.0f, 0.0f));
SOCKET_FLOAT(size, "Size", 0.0f);
SOCKET_FLOAT(angle, "Angle", 0.0f);
SOCKET_VECTOR(axisu, "Axis U", make_float3(0.0f, 0.0f, 0.0f));
SOCKET_FLOAT(sizeu, "Size U", 1.0f);
@@ -183,6 +184,8 @@ LightManager::LightManager()
need_update = true;
need_update_background = true;
use_light_visibility = false;
last_background_enabled = false;
last_background_resolution = 0;
}
LightManager::~LightManager()
@@ -202,7 +205,7 @@ bool LightManager::has_background_light(Scene *scene)
return false;
}
void LightManager::disable_ineffective_light(Scene *scene)
void LightManager::test_enabled_lights(Scene *scene)
{
/* Make all lights enabled by default, and perform some preliminary checks
* needed for finer-tuning of settings (for example, check whether we've
@@ -215,6 +218,9 @@ void LightManager::disable_ineffective_light(Scene *scene)
has_background |= light->type == LIGHT_BACKGROUND;
}
bool background_enabled = false;
int background_resolution = 0;
if (has_background) {
/* Ignore background light if:
* - If unsupported on a device
@@ -226,9 +232,18 @@ void LightManager::disable_ineffective_light(Scene *scene)
foreach (Light *light, scene->lights) {
if (light->type == LIGHT_BACKGROUND) {
light->is_enabled = !disable_mis;
background_enabled = !disable_mis;
background_resolution = light->map_resolution;
}
}
}
if (last_background_enabled != background_enabled ||
last_background_resolution != background_resolution) {
last_background_enabled = background_enabled;
last_background_resolution = background_resolution;
need_update_background = true;
}
}
bool LightManager::object_usable_as_light(Object *object)
@@ -902,12 +917,13 @@ void LightManager::device_update(Device *device,
VLOG(1) << "Total " << scene->lights.size() << " lights.";
/* Detect which lights are enabled, also determins if we need to update the background. */
test_enabled_lights(scene);
device_free(device, dscene, need_update_background);
use_light_visibility = false;
disable_ineffective_light(scene);
device_update_points(device, dscene, scene);
if (progress.get_cancel())
return;

View File

@@ -112,7 +112,7 @@ class LightManager {
* which doesn't contribute to the scene or which is only used for MIS
* and scene doesn't need MIS.
*/
void disable_ineffective_light(Scene *scene);
void test_enabled_lights(Scene *scene);
void device_update_points(Device *device, DeviceScene *dscene, Scene *scene);
void device_update_distribution(Device *device,
@@ -136,6 +136,9 @@ class LightManager {
vector<IESSlot *> ies_slots;
thread_mutex ies_mutex;
bool last_background_enabled;
int last_background_resolution;
};
CCL_NAMESPACE_END

View File

@@ -101,6 +101,7 @@ NODE_DEFINE(Object)
SOCKET_POINT(dupli_generated, "Dupli Generated", make_float3(0.0f, 0.0f, 0.0f));
SOCKET_POINT2(dupli_uv, "Dupli UV", make_float2(0.0f, 0.0f));
SOCKET_TRANSFORM_ARRAY(motion, "Motion", array<Transform>());
SOCKET_FLOAT(shadow_terminator_offset, "Terminator Offset", 0.0f);
SOCKET_BOOLEAN(is_shadow_catcher, "Shadow Catcher", false);
@@ -534,6 +535,7 @@ void ObjectManager::device_update_object_transform(UpdateObjectTransformState *s
uint32_t hash_asset = util_murmur_hash3(ob->asset_name.c_str(), ob->asset_name.length(), 0);
kobject.cryptomatte_object = util_hash_to_float(hash_name);
kobject.cryptomatte_asset = util_hash_to_float(hash_asset);
kobject.shadow_terminator_offset = 1.0f / (1.0f - 0.5f * ob->shadow_terminator_offset);
/* Object flag. */
if (ob->use_holdout) {

View File

@@ -59,6 +59,7 @@ class Object : public Node {
bool hide_on_missing_motion;
bool use_holdout;
bool is_shadow_catcher;
float shadow_terminator_offset;
float3 dupli_generated;
float2 dupli_uv;

View File

@@ -436,6 +436,12 @@ bool Session::acquire_tile(RenderTile &rtile, Device *tile_device, uint tile_typ
/* Reset copy state, since buffer contents change after the tile was acquired */
buffers->map_neighbor_copied = false;
/* This hack ensures that the copy in 'MultiDevice::map_neighbor_tiles' accounts
* for the buffer resolution divider. */
buffers->buffer.data_width = (buffers->params.width * buffers->params.get_passes_size()) /
tile_manager.state.resolution_divider;
buffers->buffer.data_height = buffers->params.height / tile_manager.state.resolution_divider;
return true;
}
@@ -1125,13 +1131,6 @@ bool Session::render_need_denoise(bool &delayed)
return false;
}
/* Cannot denoise with resolution divider and separate denoising devices.
* It breaks the copy in 'MultiDevice::map_neighbor_tiles' (which operates on
* the full buffer dimensions and not the scaled ones). */
if (!params.device.denoising_devices.empty() && tile_manager.state.resolution_divider > 1) {
return false;
}
/* Avoid excessive denoising in viewport after reaching a certain amount of samples. */
delayed = (tile_manager.state.sample >= 20 &&
(time_dt() - last_display_time) < params.progressive_update_timeout);

View File

@@ -18,6 +18,7 @@
#define __UTIL_GUARDED_ALLOCATOR_H__
#include <cstddef>
#include <cstdlib>
#include <memory>
#ifdef WITH_BLENDER_GUARDEDALLOC

View File

@@ -435,7 +435,7 @@ extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
***************************************************************************************/
/**
* Returns the state of a modifier key (ouside the message queue).
* Returns the state of a modifier key (outside the message queue).
* \param systemhandle The handle to the system
* \param mask The modifier key state to retrieve.
* \param isDown Pointer to return modifier state in.
@@ -446,7 +446,7 @@ extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
int *isDown);
/**
* Returns the state of a mouse button (ouside the message queue).
* Returns the state of a mouse button (outside the message queue).
* \param systemhandle The handle to the system
* \param mask The button state to retrieve.
* \param isDown Pointer to return button state in.

View File

@@ -382,7 +382,7 @@ class GHOST_ISystem {
***************************************************************************************/
/**
* Returns the state of a modifier key (ouside the message queue).
* Returns the state of a modifier key (outside the message queue).
* \param mask The modifier key state to retrieve.
* \param isDown The state of a modifier key (true == pressed).
* \return Indication of success.
@@ -390,7 +390,7 @@ class GHOST_ISystem {
virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const = 0;
/**
* Returns the state of a mouse button (ouside the message queue).
* Returns the state of a mouse button (outside the message queue).
* \param mask The button state to retrieve.
* \param isDown Button state.
* \return Indication of success.

View File

@@ -48,14 +48,6 @@ class GHOST_Rect {
{
}
/**
* Copy constructor.
* \param r rectangle to copy
*/
GHOST_Rect(const GHOST_Rect &r) : m_l(r.m_l), m_t(r.m_t), m_r(r.m_r), m_b(r.m_b)
{
}
/**
* Destructor.
*/

View File

@@ -219,7 +219,7 @@ class GHOST_System : public GHOST_ISystem {
***************************************************************************************/
/**
* Returns the state of a modifier key (ouside the message queue).
* Returns the state of a modifier key (outside the message queue).
* \param mask The modifier key state to retrieve.
* \param isDown The state of a modifier key (true == pressed).
* \return Indication of success.
@@ -227,7 +227,7 @@ class GHOST_System : public GHOST_ISystem {
GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const;
/**
* Returns the state of a mouse button (ouside the message queue).
* Returns the state of a mouse button (outside the message queue).
* \param mask The button state to retrieve.
* \param isDown Button state.
* \return Indication of success.
@@ -247,8 +247,8 @@ class GHOST_System : public GHOST_ISystem {
***************************************************************************************/
/**
* Sets 3D mouse deadzone
* \param deadzone: Deadzone of the 3D mouse (both for rotation and pan) relative to full range
* Sets 3D mouse dead-zone
* \param deadzone: Dead-zone of the 3D mouse (both for rotation and pan) relative to full range.
*/
void setNDOFDeadZone(float deadzone);
#endif
@@ -295,7 +295,7 @@ class GHOST_System : public GHOST_ISystem {
virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const = 0;
/**
* Returns the state of the mouse buttons (ouside the message queue).
* Returns the state of the mouse buttons (outside the message queue).
* \param buttons The state of the buttons.
* \return Indication of success.
*/

View File

@@ -198,7 +198,7 @@ class GHOST_SystemCocoa : public GHOST_System {
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const;
/**
* Returns the state of the mouse buttons (ouside the message queue).
* Returns the state of the mouse buttons (outside the message queue).
* \param buttons The state of the buttons.
* \return Indication of success.
*/

View File

@@ -1527,7 +1527,7 @@ GHOST_IWindow *GHOST_SystemWayland::createWindow(const char *title,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
const bool exclusive,
const bool /*is_dialog*/,
const bool is_dialog,
const GHOST_IWindow *parentWindow)
{
GHOST_WindowWayland *window = new GHOST_WindowWayland(
@@ -1540,6 +1540,7 @@ GHOST_IWindow *GHOST_SystemWayland::createWindow(const char *title,
state,
parentWindow,
type,
is_dialog,
((glSettings.flags & GHOST_glStereoVisual) != 0),
exclusive);

View File

@@ -212,7 +212,7 @@ class GHOST_SystemWin32 : public GHOST_System {
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const;
/**
* Returns the state of the mouse buttons (ouside the message queue).
* Returns the state of the mouse buttons (outside the message queue).
* \param buttons The state of the buttons.
* \return Indication of success.
*/

View File

@@ -182,7 +182,7 @@ class GHOST_SystemX11 : public GHOST_System {
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const;
/**
* Returns the state of the mouse buttons (ouside the message queue).
* Returns the state of the mouse buttons (outside the message queue).
* \param buttons The state of the buttons.
* \return Indication of success.
*/
@@ -211,7 +211,7 @@ class GHOST_SystemX11 : public GHOST_System {
}
#endif
/* Helped function for get data from the clipboard. */
/** Helped function for get data from the clipboard. */
void getClipboard_xcout(const XEvent *evt,
Atom sel,
Atom target,
@@ -337,7 +337,7 @@ class GHOST_SystemX11 : public GHOST_System {
private:
Display *m_display;
/* Use for scancode lookups. */
/** Use for scan-code look-ups. */
XkbDescRec *m_xkb_descr;
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
@@ -349,20 +349,22 @@ class GHOST_SystemX11 : public GHOST_System {
std::vector<GHOST_TabletX11> m_xtablets;
#endif
/// The vector of windows that need to be updated.
/** The vector of windows that need to be updated. */
std::vector<GHOST_WindowX11 *> m_dirty_windows;
/// Start time at initialization.
/** Start time at initialization. */
GHOST_TUns64 m_start_time;
/// A vector of keyboard key masks
/** A vector of keyboard key masks. */
char m_keyboard_vector[32];
/* to prevent multiple warp, we store the time of the last warp event
* and stop accumulating all events generated before that */
/**
* To prevent multiple warp, we store the time of the last warp event
* and stop accumulating all events generated before that.
*/
Time m_last_warp;
/* detect autorepeat glitch */
/* Detect auto-repeat glitch. */
unsigned int m_last_release_keycode;
Time m_last_release_time;

View File

@@ -39,6 +39,7 @@ struct window_t {
bool is_maximised;
bool is_fullscreen;
bool is_active;
bool is_dialog;
int32_t width, height;
};
@@ -144,6 +145,7 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
GHOST_TWindowState state,
const GHOST_IWindow *parentWindow,
GHOST_TDrawingContextType type,
const bool is_dialog,
const bool stereoVisual,
const bool exclusive)
: GHOST_Window(width, height, state, stereoVisual, exclusive),
@@ -155,6 +157,8 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
w->width = int32_t(width);
w->height = int32_t(height);
w->is_dialog = is_dialog;
/* Window surfaces. */
w->surface = wl_compositor_create_surface(m_system->compositor());
w->egl_window = wl_egl_window_create(w->surface, int(width), int(height));
@@ -376,6 +380,11 @@ GHOST_TSuccess GHOST_WindowWayland::endFullScreen() const
return GHOST_kSuccess;
}
bool GHOST_WindowWayland::isDialog() const
{
return w->is_dialog;
}
/**
* \param type The type of rendering context create.
* \return Indication of success.

View File

@@ -42,6 +42,7 @@ class GHOST_WindowWayland : public GHOST_Window {
GHOST_TWindowState state,
const GHOST_IWindow *parentWindow,
GHOST_TDrawingContextType type,
const bool is_dialog,
const bool stereoVisual,
const bool exclusive);
@@ -106,6 +107,8 @@ class GHOST_WindowWayland : public GHOST_Window {
GHOST_TSuccess endFullScreen() const override;
bool isDialog() const override;
private:
GHOST_SystemWayland *m_system;
struct window_t *w;

View File

@@ -181,7 +181,7 @@ class GHOST_XrGraphicsBindingOpenGL : public GHOST_IXrGraphicsBinding {
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
bool needsUpsideDownDrawing(GHOST_Context &ghost_ctx) const
bool needsUpsideDownDrawing(GHOST_Context &ghost_ctx) const override
{
return ghost_ctx.isUpsideDown();
}

View File

@@ -858,23 +858,144 @@ void MANTA::initializeRNAMap(FluidModifierData *mmd)
mRNAMap["GRAVITY_Y"] = to_string(mds->gravity[1]);
mRNAMap["GRAVITY_Z"] = to_string(mds->gravity[2]);
mRNAMap["CACHE_DIR"] = cacheDirectory;
mRNAMap["NAME_DENSITY"] = FLUID_GRIDNAME_DENSITY;
mRNAMap["NAME_SHADOW"] = FLUID_GRIDNAME_SHADOW;
mRNAMap["NAME_HEAT"] = FLUID_GRIDNAME_HEAT;
mRNAMap["NAME_VELOCITY"] = FLUID_GRIDNAME_VELOCITY;
mRNAMap["NAME_COLORR"] = FLUID_GRIDNAME_COLORR;
mRNAMap["NAME_COLORG"] = FLUID_GRIDNAME_COLORG;
mRNAMap["NAME_COLORB"] = FLUID_GRIDNAME_COLORB;
mRNAMap["NAME_FLAME"] = FLUID_GRIDNAME_FLAME;
mRNAMap["NAME_FUEL"] = FLUID_GRIDNAME_FUEL;
mRNAMap["NAME_REACT"] = FLUID_GRIDNAME_REACT;
mRNAMap["NAME_DENSITYNOISE"] = FLUID_GRIDNAME_DENSITYNOISE;
mRNAMap["NAME_COLORRNOISE"] = FLUID_GRIDNAME_COLORRNOISE;
mRNAMap["NAME_COLORGNOISE"] = FLUID_GRIDNAME_COLORGNOISE;
mRNAMap["NAME_COLORBNOISE"] = FLUID_GRIDNAME_COLORBNOISE;
mRNAMap["NAME_FLAMENOISE"] = FLUID_GRIDNAME_FLAMENOISE;
mRNAMap["NAME_FUELNOISE"] = FLUID_GRIDNAME_FUELNOISE;
mRNAMap["NAME_REACTNOISE"] = FLUID_GRIDNAME_REACTNOISE;
/* Fluid object names. */
mRNAMap["NAME_FLAGS"] = FLUID_NAME_FLAGS;
mRNAMap["NAME_VELOCITY"] = FLUID_NAME_VELOCITY;
mRNAMap["NAME_VELOCITYTMP"] = FLUID_NAME_VELOCITYTMP;
mRNAMap["NAME_VELOCITY_X"] = FLUID_NAME_VELOCITYX;
mRNAMap["NAME_VELOCITY_Y"] = FLUID_NAME_VELOCITYY;
mRNAMap["NAME_VELOCITY_Z"] = FLUID_NAME_VELOCITYZ;
mRNAMap["NAME_PRESSURE"] = FLUID_NAME_PRESSURE;
mRNAMap["NAME_PHIOBS"] = FLUID_NAME_PHIOBS;
mRNAMap["NAME_PHISIN"] = FLUID_NAME_PHISIN;
mRNAMap["NAME_PHIIN"] = FLUID_NAME_PHIIN;
mRNAMap["NAME_PHIOUT"] = FLUID_NAME_PHIOUT;
mRNAMap["NAME_FORCES"] = FLUID_NAME_FORCES;
mRNAMap["NAME_FORCES_X"] = FLUID_NAME_FORCE_X;
mRNAMap["NAME_FORCES_Y"] = FLUID_NAME_FORCE_Y;
mRNAMap["NAME_FORCES_Z"] = FLUID_NAME_FORCE_Z;
mRNAMap["NAME_NUMOBS"] = FLUID_NAME_NUMOBS;
mRNAMap["NAME_PHIOBSSIN"] = FLUID_NAME_PHIOBSSIN;
mRNAMap["NAME_PHIOBSIN"] = FLUID_NAME_PHIOBSIN;
mRNAMap["NAME_OBVEL"] = FLUID_NAME_OBVEL;
mRNAMap["NAME_OBVELC"] = FLUID_NAME_OBVELC;
mRNAMap["NAME_OBVEL_X"] = FLUID_NAME_OBVEL_X;
mRNAMap["NAME_OBVEL_Y"] = FLUID_NAME_OBVEL_Y;
mRNAMap["NAME_OBVEL_Z"] = FLUID_NAME_OBVEL_Z;
mRNAMap["NAME_FRACTIONS"] = FLUID_NAME_FRACTIONS;
mRNAMap["NAME_INVELC"] = FLUID_NAME_INVELC;
mRNAMap["NAME_INVEL"] = FLUID_NAME_INVEL;
mRNAMap["NAME_INVEL_X"] = FLUID_NAME_INVEL_X;
mRNAMap["NAME_INVEL_Y"] = FLUID_NAME_INVEL_Y;
mRNAMap["NAME_INVEL_Z"] = FLUID_NAME_INVEL_Z;
mRNAMap["NAME_PHIOUTSIN"] = FLUID_NAME_PHIOUTSIN;
mRNAMap["NAME_PHIOUTIN"] = FLUID_NAME_PHIOUTIN;
/* Smoke object names. */
mRNAMap["NAME_SHADOW"] = FLUID_NAME_SHADOW;
mRNAMap["NAME_EMISSION"] = FLUID_NAME_EMISSION;
mRNAMap["NAME_EMISSIONIN"] = FLUID_NAME_EMISSIONIN;
mRNAMap["NAME_DENSITY"] = FLUID_NAME_DENSITY;
mRNAMap["NAME_DENSITYIN"] = FLUID_NAME_DENSITYIN;
mRNAMap["NAME_HEAT"] = FLUID_NAME_HEAT;
mRNAMap["NAME_HEATIN"] = FLUID_NAME_HEATIN;
mRNAMap["NAME_COLORR"] = FLUID_NAME_COLORR;
mRNAMap["NAME_COLORG"] = FLUID_NAME_COLORG;
mRNAMap["NAME_COLORB"] = FLUID_NAME_COLORB;
mRNAMap["NAME_COLORRIN"] = FLUID_NAME_COLORRIN;
mRNAMap["NAME_COLORGIN"] = FLUID_NAME_COLORGIN;
mRNAMap["NAME_COLORBIN"] = FLUID_NAME_COLORBIN;
mRNAMap["NAME_FLAME"] = FLUID_NAME_FLAME;
mRNAMap["NAME_FUEL"] = FLUID_NAME_FUEL;
mRNAMap["NAME_REACT"] = FLUID_NAME_REACT;
mRNAMap["NAME_FUELIN"] = FLUID_NAME_FUELIN;
mRNAMap["NAME_REACTIN"] = FLUID_NAME_REACTIN;
/* Liquid object names. */
mRNAMap["NAME_PHIPARTS"] = FLUID_NAME_PHIPARTS;
mRNAMap["NAME_PHI"] = FLUID_NAME_PHI;
mRNAMap["NAME_PHITMP"] = FLUID_NAME_PHITMP;
mRNAMap["NAME_VELOLD"] = FLUID_NAME_VELOCITYOLD;
mRNAMap["NAME_VELPARTS"] = FLUID_NAME_VELOCITYPARTS;
mRNAMap["NAME_MAPWEIGHTS"] = FLUID_NAME_MAPWEIGHTS;
mRNAMap["NAME_PP"] = FLUID_NAME_PP;
mRNAMap["NAME_PVEL"] = FLUID_NAME_PVEL;
mRNAMap["NAME_PINDEX"] = FLUID_NAME_PINDEX;
mRNAMap["NAME_GPI"] = FLUID_NAME_GPI;
mRNAMap["NAME_CURVATURE"] = FLUID_NAME_CURVATURE;
/* Noise object names. */
mRNAMap["NAME_VELOCITY_NOISE"] = FLUID_NAME_VELOCITY_NOISE;
mRNAMap["NAME_DENSITY_NOISE"] = FLUID_NAME_DENSITY_NOISE;
mRNAMap["NAME_PHIIN_NOISE"] = FLUID_NAME_PHIIN_NOISE;
mRNAMap["NAME_PHIOUT_NOISE"] = FLUID_NAME_PHIOUT_NOISE;
mRNAMap["NAME_PHIOBS_NOISE"] = FLUID_NAME_PHIOBS_NOISE;
mRNAMap["NAME_FLAGS_NOISE"] = FLUID_NAME_FLAGS_NOISE;
mRNAMap["NAME_TMPIN_NOISE"] = FLUID_NAME_TMPIN_NOISE;
mRNAMap["NAME_EMISSIONIN_NOISE"] = FLUID_NAME_EMISSIONIN_NOISE;
mRNAMap["NAME_ENERGY"] = FLUID_NAME_ENERGY;
mRNAMap["NAME_TMPFLAGS"] = FLUID_NAME_TMPFLAGS;
mRNAMap["NAME_TEXTURE_U"] = FLUID_NAME_TEXTURE_U;
mRNAMap["NAME_TEXTURE_V"] = FLUID_NAME_TEXTURE_V;
mRNAMap["NAME_TEXTURE_W"] = FLUID_NAME_TEXTURE_W;
mRNAMap["NAME_TEXTURE_U2"] = FLUID_NAME_TEXTURE_U2;
mRNAMap["NAME_TEXTURE_V2"] = FLUID_NAME_TEXTURE_V2;
mRNAMap["NAME_TEXTURE_W2"] = FLUID_NAME_TEXTURE_W2;
mRNAMap["NAME_UV0"] = FLUID_NAME_UV0;
mRNAMap["NAME_UV1"] = FLUID_NAME_UV1;
mRNAMap["NAME_COLORR_NOISE"] = FLUID_NAME_COLORR_NOISE;
mRNAMap["NAME_COLORG_NOISE"] = FLUID_NAME_COLORG_NOISE;
mRNAMap["NAME_COLORB_NOISE"] = FLUID_NAME_COLORB_NOISE;
mRNAMap["NAME_FLAME_NOISE"] = FLUID_NAME_FLAME_NOISE;
mRNAMap["NAME_FUEL_NOISE"] = FLUID_NAME_FUEL_NOISE;
mRNAMap["NAME_REACT_NOISE"] = FLUID_NAME_REACT_NOISE;
/* Mesh object names. */
mRNAMap["NAME_PHIPARTS_MESH"] = FLUID_NAME_PHIPARTS_MESH;
mRNAMap["NAME_PHI_MESH"] = FLUID_NAME_PHI_MESH;
mRNAMap["NAME_PP_MESH"] = FLUID_NAME_PP_MESH;
mRNAMap["NAME_FLAGS_MESH"] = FLUID_NAME_FLAGS_MESH;
mRNAMap["NAME_LMESH"] = FLUID_NAME_LMESH;
mRNAMap["NAME_VELOCITYVEC_MESH"] = FLUID_NAME_VELOCITYVEC_MESH;
mRNAMap["NAME_VELOCITY_MESH"] = FLUID_NAME_VELOCITY_MESH;
mRNAMap["NAME_PINDEX_MESH"] = FLUID_NAME_PINDEX_MESH;
mRNAMap["NAME_GPI_MESH"] = FLUID_NAME_GPI_MESH;
/* Particles object names. */
mRNAMap["NAME_PP_PARTICLES"] = FLUID_NAME_PP_PARTICLES;
mRNAMap["NAME_PVEL_PARTICLES"] = FLUID_NAME_PVEL_PARTICLES;
mRNAMap["NAME_PFORCE_PARTICLES"] = FLUID_NAME_PFORCE_PARTICLES;
mRNAMap["NAME_PLIFE_PARTICLES"] = FLUID_NAME_PLIFE_PARTICLES;
mRNAMap["NAME_VELOCITY_PARTICLES"] = FLUID_NAME_VELOCITY_PARTICLES;
mRNAMap["NAME_FLAGS_PARTICLES"] = FLUID_NAME_FLAGS_PARTICLES;
mRNAMap["NAME_PHI_PARTICLES"] = FLUID_NAME_PHI_PARTICLES;
mRNAMap["NAME_PHIOBS_PARTICLES"] = FLUID_NAME_PHIOBS_PARTICLES;
mRNAMap["NAME_PHIOUT_PARTICLES"] = FLUID_NAME_PHIOUT_PARTICLES;
mRNAMap["NAME_NORMAL_PARTICLES"] = FLUID_NAME_NORMAL_PARTICLES;
mRNAMap["NAME_NEIGHBORRATIO_PARTICLES"] = FLUID_NAME_NEIGHBORRATIO_PARTICLES;
mRNAMap["NAME_TRAPPEDAIR_PARTICLES"] = FLUID_NAME_TRAPPEDAIR_PARTICLES;
mRNAMap["NAME_WAVECREST_PARTICLES"] = FLUID_NAME_WAVECREST_PARTICLES;
mRNAMap["NAME_KINETICENERGY_PARTICLES"] = FLUID_NAME_KINETICENERGY_PARTICLES;
/* Guiding object names. */
mRNAMap["NAME_VELT"] = FLUID_NAME_VELT;
mRNAMap["NAME_WEIGHTGUIDE"] = FLUID_NAME_WEIGHTGUIDE;
mRNAMap["NAME_NUMGUIDES"] = FLUID_NAME_NUMGUIDES;
mRNAMap["NAME_PHIGUIDEIN"] = FLUID_NAME_PHIGUIDEIN;
mRNAMap["NAME_GUIDEVELC"] = FLUID_NAME_GUIDEVELC;
mRNAMap["NAME_GUIDEVEL_X"] = FLUID_NAME_GUIDEVEL_X;
mRNAMap["NAME_GUIDEVEL_Y"] = FLUID_NAME_GUIDEVEL_Y;
mRNAMap["NAME_GUIDEVEL_Z"] = FLUID_NAME_GUIDEVEL_Z;
mRNAMap["NAME_GUIDEVEL"] = FLUID_NAME_GUIDEVEL;
/* Cache file names. */
mRNAMap["NAME_CONFIG"] = FLUID_NAME_CONFIG;
mRNAMap["NAME_DATA"] = FLUID_NAME_DATA;
mRNAMap["NAME_NOISE"] = FLUID_NAME_NOISE;
mRNAMap["NAME_MESH"] = FLUID_NAME_MESH;
mRNAMap["NAME_PARTICLES"] = FLUID_NAME_PARTICLES;
mRNAMap["NAME_GUIDING"] = FLUID_NAME_GUIDING;
}
string MANTA::getRealValue(const string &varName)
@@ -965,7 +1086,7 @@ bool MANTA::updateFlipStructures(FluidModifierData *mmd, int framenr)
mFlipParticleVelocity->clear();
string pformat = getCacheFileEnding(mds->cache_particle_format);
string file = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_PP, pformat, framenr);
string file = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_PP, pformat, framenr);
expected += 1;
if (BLI_exists(file.c_str())) {
@@ -973,7 +1094,7 @@ bool MANTA::updateFlipStructures(FluidModifierData *mmd, int framenr)
assert(result == expected);
}
file = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_PVEL, pformat, framenr);
file = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_PVEL, pformat, framenr);
expected += 1;
if (BLI_exists(file.c_str())) {
result += updateParticlesFromFile(file, false, true);
@@ -1011,7 +1132,7 @@ bool MANTA::updateMeshStructures(FluidModifierData *mmd, int framenr)
string mformat = getCacheFileEnding(mds->cache_mesh_format);
string dformat = getCacheFileEnding(mds->cache_data_format);
string file = getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_FILENAME_MESH, mformat, framenr);
string file = getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_NAME_LMESH, mformat, framenr);
expected += 1;
if (BLI_exists(file.c_str())) {
@@ -1020,7 +1141,7 @@ bool MANTA::updateMeshStructures(FluidModifierData *mmd, int framenr)
}
if (mUsingMVel) {
file = getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_FILENAME_MESHVEL, dformat, framenr);
file = getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_NAME_VELOCITYVEC_MESH, dformat, framenr);
expected += 1;
if (BLI_exists(file.c_str())) {
result += updateMeshFromFile(file);
@@ -1056,7 +1177,8 @@ bool MANTA::updateParticleStructures(FluidModifierData *mmd, int framenr)
mSndParticleLife->clear();
string pformat = getCacheFileEnding(mds->cache_particle_format);
string file = getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_FILENAME_PPSND, pformat, framenr);
string file = getFile(
mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_NAME_PP_PARTICLES, pformat, framenr);
expected += 1;
if (BLI_exists(file.c_str())) {
@@ -1064,14 +1186,14 @@ bool MANTA::updateParticleStructures(FluidModifierData *mmd, int framenr)
assert(result == expected);
}
file = getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_FILENAME_PVELSND, pformat, framenr);
file = getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_NAME_PVEL_PARTICLES, pformat, framenr);
expected += 1;
if (BLI_exists(file.c_str())) {
result += updateParticlesFromFile(file, true, true);
assert(result == expected);
}
file = getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_FILENAME_PLIFESND, pformat, framenr);
file = getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_NAME_PLIFE_PARTICLES, pformat, framenr);
expected += 1;
if (BLI_exists(file.c_str())) {
result += updateParticlesFromFile(file, true, false);
@@ -1135,29 +1257,29 @@ bool MANTA::updateSmokeStructures(FluidModifierData *mmd, int framenr)
void *aReact[] = {mReact};
/* File names for grids. */
string fDensity = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_DENSITY, dformat, framenr);
string fShadow = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_SHADOW, dformat, framenr);
string fVel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_VELOCITY, dformat, framenr);
string fHeat = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_HEAT, dformat, framenr);
string fColorR = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_COLORR, dformat, framenr);
string fColorG = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_COLORG, dformat, framenr);
string fColorB = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_COLORB, dformat, framenr);
string fFlame = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_FLAME, dformat, framenr);
string fFuel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_FUEL, dformat, framenr);
string fReact = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_REACT, dformat, framenr);
string fFluid = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_DATA, dformat, framenr);
string fDensity = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_DENSITY, dformat, framenr);
string fShadow = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_SHADOW, dformat, framenr);
string fVel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_VELOCITY, dformat, framenr);
string fHeat = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_HEAT, dformat, framenr);
string fColorR = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_COLORR, dformat, framenr);
string fColorG = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_COLORG, dformat, framenr);
string fColorB = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_COLORB, dformat, framenr);
string fFlame = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_FLAME, dformat, framenr);
string fFuel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_FUEL, dformat, framenr);
string fReact = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_REACT, dformat, framenr);
string fFluid = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_DATA, dformat, framenr);
/* Prepare grid info containers. */
GridItem gDensity = {aDensity, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_DENSITY};
GridItem gShadow = {aShadow, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_SHADOW};
GridItem gVel = {aVelocities, FLUID_DOMAIN_GRID_VEC3F, res, FLUID_GRIDNAME_VELOCITY};
GridItem gHeat = {aHeat, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_HEAT};
GridItem gColorR = {aColorR, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_COLORR};
GridItem gColorG = {aColorG, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_COLORG};
GridItem gColorB = {aColorB, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_COLORB};
GridItem gFlame = {aFlame, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_FLAME};
GridItem gFuel = {aFuel, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_FUEL};
GridItem gReact = {aReact, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_GRIDNAME_REACT};
GridItem gDensity = {aDensity, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_DENSITY};
GridItem gShadow = {aShadow, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_SHADOW};
GridItem gVel = {aVelocities, FLUID_DOMAIN_GRID_VEC3F, res, FLUID_NAME_VELOCITY};
GridItem gHeat = {aHeat, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_HEAT};
GridItem gColorR = {aColorR, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_COLORR};
GridItem gColorG = {aColorG, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_COLORG};
GridItem gColorB = {aColorB, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_COLORB};
GridItem gFlame = {aFlame, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_FLAME};
GridItem gFuel = {aFuel, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_FUEL};
GridItem gReact = {aReact, FLUID_DOMAIN_GRID_FLOAT, res, FLUID_NAME_REACT};
/* TODO (sebbas): For now, only allow single file mode. Combined grid file export is todo. */
const int fileMode = FLUID_DOMAIN_CACHE_FILES_SINGLE;
@@ -1252,36 +1374,31 @@ bool MANTA::updateNoiseStructures(FluidModifierData *mmd, int framenr)
void *aReact[] = {mReactHigh};
/* File names for grids. */
string fShadow = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_SHADOW, dformat, framenr);
string fVel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_FILENAME_VELOCITY, dformat, framenr);
string fFluid = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_DATA, dformat, framenr);
string fShadow = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_SHADOW, dformat, framenr);
string fVel = getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_VELOCITY, dformat, framenr);
string fFluid = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_DATA, dformat, framenr);
string fDensity = getFile(
mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_DENSITYNOISE, nformat, framenr);
string fColorR = getFile(
mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_COLORRNOISE, nformat, framenr);
string fColorG = getFile(
mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_COLORGNOISE, nformat, framenr);
string fColorB = getFile(
mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_COLORBNOISE, nformat, framenr);
string fFlame = getFile(
mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_FLAMENOISE, nformat, framenr);
string fFuel = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_FUELNOISE, nformat, framenr);
string fReact = getFile(
mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_REACTNOISE, nformat, framenr);
string fNoise = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_NOISE, nformat, framenr);
mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_DENSITY_NOISE, nformat, framenr);
string fColorR = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_COLORR_NOISE, nformat, framenr);
string fColorG = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_COLORG_NOISE, nformat, framenr);
string fColorB = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_COLORB_NOISE, nformat, framenr);
string fFlame = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_FLAME_NOISE, nformat, framenr);
string fFuel = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_FUEL_NOISE, nformat, framenr);
string fReact = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_REACT_NOISE, nformat, framenr);
string fNoise = getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_NOISE, nformat, framenr);
/* Prepare grid info containers. */
GridItem gShadow = {aShadow, FLUID_DOMAIN_GRID_FLOAT, resData, FLUID_GRIDNAME_SHADOW};
GridItem gVel = {aVelocities, FLUID_DOMAIN_GRID_VEC3F, resData, FLUID_GRIDNAME_VELOCITY};
GridItem gShadow = {aShadow, FLUID_DOMAIN_GRID_FLOAT, resData, FLUID_NAME_SHADOW};
GridItem gVel = {aVelocities, FLUID_DOMAIN_GRID_VEC3F, resData, FLUID_NAME_VELOCITY};
GridItem gDensity = {aDensity, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_DENSITYNOISE};
GridItem gColorR = {aColorR, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_COLORRNOISE};
GridItem gColorG = {aColorG, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_COLORGNOISE};
GridItem gColorB = {aColorB, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_COLORBNOISE};
GridItem gFlame = {aFlame, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_FLAMENOISE};
GridItem gFuel = {aFuel, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_FUELNOISE};
GridItem gReact = {aReact, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_GRIDNAME_REACTNOISE};
GridItem gDensity = {aDensity, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_DENSITY_NOISE};
GridItem gColorR = {aColorR, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_COLORR_NOISE};
GridItem gColorG = {aColorG, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_COLORG_NOISE};
GridItem gColorB = {aColorB, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_COLORB_NOISE};
GridItem gFlame = {aFlame, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_FLAME_NOISE};
GridItem gFuel = {aFuel, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_FUEL_NOISE};
GridItem gReact = {aReact, FLUID_DOMAIN_GRID_FLOAT, resNoise, FLUID_NAME_REACT_NOISE};
/* TODO (sebbas): For now, only allow single file mode. Combined grid file export is todo. */
const int fileMode = FLUID_DOMAIN_CACHE_FILES_SINGLE;
@@ -1371,7 +1488,7 @@ bool MANTA::writeConfiguration(FluidModifierData *mmd, int framenr)
string directory = getDirectory(mmd, FLUID_DOMAIN_DIR_CONFIG);
string format = FLUID_DOMAIN_EXTENSION_UNI;
string file = getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_FILENAME_CONFIG, format, framenr);
string file = getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_NAME_CONFIG, format, framenr);
/* Create 'config' subdir if it does not exist already. */
BLI_dir_create_recursive(directory.c_str());
@@ -1471,7 +1588,7 @@ bool MANTA::readConfiguration(FluidModifierData *mmd, int framenr)
string directory = getDirectory(mmd, FLUID_DOMAIN_DIR_CONFIG);
string format = FLUID_DOMAIN_EXTENSION_UNI;
string file = getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_FILENAME_CONFIG, format, framenr);
string file = getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_NAME_CONFIG, format, framenr);
if (!hasConfig(mmd, framenr))
return false;
@@ -3356,42 +3473,64 @@ bool MANTA::hasConfig(FluidModifierData *mmd, int framenr)
{
string extension = FLUID_DOMAIN_EXTENSION_UNI;
return BLI_exists(
getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_FILENAME_CONFIG, extension, framenr).c_str());
getFile(mmd, FLUID_DOMAIN_DIR_CONFIG, FLUID_NAME_CONFIG, extension, framenr).c_str());
}
bool MANTA::hasData(FluidModifierData *mmd, int framenr)
{
string filename = (mUsingSmoke) ? FLUID_FILENAME_DENSITY : FLUID_FILENAME_PP;
string extension = getCacheFileEnding(mmd->domain->cache_data_format);
return BLI_exists(getFile(mmd, FLUID_DOMAIN_DIR_DATA, filename, extension, framenr).c_str());
bool exists = BLI_exists(
getFile(mmd, FLUID_DOMAIN_DIR_DATA, FLUID_NAME_DATA, extension, framenr).c_str());
/* Check single file naming. */
if (!exists) {
string filename = (mUsingSmoke) ? FLUID_NAME_DENSITY : FLUID_NAME_PP;
exists = BLI_exists(getFile(mmd, FLUID_DOMAIN_DIR_DATA, filename, extension, framenr).c_str());
}
return exists;
}
bool MANTA::hasNoise(FluidModifierData *mmd, int framenr)
{
string extension = getCacheFileEnding(mmd->domain->cache_noise_format);
return BLI_exists(
getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_FILENAME_DENSITYNOISE, extension, framenr)
.c_str());
bool exists = BLI_exists(
getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_NOISE, extension, framenr).c_str());
/* Check single file naming. */
if (!exists) {
exists = BLI_exists(
getFile(mmd, FLUID_DOMAIN_DIR_NOISE, FLUID_NAME_DENSITY_NOISE, extension, framenr)
.c_str());
}
return exists;
}
bool MANTA::hasMesh(FluidModifierData *mmd, int framenr)
{
string extension = getCacheFileEnding(mmd->domain->cache_mesh_format);
return BLI_exists(
getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_FILENAME_MESH, extension, framenr).c_str());
getFile(mmd, FLUID_DOMAIN_DIR_MESH, FLUID_NAME_LMESH, extension, framenr).c_str());
}
bool MANTA::hasParticles(FluidModifierData *mmd, int framenr)
{
string extension = getCacheFileEnding(mmd->domain->cache_particle_format);
return BLI_exists(
getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_FILENAME_PPSND, extension, framenr).c_str());
bool exists = BLI_exists(
getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_NAME_PARTICLES, extension, framenr).c_str());
/* Check single file naming. */
if (!exists) {
exists = BLI_exists(
getFile(mmd, FLUID_DOMAIN_DIR_PARTICLES, FLUID_NAME_PP_PARTICLES, extension, framenr)
.c_str());
}
return exists;
}
bool MANTA::hasGuiding(FluidModifierData *mmd, int framenr, bool sourceDomain)
{
string subdirectory = (sourceDomain) ? FLUID_DOMAIN_DIR_DATA : FLUID_DOMAIN_DIR_GUIDE;
string filename = (sourceDomain) ? FLUID_FILENAME_VELOCITY : FLUID_FILENAME_GUIDEVEL;
string filename = (sourceDomain) ? FLUID_NAME_VELOCITY : FLUID_NAME_GUIDEVEL;
string extension = getCacheFileEnding(mmd->domain->cache_data_format);
return BLI_exists(getFile(mmd, subdirectory, filename, extension, framenr).c_str());
}
@@ -3410,7 +3549,7 @@ string MANTA::getFile(
{
char targetFile[FILE_MAX];
string path = getDirectory(mmd, subdirectory);
string filename = fname + extension;
string filename = fname + "_####" + extension;
BLI_join_dirfile(targetFile, sizeof(targetFile), path.c_str(), filename.c_str());
BLI_path_frame(targetFile, framenr, 0);
return targetFile;

View File

@@ -258,21 +258,21 @@ def fluid_adapt_time_step_$ID$():\n\
const std::string fluid_alloc =
"\n\
mantaMsg('Fluid alloc data')\n\
flags_s$ID$ = s$ID$.create(FlagGrid)\n\
flags_s$ID$ = s$ID$.create(FlagGrid, name='$NAME_FLAGS$')\n\
vel_s$ID$ = s$ID$.create(MACGrid, name='$NAME_VELOCITY$')\n\
velTmp_s$ID$ = s$ID$.create(MACGrid)\n\
x_vel_s$ID$ = s$ID$.create(RealGrid)\n\
y_vel_s$ID$ = s$ID$.create(RealGrid)\n\
z_vel_s$ID$ = s$ID$.create(RealGrid)\n\
pressure_s$ID$ = s$ID$.create(RealGrid)\n\
phiObs_s$ID$ = s$ID$.create(LevelsetGrid)\n\
phiSIn_s$ID$ = s$ID$.create(LevelsetGrid) # helper for static flow objects\n\
phiIn_s$ID$ = s$ID$.create(LevelsetGrid)\n\
phiOut_s$ID$ = s$ID$.create(LevelsetGrid)\n\
forces_s$ID$ = s$ID$.create(Vec3Grid)\n\
x_force_s$ID$ = s$ID$.create(RealGrid)\n\
y_force_s$ID$ = s$ID$.create(RealGrid)\n\
z_force_s$ID$ = s$ID$.create(RealGrid)\n\
velTmp_s$ID$ = s$ID$.create(MACGrid, name='$NAME_VELOCITYTMP$')\n\
x_vel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_VELOCITY_X$')\n\
y_vel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_VELOCITY_Y$')\n\
z_vel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_VELOCITY_Z$')\n\
pressure_s$ID$ = s$ID$.create(RealGrid, name='$NAME_PRESSURE$')\n\
phiObs_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOBS$')\n\
phiSIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHISIN$') # helper for static flow objects\n\
phiIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIIN$')\n\
phiOut_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOUT$')\n\
forces_s$ID$ = s$ID$.create(Vec3Grid, name='$NAME_FORCES$')\n\
x_force_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FORCES_X$')\n\
y_force_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FORCES_Y$')\n\
z_force_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FORCES_Z$')\n\
obvel_s$ID$ = None\n\
\n\
# Set some initial values\n\
@@ -288,14 +288,14 @@ fluid_data_dict_resume_s$ID$ = dict(phiObs=phiObs_s$ID$, phiIn=phiIn_s$ID$, phiO
const std::string fluid_alloc_obstacle =
"\n\
mantaMsg('Allocating obstacle data')\n\
numObs_s$ID$ = s$ID$.create(RealGrid)\n\
phiObsSIn_s$ID$ = s$ID$.create(LevelsetGrid) # helper for static obstacle objects\n\
phiObsIn_s$ID$ = s$ID$.create(LevelsetGrid)\n\
obvel_s$ID$ = s$ID$.create(MACGrid)\n\
obvelC_s$ID$ = s$ID$.create(Vec3Grid)\n\
x_obvel_s$ID$ = s$ID$.create(RealGrid)\n\
y_obvel_s$ID$ = s$ID$.create(RealGrid)\n\
z_obvel_s$ID$ = s$ID$.create(RealGrid)\n\
numObs_s$ID$ = s$ID$.create(RealGrid, name='$NAME_NUMOBS$')\n\
phiObsSIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOBSSIN$') # helper for static obstacle objects\n\
phiObsIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOBSIN$')\n\
obvel_s$ID$ = s$ID$.create(MACGrid, name='$NAME_OBVEL$')\n\
obvelC_s$ID$ = s$ID$.create(Vec3Grid, name='$NAME_OBVELC$')\n\
x_obvel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_OBVEL_X$')\n\
y_obvel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_OBVEL_Y$')\n\
z_obvel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_OBVEL_Z$')\n\
\n\
# Set some initial values\n\
phiObsSIn_s$ID$.setConst(9999)\n\
@@ -307,40 +307,40 @@ if 'fluid_data_dict_resume_s$ID$' in globals():\n\
const std::string fluid_alloc_guiding =
"\n\
mantaMsg('Allocating guiding data')\n\
velT_s$ID$ = s$ID$.create(MACGrid)\n\
weightGuide_s$ID$ = s$ID$.create(RealGrid)\n\
numGuides_s$ID$ = s$ID$.create(RealGrid)\n\
phiGuideIn_s$ID$ = s$ID$.create(LevelsetGrid)\n\
guidevelC_s$ID$ = s$ID$.create(Vec3Grid)\n\
x_guidevel_s$ID$ = s$ID$.create(RealGrid)\n\
y_guidevel_s$ID$ = s$ID$.create(RealGrid)\n\
z_guidevel_s$ID$ = s$ID$.create(RealGrid)\n\
velT_s$ID$ = s$ID$.create(MACGrid, name='$NAME_VELT$')\n\
weightGuide_s$ID$ = s$ID$.create(RealGrid, name='$NAME_WEIGHTGUIDE$')\n\
numGuides_s$ID$ = s$ID$.create(RealGrid, name='$NAME_NUMGUIDES$')\n\
phiGuideIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIGUIDEIN$')\n\
guidevelC_s$ID$ = s$ID$.create(Vec3Grid, name='$NAME_GUIDEVELC$')\n\
x_guidevel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_GUIDEVEL_X$')\n\
y_guidevel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_GUIDEVEL_Y$')\n\
z_guidevel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_GUIDEVEL_Z$')\n\
\n\
# Final guide vel grid needs to have independent size\n\
guidevel_sg$ID$ = sg$ID$.create(MACGrid)\n\
guidevel_sg$ID$ = sg$ID$.create(MACGrid, name='$NAME_GUIDEVEL$')\n\
\n\
# Keep track of important objects in dict to load them later on\n\
fluid_guiding_dict_s$ID$ = dict(guidevel=guidevel_sg$ID$)\n";
fluid_guiding_dict_s$ID$ = { 'guidevel' : guidevel_sg$ID$ }\n";
const std::string fluid_alloc_fractions =
"\n\
mantaMsg('Allocating fractions data')\n\
fractions_s$ID$ = s$ID$.create(MACGrid)\n";
fractions_s$ID$ = s$ID$.create(MACGrid, name='$NAME_FRACTIONS$')\n";
const std::string fluid_alloc_invel =
"\n\
mantaMsg('Allocating initial velocity data')\n\
invelC_s$ID$ = s$ID$.create(VecGrid)\n\
invel_s$ID$ = s$ID$.create(MACGrid)\n\
x_invel_s$ID$ = s$ID$.create(RealGrid)\n\
y_invel_s$ID$ = s$ID$.create(RealGrid)\n\
z_invel_s$ID$ = s$ID$.create(RealGrid)\n";
invelC_s$ID$ = s$ID$.create(VecGrid, name='$NAME_INVELC$')\n\
invel_s$ID$ = s$ID$.create(MACGrid, name='$NAME_INVEL$')\n\
x_invel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_INVEL_X$')\n\
y_invel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_INVEL_Y$')\n\
z_invel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_INVEL_Z$')\n";
const std::string fluid_alloc_outflow =
"\n\
mantaMsg('Allocating outflow data')\n\
phiOutSIn_s$ID$ = s$ID$.create(LevelsetGrid) # helper for static outflow objects\n\
phiOutIn_s$ID$ = s$ID$.create(LevelsetGrid)\n\
phiOutSIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOUTSIN$') # helper for static outflow objects\n\
phiOutIn_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIOUTIN$')\n\
\n\
# Set some initial values\n\
phiOutSIn_s$ID$.setConst(9999)\n\

View File

@@ -77,21 +77,21 @@ using_snd_pushout_sp$ID$ = $SNDPARTICLE_BOUNDARY_PUSHOUT$\n";
const std::string liquid_alloc =
"\n\
mantaMsg('Liquid alloc')\n\
phiParts_s$ID$ = s$ID$.create(LevelsetGrid)\n\
phi_s$ID$ = s$ID$.create(LevelsetGrid)\n\
phiTmp_s$ID$ = s$ID$.create(LevelsetGrid)\n\
velOld_s$ID$ = s$ID$.create(MACGrid)\n\
velParts_s$ID$ = s$ID$.create(MACGrid)\n\
mapWeights_s$ID$ = s$ID$.create(MACGrid)\n\
phiParts_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHIPARTS$')\n\
phi_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHI$')\n\
phiTmp_s$ID$ = s$ID$.create(LevelsetGrid, name='$NAME_PHITMP$')\n\
velOld_s$ID$ = s$ID$.create(MACGrid, name='$NAME_VELOLD$')\n\
velParts_s$ID$ = s$ID$.create(MACGrid, name='$NAME_VELPARTS$')\n\
mapWeights_s$ID$ = s$ID$.create(MACGrid, name='$NAME_MAPWEIGHTS$')\n\
fractions_s$ID$ = None # allocated dynamically\n\
curvature_s$ID$ = None\n\
\n\
pp_s$ID$ = s$ID$.create(BasicParticleSystem)\n\
pVel_pp$ID$ = pp_s$ID$.create(PdataVec3)\n\
pp_s$ID$ = s$ID$.create(BasicParticleSystem, name='$NAME_PP$')\n\
pVel_pp$ID$ = pp_s$ID$.create(PdataVec3, name='$NAME_PVEL$')\n\
\n\
# Acceleration data for particle nbs\n\
pindex_s$ID$ = s$ID$.create(ParticleIndexSystem)\n\
gpi_s$ID$ = s$ID$.create(IntGrid)\n\
pindex_s$ID$ = s$ID$.create(ParticleIndexSystem, name='$NAME_PINDEX$')\n\
gpi_s$ID$ = s$ID$.create(IntGrid, name='$NAME_GPI$')\n\
\n\
# Keep track of important objects in dict to load them later on\n\
liquid_data_dict_final_s$ID$ = dict(pp=pp_s$ID$, pVel=pVel_pp$ID$)\n\
@@ -100,19 +100,19 @@ liquid_data_dict_resume_s$ID$ = dict(phiParts=phiParts_s$ID$, phi=phi_s$ID$, phi
const std::string liquid_alloc_mesh =
"\n\
mantaMsg('Liquid alloc mesh')\n\
phiParts_sm$ID$ = sm$ID$.create(LevelsetGrid)\n\
phi_sm$ID$ = sm$ID$.create(LevelsetGrid)\n\
pp_sm$ID$ = sm$ID$.create(BasicParticleSystem)\n\
flags_sm$ID$ = sm$ID$.create(FlagGrid)\n\
mesh_sm$ID$ = sm$ID$.create(Mesh)\n\
phiParts_sm$ID$ = sm$ID$.create(LevelsetGrid, name='$NAME_PHIPARTS_MESH$')\n\
phi_sm$ID$ = sm$ID$.create(LevelsetGrid, name='$NAME_PHI_MESH$')\n\
pp_sm$ID$ = sm$ID$.create(BasicParticleSystem, name='$NAME_PP_MESH$')\n\
flags_sm$ID$ = sm$ID$.create(FlagGrid, name='$NAME_FLAGS_MESH$')\n\
mesh_sm$ID$ = sm$ID$.create(Mesh, name='$NAME_LMESH$')\n\
\n\
if using_speedvectors_s$ID$:\n\
mVel_mesh$ID$ = mesh_sm$ID$.create(MdataVec3)\n\
vel_sm$ID$ = sm$ID$.create(MACGrid)\n\
mVel_mesh$ID$ = mesh_sm$ID$.create(MdataVec3, name='$NAME_VELOCITYVEC_MESH$')\n\
vel_sm$ID$ = sm$ID$.create(MACGrid, name='$NAME_VELOCITY_MESH$')\n\
\n\
# Acceleration data for particle nbs\n\
pindex_sm$ID$ = sm$ID$.create(ParticleIndexSystem)\n\
gpi_sm$ID$ = sm$ID$.create(IntGrid)\n\
pindex_sm$ID$ = sm$ID$.create(ParticleIndexSystem, name='$NAME_PINDEX_MESH$')\n\
gpi_sm$ID$ = sm$ID$.create(IntGrid, name='$NAME_GPI_MESH$')\n\
\n\
# Set some initial values\n\
phiParts_sm$ID$.setConst(9999)\n\
@@ -127,24 +127,24 @@ if using_speedvectors_s$ID$:\n\
const std::string liquid_alloc_curvature =
"\n\
mantaMsg('Liquid alloc curvature')\n\
curvature_s$ID$ = s$ID$.create(RealGrid)\n";
curvature_s$ID$ = s$ID$.create(RealGrid, name='$NAME_CURVATURE$')\n";
const std::string liquid_alloc_particles =
"\n\
ppSnd_sp$ID$ = sp$ID$.create(BasicParticleSystem)\n\
pVelSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataVec3)\n\
pForceSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataVec3)\n\
pLifeSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataReal)\n\
vel_sp$ID$ = sp$ID$.create(MACGrid)\n\
flags_sp$ID$ = sp$ID$.create(FlagGrid)\n\
phi_sp$ID$ = sp$ID$.create(LevelsetGrid)\n\
phiObs_sp$ID$ = sp$ID$.create(LevelsetGrid)\n\
phiOut_sp$ID$ = sp$ID$.create(LevelsetGrid)\n\
normal_sp$ID$ = sp$ID$.create(VecGrid)\n\
neighborRatio_sp$ID$ = sp$ID$.create(RealGrid)\n\
trappedAir_sp$ID$ = sp$ID$.create(RealGrid)\n\
waveCrest_sp$ID$ = sp$ID$.create(RealGrid)\n\
kineticEnergy_sp$ID$ = sp$ID$.create(RealGrid)\n\
ppSnd_sp$ID$ = sp$ID$.create(BasicParticleSystem, name='$FLUID_NAME_PP_PARTICLES$')\n\
pVelSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataVec3, name='$FLUID_NAME_PVEL_PARTICLES$')\n\
pForceSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataVec3, name='$FLUID_NAME_PFORCE_PARTICLES$')\n\
pLifeSnd_pp$ID$ = ppSnd_sp$ID$.create(PdataReal, name='$FLUID_NAME_PLIFE_PARTICLES$')\n\
vel_sp$ID$ = sp$ID$.create(MACGrid, name='$FLUID_NAME_VELOCITY_PARTICLES$')\n\
flags_sp$ID$ = sp$ID$.create(FlagGrid, name='$FLUID_NAME_FLAGS_PARTICLES$')\n\
phi_sp$ID$ = sp$ID$.create(LevelsetGrid, name='$FLUID_NAME_PHI_PARTICLES$')\n\
phiObs_sp$ID$ = sp$ID$.create(LevelsetGrid, name='$FLUID_NAME_PHIOBS_PARTICLES$')\n\
phiOut_sp$ID$ = sp$ID$.create(LevelsetGrid, name='$FLUID_NAME_PHIOUT_PARTICLES$')\n\
normal_sp$ID$ = sp$ID$.create(VecGrid, name='$FLUID_NAME_NORMAL_PARTICLES$')\n\
neighborRatio_sp$ID$ = sp$ID$.create(RealGrid, name='$FLUID_NAME_NEIGHBORRATIO_PARTICLES$')\n\
trappedAir_sp$ID$ = sp$ID$.create(RealGrid, name='$FLUID_NAME_TRAPPEDAIR_PARTICLES$')\n\
waveCrest_sp$ID$ = sp$ID$.create(RealGrid, name='$FLUID_NAME_WAVECREST_PARTICLES$')\n\
kineticEnergy_sp$ID$ = sp$ID$.create(RealGrid, name='$FLUID_NAME_KINETICENERGY_PARTICLES$')\n\
\n\
# Set some initial values\n\
phi_sp$ID$.setConst(9999)\n\

View File

@@ -82,10 +82,10 @@ const std::string smoke_alloc =
"\n\
mantaMsg('Smoke alloc')\n\
shadow_s$ID$ = s$ID$.create(RealGrid, name='$NAME_SHADOW$')\n\
emission_s$ID$ = s$ID$.create(RealGrid)\n\
emissionIn_s$ID$ = s$ID$.create(RealGrid)\n\
emission_s$ID$ = s$ID$.create(RealGrid, name='$NAME_EMISSION$')\n\
emissionIn_s$ID$ = s$ID$.create(RealGrid, name='$NAME_EMISSIONIN$')\n\
density_s$ID$ = s$ID$.create(RealGrid, name='$NAME_DENSITY$')\n\
densityIn_s$ID$ = s$ID$.create(RealGrid)\n\
densityIn_s$ID$ = s$ID$.create(RealGrid, name='$NAME_DENSITYIN$')\n\
heat_s$ID$ = None # allocated dynamically\n\
heatIn_s$ID$ = None\n\
flame_s$ID$ = None\n\
@@ -107,22 +107,22 @@ smoke_data_dict_resume_s$ID$ = dict(densityIn=densityIn_s$ID$, emission=emission
const std::string smoke_alloc_noise =
"\n\
mantaMsg('Smoke alloc noise')\n\
vel_sn$ID$ = sn$ID$.create(MACGrid)\n\
density_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_DENSITYNOISE$')\n\
phiIn_sn$ID$ = sn$ID$.create(LevelsetGrid)\n\
phiOut_sn$ID$ = sn$ID$.create(LevelsetGrid)\n\
phiObs_sn$ID$ = sn$ID$.create(LevelsetGrid)\n\
flags_sn$ID$ = sn$ID$.create(FlagGrid)\n\
tmpIn_sn$ID$ = sn$ID$.create(RealGrid)\n\
emissionIn_sn$ID$ = sn$ID$.create(RealGrid)\n\
energy_s$ID$ = s$ID$.create(RealGrid)\n\
tempFlag_s$ID$ = s$ID$.create(FlagGrid)\n\
texture_u_s$ID$ = s$ID$.create(RealGrid)\n\
texture_v_s$ID$ = s$ID$.create(RealGrid)\n\
texture_w_s$ID$ = s$ID$.create(RealGrid)\n\
texture_u2_s$ID$ = s$ID$.create(RealGrid)\n\
texture_v2_s$ID$ = s$ID$.create(RealGrid)\n\
texture_w2_s$ID$ = s$ID$.create(RealGrid)\n\
vel_sn$ID$ = sn$ID$.create(MACGrid, name='$NAME_VELOCITY_NOISE$')\n\
density_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_DENSITY_NOISE$')\n\
phiIn_sn$ID$ = sn$ID$.create(LevelsetGrid, name='$NAME_PHIIN_NOISE$')\n\
phiOut_sn$ID$ = sn$ID$.create(LevelsetGrid, name='$NAME_PHIOUT_NOISE$')\n\
phiObs_sn$ID$ = sn$ID$.create(LevelsetGrid, name='$NAME_PHIOBS_NOISE$')\n\
flags_sn$ID$ = sn$ID$.create(FlagGrid, name='$NAME_FLAGS_NOISE$')\n\
tmpIn_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_TMPIN_NOISE$')\n\
emissionIn_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_EMISSIONIN_NOISE$')\n\
energy_s$ID$ = s$ID$.create(RealGrid, name='$NAME_ENERGY$')\n\
tmpFlags_s$ID$ = s$ID$.create(FlagGrid, name='$NAME_TMPFLAGS$')\n\
texture_u_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_U$')\n\
texture_v_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_V$')\n\
texture_w_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_W$')\n\
texture_u2_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_U2$')\n\
texture_v2_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_V2$')\n\
texture_w2_s$ID$ = s$ID$.create(RealGrid, name='$NAME_TEXTURE_W2$')\n\
flame_sn$ID$ = None\n\
fuel_sn$ID$ = None\n\
react_sn$ID$ = None\n\
@@ -132,8 +132,8 @@ color_b_sn$ID$ = None\n\
wltnoise_sn$ID$ = sn$ID$.create(NoiseField, fixedSeed=265, loadFromFile=True)\n\
\n\
mantaMsg('Initializing UV Grids')\n\
uvGrid0_s$ID$ = s$ID$.create(VecGrid)\n\
uvGrid1_s$ID$ = s$ID$.create(VecGrid)\n\
uvGrid0_s$ID$ = s$ID$.create(VecGrid, name='$NAME_UV0$')\n\
uvGrid1_s$ID$ = s$ID$.create(VecGrid, name='$NAME_UV1$')\n\
resetUvGrid(target=uvGrid0_s$ID$, offset=uvs_offset_s$ID$)\n\
resetUvGrid(target=uvGrid1_s$ID$, offset=uvs_offset_s$ID$)\n\
\n\
@@ -160,9 +160,9 @@ mantaMsg('Allocating colors')\n\
color_r_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORR$')\n\
color_g_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORG$')\n\
color_b_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORB$')\n\
color_r_in_s$ID$ = s$ID$.create(RealGrid)\n\
color_g_in_s$ID$ = s$ID$.create(RealGrid)\n\
color_b_in_s$ID$ = s$ID$.create(RealGrid)\n\
color_r_in_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORRIN$')\n\
color_g_in_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORGIN$')\n\
color_b_in_s$ID$ = s$ID$.create(RealGrid, name='$NAME_COLORBIN$')\n\
\n\
# Add objects to dict to load them later on\n\
if 'smoke_data_dict_final_s$ID$' in globals():\n\
@@ -178,9 +178,9 @@ if 'color_g_sn$ID$' in globals(): del color_g_sn$ID$\n\
if 'color_b_sn$ID$' in globals(): del color_b_sn$ID$\n\
\n\
mantaMsg('Allocating colors noise')\n\
color_r_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORRNOISE$')\n\
color_g_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORGNOISE$')\n\
color_b_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORBNOISE$')\n\
color_r_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORR_NOISE$')\n\
color_g_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORG_NOISE$')\n\
color_b_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_COLORB_NOISE$')\n\
\n\
# Add objects to dict to load them later on\n\
if 'smoke_noise_dict_final_s$ID$' in globals():\n\
@@ -214,7 +214,7 @@ if 'heatIn_s$ID$' in globals(): del heatIn_s$ID$\n\
\n\
mantaMsg('Allocating heat')\n\
heat_s$ID$ = s$ID$.create(RealGrid, name='$NAME_HEAT$')\n\
heatIn_s$ID$ = s$ID$.create(RealGrid)\n\
heatIn_s$ID$ = s$ID$.create(RealGrid, name='$NAME_HEATIN$')\n\
\n\
# Add objects to dict to load them later on\n\
if 'smoke_data_dict_final_s$ID$' in globals():\n\
@@ -235,8 +235,8 @@ mantaMsg('Allocating fire')\n\
flame_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FLAME$')\n\
fuel_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FUEL$')\n\
react_s$ID$ = s$ID$.create(RealGrid, name='$NAME_REACT$')\n\
fuelIn_s$ID$ = s$ID$.create(RealGrid)\n\
reactIn_s$ID$ = s$ID$.create(RealGrid)\n\
fuelIn_s$ID$ = s$ID$.create(RealGrid, name='$NAME_FUELIN$')\n\
reactIn_s$ID$ = s$ID$.create(RealGrid, name='$NAME_REACTIN$')\n\
\n\
# Add objects to dict to load them later on\n\
if 'smoke_data_dict_final_s$ID$' in globals():\n\
@@ -252,9 +252,9 @@ if 'fuel_sn$ID$' in globals(): del fuel_sn$ID$\n\
if 'react_sn$ID$' in globals(): del react_sn$ID$\n\
\n\
mantaMsg('Allocating fire noise')\n\
flame_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_FLAMENOISE$')\n\
fuel_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_FUELNOISE$')\n\
react_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_REACTNOISE$')\n\
flame_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_FLAME_NOISE$')\n\
fuel_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_FUEL_NOISE$')\n\
react_sn$ID$ = sn$ID$.create(RealGrid, name='$NAME_REACT_NOISE$')\n\
\n\
# Add objects to dict to load them later on\n\
if 'smoke_noise_dict_final_s$ID$' in globals():\n\
@@ -493,9 +493,9 @@ def step_noise_$ID$():\n\
mantaMsg('Energy')\n\
computeEnergy(flags=flags_s$ID$, vel=vel_s$ID$, energy=energy_s$ID$)\n\
\n\
tempFlag_s$ID$.copyFrom(flags_s$ID$)\n\
extrapolateSimpleFlags(flags=flags_s$ID$, val=tempFlag_s$ID$, distance=2, flagFrom=FlagObstacle, flagTo=FlagFluid)\n\
extrapolateSimpleFlags(flags=tempFlag_s$ID$, val=energy_s$ID$, distance=6, flagFrom=FlagFluid, flagTo=FlagObstacle)\n\
tmpFlags_s$ID$.copyFrom(flags_s$ID$)\n\
extrapolateSimpleFlags(flags=flags_s$ID$, val=tmpFlags_s$ID$, distance=2, flagFrom=FlagObstacle, flagTo=FlagFluid)\n\
extrapolateSimpleFlags(flags=tmpFlags_s$ID$, val=energy_s$ID$, distance=6, flagFrom=FlagFluid, flagTo=FlagObstacle)\n\
computeWaveletCoeffs(energy_s$ID$)\n\
\n\
sStr_s$ID$ = 1.0 * wltStrength_s$ID$\n\

View File

@@ -263,19 +263,20 @@ static void updateGLSLShader(OCIO_GLSLShader *shader,
shader->curve_mapping_loc = glGetUniformLocation(shader->program, "curve_mapping");
glUseProgram(shader->program);
/* Set texture bind point uniform once. This is saved by the shader. */
glUniform1i(glGetUniformLocation(shader->program, "image_texture"), 0);
glUniform1i(glGetUniformLocation(shader->program, "lut3d_texture"), 2);
glUniform1i(glGetUniformLocation(shader->program, "lut3d_display_texture"), 3);
glUniform1i(glGetUniformLocation(shader->program, "curve_mapping_texture"), 4);
/* TODO(fclem) Remove this. Make caller always assume viewport space and
* specify texco via vertex attribs. */
shader->interface = GPU_shaderinterface_create(shader->program);
/* Set UBO binding location. */
GLuint index = glGetUniformBlockIndex(shader->program, "OCIO_GLSLCurveMappingParameters");
glUniformBlockBinding(shader->program, index, UBO_BIND_LOC);
/* TODO(fclem) Remove this. Make caller always assume viewport space and
* specify texco via vertex attribs. */
shader->interface = GPU_shaderinterface_create(shader->program);
/* Set texture bind point uniform once. This is saved by the shader. */
glUniform1i(glGetUniformLocation(shader->program, "image_texture"), 0);
glUniform1i(glGetUniformLocation(shader->program, "lut3d_texture"), 2);
glUniform1i(glGetUniformLocation(shader->program, "lut3d_display_texture"), 3);
glUniform1i(glGetUniformLocation(shader->program, "curve_mapping_texture"), 4);
}
shader->cacheId = cache_id;

View File

@@ -50,26 +50,41 @@ if(WITH_OPENSUBDIV)
)
list(APPEND SRC
internal/opensubdiv.cc
internal/opensubdiv_converter_factory.cc
internal/opensubdiv_converter_internal.cc
internal/opensubdiv_device_context_cuda.cc
internal/opensubdiv_device_context_opencl.cc
internal/opensubdiv_evaluator.cc
internal/opensubdiv_evaluator_internal.cc
internal/opensubdiv_topology_refiner.cc
internal/opensubdiv_topology_refiner_internal.cc
internal/opensubdiv_util.cc
# Base.
internal/base/memory.h
internal/base/opensubdiv_capi.cc
internal/base/type.h
internal/base/type_convert.cc
internal/base/type_convert.h
internal/base/util.cc
internal/base/util.h
internal/opensubdiv_converter_factory.h
internal/opensubdiv_converter_internal.h
internal/opensubdiv_device_context_cuda.h
internal/opensubdiv_device_context_opencl.h
internal/opensubdiv_edge_map.h
internal/opensubdiv_evaluator_internal.h
internal/opensubdiv_internal.h
internal/opensubdiv_topology_refiner_internal.h
internal/opensubdiv_util.h
# Device.
internal/device/device_context_cuda.cc
internal/device/device_context_cuda.h
internal/device/device_context_glsl_compute.cc
internal/device/device_context_glsl_compute.h
internal/device/device_context_glsl_transform_feedback.cc
internal/device/device_context_glsl_transform_feedback.h
internal/device/device_context_opencl.cc
internal/device/device_context_opencl.h
internal/device/device_context_openmp.cc
internal/device/device_context_openmp.h
# Evaluator.
internal/evaluator/evaluator_capi.cc
internal/evaluator/evaluator_impl.cc
internal/evaluator/evaluator_impl.h
# Topology.
internal/topology/mesh_topology.cc
internal/topology/mesh_topology_compare.cc
internal/topology/mesh_topology.h
internal/topology/topology_refiner_capi.cc
internal/topology/topology_refiner_factory.cc
internal/topology/topology_refiner_impl.cc
internal/topology/topology_refiner_impl_compare.cc
internal/topology/topology_refiner_impl.h
)
list(APPEND LIB
@@ -83,10 +98,8 @@ if(WITH_OPENSUBDIV)
endif()
OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENMP)
# TODO(sergey): OpenCL is not tested and totally unstable atm.
# OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENCL)
# TODO(sergey): CUDA stays disabled for util it's ported to drievr API.
# OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_CUDA)
OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENCL)
OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_CUDA)
OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_COMPUTE)
@@ -97,21 +110,6 @@ if(WITH_OPENSUBDIV)
add_definitions(-DNOMINMAX)
add_definitions(-D_USE_MATH_DEFINES)
endif()
# TODO(sergey): Put CUEW back when CUDA is officially supported by OSD.
# if(OPENSUBDIV_HAS_CUDA)
# list(APPEND INC
# ../../extern/cuew/include
# )
# add_definitions(-DOPENSUBDIV_HAS_CUEW)
# endif()
if(OPENSUBDIV_HAS_OPENCL)
list(APPEND INC
../../extern/clew/include
)
add_definitions(-DOPENSUBDIV_HAS_CLEW)
endif()
else()
list(APPEND SRC
stub/opensubdiv_stub.cc
@@ -121,3 +119,15 @@ else()
endif()
blender_add_lib(bf_intern_opensubdiv "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# Tests.
if(WITH_GTESTS AND WITH_OPENSUBDIV)
include(GTestTesting)
add_definitions(${GFLAGS_DEFINES})
add_definitions(${GLOG_DEFINES})
add_definitions(-DBLENDER_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
BLENDER_SRC_GTEST(opensubdiv_mesh_topology_test "internal/topology/mesh_topology_test.cc" "${LIB};bf_intern_opensubdiv")
endif()

View File

@@ -1,4 +1,4 @@
// Copyright 2015 Blender Foundation. All rights reserved.
// Copyright 2020 Blender Foundation. All rights reserved.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -13,18 +13,16 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// Author: Sergey Sharybin
#ifndef OPENSUBDIV_INTERNAL_H_
#define OPENSUBDIV_INTERNAL_H_
#ifndef OPENSUBDIV_BASE_MEMORY_H_
#define OPENSUBDIV_BASE_MEMORY_H_
// Perform full topology validation when exporting it to OpenSubdiv.
#ifdef NDEBUG
// Never do for release builds.
# undef OPENSUBDIV_VALIDATE_TOPOLOGY
#else
# define OPENSUBDIV_VALIDATE_TOPOLOGY
#endif
#include "MEM_guardedalloc.h"
#endif // OPENSUBDIV_INTERNAL_H_
namespace blender {
namespace opensubdiv {
} // namespace opensubdiv
} // namespace blender
#endif // OPENSUBDIV_BASE_MEMORY_H_

View File

@@ -20,10 +20,18 @@
# include <iso646.h>
#endif
#include <GL/glew.h>
#include "internal/base/util.h"
#include "internal/device/device_context_cuda.h"
#include "internal/device/device_context_glsl_compute.h"
#include "internal/device/device_context_glsl_transform_feedback.h"
#include "internal/device/device_context_opencl.h"
#include "internal/device/device_context_openmp.h"
#include "opensubdiv_device_context_cuda.h"
#include "opensubdiv_device_context_opencl.h"
using blender::opensubdiv::CUDADeviceContext;
using blender::opensubdiv::GLSLComputeDeviceContext;
using blender::opensubdiv::GLSLTransformFeedbackDeviceContext;
using blender::opensubdiv::OpenCLDeviceContext;
using blender::opensubdiv::OpenMPDeviceContext;
void openSubdiv_init(void)
{
@@ -39,33 +47,25 @@ int openSubdiv_getAvailableEvaluators(void)
{
int flags = OPENSUBDIV_EVALUATOR_CPU;
#ifdef OPENSUBDIV_HAS_OPENMP
flags |= OPENSUBDIV_EVALUATOR_OPENMP;
#endif
if (OpenMPDeviceContext::isSupported()) {
flags |= OPENSUBDIV_EVALUATOR_OPENMP;
}
#ifdef OPENSUBDIV_HAS_OPENCL
if (CLDeviceContext::HAS_CL_VERSION_1_1()) {
if (OpenCLDeviceContext::isSupported()) {
flags |= OPENSUBDIV_EVALUATOR_OPENCL;
}
#endif
#ifdef OPENSUBDIV_HAS_CUDA
if (CudaDeviceContext::HAS_CUDA_VERSION_4_0()) {
if (CUDADeviceContext::isSupported()) {
flags |= OPENSUBDIV_EVALUATOR_CUDA;
}
#endif
#ifdef OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK
if (GLEW_VERSION_4_1) {
if (GLSLTransformFeedbackDeviceContext::isSupported()) {
flags |= OPENSUBDIV_EVALUATOR_GLSL_TRANSFORM_FEEDBACK;
}
#endif
#ifdef OPENSUBDIV_HAS_GLSL_COMPUTE
if (GLEW_VERSION_4_3 || GLEW_ARB_compute_shader) {
if (GLSLComputeDeviceContext::isSupported()) {
flags |= OPENSUBDIV_EVALUATOR_GLSL_COMPUTE;
}
#endif
return flags;
}

View File

@@ -14,13 +14,14 @@
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef OPENSUBDIV_UTIL_H_
#define OPENSUBDIV_UTIL_H_
#ifndef OPENSUBDIV_BASE_TYPE_H_
#define OPENSUBDIV_BASE_TYPE_H_
#include <stdint.h>
#include <algorithm>
#include <cassert>
#include <map>
#include <stack>
#include <string>
#include <unordered_map>
@@ -30,29 +31,21 @@
namespace blender {
namespace opensubdiv {
using std::map;
using std::pair;
using std::stack;
using std::string;
using std::unordered_map;
using std::vector;
using std::fill;
using std::make_pair;
using std::max;
using std::min;
using std::pair;
using std::stack;
using std::string;
using std::move;
using std::swap;
using std::unordered_map;
using std::vector;
#define foreach(x, y) for (x : y)
#define STRINGIFY_ARG(x) "" #x
#define STRINGIFY_APPEND(a, b) "" a #b
#define STRINGIFY(x) STRINGIFY_APPEND("", x)
void stringSplit(vector<string> *tokens,
const string &str,
const string &separators,
bool skip_empty);
} // namespace opensubdiv
} // namespace blender
#endif // OPENSUBDIV_UTIL_H_
#endif // OPENSUBDIV_BASE_TYPE_H_

View File

@@ -20,7 +20,7 @@
# include <iso646.h>
#endif
#include "internal/opensubdiv_converter_internal.h"
#include "internal/base/type_convert.h"
#include <cassert>
#include <opensubdiv/sdc/crease.h>
@@ -86,5 +86,22 @@ OpenSubdiv_FVarLinearInterpolation getCAPIFVarLinearInterpolationFromOSD(
return OSD_FVAR_LINEAR_INTERPOLATION_NONE;
}
OpenSubdiv::Sdc::Options::VtxBoundaryInterpolation getVtxBoundaryInterpolationFromCAPI(
OpenSubdiv_VtxBoundaryInterpolation boundary_interpolation)
{
using OpenSubdiv::Sdc::Options;
switch (boundary_interpolation) {
case OSD_VTX_BOUNDARY_NONE:
return Options::VTX_BOUNDARY_NONE;
case OSD_VTX_BOUNDARY_EDGE_ONLY:
return Options::VTX_BOUNDARY_EDGE_ONLY;
case OSD_VTX_BOUNDARY_EDGE_AND_CORNER:
return Options::VTX_BOUNDARY_EDGE_AND_CORNER;
}
assert(!"Unknown veretx boundary interpolation.");
return Options::VTX_BOUNDARY_EDGE_ONLY;
}
} // namespace opensubdiv
} // namespace blender

View File

@@ -16,8 +16,8 @@
//
// Author: Sergey Sharybin
#ifndef OPENSUBDIV_CONVERTER_INTERNAL_H_
#define OPENSUBDIV_CONVERTER_INTERNAL_H_
#ifndef OPENSUBDIV_BASE_TYPE_CONVERT_H_
#define OPENSUBDIV_BASE_TYPE_CONVERT_H_
#ifdef _MSC_VER
# include <iso646.h>
@@ -26,7 +26,7 @@
#include <opensubdiv/sdc/options.h>
#include <opensubdiv/sdc/types.h>
#include "opensubdiv_converter_capi.h"
#include "opensubdiv_capi_type.h"
struct OpenSubdiv_Converter;
@@ -45,7 +45,10 @@ OpenSubdiv::Sdc::Options::FVarLinearInterpolation getFVarLinearInterpolationFrom
OpenSubdiv_FVarLinearInterpolation getCAPIFVarLinearInterpolationFromOSD(
OpenSubdiv::Sdc::Options::FVarLinearInterpolation linear_interpolation);
OpenSubdiv::Sdc::Options::VtxBoundaryInterpolation getVtxBoundaryInterpolationFromCAPI(
OpenSubdiv_VtxBoundaryInterpolation boundary_interpolation);
} // namespace opensubdiv
} // namespace blender
#endif // OPENSUBDIV_CONVERTER_INTERNAL_H_
#endif // OPENSUBDIV_BASE_TYPE_CONVERT_H_

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