1
1

Compare commits

...

432 Commits

Author SHA1 Message Date
Nicholas Rishel
a5ab9062cb Replace Ghost integral types with standard fixed width integers.
Also replace integer with bool in Ghost API when only used as boolean, and replace uint8* with char* in Ghost API when variable is a string.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11617
2021-07-05 10:10:20 -07:00
b73dc36859 GPencil: Add weight factor to Offset randomize
Now, The weight is used in the randomize parameters of the offset modifier. 

This is useful to generate effects like explosions.

Related to the new Vertex Weight modifiers.
2021-07-03 17:41:12 +02:00
9b89de2571 Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXX
Also use doxy style function reference `#` prefix chars when
referencing identifiers.
2021-07-04 00:43:40 +10:00
05f970847e GPencil: Fix unreported PDF export offset
When exporting a PDF, the image was displaced towards top right a few pixels.

Also removed is_orthographic variable because is not needed now.
2021-07-03 12:32:44 +02:00
2d146b61d8 Cleanup: Use simpler method to retrieve attribute domain 2021-07-02 23:16:39 -05:00
5f5cf21a83 Cleanup: Remove unused transform matrix from objects
This was the only reference to this matrix.

https://developer.blender.org/D11770
2021-07-02 13:27:56 -05:00
55f27617cf Geometry Nodes: Add mesh input warning to curve to mesh node
A point of confusion about this node is that it doesn't work on the
output of the mesh circle primitive node. This patch adds a warning to
help with that. This avoids adding a warning when the geometry set
input has no mesh.

Differential Revision: https://developer.blender.org/D11771
2021-07-02 13:24:42 -05:00
00e30f122b Build: upgrade NanoVDB library to latest revision
This includes improved handling of OpenVDB trees with inactive voxels,
which previously could throw an error.

Ref T89581, T88438
2021-07-02 19:06:08 +02:00
82466ca2e5 Fix T89581: Cycles crash rendering some OpenVDB files with inactive voxels
Print an error message instead.
2021-07-02 19:01:53 +02:00
0c84939117 Cleanup: use template utility function to handle OpenVDB grid types in Cycles 2021-07-02 19:01:53 +02:00
8221d64844 Cleanup: Further use of const when accessing evaluated mesh
Also resolve a warning from the previous commit. The next blocker to
using const is `BKE_mesh_wrapper_ensure_mdata`.
2021-07-02 11:56:29 -05:00
5f8969bb4b Cleanup: Use const mesh to ensure BVH and triangulation cache
As noted in a comment now, these functions only update a cache, so they
don't change the logical state of the mesh, which is "it will have the
data when necessary." Using a const argument will help const correctness
when accessing an object's evaluated mesh.
2021-07-02 11:37:01 -05:00
a1609340b4 Cleanup: Fix variable redeclaration warning 2021-07-02 10:07:43 -05:00
a96b52e37f GPencil: Fix compiler warnings in previous commit 2021-07-02 16:32:57 +02:00
88c855174d Cleanup: Remove unused/unneeded code from old Asset Engine design
This code was written for the File Browser together with the Asset Engine
design, that is not part of the Asset Browser/System design anymore. Updated
comments accordingly.

`FileDirEntryRevision` was actually used, but I removed it and moved the used
members to the parent `FileDirEntry`, since there is no concept of revisions
currently.

There should be no functional changes.
2021-07-02 15:42:22 +02:00
5a693ce9e3 Constraints: support a new Local Space (Owner Orientation) for targets.
Add a new transformation space choice for bone constraints, which
represent the local transformation of the target bone in the constraint
owner's local space.

The use case for this is transferring the local (i.e. excluding the
effect of parents) motion of one bone to another one, while ignoring
the difference between their rest pose orientations.

The new option replaces the following setup:

* A `child` bone of the `target`, rotated the same as `owner` in rest pose.
* A `sibling` bone of the `target`, positioned same as `child` in rest
  pose and using Copy Transforms in World Space from `child`.
* The `owner` bone constraint uses Local Space of `sibling`.

(This analogy applies provided both bones use Local Location)

Differential Revision: https://developer.blender.org/D9493
2021-07-02 15:15:05 +03:00
bc8ae58727 Copy Transforms: implement Remove Target Shear and more Mix options.
This constraint can be naturally viewed as a prototype for a future
4x4 matrix math node (or subset thereof), since its basic semantics
already is matrix assignment. Thus it makes sense to add math options
to this constraint to increase flexibility in the meantime.

This patch adds support for several operations that would be useful:

- An option to remove shear in the incoming target matrix.

  Shear is known to cause issues for various mathematical operations,
  so an option to remove it at key points is useful.

  Constraints based on Euler like Copy Rotation and Limit Rotation
  already have always enabled shear removal built in, because their
  math doesn't work correctly with shear.

  In the future node system shear removal would be a separate node
  (and currently Limit Rotation can be used as a Remove Shear constraint).
  However removing shear from the result of the target space conversion
  before mixing (similar to Copy Rotation) has to be built into
  Copy Transforms itself as an option.

- More ways to combine the target and owner matrices.

  Similar to multiple Inherit Scale modes for parenting, there are
  multiple ways one may want to combine matrices based on context.
  This implements 3 variants for each of the Before/After modes
  (one of them already existing).

  - Full implements regular matrix multiplication as the most basic
    option. The downside is the risk of creating shear.
  - Aligned emulates the 'anti-shear' Aligned Inherit Scale mode,
    and basically uses Full for location, and Split for rotation/scale.
    (This choice already existed.)
  - Split Channels combines location, rotation and scale separately.

  Looking at D7547 there is demand for Split Channels in some cases,
  so I think it makes sense to include it in Copy Transforms too, so that
  the Mix menu items can be identical for it and the Action constraint.

Differential Revision: https://developer.blender.org/D9469
2021-07-02 15:15:05 +03:00
01e1944cd4 File Browser: Refactor file "UUID" code (which wasn't really a "UUID")
To some degree these are changes in preparation of further Asset Browser
related changes, see D11119. But also, the current UUID design was written for
the old Asset Engine design, which isn't part of the current Asset
Browser/System design anymore.
And lastly, "UUID" are a well established standard
(https://en.wikipedia.org/wiki/Universally_unique_identifier) which this
implementation didn't follow. What we have here is more of an index, or a
unique identifier (https://en.wikipedia.org/wiki/Unique_identifier).

So this does the following changes:
* Renames "UUID" to "UID"
* Changes the type of the UID to (a typedef'ed) `uint32_t`, which is more than
  enough for our current asset system design and simplifies things.
* Due to the new type, we can avoid allocations for hash-table storage.
* Add/use functions for UID handling

Note that I am working on a major rewrite of the file-list code. Meanwhile we
want to keep things sensible.
2021-07-02 13:49:30 +02:00
29b65f5345 GPencil: New modifier to generate weights dynamically
his new modifier allows to generate weights base on:

* Angle of the stroke relative to object or world orientation. For example, if the value is 90, the maximum weights will be for vertical lines and minimum for horizontal lines.

* Distance to Target object. The distance calculated is normalized to get valid weights between 0 and 1.0.

The weights are created in an existing vertex group and the data can be replaced or mixed with the existing value to combine different weight effects. The minimum parameter, allows to define the minimum weight generated. This is useful to avoid very low weights.

The generated weights can be used in any modifier. For example, the angle weight value can be used to mimic FreeStyle Caligraphy modifier using the weight with the thickness modifier.

Also some modifier has been changed to inlude a new option to use the weights as factor of the effect.
As result of this change, the fading option has been removed from Thickness and Opacity modifiers because this can be done using the new modifier, it's not logic to repeat the same.

Reviewed By: mendio, filedescriptor

Differential Revision: https://developer.blender.org/D11604
2021-07-02 12:04:07 +02:00
9f5c0ffb5e Cleanup: Use const variables for object's evaluated mesh
Generally the evaluated mesh should not be changed, since that is the
job of the modifier stack. Current code is far from const correct in
that regard. This commit uses a const variable for the reult of
`BKE_object_get_evaluated_mesh` in some cases. The most common
remaining case is retrieving a BVH tree from the mesh.
2021-07-01 23:03:27 -05:00
016a2707f5 Cleanup: refactor edit-mesh copy functions into functions 2021-07-02 12:51:44 +10:00
841b2cea7b Cleanup: compiler & clang-tidy warnings 2021-07-02 12:15:29 +10:00
addb1a5c9a Cleanup: spelling in comments 2021-07-02 12:15:29 +10:00
b39d66adde Fix T88909: Win32 getTitle() UTF8 Support
In the Win32 platform our setTitle() can properly assign a Unicode
utf-8 window title. Unfortunately our getTitle() will only read regular
8-bit character strings. This means that we can never compare what we
set to what we get. This patch updates getTitle() to use Unicode-aware
GetWindowTextLengthW and GetWindowTextW.

see T88909 for an example of this affecting user experience.

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

Reviewed by Ray Molenkamp
2021-07-01 18:08:29 -07:00
0ff1c38fcc Cleanup: Move bvhutils.c to C++
This will be useful when adding a utility to create a BVH tree from a
`CurveEval` for the attribute proximity and attribute transfer nodes.
2021-07-01 16:46:55 -05:00
7eecf77f0b VSE: Fix handle size calculation
Handle width calculation was incorrect in drawing code. This caused
handles to be invisible when zoomed out.

After fixing math, handles become too large, so now they are constrained
to quarter of strip width, which feels more natural and represents
clickable area more closely.

`sequence_handle_size_get_clamped()` did not return size in pixels, but
in 2D-View space, this comment was corrected.
2021-07-01 23:38:06 +02:00
fd1fec5600 Cleanup: Clang tidy, remove typedef 2021-07-01 16:33:07 -05:00
b7b5c23b80 Fix memory leak in VSE transform code
SeqCollection wasn't freed.

It wasn't easy to find culprit so added argument to
SEQ_collection_create() to pass function name.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11746
2021-07-01 22:14:29 +02:00
519c12da41 VSE: Snapping feedback
Address initial feedback:
 - Use checkboxes instead of radio buttons
 - Hide snapping distance control from UI
 - Tweak snapping line color - use selected strip color, 50% transparency. Similar to other editors
 - Draw 2px thick line, since strip outline is also 2px thick

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11759
2021-07-01 22:08:11 +02:00
4a7951fede Cleanup: Separate each extractor into specific compile units
Makes code cleaner and easier to find.
2021-07-01 11:13:58 -03:00
4617172740 Fix race condition when loading multiple File/Asset Browsers at once
When multiple File or Asset Browsers would load at once (e.g. when loading a
file with two File Browsers open) and they would load multiple directories or
.blend files (using the Recursions option in the File Browser or loading an
asset library with multiple .blends), often only one File/Asset Browser would
correctly load all files. Others would be incomplete or entirely empty. That
was because of a race condition, where the directories or .blend files would be
loaded concurrently and the first one that finished would cancel the other
ones. This again happened because they used the job system with the same
"owner", which by design makes all jobs with the same owner cancel as soon as
the first is finished.
Address this by making sure they have different owners. That is, not the scene
anymore, but the filelist the job belongs to. Doesn't make much sense to use
the scene as owner for scene-unrelated file loading anyway.

Steps to reproduce were:
* Open two File Browsers as regular editors.
* In the Display Settings popover, set "Recursions" to 2 or 3 levels.
* Navigate to a directory with plenty of subdirectories in both File Browsers.
* Save the file.
* Reload the file, one of the File Browsers likely has an incomplete file list.

Alternatively, use Asset Browsers and open an asset library containing multiple
.blends.
2021-07-01 15:22:12 +02:00
a112adf16a Audaspace: porting pulseaudio fixes from upstream. 2021-07-01 14:26:13 +02:00
19d19970e4 Fix T88887: Audio causes issues with Playback when PC put to Sleep, Hibernate or when Screensaver appears
Porting WASAPI device reinitialization from upstream.
2021-07-01 14:26:13 +02:00
8c3855dc6e Fix broken physics modifiers after cleanup commits
4f3ec0110 and 5a64c687dd should have removed the entire conditional to skip
time depedent modifiers, rather than always enable it.
2021-07-01 12:58:42 +02:00
Paul Golter
229c0580e2 Fix: Export subtitles timecode relative to scene start frame, ignore muted strips
This patch writes the timecode in the .srt file relative to the start
frame of the scene. If the timecode is global but scene does not start
at frame 0 the subtitles don't match if they get loaded in an external
video player. Muted strips will be ignored. Don't allow negative
timecodes in .srt.

Reviewed By: Richard Antalik
Differential Revision: http://developer.blender.org/D11762
2021-07-01 12:21:31 +02:00
96d487b3ae Cleanup: remove redundant calls to BMO_error_clear 2021-07-01 17:25:27 +10:00
aaa8ee1307 Cleanup: remove bmesh-operator error code
The error codes could be used to look up messages from a table
of messages however this wasn't especially useful.

Now all calls to BMO_error_raise must inclue a message.
2021-07-01 17:01:19 +10:00
927456491a Fix edit-mesh partial update regression when snapping to normals
Edit-mesh partial update logic assumed translate didn't need normals
to be recalculated (for faces with all vertices being transformed).

However translate can optionally rotate which requires
all transformed normals to be updated.

Check for this case and use the previous partial-update method
when it modified extra geometry, so the normals are properly reset.
Further updates need not recalculate them.
2021-07-01 14:53:01 +10:00
02df67875a Cleanup: replace booleans with enum for storing translate rotation 2021-07-01 13:30:19 +10:00
f578e31a8e Correction to T89571 fix 4546f176eb
Supporting both object & edit-mode is more involved.
Both cases are now supported with object mode tracking the last-used
state for rotation so it's only reset once when rotation is disabled.
2021-07-01 12:58:10 +10:00
4546f176eb Fix T89571: Align Orientation to Target keeps rotation when toggled 2021-07-01 11:54:05 +10:00
1e532eb37a BLI_linklist_stack: use cast to prevent warnings when used in C++ 2021-07-01 11:24:54 +10:00
aa112dc77c Cleanup: spelling 2021-07-01 11:16:25 +10:00
39188f3c99 Cleanup: rename playhead to current-frame 2021-07-01 11:06:04 +10:00
930ecef9b5 Cleanup: outdated IPO references in comments 2021-07-01 11:06:04 +10:00
753806c731 Cleanup: spelling 2021-07-01 10:25:49 +10:00
a689b5932d Cleanup: remove unused internal grease pencil definitions 2021-07-01 10:25:49 +10:00
dba675fb65 Cleanup: split normal calculation into it's own file
Normals now includes many functions including normal splitting &
custom normal manipulation split this into it's own file
to centralize related functions.
2021-07-01 10:25:49 +10:00
924596abad Cleanup: clang-format, clang-tidy 2021-07-01 10:25:49 +10:00
Johnny Matthews
c1fc180861 Geometry Nodes: Curve Primitive Circle
This node has two modes: the first mode computes a circle from three
locations and a resolution. The second takes radius and resolution.
The first mode also outputs the center of the computed circle as
a vector.

Differential Revision: https://developer.blender.org/D11650
2021-06-30 19:22:13 -05:00
5a64c687dd Cleanup: Fix compiler warning from previous commit
The use_deform argument was always passed as zero or one, so the "< 0"
check is no longer necessary.
2021-06-30 18:03:45 -05:00
4f3ec01101 Cleanup: Use bool instead of int, rename variable
The "useDeform" argument was only passed as 1 or 0, so even though
there was an odd "< 0" comparison, it can be passed as a boolean.
2021-06-30 16:41:53 -05:00
17a67bf778 UI: custom free function improvements
This changes `UI_but_func_tooltip_set` so that it allows passing a custom free function, which has two benefits:

* The caller can pass `null` to indicate that the value should not be freed.
* Arbitrary c++ data can be passed to the callback (before the struct had to be trivially destructible).

I added `uiFreeArgFunc` and used it in other places where appropriate.

Differential Revision: https://developer.blender.org/D11738
2021-06-30 17:46:59 +02:00
ca12d70af0 Cleanup: variable naming for texture/material SocketPropertyType
Copy-Pasting error in rB3025c348253a

Maniphest Tasks: T88701

Differential Revision: https://developer.blender.org/D11755
2021-06-30 17:29:14 +02:00
5737193d81 Fix bad versioning of snapping flags
If the value of a macro has changed. We need to change all references to
that macro in the versioning code.
2021-06-30 10:42:09 -03:00
8de8ab38f6 Fix T89535: FCurve.mute UI text wrong
Copy-paste mistake in rB4e9817a4fb29 (copied from fmodifier).

Maniphest Tasks: T89535

Differential Revision: https://developer.blender.org/D11753
2021-06-30 15:38:06 +02:00
0e4245bc28 Fix T89554: UV snapping broken
Caused by {rBfba9cd019f21}.

Above commit reordered toolsettings snapping flags but missed remapping
these for the UV toolsettings in versioning code.

Differential Revision: https://developer.blender.org/D11756
2021-06-30 15:15:32 +02:00
be451354c9 Fix T89153: Follow Path for empty works only in negative values
The old code only clamped cyclic curves
2021-06-30 11:20:42 +02:00
918d9291d6 Cleanup: store the result of isLockConstraint for reuse
This was being called for every element in some situations.
2021-06-30 18:40:16 +10:00
c57b0cae28 Cleanup: rename transform mode variables
Use the term 'mat_final' for calculated matrices used for transforming.
Also rename 'pivot' to 'pivot_local'.
2021-06-30 18:18:30 +10:00
4f9ef65dac Transform: support multi-threading for bend 2021-06-30 18:01:14 +10:00
2d4ec90497 Transform: support multi-threading for most modes
Multi-threading support for transform modes: bevel-weight, crease,
push-pull, rotate, shear, shrink-fatten, skin-resize, to-sphere,
trackball & translate.

This is done using a parallel loop over transform data.

From testing a 1.5million polygon mesh on a 32 core system
the overall performance gains were between ~20-28%

To ensure the code is thread-safe arguments to shared data are const.

Reviewed By: mano-wii
2021-06-30 16:53:55 +10:00
501d2443d0 Cleanup: use const arguments for accessor functions 2021-06-30 16:42:19 +10:00
df9597cfba Cleanup: use const for datatoc declarations 2021-06-30 16:42:19 +10:00
Johnny Matthews
8884d2d61b Geometry Nodes: Curve Primitive Bezier Segment
Creates a Curve with 1 Bezier Spline from four positions (start,
start handle, end handle, end) and a resolution. The handles are
aligned and mirrored automatically. An "Offset" mode is also included
to allow specifying the handles relative to the control points.

The default settings recreate the existing default Bezier Curve in the
3D viewport add menu.

Differential Revision: https://developer.blender.org/D11648
2021-06-30 00:03:55 -05:00
c36d2a9a7a Cleanup: rename 'count' to 'len'
Reserve the term count for values that require calculation
(typically linked lists).

Without this convention it's difficult to know if using a length
accessor function in a loop will be O(N^2) without inspecting the
underlying implementation.
2021-06-30 14:39:32 +10:00
77ac1f39c4 Cleanup: unused arg warnings 2021-06-30 14:32:53 +10:00
Johnny Matthews
d3788207aa Geometry Nodes: Curve Primitive Quadratic Bezier Segment
This patch is for a node that creates a poly spline from a
3 point quadratic Bezier. Resolution is also specified.

Curve primitives design task: T89220

Differential Revision: https://developer.blender.org/D11649
2021-06-29 22:39:26 -05:00
Johnny Matthews
21ebee2580 Geometry Nodes: Curve Primitive Spiral
This node creates a curve spline and gives control for the number of
rotations, the number of points per rotation, start and end radius,
height, and direction. The "Reverse" input produces a visual change,
it doesn't just change the order of the control points.

Differential Revision: https://developer.blender.org/D11609
2021-06-29 22:22:28 -05:00
Johnny Matthews
86c6769e20 Geometry Nodes: Curve Primitive Spiral
This patch adds a Curve Primitives menu in Geometry nodes with an
initial entry of a star primitive.

The node is a basic star pattern node that outputs a poly spline.
Options control the inner and outer radius, the number of points,
and the twist of the valleys.

Differential Revision: https://developer.blender.org/D11653
2021-06-29 22:00:29 -05:00
2d35eed34d Cleanup: split uses of _snap_sequencer_apply according to transform mode
The `applySnap` callback of each mode was overwriting the value
calculated in `transform_snap_sequencer_apply`.
2021-06-29 18:08:41 -03:00
929d9ec0c7 Cleanup: Deduplicate code 2021-06-29 17:42:48 -03:00
dd14ea1819 Cleanup: split CalcSnapGeometry in smaller functions 2021-06-29 17:38:34 -03:00
fba9cd019f VSE: Improved Snapping
Change snapping behavior to snap strip edges when they are close to snap point.
Default behavior is, that each transformed strip is snapped to any other strip.

Implement snapping controls in sequencer tool settings. These controls include:

 - Snapping on/off
 - Ability to snap to playhead and strip hold offset points
 - Filter snap points by excluding sound or muted strips
 - Control snapping distance

Snapping controls are placed in timeline header similar to 3D viewport

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11646
2021-06-29 20:30:31 +02:00
ea43ae4194 Fix crash on link/append for asset data-blocks in Thumbnails mode
Same fix as 03a83b4eb5, but for the Thumbnails display mode.
2021-06-29 20:09:07 +02:00
516a060bb3 Fix T89523: Cycles OpenCL compile error after recent changes
Also correctly used inverse transposed matrix for normal transform.
2021-06-29 19:47:11 +02:00
999f1f7504 Win32: Window Placement DPI and Scale Adjustment
When using multiple monitors that differ in scale and/or dpi, the
varying sizes of the window titles and borders can cause the placement
of those windows to be out by a small amount. This patch adjusts for
those differences on Windows 10 and newer.

see D10863 for details and examples.

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

Reviewed by Ray Molenkamp
2021-06-29 09:29:40 -07:00
2ff714269e UI: Support setting operator properties for UILayout.operator_menu_enum()
`UILayout.operator_menu_enum()` now returns the operator properties, just like
`UILayout.operator()`. This makes it possible to set options for the operator
displayed in the menu. In C it can be done through the new
`uiItemMenuEnumFullO()` or `uiItemMenuEnumFullO_ptr()`.

It's reasonable to have this, probably just a small thing never bothered to
add. D10912 could use it, the following comment can be addressed now too:
https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/space_nla/nla_buttons.c$583-586
2021-06-29 18:20:56 +02:00
63aa6dd845 Cleanup: Win32 Window Creation
This is just some cleanup of the Win32 window creation code. After
CreateWindowExW() this patch uses some early exits to replace some
potentially confusing if blocks. No functional changes.

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

Reviewed by Ray Molenkamp
2021-06-29 08:51:51 -07:00
ae636994cd Fix Cycles hair render error on GPU after recent changes
Volumes primitive needs to be part of traceable primitives.
2021-06-29 16:35:06 +02:00
037035921b Cleanup: Remove unused function in lineart_cpu.c 2021-06-29 22:32:38 +08:00
e7fc15e2ef Fix T70615: Cycles ignores BSDF inputs when nodes are optimized
When compiling BSDF nodes, we only assing stack space to the normal and
tangent inputs if they are linked. However, it could be that the
ConstantFolder removed the link, so checking if there is a link fails
to take this into account.

To fix this, added a flag to ShaderInput to keep track of whether a
constant was folded into the input, and use it as well to verify that
the socket is linked when assigning stack space.

Reviewed By: brecht

Maniphest Tasks: T70615

Differential Revision: https://developer.blender.org/D11731
2021-06-29 16:24:21 +02:00
d1e0059eac LineArt: Filtering intersection lines using mask numbers
Mask value works just like transparency mask.

You are able to select intersection lines inside a
collection or, between collections.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11309
2021-06-29 20:47:55 +08:00
5d5cf53081 Fix T89484: NLA "Remove Empty Animation Data" missing Outliner refresh
Similar to rBb4530deec478, just add appropriate notifier.

Maniphest Tasks: T89484

Differential Revision: https://developer.blender.org/D11724
2021-06-29 14:37:00 +02:00
8f6a9c5176 Fix T89526: "Toggle Maximize Area" clears context screen properties
Removed in b787581c9c as it's comment
noted it was bad code, the reason for it's necessity was no longer valid.

Add this back with comment explaining why it's still needed.
2021-06-29 21:09:00 +10:00
5130bb116a Cleanup: unused warnings 2021-06-29 21:09:00 +10:00
df7db41e1b LineArt: Use separate sub panel for line types.
Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11735
2021-06-29 18:48:59 +08:00
f2c52aa0e1 Cleanup: use 'const' arguments in transform calculation
Use const arguments to simplify further optimizations.

Transforming elements shouldn't need to change their containers
data-structures.
ElementResize for grease pencil stroke thickness was
modifying TransInfo.num & TransInfo.values_final.

Now copies are operated on to preserve const correctness although
it's worth investigating if this can be avoided altogether.
2021-06-29 20:23:30 +10:00
855f7fee63 Cleanup: clang-format 2021-06-29 20:13:24 +10:00
203d405299 Cleanup: spelling 2021-06-29 20:12:51 +10:00
66d48b272e Cleanup: GPU Shader Log Parsing.
- Added functions to check if the cursor is at a number.
- Added function to parse a number.
- Joined skip_separator functions.
- Added function to check if cursor is at any given set of characters.
2021-06-29 09:52:31 +02:00
ee0c3081b0 Fixed issue in previous commit.
During development a test was disabled. Enabling it again.
2021-06-29 09:08:33 +02:00
2262d6c45a Fix T89405: Viewport Render Preview glitching (AMD)
AMD Drivers didn't report an additional space in the rendered. This made
testing for the HQ workaround fail and the issue appeared back on
certain cards.

This fix will test with surrounding spaces or if the renderer name
endswith the given string. If any of these are the case the hq normals
workaround will be enabled.
2021-06-29 09:04:24 +02:00
28135c06bb Typo in function identifier: mutli -> multi
Fixing small typo of word "multi" in function identifier by renaming
"count_mutli_input_socket_links" to "count_multi_input_socket_links"

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

Reviewed by Hans Goudey
2021-06-28 20:58:17 -07:00
24c321cfe9 Cleanup: Use function name for allocation strings
This is simpler, more consistent, and takes up less space.
2021-06-28 22:45:02 -05:00
91b31173e9 LineArt Cleanup: Rename floating->loose
see comment in https://developer.blender.org/rB841df831e89dfc4011c323203c2efb8265dc1878
2021-06-29 11:40:59 +08:00
34b213d604 Cleanup: use "use_" prefix for boolean types 2021-06-29 13:31:53 +10:00
c109a39995 Cleanup: translate comments
It wasn't so clear why the POINT_INIT check was disabled,
move this into the code comment.
2021-06-29 13:31:53 +10:00
f8d8f28e2c Curves: Avoid duplication of control points during evaluation
This commit avoids duplicating the deformed control point
list twice by modifying the list in the object curve cache directly.

For curves, the original control point data was duplicated into a
local listbase, deformed, used to create the "bevel list" data, and
then duplicated again for the object-level storage of deformed
control points. Text objects and surface objects had a similar
unnecessary duplication.
2021-06-28 22:22:06 -05:00
a3a7e19f07 Cleanup: Avoid freeing curve evaluation data twice
The curve bevel list was freed, and then freed again in a call to the
function that recalulates it. The curve "anim path" data was freed
only to be freed again in its calculation function as well. Also move
the anim_path calculation directly after the bevel list creation to
make its requirements more explicit.
2021-06-28 21:46:12 -05:00
3471ff1a5c Cleanup: Split curve and surface data evaluation functions, rename
Surface objects were already handled by an early return in the main
"curve types" function. This commit splits them, renames the funtions
to match (and be more consistent with other names), and sanitizes the
checking of object types.
2021-06-28 21:31:59 -05:00
d6480167ad Cleanup: Order return arguments last, use r_ prefix 2021-06-28 21:17:19 -05:00
60a2038fba Cleanup: clang-tidy 2021-06-29 10:37:00 +10:00
515d9f9a35 Cleanup: resolve discarded-qualifier warning 2021-06-29 10:23:22 +10:00
e1a719c043 Fix T89465: Loss of mouse movement when window left with pen.
When a window is left with a WinPointer pen, the inrange check
prevents resetting pen info.
2021-06-28 15:09:59 -07:00
2271b9b584 Cleanup: Avoid ASAN report when converting displist to mesh
Don't call `memcpy` with a null destination (and 0 size).
2021-06-28 16:56:30 -05:00
d0e6b59cd1 Cleanup: Replace paranoid check with assert
Every call to `BKE_displist_make_curveTypes` already checks the object
type beforehand, there is no need to check it again. Also removed an
outdated comment.
2021-06-28 15:21:14 -05:00
d2e473a2dd Cleanup: Remove unused "for_orco" argument to curve evaluation
`BKE_displist_make_curveTypes` had a `for_orco` argument that was
always false in calls to the function. Removing it allows the curve
displist and modifier evaluation code to become simpler. There are
some related cleanups in rBdf4299465279 and rB93aecd2b8107.
2021-06-28 15:14:43 -05:00
a0c45a2d54 Cleanup: Add function to create a CurveEval from a nurbs list
Sometimes the current spline list isn't part of the original curve, like
when using the deformed control points, etc. This will be helpful in
the curve modifier stack.
2021-06-28 14:28:52 -05:00
790cb28766 Curve: Add functions to retrieve const access to spline list
While the const correctness of `ListBase` is quite limited, it's helpful
to have a way to retrieve the `Nurb` list from curve object data without
casting away const from the curve.
2021-06-28 14:15:58 -05:00
dc0c81337d Cleanup: Use const arguments 2021-06-28 13:47:48 -05:00
Jesse Y
643720f8ab UI: Do Not Resize Already-Open Temporary Windows
There is no longer a need to resize windows that are _already_ open,
since temporary windows can no longer take over the space used by other
already-open temporary windows. This primarily affects Preferences and
Render windows.

see D11721 for more details.

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

Reviewed by Julian Eisel
2021-06-28 11:43:45 -07:00
c0fb8375f6 Fix T89515: Clicking on Favorites in File Browser will rename them
Likely uncovered by 6c97c7f767, the actual mistake would be from
6942dd9f49.

The hacks to display text buttons for renaming in UI-Lists used the emboss of
the text button for handling logic. It relied on the emboss `NONE` but we also
introduced `NONE_OR_STATUS` with 6942dd9f49. Both values need to be treated
equally for the logic of this hack to work.

The change in `interface_layout.c` is actually not needed for this exact issue,
but it's the correct thing to do. There may actually be more cases where `NONE`
and `NONE_OR_STATUS` need to be treated equally. Something to be checked still.
2021-06-28 19:47:13 +02:00
578ccdf75b Fix T89516: Crash on append
Caused by 37458798fa, was doing a NULL-pointer dereference because it used
the wrong pointer to check if the data-block is linked.
2021-06-28 19:30:56 +02:00
a5ed075110 Fix T87194: custom attributes not accessible with Cycles Volume
Custom properties defined on objects are not accessible from the
attribute node when rendering a volume in Cycles. This is because
this case is not handled.

To handle it, added a primitive type for volumes in the kernel,
which is then used in the initialization of ShaderData and to
check whether an attribute lookup is for a volume.

`volume_attribute_float4` is also now checking the attribute
element type to dispatch to the right lookup function.

Reviewed By: #cycles, brecht

Maniphest Tasks: T87194

Differential Revision: https://developer.blender.org/D11728
2021-06-28 19:09:15 +02:00
afb17552e1 Fix T89449: File Browser preview image not responsive to click
Logic in the main `switch` for button handling was wrong and would execute for
other button types than the new data-set row button type.
2021-06-28 18:38:53 +02:00
37458798fa LibOverride: Fix crash in ShapeKeys when making a mesh override local.
Weird 'embedded for overrides' flag of embedded IDs (including ShapeKeys
in override context) was not properly cleaned up when making an override
fully local.

Reported by studio, thanks.

@jbakker should be backported to 2.93LTS if possible.
2021-06-28 17:03:10 +02:00
e8d75b957f Fix UI glitch in outliner when hiding excluded collections.
In ViewLayer view, overrides of excluded collections would then show one
level higher, due to bad handling of those excluded collection in draw
code.

Reported by studio, thanks.

@jbakker should be backported to 2.93LTS.
2021-06-28 17:02:50 +02:00
6c97c7f767 Fix T89350: Emboss color missing from icon buttons without emboss
Passing `emboss=False`set `UI_EMBOSS_NONE` in the layout, which
completely disables button background colors for things like animation
state. This commit changes that to `UI_EMBOSS_NONE_OR_STATUS`,
which effectively restores the behavior to what it was prior to the
addition of that flag, with the added option to completely disable
the status emboss with `UI_EMBOSS_NONE`.
2021-06-28 10:00:15 -05:00
6ce4d39e6b Geometry Nodes: initial attribute list for meshes
This adds a new Attributes panel in the mesh properties editor.
It shows a list of all the generic attributes on the mesh.
In the future, we want to show built-in and other attributes in the
list as well. Related technical design tasks: T88460, T89054.

There is also a new simple name collision check that warns the user
when there are multiple attributes with the same name. This can be
problematic when the attribute is supposed to be used in geometry
nodes or during rendering.

Differential Revision: https://developer.blender.org/D11276
2021-06-28 16:53:25 +02:00
0afe4e81cb Fix name of UI emboss RNA enum item
This was a stupid mistake in my original commit that added this item.
While this is an API breakage, the name is simply wrong, and it is only
6 months old, and slightly niche.

Differential Revision: https://developer.blender.org/D11701
2021-06-28 09:51:39 -05:00
222c39fe70 Transform: Move "Proportional Size" and "AutoIK-Len" values to the beginning of the header
This prevents the text from shaking while transforming.
2021-06-28 11:48:32 -03:00
8de878e202 Draw: make 'ibo.lines_loose' extracting safer
No functional changes.
2021-06-28 11:48:32 -03:00
413bd71aaf Cleanup: remove unused macro parameters 2021-06-28 11:48:32 -03:00
cf21ba37ef LineArt: Occlusion effectiveness support
This patch adds a function where you can specify occlusion effectiveness from 0 to 255 layers per face for a given mesh material.

Reviewed By: Sebastian Parborg (zeddb)

Ref D11308
2021-06-28 22:26:23 +08:00
Mikhail Matrosov
9c6a382f95 Cycles: reduce shadow terminator artifacts
Offset rays from the flat surface to match where they would be for a smooth
surface as specified by the normals. In the shading panel there is now a
Shading Offset (existing option) and Geometry Offset (new).

The Geometry Offset works as follows:
* 0: disabled
* 0.001: only terminated triangles (normal points to the light, geometry
  doesn't) are affected
* 0.1 (default): triangles at grazing angles are affected, and the effect
  fades out
* 1: all triangles are affected

Limitations:
* The artifact is still visible in some cases, it could be that some quads
  require to be treated specifically as quads.
* Inconsistent normals cause artifacts.
* If small objects cast shadows to a big low poly surface, the shadows can
  appear to be in a wrong place - because the surface moved slightly above
  the geometry. This can be noticed only at grazing angles to light.
* Approximated surfaces of two non-intersecting low-poly objects can overlap
  that causes off-the-wall shadows.

Generally, using one or a few levels of subdivision can get rid of artifacts
faster than before.

Differential Revision: https://developer.blender.org/D11065
2021-06-28 14:05:22 +02:00
ce25b5812b Fix Cycles not rendering motion vector passes after recent changes
Causing regression tests to fail.
2021-06-28 13:57:12 +02:00
7d281a4f7d Functions: improve CPPType
* Reduce code duplication.
* Give methods more standardized names (e.g. `move_to_initialized` -> `move_assign`).
* Support wrapping arbitrary C++ types, even those that e.g. are not copyable.
2021-06-28 13:16:32 +02:00
f7e2559fd6 BLI: improve enum operators
* Use unsigned integer types for bit operations.
* Use 64 bit integer instead of 32 bit.
* Support scoped enumes (aka `enum class`) by adding some more casts.
2021-06-28 13:16:32 +02:00
2dbb492268 Fix T89455: Cycles crash when rendering a Mesh with autosmooth
The crash was caused by a mistake in 5f9677fe0c
where the pointers to the custom data layers would be overwritten with the one
for the first layer, as CustomData_duplicate_referenced_layer is only about the
first layer. customData_duplicate_referenced_layer_index should be used instead
to duplicate the right layer.
2021-06-28 13:12:07 +02:00
1b942ef90c GPU: Refactored +cleanup compilation log parsing.
Old implementation has a single parser of many different
formats. With the introduction of Vulkan this would lead
to another parser in the same function. This patch
separates the log parsing using a visitor pattern so the
log parsing can be configured per GPU backend or even
per driver.

With Vulkan we manage the compiler our self so the parsing
will become more straight forward. The OpenGL part depends
on many factors (OS, Driver) and perhaps even GPU.
2021-06-28 12:23:10 +02:00
dbd4ff4163 GPU: Separate compiler log from shader.
Current compiler log parser is to complex to follow. Moving it to its
own compile unit before refactoring.
2021-06-28 12:23:10 +02:00
c4d56199cc Cleanup: use doxy sections for editcurve_select.c
Signed-off-by: Campbell Barton <ideasman42@gmail.com>
2021-06-28 20:19:47 +10:00
Piotr Makal
98cd0fed36 Fix edit-mesh random select regression in random seed use
Fix regression in 9c20228128
that wasn't using the random seed correctly.
2021-06-28 19:57:46 +10:00
Piotr Makal
1c8c91384c Apply random selection precisely for curves, lattices & objects
This patch is part of: T87228.
Support accurate random selection for:

- CURVE_OT_select_random
- LATTICE_OT_select_random
- OBJECT_OT_select_random

Ref D11685
2021-06-28 19:51:49 +10:00
Piotr Makal
ab31c24322 BLI_rand: support for randomizing bitmaps
Add utility functions:

- BLI_bitmap_randomize
- BLI_rng_shuffle_bitmap

Part of D11685
2021-06-28 19:35:43 +10:00
addb2034a7 Cleanup: Fix const warnings in buttons_context.c 2021-06-28 17:34:15 +08:00
c297769d22 UI: Hide collection tab when scene master collection is active
CollectionLineart does not care about the configurations
in master collection.
Other options are not applicaple for master collection as well.
Hence hiding it.

Reviewed by Dalai Felinto (dfelinto)

Differential Revision: https://developer.blender.org/D11702
2021-06-28 15:51:34 +08:00
bb2648ebf0 Outliner: View Layers filter for View Layer Mode
This option allow users to see the view layer in context to the
others. It is particularly useful to see which view layers have which
collections enabled, and their render settings (holdout, ...).

This option is off by default.

Differential Revision: https://developer.blender.org/D11708
2021-06-28 09:34:44 +02:00
2ff490f9e3 Fix: Crash Requesting GPU_SHADER_GPENCIL_FILL builtin shader.
Shader doesn't have any shader code. Requesting the shader
would crash blender. Solved by removing the enum_value.
2021-06-28 08:55:13 +02:00
b2cd225623 GPU: Testcases for builtin shaders.
Adding compiler test (does it compile?) test for all builtin shaders.
2021-06-28 08:55:13 +02:00
f53bd31690 Cleanup GPU/Draw test cases.
In preparation of supporting vulkan. Draw/GPU tests should use
GPU_TEST or DRAW_TEST macros. These macros will run the test
on available drawing context backends like OpenGL or Vulkan.

As in master there is only an OpenGL backend nothing changed.
2021-06-28 08:55:13 +02:00
e94ec79341 Cleanup: use view3d_navigate prefix for walk/fly operators
Use matching file-name prefix as these operators are closely related.
2021-06-28 16:13:01 +10:00
7beb57f3bd Cleanup: update comments 2021-06-28 16:11:18 +10:00
6f42e69b58 Cleanup: de-duplicate 3D-view depth calculation function 2021-06-28 15:46:16 +10:00
7efc87dcd2 Cleanup: typos in RNA enums 2021-06-28 15:46:16 +10:00
1d8648b13a Cleanup: repeated terms in code comments & error messages 2021-06-28 15:46:08 +10:00
23c4854f45 UI: Cleanup: Phrasing of tooltips in line art modifier
Start the tooltip with a verb instead of a gerund, other small changes
for consistency and readability.
2021-06-27 23:48:46 -05:00
7223a0348f Fix T89330 Exact Boolean fails on a simple model.
The problem was an optimization I put in to triangulate quads.
It was wrong if the quad, after projecting onto a 2d plane, was
not convex. Handling quads the same as other faces fixes the bug.
Unfortunately, this will slow down Exact Boolean when the input has
many quads (the usual case, of course).
Will attempt to fix that with a later change, but for now, this
at least restores correctness.
2021-06-26 17:49:52 -04:00
abc6200331 Cleanup: spelling 2021-06-26 21:50:48 +10:00
46a222afd7 Cleanup: remove redundant/outdated comments 2021-06-26 21:50:48 +10:00
624bce6b4d Cleanup: redundant use of static constant 2021-06-26 21:50:48 +10:00
f1e4903854 Cleanup: full sentences in comments, improve comment formatting 2021-06-26 21:50:48 +10:00
fae5a907d4 GPencil: Duplicate Masks when separate Layer/Strokes
Now, the mask layers are copied and later a cleanup is done in order to verify all mask layer exist in destination object. If the layer mask does not exist, it's removed from the list.

This is related to T89234.
2021-06-26 11:38:37 +02:00
b5542c1ea4 Edit Mesh: optimize common use-cases for partial updates
Skip updating normals & tessellation for contiguous geometry regions
for operations such as translate & uniform scale.

This means when all geometry is selected, no updates are needed
as the relative locations of vertices aren't being modified.

Performance:

As this is skipping a multi-threaded operation,
larger improvements are noticeable on systems with fewer cores.

- ~1.15x to ~1.3x overall gain for 32 cores.
- ~1.7x to ~2.2x overall gain for 1 core (limited using `-t 1` argument).

Details:

- Rotate & non-uniform scale only skip tessellation.

- Proportional editing and axis-mirror have special handling
  ensure geometry is properly grouped before considering
  a face part of a single group that can be skipped.

- Loose vertices always need their normals to be recalculated
  since they're calculated based on the location.

- Non-affine transform operations such as shrink-fatten & bend,
  don't take advantage of this optimization.

- Snap projection also disables the optimization.
2021-06-26 17:07:05 +10:00
c1fe582446 Cleanup: move snap with projection check into a function 2021-06-26 16:57:03 +10:00
a287c8d3c1 BMesh: skip partial updates when there is nothing to do 2021-06-26 16:55:14 +10:00
3826fcf035 Cleanup: RNA warning 2021-06-26 16:53:48 +10:00
5759bbe9f9 Fixes a bug where the instances count in the spreadsheet
editor dataset region always showed 0. This was caused by a conditional
statement that needed a domain to be set, which is not the case for
Instances component type.

Reviewer: Hans Goudey (Hoogly Boogly)

Differential Revision: https://developer.blender.org/D11710
2021-06-25 22:57:47 +02:00
eae7090464 Fixes a warning where dst array size was wrong in the
signiture of BLI_str_format_attribute_domain_size.

Reviewer: Hans Goudey (Hoogly Boogly)

Differential Revision: https://developer.blender.org/D11710
2021-06-25 22:56:50 +02:00
cb548329ea UI: Improved File Browser Preview Image Scaling
This patch enables sample filtering when scaling preview images in File
Browser, improving the result a bit. Reduces blockiness and other
artifacts when enlarging the images.

see D11706 for details and examples.

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

Reviewed by Julian Eisel
2021-06-25 10:37:43 -07:00
9586472b9a Cleanup: Clang format 2021-06-25 12:11:13 -05:00
23042a3fb1 Cycles: add view layer option to disable motion blur, in the Filter panel 2021-06-25 18:47:54 +02:00
f863ef8a34 Cleanup: make format
string.c still needs cleanup, but I will leave to the original
author of the latest chagnes to do it since it needs
some tags to skip formatting.
2021-06-25 18:42:30 +02:00
74450265d0 Fix T87185: value assigned to modal Scale does not work properly
`t->values` does not necessarily represent a final value of the
transformation, as each mode treats this value differently.

So, unfortunately, we cannot have a generic offset solution for modal
transform operations. Offset needs to be handled by each mode.

Note: Currently only, `Move`, `Rotate` and `Resize` support this.
2021-06-25 12:52:27 -03:00
20e68d848e Fix T89430: Realizing NURBS curve instances is broken
The "copy_data" function for nurbs splines was incorrect,
it always set the destination's knots vector as "not dirty,"
even if the source's was.
2021-06-25 08:56:40 -05:00
Mihnea Stoian
5ec6c8d267 Linux: prefer using dedicated GPU when launching Blender
Adds "PrefersNonDefaultGPU" and "X-KDE-RunOnDiscreteGpu" to the .desktop file.
Similar hints for macOS and Windows exist already, to prefer using a dedicated
GPU over a slower integrated GPU.

See: https://gitlab.freedesktop.org/xdg/xdg-specs/-/merge_requests/13

Differential Revision: https://developer.blender.org/D11643
2021-06-25 15:28:19 +02:00
5f9677fe0c Fix T88756: crash when baking with autosmooth
When baking some data, we create a new Mesh with edits and modifiers applied.
However, in some cases (e.g. when there is no modifier), the returned Mesh is
actually referencing the original one and its data layers. When autosmooth is
enabled we also split the Mesh. However, since the new Mesh is referencing the
original one, although `BKE_mesh_split_faces` is creating new vertices and edges,
the reallocation of the custom data layers is preempted because of the
reference, so adding the new vertices and edges overwrites valid data

To fix this we duplicate referenced layers before splitting the faces.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11703
2021-06-25 14:16:07 +02:00
3558bb8eae LineArt: Filtering feature lines with face mask
User can specify filtering options inside line art modifier,
like inverting selection and including face mark region border.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11307
2021-06-25 18:48:20 +08:00
ae085e301c Spreadsheet: Dataset region for spreadsheet editor
This patch adds a left aligned sidebar to the spreadsheet editor. This
Sidebar can be used to navigate the geometry component types and
attribute domains. It also provides a quick overview of domain sizes.
It replaces the two dropdowns in the regions header.
Next step will be to add the domain cycling shortcut
using the CTRL + mouse wheel.

Reviewer: Dalai Felinto (dfelinto), Julian Eisel (Severin),
Hans Goudey (HooglyBoogly).

Differential Revision: https://developer.blender.org/D11046
2021-06-25 07:57:24 +02:00
841df831e8 LineArt: More type & related chaining improvements
This patch includes: Floating edge type support,
Special chaining option for floating edge,
Chaining option for reducing jagged edges when floating
edges are involved.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11306
2021-06-25 13:15:25 +08:00
3d7021b4ec GHOST/XR: support Wayland via XrGraphicsBindingOpenGLWaylandKHR 2021-06-24 18:40:05 +01:00
b129a0b397 GHOST: remove unused EGL context includes in Win32 and Cocoa 2021-06-24 18:40:05 +01:00
5f27a5fff7 GHOST/EGL: store pointer to GHOST_System for downcast tests 2021-06-24 18:40:05 +01:00
b801db1181 GHOST/Wayland: auto-select highest supported OpenGL version 2021-06-24 18:40:05 +01:00
b5840f9b5b Cleanup: compiler warnings with clang
* Mark either all or no class methods with override
* Don't use zero sized array since it has a different size in C and C++.
  Using a little more memory here is not significant.
* Don't use deprecated mechanism to mark private GSet members in clang
  just like we don't for MSVC, it warns even for simple zero initialization.
2021-06-24 19:35:23 +02:00
Leon Zandman
beb6399ae5 Fix T89129: file dialog displays in-progress Safari downloads as a folder
In-progress Safari download files/packages are now recognized as bundles
and therefore not treated as directories.

Differential Revision: https://developer.blender.org/D11613
2021-06-24 19:05:49 +02:00
Thomas Lachmann
15868b1ff4 Fix wrong default value for RenderEngine.bl_use_image_save
Differential Revision: https://developer.blender.org/D11680
2021-06-24 19:03:07 +02:00
7b524d9b71 Cleanup: move and simplify some draw_cache macros 2021-06-24 10:54:08 -03:00
a13314a03f Fix T89390: crash when join geometry node has only muted inputs 2021-06-24 15:45:43 +02:00
cbdddc5648 Workaround for assert from 27da305a40
This worked for existing scenes but adding new objects was asserting
needs further investigation.
2021-06-24 21:01:48 +10:00
51568030e9 Depsgraph: remove redundant mesh data duplication in edit-mode
This resolves a bottleneck where every update while transforming
copied the entire mesh data-block, which isn't needed as the edit-mesh
is the source of the data being edited.

Testing shows a significant overall speedup when transforming:

- ~1.5x with a subdivided cube 1.5 million vertices.
- ~3.0x with the spring mesh (edit-mode with modifiers disabled,
  duplicated 10x to drop performance).

Reviewed By: sergey

Ref D11337
2021-06-24 20:23:00 +10:00
27da305a40 Depsgraph: support flushing parameters without a full COW update
Avoid computationally expensive copying operations
when only some settings have been modified.

This is done by adding support for updating parameters
without tagging for copy-on-write.

Currently only mesh data blocks are supported,
other data-blocks can be added individually.

This prepares for changing values such as edit-mesh auto-smooth angle
in edit-mode without duplicating all mesh-data.
The benefit will only be seen when the user interface no longer tags
all ID's for copy on write updates.

ID_RECALC_GEOMETRY_ALL_MODES has been added to support situations
where non edit-mode geometry is modified in edit-mode.
While this isn't something user are likely to do,
Python scripts may change the underlying mesh.

Reviewed By: sergey

Ref D11377
2021-06-24 20:23:00 +10:00
67b352f9c5 Fix T87486: Can't open file with modifiers to a grease pencil library override
Very stupid typo in override apply code on GP modifiers (typical
copy/paste mistake from original modifiers code).

@jbakker this should be back-ported to 2.93LTS.
2021-06-24 12:10:38 +02:00
8cdb99d51c Fix linking code after own recent commit.
More stupid mistake in recent enhanced reports for file load code,
rB82c17082ba0e left some read-after-free situations.
2021-06-24 12:10:06 +02:00
3a8347f823 CMake: link bf_blenkernel from bf_depsgraph
Without this tests fail to lknk in D11377. Commit separately as the
depsgraph is using BKE it should link to it.
2021-06-24 19:38:26 +10:00
6570159929 Cleanup: update clang-format so PyObject_HEAD indents properly 2021-06-24 17:12:04 +10:00
1f778dbefc Cleanup: use Blender's code style for doxygen commetns in freestyle 2021-06-24 15:59:34 +10:00
4b9ff3cd42 Cleanup: comment blocks, trailing space in comments 2021-06-24 15:59:34 +10:00
2e99a74df9 Cleanup: use '#if 0' for commented code-block 2021-06-24 15:53:26 +10:00
879b89e967 Cleanup: correct variable name in comments 2021-06-24 15:53:26 +10:00
0469f2392f Cleanup: remove outdated/redundant comments 2021-06-24 15:53:26 +10:00
55bffa82da Cleanup: clang-format, spelling 2021-06-24 15:53:26 +10:00
de6c6501f0 LineArt: Bound box visibility check when loading
This patch enables bound box check when loading geometry
into line art. Works with overscan as well. Will discard
object if its bbox completely lies in one side of the
clipping space frustum.

Reviewed by: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11545
2021-06-24 13:17:29 +08:00
de05e261ec Line Art: Discard out of frame edges.
For scenes that have a lot of edges, this could potentially
save some time generating individual strokes that are outside
camera frustum.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11525
2021-06-24 13:09:25 +08:00
f7fbb518c8 Fix failure when baking actions with Bendy Bones
682a74e090 renamed Bendy Bones properties and replaced existing float
properties with float-vector properties. This updates the property names used
by the action baking operator (`NLA_OT_bake`).
2021-06-24 00:10:11 +02:00
d6212f67a9 Remove window iteration in WM_DISPLAYCHANGE.
Iteration was incorrectly calling the same object. Had it called every
window it would still be unnecessary as WM_DISPLAYCHANGE is sent to all
broadcast receiving windows.
2021-06-23 10:12:21 -07:00
ef7fcaf8e6 Voxel Remesher: Make smooth shading output automatic
Previously the smooth shading of the voxel remesher was controlled by a
mesh property. With this change, the output will try to match the
current shading of the object. This only takes into consideration the
shading mode of the first polygon of the model, but it is probably what
most users expect as it works as intended with the shade smooth/flat
object mode options.

Reviewed By: JulienKaspar, JacquesLucke

Differential Revision: https://developer.blender.org/D11626
2021-06-23 18:42:40 +02:00
6e4b9f5836 Fix T89221: Sculpt tools symmetry failing with non symmetrical meshes
SCULPT_nearest_vertex_get expects a distance, not a distance squared.
This should make symmetry work as expected, but it still can fail if the
mesh topology is not completely symmetrical.

Reviewed By: JacquesLucke

Maniphest Tasks: T89221

Differential Revision: https://developer.blender.org/D11642
2021-06-23 18:17:46 +02:00
c9f12b21e2 Compositor: Full frame ID Mask node
Adds full frame implementation to this node operations.
No functional changes.
1.2x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11638
2021-06-23 17:46:54 +02:00
35db01325f Compositor: Full frame Image node
Adds full frame implementation to Image node operations.
Mostly refactored into buffer utility methods for reuse in other
operations.
No functional changes.
1.8x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11559
2021-06-23 17:46:53 +02:00
8f4d991594 Cleanup: remove unused parameter 2021-06-23 17:46:53 +02:00
a50a51eef0 Fix T88769: GPencil smooth incorrect behavior in cyclic strokes
When use smooth tool in a cyclic stroke, the smoothing algorithm was not using the adjacent points if these are the end or start of stroke.

Now, the smooth uses the other extreme of the stroke to compute smoothness.
2021-06-23 17:28:01 +02:00
276790cbfa LibOverride: Also override owner collection in Outliner hierarchy override.
This change will ensure at least one 'local' collection can host the new
'local' override of all objects (indirectly) overridden by this
operation, such that no new override of object ends up in master
collection (which can become extremely messy in production files).

In practice, it means often at least one of the linked collection owning
those objects also has to be overridden.

NOTE: This only affect cases where root overridden linked object has
some dependencies outside of its own root linked collection. While this
situation should be avoided, it cannot always be, so we try to support
it as best as we can.
2021-06-23 17:07:35 +02:00
7dd7849ddd Memfile Undo: aslo tag embedded IDs for update.
This is again in the fuzzy area of how embedded IDs are handled
respectively by partial undo code and depsgraph... Should not be
necessary currently, but better be safe and explicit, and also tag
those embeded IDs from re-used owner ID.
2021-06-23 17:00:17 +02:00
7561e3dad0 CMake/win: Fix linker issue with OCIO
In certain CMake configurations it was possible
that OCIO gave linker errors due to it thinking
it was using the shared library rather than the
static library we ship.
2021-06-23 08:45:37 -06:00
354ecc2f1e Fix T89269: Memory corruption during extrusions of overlapping edges
The "extrude" operator with the "use_dissolve_ortho_edges" option assumed
the edges were connected.
2021-06-23 11:37:35 -03:00
157081069d Fix (studio reported) crash on Undo in some cases.
Would crash when adding or removing a collection directly to the master
collection of a scene.

Consequence of change to handle depsgraph-controlled evaluation of some
IDs (like excluded collections which do not get evaluated and do not get
a COW anymore). See rBcf4258673755 and D10907.

Note that this mostly demonstrates once again how weak and flacky our
handling of embedded IDs still remains, with some part of the code
handling them as independent IDs, some as fully local/private data, some
as a mix of both... and lots and lots of custom handling code and corner
cases that are a bottomless pit of issues.

Also quiet incredible that this was not reported already, luckily this
original change did not make it to 2.93 release.
2021-06-23 16:16:29 +02:00
befb9d99f8 Fix T89331: Cycles lights flicker when transformed
The check on the transformation introduced in rBb313525c1bd0 to fix
T88515 would sometimes prevent to update the light if the Blender object
changed. To fix this, reverse the order in which the checks happen so
that we do not shortcuit the object change check.
2021-06-23 16:07:06 +02:00
b964f73e7d Readfile: use CLOG instead of printf's.
Note that this commit uses a second LogRef (`blo.readfile.undo`) for undo
specific meassages. Allows to use `--log "*undo*"` cli option to match
all undo reporting.

Also did some minor tweaks to some reports on the way.
2021-06-23 14:23:54 +02:00
eed9ac5b6e Fix Scene/MasterCollection handling in BKE_main_collection_sync_remap().
Those were missing proper (explicit) object cache clear, and DEG
tagging.

Note that this was most likely not an common issue in practice (Collection
object cache clearing recursively goes into all parents, so master
collection would only miss it in case they had no child collections at
all, and tagging of those happens almost always at other steps on
remapping). But better to be explicit and consistent here in any case.
2021-06-23 12:15:09 +02:00
e291432f5f Fix T89342: Select mirror with a zero length central edge asserts 2021-06-23 20:07:19 +10:00
635b4db162 Fix T89367: Crash running edit-mesh select_linked_pick from Python 2021-06-23 19:45:48 +10:00
Pratik Borhade
a6f275cad3 Fix T88808: Set Origin missing from Text object in 2.93
Fix T88808.
Caused by {rB5f2c5e5bb8c15bf0d6679351e3482f9c38c00935}

object type for `TEXT object` was missing in following check
that's why `Set Origin` option was lost from object context menu.

Reviewed By: lichtwerk

Maniphest Tasks: T88808

Differential Revision: https://developer.blender.org/D11495
2021-06-23 11:12:13 +02:00
82c17082ba Revert "Revert "Enhanced stats/reports for blendfile reading.""
This reverts commit rB3a48147b8ab92, and fixes the issues with linking
etc.

Change compared to previous buggy commit (rBf8d219dfd4c31) is that
new `BlendFileReadReports` reports are now passed to the lowest level
function generating the `FileData` (`filedata_new()`), which ensures
(and asserts) that all code using it does have a valid non-NULL pointer
to a `BlendFileReadReport` data.

Sorry for the noise, it's always when you think a change is trivial and
do not test it well enough that you end up doing those kind of
mistakes...
2021-06-23 10:37:00 +02:00
071799d4fc Fix T89265: Crash when tabbing through num inputs
Fix by reverting the part of ec30cf0b74
that assigned `but->editval` in `ui_numedit_begin_set_values`.

Causing access freed memory when using tab to switch
to a numeric input and then leaving the textbox by clicking outside.
This was because `ui_numedit_begin_set_values` shouldn't need to set
`but->editval` and overwrite the pointer.
This would set a pointer that had previously been freed,
causing a `NULL` check to fail later on.

Ref D11679
2021-06-23 14:56:36 +10:00
61b22d27c8 Fix T89249: incorrect mesh validate error with zeroed vertex normals
It's not an error for centered vertices to have a zero normal.
2021-06-23 13:57:23 +10:00
5cc8e7ab53 Cleanup: reformat trailing comments that caused line wrapping 2021-06-23 13:54:12 +10:00
2c916c97ac Cleanup: clang-tidy quiet equals-default, nullptr warnings 2021-06-23 12:04:19 +10:00
0f427f4eb1 Cleanup: suppress clang-tidy warnings 2021-06-23 11:48:08 +10:00
58e58310b7 Cleanup: compiler warning for invalid argument type 2021-06-23 11:44:02 +10:00
a8f37763ca RNA Manual Reference: Update Mapping File 2021-06-22 19:37:45 -04:00
dbc054bb88 Fix T89374: Erasing/cutting in Grease Pencil makes Blender shut down
When cut a stroke of 1 point, the clean up done to avoid keep 1 point strokes removes the memory, but the pointer to the first stroke was not set to NULL. As this pointer is invalid now, any use of this produces a segment fault because the pointer is corrupted..
2021-06-22 23:12:04 +02:00
abb07a38b8 GHOST/XR: fix code format 2021-06-22 22:05:47 +01:00
c88c331384 PyDoc: Update Sphinx and pin dependencies
Sphinx has rather loose dependency requirements which can cause issues if we aren't careful.
As a solution they recommend that you pin sphinx dependency versions
2021-06-22 16:30:07 -04:00
Leon Leno
187e217b5a UI: Fix widget emboss: Also fade on the right side
Currently the emboss is only fading on left side of the widget,
resulting in the emboss extending vertically on the right side
and ending abruptly. This patch fixes this by also fading the
emboss on the right side and making it symmetric.

Differential Revision: https://developer.blender.org/D10810
2021-06-22 15:21:53 -05:00
fa1868ae97 Transform: display units for proportional edit value
This fixes T88346.

The code is also more readable by making a better distinction between
the texts used for Distances, "Proportional Size" and "AutoIK-Len".

And the text used to translate the "Proportional Size" is reused.
2021-06-22 17:17:44 -03:00
c3b641613c Cleanup: deduplicate code and rename variables
This makes it clearer that variables are strings and how they are used
in the Move header code.
2021-06-22 16:51:34 -03:00
0732a9f1b2 GHOST/XR: enable X11-EGL context for OpenXR 2021-06-22 20:00:40 +01:00
87833f8f95 GHOST/EGL: add GHOST_XrGraphicsBindingOpenGL as friend 2021-06-22 20:00:40 +01:00
b35ba22d84 GHOST/EGL: getters for display, config and context 2021-06-22 20:00:40 +01:00
c6e6a9046e GHOST/EGL: ignore unused variables 2021-06-22 20:00:40 +01:00
ee8b284d11 Fix T89327: Cube and ico sphere nodes do not create UVs
It turns out you have to add the UV custom data layer manually before
calling the BMesh primitive operators, even if you pass `calc_uvs=true`.
2021-06-22 13:22:40 -05:00
Leon Zandman
c317f111c1 Cleanup: Spelling Mistakes
This patch fixes many minor spelling mistakes, all in comments or
console output. Mostly contractions like can't, won't, don't, its/it's,
etc.

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

Reviewed by Harley Acheson
2021-06-22 10:54:50 -07:00
2fcd3f0296 Cleanup: Remove extra blank line 2021-06-22 19:52:16 +02:00
1917d0345e Fix T89366: GPencil hide layers above parented layer
The problem was the flag was not reset by layer in the loop.
2021-06-22 19:49:03 +02:00
ebfad93039 Fix T89343: Point cloud instances not transformed when realized
This problem has surprisingly been there for quite a few months.
For point clouds all attributes were handled the same, even "position",
which should be transformed when combining source points into the
destination.
2021-06-22 12:19:34 -05:00
3a48147b8a Revert "Enhanced stats/reports for blendfile reading."
This change crashes library linking operators, related tests and probably more.

This reverts commit f8d219dfd4.

Ref D11583
2021-06-22 19:13:50 +02:00
0b15353baa Geometry Nodes: Join curve attributes when realizing instances
Previously the code assumed that curve instances had no attributes.
This is true when the data came from curve objects, which don't support
attributes currently, but it isn't necessarily true when retrieving curves
from evaluated geometry sets.
2021-06-22 11:35:00 -05:00
f3eecfe386 Cleanup: Refactor spline copying functions
Make the virtual functions protected and simpler, so that the logic is
better contained in the base class's implementation. Also introduce a
`copy_without_attributes` method to be used for realizing instances.
2021-06-22 11:32:50 -05:00
026de343e3 Fix deadlock with shrinkwrap and other modifiers
More code that needs task isolation. Encountered in sprite fright production
file.

Ref D11603
2021-06-22 18:26:58 +02:00
f8d219dfd4 Enhanced stats/reports for blendfile reading.
Add direct user feedback (as a warning report) to user when recursive
resync of overrides was needed.

And some timing (as CLOG logs) about main readfile process steps.

This is essentially adding a new BlendFileReadReport structure that wraps
BKE_reports list, and adds some extra info (some timing, some info about
overrides and (recursive) resync, etc.).
2021-06-22 17:28:19 +02:00
6ff0d59967 Minor cleanup to previous commit introducing BLI_math_time.
Forgot to address latest review comments, sorry for the noise.`:wq
2021-06-22 17:02:45 +02:00
feaf309de7 Add initial BLI_math_time with a 'seconds decompose' function.
Allows to decompose a given amount of seconds into a random set of
days/hours/minutes/seconds/milliseconds values.

Also add matching test.

Differential Revision: https://developer.blender.org/D11581
2021-06-22 17:00:18 +02:00
f4e3b1e573 Fix T89360: Eevee transforms geometry when using "High Quality Normals"
Offset missed in rB44d2479dc36f
2021-06-22 10:14:13 -03:00
e3bdb189a7 Cleanup: split BKE_object_batch_cache_dirty_tag
Create a more specialized function `BKE_object_data_batch_cache_dirty_tag`
2021-06-22 09:06:33 -03:00
ab063db34d Cleanup: deduplicate free code
It is more appropriate that `depths` is freed in `ED_view3d_depths_free`.
2021-06-22 08:25:32 -03:00
3f1111b2a8 Draw: Added testcases for hair refine shaders. 2021-06-22 11:11:31 +02:00
ad9fd47d7b Fix T89347: Edit-mesh make planar faces doesn't update face normals
Invalid face normals were used for tessellation.
2021-06-22 18:32:51 +10:00
01234b430b Fix T89345: Edit-mesh decimate doesn't update face normals
Invalid face normals were used for tessellation.
2021-06-22 18:27:52 +10:00
956c539e59 Fix T89196: Depsgraph use-after-free after scene switching undo
Delay depsgraph visibility update tagging until it is known that
graph relations are up to date, and until it is known that the graph
is actually needed to be evaluated.

Differential Revision: https://developer.blender.org/D11660
2021-06-22 09:52:45 +02:00
d3a792431e Cleanup: Use more clear visibility tag function name
No functional changes. Just makes it clear this is not an immediate
update, and will make an upcoming change more localized.
2021-06-22 09:52:45 +02:00
53ba9f01e2 Fix error in context menu when built without freestyle 2021-06-22 17:19:02 +10:00
1725bfc3cb Cleanup: remove unused menu VIEW3D_MT_edit_mesh_edges_data
8aa17c5b12 missed removing the
menu definition when removing from the UI.
2021-06-22 17:18:28 +10:00
6a3bd04e42 Cleanup: rename playhead in the UI and code
Current convention is not to use this term, use "current frame",
and "timeline frame" in render.c as this is the argument passed in.
2021-06-22 17:03:22 +10:00
8af2c87f7e 3D View: adjust order of planes for occlusion check
Move far plane last since it's the least likely to intersect edges.
2021-06-22 15:59:15 +10:00
cd39e3dec1 OptiX: select BVH build options from Scene params
Currently, the OptiX BVH build options are selected based on whether
we are in background mode (final renders) or not (viewport renders).
In background mode, the BVH is built for fast path tracing and low
memory footprint, while in viewport, it is built for fast updates.

However, on platforms without OpenGL support, the background flag is
always set to true and prevents using fast BVH builds in the viewport.

Now, the BVH options derive from the Scene BVH settings:
* if BVH is static, a fast to trace BVH is built
* if BVH is dynamic, a fast to update BVH is built

Reviewed By: #cycles, brecht

Differential Revision: https://developer.blender.org/D11154
2021-06-22 07:38:28 +02:00
338be95874 Fix bone select failing with end-points outside the view
Apply the same fix for T32214 (edge-select failing) to bones
which also failed when their end-points were outside of the view.

- Add V3D_PROJ_TEST_CLIP_CONTENT support for edit & pose bone iterator
  and use for selection operators.
- Remove unnecessarily complicated checks with pose-mode lasso tagging.
- Correct error in pose-mode LassoSelectUserData.is_changed
  (currently harmless as it's not read back).
2021-06-22 14:23:37 +10:00
9ac56bad4c Cleanup: use early return for selection callbacks 2021-06-22 14:23:37 +10:00
67ee87a6e9 Cleanup: spelling 2021-06-22 14:23:37 +10:00
53e1442ac2 Cleanup: comment use C comment-blocks for GHOST_Types.h
Also use full sentences, and correct typos.
2021-06-22 14:23:37 +10:00
e1d6219731 Cleanup: Use "size" instead of "points_len" in spline code
Previously this was mostly consistent, but not completely. It's helpful
to use the same name for the same meaning everywhere in this area.
2021-06-21 23:07:26 -05:00
dc3b7602ee Cleanup: Rename variables, use shorter names
`src` and `dst` are perfectly clear, and avoid repeating unecessary
characters when writing the variables many times, allowing more space
for everything else.
2021-06-21 23:02:00 -05:00
d086570c7a UI: Sequencer: add refresh_all operator to all sequencer view menus
This commit piggybacks on rB3e695a27cdfad560d0b28e742cfa069d098200d6
2021-06-21 22:29:58 -04:00
4947aa29db CMake: Improve python version mismatch error
When CMake detects and incompatible Python version
it errors out with an error saying at-least python 3.9
is required, but doesn't mention the version it detected.

This makes troubleshooting the problem harder than it
needs to be.

This diff changes the error message to include the python
version CMake detected.

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

Reviewed By: Ray Molenkamp
2021-06-21 18:19:07 -06:00
d443dcc733 Build/Windows: Preliminary VS 2022 support.
This adds preliminary VS 2022 support, since
there currently is no CMake version that
supports the VS2022 IDE only ninja support
was tested.

IDE support should work without any additional
changes as soon as an updated CMake becomes
available.

As VS2022 appears to keep binary compatibility
with earlier MSVC versions, the current SVN
libraries will work for this version.
2021-06-21 18:11:30 -06:00
6f158f834d Refactor of Wintab to use Wintab supplied mouse movement once verified against system input.
Reviewed By: brecht, LazyDodo

Maniphest Tasks: T88852

Differential Revision: https://developer.blender.org/D11508
2021-06-21 14:38:51 -07:00
445d506ac9 Geometry Nodes: Use multithreading for the curve to mesh node
This commit optimizes the node for the case where it works on many
splines by allowing it to generate mesh data from their combinations
in parallel. By itself, this made the node around twice as fast in my
test file with a result of 20 million vertices, around 600ms instead of
1.2s before.

That isn't actually a very good result; it reveals another bottleneck,
a single threaded loop over all face corners in the mesh normal
calculation code. As a simple change that might improve performance
in some situations, this commit moves normal calculation out of this
node, so at least the work isn't wasted if the mesh is changed later
on in the node tree anyway.
2021-06-21 16:17:02 -05:00
Germano Cavalcante
b11a463e4f Refactor: Do not keep a copy of depth buffer in RegionView3D
The depth cache (located in `RegionView3D::depths`) is used for quick
and simple occlusion testing in:
- particle selection,
- "Draw Curve" operator and
- "Interactive Light Track to Cursor" operator,

However, keeping a texture buffer in cache is not a recommended practice.

For displays with high resolution like 8k this represents something
around 132MB.

Also, currently, each call to `ED_view3d_depth_override` invalidates
the depth cache. So that depth is never reused in multiple calls from
an operator (this was not the case in blender 2.79).

This commit allows to create a depth cache and release it in the same
operator. Thus, the buffer is kept in cache for a short time, freeing
up space.

No functional changes.
2021-06-21 16:41:50 -03:00
b665ad8621 Fix T89291: Objects with rotation deltas don't rotate in correct axes
Quaternion correction was not implemented and Euler values were being
incorrectly combined.
2021-06-21 14:31:45 -03:00
41af27c582 Fix deadlocks in mesh modifier evaluation and particles
The recent task isolation changes missed two mutex locks that also need task
isolation.

Ref D11603, T89194
2021-06-21 19:25:12 +02:00
47473bee34 GPencil: Disable Lights when duplicate layer
Missing to disable default light ON when use separate operator.
2021-06-21 16:59:20 +02:00
b9ccfb89ce Performance: Flush selection to edges/faces.
This patch uses threading to flush selection from verts to edges and
from edges to faces. The solution is lockless and should scale well on
modern CPU architectures.

Master:{F10185359}
Patch:{F10185361}

End user performance went from 3.9 to 4.6 FPS (Stanford Dragon) but that
was measured on a Intel Core i7-6700 CPU and AMD RX480 Gpu. The more
cores the better improvements you get.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11644
2021-06-21 16:35:28 +02:00
ce64cfd6ed Fix T89306: GPencil selection doesn't work correctly with modifiers
The problem was introduced with Bezier modification because the selection code was using the original stroke and not the evaluated version.
2021-06-21 16:08:26 +02:00
3cf39c09bf Cleanup: improve naming in Compositor 2021-06-21 13:51:51 +02:00
4246898ad3 Cleanup: move function parameter to member
Get current pass only when needed.
2021-06-21 13:51:51 +02:00
2851602052 Add a reason for why an Addon can not be loaded. This change gives a more detailed explanation of the issue and may help the Addon Developer to identify what exactly needs to be changed.
The current message 'addon not loaded' is a bit too sparse.

Differential Revision: https://developer.blender.org/D11655
2021-06-21 12:51:46 +02:00
4968a0bdf9 Fix T89122: crash when multi input is connected to multiple group inputs
The early `return` was wrong when there are multiple origin sockets
that need to be loaded.
2021-06-21 12:15:32 +02:00
Daniel Salazar
f383cad329 Fix T89329: icosphere subdivisions can be set to 0
Differential Revision: https://developer.blender.org/D11658
2021-06-21 11:11:11 +02:00
002d563bbb Cleanup: use doxy sections in view3d iterators 2021-06-21 18:17:02 +10:00
4d91808710 Cleanup: variable naming in view3d_iterators
Consistently use a/b instead of 0/1.
2021-06-21 18:01:12 +10:00
4044c29069 Fix T32214: Wireframe edge select fails with verts behind the view
This resolves a long standing bug in edge selection
(picking, circle, box & lasso).

Now when one of the edges vertices fails to project into screen space,
the edge is clipped by the viewport to calculate an on-screen location
that can be used instead.

This isn't default as it may be important for the on the screen location
not to be clipped by the viewport.
2021-06-21 17:27:56 +10:00
54d651c344 Cleanup: pass objects as const arguments 2021-06-21 17:25:10 +10:00
19df0e3cfd Cleanup: swap top/bottom args to planes_from_projmat
X & Z were ordered min/max, where as Y was max/min.
2021-06-21 17:25:09 +10:00
b2510b9e20 Fix T89271: Selecting all vertices doesn't select all edges.
Mistake in recent commit {rBea4309925f1d2d2a224bd1dce12269a58ade9b62}.
2021-06-21 07:55:49 +02:00
feb6fd632f Cleanup: Rename spline interpolation functions
The names were slightly longer than they needed to be clear,
and when they are shorter they tend to fit on one line better.
2021-06-20 22:05:57 -05:00
a1c3e45100 Geometry Nodes: Multithread curve resample node
Optimize the node for the case of many splines. In a test file with
14000 splines, the node is 3x faster (72ms to 24ms) on an 8 core CPU.
2021-06-20 21:57:47 -05:00
b45cee1aaf Cleanup: use early return in view3d iterator callbacks 2021-06-21 12:52:08 +10:00
5df6b4004c Docs: improve imbuf.write docstring
The file path wasn't documented as being optional.
2021-06-21 12:25:36 +10:00
5f71b1edd5 Delaunay add support for detecting and removing holes from output.
Adds two new output modes to the CDT api which detect and remove
holes. A hole is a face from which a ray shot to the outside
intersects an even number of constraint edges, except we don't
count constraint edges in the same connected region of faces,
where a region is connected via non-constraint edges.

These modes are useful for filling in outlines meant to represent
text characters and the like.

Original patch was from Erik Abrahamsson, modified by me to work
with the "valid Bmesh" output type too. I also added tests
for the new modes.
2021-06-20 20:57:22 -04:00
80083ac773 Fix T89310: Industry Compatible keymap not working
Caused by improper testing on my part, assuming a helper function
existed in the industry compatible keymap file, and also assuming it
also used the N and T keys for the left and right side-regions.
2021-06-20 18:52:01 -05:00
0cd34967c0 Curves: Multithread Curve to CurveEval conversion
A different data structure / implementation is used for curves in the
node tree currently. Converting from the DNA `Curve` structure to this
wasn't slow, but it's nice to decrease overhead. In a test of 14000
splines with 128000 points, this halves the runtime from about 5ms
to about 2.5ms.
2021-06-20 18:42:02 -05:00
6afafc46f6 Fix: Spreadsheet selection filter crash on non-mesh components
The spreadsheet filter tried to apply the mesh selection filter on non-
mesh geometry components. Add a check for the component type,
and also refactor the function to be more easily readable.
2021-06-20 17:39:18 -05:00
2d75b39b64 Fix T89302: Broken normals after mesh to curve node
The normals were broken because the normal calculation mode wasn't set.
This patch adds a default normal mode so all code creating a spline does
not necessarily have to set it manually. In the future there should be a
way to change this value in the node tree.
2021-06-20 13:07:49 -05:00
eee3529eaf Docs: improve poly_to_tri_count doc-string
It wasn't obvious this can be used for calculating the triangle index
from the polygon and loop index.
2021-06-21 00:05:26 +10:00
859b3ff346 Cleanup: remove contents of endif() in cmake
This convention is no longer used for Blender's CMake files.
2021-06-20 23:59:07 +10:00
bce482f476 Cleanup: use eSpace_Type enum type 2021-06-20 23:59:07 +10:00
d9b1592c88 Cleanup: make BKE_mesh_loops_to_tessdata a static function 2021-06-20 17:21:50 +10:00
3462b4c7ae Docs: add additional notes on tessellation, update comments 2021-06-20 17:18:53 +10:00
2d60c496a2 Mesh: minor optimization to concave quad check for tessellation
Use the face normal (when available) for a faster concave quad test.
2021-06-20 14:39:13 +10:00
513f566b40 Mesh: optimize object mode face tessellation
- Multi-thread BKE_mesh_recalc_looptri.

- Add BKE_mesh_recalc_looptri_with_normals,
  this skips having to calculate normals for ngons.

Exact performance depends on number of faces, size of ngons and
available CPU cores.

For high poly meshes the isolated improvement to BKE_mesh_recalc_looptri
in my tests was between 6.7x .. 25.0x, with the largest gains seen in
meshes containing ngons with many sides.

The overall speedup for high poly meshes containing quads and triangles
is only ~20% although ngon heavy meshes can be much faster.
2021-06-20 14:39:13 +10:00
b5e5fbcfc8 Cleanup: clang-format 2021-06-20 13:12:27 +10:00
3da25dc625 Cleanup: use doxy sections 2021-06-19 19:41:44 +10:00
f3c5a84bb9 Cleanup: clang-tidy 2021-06-19 18:42:57 +10:00
033641aa74 VSE: Remove seq->tmp usage
Remove `seq->tmp` usage from transform code. It was used to tag strips
that need to be "shuffled". Pass these strips in `SeqCollection`
instead.

Reviewed By: sergey, mano-wii

Differential Revision: https://developer.blender.org/D11631
2021-06-19 05:07:00 +02:00
f9aea19d98 Spreadsheet Editor: Row Filters
This patch adds support for filtering rows based on rules and values.
Filters will work for any attribute data source, they are a property
of the spreadsheet rather than of the attribute system. The properties
displayed in the row filter can depend on data type of the currently
visible column with that name. If the name is no longer visible, the
row filter filter is grayed out, but it will remember the value until
a column with its name is visible again.

Note: The comments in `screen.c` combined with tagging the sidebar
for redraw after the main region point to a lack of understanding
or technical debt, that is a point to improve in the future.

**Future Improvements**
* T89272: A search menu for visible columns when adding a new filter.
* T89273: Possibly a "Range" operation.

Differential Revision: https://developer.blender.org/D10959
2021-06-18 16:33:02 -05:00
d52b7dbe26 Fix T89261: Crash when calculating bmesh tessellation
Error passing `false` instead of a `BMeshCalcTessellation_Params` struct.
2021-06-18 15:20:36 -03:00
3e6f2c7a99 Cleanup: Remove dead code
This code was disabled in 2.8 and all other associated code/comments 
have been removed/cleared. These rna properties have been replaced with 
`seq_prev_type`
2021-06-18 13:54:00 -04:00
f7022fc73f Fix Build Warning
Removal of unused local variable. Calculation of underline thickness
no longer needed with change to text output of underscore character.

Introduced in aee04d4960

Differential Revision: https://developer.blender.org/D11641
2021-06-18 09:22:52 -07:00
8a048593ca Fix T89259: GPencil Duplicate point doesn't work for last point
The loop was checking the len of the island, but if the island started in the last point the copy was not executed.
2021-06-18 18:16:38 +02:00
b6030711a2 Armature: add automatic B-Bone Scale toggles.
Currently B-Bone scaling can only be controlled via their
properties, thus requiring up to 8 drivers per joint between
B-Bones to transfer scaling factors from the handle bone.

A Scale Easing option is added to multiply the easing value
by the Y scale channels to synchronize them - this produces a
natural scaling effect where both the shape of the curve and
the scale is affected.

In addition, four toggles are added for each handle, which
multiply each of the X, Y, Z and Ease values by the matching
Local Scale channel of the handle bone, thus replacing trivial
drivers. The Scale Easing option has no effect on this process
since it's easy to just enable both Length and Ease buttons.

Differential Revision: https://developer.blender.org/D9870
2021-06-18 18:56:04 +03:00
638c16f410 Armature: implement lengthwise scaling of B-Bone segments.
Implement actual behavior for the B-Bone Y Scale channels added
to DNA and UI in the previous commit in addition to the existing
X and Z Scale inputs.

The two length scale inputs control the ratio between the lengths
of the start and end segments of the bone: although for convenience
two inputs are provided, the whole chain is still uniformly scaled
to fit the curve.

Differential Revision: https://developer.blender.org/D9870
2021-06-18 18:56:03 +03:00
682a74e090 Armature: add B-Bone Y scale channel and extra flag fields to DNA.
In addition to the base bone transformation itself, B-Bones have
controls that affect transformation of its segments. For rotation
the features are quite complete, allowing to both reorient the
Bezier handles via properties, and to control them using custom
handle bones. However for scaling there are two deficiencies.

First, there are only X and Y scale factors (actually X and Z),
while lengthwise all segments have the same scaling. The ease
option merely affects the shape of the curve, and does not cause
actual scaling.

Second, scaling can only be controlled via properties, thus
requiring up to 6 drivers per joint between B-Bones to transfer
scaling factors from the handle bone. This is very inefficient.

Finally, the Z channels are confusingly called Y.

This commit adds a B-Bone Y Scale channel and extra B-Bone flag
fields to DNA with appropriate versioning (including for F-Curves
and drivers) in preparation to addressing these limitations.

Functionality is not changed, so the new fields are not used
until the following commits.

Differential Revision: https://developer.blender.org/D9870
2021-06-18 18:56:03 +03:00
aee04d4960 Fix T89246: No Mnemonic Underlines in Dialogs
When drawing mnemonic underlines for hotkeys, use text output of
underscore character instead of direct drawing a line. Otherwise these
are not visible in dialog buttons.

Introduced in 0fcc063fd9

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

Reviewed by Campbell Barton
2021-06-18 08:32:07 -07:00
4c19fe4707 UI: Sequencer: Use ampersand instead of slash for "Sequencer/Preview"
Using an ampersand here is more semantically correct. A slash indicates "or" while an ampersand indicates "and".
An ampersand here is best because the view type shows both the Sequencer and the Preview.
2021-06-18 11:13:00 -04:00
4998ceebfc GPencil: Missed flag in previous Copy Settings commit 2021-06-18 16:47:08 +02:00
408726000a GPencil: Move copy layer settings to function
Better to have a function that can be reused to duplicate the settings that need to be copied.
2021-06-18 16:40:44 +02:00
Jeroen Bakker
e0f2f07d1e DrawManager: Multithreaded counting of material buckets.
When having multiple materials in a mesh the triangles are sorted based
on material index. This sorting is done single threaded, but needs two
loops over the data. One to count the bucket size and the second one to
add the triangles to the right position in the buckets.

This patch will do the counting in a multithreaded approach that would
speed up the cache creation. It has been measured that this part is the
most blocking part of the cache creation.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11615
2021-06-18 16:10:28 +02:00
Jeroen Bakker
6d73d98fb6 BMesh: use threading to count total selection.
During selections the total selection is refreshed at the end. This
process was done single threaded. This patch will do a parallel iter
approach.

Master: 0.043612s Threaded 0.017964s.

Master: {F10179586}
This patch: {F10179587}

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11622
2021-06-18 16:06:36 +02:00
03a83b4eb5 Fix T89262: Crash in regular FileBrowser ID listing of 'asset' .blend files.
`ED_fileselect_get_asset_params` would only return actual data pointer
when file browser is in ASSET mode.

Calling that whole section only makes sense if filebrowser is in asset
mode anyway.

Regression introduced in rBf6c5af3d4753 I think.

@Severin committing this fix now as this is a fairly critical bug for
the studio, feel free to revert and do proper fix if this one is not the
best solution.
2021-06-18 15:49:50 +02:00
Jeroen Bakker
ea4309925f Performance: Limit recounting during selection mode flushing.
This patch ensures that selection mode flushing updates total selection
counts internally. This reduces recounting when we are sure that the
input total selection counts were up to date.

For example for circle selection the total selection counts were
correct. But during flushing the selection could have been changed and
therefore the selection was always recounted.

This increased the performance on selected system from 6.90 FPS to 8.25
FPS during circle selection operations.

Before: {F10179981}
After: {F10179982}

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11647
2021-06-18 15:44:08 +02:00
a9d5c8f97f Fix error passing in false as instead of a struct
Error in 8a1860bd9a.
2021-06-18 23:40:28 +10:00
847b66e81d Fix T88394: crash when editing animated Alembic properties
When an object, whose mesh gets loaded from Alembic, gets animated in
Blender and the Alembic CacheFile datablock also gets animated, editing
keyframes causes both datablock to be re-copied for evaluation. This
caused a threading issue and a double-free of some memory. This is fixed
by expanding the scope of the spin lock in
`BKE_cachefile_reader_free()`.
2021-06-18 13:57:46 +02:00
b8cf8e0bc2 Fix T89240: Crash when moving vertices on a linked duplicate
There is an attempt to free an illegal pointer in `extract_edge_fac_finish`.
2021-06-18 08:25:51 -03:00
80bc819d50 Fluid: Clang-format cleanup
Updated fluid source files in extern with clang-format.
2021-06-18 12:28:17 +02:00
adefdbc9df Fluid: Optimization for FLIP neighbor search radius
Contributed by @erik85 in D11400. The idea from this patch was placed in
a more generic context: A new FOR macro has been added that loops
over the neighbors of a cell within a given radius.
2021-06-18 12:18:21 +02:00
7c68147709 Fix T88605: Alembic import crashes when missing arbGeomParams
Add check for the `arbGeomParams` property being valid, before attempting
to access a sub-property from it.
2021-06-18 11:21:13 +02:00
060d668ae6 Cleanup: clang format 2021-06-18 10:50:19 +02:00
6c1fdd52c1 Fix invalid polygon normal array access building bake data
Pre computed normals index wasn't properly aligned.
Regression from 2ec00ea0c1.
2021-06-18 18:00:47 +10:00
3caafd24a9 Cleanup: use 'bmesh' prefix for BMesh tessellation utilities 2021-06-18 16:37:43 +10:00
c4958bc540 Cleanup: rename test_index_face -> BKE_mesh_mface_index_validate 2021-06-18 15:13:52 +10:00
2e8d7fa7ee Cleanup: remove unused MFace custom-data utilities
Remove:

- BKE_mesh_loops_to_mface_corners
- BKE_mesh_tangent_loops_to_tessdata
2021-06-18 15:08:23 +10:00
253c5d25f7 Cleanup: move mesh tessellation into it's own file
This matches BMesh which also has tessellation in it's own file.

Using a separate file helps with organization when
extracting code into smaller functions.
2021-06-18 15:03:31 +10:00
c290ac2ab1 CMake: remove workaround for version that's no longer supported 2021-06-18 14:41:24 +10:00
af4167441b Cleanup: clang-tidy 2021-06-18 14:41:24 +10:00
50a4b9d502 Cleanup: replace 'unsigned in' with 'uint' 2021-06-18 14:27:41 +10:00
5f0d4fef91 Cleanup: use standard identifier for uint64_t string formatting 2021-06-18 14:27:39 +10:00
68b06208d2 Fix undefs from previous commit 2021-06-17 22:27:09 -03:00
f3c88f8ba5 Fix T89210: Box selection can fail in graphics editor
Test the intersection of segment instead of point.
2021-06-17 22:20:50 -03:00
Fen
e178a273fa Fix T89247: Dereference arguments to comparison function correctly
`bm_face_len_cmp` incorrectly interpreted its arguments as `BMFace *`
instead of `BMFace **`, causing an out-of-bounds read.

Ref D11637
2021-06-18 11:13:09 +10:00
94c4a9995e Fix T89233: Incorrect attribute remove warning for curves
The curve attribute delete function didn't return whether it was
successful or not.
2021-06-17 17:22:09 -05:00
4b673ebb99 Raycast geometry node.
The //Raycast// node intersects rays from one geometry onto another.
It computes hit points on the target mesh and returns normals, distances
and any surface attribute specified by the user.

A ray starts on each point of the input //Geometry//. Rays continue
in the //Ray Direction// until they either hit the //Target Geometry//
or reach the //Ray Length// limit. If the target is hit, the value of the
//Is Hit// attribute in the output mesh will be true. //Hit Position//,
//Hit Normal//, //Hit Distance// and //Hit Index// are the properties of the
target mesh at the intersection point. In addition, a //Target Attribute//
can be specified that is interpolated at the hit point and the result
stored in //Hit Attribute//.

Docs: D11620

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11619
2021-06-17 21:11:32 +01:00
577d6d3f87 Fix T89234: Gpencil Separate doesn't copy settings in Stroke/Point mode
Some values were not copied from the old layer to the new one as Tint or Opacity factor.

The error affected to Strokes and Point mode
2021-06-17 20:41:53 +02:00
ed4222258e Geometry Nodes: Add Curve Subdivision Node
This node creates splines with more control points in between the
existing control points. The point is to give the splines more
definition for further tweaking like randomization with white noise,
instead of deforming a resampled poly spline with a noise texture.

For poly splines and NURBS, the node simply interpolates new values
between the existing control points. However, for Bezier splines,
the result follows the existing evaluated shape of the curve, changing
the handle positions and handle types to make that possible.

The number of "cuts" can be controlled by an integer input, or an
attribute can be used. Both spline and point domain attributes are
supported, so the number of cuts can vary using the value from the
point at the start of each segment.

Dynamic curve attributes are interpolated to the result with linear
interpolation.

Differential Revision: https://developer.blender.org/D11421
2021-06-17 11:39:23 -05:00
7c1bb239be Geometry Nodes: support minimum twist normal mode
The minimum twist mode is important because it allows creating
normals without sudden changes in direction. The disadvantage
of minimum twist normals is that the normals depend on all control
points. So changing one control point can change the normals
everywhere. The computed normals do not match the existing
code exactly, although they do match quite well on non-cyclic and
on some cyclic curves. I also noticed that the existing implementation
has some fairly simple failure cases that I haven't found in the new
implementation so far.

Differential Revision: https://developer.blender.org/D11621
2021-06-17 15:23:01 +02:00
56db09e2fd Geometry Nodes: fix ownership issue in spline to points conversion
Previously, `VArray_For_SplineToPoint` did not take ownership of the
virtual array leading to use-after-free errors.
2021-06-17 13:40:08 +02:00
1388e9de8a Geometry Nodes: improve node locking in evaluator
This makes the parts where a node is locked more explicit. Also, now the thread
is isolated when the node is locked. This prevents some kinds of deadlocks
(which haven't happened in practice yet).
2021-06-17 10:43:39 +02:00
a971409d5a Cleanup: use doxy sections for rna_mesh.c 2021-06-17 16:44:43 +10:00
ccd5f80550 Cleanup: rename rna_Mesh_update_data to rna_Mesh_update_data_deg_all
It's ambiguous what rna_Mesh_update_data does compared with functions
that use `rna_Mesh_update_data_*` as a prefix.

Noticed by @sybren D11377 review.
2021-06-17 16:38:19 +10:00
8ff6322152 Cleanup: improved comment for skipping updated with zero user meshes
Noticed by @sybren D11377 review.
2021-06-17 16:32:08 +10:00
6db290641e Cleanup: split BKE_mesh_copy_settings into two functions
- BKE_mesh_copy_parameters_for_eval to be used for evaluated meshes only
  as it doesn't handle ID user-counts.

- BKE_mesh_copy_parameters is a general function for copying parameters
  between meshes.
2021-06-17 15:08:19 +10:00
286bd87445 Cleanup: spelling 2021-06-17 14:43:25 +10:00
eb85de027c Cleanup: unused argument, function & shadow variable warning 2021-06-17 14:43:13 +10:00
78693d524c VSE: Refactor transform operator code
Refactor function `freeSeqData` so it is readable.

One strip can have multiple transform operations defined. To prevent
processing strip multiple times, build `SeqCollection` and use
sequencer iterator instead of iterating `TransData` directly.

No functional changes.

Differential Revision: https://developer.blender.org/D11618
2021-06-17 04:04:01 +02:00
e7003bc965 VSE: Reduce transform code complexity
Reduce complexity of sequencer transform code by removing recursivity.
This is possible by treating meta strips (mostly) as any other strip and
containing all transform code within SEQ_ functions.

Unfortunately internally meta strips still require special treatment,
but all complexity from code all over transform code seems to be
possible to contain within one function.

Functional change:
Previously adjusting handle of single image strip moved animation.
Now animation is not moved, which is behavior for all other strips.

Reviewed By: sergey, mano-wii

Differential Revision: https://developer.blender.org/D11493
2021-06-17 03:42:04 +02:00
c73be23e17 Revert "Fix T89204: slow repeated rendering with GPUOffscreen.draw_view3d"
This reverts commit d03b26edbd. There is some
refresh issue that needs to be solved before this can be enabled.
2021-06-17 02:06:26 +02:00
845f4cebad Fix T88342: 'To Sphere' and 'Push/Pull' not working in Pose mode
Some modes don't take into account that `TransData` may be in data space.
2021-06-16 16:47:46 -03:00
d03b26edbd Fix T89204: slow repeated rendering with GPUOffscreen.draw_view3d
Cache the GPUViewport so the framebuffers and associated textures are not
reallocated each time.
2021-06-16 20:19:34 +02:00
a1cc7042a7 Edge-scrolling for node editor
Starts scrolling when dragging a node or node link and going outside the current window.
Largely copied from the VIEW2D_OT_edge_pan operator.

Edge panning operator customdata and supporting functions now in
UI_view2d.h, so they could be used by operators in other editor
libraries. The VIEW2D_OT_edge_pan operator also uses this customdata and
shared functions now. Operators properties can be used to configure
edge panning margins and speed for each use case, rather than using
hardcoded values.

The speed function for edge panning has been tweaked somewhat:
* "Speed per pixel" has been replaced with a "speed ramp" distance.
  This is more intuitive and also creates an upper bound for the speed,
  which can otherwise become extreme with large cursor distance.
* "Max speed" is reached at the end of the speed ramp.
* Padding the region inside and outside is applied as before, but both
  values are operator properties now.

Node transform operator also supports edge panning. This requires
an offset for changes in the view2d rect, otherwise nodes are "stuck"
to the original view.

Transform operator had cursor wrapping categorically enabled, but this
gets quite confusing with the edge scrolling mechanism. A new TransInfo
option T_NO_CURSOR_WRAP has been introduced to disable this behavior.
The double negative is a bit annoying, but want to avoid affecting the
existing transform modes, so by default it should still set the
OP_IS_MODAL_GRAB_CURSOR flag (which then sets the WM_CURSOR_WRAP_XY
flag during modal execution).

Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D11073
2021-06-16 18:35:52 +01:00
247abdbf41 LineArt: Cached calculation for modifiers in the same stack.
This allows line art to run only once for each modifier stacks,
with an option to toggle a specific line art modifier should
use cache or re-do their own calculations.

Reviewed By: Sebastian Parborg (zeddb), Hans Goudey (HooglyBoogly)

Differential Revision: https://developer.blender.org/D11291
2021-06-16 22:38:47 +08:00
b37093de7b BLI: add C++ wrapper for task isolation
This makes it easier to use task isolation in c++ code.
Previously, one either had to check `WITH_TBB` (possibly indirectly
through `WITH_OPENVDB`) or one had to use the C function which
is less convenient.
2021-06-16 16:29:21 +02:00
45d59e0df5 BLI: add threading namespace
This namespace groups threading related functions/classes. This avoids
adding more threading related stuff to the blender namespace. Also it
makes naming a bit easier, e.g. the c++ version of BLI_task_isolate could
become blender::threading::isolate_task or something similar.

Differential Revision: https://developer.blender.org/D11624
2021-06-16 16:14:02 +02:00
0cebe554d1 ShaderFX operators: Tweak a bit poll functions, forbid in liboverride cases.
Similar to what we do for constraints and modifiers, except that
currently adding or editing shaderfx in liboverride objects is
completely unsuported.

Fix T88974.
2021-06-16 16:09:28 +02:00
af3d7123c9 ShaderFX/LibOverride: Add BKE_shaderfx_is_nonlocal_in_liboverride util.
Used to detect if a shaderfx is purely local, or comes from linked data,
in case of a liboverride.

Not actually used yet since we do not currently support adding
shaderfx's to overrides, but will be in the future, and matches
constraints and modifiers code.
2021-06-16 16:09:28 +02:00
3953b82030 Tweaks to Constraints operators poll functions.
Mainly:
* Make `ED_operator_object_active_editable_ex` properly report poll
  messages on failure.
* Add `ED_operator_object_active_local_editable_posemode_exclusive` for
  bone constraints requiring pure local Object (non-override one).
* General cleanup and adding more poll messages on failures.
2021-06-16 16:09:28 +02:00
88aa056d1a Fix: Image node alpha socket converted to operations twice
On selecting a multi-layer image with a combined pass, a "Combined"
socket is created and default combined pass socket "Image" is
disabled by setting `SOCK_UNAVAIL` flag. When converting into
operations, `ImageNode` converts alpha socket on finding any socket with
a combined pass without checking the flag.

Since commit rB93e2491ee724 an assertion fails when mapping sockets
twice because now map `add_new` is used.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11566
2021-06-16 14:04:24 +02:00
b66600b9f3 Compositor: Full frame Value node
Adds full frame implementation to Value node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11594
2021-06-16 14:02:08 +02:00
b406b6717f Compositor: Full frame RGB node
Adds full frame implementation to RGB node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11593
2021-06-16 14:00:05 +02:00
94084b2d3c Geometry Nodes: fix z-up spline normal calculation
Previously it didn't work when the tangents were collinear to the z axis.
2021-06-16 12:20:28 +02:00
00fc110d3f Alembic procedural: support reading per-vertex UV sets
This adds support for importing UV sets which are defined per vertex,
instead of per face corners. Such UV sets can be generated when the
mesh is split according to UV islands, or when there is only one UV
island, in which cases only a single UV value can be stored per
vertex since vertices will never be on a seam.
2021-06-16 09:39:39 +02:00
1c0a490d0e Cleanup: minor simplification to status allocation 2021-06-16 17:17:15 +10:00
c3fa7b7e4f Fix pose-mode statistics with multi-object editing
- Include all objects in pose mode.
- Show the number of objects in pose mode.
- Show the number of objects in edit mode for all types of objects
  (not just meshes).
2021-06-16 17:17:15 +10:00
4b36c5b1a7 Cleanup: sculpt mode checks when calculating stats
Sculpting dynamic topology used to code-path for counting object
then never used the result.

Match object mode checks in string access & drawing.
2021-06-16 17:17:15 +10:00
3385c04598 Alembic: support reading per-vertex UV sets
This adds support for importing UV sets which are defined per vertex,
instead of per face corners. Such UV sets can be generated when the
mesh is split according to UV islands, or when there is only one UV
island, in which cases only a single UV value can be stored per
vertex since vertices will never be on a seam.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11584
2021-06-16 08:22:10 +02:00
9fed00341e Cleanup: reduce warnings when compiling release builds. 2021-06-16 08:00:52 +02:00
Johnny Matthews
ed4b2ba75a Geometry Nodes: Separate Components Node
Implementation of T86970. This node takes a geometry input with
multiple components and outputs them by component type. Meshes,
Curves, and Point Clouds support combining multiple input instances,
while volumes will only output the first volume component input until
suitable instance realization for multiple volumes is finished.

When direct geometry instancing is implemented it will be possible to
avoid realizing instances in this node.

Differential Revision: https://developer.blender.org/D11577
2021-06-15 22:31:57 -05:00
2209321f78 Screen: simplify internal logic for new full-screen areas
Creating a new full screen area had it's area initialized as empty,
updating the screen then set the area to a 3D view (as a fallback),
before the actual area type was set.

This made setting the intended space-type run the 3D views exit callback
on a 3D view without a View3D struct allocated, which the exit callback
needed to account for.

Resolve by calling ED_screen_change after the area type has been set.
2021-06-16 12:50:00 +10:00
be8a201a16 Cleanup: unused warning 2021-06-16 12:29:44 +10:00
0b0c7ca017 Cleanup: Fix inconsistent parameter name warning 2021-06-15 21:11:18 -05:00
c8e331f450 UI - LOCAL View3D overlay stats
This patch improves the 3DView statistics overlay to show LOCAL stats
while in local view. This means the stats can vary between 3DViews and
the statusbar when views are in local view, but this gives a much more
accurate count of the objects, and their components, that you are
directly working with rather than just scene values.

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

Reviewed by Campbell Barton
2021-06-15 19:01:53 -07:00
4891da8ae2 Fix T88263: Incorrect image offset from old file
Versioning code for converting strip offset property doesn't work, when
property was animated and disabled or when crop was used.

When offset property is animated and offset is enabled, animation is
converted to be used with new transform design. When offset is disabled,
animation is left untouched. New transform design doesn't have option
to disable offset, and therefore old unconverted animation is used
instead of converted static value.

Remove animation from propery if it was unused.

Another issue was that both X and Y offset animation was being corrected
by factor caluclated for X channel.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11370
2021-06-16 00:44:37 +02:00
1a5fa2b319 VSE: Improve animation evaluation performance
Use lookup string callback function for `sequences_all` RNA property
`rna_SequenceEditor_sequences_all_lookup_string` using a GHash for faster lookups.

When names are changed or strips are added/removed the lookup is tagged invalid.
The next time the lookup is used it will rebuild it.

Reviewed By: sergey, jbakker

Differential Revision: https://developer.blender.org/D11544
2021-06-16 00:29:17 +02:00
143a81ccce Geometry Nodes: Allow int attribute input fields with single value
Just like the way we often have a choice between an attribute input and
a single float, this adds the ability to choose between attribute and
integer input sockets, useful for D11421.
2021-06-15 16:38:28 -05:00
c29afa5156 Cleanup: Expose function publicly, rename
There is no particular reason these two functions shouldn't be used
outside of the bezier spline implementation since they don't do anything
particularly controversial.
2021-06-15 16:31:08 -05:00
732e8c723e Splines: Add resize method to CurveEval
This helps when adding splines to a new curve in parallel.
2021-06-15 16:24:11 -05:00
Germano Cavalcante
6bb980b0f4 DRW: sanitize 'DRW_mesh_batch_cache_dirty_tag'
Create maps that specify which batches have vbo or ibo as a reference
and use these maps to discard batches along with buffers.

Differential Revision: https://developer.blender.org/D11588
2021-06-15 17:03:19 -03:00
8e84938dd0 Cleanup: Add files for version independent versioning helpers
Adds `source/blender/blendloader/intern/versioning_common.cc` and
`versioning_common.h` for version independent versioning functions.

I only placed `do_versions_add_region_if_not_found()` in there for now.
`blo_do_version_old_trackto_to_constraints()` could also be added, but
that's so old, I prefer keeping that in `versioning_legacy.c`.
2021-06-15 19:33:00 +02:00
a4f840e15b UI: Support right aligned non-shortcut hints in widgets
Widget drawing code already supported drawing right-aligned, grayed out
shortcut strings. This patch generalizes things a bit so this can also
be used to draw other hints in the same way. There have been a few
instances in the past where this would've been useful, D11046 being the
latest one.

Note that besides some manual regression testing, I didn't check if this
works yet, as there is no code actually using it (other than the
shortcuts). Can be checked as part of further development for D11046.

A possible further improvement would be providing a way to define how
clipping should be done. E.g. sometimes the right-aligned text should be
clipped first (because it's just a hint), in other cases it should be
left untouched (like current code explicitly does it for shortcuts).

Removes the `UI_BUT_HAS_SHORTCUT` flag, which isn't needed anymore.
2021-06-15 19:13:09 +02:00
fcc844f8fb BLI: use explicit task isolation, no longer part of parallel operations
After looking into task isolation issues with Sergey, we couldn't find the
reason behind the deadlocks that we are getting in T87938 and a Sprite Fright
file involving motion blur renders.

There is no apparent place where we adding or waiting on tasks in a task group
from different isolation regions, which is what is known to cause problems. Yet
it still hangs. Either we do not understand some limitation of TBB isolation,
or there is a bug in TBB, but we could not figure it out.

Instead the idea is to use isolation only where we know we need it: when
holding a mutex lock and then doing some multithreaded operation within that
locked region. Three places where we do this now:
* Generated images
* Cached BVH tree building
* OpenVDB lazy grid loading

Compared to the more automatic approach previously used, there is the downside
that it is easy to miss places where we need isolation. Yet doing it more
automatically is also causing unexpected issue and bugs that we found no
solution for, so this seems better.

Patch implemented by Sergey and me.

Differential Revision: https://developer.blender.org/D11603
2021-06-15 17:28:44 +02:00
Germano Cavalcante
b3f0dc2907 Draw Cache: avoid recalculating 'poly_normals'
Call `BKE_mesh_ensure_normals_for_display` to avoid recalculating
poly_normals.

**Benchmark**
||master:|PATCH:
|---|---|---|
|looptris_test:|Average: 3.995076 FPS|Average: 4.047470 FPS
||rdata 11ms iter 91ms (frame 235ms)|rdata 11ms iter 86ms (frame 233ms)
|subdiv_mesh_cage_and_final:|Average: 1.884492 FPS|Average: 1.900114 FPS
||rdata 7ms iter 42ms (frame 268ms)|rdata 7ms iter 39ms (frame 265ms)
||rdata 7ms iter 44ms (frame 259ms)|rdata 7ms iter 42ms (frame 257ms)
|subdiv_mesh_final_only:|Average: 6.245944 FPS|Average: 6.289000 FPS
||rdata 3ms iter 23ms (frame 153ms)|rdata 3ms iter 21ms (frame 154ms)
|subdiv_mesh_final_only_ledge:|Average: 6.263482 FPS|Average: 6.187218 FPS
||rdata 3ms iter 23ms (frame 156ms)|rdata 3ms iter 22ms (frame 154ms)

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11527
2021-06-15 11:45:39 -03:00
71997921c4 Cleanup: use back-slash for doxygen comments 2021-06-16 00:08:34 +10:00
0c75a98561 CMake: disable TBB when not found 2021-06-16 00:08:34 +10:00
Jeroen Bakker
174ed69c1b DrawManager: Cache material offsets.
When using multiple materials in a single mesh the most time is spend in
counting the offsets of each material for the sorting.

This patch moves the counting of the offsets to render mesh data and
caches it as long as the geometry doesn't change.

This patch doesn't include multithreading of this code.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11612
2021-06-15 15:31:34 +02:00
7c8b9c7a9a Fix warning treated as an error
"void' function returning a value".
2021-06-15 09:57:57 -03:00
62906cdbea Cleanup: Added hierarchy in MeshBufferExtractionCache. 2021-06-15 12:34:13 +02:00
7f570a7174 Cleanup: Split mesh_render_data_loose_geom into multiple functions. 2021-06-15 11:39:36 +02:00
9cd2e80d5d Fix: wrong size check
This fixes a bad mistake by myself. Thanks Lukas Tönne for telling me.
2021-06-15 10:26:31 +02:00
462bd81399 Fix: Sequencer backdrop not updated during playback.
Caused by recent optimization in {7b76a160a4}.
2021-06-15 09:31:03 +02:00
819152527f BMesh: assert that face normals have been updated for tessellation
This catches missing normal updates that may cause invalid tessellation.
2021-06-15 14:54:34 +10:00
89e2b441ed Cleanup: remove return value from face normal calculation
This value is always 'sides - 2', no need to return this value.
2021-06-15 14:38:10 +10:00
ae34808114 Fix missing normal update in edit-mesh blend-from shape operator 2021-06-15 14:35:43 +10:00
fdad77d73d BMesh: use faster normal update method for edit-mesh coordinates
This wasn't included in the previous fix so it'd be 2.93 compatible.
2021-06-15 13:52:00 +10:00
0a361eb5ec Fix outdated face tessellation use when editing edit-mesh coodinates 2021-06-15 13:31:33 +10:00
2ba804d7b7 Screen: clear runtime structures on file-read & data-copy
Clear the runtime data structs instead of individual members,
this simplifies adding new runtime members as there are at least
two places they would need to be cleared.

Resolves error in D8883.
2021-06-15 12:52:59 +10:00
5dc0fd08a7 Cleanup: correct incomplete comment 2021-06-15 10:59:57 +10:00
2053e1f533 Fix image space missing mask display panel 2021-06-15 10:50:48 +10:00
4ae06b6123 Cleanup: remove "_" prefix for used arguments 2021-06-15 10:50:43 +10:00
013fc69ea8 Cleanup: unused argument & variable warnings 2021-06-15 10:50:43 +10:00
3bf98d1cec Cleanup: use private methods for internal operator utilities
Also remove unused argument.
2021-06-15 10:08:57 +10:00
9ce49af32e Cleanup: use doxygen comments for DNA_color_types
Also use enum instead of defines for Scopes.wavefrm_mode
2021-06-15 09:34:58 +10:00
1f251b7a27 Win8 cleanup, remove dead function pointer and macro. 2021-06-14 14:41:58 -07:00
61fdc45034 Geometry Nodes: Join dynamic curve attributes in the join geometry node
This commit lets the join geometry node transfer dynamic attributes
to the result, the same way that point cloud and mesh attributes are
joined. The implementation is different though, because of an
optimization implemented for curves to avoid copying splines.

The result attribute is added with the highest priority domain (points
over splines), and the highest complexity data type. If one curve had
the attribute on the spline domain but not others, the point domain
values will be used.

Generally this is a bit lower level than I would have liked this code
to be, but should be efficient, and it's really not too complicated.

Differential Revision: https://developer.blender.org/D11491
2021-06-14 15:13:43 -05:00
bf7f918a0e Geometry Nodes: Parallelize curve reverse node
Each spline can be handled separately here. This gives approximately a
2x speedup on my 8 core processor on an input of 80000 2 point splines.
2021-06-14 14:28:57 -05:00
fe0fa7cec6 Cleanup: Refactor join geometry node attribute gathering
Instead of building a set and then determining the final domain and
type for every attribute separately in the loop, construct a map with
the necessary data in the first place. This is simpler and should be
slightly more efficient.

Split from D11491
2021-06-14 13:58:11 -05:00
Johnny Matthews
4a540b9b48 Geometry Nodes: Curve Reverse Node
This is an implementation of T88722. It accepts a curve object and
for each spline, reverses the order of the points and all attributes.
This is more of a foundational node to support other nodes in the
future (like curve deform)

Selection takes spline domain attributes to determine which splines
are selected. If no selection is present all splines are reversed.

Differential Revision: https://developer.blender.org/D11538
2021-06-14 13:28:38 -05:00
fcbb20286a Geometry Nodes: Curve to Points Node for Evaluated Data
This node implements the second option of T87429, creating points
along the input splines with the necessary evaluated information
for instancing: `tangent`, `normal`, and `rotation` attributes.
All generic curve point and spline attributes are copied to the
result points as well.

The "Count" and "Length" methods are just like the current options
in the resample node, but the output is points instead of a curve.
The "Evaluated" method uses the points you see on the curve directly,
and therefore should be the fastest.

The rotation data is retrieved from a transform matrix built with the
same method that the curve to mesh node uses. The radius attribute is
divided by 10 so the points don't look absurdly huge in the viewport.
In the future that could be an option.

For the implementation, one thing that could use an improvement
is the amount of temporary allocations while resampling to evaluated
points before the final points. I expect that reusing a buffer for
each thread would give a nice improvement.

Differential Revision: https://developer.blender.org/D11539
2021-06-14 12:52:08 -05:00
d08e925ef1 Fix Build Warning
Marking unused function argument.

Introduced in bcff0ef9ca

Differential Revision: https://developer.blender.org/D10887
2021-06-14 10:42:28 -07:00
bcff0ef9ca UI: Windows Blend File Association
This patch allows Windows users to specify that their current blender
installation should be used to create thumbnails and be associated
with ".blend" files. This is done from Preferences / System. The only
way to do this currently is from the command-line and this is sometimes
inconvenient.

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

Reviewed by Brecht Van Lommel
2021-06-14 10:22:03 -07:00
2e5671a959 Fix: VSE seeking with proxy strips would fail on certain frames
If the last decoded frame had the same timestamp as the GOP current
packet, then we would skip over this frame when fast forwarding and we
would seek until the end of the file.

This would could only be triggered reliably in single threaded mode.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11601
2021-06-14 19:08:51 +02:00
aadd355028 Fix possible C-linkage warning on Clang
The warning would appear when using the `ENUM_OPERATORS()` macro inside
of an `extern "C"` block.
Didn't cause a warning in master currently, but in the
`asset-browser-poselib` branch.

After macro expansion, there would be C++ code in code with C linkage
(`extern "C"`). So make sure the expanded C++ code always uses C++
linkage.
The syntax used is totally C++ compliant: the C++ standard requires that
in such nested linkage specifications, the innermost one determines the
linking language (e.g. see
https://timsong-cpp.github.io/cppwp/n4659/dcl.link#4).
2021-06-14 19:00:13 +02:00
3de6fe0b3e Error Messages Creating Thumbnail Folders
On the Windows platform there will be some errors printed to the
console if the user's thumbnail cache folder doesn't already exist.
While creating those folders there is an attempt to do so multiple
times and so we get errors when trying to create when exists. This
is caused by paths that have hard-coded forward slashes, which causes
our path processing routines to not work correctly. This patch defines
those paths using platform-varying separator characters.

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

Reviewed by Brecht Van Lommel
2021-06-14 09:17:27 -07:00
e9b4de43d8 Cleanup: rename id to owner_id for python id properties
This is consistent with the naming in `PointerRNA`.
2021-06-14 18:13:27 +02:00
90b0fb135f PyAPI: remove deprecated bpy.app.binary_path_python 2021-06-14 23:52:08 +10:00
8a1860bd9a BMesh: support face-normal calculation in normal & looptri functions
Support calculating face normals when tessellating. When this is done
before updating vertex normals it gives ~20% performance improvement.

Now vertex normal calculation only needs to perform a single pass on the
mesh vertices when called after tessellation.

Extended versions of normal & looptri update functions have been added:

- BM_mesh_calc_tessellation_ex
- BM_mesh_normals_update_ex

Most callers don't need to be aware of this detail by using:

- BKE_editmesh_looptri_and_normals_calc
- BKE_editmesh_looptri_and_normals_calc_with_partial

- EDBM_update also takes advantage of this,
  where calling EDBM_update with calc_looptri & calc_normals
  enabled uses the faster normal updating logic.
2021-06-14 23:01:19 +10:00
6bef255904 BMesh: remove unit-length edge-vector cache from normal calculation
Bypass stored edge-vectors for ~16% performance gains.

While this increases unit-length edge-vector calculations by around ~4x
the overhead of a parallel loop over all edges makes it worthwhile.

Note that caching edge-vectors per-vertex performs better and may be
worth investigating further, although in my tests this increases code
complexity with barley measurable benefits over not using cache at all.

Details about performance and possible optimizations are noted in
bm_vert_calc_normals_impl.
2021-06-14 22:56:02 +10:00
8083527f90 Edit Mesh: use params arg for update function, add calc_normals arg
Rename function EDBM_update_generic to EDBM_update, use a parameters
argument for better readability.

Also add calc_normals argument, which will have benefits when
calculating normals and tessellation together is optimized.
2021-06-14 22:56:01 +10:00
1d2eb461b5 Cleanup: clang-format 2021-06-14 22:56:00 +10:00
Thomas Lachmann
b84707df17 Python API: option for render engines to disable image file saving
For some custom rendering engines it's advantageous not to write the image files to disk.
An example would be a network rendering engine which does it's own image writing.

This feature is only supported when bl_use_postprocess is also disabled, since render
engines can't influence the saving behavior of the sequencer or compositor.

Differential Revision: https://developer.blender.org/D11512
2021-06-14 14:20:04 +02:00
ada47c4772 Fix build error in release builds after recent changes 2021-06-14 13:22:11 +02:00
748475b943 BLI_math: Cleanup: Use mul_/madd_ functions.
Better to avoid explicit vectors components direct manipulation when a
generic operation for whole vector exists, if nothing else it avoids
potential mistakes in indices.
2021-06-14 12:32:38 +02:00
b21db5e698 BLI_math: Fix several division-by-zero cases.
Those were caused by various tools used on degenerate geometry, see
T79775.

Note that fixes are as low-level as possible, to ensure they cover as
much as possible of unreported issues too.

We still probably have many more of those hidden in BLI_math though.
2021-06-14 12:32:38 +02:00
Leon Zandman
5add6f2ed9 Fix T87867: file open dialog triggers OneDrive file downloads on macOS
Until OneDrive supports macOS's native placeholder file implementation, detect
the com.microsoft.OneDrive.RecallOnOpen extended file attribute.

Differential Revision: https://developer.blender.org/D11466
2021-06-14 12:26:07 +02:00
1918 changed files with 37833 additions and 21588 deletions

View File

@@ -265,4 +265,5 @@ ForEachMacros:
- VECTOR_SET_SLOT_PROBING_BEGIN
StatementMacros:
- PyObject_HEAD
- PyObject_VAR_HEAD

View File

@@ -836,7 +836,7 @@ if(WITH_PYTHON)
# because UNIX will search for the old Python paths which may not exist.
# giving errors about missing paths before this case is met.
if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.9")
message(FATAL_ERROR "At least Python 3.9 is required to build")
message(FATAL_ERROR "At least Python 3.9 is required to build, but found Python ${PYTHON_VERSION}")
endif()
file(GLOB RESULT "${CMAKE_SOURCE_DIR}/release/scripts/addons")

View File

@@ -216,9 +216,9 @@ set(OPENVDB_HASH 01b490be16cc0e15c690f9a153c21461)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
set(NANOVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(NANOVDB_GIT_UID dc37d8a631922e7bef46712947dc19b755f3e841)
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
set(NANOVDB_HASH 90919510bc6ccd630fedc56f748cb199)
set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
set(NANOVDB_HASH_TYPE MD5)
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)

View File

@@ -1073,7 +1073,7 @@ OPENVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/v
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
NANOVDB_USE_REPO=false
NANOVDB_SOURCE_REPO_UID="e62f7a0bf1e27397223c61ddeaaf57edf111b77f"
NANOVDB_SOURCE_REPO_UID="dc37d8a631922e7bef46712947dc19b755f3e841"
NANOVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_SOURCE_REPO_UID}.tar.gz" )
ALEMBIC_USE_REPO=false

View File

@@ -472,8 +472,7 @@ if(NOT GFLAGS_FOUND)
gflags_report_not_found(
"Could not find gflags include directory, set GFLAGS_INCLUDE_DIR "
"to directory containing gflags/gflags.h")
endif(NOT GFLAGS_INCLUDE_DIR OR
NOT EXISTS ${GFLAGS_INCLUDE_DIR})
endif()
find_library(GFLAGS_LIBRARY NAMES gflags
PATHS ${GFLAGS_LIBRARY_DIR_HINTS}
@@ -484,8 +483,7 @@ if(NOT GFLAGS_FOUND)
gflags_report_not_found(
"Could not find gflags library, set GFLAGS_LIBRARY "
"to full path to libgflags.")
endif(NOT GFLAGS_LIBRARY OR
NOT EXISTS ${GFLAGS_LIBRARY})
endif()
# gflags typically requires a threading library (which is OS dependent), note
# that this defines the CMAKE_THREAD_LIBS_INIT variable. If we are able to
@@ -560,8 +558,7 @@ if(NOT GFLAGS_FOUND)
gflags_report_not_found(
"Caller defined GFLAGS_INCLUDE_DIR:"
" ${GFLAGS_INCLUDE_DIR} does not contain gflags/gflags.h header.")
endif(GFLAGS_INCLUDE_DIR AND
NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
endif()
# TODO: This regex for gflags library is pretty primitive, we use lowercase
# for comparison to handle Windows using CamelCase library names, could
# this check be better?
@@ -571,8 +568,7 @@ if(NOT GFLAGS_FOUND)
gflags_report_not_found(
"Caller defined GFLAGS_LIBRARY: "
"${GFLAGS_LIBRARY} does not match gflags.")
endif(GFLAGS_LIBRARY AND
NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
endif()
gflags_reset_find_library_prefix()

View File

@@ -40,7 +40,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(NanoVDB DEFAULT_MSG
IF(NANOVDB_FOUND)
SET(NANOVDB_INCLUDE_DIRS ${NANOVDB_INCLUDE_DIR})
ENDIF(NANOVDB_FOUND)
ENDIF()
MARK_AS_ADVANCED(
NANOVDB_INCLUDE_DIR

View File

@@ -46,7 +46,7 @@ SET(_opencollada_FIND_COMPONENTS
)
# Fedora openCOLLADA package links these statically
# note that order is important here ot it wont link
# note that order is important here or it won't link
SET(_opencollada_FIND_STATIC_COMPONENTS
buffer
ftoa

View File

@@ -44,7 +44,7 @@ SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for p
MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
# if the user passes these defines as args, we dont want to overwrite
# if the user passes these defines as args, we don't want to overwrite
SET(_IS_INC_DEF OFF)
SET(_IS_INC_CONF_DEF OFF)
SET(_IS_LIB_DEF OFF)
@@ -143,7 +143,7 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_
SET(_PYTHON_ABI_FLAGS "${_CURRENT_ABI_FLAGS}")
break()
ELSE()
# ensure we dont find values from 2 different ABI versions
# ensure we don't find values from 2 different ABI versions
IF(NOT _IS_INC_DEF)
UNSET(PYTHON_INCLUDE_DIR CACHE)
ENDIF()

View File

@@ -40,7 +40,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(sse2neon DEFAULT_MSG
IF(SSE2NEON_FOUND)
SET(SSE2NEON_INCLUDE_DIRS ${SSE2NEON_INCLUDE_DIR})
ENDIF(SSE2NEON_FOUND)
ENDIF()
MARK_AS_ADVANCED(
SSE2NEON_INCLUDE_DIR

View File

@@ -305,7 +305,7 @@ def file_check_arg_sizes(tu):
for i, node_child in enumerate(children):
children = list(node_child.get_children())
# skip if we dont have an index...
# skip if we don't have an index...
size_def = args_size_definition.get(i, -1)
if size_def == -1:
@@ -354,7 +354,7 @@ def file_check_arg_sizes(tu):
filepath # always the same but useful when running threaded
))
# we dont really care what we are looking at, just scan entire file for
# we don't really care what we are looking at, just scan entire file for
# function calls.
def recursive_func_call_check(node):

View File

@@ -694,7 +694,7 @@ macro(message_first_run)
endmacro()
# when we have warnings as errors applied globally this
# needs to be removed for some external libs which we dont maintain.
# needs to be removed for some external libs which we don't maintain.
# utility macro
macro(remove_cc_flag
@@ -794,7 +794,7 @@ macro(remove_extra_strict_flags)
endmacro()
# note, we can only append flags on a single file so we need to negate the options.
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
# at the moment we can't shut up ffmpeg deprecations, so use this, but will
# probably add more removals here.
macro(remove_strict_c_flags_file
filenames)
@@ -963,14 +963,6 @@ macro(blender_project_hack_post)
unset(_reset_standard_cflags_rel)
unset(_reset_standard_cxxflags_rel)
# ------------------------------------------------------------------
# workaround for omission in cmake 2.8.4's GNU.cmake, fixed in 2.8.5
if(CMAKE_COMPILER_IS_GNUCC)
if(NOT DARWIN)
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
endif()
endif()
endmacro()
# pair of macros to allow libraries to be specify files to install, but to

View File

@@ -388,6 +388,10 @@ endif()
if(WITH_TBB)
find_package(TBB)
if(NOT TBB_FOUND)
message(WARNING "TBB not found, disabling WITH_TBB")
set(WITH_TBB OFF)
endif()
endif()
if(WITH_POTRACE)

View File

@@ -457,6 +457,10 @@ endif()
if(WITH_TBB)
find_package_wrapper(TBB)
if(NOT TBB_FOUND)
message(WARNING "TBB not found, disabling WITH_TBB")
set(WITH_TBB OFF)
endif()
endif()
if(WITH_XR_OPENXR)

View File

@@ -261,8 +261,10 @@ if(NOT DEFINED LIBDIR)
else()
message(FATAL_ERROR "32 bit compiler detected, blender no longer provides pre-build libraries for 32 bit windows, please set the LIBDIR cmake variable to your own library folder")
endif()
# Can be 1910..1912
if(MSVC_VERSION GREATER 1919)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30130)
message(STATUS "Visual Studio 2022 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
elseif(MSVC_VERSION GREATER 1919)
message(STATUS "Visual Studio 2019 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
elseif(MSVC_VERSION GREATER 1909)
@@ -548,7 +550,6 @@ if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
set(OPENCOLORIO_DEFINITIONS "-DDOpenColorIO_SKIP_IMPORTS")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
add_definitions(-DOIIO_STATIC_DEFINE)
add_definitions(-DOIIO_NO_SSE=1)
@@ -594,7 +595,7 @@ if(WITH_OPENCOLORIO)
debug ${OPENCOLORIO_LIBPATH}/libexpatdMD.lib
debug ${OPENCOLORIO_LIBPATH}/pystring_d.lib
)
set(OPENCOLORIO_DEFINITIONS)
set(OPENCOLORIO_DEFINITIONS "-DOpenColorIO_SKIP_IMPORTS")
endif()
if(WITH_OPENVDB)

View File

@@ -6,6 +6,9 @@ if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2019.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2022.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
echo Compiler Detection failed. Use verbose switch for more information.
exit /b 1

View File

@@ -1,5 +1,6 @@
if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc15
if "%BUILD_VS_YEAR%"=="2019" set BUILD_VS_LIBDIRPOST=vc15
if "%BUILD_VS_YEAR%"=="2022" set BUILD_VS_LIBDIRPOST=vc15
set BUILD_VS_SVNDIR=win64_%BUILD_VS_LIBDIRPOST%
set BUILD_VS_LIBDIR="%BLENDER_DIR%..\lib\%BUILD_VS_SVNDIR%"

View File

@@ -19,10 +19,10 @@ if "%WITH_PYDEBUG%"=="1" (
set PYDEBUG_CMAKE_ARGS=-DWINDOWS_PYTHON_DEBUG=On
)
if "%BUILD_VS_YEAR%"=="2019" (
set BUILD_PLATFORM_SELECT=-A %MSBUILD_PLATFORM%
) else (
if "%BUILD_VS_YEAR%"=="2017" (
set BUILD_GENERATOR_POST=%WINDOWS_ARCH%
) else (
set BUILD_PLATFORM_SELECT=-A %MSBUILD_PLATFORM%
)
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%BUILD_GENERATOR_POST%" %BUILD_PLATFORM_SELECT% %TESTS_CMAKE_ARGS% %CLANG_CMAKE_ARGS% %ASAN_CMAKE_ARGS% %PYDEBUG_CMAKE_ARGS%

View File

@@ -0,0 +1,3 @@
set BUILD_VS_VER=17
set BUILD_VS_YEAR=2022
call "%~dp0\detect_msvc_vswhere.cmd"

View File

@@ -66,6 +66,14 @@ if NOT "%1" == "" (
) else if "%1" == "2019b" (
set BUILD_VS_YEAR=2019
set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
) else if "%1" == "2022" (
set BUILD_VS_YEAR=2022
) else if "%1" == "2022pre" (
set BUILD_VS_YEAR=2022
set VSWHERE_ARGS=-prerelease
) else if "%1" == "2022b" (
set BUILD_VS_YEAR=2022
set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
) else if "%1" == "packagename" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DCPACK_OVERRIDE_PACKAGENAME="%2"
shift /1

View File

@@ -1,2 +1,13 @@
Sphinx==3.5.3
sphinx==3.5.4
# Sphinx dependencies that are important
Jinja2==2.11.3
Pygments==2.9.0
docutils==0.16
snowballstemmer==2.1.0
babel==2.9.1
requests==2.25.1
# Only needed to match the theme used for the official documentation.
# Without this theme, the default theme will be used.
sphinx_rtd_theme==0.5.2

View File

@@ -265,6 +265,12 @@ protected:
*/
void setSpecs(Specs specs);
/**
* Sets the audio output specification of the device.
* \param specs The output specification.
*/
void setSpecs(DeviceSpecs specs);
/**
* Empty default constructor. To setup the device call the function create()
* and to uninitialize call destroy().

View File

@@ -87,6 +87,12 @@ public:
*/
void setSpecs(Specs specs);
/**
* Sets the target specification for superposing.
* \param specs The target specification.
*/
void setSpecs(DeviceSpecs specs);
/**
* Mixes a buffer.
* \param buffer The buffer to superpose.

View File

@@ -78,6 +78,7 @@ void PulseAudioDevice::runMixingThread()
if(shouldStop())
{
AUD_pa_stream_cork(m_stream, 1, nullptr, nullptr);
AUD_pa_stream_flush(m_stream, nullptr, nullptr);
doStop();
return;
}
@@ -86,7 +87,10 @@ void PulseAudioDevice::runMixingThread()
if(AUD_pa_stream_is_corked(m_stream))
AUD_pa_stream_cork(m_stream, 0, nullptr, nullptr);
AUD_pa_mainloop_iterate(m_mainloop, true, nullptr);
// similar to AUD_pa_mainloop_iterate(m_mainloop, false, nullptr); except with a longer timeout
AUD_pa_mainloop_prepare(m_mainloop, 1 << 14);
AUD_pa_mainloop_poll(m_mainloop);
AUD_pa_mainloop_dispatch(m_mainloop);
}
}

View File

@@ -24,6 +24,7 @@ PULSEAUDIO_SYMBOL(pa_context_unref);
PULSEAUDIO_SYMBOL(pa_stream_begin_write);
PULSEAUDIO_SYMBOL(pa_stream_connect_playback);
PULSEAUDIO_SYMBOL(pa_stream_cork);
PULSEAUDIO_SYMBOL(pa_stream_flush);
PULSEAUDIO_SYMBOL(pa_stream_is_corked);
PULSEAUDIO_SYMBOL(pa_stream_new);
PULSEAUDIO_SYMBOL(pa_stream_set_buffer_attr);
@@ -35,3 +36,6 @@ PULSEAUDIO_SYMBOL(pa_mainloop_free);
PULSEAUDIO_SYMBOL(pa_mainloop_get_api);
PULSEAUDIO_SYMBOL(pa_mainloop_new);
PULSEAUDIO_SYMBOL(pa_mainloop_iterate);
PULSEAUDIO_SYMBOL(pa_mainloop_prepare);
PULSEAUDIO_SYMBOL(pa_mainloop_poll);
PULSEAUDIO_SYMBOL(pa_mainloop_dispatch);

View File

@@ -31,65 +31,81 @@ template <class T> void SafeRelease(T **ppT)
}
}
void WASAPIDevice::runMixingThread()
HRESULT WASAPIDevice::setupRenderClient(IAudioRenderClient*& render_client, UINT32& buffer_size)
{
UINT32 buffer_size;
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
UINT32 padding;
UINT32 length;
data_t* buffer;
IAudioRenderClient* render_client = nullptr;
HRESULT result;
{
std::lock_guard<ILockable> lock(*this);
if(FAILED(result = m_audio_client->GetBufferSize(&buffer_size)))
return result;
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
if(FAILED(result = m_audio_client->GetService(IID_IAudioRenderClient, reinterpret_cast<void**>(&render_client))))
return result;
if(FAILED(m_audio_client->GetBufferSize(&buffer_size)))
goto init_error;
if(FAILED(result = m_audio_client->GetCurrentPadding(&padding)))
return result;
if(FAILED(m_audio_client->GetService(IID_IAudioRenderClient, reinterpret_cast<void**>(&render_client))))
goto init_error;
length = buffer_size - padding;
if(FAILED(m_audio_client->GetCurrentPadding(&padding)))
goto init_error;
if(FAILED(result = render_client->GetBuffer(length, &buffer)))
return result;
length = buffer_size - padding;
mix((data_t*)buffer, length);
if(FAILED(render_client->GetBuffer(length, &buffer)))
goto init_error;
mix((data_t*)buffer, length);
if(FAILED(render_client->ReleaseBuffer(length, 0)))
{
init_error:
SafeRelease(&render_client);
doStop();
return;
}
}
if(FAILED(result = render_client->ReleaseBuffer(length, 0)))
return result;
m_audio_client->Start();
auto sleepDuration = std::chrono::milliseconds(buffer_size * 1000 / int(m_specs.rate) / 2);
return result;
}
void WASAPIDevice::runMixingThread()
{
UINT32 buffer_size;
IAudioRenderClient* render_client = nullptr;
std::chrono::milliseconds sleep_duration;
bool run_init = true;
for(;;)
{
HRESULT result = S_OK;
{
UINT32 padding;
UINT32 length;
data_t* buffer;
std::lock_guard<ILockable> lock(*this);
if(FAILED(m_audio_client->GetCurrentPadding(&padding)))
if(run_init)
{
result = setupRenderClient(render_client, buffer_size);
if(FAILED(result))
goto stop_thread;
sleep_duration = std::chrono::milliseconds(buffer_size * 1000 / int(m_specs.rate) / 2);
}
if(FAILED(result = m_audio_client->GetCurrentPadding(&padding)))
goto stop_thread;
length = buffer_size - padding;
if(FAILED(render_client->GetBuffer(length, &buffer)))
if(FAILED(result = render_client->GetBuffer(length, &buffer)))
goto stop_thread;
mix((data_t*)buffer, length);
if(FAILED(render_client->ReleaseBuffer(length, 0)))
if(FAILED(result = render_client->ReleaseBuffer(length, 0)))
goto stop_thread;
// stop thread
@@ -98,53 +114,51 @@ void WASAPIDevice::runMixingThread()
stop_thread:
m_audio_client->Stop();
SafeRelease(&render_client);
doStop();
return;
if(result == AUDCLNT_E_DEVICE_INVALIDATED)
{
DeviceSpecs specs = m_specs;
if(!setupDevice(specs))
result = S_FALSE;
else
{
setSpecs(specs);
run_init = true;
}
}
if(result != AUDCLNT_E_DEVICE_INVALIDATED)
{
doStop();
return;
}
}
}
std::this_thread::sleep_for(sleepDuration);
std::this_thread::sleep_for(sleep_duration);
}
}
WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
m_imm_device_enumerator(nullptr),
m_imm_device(nullptr),
m_audio_client(nullptr),
m_wave_format_extensible({})
bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
{
// initialize COM if it hasn't happened yet
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
SafeRelease(&m_audio_client);
SafeRelease(&m_imm_device);
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
const IID IID_IAudioClient = __uuidof(IAudioClient);
if(FAILED(m_imm_device_enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &m_imm_device)))
return false;
if(FAILED(m_imm_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, reinterpret_cast<void**>(&m_audio_client))))
return false;
WAVEFORMATEXTENSIBLE wave_format_extensible_closest_match;
WAVEFORMATEXTENSIBLE* closest_match_pointer = &wave_format_extensible_closest_match;
HRESULT result;
REFERENCE_TIME minimum_time = 0;
REFERENCE_TIME buffer_duration;
if(FAILED(CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, reinterpret_cast<void**>(&m_imm_device_enumerator))))
goto error;
if(FAILED(m_imm_device_enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &m_imm_device)))
goto error;
if(FAILED(m_imm_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, reinterpret_cast<void**>(&m_audio_client))))
goto error;
if(specs.channels == CHANNELS_INVALID)
specs.channels = CHANNELS_STEREO;
if(specs.format == FORMAT_INVALID)
specs.format = FORMAT_FLOAT32;
if(specs.rate == RATE_INVALID)
specs.rate = RATE_48000;
switch(specs.format)
{
case FORMAT_U8:
@@ -203,12 +217,14 @@ WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
m_wave_format_extensible.Format.cbSize = 22;
m_wave_format_extensible.Samples.wValidBitsPerSample = m_wave_format_extensible.Format.wBitsPerSample;
result = m_audio_client->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, reinterpret_cast<const WAVEFORMATEX*>(&m_wave_format_extensible), reinterpret_cast<WAVEFORMATEX**>(&closest_match_pointer));
HRESULT result = m_audio_client->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, reinterpret_cast<const WAVEFORMATEX*>(&m_wave_format_extensible), reinterpret_cast<WAVEFORMATEX**>(&closest_match_pointer));
if(result == S_FALSE)
{
bool errored = false;
if(closest_match_pointer->Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE)
goto error;
goto closest_match_error;
specs.channels = Channels(closest_match_pointer->Format.nChannels);
specs.rate = closest_match_pointer->Format.nSamplesPerSec;
@@ -220,7 +236,7 @@ WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
else if(closest_match_pointer->Format.wBitsPerSample == 64)
specs.format = FORMAT_FLOAT64;
else
goto error;
goto closest_match_error;
}
else if(closest_match_pointer->SubFormat == KSDATAFORMAT_SUBTYPE_PCM)
{
@@ -239,44 +255,81 @@ WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
specs.format = FORMAT_S32;
break;
default:
goto error;
goto closest_match_error;
break;
}
}
else
goto error;
goto closest_match_error;
m_wave_format_extensible = *closest_match_pointer;
if(false)
{
closest_match_error:
errored = true;
}
if(closest_match_pointer != &wave_format_extensible_closest_match)
{
CoTaskMemFree(closest_match_pointer);
closest_match_pointer = &wave_format_extensible_closest_match;
}
if(errored)
return false;
}
else if(FAILED(result))
goto error;
return false;
if(FAILED(m_audio_client->GetDevicePeriod(nullptr, &minimum_time)))
goto error;
return false;
buffer_duration = REFERENCE_TIME(buffersize) * REFERENCE_TIME(10000000) / REFERENCE_TIME(specs.rate);
buffer_duration = REFERENCE_TIME(m_buffersize) * REFERENCE_TIME(10000000) / REFERENCE_TIME(specs.rate);
if(minimum_time > buffer_duration)
buffer_duration = minimum_time;
m_specs = specs;
if(FAILED(m_audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, buffer_duration, 0, reinterpret_cast<WAVEFORMATEX*>(&m_wave_format_extensible), nullptr)))
return false;
return true;
}
WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
m_buffersize(buffersize),
m_imm_device_enumerator(nullptr),
m_imm_device(nullptr),
m_audio_client(nullptr),
m_wave_format_extensible({})
{
// initialize COM if it hasn't happened yet
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
if(specs.channels == CHANNELS_INVALID)
specs.channels = CHANNELS_STEREO;
if(specs.format == FORMAT_INVALID)
specs.format = FORMAT_FLOAT32;
if(specs.rate == RATE_INVALID)
specs.rate = RATE_48000;
if(FAILED(CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, reinterpret_cast<void**>(&m_imm_device_enumerator))))
goto error;
if(!setupDevice(specs))
goto error;
m_specs = specs;
create();
return;
error:
if(closest_match_pointer != &wave_format_extensible_closest_match)
CoTaskMemFree(closest_match_pointer);
SafeRelease(&m_imm_device);
SafeRelease(&m_imm_device_enumerator);
SafeRelease(&m_audio_client);

View File

@@ -43,16 +43,21 @@ AUD_NAMESPACE_BEGIN
class AUD_PLUGIN_API WASAPIDevice : public ThreadedDevice
{
private:
int m_buffersize;
IMMDeviceEnumerator* m_imm_device_enumerator;
IMMDevice* m_imm_device;
IAudioClient* m_audio_client;
WAVEFORMATEXTENSIBLE m_wave_format_extensible;
AUD_LOCAL HRESULT setupRenderClient(IAudioRenderClient*& render_client, UINT32& buffer_size);
/**
* Streaming thread main function.
*/
AUD_LOCAL void runMixingThread();
AUD_LOCAL bool setupDevice(DeviceSpecs& specs);
// delete copy constructor and operator=
WASAPIDevice(const WASAPIDevice&) = delete;
WASAPIDevice& operator=(const WASAPIDevice&) = delete;

View File

@@ -756,6 +756,7 @@ void SoftwareDevice::mix(data_t* buffer, int length)
// get the buffer from the source
pos = 0;
len = length;
eos = false;
// update 3D Info
sound->update();
@@ -842,6 +843,27 @@ void SoftwareDevice::setSpecs(Specs specs)
{
sound->setSpecs(specs);
}
for(auto& sound : m_pausedSounds)
{
sound->setSpecs(specs);
}
}
void SoftwareDevice::setSpecs(DeviceSpecs specs)
{
m_specs = specs;
m_mixer->setSpecs(specs);
for(auto& sound : m_playingSounds)
{
sound->setSpecs(specs.specs);
}
for(auto& sound : m_pausedSounds)
{
sound->setSpecs(specs.specs);
}
}
SoftwareDevice::SoftwareDevice()

View File

@@ -21,9 +21,25 @@
AUD_NAMESPACE_BEGIN
Mixer::Mixer(DeviceSpecs specs) :
m_specs(specs)
Mixer::Mixer(DeviceSpecs specs)
{
setSpecs(specs);
}
DeviceSpecs Mixer::getSpecs() const
{
return m_specs;
}
void Mixer::setSpecs(Specs specs)
{
m_specs.specs = specs;
}
void Mixer::setSpecs(DeviceSpecs specs)
{
m_specs = specs;
switch(m_specs.format)
{
case FORMAT_U8:
@@ -54,16 +70,6 @@ Mixer::Mixer(DeviceSpecs specs) :
}
}
DeviceSpecs Mixer::getSpecs() const
{
return m_specs;
}
void Mixer::setSpecs(Specs specs)
{
m_specs.specs = specs;
}
void Mixer::clear(int length)
{
m_buffer.assureSize(length * AUD_SAMPLE_SIZE(m_specs));

View File

@@ -1,3 +1,3 @@
#define MANTA_GIT_VERSION "commit 9c505cd22e289b98c9aa717efba8ef3201c7e458"
#define MANTA_GIT_VERSION "commit 8fbebe02459b7f72575872c20961f7cb757db408"

View File

@@ -71,6 +71,19 @@ class ParticleBase;
for (int j = bnd; j < (grid).getSizeY() - bnd; ++j) \
for (int i = bnd; i < (grid).getSizeX() - bnd; ++i)
#define FOR_NEIGHBORS_BND(grid, radius, bnd) \
for (int zj = ((grid).is3D() ? std::max(bnd, k - radius) : 0); \
zj <= ((grid).is3D() ? std::min(k + radius, (grid).getSizeZ() - 1 - bnd) : 0); \
zj++) \
for (int yj = std::max(bnd, j - radius); \
yj <= std::min(j + radius, (grid).getSizeY() - 1 - bnd); \
yj++) \
for (int xj = std::max(bnd, i - radius); \
xj <= std::min(i + radius, (grid).getSizeX() - 1 - bnd); \
xj++)
#define FOR_NEIGHBORS(grid, radius) FOR_NEIGHBORS_BND(grid, radius, 0)
//! Basic data structure for kernel data, initialized based on kernel type (e.g. single, idx, etc).
struct KernelBase {
int maxX, maxY, maxZ, minZ, maxT, minT;

View File

@@ -822,33 +822,29 @@ struct ComputeUnionLevelsetPindex : public KernelBase {
{
const Vec3 gridPos = Vec3(i, j, k) + Vec3(0.5); // shifted by half cell
Real phiv = radius * 1.0; // outside
const int r = int(radius) + 1;
int r = int(radius) + 1;
int rZ = phi.is3D() ? r : 0;
for (int zj = k - rZ; zj <= k + rZ; zj++)
for (int yj = j - r; yj <= j + r; yj++)
for (int xj = i - r; xj <= i + r; xj++) {
if (!phi.isInBounds(Vec3i(xj, yj, zj)))
continue;
FOR_NEIGHBORS(phi, r)
{
// note, for the particle indices in indexSys the access is periodic (ie, dont skip for
// eg inBounds(sx,10,10)
IndexInt isysIdxS = index.index(xj, yj, zj);
IndexInt pStart = index(isysIdxS), pEnd = 0;
if (phi.isInBounds(isysIdxS + 1))
pEnd = index(isysIdxS + 1);
else
pEnd = indexSys.size();
// note, for the particle indices in indexSys the access is periodic (ie, dont skip for eg
// inBounds(sx,10,10)
IndexInt isysIdxS = index.index(xj, yj, zj);
IndexInt pStart = index(isysIdxS), pEnd = 0;
if (phi.isInBounds(isysIdxS + 1))
pEnd = index(isysIdxS + 1);
else
pEnd = indexSys.size();
// now loop over particles in cell
for (IndexInt p = pStart; p < pEnd; ++p) {
const int psrc = indexSys[p].sourceIndex;
if (ptype && ((*ptype)[psrc] & exclude))
continue;
const Vec3 pos = parts[psrc].pos;
phiv = std::min(phiv, fabs(norm(gridPos - pos)) - radius);
}
}
// now loop over particles in cell
for (IndexInt p = pStart; p < pEnd; ++p) {
const int psrc = indexSys[p].sourceIndex;
if (ptype && ((*ptype)[psrc] & exclude))
continue;
const Vec3 pos = parts[psrc].pos;
phiv = std::min(phiv, fabs(norm(gridPos - pos)) - radius);
}
}
phi(i, j, k) = phiv;
}
inline const Grid<int> &getArg0()
@@ -1026,39 +1022,35 @@ struct ComputeAveragedLevelsetWeight : public KernelBase {
// loop over neighborhood, similar to ComputeUnionLevelsetPindex
const Real sradiusInv = 1. / (4. * radius * radius);
int r = int(1. * radius) + 1;
int rZ = phi.is3D() ? r : 0;
const int r = int(radius) + 1;
// accumulators
Real wacc = 0.;
Vec3 pacc = Vec3(0.);
Real racc = 0.;
for (int zj = k - rZ; zj <= k + rZ; zj++)
for (int yj = j - r; yj <= j + r; yj++)
for (int xj = i - r; xj <= i + r; xj++) {
if (!phi.isInBounds(Vec3i(xj, yj, zj)))
continue;
FOR_NEIGHBORS(phi, r)
{
IndexInt isysIdxS = index.index(xj, yj, zj);
IndexInt pStart = index(isysIdxS), pEnd = 0;
if (phi.isInBounds(isysIdxS + 1))
pEnd = index(isysIdxS + 1);
else
pEnd = indexSys.size();
for (IndexInt p = pStart; p < pEnd; ++p) {
IndexInt psrc = indexSys[p].sourceIndex;
if (ptype && ((*ptype)[psrc] & exclude))
continue;
IndexInt isysIdxS = index.index(xj, yj, zj);
IndexInt pStart = index(isysIdxS), pEnd = 0;
if (phi.isInBounds(isysIdxS + 1))
pEnd = index(isysIdxS + 1);
else
pEnd = indexSys.size();
for (IndexInt p = pStart; p < pEnd; ++p) {
IndexInt psrc = indexSys[p].sourceIndex;
if (ptype && ((*ptype)[psrc] & exclude))
continue;
Vec3 pos = parts[psrc].pos;
Real s = normSquare(gridPos - pos) * sradiusInv;
// Real w = std::max(0., cubed(1.-s) );
Real w = std::max(0., (1. - s)); // a bit smoother
wacc += w;
racc += radius * w;
pacc += pos * w;
}
}
Vec3 pos = parts[psrc].pos;
Real s = normSquare(gridPos - pos) * sradiusInv;
// Real w = std::max(0., cubed(1.-s) );
Real w = std::max(0., (1. - s)); // a bit smoother
wacc += w;
racc += radius * w;
pacc += pos * w;
}
}
if (wacc > VECTOR_EPSILON) {
racc /= wacc;

View File

@@ -234,10 +234,10 @@ void subdivideMesh(
normalize(ne2);
// Real thisArea = sqrMag(cross(-e2,e0));
// small angle approximation says sin(x) = arcsin(x) = x,
// arccos(x) = pi/2 - arcsin(x),
// cos(x) = dot(A,B),
// so angle is approximately 1 - dot(A,B).
// small angle approximation says sin(x) = arcsin(x) = x,
// arccos(x) = pi/2 - arcsin(x),
// cos(x) = dot(A,B),
// so angle is approximately 1 - dot(A,B).
Real angle[3];
angle[0] = 1.0 - dot(ne0, -ne2);
angle[1] = 1.0 - dot(ne1, -ne0);

View File

@@ -2287,10 +2287,9 @@ struct knFlipComputePotentialTrappedAir : public KernelBase {
const Vec3 &vj = scaleFromManta * v.getCentered(x, y, z);
const Vec3 xij = xi - xj;
const Vec3 vij = vi - vj;
Real h = !pot.is3D() ?
1.414 * radius :
1.732 * radius; // estimate sqrt(2)*radius resp. sqrt(3)*radius for h, due
// to squared resp. cubic neighbor area
Real h = !pot.is3D() ? 1.414 * radius :
1.732 * radius; // estimate sqrt(2)*radius resp. sqrt(3)*radius
// for h, due to squared resp. cubic neighbor area
vdiff += norm(vij) * (1 - dot(getNormalized(vij), getNormalized(xij))) *
(1 - norm(xij) / h);
}

View File

@@ -79,15 +79,15 @@ typedef struct CLG_IDFilter {
} CLG_IDFilter;
typedef struct CLogContext {
/** Single linked list of types. */
/** Single linked list of types. */
CLG_LogType *types;
/** Single linked list of references. */
/** Single linked list of references. */
CLG_LogRef *refs;
#ifdef WITH_CLOG_PTHREADS
pthread_mutex_t types_lock;
#endif
/* exclude, include filters. */
/* exclude, include filters. */
CLG_IDFilter *filters[2];
bool use_color;
bool use_basename;

View File

@@ -51,12 +51,12 @@ CCL_NAMESPACE_BEGIN
/* XML reading state */
struct XMLReadState : public XMLReader {
Scene *scene; /* scene pointer */
Transform tfm; /* current transform state */
bool smooth; /* smooth normal state */
Shader *shader; /* current shader */
string base; /* base path to current file*/
float dicing_rate; /* current dicing rate */
Scene *scene; /* Scene pointer. */
Transform tfm; /* Current transform state. */
bool smooth; /* Smooth normal state. */
Shader *shader; /* Current shader. */
string base; /* Base path to current file. */
float dicing_rate; /* Current dicing rate. */
XMLReadState() : scene(NULL), smooth(false), shader(NULL), dicing_rate(1.0f)
{
@@ -385,7 +385,7 @@ static Mesh *xml_add_mesh(Scene *scene, const Transform &tfm)
Mesh *mesh = new Mesh();
scene->geometry.push_back(mesh);
/* create object*/
/* Create object. */
Object *object = new Object();
object->set_geometry(mesh);
object->set_tfm(tfm);

View File

@@ -1254,12 +1254,19 @@ class CyclesObjectSettings(bpy.types.PropertyGroup):
)
shadow_terminator_offset: FloatProperty(
name="Shadow Terminator Offset",
name="Shadow Terminator Shading 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,
)
shadow_terminator_geometry_offset: FloatProperty(
name="Shadow Terminator Geometry Offset",
description="Offset rays from the surface to reduce shadow terminator artifact on low poly geometry. Only affects triangles at grazing angles to light",
min=0.0, max=1.0,
default=0.1,
)
is_shadow_catcher: BoolProperty(
name="Shadow Catcher",
description="Only render shadows on this object, for compositing renders into real footage",

View File

@@ -821,6 +821,11 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
col.prop(view_layer, "use_strand", text="Hair")
col.prop(view_layer, "use_volumes", text="Volumes")
col = layout.column(heading="Use")
sub = col.row()
sub.prop(view_layer, "use_motion_blur", text="Motion Blur")
sub.active = rd.use_motion_blur
class CYCLES_RENDER_PT_override(CyclesButtonsPanel, Panel):
bl_label = "Override"
@@ -1218,20 +1223,31 @@ class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
return CyclesButtonsPanel.poll(context) and (context.object)
if not CyclesButtonsPanel.poll(context):
return False
ob = context.object
return ob and has_geometry_visibility(ob)
def draw(self, context):
pass
class CYCLES_OBJECT_PT_shading_shadow_terminator(CyclesButtonsPanel, Panel):
bl_label = "Shadow Terminator"
bl_parent_id = "CYCLES_OBJECT_PT_shading"
bl_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
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
ob = context.object
cob = ob.cycles
if has_geometry_visibility(ob):
col = flow.column()
col.prop(cob, "shadow_terminator_offset")
flow.prop(cob, "shadow_terminator_geometry_offset", text="Geometry Offset")
flow.prop(cob, "shadow_terminator_offset", text="Shading Offset")
class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
@@ -2311,6 +2327,7 @@ classes = (
CYCLES_PT_context_material,
CYCLES_OBJECT_PT_motion_blur,
CYCLES_OBJECT_PT_shading,
CYCLES_OBJECT_PT_shading_shadow_terminator,
CYCLES_OBJECT_PT_visibility,
CYCLES_OBJECT_PT_visibility_ray_visibility,
CYCLES_OBJECT_PT_visibility_culling,

View File

@@ -533,7 +533,7 @@ void BlenderSync::sync_particle_hair(
return;
}
/* extract particle hair data - should be combined with connecting to mesh later*/
/* Extract particle hair data - should be combined with connecting to mesh later. */
ParticleCurveData CData;

View File

@@ -44,7 +44,7 @@ void BlenderSync::sync_light(BL::Object &b_parent,
const bool tfm_updated = (light && light->get_tfm() != tfm);
/* Update if either object or light data changed. */
if (!tfm_updated && !light_map.add_or_update(&light, b_ob, b_parent, key)) {
if (!light_map.add_or_update(&light, b_ob, b_parent, key) && !tfm_updated) {
Shader *shader;
if (!shader_map.add_or_update(&shader, b_light)) {
if (light->get_is_portal())

View File

@@ -290,8 +290,12 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
bool is_shadow_catcher = get_boolean(cobject, "is_shadow_catcher");
object->set_is_shadow_catcher(is_shadow_catcher);
float shadow_terminator_offset = get_float(cobject, "shadow_terminator_offset");
object->set_shadow_terminator_offset(shadow_terminator_offset);
float shadow_terminator_shading_offset = get_float(cobject, "shadow_terminator_offset");
object->set_shadow_terminator_shading_offset(shadow_terminator_shading_offset);
float shadow_terminator_geometry_offset = get_float(cobject,
"shadow_terminator_geometry_offset");
object->set_shadow_terminator_geometry_offset(shadow_terminator_geometry_offset);
/* sync the asset name for Cryptomatte */
BL::Object parent = b_ob.parent();

View File

@@ -289,11 +289,10 @@ static PyObject *render_func(PyObject * /*self*/, PyObject *args)
RNA_pointer_create(NULL, &RNA_Depsgraph, (ID *)PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr);
BL::Depsgraph b_depsgraph(depsgraphptr);
/* Allow Blender to execute other Python scripts, and isolate TBB tasks so we
* don't get deadlocks with Blender threads accessing shared data like images. */
/* Allow Blender to execute other Python scripts. */
python_thread_state_save(&session->python_thread_state);
tbb::this_task_arena::isolate([&] { session->render(b_depsgraph); });
session->render(b_depsgraph);
python_thread_state_restore(&session->python_thread_state);
@@ -330,8 +329,7 @@ static PyObject *bake_func(PyObject * /*self*/, PyObject *args)
python_thread_state_save(&session->python_thread_state);
tbb::this_task_arena::isolate(
[&] { session->bake(b_depsgraph, b_object, pass_type, pass_filter, width, height); });
session->bake(b_depsgraph, b_object, pass_type, pass_filter, width, height);
python_thread_state_restore(&session->python_thread_state);
@@ -377,7 +375,7 @@ static PyObject *reset_func(PyObject * /*self*/, PyObject *args)
python_thread_state_save(&session->python_thread_state);
tbb::this_task_arena::isolate([&] { session->reset_session(b_data, b_depsgraph); });
session->reset_session(b_data, b_depsgraph);
python_thread_state_restore(&session->python_thread_state);
@@ -399,7 +397,7 @@ static PyObject *sync_func(PyObject * /*self*/, PyObject *args)
python_thread_state_save(&session->python_thread_state);
tbb::this_task_arena::isolate([&] { session->synchronize(b_depsgraph); });
session->synchronize(b_depsgraph);
python_thread_state_restore(&session->python_thread_state);

View File

@@ -281,7 +281,6 @@ void BlenderSync::sync_data(BL::RenderSettings &b_render,
void BlenderSync::sync_integrator()
{
BL::RenderSettings r = b_scene.render();
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
experimental = (get_enum(cscene, "feature_set") != 0);
@@ -325,7 +324,7 @@ void BlenderSync::sync_integrator()
integrator->set_sample_clamp_direct(get_float(cscene, "sample_clamp_direct"));
integrator->set_sample_clamp_indirect(get_float(cscene, "sample_clamp_indirect"));
if (!preview) {
integrator->set_motion_blur(r.use_motion_blur());
integrator->set_motion_blur(view_layer.use_motion_blur);
}
integrator->set_method((Integrator::Method)get_enum(
@@ -456,6 +455,8 @@ void BlenderSync::sync_view_layer(BL::ViewLayer &b_view_layer)
view_layer.use_surfaces = b_view_layer.use_solid() || scene->bake_manager->get_baking();
view_layer.use_hair = b_view_layer.use_strand();
view_layer.use_volumes = b_view_layer.use_volumes();
view_layer.use_motion_blur = b_view_layer.use_motion_blur() &&
b_scene.render().use_motion_blur();
/* Material override. */
view_layer.material_override = b_view_layer.material_override();
@@ -602,8 +603,10 @@ vector<Pass> BlenderSync::sync_render_passes(BL::Scene &b_scene,
for (BL::RenderPass &b_pass : b_rlay.passes) {
PassType pass_type = get_pass_type(b_pass);
if (pass_type == PASS_MOTION && b_scene.render().use_motion_blur())
if (pass_type == PASS_MOTION &&
(b_view_layer.use_motion_blur() && b_scene.render().use_motion_blur())) {
continue;
}
if (pass_type != PASS_NONE)
Pass::add(pass_type, passes, b_pass.name().c_str());
}

View File

@@ -246,6 +246,7 @@ class BlenderSync {
use_surfaces(true),
use_hair(true),
use_volumes(true),
use_motion_blur(true),
samples(0),
bound_samples(false)
{
@@ -258,6 +259,7 @@ class BlenderSync {
bool use_surfaces;
bool use_hair;
bool use_volumes;
bool use_motion_blur;
int samples;
bool bound_samples;
} view_layer;

View File

@@ -181,7 +181,7 @@ static void rtc_filter_occluded_func(const RTCFilterFunctionNArguments *args)
/* record intersection */
ctx->local_isect->hits[hit_idx] = current_isect;
ctx->local_isect->Ng[hit_idx] = normalize(make_float3(hit->Ng_x, hit->Ng_y, hit->Ng_z));
/* This tells Embree to continue tracing .*/
/* This tells Embree to continue tracing. */
*args->valid = 0;
break;
}

View File

@@ -179,7 +179,7 @@ class InnerNode : public BVHNode {
}
/* NOTE: This function is only used during binary BVH builder, and it
* supposed to be configured to have 2 children which will be filled in in a
* supposed to be configured to have 2 children which will be filled-in in a
* bit. But this is important to have children reset to NULL. */
explicit InnerNode(const BoundBox &bounds) : BVHNode(bounds), num_children_(0)
{

View File

@@ -297,7 +297,7 @@ struct BVHSpatialBin {
*/
struct BVHSpatialStorage {
/* Accumulated bounds when sweeping from right to left. */
/* Accumulated bounds when sweeping from right to left. */
vector<BoundBox> right_bounds;
/* Bins used for histogram when selecting best split plane. */

View File

@@ -388,7 +388,7 @@ void BVHSpatialSplit::split_curve_primitive(const Hair *hair,
BoundBox &left_bounds,
BoundBox &right_bounds)
{
/* curve split: NOTE - Currently ignores curve width and needs to be fixed.*/
/* curve split: NOTE - Currently ignores curve width and needs to be fixed. */
Hair::Curve curve = hair->get_curve(prim_index);
const int k0 = curve.first_key + segment_index;
const int k1 = k0 + 1;

View File

@@ -1196,16 +1196,18 @@ class OptiXDevice : public CUDADevice {
const CUDAContextScope scope(cuContext);
const bool use_fast_trace_bvh = (bvh->params.bvh_type == SceneParams::BVH_STATIC);
// Compute memory usage
OptixAccelBufferSizes sizes = {};
OptixAccelBuildOptions options = {};
options.operation = operation;
if (background) {
// Prefer best performance and lowest memory consumption in background
if (use_fast_trace_bvh) {
VLOG(2) << "Using fast to trace OptiX BVH";
options.buildFlags = OPTIX_BUILD_FLAG_PREFER_FAST_TRACE | OPTIX_BUILD_FLAG_ALLOW_COMPACTION;
}
else {
// Prefer fast updates in viewport
VLOG(2) << "Using fast to update OptiX BVH";
options.buildFlags = OPTIX_BUILD_FLAG_PREFER_FAST_BUILD | OPTIX_BUILD_FLAG_ALLOW_UPDATE;
}
@@ -1253,15 +1255,16 @@ class OptiXDevice : public CUDADevice {
out_data.device_pointer,
sizes.outputSizeInBytes,
&out_handle,
background ? &compacted_size_prop : NULL,
background ? 1 : 0));
use_fast_trace_bvh ? &compacted_size_prop : NULL,
use_fast_trace_bvh ? 1 : 0));
bvh->traversable_handle = static_cast<uint64_t>(out_handle);
// Wait for all operations to finish
check_result_cuda_ret(cuStreamSynchronize(NULL));
// Compact acceleration structure to save memory (do not do this in viewport for faster builds)
if (background) {
// Compact acceleration structure to save memory (only if using fast trace as the
// OPTIX_BUILD_FLAG_ALLOW_COMPACTION flag is only set in this case).
if (use_fast_trace_bvh) {
uint64_t compacted_size = sizes.outputSizeInBytes;
check_result_cuda_ret(
cuMemcpyDtoH(&compacted_size, compacted_size_prop.result, sizeof(compacted_size)));
@@ -1306,6 +1309,8 @@ class OptiXDevice : public CUDADevice {
return;
}
const bool use_fast_trace_bvh = (bvh->params.bvh_type == SceneParams::BVH_STATIC);
free_bvh_memory_delayed();
BVHOptiX *const bvh_optix = static_cast<BVHOptiX *>(bvh);
@@ -1315,10 +1320,10 @@ class OptiXDevice : public CUDADevice {
if (!bvh->params.top_level) {
assert(bvh->objects.size() == 1 && bvh->geometry.size() == 1);
// Refit is only possible in viewport for now (because AS is built with
// OPTIX_BUILD_FLAG_ALLOW_UPDATE only there, see above)
OptixBuildOperation operation = OPTIX_BUILD_OPERATION_BUILD;
if (refit && !background) {
/* Refit is only possible when using fast to trace BVH (because AS is built with
* OPTIX_BUILD_FLAG_ALLOW_UPDATE only there, see above). */
if (refit && !use_fast_trace_bvh) {
assert(bvh_optix->traversable_handle != 0);
operation = OPTIX_BUILD_OPERATION_UPDATE;
}

View File

@@ -65,7 +65,7 @@ class DenoiseParams {
/* Viewport start sample. */
int start_sample;
/** Native Denoiser **/
/** Native Denoiser. */
/* Pixel radius for neighboring pixels to take into account. */
int radius;
@@ -81,7 +81,7 @@ class DenoiseParams {
/* Clamp the input to the range of +-1e8. Should be enough for any legitimate data. */
bool clamp_input;
/** OIDN/Optix Denoiser **/
/** OIDN/Optix Denoiser. */
/* Passes handed over to the OIDN/OptiX denoiser (default to color + albedo). */
DenoiserInput input_passes;

View File

@@ -1186,7 +1186,7 @@ bool OpenCLInfo::get_device_extensions(cl_device_id device_id,
{
size_t extension_length = 0;
cl_int err;
/* Determine the size of the extension string*/
/* Determine the size of the extension string. */
if ((err = clGetDeviceInfo(device_id, CL_DEVICE_EXTENSIONS, 0, 0, &extension_length)) !=
CL_SUCCESS) {
if (error != NULL) {

View File

@@ -116,7 +116,7 @@ CCL_NAMESPACE_BEGIN
# endif
# endif /* __SHADOW_RECORD_ALL__ */
/* Record all intersections - Volume BVH traversal */
/* Record all intersections - Volume BVH traversal. */
# if defined(__VOLUME_RECORD_ALL__)
# define BVH_FUNCTION_NAME bvh_intersect_volume_all

View File

@@ -71,6 +71,87 @@ ccl_device_inline float3 ray_offset(float3 P, float3 Ng)
#endif
}
/* This function should be used to compute a modified ray start position for
* rays leaving from a surface. The algorithm slightly distorts flat surface
* of a triangle. Surface is lifted by amount h along normal n in the incident
* point. */
ccl_device_inline float3 smooth_surface_offset(KernelGlobals *kg, ShaderData *sd, float3 Ng)
{
float3 V[3], N[3];
triangle_vertices_and_normals(kg, sd->prim, V, N);
const float u = sd->u, v = sd->v;
const float w = 1 - u - v;
float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */
float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without normalization */
n = normalize(
transform_direction_transposed_auto(&sd->ob_itfm, n)); /* Normal x scale, world space */
/* Parabolic approximation */
float a = dot(N[2] - N[0], V[0] - V[2]);
float b = dot(N[2] - N[1], V[1] - V[2]);
float c = dot(N[1] - N[0], V[1] - V[0]);
float h = a * u * (u - 1) + (a + b + c) * u * v + b * v * (v - 1);
/* Check flipped normals */
if (dot(n, Ng) > 0) {
/* Local linear envelope */
float h0 = max(max(dot(V[1] - V[0], N[0]), dot(V[2] - V[0], N[0])), 0.0f);
float h1 = max(max(dot(V[0] - V[1], N[1]), dot(V[2] - V[1], N[1])), 0.0f);
float h2 = max(max(dot(V[0] - V[2], N[2]), dot(V[1] - V[2], N[2])), 0.0f);
h0 = max(dot(V[0] - P, N[0]) + h0, 0.0f);
h1 = max(dot(V[1] - P, N[1]) + h1, 0.0f);
h2 = max(dot(V[2] - P, N[2]) + h2, 0.0f);
h = max(min(min(h0, h1), h2), h * 0.5f);
}
else {
float h0 = max(max(dot(V[0] - V[1], N[0]), dot(V[0] - V[2], N[0])), 0.0f);
float h1 = max(max(dot(V[1] - V[0], N[1]), dot(V[1] - V[2], N[1])), 0.0f);
float h2 = max(max(dot(V[2] - V[0], N[2]), dot(V[2] - V[1], N[2])), 0.0f);
h0 = max(dot(P - V[0], N[0]) + h0, 0.0f);
h1 = max(dot(P - V[1], N[1]) + h1, 0.0f);
h2 = max(dot(P - V[2], N[2]) + h2, 0.0f);
h = min(-min(min(h0, h1), h2), h * 0.5f);
}
return n * h;
}
/* Ray offset to avoid shadow terminator artifact. */
ccl_device_inline float3 ray_offset_shadow(KernelGlobals *kg, ShaderData *sd, float3 L)
{
float NL = dot(sd->N, L);
bool transmit = (NL < 0.0f);
float3 Ng = (transmit ? -sd->Ng : sd->Ng);
float3 P = ray_offset(sd->P, Ng);
if ((sd->type & PRIMITIVE_ALL_TRIANGLE) && (sd->shader & SHADER_SMOOTH_NORMAL)) {
const float offset_cutoff =
kernel_tex_fetch(__objects, sd->object).shadow_terminator_geometry_offset;
/* Do ray offset (heavy stuff) only for close to be terminated triangles:
* offset_cutoff = 0.1f means that 10-20% of rays will be affected. Also
* make a smooth transition near the threshold. */
if (offset_cutoff > 0.0f) {
float NgL = dot(Ng, L);
float offset_amount = 0.0f;
if (NL < offset_cutoff) {
offset_amount = clamp(2.0f - (NgL + NL) / offset_cutoff, 0.0f, 1.0f);
}
else {
offset_amount = clamp(1.0f - NgL / offset_cutoff, 0.0f, 1.0f);
}
if (offset_amount > 0.0f) {
P += smooth_surface_offset(kg, sd, Ng) * offset_amount;
}
}
}
return P;
}
#if defined(__VOLUME_RECORD_ALL__) || (defined(__SHADOW_RECORD_ALL__) && defined(__KERNEL_CPU__))
/* ToDo: Move to another file? */
ccl_device int intersections_compare(const void *a, const void *b)

View File

@@ -462,7 +462,7 @@ ccl_device_inline int bsdf_sample(KernelGlobals *kg,
else {
/* Shadow terminator offset. */
const float frequency_multiplier =
kernel_tex_fetch(__objects, sd->object).shadow_terminator_offset;
kernel_tex_fetch(__objects, sd->object).shadow_terminator_shading_offset;
if (frequency_multiplier > 1.0f) {
*eval *= shift_cos_in(dot(*omega_in, sc->N), frequency_multiplier);
}
@@ -488,12 +488,9 @@ ccl_device_inline
const float3 omega_in,
float *pdf)
{
/* For curves use the smooth normal, particularly for ribbons the geometric
* normal gives too much darkening otherwise. */
const float3 Ng = (sd->type & PRIMITIVE_ALL_CURVE) ? sd->N : sd->Ng;
float3 eval;
if (dot(Ng, omega_in) >= 0.0f) {
if (dot(sd->N, omega_in) >= 0.0f) {
switch (sc->type) {
case CLOSURE_BSDF_DIFFUSE_ID:
case CLOSURE_BSDF_BSSRDF_ID:
@@ -589,7 +586,7 @@ ccl_device_inline
}
/* Shadow terminator offset. */
const float frequency_multiplier =
kernel_tex_fetch(__objects, sd->object).shadow_terminator_offset;
kernel_tex_fetch(__objects, sd->object).shadow_terminator_shading_offset;
if (frequency_multiplier > 1.0f) {
eval *= shift_cos_in(dot(omega_in, sc->N), frequency_multiplier);
}

View File

@@ -61,8 +61,8 @@ ccl_device_forceinline float3 bsdf_ashikhmin_shirley_eval_reflect(const ShaderCl
const MicrofacetBsdf *bsdf = (const MicrofacetBsdf *)sc;
float3 N = bsdf->N;
float NdotI = dot(N, I); /* in Cycles/OSL convention I is omega_out */
float NdotO = dot(N, omega_in); /* and consequently we use for O omaga_in ;) */
float NdotI = dot(N, I); /* in Cycles/OSL convention I is omega_out */
float NdotO = dot(N, omega_in); /* and consequently we use for O omaga_in ;) */
float out = 0.0f;

View File

@@ -66,7 +66,7 @@ ccl_device_noinline void motion_triangle_shader_setup(
sd->P = motion_triangle_refine_local(kg, sd, isect, ray, verts);
}
else
#endif /* __BVH_LOCAL__*/
#endif /* __BVH_LOCAL__*/
{
sd->P = motion_triangle_refine(kg, sd, isect, ray, verts);
}

View File

@@ -138,7 +138,7 @@ ccl_device_inline float4 primitive_surface_attribute_float4(KernelGlobals *kg,
ccl_device_inline bool primitive_is_volume_attribute(const ShaderData *sd,
const AttributeDescriptor desc)
{
return (sd->object != OBJECT_NONE && desc.element == ATTR_ELEMENT_VOXEL);
return sd->type == PRIMITIVE_VOLUME;
}
ccl_device_inline float primitive_volume_attribute_float(KernelGlobals *kg,

View File

@@ -22,7 +22,7 @@
CCL_NAMESPACE_BEGIN
/* normal on triangle */
/* Normal on triangle. */
ccl_device_inline float3 triangle_normal(KernelGlobals *kg, ShaderData *sd)
{
/* load triangle vertices */
@@ -40,7 +40,7 @@ ccl_device_inline float3 triangle_normal(KernelGlobals *kg, ShaderData *sd)
}
}
/* point and normal on triangle */
/* Point and normal on triangle. */
ccl_device_inline void triangle_point_normal(
KernelGlobals *kg, int object, int prim, float u, float v, float3 *P, float3 *Ng, int *shader)
{
@@ -75,6 +75,22 @@ ccl_device_inline void triangle_vertices(KernelGlobals *kg, int prim, float3 P[3
P[2] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 2));
}
/* Triangle vertex locations and vertex normals */
ccl_device_inline void triangle_vertices_and_normals(KernelGlobals *kg,
int prim,
float3 P[3],
float3 N[3])
{
const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
P[0] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 0));
P[1] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 1));
P[2] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 2));
N[0] = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.x));
N[1] = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.y));
N[2] = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.z));
}
/* Interpolate smooth vertex normal from vertices */
ccl_device_inline float3

View File

@@ -72,14 +72,22 @@ ccl_device float4 volume_attribute_float4(KernelGlobals *kg,
const ShaderData *sd,
const AttributeDescriptor desc)
{
/* todo: optimize this so we don't have to transform both here and in
* kernel_tex_image_interp_3d when possible. Also could optimize for the
* common case where transform is translation/scale only. */
float3 P = sd->P;
object_inverse_position_transform(kg, sd, &P);
InterpolationType interp = (sd->flag & SD_VOLUME_CUBIC) ? INTERPOLATION_CUBIC :
INTERPOLATION_NONE;
return kernel_tex_image_interp_3d(kg, desc.offset, P, interp);
if (desc.element & (ATTR_ELEMENT_OBJECT | ATTR_ELEMENT_MESH)) {
return kernel_tex_fetch(__attributes_float3, desc.offset);
}
else if (desc.element == ATTR_ELEMENT_VOXEL) {
/* todo: optimize this so we don't have to transform both here and in
* kernel_tex_image_interp_3d when possible. Also could optimize for the
* common case where transform is translation/scale only. */
float3 P = sd->P;
object_inverse_position_transform(kg, sd, &P);
InterpolationType interp = (sd->flag & SD_VOLUME_CUBIC) ? INTERPOLATION_CUBIC :
INTERPOLATION_NONE;
return kernel_tex_image_interp_3d(kg, desc.offset, P, interp);
}
else {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
}
#endif

View File

@@ -40,7 +40,7 @@ ccl_device_noinline void compute_light_pass(
/* Evaluate surface shader. */
shader_eval_surface(kg, sd, &state, NULL, state.flag);
/* TODO, disable more closures we don't need besides transparent */
/* TODO: disable more closures we don't need besides transparent. */
shader_bsdf_disable_transparency(kg, sd);
/* Init ray. */

View File

@@ -176,8 +176,7 @@ ccl_device_noinline_cpu bool direct_emission(KernelGlobals *kg,
if (ls->shader & SHADER_CAST_SHADOW) {
/* setup ray */
bool transmit = (dot(sd->Ng, ls->D) < 0.0f);
ray->P = ray_offset(sd->P, (transmit) ? -sd->Ng : sd->Ng);
ray->P = ray_offset_shadow(kg, sd, ls->D);
if (ls->t == FLT_MAX) {
/* distant light */

View File

@@ -64,7 +64,7 @@ typedef struct KernelGlobals {
OSLThreadData *osl_tdata;
# endif
/* **** Run-time data **** */
/* **** Run-time data **** */
/* Heap-allocated storage for transparent shadows intersections. */
Intersection *transparent_shadow_intersections;

View File

@@ -35,7 +35,7 @@
CCL_NAMESPACE_BEGIN
/* Spherical coordinates <-> Cartesian direction */
/* Spherical coordinates <-> Cartesian direction. */
ccl_device float2 direction_to_spherical(float3 dir)
{

View File

@@ -79,7 +79,7 @@ ccl_device void enqueue_ray_index_local(
{
int lidx = ccl_local_id(1) * ccl_local_size(0) + ccl_local_id(0);
/* Get local queue id .*/
/* Get local queue id. */
unsigned int lqidx;
if (enqueue_flag) {
lqidx = atomic_fetch_and_inc_uint32(local_queue_atomics);

View File

@@ -274,7 +274,7 @@ ccl_device_inline void shader_setup_from_sample(KernelGlobals *kg,
/* primitive */
sd->object = object;
sd->lamp = LAMP_NONE;
/* currently no access to bvh prim index for strand sd->prim*/
/* Currently no access to bvh prim index for strand sd->prim. */
sd->prim = prim;
sd->u = u;
sd->v = v;
@@ -1268,6 +1268,7 @@ ccl_device_inline void shader_eval_volume(KernelGlobals *kg,
sd->num_closure_left = max_closures;
sd->flag = 0;
sd->object_flag = 0;
sd->type = PRIMITIVE_VOLUME;
for (int i = 0; stack[i].shader != SHADER_NONE; i++) {
/* setup shaderdata from stack. it's mostly setup already in

View File

@@ -409,7 +409,7 @@ ccl_device void subsurface_random_walk_coefficients(const ShaderClosure *sc,
ccl_device_forceinline float eval_phase_dwivedi(float v, float phase_log, float cos_theta)
{
/* Eq. 9 from [2] using precomputed log((v + 1) / (v - 1))*/
/* Eq. 9 from [2] using precomputed log((v + 1) / (v - 1)) */
return 1.0f / ((v - cos_theta) * phase_log);
}

View File

@@ -302,7 +302,7 @@ enum PathRayFlag {
PATH_RAY_DIFFUSE_ANCESTOR = (1 << 15),
/* Single pass has been written. */
PATH_RAY_SINGLE_PASS_DONE = (1 << 16),
/* Ray is behind a shadow catcher .*/
/* Ray is behind a shadow catcher. */
PATH_RAY_SHADOW_CATCHER = (1 << 17),
/* Store shadow data for shadow catcher or denoising. */
PATH_RAY_STORE_SHADOW_INFO = (1 << 18),
@@ -689,22 +689,24 @@ typedef enum PrimitiveType {
PRIMITIVE_MOTION_CURVE_THICK = (1 << 3),
PRIMITIVE_CURVE_RIBBON = (1 << 4),
PRIMITIVE_MOTION_CURVE_RIBBON = (1 << 5),
PRIMITIVE_VOLUME = (1 << 6),
/* Lamp primitive is not included below on purpose,
* since it is no real traceable primitive.
*/
PRIMITIVE_LAMP = (1 << 6),
PRIMITIVE_LAMP = (1 << 7),
PRIMITIVE_ALL_TRIANGLE = (PRIMITIVE_TRIANGLE | PRIMITIVE_MOTION_TRIANGLE),
PRIMITIVE_ALL_CURVE = (PRIMITIVE_CURVE_THICK | PRIMITIVE_MOTION_CURVE_THICK |
PRIMITIVE_CURVE_RIBBON | PRIMITIVE_MOTION_CURVE_RIBBON),
PRIMITIVE_ALL_VOLUME = (PRIMITIVE_VOLUME),
PRIMITIVE_ALL_MOTION = (PRIMITIVE_MOTION_TRIANGLE | PRIMITIVE_MOTION_CURVE_THICK |
PRIMITIVE_MOTION_CURVE_RIBBON),
PRIMITIVE_ALL = (PRIMITIVE_ALL_TRIANGLE | PRIMITIVE_ALL_CURVE),
PRIMITIVE_ALL = (PRIMITIVE_ALL_TRIANGLE | PRIMITIVE_ALL_CURVE | PRIMITIVE_ALL_VOLUME),
/* Total number of different traceable primitives.
* NOTE: This is an actual value, not a bitflag.
*/
PRIMITIVE_NUM_TOTAL = 6,
PRIMITIVE_NUM_TOTAL = 7,
} PrimitiveType;
#define PRIMITIVE_PACK_SEGMENT(type, segment) ((segment << PRIMITIVE_NUM_TOTAL) | (type))
@@ -1479,7 +1481,8 @@ typedef struct KernelObject {
float cryptomatte_object;
float cryptomatte_asset;
float shadow_terminator_offset;
float shadow_terminator_shading_offset;
float shadow_terminator_geometry_offset;
float pad1, pad2, pad3;
} KernelObject;
static_assert_align(KernelObject, 16);

View File

@@ -317,4 +317,4 @@ class OSLRenderServices : public OSL::RendererServices {
CCL_NAMESPACE_END
#endif /* __OSL_SERVICES_H__ */
#endif /* __OSL_SERVICES_H__ */

View File

@@ -49,7 +49,7 @@ void OSLShader::thread_init(KernelGlobals *kg,
return;
}
/* per thread kernel data init*/
/* Per thread kernel data init. */
kg->osl = osl_globals;
OSL::ShadingSystem *ss = kg->osl->ss;

View File

@@ -68,7 +68,7 @@ typedef ccl_global struct SplitBranchedState {
uint lcg_state;
LocalIntersection ss_isect;
# endif /*__SUBSURFACE__ */
# endif /* __SUBSURFACE__ */
int shared_sample_count; /* number of branched samples shared with other threads */
int original_ray; /* index of original ray when sharing branched samples */

View File

@@ -803,7 +803,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg,
float melanin_redness = stack_load_float_default(
stack, melanin_redness_ofs, data_node2.w);
/* Randomize melanin. */
/* Randomize melanin. */
float random_color = stack_load_float_default(stack, random_color_ofs, data_node3.z);
random_color = clamp(random_color, 0.0f, 1.0f);
float factor_random_color = 1.0f + 2.0f * (random - 0.5f) * random_color;

View File

@@ -220,11 +220,13 @@ ccl_device void svm_node_hair_info(
stack_store_float(stack, out_offset, data);
break;
}
/*case NODE_INFO_CURVE_FADE: {
# if 0
case NODE_INFO_CURVE_FADE: {
data = sd->curve_transparency;
stack_store_float(stack, out_offset, data);
break;
}*/
}
# endif
case NODE_INFO_CURVE_TANGENT_NORMAL: {
data3 = curve_tangent_normal(kg, sd);
stack_store_float3(stack, out_offset, data3);

View File

@@ -182,7 +182,7 @@ ccl_device void svm_node_tex_image_box(KernelGlobals *kg, ShaderData *sd, float
}
}
else {
/* Desperate mode, no valid choice anyway, fallback to one side.*/
/* Desperate mode, no valid choice anyway, fallback to one side. */
weight.x = 1.0f;
}

View File

@@ -333,7 +333,7 @@ static M44d get_interpolated_matrix_for_time(const MatrixSampleMap &samples, chr
chrono_t t = (time - prev_time) / (next_time - prev_time);
/* ensure rotation around the shortest angle */
/* Ensure rotation around the shortest angle. */
if ((prev_rotation ^ next_rotation) < 0) {
next_rotation = -next_rotation;
}

View File

@@ -736,13 +736,14 @@ static void process_uvs(CachedData &cache,
const IV2fGeomParam::Sample &sample,
double time)
{
if (scope != kFacevaryingScope) {
if (scope != kFacevaryingScope && scope != kVaryingScope && scope != kVertexScope) {
return;
}
const array<int> *uv_loops = cache.uv_loops.data_for_time_no_check(time).get_data_or_null();
if (!uv_loops) {
/* It's ok to not have loop indices, as long as the scope is not face-varying. */
if (!uv_loops && scope == kFacevaryingScope) {
return;
}
@@ -766,9 +767,27 @@ static void process_uvs(CachedData &cache,
const uint32_t *indices = sample.getIndices()->get();
const V2f *values = sample.getVals()->get();
for (const int uv_loop_index : *uv_loops) {
const uint32_t index = indices[uv_loop_index];
*data_float2++ = make_float2(values[index][0], values[index][1]);
if (scope == kFacevaryingScope) {
for (const int uv_loop_index : *uv_loops) {
const uint32_t index = indices[uv_loop_index];
*data_float2++ = make_float2(values[index][0], values[index][1]);
}
}
else if (scope == kVaryingScope || scope == kVertexScope) {
if (triangles) {
for (size_t i = 0; i < triangles->size(); i++) {
const int3 t = (*triangles)[i];
*data_float2++ = make_float2(values[t.x][0], values[t.x][1]);
*data_float2++ = make_float2(values[t.y][0], values[t.y][1]);
*data_float2++ = make_float2(values[t.z][0], values[t.z][1]);
}
}
else if (corners) {
for (size_t i = 0; i < corners->size(); i++) {
const int c = (*corners)[i];
*data_float2++ = make_float2(values[c][0], values[c][1]);
}
}
}
attribute.data.add_data(data, time);

View File

@@ -48,6 +48,7 @@ void ConstantFolder::make_constant(float value) const
foreach (ShaderInput *sock, output->links) {
sock->set(value);
sock->constant_folded_in = true;
}
graph->disconnect(output);
@@ -59,6 +60,7 @@ void ConstantFolder::make_constant(float3 value) const
foreach (ShaderInput *sock, output->links) {
sock->set(value);
sock->constant_folded_in = true;
}
graph->disconnect(output);

View File

@@ -676,8 +676,8 @@ void GeometryManager::update_attribute_element_offset(Geometry *geom,
Mesh *mesh = static_cast<Mesh *>(geom);
if (mesh->subdivision_type == Mesh::SUBDIVISION_CATMULL_CLARK &&
desc.flags & ATTR_SUBDIVIDED) {
/* indices for subdivided attributes are retrieved
* from patch table so no need for correction here*/
/* Indices for subdivided attributes are retrieved
* from patch table so no need for correction here. */
}
else if (element == ATTR_ELEMENT_VERTEX)
offset -= mesh->vert_offset;

View File

@@ -79,7 +79,11 @@ enum ShaderNodeSpecialType {
class ShaderInput {
public:
ShaderInput(const SocketType &socket_type_, ShaderNode *parent_)
: socket_type(socket_type_), parent(parent_), link(NULL), stack_offset(SVM_STACK_INVALID)
: socket_type(socket_type_),
parent(parent_),
link(NULL),
stack_offset(SVM_STACK_INVALID),
constant_folded_in(false)
{
}
@@ -111,6 +115,10 @@ class ShaderInput {
ShaderNode *parent;
ShaderOutput *link;
int stack_offset; /* for SVM compiler */
/* Keeps track of whether a constant was folded in this socket, to avoid over-optimizing when the
* link is null. */
bool constant_folded_in;
};
/* Output

View File

@@ -16,8 +16,10 @@
#include "render/image_vdb.h"
#include "util/util_logging.h"
#include "util/util_openvdb.h"
#ifdef WITH_OPENVDB
# include <openvdb/openvdb.h>
# include <openvdb/tools/Dense.h>
#endif
#ifdef WITH_NANOVDB
@@ -26,6 +28,57 @@
CCL_NAMESPACE_BEGIN
#ifdef WITH_OPENVDB
struct NumChannelsOp {
int num_channels = 0;
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
bool operator()(const openvdb::GridBase::ConstPtr &grid)
{
num_channels = channels;
return true;
}
};
struct ToDenseOp {
openvdb::CoordBBox bbox;
void *pixels;
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
bool operator()(const openvdb::GridBase::ConstPtr &grid)
{
openvdb::tools::Dense<FloatDataType, openvdb::tools::LayoutXYZ> dense(bbox,
(FloatDataType *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<GridType>(grid), dense);
return true;
}
};
# ifdef WITH_NANOVDB
struct ToNanoOp {
nanovdb::GridHandle<> nanogrid;
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
bool operator()(const openvdb::GridBase::ConstPtr &grid)
{
if constexpr (!std::is_same_v<GridType, openvdb::MaskGrid>) {
try {
nanogrid = nanovdb::openToNanoVDB(
FloatGridType(*openvdb::gridConstPtrCast<GridType>(grid)));
}
catch (const std::exception &e) {
VLOG(1) << "Error converting OpenVDB to NanoVDB grid: " << e.what();
}
return true;
}
else {
return false;
}
}
};
# endif
#endif
VDBImageLoader::VDBImageLoader(const string &grid_name) : grid_name(grid_name)
{
}
@@ -41,98 +94,40 @@ bool VDBImageLoader::load_metadata(const ImageDeviceFeatures &features, ImageMet
return false;
}
/* Get number of channels from type. */
NumChannelsOp op;
if (!openvdb::grid_type_operation(grid, op)) {
return false;
}
metadata.channels = op.num_channels;
/* Set data type. */
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
/* NanoVDB expects no inactive leaf nodes. */
/*openvdb::FloatGrid &pruned_grid = *openvdb::gridPtrCast<openvdb::FloatGrid>(grid);
openvdb::tools::pruneInactive(pruned_grid.tree());
nanogrid = nanovdb::openToNanoVDB(pruned_grid);*/
ToNanoOp op;
if (!openvdb::grid_type_operation(grid, op)) {
return false;
}
nanogrid = std::move(op.nanogrid);
}
# endif
/* Set dimensions. */
bbox = grid->evalActiveVoxelBoundingBox();
if (bbox.empty()) {
return false;
}
/* Set dimensions. */
openvdb::Coord dim = bbox.dim();
metadata.width = dim.x();
metadata.height = dim.y();
metadata.depth = dim.z();
/* Set data type. */
if (grid->isType<openvdb::FloatGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(*openvdb::gridConstPtrCast<openvdb::FloatGrid>(grid));
}
# endif
}
else if (grid->isType<openvdb::Vec3fGrid>()) {
metadata.channels = 3;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(*openvdb::gridConstPtrCast<openvdb::Vec3fGrid>(grid));
}
# endif
}
else if (grid->isType<openvdb::BoolGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::BoolGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::DoubleGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::DoubleGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Int32Grid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::Int32Grid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Int64Grid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::Int64Grid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Vec3IGrid>()) {
metadata.channels = 3;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::Vec3fGrid(*openvdb::gridConstPtrCast<openvdb::Vec3IGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Vec3dGrid>()) {
metadata.channels = 3;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::Vec3fGrid(*openvdb::gridConstPtrCast<openvdb::Vec3dGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::MaskGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
return false; // Unsupported
# endif
}
else {
return false;
}
# ifdef WITH_NANOVDB
if (nanogrid) {
metadata.byte_size = nanogrid.size();
@@ -200,45 +195,10 @@ bool VDBImageLoader::load_pixels(const ImageMetaData &, void *pixels, const size
else
# endif
{
if (grid->isType<openvdb::FloatGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::FloatGrid>(grid), dense);
}
else if (grid->isType<openvdb::Vec3fGrid>()) {
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
bbox, (openvdb::Vec3f *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3fGrid>(grid), dense);
}
else if (grid->isType<openvdb::BoolGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::BoolGrid>(grid), dense);
}
else if (grid->isType<openvdb::DoubleGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::DoubleGrid>(grid), dense);
}
else if (grid->isType<openvdb::Int32Grid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Int32Grid>(grid), dense);
}
else if (grid->isType<openvdb::Int64Grid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Int64Grid>(grid), dense);
}
else if (grid->isType<openvdb::Vec3IGrid>()) {
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
bbox, (openvdb::Vec3f *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3IGrid>(grid), dense);
}
else if (grid->isType<openvdb::Vec3dGrid>()) {
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
bbox, (openvdb::Vec3f *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3dGrid>(grid), dense);
}
else if (grid->isType<openvdb::MaskGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::MaskGrid>(grid), dense);
}
ToDenseOp op;
op.pixels = pixels;
op.bbox = bbox;
openvdb::grid_type_operation(grid, op);
}
return true;
#else

View File

@@ -4374,7 +4374,7 @@ NODE_DEFINE(HairInfoNode)
SOCKET_OUT_FLOAT(intercept, "Intercept");
SOCKET_OUT_FLOAT(thickness, "Thickness");
SOCKET_OUT_NORMAL(tangent_normal, "Tangent Normal");
#if 0 /*output for minimum hair width transparency - deactivated */
#if 0 /* Output for minimum hair width transparency - deactivated. */
SOCKET_OUT_FLOAT(fade, "Fade");
#endif
SOCKET_OUT_FLOAT(index, "Random");
@@ -4425,12 +4425,12 @@ void HairInfoNode::compile(SVMCompiler &compiler)
if (!out->links.empty()) {
compiler.add_node(NODE_HAIR_INFO, NODE_INFO_CURVE_TANGENT_NORMAL, compiler.stack_assign(out));
}
/*out = output("Fade");
#if 0
out = output("Fade");
if(!out->links.empty()) {
compiler.add_node(NODE_HAIR_INFO, NODE_INFO_CURVE_FADE, compiler.stack_assign(out));
}*/
}
#endif
out = output("Random");
if (!out->links.empty()) {
int attr = compiler.attribute(ATTR_STD_CURVE_RANDOM);

View File

@@ -93,7 +93,8 @@ NODE_DEFINE(Object)
SOCKET_POINT(dupli_generated, "Dupli Generated", zero_float3());
SOCKET_POINT2(dupli_uv, "Dupli UV", zero_float2());
SOCKET_TRANSFORM_ARRAY(motion, "Motion", array<Transform>());
SOCKET_FLOAT(shadow_terminator_offset, "Terminator Offset", 0.0f);
SOCKET_FLOAT(shadow_terminator_shading_offset, "Shadow Terminator Shading Offset", 0.0f);
SOCKET_FLOAT(shadow_terminator_geometry_offset, "Shadow Terminator Geometry Offset", 0.1f);
SOCKET_STRING(asset_name, "Asset Name", ustring());
SOCKET_BOOLEAN(is_shadow_catcher, "Shadow Catcher", false);
@@ -507,7 +508,9 @@ void ObjectManager::device_update_object_transform(UpdateObjectTransformState *s
kobject.cryptomatte_asset = util_hash_to_float(hash_asset);
}
kobject.shadow_terminator_offset = 1.0f / (1.0f - 0.5f * ob->shadow_terminator_offset);
kobject.shadow_terminator_shading_offset = 1.0f /
(1.0f - 0.5f * ob->shadow_terminator_shading_offset);
kobject.shadow_terminator_geometry_offset = ob->shadow_terminator_geometry_offset;
/* Object flag. */
if (ob->use_holdout) {

View File

@@ -64,7 +64,8 @@ class Object : public Node {
NODE_SOCKET_API(bool, hide_on_missing_motion)
NODE_SOCKET_API(bool, use_holdout)
NODE_SOCKET_API(bool, is_shadow_catcher)
NODE_SOCKET_API(float, shadow_terminator_offset)
NODE_SOCKET_API(float, shadow_terminator_shading_offset)
NODE_SOCKET_API(float, shadow_terminator_geometry_offset)
NODE_SOCKET_API(float3, dupli_generated)
NODE_SOCKET_API(float2, dupli_uv)

View File

@@ -195,4 +195,4 @@ class OSLCompiler {
CCL_NAMESPACE_END
#endif /* __OSL_H__ */
#endif /* __OSL_H__ */

View File

@@ -1252,7 +1252,7 @@ bool Session::update_progressive_refine(bool cancel)
double current_time = time_dt();
if (current_time - last_update_time < params.progressive_update_timeout) {
/* if last sample was processed, we need to write buffers anyway */
/* If last sample was processed, we need to write buffers anyway. */
if (!write && sample != 1)
return false;
}

View File

@@ -304,7 +304,7 @@ int SVMCompiler::stack_assign(ShaderOutput *output)
int SVMCompiler::stack_assign_if_linked(ShaderInput *input)
{
if (input->link)
if (input->link || input->constant_folded_in)
return stack_assign(input);
return SVM_STACK_INVALID;

View File

@@ -15,7 +15,7 @@
if(WITH_GTESTS)
Include(GTestTesting)
# Otherwise we get warnings here that we cant fix in external projects
# Otherwise we get warnings here that we can't fix in external projects
remove_strict_flags()
endif()

View File

@@ -223,12 +223,14 @@ ccl_device_inline ssef fastpow24(const ssef &arg)
ssef x = fastpow<0x3F4CCCCD, 0x4F55A7FB>(arg); // error max = 0.17 avg = 0.0018 |avg| = 0.05
ssef arg2 = arg * arg;
ssef arg4 = arg2 * arg2;
x = improve_5throot_solution(x,
arg4); /* error max = 0.018 avg = 0.0031 |avg| = 0.0031 */
x = improve_5throot_solution(x,
arg4); /* error max = 0.00021 avg = 1.6e-05 |avg| = 1.6e-05 */
x = improve_5throot_solution(x,
arg4); /* error max = 6.1e-07 avg = 5.2e-08 |avg| = 1.1e-07 */
/* error max = 0.018 avg = 0.0031 |avg| = 0.0031 */
x = improve_5throot_solution(x, arg4);
/* error max = 0.00021 avg = 1.6e-05 |avg| = 1.6e-05 */
x = improve_5throot_solution(x, arg4);
/* error max = 6.1e-07 avg = 5.2e-08 |avg| = 1.1e-07 */
x = improve_5throot_solution(x, arg4);
return x * (x * x);
}

View File

@@ -129,7 +129,7 @@ class DebugFlags {
DEVICE_NONE,
/* All OpenCL devices will be used. */
DEVICE_ALL,
/* Default system OpenCL device will be used. */
/* Default system OpenCL device will be used. */
DEVICE_DEFAULT,
/* Host processor will be used. */
DEVICE_CPU,

View File

@@ -243,7 +243,7 @@ ccl_device float fast_sinpif(float x)
const float P = 3.584135056f; /* P = 16-4*Q */
return y * (Q + P * fabsf(y));
/* The original article used used inferior constants for Q and P and
/* The original article used inferior constants for Q and P and
* so had max error 1.091e-3.
*
* The optimal value for Q was determined by exhaustive search, minimizing

View File

@@ -25,6 +25,42 @@ namespace openvdb {
using Vec4fTree = tree::Tree4<Vec4f, 5, 4, 3>::Type;
using Vec4fGrid = Grid<Vec4fTree>;
/* Apply operation to known grid types. */
template<typename OpType>
bool grid_type_operation(const openvdb::GridBase::ConstPtr &grid, OpType &&op)
{
if (grid->isType<openvdb::FloatGrid>()) {
return op.template operator()<openvdb::FloatGrid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Vec3fGrid>()) {
return op.template operator()<openvdb::Vec3fGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
}
else if (grid->isType<openvdb::BoolGrid>()) {
return op.template operator()<openvdb::BoolGrid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::DoubleGrid>()) {
return op.template operator()<openvdb::DoubleGrid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Int32Grid>()) {
return op.template operator()<openvdb::Int32Grid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Int64Grid>()) {
return op.template operator()<openvdb::Int64Grid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Vec3IGrid>()) {
return op.template operator()<openvdb::Vec3IGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
}
else if (grid->isType<openvdb::Vec3dGrid>()) {
return op.template operator()<openvdb::Vec3dGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
}
else if (grid->isType<openvdb::MaskGrid>()) {
return op.template operator()<openvdb::MaskGrid, openvdb::FloatGrid, float, 1>(grid);
}
else {
return false;
}
}
}; // namespace openvdb
#endif

View File

@@ -282,8 +282,8 @@ static CPUCapabilities &system_cpu_capabilities()
/* actual opcode for xgetbv */
__asm__(".byte 0x0f, 0x01, 0xd0" : "=a"(xcr_feature_mask), "=d"(edx) : "c"(0));
# elif defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK)
xcr_feature_mask = (uint32_t)_xgetbv(
_XCR_XFEATURE_ENABLED_MASK); /* min VS2010 SP1 compiler is required */
/* Minimum VS2010 SP1 compiler is required. */
xcr_feature_mask = (uint32_t)_xgetbv(_XCR_XFEATURE_ENABLED_MASK);
# else
xcr_feature_mask = 0;
# endif

View File

@@ -68,7 +68,7 @@ class TaskPool {
/* ** Statistics ** */
/* Time time stamp of first task pushed. */
/* Time stamp of first task pushed. */
double start_time;
/* Number of all tasks pushed to the pool. Cleared after wait_work() and cancel(). */
@@ -88,7 +88,7 @@ class TaskScheduler {
/* Approximate number of threads that will work on task, which may be lower
* or higher than the actual number of threads. Use as little as possible and
* leave splitting up tasks to the scheduler.. */
* leave splitting up tasks to the scheduler. */
static int num_threads();
protected:

View File

@@ -370,6 +370,7 @@ elseif(WIN32)
intern/GHOST_DropTargetWin32.cpp
intern/GHOST_SystemWin32.cpp
intern/GHOST_WindowWin32.cpp
intern/GHOST_Wintab.cpp
intern/GHOST_ContextD3D.h
intern/GHOST_DisplayManagerWin32.h
@@ -377,6 +378,7 @@ elseif(WIN32)
intern/GHOST_SystemWin32.h
intern/GHOST_TaskbarWin32.h
intern/GHOST_WindowWin32.h
intern/GHOST_Wintab.h
)
if(NOT WITH_GL_EGL)
@@ -481,10 +483,17 @@ if(WITH_XR_OPENXR)
shlwapi
)
elseif(UNIX AND NOT APPLE)
list(APPEND XR_PLATFORM_DEFINES
-DXR_OS_LINUX
-DXR_USE_PLATFORM_XLIB
)
list(APPEND XR_PLATFORM_DEFINES -DXR_OS_LINUX)
if (WITH_GHOST_WAYLAND)
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_WAYLAND)
endif()
if (WITH_GHOST_X11)
if (WITH_GL_EGL)
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_EGL)
else()
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_XLIB)
endif()
endif()
endif()
add_definitions(-DWITH_XR_OPENXR ${XR_PLATFORM_DEFINES})

View File

@@ -96,7 +96,7 @@ extern GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consu
* \param systemhandle: The handle to the system.
* \return The number of milliseconds.
*/
extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
extern uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
/**
* Installs a timer.
@@ -110,8 +110,8 @@ extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
* \return A timer task (0 if timer task installation failed).
*/
extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
GHOST_TUns64 delay,
GHOST_TUns64 interval,
uint64_t delay,
uint64_t interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData);
@@ -133,7 +133,7 @@ extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
* \param systemhandle: The handle to the system.
* \return The number of displays.
*/
extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
extern uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
/**
* Returns the dimensions of the main display on this system.
@@ -142,8 +142,8 @@ extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
* \param height: A pointer the height gets put in.
*/
extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
GHOST_TUns32 *width,
GHOST_TUns32 *height);
uint32_t *width,
uint32_t *height);
/**
* Returns the dimensions of all displays combine
@@ -154,8 +154,8 @@ extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
* \param height: A pointer the height gets put in.
*/
extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
GHOST_TUns32 *width,
GHOST_TUns32 *height);
uint32_t *width,
uint32_t *height);
/**
* Create a new window.
@@ -178,10 +178,10 @@ extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle parent_windowhandle,
const char *title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TWindowState state,
bool is_dialog,
GHOST_TDrawingContextType type,
@@ -360,13 +360,13 @@ extern GHOST_TSuccess GHOST_HasCursorShape(GHOST_WindowHandle windowhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
uint8_t *bitmap,
uint8_t *mask,
int sizex,
int sizey,
int hotX,
int hotY,
GHOST_TUns8 canInvertColor);
bool canInvertColor);
/**
* Returns the visibility state of the cursor.
@@ -391,8 +391,8 @@ extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 *x,
GHOST_TInt32 *y);
int32_t *x,
int32_t *y);
/**
* Updates the location of the cursor (location in screen coordinates).
@@ -403,8 +403,8 @@ extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 x,
GHOST_TInt32 y);
int32_t x,
int32_t y);
/**
* Grabs the cursor for a modal operation, to keep receiving
@@ -467,7 +467,7 @@ extern void GHOST_setNDOFDeadZone(float deadzone);
/**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
*/
extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept);
extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool canAccept);
/**
* Returns the event type.
@@ -481,7 +481,7 @@ extern GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle);
* \param eventhandle: The handle to the event.
* \return The event generation time.
*/
extern GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle);
extern uint64_t GHOST_GetEventTime(GHOST_EventHandle eventhandle);
/**
* Returns the window this event was generated on,
@@ -507,7 +507,7 @@ extern GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhand
/**
* Changes the timer callback.
* \param timertaskhandle: The handle to the timertask.
* \param timertaskhandle: The handle to the timer-task.
* \param timerProc: The timer callback.
*/
extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
@@ -515,14 +515,14 @@ extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
/**
* Returns the timer user data.
* \param timertaskhandle: The handle to the timertask.
* \param timertaskhandle: The handle to the timer-task.
* \return The timer user data.
*/
extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle);
/**
* Changes the time user data.
* \param timertaskhandle: The handle to the timertask.
* \param timertaskhandle: The handle to the timer-task.
* \param userdata: The timer user data.
*/
extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
@@ -595,7 +595,7 @@ void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle);
* \param width: The new width of the client area of the window.
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, GHOST_TUns32 width);
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint32_t width);
/**
* Resizes client rectangle height.
@@ -603,7 +603,7 @@ extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, GHOS
* \param height: The new height of the client area of the window.
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHOST_TUns32 height);
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t height);
/**
* Resizes client rectangle.
@@ -613,8 +613,8 @@ extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHO
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
GHOST_TUns32 width,
GHOST_TUns32 height);
uint32_t width,
uint32_t height);
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -624,11 +624,8 @@ extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
* \param outX: The x-coordinate in the client rectangle.
* \param outY: The y-coordinate in the client rectangle.
*/
extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY);
extern void GHOST_ScreenToClient(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY);
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -638,11 +635,8 @@ extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
* \param outX: The x-coordinate on the screen.
* \param outY: The y-coordinate on the screen.
*/
extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY);
extern void GHOST_ClientToScreen(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY);
/**
* Returns the state of the window (normal, minimized, maximized).
@@ -667,7 +661,7 @@ extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
GHOST_TUns8 isUnsavedChanges);
bool isUnsavedChanges);
/**
* Sets the order of the window (bottom, top).
@@ -758,14 +752,14 @@ extern void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI
* \param rectanglehandle: The handle to the rectangle.
* \return width of the rectangle
*/
extern GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle);
extern int32_t GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Access to rectangle height.
* \param rectanglehandle: The handle to the rectangle.
* \return height of the rectangle
*/
extern GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
extern int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Gets all members of the rectangle.
@@ -775,11 +769,8 @@ extern GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehand
* \param r: Pointer to return right coordinate in.
* \param b: Pointer to return bottom coordinate in.
*/
extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 *l,
GHOST_TInt32 *t,
GHOST_TInt32 *r,
GHOST_TInt32 *b);
extern void GHOST_GetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b);
/**
* Sets all members of the rectangle.
@@ -789,11 +780,8 @@ extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
* \param r: requested right coordinate of the rectangle.
* \param b: requested bottom coordinate of the rectangle.
*/
extern void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 l,
GHOST_TInt32 t,
GHOST_TInt32 r,
GHOST_TInt32 b);
extern void GHOST_SetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t l, int32_t t, int32_t r, int32_t b);
/**
* Returns whether this rectangle is empty.
@@ -818,7 +806,7 @@ extern GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehand
* \param rectanglehandle: The handle to the rectangle.
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
*/
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 i);
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t i);
/**
* Does a union of the rectangle given and this rectangle.
@@ -835,9 +823,7 @@ extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
* \param x: The x-coordinate of the point.
* \param y: The y-coordinate of the point.
*/
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y);
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y);
/**
* Returns whether the point is inside this rectangle.
@@ -848,8 +834,8 @@ extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
* \return Success value (true if point is inside).
*/
extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y);
int32_t x,
int32_t y);
/**
* Returns whether the rectangle is inside this rectangle.
@@ -868,8 +854,8 @@ extern GHOST_TVisibility GHOST_GetRectangleVisibility(
* \param cy: Requested center y-coordinate of the rectangle.
*/
extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy);
int32_t cx,
int32_t cy);
/**
* Sets rectangle members.
@@ -881,11 +867,8 @@ extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
* \param w: requested width of the rectangle.
* \param h: requested height of the rectangle.
*/
extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy,
GHOST_TInt32 w,
GHOST_TInt32 h);
extern void GHOST_SetRectangleCenter(
GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy, int32_t w, int32_t h);
/**
* Clips a rectangle.
@@ -903,14 +886,14 @@ extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
* \param selection: Boolean to return the selection instead, X11 only feature.
* \return clipboard data
*/
extern GHOST_TUns8 *GHOST_getClipboard(int selection);
extern char *GHOST_getClipboard(bool selection);
/**
* Put data to the Clipboard
* \param buffer: the string buffer to set.
* \param selection: Set the selection instead, X11 only feature.
*/
extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
extern void GHOST_putClipboard(char *buffer, bool selection);
/**
* Toggles console
@@ -942,7 +925,7 @@ extern float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle);
/**
* Returns the suggested DPI for this window.
*/
extern GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
extern uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
/**
* Enable IME attached to the given window, i.e. allows user-input
@@ -956,12 +939,8 @@ extern GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
* - true: Start a new composition.
* - false: Move the IME windows to the given position without finishing it.
*/
extern void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
GHOST_TInt32 x,
GHOST_TInt32 y,
GHOST_TInt32 w,
GHOST_TInt32 h,
int complete);
extern void GHOST_BeginIME(
GHOST_WindowHandle windowhandle, int32_t x, int32_t y, int32_t w, int32_t h, bool complete);
/**
* Disable the IME attached to the given window, i.e. prohibits any user-input
* events from being dispatched to the IME.
@@ -1076,7 +1055,7 @@ void GHOST_XrDestroyActionSet(GHOST_XrContextHandle xr_context, const char *acti
*/
int GHOST_XrCreateActions(GHOST_XrContextHandle xr_context,
const char *action_set_name,
GHOST_TUns32 count,
uint32_t count,
const GHOST_XrActionInfo *infos);
/**
@@ -1084,7 +1063,7 @@ int GHOST_XrCreateActions(GHOST_XrContextHandle xr_context,
*/
void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
const char *action_set_name,
GHOST_TUns32 count,
uint32_t count,
const char *const *action_names);
/**
@@ -1092,7 +1071,7 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
*/
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
const char *action_set_name,
GHOST_TUns32 count,
uint32_t count,
const GHOST_XrActionSpaceInfo *infos);
/**
@@ -1100,7 +1079,7 @@ int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
*/
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
const char *action_set_name,
GHOST_TUns32 count,
uint32_t count,
const GHOST_XrActionSpaceInfo *infos);
/**
@@ -1108,7 +1087,7 @@ void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
*/
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
const char *action_set_name,
GHOST_TUns32 count,
uint32_t count,
const GHOST_XrActionProfileInfo *infos);
/**
@@ -1116,7 +1095,7 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
*/
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_context,
const char *action_set_name,
GHOST_TUns32 count,
uint32_t count,
const GHOST_XrActionProfileInfo *infos);
/**
@@ -1138,7 +1117,7 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_context, const char *action_set
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
const char *action_set_name,
const char *action_name,
const GHOST_TInt64 *duration,
const int64_t *duration,
const float *frequency,
const float *amplitude);

View File

@@ -58,7 +58,7 @@ class GHOST_IEvent {
* Returns the time this event was generated.
* \return The event generation time.
*/
virtual GHOST_TUns64 getTime() = 0;
virtual uint64_t getTime() = 0;
/**
* Returns the window this event was generated on,

View File

@@ -177,7 +177,7 @@ class GHOST_ISystem {
* Based on ANSI clock() routine.
* \return The number of milliseconds.
*/
virtual GHOST_TUns64 getMilliSeconds() const = 0;
virtual uint64_t getMilliSeconds() const = 0;
/**
* Installs a timer.
@@ -189,8 +189,8 @@ class GHOST_ISystem {
* \param userData: Placeholder for user data.
* \return A timer task (0 if timer task installation failed).
*/
virtual GHOST_ITimerTask *installTimer(GHOST_TUns64 delay,
GHOST_TUns64 interval,
virtual GHOST_ITimerTask *installTimer(uint64_t delay,
uint64_t interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData = NULL) = 0;
@@ -209,19 +209,19 @@ class GHOST_ISystem {
* Returns the number of displays on this system.
* \return The number of displays.
*/
virtual GHOST_TUns8 getNumDisplays() const = 0;
virtual uint8_t getNumDisplays() const = 0;
/**
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
virtual void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const = 0;
virtual void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const = 0;
/**
* Returns the combine dimensions of all monitors.
* \return The dimension of the workspace.
*/
virtual void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const = 0;
virtual void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const = 0;
/**
* Create a new window.
@@ -242,10 +242,10 @@ class GHOST_ISystem {
* \return The new window (or 0 if creation failed).
*/
virtual GHOST_IWindow *createWindow(const char *title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -365,7 +365,7 @@ class GHOST_ISystem {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const = 0;
virtual GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const = 0;
/**
* Updates the location of the cursor (location in screen coordinates).
@@ -374,7 +374,7 @@ class GHOST_ISystem {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0;
virtual GHOST_TSuccess setCursorPosition(int32_t x, int32_t y) = 0;
/***************************************************************************************
* Access to mouse button and keyboard states.
@@ -431,12 +431,12 @@ class GHOST_ISystem {
* \return "unsigned char" from X11 XA_CUT_BUFFER0 buffer
*
*/
virtual GHOST_TUns8 *getClipboard(bool selection) const = 0;
virtual char *getClipboard(bool selection) const = 0;
/**
* Put data to the Clipboard
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
virtual void putClipboard(char *buffer, bool selection) const = 0;
/***************************************************************************************
* System Message Box.

View File

@@ -68,26 +68,26 @@ class GHOST_ISystemPaths {
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
virtual const char *getSystemDir(int version, const char *versionstr) const = 0;
/**
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
virtual const char *getUserDir(int version, const char *versionstr) const = 0;
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
virtual const GHOST_TUns8 *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const = 0;
virtual const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const = 0;
/**
* Determine the directory of the current binary
* \return Unsigned char string pointing to the binary dir
*/
virtual const GHOST_TUns8 *getBinaryDir() const = 0;
virtual const char *getBinaryDir() const = 0;
/**
* Add the file to the operating system most recently used files
@@ -95,7 +95,7 @@ class GHOST_ISystemPaths {
virtual void addToSystemRecentFiles(const char *filename) const = 0;
private:
/** The one and only system paths*/
/** The one and only system paths. */
static GHOST_ISystemPaths *m_systemPaths;
#ifdef WITH_CXX_GUARDEDALLOC

View File

@@ -108,20 +108,20 @@ class GHOST_IWindow {
* Resizes client rectangle width.
* \param width: The new width of the client area of the window.
*/
virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
virtual GHOST_TSuccess setClientWidth(uint32_t width) = 0;
/**
* Resizes client rectangle height.
* \param height: The new height of the client area of the window.
*/
virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
virtual GHOST_TSuccess setClientHeight(uint32_t height) = 0;
/**
* Resizes client rectangle.
* \param width: The new width of the client area of the window.
* \param height: The new height of the client area of the window.
*/
virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
virtual GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) = 0;
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -130,10 +130,7 @@ class GHOST_IWindow {
* \param outX: The x-coordinate in the client rectangle.
* \param outY: The y-coordinate in the client rectangle.
*/
virtual void screenToClient(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const = 0;
virtual void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const = 0;
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -142,10 +139,7 @@ class GHOST_IWindow {
* \param outX: The x-coordinate on the screen.
* \param outY: The y-coordinate on the screen.
*/
virtual void clientToScreen(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const = 0;
virtual void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const = 0;
/**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
@@ -290,8 +284,8 @@ class GHOST_IWindow {
* \param hotY: The Y coordinate of the cursor hot-spot.
* \return Indication of success.
*/
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
virtual GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap,
uint8_t *mask,
int sizex,
int sizey,
int hotX,
@@ -319,7 +313,7 @@ class GHOST_IWindow {
virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode /*mode*/,
GHOST_TAxisFlag /*wrap_axis*/,
GHOST_Rect * /*bounds*/,
GHOST_TInt32 /*mouse_ungrab_xy*/[2])
int32_t /*mouse_ungrab_xy*/[2])
{
return GHOST_kSuccess;
}
@@ -334,7 +328,7 @@ class GHOST_IWindow {
* Returns the recommended DPI for this window.
* \return The recommended DPI for this window.
*/
virtual GHOST_TUns16 getDPIHint() = 0;
virtual uint16_t getDPIHint() = 0;
#ifdef WITH_INPUT_IME
/**
@@ -348,8 +342,7 @@ class GHOST_IWindow {
* - true: Start a new composition
* - false: Move the IME windows to the given position without finishing it.
*/
virtual void beginIME(
GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 w, GHOST_TInt32 h, int completed) = 0;
virtual void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) = 0;
/**
* Disable the IME attached to the given window, i.e. prohibits any user-input

View File

@@ -48,25 +48,25 @@ extern GHOST_TSuccess GHOST_DisposeSystemPaths(void);
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
extern const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr);
extern const char *GHOST_getSystemDir(int version, const char *versionstr);
/**
* Determine the base dir in which user configuration is stored, including versioning.
* \return Unsigned char string pointing to user dir (eg ~).
*/
extern const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr);
extern const char *GHOST_getUserDir(int version, const char *versionstr);
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
extern const GHOST_TUns8 *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type);
extern const char *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type);
/**
* Determine the dir in which the binary file is found.
* \return Unsigned char string pointing to binary dir (eg ~/usr/local/bin/).
*/
extern const GHOST_TUns8 *GHOST_getBinaryDir(void);
extern const char *GHOST_getBinaryDir(void);
/**
* Add the file to the operating system most recently used files

View File

@@ -42,7 +42,7 @@ class GHOST_Rect {
* \param r: requested right coordinate of the rectangle.
* \param b: requested bottom coordinate of the rectangle.
*/
GHOST_Rect(GHOST_TInt32 l = 0, GHOST_TInt32 t = 0, GHOST_TInt32 r = 0, GHOST_TInt32 b = 0)
GHOST_Rect(int32_t l = 0, int32_t t = 0, int32_t r = 0, int32_t b = 0)
: m_l(l), m_t(t), m_r(r), m_b(b)
{
}
@@ -58,13 +58,13 @@ class GHOST_Rect {
* Access to rectangle width.
* \return width of the rectangle.
*/
virtual inline GHOST_TInt32 getWidth() const;
virtual inline int32_t getWidth() const;
/**
* Access to rectangle height.
* \return height of the rectangle.
*/
virtual inline GHOST_TInt32 getHeight() const;
virtual inline int32_t getHeight() const;
/**
* Sets all members of the rectangle.
@@ -73,7 +73,7 @@ class GHOST_Rect {
* \param r: requested right coordinate of the rectangle.
* \param b: requested bottom coordinate of the rectangle.
*/
virtual inline void set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b);
virtual inline void set(int32_t l, int32_t t, int32_t r, int32_t b);
/**
* Returns whether this rectangle is empty.
@@ -95,7 +95,7 @@ class GHOST_Rect {
* The method avoids negative insets making the rectangle invalid
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
*/
virtual void inset(GHOST_TInt32 i);
virtual void inset(int32_t i);
/**
* Does a union of the rectangle given and this rectangle.
@@ -109,17 +109,14 @@ class GHOST_Rect {
* \param x: The x-coordinate of the point.
* \param y: The y-coordinate of the point.
*/
virtual inline void unionPoint(GHOST_TInt32 x, GHOST_TInt32 y);
virtual inline void unionPoint(int32_t x, int32_t y);
/**
* Grows the rectangle to included a point.
* \param x: The x-coordinate of the point.
* \param y: The y-coordinate of the point.
*/
virtual inline void wrapPoint(GHOST_TInt32 &x,
GHOST_TInt32 &y,
GHOST_TInt32 ofs,
GHOST_TAxisFlag axis);
virtual inline void wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAxisFlag axis);
/**
* Returns whether the point is inside this rectangle.
@@ -128,7 +125,7 @@ class GHOST_Rect {
* \param y: y-coordinate of point to test.
* \return boolean value (true if point is inside).
*/
virtual inline bool isInside(GHOST_TInt32 x, GHOST_TInt32 y) const;
virtual inline bool isInside(int32_t x, int32_t y) const;
/**
* Returns whether the rectangle is inside this rectangle.
@@ -143,7 +140,7 @@ class GHOST_Rect {
* \param cx: requested center x-coordinate of the rectangle.
* \param cy: requested center y-coordinate of the rectangle.
*/
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy);
virtual void setCenter(int32_t cx, int32_t cy);
/**
* Sets rectangle members.
@@ -154,7 +151,7 @@ class GHOST_Rect {
* \param w: requested width of the rectangle.
* \param h: requested height of the rectangle.
*/
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h);
virtual void setCenter(int32_t cx, int32_t cy, int32_t w, int32_t h);
/**
* Clips a rectangle.
@@ -166,30 +163,30 @@ class GHOST_Rect {
virtual bool clip(GHOST_Rect &r) const;
/** Left coordinate of the rectangle */
GHOST_TInt32 m_l;
int32_t m_l;
/** Top coordinate of the rectangle */
GHOST_TInt32 m_t;
int32_t m_t;
/** Right coordinate of the rectangle */
GHOST_TInt32 m_r;
int32_t m_r;
/** Bottom coordinate of the rectangle */
GHOST_TInt32 m_b;
int32_t m_b;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_Rect")
#endif
};
inline GHOST_TInt32 GHOST_Rect::getWidth() const
inline int32_t GHOST_Rect::getWidth() const
{
return m_r - m_l;
}
inline GHOST_TInt32 GHOST_Rect::getHeight() const
inline int32_t GHOST_Rect::getHeight() const
{
return m_b - m_t;
}
inline void GHOST_Rect::set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b)
inline void GHOST_Rect::set(int32_t l, int32_t t, int32_t r, int32_t b)
{
m_l = l;
m_t = t;
@@ -219,7 +216,7 @@ inline void GHOST_Rect::unionRect(const GHOST_Rect &r)
m_b = r.m_b;
}
inline void GHOST_Rect::unionPoint(GHOST_TInt32 x, GHOST_TInt32 y)
inline void GHOST_Rect::unionPoint(int32_t x, int32_t y)
{
if (x < m_l)
m_l = x;
@@ -231,13 +228,10 @@ inline void GHOST_Rect::unionPoint(GHOST_TInt32 x, GHOST_TInt32 y)
m_b = y;
}
inline void GHOST_Rect::wrapPoint(GHOST_TInt32 &x,
GHOST_TInt32 &y,
GHOST_TInt32 ofs,
GHOST_TAxisFlag axis)
inline void GHOST_Rect::wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAxisFlag axis)
{
GHOST_TInt32 w = getWidth();
GHOST_TInt32 h = getHeight();
int32_t w = getWidth();
int32_t h = getHeight();
/* highly unlikely but avoid eternal loop */
if (w - ofs * 2 <= 0 || h - ofs * 2 <= 0) {
@@ -258,7 +252,7 @@ inline void GHOST_Rect::wrapPoint(GHOST_TInt32 &x,
}
}
inline bool GHOST_Rect::isInside(GHOST_TInt32 x, GHOST_TInt32 y) const
inline bool GHOST_Rect::isInside(int32_t x, int32_t y) const
{
return (x >= m_l) && (x <= m_r) && (y >= m_t) && (y <= m_b);
}

View File

@@ -23,6 +23,8 @@
#pragma once
#include <stdint.h>
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
@@ -56,13 +58,6 @@ GHOST_DECLARE_HANDLE(GHOST_EventConsumerHandle);
GHOST_DECLARE_HANDLE(GHOST_ContextHandle);
GHOST_DECLARE_HANDLE(GHOST_XrContextHandle);
typedef char GHOST_TInt8;
typedef unsigned char GHOST_TUns8;
typedef short GHOST_TInt16;
typedef unsigned short GHOST_TUns16;
typedef int GHOST_TInt32;
typedef unsigned int GHOST_TUns32;
typedef struct {
int flags;
} GHOST_GLSettings;
@@ -78,14 +73,6 @@ typedef enum GHOST_DialogOptions {
GHOST_DialogError = (1 << 1),
} GHOST_DialogOptions;
#ifdef _MSC_VER
typedef __int64 GHOST_TInt64;
typedef unsigned __int64 GHOST_TUns64;
#else
typedef long long GHOST_TInt64;
typedef unsigned long long GHOST_TUns64;
#endif
typedef void *GHOST_TUserDataPtr;
typedef enum { GHOST_kFailure = 0, GHOST_kSuccess } GHOST_TSuccess;
@@ -105,7 +92,9 @@ typedef enum {
typedef enum {
GHOST_kTabletAutomatic = 0,
GHOST_kTabletNative,
/* Show as Windows Ink to users to match "Use Windows Ink" in tablet utilities,
* but we use the dependent Windows Pointer API. */
GHOST_kTabletWinPointer,
GHOST_kTabletWintab,
} GHOST_TTabletAPI;
@@ -168,7 +157,7 @@ typedef enum {
GHOST_kButtonMaskRight,
GHOST_kButtonMaskButton4,
GHOST_kButtonMaskButton5,
/* Trackballs and programmable buttons */
/* Trackballs and programmable buttons. */
GHOST_kButtonMaskButton6,
GHOST_kButtonMaskButton7,
GHOST_kButtonNumMasks
@@ -177,15 +166,15 @@ typedef enum {
typedef enum {
GHOST_kEventUnknown = 0,
GHOST_kEventCursorMove, /// Mouse move event
GHOST_kEventButtonDown, /// Mouse button event
GHOST_kEventButtonUp, /// Mouse button event
GHOST_kEventWheel, /// Mouse wheel event
GHOST_kEventTrackpad, /// Trackpad event
GHOST_kEventCursorMove, /* Mouse move event. */
GHOST_kEventButtonDown, /* Mouse button event. */
GHOST_kEventButtonUp, /* Mouse button event. */
GHOST_kEventWheel, /* Mouse wheel event. */
GHOST_kEventTrackpad, /* Trackpad event. */
#ifdef WITH_INPUT_NDOF
GHOST_kEventNDOFMotion, /// N degree of freedom device motion event
GHOST_kEventNDOFButton, /// N degree of freedom device button event
GHOST_kEventNDOFMotion, /* N degree of freedom device motion event. */
GHOST_kEventNDOFButton, /* N degree of freedom device button event. */
#endif
GHOST_kEventKeyDown,
@@ -207,8 +196,8 @@ typedef enum {
GHOST_kEventDraggingExited,
GHOST_kEventDraggingDropDone,
GHOST_kEventOpenMainFile, // Needed for Cocoa to open double-clicked .blend file at startup
GHOST_kEventNativeResolutionChange, // Needed for Cocoa when window moves to other display
GHOST_kEventOpenMainFile, /* Needed for Cocoa to open double-clicked .blend file at startup. */
GHOST_kEventNativeResolutionChange, /* Needed for Cocoa when window moves to other display. */
GHOST_kEventTimer,
@@ -281,7 +270,7 @@ typedef enum {
GHOST_kKeyPeriod = '.',
GHOST_kKeySlash = '/',
// Number keys
/* Number keys. */
GHOST_kKey0 = '0',
GHOST_kKey1,
GHOST_kKey2,
@@ -296,7 +285,7 @@ typedef enum {
GHOST_kKeySemicolon = ';',
GHOST_kKeyEqual = '=',
// Character keys
/* Character keys. */
GHOST_kKeyA = 'A',
GHOST_kKeyB,
GHOST_kKeyC,
@@ -335,9 +324,9 @@ typedef enum {
GHOST_kKeyRightControl,
GHOST_kKeyLeftAlt,
GHOST_kKeyRightAlt,
GHOST_kKeyOS, // Command key on Apple, Windows key(s) on Windows
GHOST_kKeyGrLess, // German PC only!
GHOST_kKeyApp, /* Also known as menu key. */
GHOST_kKeyOS, /* Command key on Apple, Windows key(s) on Windows. */
GHOST_kKeyGrLess, /* German PC only! */
GHOST_kKeyApp, /* Also known as menu key. */
GHOST_kKeyCapsLock,
GHOST_kKeyNumLock,
@@ -358,7 +347,7 @@ typedef enum {
GHOST_kKeyUpPage,
GHOST_kKeyDownPage,
// Numpad keys
/* Numpad keys. */
GHOST_kKeyNumpad0,
GHOST_kKeyNumpad1,
GHOST_kKeyNumpad2,
@@ -376,7 +365,7 @@ typedef enum {
GHOST_kKeyNumpadAsterisk,
GHOST_kKeyNumpadSlash,
// Function keys
/* Function keys. */
GHOST_kKeyF1,
GHOST_kKeyF2,
GHOST_kKeyF3,
@@ -402,7 +391,7 @@ typedef enum {
GHOST_kKeyF23,
GHOST_kKeyF24,
// Multimedia keypad buttons
/* Multimedia keypad buttons. */
GHOST_kKeyMediaPlay,
GHOST_kKeyMediaStop,
GHOST_kKeyMediaFirst,
@@ -434,9 +423,9 @@ typedef void *GHOST_TEventDataPtr;
typedef struct {
/** The x-coordinate of the cursor position. */
GHOST_TInt32 x;
int32_t x;
/** The y-coordinate of the cursor position. */
GHOST_TInt32 y;
int32_t y;
/** Associated tablet data. */
GHOST_TabletData tablet;
} GHOST_TEventCursorData;
@@ -450,7 +439,7 @@ typedef struct {
typedef struct {
/** Displacement of a mouse wheel. */
GHOST_TInt32 z;
int32_t z;
} GHOST_TEventWheelData;
typedef enum {
@@ -466,29 +455,29 @@ typedef struct {
/** The event subtype */
GHOST_TTrackpadEventSubTypes subtype;
/** The x-location of the trackpad event */
GHOST_TInt32 x;
int32_t x;
/** The y-location of the trackpad event */
GHOST_TInt32 y;
int32_t y;
/** The x-delta or value of the trackpad event */
GHOST_TInt32 deltaX;
int32_t deltaX;
/** The y-delta (currently only for scroll subtype) of the trackpad event */
GHOST_TInt32 deltaY;
int32_t deltaY;
/** The delta is inverted from the device due to system preferences. */
char isDirectionInverted;
} GHOST_TEventTrackpadData;
typedef enum {
GHOST_kDragnDropTypeUnknown = 0,
GHOST_kDragnDropTypeFilenames, /*Array of strings representing file names (full path) */
GHOST_kDragnDropTypeString, /* Unformatted text UTF-8 string */
GHOST_kDragnDropTypeBitmap /*Bitmap image data */
GHOST_kDragnDropTypeFilenames, /* Array of strings representing file names (full path). */
GHOST_kDragnDropTypeString, /* Unformatted text UTF-8 string. */
GHOST_kDragnDropTypeBitmap /* Bitmap image data. */
} GHOST_TDragnDropTypes;
typedef struct {
/** The x-coordinate of the cursor position. */
GHOST_TInt32 x;
int32_t x;
/** The y-coordinate of the cursor position. */
GHOST_TInt32 y;
int32_t y;
/** The dropped item type */
GHOST_TDragnDropTypes dataType;
/** The "dropped content" */
@@ -513,7 +502,7 @@ typedef struct {
typedef struct {
int count;
GHOST_TUns8 **strings;
uint8_t **strings;
} GHOST_TStringArray;
typedef enum {
@@ -527,18 +516,23 @@ typedef enum {
#ifdef WITH_INPUT_NDOF
typedef struct {
/** N-degree of freedom device data v3 [GSoC 2010] */
// Each component normally ranges from -1 to +1, but can exceed that.
// These use blender standard view coordinates, with positive rotations being CCW about the axis.
float tx, ty, tz; // translation
float rx, ry, rz; // rotation:
// axis = (rx,ry,rz).normalized
// amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg]
float dt; // time since previous NDOF Motion event
GHOST_TProgress progress; // Starting, InProgress or Finishing (for modal handlers)
/* Each component normally ranges from -1 to +1, but can exceed that.
* These use blender standard view coordinates,
* with positive rotations being CCW about the axis. */
/* translation: */
float tx, ty, tz;
/* rotation:
* - `axis = (rx,ry,rz).normalized`
* - `amount = (rx,ry,rz).magnitude` [in revolutions, 1.0 = 360 deg]. */
float rx, ry, rz;
/** Time since previous NDOF Motion event */
float dt;
/** Starting, #GHOST_kInProgress or #GHOST_kFinishing (for modal handlers) */
GHOST_TProgress progress;
} GHOST_TEventNDOFMotionData;
typedef enum { GHOST_kPress, GHOST_kRelease } GHOST_TButtonAction;
// good for mouse or other buttons too, hmmm?
/* Good for mouse or other buttons too, hmmm? */
typedef struct {
GHOST_TButtonAction action;
@@ -561,7 +555,7 @@ typedef struct {
*/
/** The ascii code for the key event ('\0' if none). */
char ascii;
/** The unicode character. if the length is 6, not NULL terminated if all 6 are set */
/** The unicode character. if the length is 6, not NULL terminated if all 6 are set. */
char utf8_buf[6];
/** Generated by auto-repeat. */
@@ -580,13 +574,13 @@ typedef enum {
typedef struct {
/** Number of pixels on a line. */
GHOST_TUns32 xPixels;
uint32_t xPixels;
/** Number of lines. */
GHOST_TUns32 yPixels;
uint32_t yPixels;
/** Number of bits per pixel. */
GHOST_TUns32 bpp;
uint32_t bpp;
/** Refresh rate (in Hertz). */
GHOST_TUns32 frequency;
uint32_t frequency;
} GHOST_DisplaySetting;
#ifdef _WIN32
@@ -594,7 +588,8 @@ typedef void *GHOST_TEmbedderWindowID;
#endif // _WIN32
#ifndef _WIN32
// I can't use "Window" from "<X11/Xlib.h>" because it conflits with Window defined in winlay.h
/* I can't use "Window" from `X11/Xlib.h`
* because it conflicts with Window defined in `winlay.h`. */
typedef int GHOST_TEmbedderWindowID;
#endif // _WIN32
@@ -605,10 +600,10 @@ typedef int GHOST_TEmbedderWindowID;
*/
#ifdef __cplusplus
class GHOST_ITimerTask;
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, GHOST_TUns64 time);
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, uint64_t time);
#else
struct GHOST_TimerTaskHandle__;
typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, GHOST_TUns64 time);
typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_t time);
#endif
#ifdef WITH_XR_OPENXR
@@ -642,8 +637,10 @@ typedef void *(*GHOST_XrGraphicsContextBindFn)(void);
typedef void (*GHOST_XrGraphicsContextUnbindFn)(GHOST_ContextHandle graphics_context);
typedef void (*GHOST_XrDrawViewFn)(const struct GHOST_XrDrawViewInfo *draw_view, void *customdata);
/* An array of GHOST_TXrGraphicsBinding items defining the candidate bindings to use. The first
* available candidate will be chosen, so order defines priority. */
/**
* An array of #GHOST_TXrGraphicsBinding items defining the candidate bindings to use.
* The first available candidate will be chosen, so order defines priority.
*/
typedef const GHOST_TXrGraphicsBinding *GHOST_XrGraphicsBindingCandidates;
typedef struct {
@@ -684,7 +681,7 @@ typedef struct GHOST_XrDrawViewInfo {
float angle_up, angle_down;
} fov;
/** Set if the buffer should be submitted with a srgb transfer applied. */
/** Set if the buffer should be submitted with a SRGB transfer applied. */
char expects_srgb_buffer;
} GHOST_XrDrawViewInfo;
@@ -714,7 +711,7 @@ typedef enum GHOST_XrActionType {
typedef struct GHOST_XrActionInfo {
const char *name;
GHOST_XrActionType type;
GHOST_TUns32 count_subaction_paths;
uint32_t count_subaction_paths;
const char **subaction_paths;
/** States for each subaction path. */
void *states;
@@ -725,7 +722,7 @@ typedef struct GHOST_XrActionInfo {
typedef struct GHOST_XrActionSpaceInfo {
const char *action_name;
GHOST_TUns32 count_subaction_paths;
uint32_t count_subaction_paths;
const char **subaction_paths;
/** Poses for each subaction path. */
const GHOST_XrPose *poses;
@@ -733,14 +730,14 @@ typedef struct GHOST_XrActionSpaceInfo {
typedef struct GHOST_XrActionBindingInfo {
const char *action_name;
GHOST_TUns32 count_interaction_paths;
/** Interaction path: User (subaction) path + component path. */
uint32_t count_interaction_paths;
/** Interaction path: User (sub-action) path + component path. */
const char **interaction_paths;
} GHOST_XrActionBindingInfo;
typedef struct GHOST_XrActionProfileInfo {
const char *profile_path;
GHOST_TUns32 count_bindings;
uint32_t count_bindings;
const GHOST_XrActionBindingInfo *bindings;
} GHOST_XrActionProfileInfo;

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