1
1

Compare commits

...

1101 Commits

Author SHA1 Message Date
c56ef6fd89 Merge remote-tracking branch 'origin/master' into lineart-bvh 2021-07-04 13:25:58 +08:00
442f269a72 Merge remote-tracking branch 'origin/master' into lineart-bvh 2021-07-04 13:23:52 +08: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
87dae08dd3 LineAer: benchmark 2021-06-23 21:26:10 +08:00
6521f0cbc6 Merge remote-tracking branch 'origin/master' into lineart-bvh 2021-06-23 20:13:39 +08:00
1e816bf837 LineArt: Move type rejection before visibility check 2021-06-22 23:03:53 +08:00
f4ebf2133b LineArt: global look up list for bvh 2021-06-22 20:57:31 +08:00
ee7e06d9b2 Merge remote-tracking branch 'origin/master' into lineart-bvh 2021-06-22 20:14:25 +08:00
1913b4f670 LineArt: Use own isec function 2021-06-21 20:42:12 +08:00
0cc39456c4 Merge remote-tracking branch 'origin/master' into lineart-bvh 2021-06-21 19:57:54 +08:00
73f4bebeff LineArt: Working BVH intersection. 2021-06-16 22:07:44 +08:00
f8230df553 LineArt: BVH reduction 2021-06-15 17:23:37 +08:00
9c2c3e1dd1 Merge branch 'temp-lineart-contained' into lineart-bvh 2021-06-15 16:51:16 +08:00
c3f07d5c6a LineArt: cached ui? 2021-06-15 16:34:41 +08:00
481ff6e7f1 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-15 13:42:47 +08:00
2c4d682edd LineArt: First run cache bug. 2021-06-15 13:38:41 +08:00
9927e833f3 Lineart: Clean up cache patch. 2021-06-14 20:46:35 +08:00
b02b478bb7 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-14 14:45:35 +08:00
0778a469f5 LineArt: Take care of empty duplicollection. 2021-06-11 17:54:14 +08:00
4878f77d58 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-11 15:09:27 +08:00
5e78be3ff8 LineArt: Light contour type. 2021-06-10 22:36:39 +08:00
ca2c6634d5 LineArt: Change edge flag to 16 bits. 2021-06-10 20:53:27 +08:00
e1041b176a Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-10 20:27:55 +08:00
e0a800d6bd LineArt: Add camera marker check. 2021-06-10 00:13:43 +08:00
bc06c08212 Cleanup: Remove useless comment. 2021-06-09 17:36:35 +08:00
10f0d4c6e7 LineArt: Use BKE_object_boundbox_get() instead of mesh only. 2021-06-09 17:33:20 +08:00
a170716208 LineArt: Bound box visibility check when loading 2021-06-09 14:38:30 +08:00
8fa34714ae Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-09 12:41:23 +08:00
9d7466739c Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-08 17:25:18 +08:00
d9c3736950 Cleanup: Comments and unused var. 2021-06-08 12:47:09 +08:00
153828b30d LineArt: Move Mesh->BMesh conversion to worker. 2021-06-07 22:48:32 +08:00
852d53a677 LineArt: Remove fixed overscan in discard function. 2021-06-07 21:14:01 +08:00
31608aab54 LineArt: Adjustable overscan. 2021-06-07 21:03:58 +08:00
f06fa3797b LineArt: Shifting fix for different camera fitting 2021-06-07 20:00:46 +08:00
7591e2807d Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-07 18:42:23 +08:00
90ce858ab6 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-05 23:53:05 +08:00
03599c6dca Lineart: Fixed overscan to 0.1 2021-06-05 23:44:21 +08:00
b44eba1c39 LineArt: Fix edge clipping index error. 2021-06-05 23:04:09 +08:00
b519f95b9f LineArt: Option to offset strokes to custom camera 2021-06-03 20:34:31 +08:00
79c2835397 LineArt: update depsgraph for source_camera. 2021-06-03 20:14:54 +08:00
0cffce3258 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-03 20:13:46 +08:00
6ff2853509 LineArt: Custom camera working correctly. 2021-06-02 20:50:33 +08:00
6d644c587b LineArt: Use NOTE instead of FIXME. 2021-06-02 19:56:26 +08:00
de7563c91a LineArt: Better tolerance for faces that are perpendicular to view vector.
This is due to cam->obmat precision issue, where it affects view vector precision.
2021-06-02 19:39:16 +08:00
8186602fec LineArt: Camera selection. 2021-06-02 19:37:54 +08:00
87bae57cdc Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-02 16:02:19 +08:00
9b420cfef3 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-01 21:36:02 +08:00
6e21a40284 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-28 19:55:22 +08:00
423dee4202 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-26 23:32:06 +08:00
7f20c4c885 LineArt: Cleaning up edge list names. 2021-05-25 20:09:11 +08:00
ea48e3bdf3 LineArt: Cleaning up naming convensions. 2021-05-25 19:38:02 +08:00
18e348ded3 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-25 19:18:28 +08:00
cb9504187a LineArt: Change chain_smooth_tolerance default to 0. 2021-05-25 13:02:16 +08:00
c4e0c13604 LineArt: Allow intersection in object selection mode. 2021-05-24 21:56:19 +08:00
17a7b942e1 GPencil: Fix minor stuff in obj_add 2021-05-24 21:39:53 +08:00
e180ed7ee5 GPencil: Use default false for use_lights option. 2021-05-24 16:00:48 +08:00
b2e87e4f77 GPencil: Add line art use_lights option 2021-05-24 15:56:44 +08:00
60a32b8d4e Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-24 15:29:30 +08:00
3b8031e1d6 Cleanup: Use int16_t instead of short. 2021-05-24 14:47:50 +08:00
30d76f3868 Cleanup: List argument renaming. 2021-05-24 14:38:00 +08:00
8d751d48e1 Cleanup: Naming fixes in obj load patch. 2021-05-24 14:26:18 +08:00
b622b2caeb LineArt: Use 2 way look up for global triangle index.
By Falk David
2021-05-22 20:44:50 +08:00
072067f546 LineArt: Make consistent with master typo fix. 2021-05-22 20:33:40 +08:00
d3da4c695e Fix T88464: Incorrect baking with camera markers. 2021-05-22 20:33:27 +08:00
1931f7a7c1 Cleanup: Fix naming changes. 2021-05-22 19:41:36 +08:00
cadd0dacf0 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-22 19:23:11 +08:00
b7871afad0 LineArt: BVH compiler switches. 2021-05-22 17:28:16 +08:00
6624700725 LineArt: Use BVH for intersection calculation. 2021-05-22 17:16:33 +08:00
3507916f62 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-22 14:25:37 +08:00
f6b4d81933 Fix T88362: Lineart countour rendering error 2021-05-18 22:39:49 +08:00
f3c7da0911 LineArt: Fix API Change. 2021-05-18 17:41:41 +08:00
5fcc83a49f Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-18 15:44:04 +08:00
dc8ebd698b Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-15 16:30:40 +08:00
5860d4e240 LineArt: Use array instead of array for ba->linked_edge 2021-05-14 19:15:48 +08:00
be91ecbca3 LineArt: Toggle duplicated edge for types. 2021-05-13 14:23:23 +08:00
13a3dd4be4 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-13 13:33:05 +08:00
ba96e6aa71 LineArt: Option for toggling chaining modes.
Allows switching between image-space and
geometry-space chainin.
2021-05-12 19:41:53 +08:00
099daebdbf Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-12 10:15:37 +08:00
c33d9de716 Cleanup: Use a helper function for repetitive code
Retrieving data from the component can be done in a separate function
to save some repetition.
2021-05-12 10:14:59 +08:00
b0e21a37e4 Functions: Add materialize methods for generic mutable virtual array
Similar to how `GVArray_For_VArray` implements `materialize_impl` to
forward the work to its non-generic virtual array, we can do the same
thing for the mutable version, `GVMutableArray_For_VMutableArray`.

This commit should have no visible changes, since as far as I can tell
the only user of this class does not implement special materialize
methods anyway.
2021-05-12 10:14:59 +08:00
Pablo Dobarro
a95e2eb5b1 Fix T82155: Fade inactive geometry overlay not working with instanced geometry
This enables the overlay for instanced geometry.

After this change, objects that are an instance of the current active
object (which are also being modified in the current active mode) won't
fade, which is different from the previous behavior.

Reviewed By: fclem

Maniphest Tasks: T82155

Differential Revision: https://developer.blender.org/D9362
2021-05-12 10:14:59 +08:00
dc30002cfd Fix T88060: Expand freezing when deleting a Face Set with multiple loose parts
When checking if the mesh has only one Face Set only the current active
component for expand needs to be checked. Otherwhise other components
that won't be modified by Expand that contain other IDs will be taken
into account, making the Face Set deletion go into an infinite loop.

Reviewed By: JacquesLucke

Maniphest Tasks: T88060

Differential Revision: https://developer.blender.org/D11169
2021-05-12 10:14:59 +08:00
300272e8bd Fix T88180: Enable HQ normal workaround for RX 580X cards.
This needs to be backported to 2.83.
2021-05-12 10:14:59 +08:00
367e309fe8 GPencil: Remove B key to create Blank Keyframe in Drawing mode
We have the `I` menu for that. This is part of the old code.
2021-05-12 10:14:59 +08:00
491ee6f15a GPencil: Rename prop dilate_pixels to dilate
Better avoid units in name.
2021-05-12 10:14:59 +08:00
Pratik Borhade
291094b06f Fix T54339: Shapekey Max value doesn't clamp existing value
Update the "current value" of the Shape Key blend amount when value is
not within the min/max range. New function `rna_ShapeKey_update_minmax`
used to update and clamp the current value.

Reviewed By: mano-wii, lichtwerk, #animation_rigging, sybren

Maniphest Tasks: T54339

Differential Revision: https://developer.blender.org/D11071
2021-05-12 10:14:59 +08:00
aec9094530 Fix T87764: Mem-leak during viewport rendering.
When a scene uses cryptomatte the viewport rendering would lead to a
memory leak. The reason was that all image renders (viewport+final)
activated cryptomatte. But is only used for final rendering.

This patch only activates cryptomatte when doing final rendering.
2021-05-12 10:14:59 +08:00
bef38364e8 Animation: move Cycle-Aware Keying to the Keying popover.
The Cycle-Aware Keying option was added in 2.8 and is used
to allow keyframing over cyclic F-Curves without disturbing
the cycle (e.g. overwriting an end keyframe updates both ends).

This effect is not limited to auto keyframing and is applied
to any key insertion, but when the popovers were rearranged
it was put in the Auto-Keyframing related one for some reason.

This is misleading, especially since because of that the
option is incorrectly greyed out when auto keyframing is
disabled, so move it to the generic Keyframing popover.

Differential Revision: https://developer.blender.org/D11213
2021-05-12 10:14:58 +08:00
Severin
2741f3fb2f Fix warning on Apple Clang, missing override specifier
Was giving a warning:
```
BKE_spline.hh:293:35: warning: 'interpolate_to_evaluated_points' overrides a
member function but is not marked 'override' [-Winconsistent-missing-override]
```
2021-05-12 10:14:58 +08:00
4395d7eb27 Fix T88145: Dynamic Paint initial color using vertex color not working as expected
Mistake in {rBe48c4d73d378}.

Was using the vertex index as a lookup for the loop color (instead of
the loop index).
(Issue was not present in original D1429 btw).

Maniphest Tasks: T88145

Differential Revision: https://developer.blender.org/D11212
2021-05-12 10:14:58 +08:00
6afe643435 Compositor: Add vars and methods for easier image looping
These variables and methods should make it easier to loop through buffers elements/pixels. They take into account single element buffers.
Single element buffers can be used for set operations to reduce memory usage.

Usage example: P2078

Reviewed By: #compositing, jbakker

Differential Revision: https://developer.blender.org/D11015
2021-05-12 10:14:58 +08:00
b97d5c388d Cleanup: too small loop variable type
Clang-Tidy: bugprone-too-small-loop-variable
2021-05-12 10:14:58 +08:00
c9f37f50dd Functions: support materialize virtual array to initialized span 2021-05-12 10:14:58 +08:00
de8a32352a Cleanup: spelling 2021-05-12 10:14:58 +08:00
5e712c46cd Cleanup: unused variable warning 2021-05-12 10:14:58 +08:00
c2c7d3573c Cleanup: Remove double import in previous commit. 2021-05-12 10:14:58 +08:00
aee9176996 Enable CLog for GPU test cases. 2021-05-12 10:14:58 +08:00
50c9d4f8aa Cleanup: correct/clarify PlayAnim comments 2021-05-12 10:14:58 +08:00
4c706e90f9 LineArt: Floating edge chaining option 2021-05-10 13:47:38 +08:00
df990e78fa LineArt: better ui logic for crease threshold. 2021-05-10 11:49:20 +08:00
a5b3496785 LineArt: Filtering feature line using face mark. 2021-05-10 11:38:17 +08:00
c6f8567f84 LineArt: Fix LRT_ITER_ALL_LINES_BEGIN.
This handles when the first line list being empty.
2021-05-10 10:59:38 +08:00
146cf1db3f Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-10 09:10:31 +08:00
b4b2f638e9 LineArt: Working intersection filtering. 2021-05-09 13:17:03 +08:00
50a104d2be LineArt: intersection mask ui and code. 2021-05-09 11:12:21 +08:00
2fc5af5b19 LineArt: show full options in first modifier. 2021-05-09 10:17:59 +08:00
213f704b76 LineArt: Data for intersection_flag 2021-05-09 09:55:10 +08:00
d4bdf9a348 LineArt: Clipping handling multi type edges. 2021-05-09 09:11:39 +08:00
e8fc0697de LineArt: Fix text in object_add.c 2021-05-09 08:26:52 +08:00
a5b5775239 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-09 08:23:30 +08:00
477fe55785 LineArt: Use enum for stroke_depth_order.
This is for gpencil object adding.
2021-05-08 09:47:55 +08:00
670342eafd Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-08 09:22:25 +08:00
29bb98efa6 LineArt; intersection flag variables. 2021-05-08 09:15:27 +08:00
6810d031da LineArt: Fix merge conflicts. 2021-05-06 18:01:07 +08:00
5db821da04 LineArt: Smoothing chains before angle splitting. 2021-05-06 18:00:45 +08:00
8658ae92ed LineArt: In-front UI hints. 2021-05-06 11:34:36 +08:00
43f5ae0cea LineArt: Floating edge type. 2021-05-06 11:00:46 +08:00
e7da22ed8a Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-06 09:53:42 +08:00
246345ba03 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-01 16:13:06 +08:00
948e4e55dd LineArt: UI For occlusion effectiveness. 2021-05-01 16:12:47 +08:00
bff21b191f LineArt: Ignore triangle when it's ineffective. 2021-05-01 16:12:47 +08:00
87a0494313 LineArt: Occlusion effectiveness in material. 2021-05-01 16:12:47 +08:00
2d874aa34a Cleanup: compiler warnings 2021-05-01 16:12:47 +08:00
840ea5195d Revert "Fix crash running constraint, modifier, fx from missing NULL check"
This reverts commit f4d5a69cf8.

This causes bpy.ops.object.modifier_apply.poll() to fail as
well as modifier binding operators (breaking tests).
2021-05-01 16:12:47 +08:00
d3464315f0 BLI: support removing Map elements during iteration
While it was technically safe to call Map.remove while iterating over
a map, it wasn't really designed to work. Also it wasn't very efficient,
because to remove the element, the map would have to search it
again. Now it is possible to remove an element given an iterator
into the map. It is safe to remove the element while iterating over
the map. Obviously, the removed element must not be accessed
anymore after it has been removed.
2021-05-01 16:12:47 +08:00
6fd0c7a70d BLI: add a common base class for Map iterators
This is useful for an upcoming commit that allows removing
an element based on an iterator.
2021-05-01 16:12:47 +08:00
c0aef3541a Cleanup: Rename #if GPU_USE_PY_REFERENCES to #ifndef GPU_NO_USE_PY_REFERENCES
This is safer for incremental build.

And there was already a macro `GPU_USE_PY_REFERENCES` used elsewhere.
2021-05-01 16:12:47 +08:00
0c7a99d6ec Fix accidental lines removed in the last commit 2021-05-01 16:12:47 +08:00
29c5231fd4 Fix gross errors in previous commit 2021-05-01 16:12:47 +08:00
00ecb38225 Documentation: Replace the bgl API in the gpu module exemples 2021-05-01 16:12:47 +08:00
4b355683ee Python GPU: Add new methods to port the code templates in the manual
This commit adds a new API tha allow to replace the bgl API in the exemples on:
https://docs.blender.org/api/current/gpu.html

**Overview (New API):**
```
gpu.state:      active_framebuffer_get
GPUFramebuffer: read_color
GPUOffscreen:   texture_color
```

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11031
2021-05-01 16:12:47 +08:00
Germano Cavalcante
1376262d87 Python GPU: Add reference of PyObject GPU object to the GPU object itself
Instead of creating different python wrappers for the same GPU object,
return the same `PyObject` created earlier.

This also allows for more secure access to existing GPU objects.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11044
2021-05-01 16:12:47 +08:00
Henrik Dick
3afcf77c91 Fix T85470: Simple deform modifier causes artifacts at low angles
The formula used to compute the bend did subtraction of two big numbers
to get the position. Changed to find the delta and add that,
by rearranging the formula into a more numerically stable form.

Reviewed By: mano-wii, campbellbarton

Ref D11074
2021-05-01 16:12:47 +08:00
c2c70ddc4f Fix/Workaround T87511: snap gizmo flickers on Ctrl-Drag
Hack to bypass drag events, eventually the gizmo API
should support this use case without hacks.
2021-05-01 16:12:47 +08:00
Charlie Jolly
986cc5c018 Geometry Nodes: Add an "Auto" option for Attribute Convert data type
Currently there is an "Auto" option for the domain, this commit adds a
similar option for "Auto" data type, that uses the data type from the
target attribute or the source attribute (in that order).

Ref T87347

Differential Revision: https://developer.blender.org/D10932
2021-05-01 16:12:46 +08:00
9573d22cf8 Object: rename BKE_object_runtime_free, leave data cleared
Rename BKE_object_runtime_free -> BKE_object_runtime_free_data,
since the runtime pointer is part of the object, only the data is freed.

Leave the data cleared to avoid accidental use,
this is in keeping with other `*_free_data()` functions.
2021-05-01 16:12:46 +08:00
ac989a43b2 Fix: missing return 2021-05-01 16:12:46 +08:00
aed01df79e Fix crash running constraint, modifier, fx from missing NULL check
None of these generic poll functions had NULL pointer checks,
since all operators that use these functions expect a valid constraint,
modifier .. etc. Add the NULL check to the poll function.

Ref D11126

Reviewed By: mont29, Severin
2021-05-01 16:12:46 +08:00
5b110496ff Fix all objects getting selected sometimes when droppping object
If no other object was selected while dragging one in (e.g. from the Outliner
or an object asset from the Asset Browser), all visible objects in the active
view layer would get selected.
Issue was caused by a wrong enum type use.

Mistake in bcdba7c34d.
2021-05-01 16:12:46 +08:00
ab94ee39f1 BLI: improve VectorSet data structure
This adds two new methods:
* `clear` just removes all keys from the vector set.
* `index_of_or_add` returns the index of a key and adds it if has not
  been added before.
2021-05-01 16:12:46 +08:00
dc9d940439 Object: improve on fix for Object.to_mesh() crash T86871
While fa7ddd0f43 fixed the reported issue,
the possibility of reusing runtime data during curve-to-mesh conversion
remained. Instead of treating the bounding-box as a special case,
clear all run-time data for temporary objects.

Ref D11026

Reviewed By: sergey
2021-05-01 16:12:46 +08:00
a9ae8d883f Cleanup: interface_intern.h doc-strings
Also clarify some vague comments & add doxygen section for menu-memory.
2021-05-01 16:12:45 +08:00
984637b240 Cleanup: correct comment 2021-05-01 16:12:45 +08:00
e4c6ae784d Cleanup: comments in BMesh bisect, use doxygen sections 2021-05-01 16:12:45 +08:00
0ee0cd71a2 Cleanup: rename BKE_pose_channel_{verify => ensure}
The term `verify` doesn't fit with what this function does
and is sometimes used to check data is valid or to control validity
checking as with `RNA_define_verify_sdna`.
use more common term `ensure`.
2021-05-01 16:12:44 +08:00
40e18eceab Cleanup: rename BKE_pose_channels_hash_{make => ensure}
Use the term `ensure` since it makes it clear the data is
not manipulated if it already exists.
2021-05-01 16:12:44 +08:00
c9030983dc Cleanup: use early return in edittranslation_exec 2021-05-01 16:12:44 +08:00
96160d1ed4 Cleanup: use const variables 2021-05-01 16:12:44 +08:00
8440fcb4d9 Cleanup: avoid ambiguous parenthesis 2021-05-01 16:12:44 +08:00
864303d80e Cleanup: duplicate break 2021-05-01 16:12:44 +08:00
6672a2e9fa Cleanup: use 'else if' 2021-05-01 16:12:44 +08:00
d2daf6aec1 Cleanup: remove redundant assignments & NULL pointer check 2021-05-01 16:12:44 +08:00
b13da56836 Fix potential buffer overrun in drw_shader_dependencies_get
Logical error let this function to write one past the buffer bounds.
2021-05-01 16:12:44 +08:00
1d6642ab1b Fix missing NULL check in grease-pencil clear strokes 2021-05-01 16:12:44 +08:00
0d8c4ec77f Fix sculpt mask operator crash running without a 3D view
Add missing operator poll, depend on the 3D view for all
sculpt paint/mask operators.
2021-05-01 16:12:44 +08:00
c87ea85012 Fix crash running window operators in background mode 2021-05-01 16:12:44 +08:00
59e68605c2 Fix uninitialized memory use in GLDrawList
GLDrawList::init() used MDI_INDEXED which checks base_index_.
2021-05-01 16:12:44 +08:00
f1a1b58105 Fix uninitialized local-view flag on object creation
Local view return argument to ED_object_add_generic_get_opts
was left uninitialized.
2021-05-01 16:12:44 +08:00
27e32c4ce3 Cleanup: quiet shadow variable warning 2021-05-01 16:12:44 +08:00
219679061b Fix T87317: Cycles XML parsing broken after bugfix for initialization order 2021-05-01 16:12:44 +08:00
0f35979283 Fix: crash when creating GPU texture from image fails 2021-05-01 16:12:44 +08:00
8e5c1225f1 Fix error in Python UI script 2021-05-01 16:12:44 +08:00
Wannes Malfait
cc835bec8a Nodes: Add a callback to check for valid socket type
This adds a callback to bNodeTreeType to check which socket types are
valid for the tree type. Function has been implemented for the normal
tree types, and can be implemented for custom node trees with python,
by adding a `classmethod` to the tree. However, only builtin socket
types are supported.

This is relevant for T87049, but it also has the advantage that it is
now clear which node trees support which sockets. Previously this
was assumed to be known by all developers.

Differential Revision: https://developer.blender.org/D10938
2021-05-01 16:12:44 +08:00
ffcb99e1f1 Geometry Nodes: Add a template utility to mix two attribute values
This is just linear interpolation, but it's nice to have an equivalent
to `mix3` for only two values. It will be used for interpolation of
values between bezier spline control points.
2021-05-01 16:12:44 +08:00
c637fe722c Cleanup: Mismatched array bounds in function declaration 2021-05-01 16:12:44 +08:00
c5b622b773 Cleanup: Remove unecessary variable
The value of this variable was incremented, but never used.
2021-05-01 16:12:44 +08:00
Antonio Vazquez
75b157b36b GPencil: Add "Convert Text to Gpencil"
Currently when you try to convert a Text-object to Grease pencil from the Object-menu or via the operator in some other way, the Text-object is only converted to a Curve.

This commit converts that curve to a Grease pencil object.

Differential Revision: https://developer.blender.org/D11117
2021-05-01 16:12:44 +08:00
1db971a6dd Cleanup: Reduce indentation by returning early 2021-05-01 16:12:44 +08:00
eb105f3fa4 Fix T86335: Knife tool fails on object with zero scaled axis
Use invert_m4_m4_safe_ortho for the knife tool to support
operating on objects with a single zero scaled axis.
2021-05-01 16:12:44 +08:00
Pratik Borhade
1c9e23892b Clean-up: Edit and comments
- Corrected spellings
- Comments added and edited

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10991
2021-05-01 16:12:44 +08:00
ae3c0c8394 Fix T87297: Gpencil - Disable Frames and Start delay when use Factor
After talking with the GP team, we agree in disable these options when the factor is used in Build modifier.
2021-05-01 16:12:44 +08:00
436a5db96a Fix T86799: Boolean crashes duplicating object with "Fast" solver
BMesh intersect could leave invalid items in the selection list,
causing a crash. The list is now cleared since boolean is such a
destructive operation, it's unlikely the selection order would be useful.

Thanks to @lukastoenne for finding the root cause.
2021-05-01 16:12:44 +08:00
b08082434b GPencil: glow fx, add threshold value color mode
This patch adds a threshold value to the glow effect in color mode.
Currently, the threshold is hardcoded to 5%.
You can select a color and specify a higher threshold to include
similar colors in the effect.

Note: depends on D10670

Reviewed By: #grease_pencil, pepeland

Differential Revision: https://developer.blender.org/D10672
2021-05-01 16:12:44 +08:00
Himanshi Kalra
a263fce3b3 Added Operator tests: unsubdivide, shading, vertex connect and mark seam
Added tests for:
* Mark Seam
* Shade flat
* Shade smooth
* Unsubdivide
* Vertex Connect Path
* select nth (Checkered Deselect)

Notes:
1) Shade flat, shade smooth are base test cases (to check mesh doesn't change for real)

Updated blend file: tests/modeling/operators.blend

Reviewed By: zazizizou, mont29

Differential Revision: https://developer.blender.org/D10893
2021-05-01 16:12:44 +08:00
01e984712b Fix T87779: Asymmetric position vertices in circles primitives.
Incrementing a floating point value in a loop resulted in the vertex
locations for circles in primitives being slightly asymmetric.
2021-05-01 16:12:43 +08:00
e76b6d1ae8 Fix build error after recent changes to CPU name detection 2021-05-01 16:12:43 +08:00
43da1288f4 Cleanup: Use BLI_findindex instead of loop 2021-05-01 16:12:43 +08:00
Christian Baars
4bfbe8c70e Fix missing Cycles CPU name on macOS Arm
Differential Revision: https://developer.blender.org/D11061
2021-05-01 16:12:43 +08:00
9a2f8b80c5 Fix T87686: Cycles persistent data not updating correctly with hair 2021-05-01 16:12:43 +08:00
Matteo Falduto
df29a77303 Cleanup: removed unnecessary multiplications in area light importance sampling
Differential Revision: https://developer.blender.org/D11114
2021-05-01 16:12:43 +08:00
9756e41302 Fix macOS arm crash in scaling images with ffmpeg
Ref T78710
2021-05-01 16:12:43 +08:00
ed10ebbe30 Fix ASAN warnings with Cycles OSL 2021-05-01 16:12:43 +08:00
ae8f78d136 Fix: missing AO factor from Cyclest Fast GI panel
The AO distance was already there, but I forgot the factor also has an impact
on this.
2021-05-01 16:12:43 +08:00
a5a2dfdd60 Fix T87808: Connected proportional editing includes hidden geometry
Regression in 21b9231d7f
2021-05-01 16:12:43 +08:00
821671f987 Cleanup: Add float format 2021-05-01 16:12:43 +08:00
Cody Winchester
6b9009315e Gpencil Offset Modifier - Add randomize offset options
This patch adds the Randomize options that exist in the Array modifier to the offset modifier.

Currently the patch uses
```
BLI_findindex(&gpf->strokes, gps);
```
to get the index of the current stroke for making each stroke a different seed value. This is how the noise modifier also gets the stroke seed value and it is noted there as well that this method is slow, and should be fixed in the future with another method of getting the stroke index.
Other methods were explored such as using the total number of points of the stroke, but that makes the randomize options incompatible with other modifiers before it such as Multiple Strokes, Array, Build, and Simplify.

{F9591325}

Differential Revision: https://developer.blender.org/D10171
2021-05-01 16:12:43 +08:00
09e1e5d9bf Function: add method to create shallow copy of virtual array
Creating a shallow copy is sometimes useful to get a unique ptr
for a virtual array when one only has a reference. It shouldn't
be used usually, but sometimes its the fastest way to do correct
ownership handling.
2021-05-01 16:12:43 +08:00
83056fc8c9 Correction to own previous commit: Add missing break
Small mistake in 88400f0c03.
Not having this break would be harmless, but we can avoid some unnecessary work
with it.
2021-05-01 16:12:43 +08:00
854f639de7 LineArt: Conditional ui for adding line art. 2021-05-01 16:12:43 +08:00
37fd106739 LineArt: In front and stroke order when adding. 2021-04-30 22:53:21 +08:00
97ecbdb0aa LineArt: Remove default in-front (from a merge). 2021-04-30 22:32:57 +08:00
2f6eca4af3 LineArt: Fix memory leaking issue in threaded loading. 2021-04-29 22:17:26 +08:00
d184490f0e Lineart: Cache toggle for baking operators. 2021-04-29 21:26:46 +08:00
ff51da43fe LineArt: Cache/Non-cache toggle for modifier stack. 2021-04-29 21:18:41 +08:00
88065c20dc LineArt: UI grey out for cache mode. 2021-04-29 21:04:55 +08:00
781684d0cf Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-04-29 19:37:29 +08:00
6b11df31af LineArt: Fix incorrect fov when sensor fit is not Auto. 2021-04-27 11:26:44 +08:00
dac54c3af8 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-04-27 10:56:09 +08:00
b5dc1def41 LineArt: Offset strokes instead of In Front. 2021-04-26 15:20:43 +08:00
40691f442f Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-04-26 14:02:09 +08:00
3086602f70 LineArt: Global overrides for cached calculation. 2021-04-22 11:45:08 +08:00
89d1fb011a LineArt: Fix cache allocation error. 2021-04-22 11:05:11 +08:00
8f3d40820e LineArt: Fix cache nullptr bug. 2021-04-21 19:23:58 +08:00
4b3fc7bb04 LineArt: Modifier stack cache wip 2021-04-21 18:00:23 +08:00
5c8187ee86 LineArt: Fix crashing when tile triangle count exceeds 100. 2021-04-21 14:40:18 +08:00
d336e4d9b2 LineArt: Use array for ba->linked_triangles. 2021-04-21 13:51:15 +08:00
4e19a32cd8 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-04-21 13:14:31 +08:00
9c665e7980 LineArt: UI Fixes. 2021-04-19 16:54:39 +08:00
e1e7e021b2 LineArt: Partial UI fixes for modifier and object panels. 2021-04-16 21:53:42 +08:00
0247439090 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-04-16 20:34:33 +08:00
cd41b9a9a4 LineArt: Optimized tiling strategy for ortho and perspective cameras. 2021-04-14 15:05:45 +08:00
87e3ea74d9 LineArt: Spreading load for multithread loading of geometry. 2021-04-14 14:27:13 +08:00
3df57fe330 LineArt: Accepts multiple line types for one line. 2021-04-13 11:29:03 +08:00
efab421f9e Revert "LineArt: PointCache for caching chains (code path only)"
This reverts commit f3e4464ef7.
2021-04-13 10:50:48 +08:00
f3e4464ef7 LineArt: PointCache for caching chains (code path only) 2021-04-07 23:01:11 +08:00
731b9ad137 LineArt: Use separate memory pool for chained data. 2021-04-07 20:53:35 +08:00
5201296598 GPencil: Fix opacity ineffective curve influence after fading patch. 2021-04-07 20:51:22 +08:00
d883491e40 GPencil: Fading control for opacity/thickness modifier updated. 2021-04-02 12:58:30 +08:00
0da169a778 LineArt: Fix Compiler warnings 2021-03-30 10:38:00 +08:00
0f65f4829a Lineart: Fix missing edge mark problem. 2021-03-27 19:02:06 +08:00
3557fa6963 LineArt: Remove BINARY_WEIGHTS option. 2021-03-26 19:08:10 +08:00
54271f462f LineArt: Remove chaining settings. 2021-03-23 22:15:44 +08:00
8449cfdca2 LineArt: Properly working threaded geometry loading. 2021-03-23 22:09:57 +08:00
e8a9488173 LineArt: Multithread object iterator problem staging. 2021-03-23 18:26:27 +08:00
dc5f6c0d4d LineArt: Fix threading data assignment. 2021-03-23 13:28:25 +08:00
c0d37c9555 LineArt: Fix slight issues for threading object loading (DG still have problems) 2021-03-23 09:49:06 +08:00
3b5044f3bc LineArt: Multithread object loading. 2021-03-23 09:36:12 +08:00
58c2c3262f Merge branch 'master' into temp-lineart-contained 2021-03-22 17:41:52 +01:00
59570d130b LineArt: Fix compiler error for ob->id.orig_id != _rb->_source_object 2021-03-21 15:45:54 +08:00
f9545276c4 Merge branch 'master' into temp-lineart-contained 2021-03-20 14:08:09 +01:00
4194ac20cd LineArt: Fix blank baking for when source type is object. 2021-03-20 20:55:48 +08:00
77261ecb25 Merge branch 'master' into temp-lineart-contained 2021-03-20 12:39:40 +01:00
7f9720124d LineArt: Fixed source selection for nested-instanced collection. 2021-03-20 18:42:27 +08:00
9db7c3db08 Fix T86730: LineArt: keep contour when there's perpendicular faces. 2021-03-20 13:36:17 +08:00
b36ad7dfed Merge branch 'master' into temp-lineart-contained 2021-03-19 21:02:32 +01:00
2468bc8f1b LineArt: Add missing modifer and sanity checks to bake operator
Previously we could crash because we would not check if the modifier in
question actually was a line art modifier. We also did not query if the
modifier was disabled.
2021-03-19 20:56:18 +01:00
8e36187e51 Merge branch 'master' into temp-lineart-contained 2021-03-19 19:00:59 +01:00
203ffd8dee LineArt: Remove geometry space chaining 2021-03-19 20:55:38 +08:00
4569ae7a60 Revert "LineArt: Binary weights option."
This reverts commit 7b76f9f6b6.

# Conflicts:
#	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
#	source/blender/makesrna/intern/rna_gpencil_modifier.c
2021-03-19 20:31:57 +08:00
8793250074 Revert "LineArt: Remove geometry space chaining and clean up vertex group selection code."
This reverts commit b51554bb93.

# Conflicts:
#	source/blender/makesdna/DNA_gpencil_modifier_defaults.h
2021-03-19 20:28:39 +08:00
6276a04d7f LineArt: Added back the missing "allow_clipping_boundaries" option. 2021-03-19 18:48:05 +08:00
8c1bba2fc0 LineArt: Modifier defaults optimization. 2021-03-19 18:47:40 +08:00
ba8e5de378 LineArt: Weight threshold conditional display. 2021-03-19 11:50:11 +08:00
7b76f9f6b6 LineArt: Binary weights option. 2021-03-19 09:11:14 +08:00
b51554bb93 LineArt: Remove geometry space chaining and clean up vertex group selection code. 2021-03-19 09:01:43 +08:00
e51c54478c Merge branch 'master' into temp-lineart-contained 2021-03-18 14:22:49 +01:00
86f404a889 Merge branch 'master' into temp-lineart-contained 2021-03-18 13:29:41 +01:00
6704b49b49 LineArt: Add back allow_duplication property for instanced objects. 2021-03-18 19:29:47 +08:00
dfa85f8629 LineArt: use resample_length property name. 2021-03-18 19:29:17 +08:00
b052e5bf99 LineArt: Add new frame at 0 after clearing baked strokes. 2021-03-18 19:23:52 +08:00
53018b4ac8 LineArt: Use frame 0 when creating grease pencil object. 2021-03-18 17:48:46 +08:00
eb8cc3f33d LineArt: rename tl,tr to t1,t2 2021-03-18 17:45:49 +08:00
8547bf7eb9 LineArt: Fixed collection usage check for nested cases. 2021-03-18 17:24:55 +08:00
719cd96de5 LineArt: Optimize intersection list skipping. 2021-03-18 10:43:26 +08:00
9f52862a1b LineArt: Temp solution for not including lines that are outside selected source. 2021-03-18 10:01:18 +08:00
c1f328753b LineArt: Fix naming error in lineart_cpu.c 2021-03-18 09:44:19 +08:00
4d21182f86 Cleanup LineartLine -> LineartEdge 2021-03-17 14:28:12 +01:00
17f3369f81 LineArt: Fix transparenct mask in cutting function. 2021-03-17 17:55:39 +08:00
59346789fe LineArt:Fix transparency flag error during cutting and chaining. 2021-03-17 17:43:29 +08:00
cdc5e108e5 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-17 15:05:49 +08:00
f8a91f9aaa LineArt: Remove "Render" in structure names. 2021-03-17 15:04:51 +08:00
3f78097a6b LineArt: better explaination in lineart_line_cut() 2021-03-17 12:34:23 +08:00
ca3487007c Merge branch 'master' into temp-lineart-contained 2021-03-16 20:04:02 +01:00
49e839bb46 Cleanup comments from older merges with master 2021-03-16 18:50:30 +01:00
a11448b74d Update debug flag add date 2021-03-16 18:43:38 +01:00
581202b34f Minor cleanup 2021-03-16 18:37:42 +01:00
930ddd844e Merge branch 'master' into temp-lineart-contained 2021-03-16 18:13:06 +01:00
ccf076d804 Tweak the collection propery tab location 2021-03-16 15:46:28 +01:00
7aaab357bd LineArt modifier UI tweaks. 2021-03-16 14:48:05 +01:00
66404a54aa LineArt: Fix UI for misused remove_doubles and allow_overlapping_edges. 2021-03-16 21:45:44 +08:00
c3ae9a3438 LineArt: fix struct LineartRenderLine *testing[1]; for addressing level issue. 2021-03-16 09:52:24 +08:00
512f385210 LineArt: Fix pointer in struct LineartRenderLine **testing; 2021-03-16 09:45:32 +08:00
31d1e751b5 LineArt: Continue comment cleanups. 2021-03-15 23:46:39 +08:00
9ec3d01b13 LineArt: MOD_lineart_get_bounding_area rename in header. 2021-03-15 23:03:28 +08:00
259ab267ec LineArt: Comment cleanups in lineart_cpu.c and so on. 2021-03-15 22:57:37 +08:00
736455522d Update collection tab with instancing and tweak LineArt name 2021-03-15 12:19:28 +01:00
6e33b474b9 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-15 19:12:11 +08:00
e5a1aefd73 LineArt: chain.c growing comment fixed. 2021-03-15 19:11:42 +08:00
4b2dec18b9 Line Art: Tweak collection tab properties
- Use property split
- Use the same oder as in the outliner
2021-03-14 23:28:20 -04:00
72d70aa88b Line Art: Use correct object source icon in modifier
Also use consistent variable name for a column layout.
2021-03-14 23:24:47 -04:00
952d6882bc Line Art: Remove period after UI description 2021-03-14 23:16:51 -04:00
961316d8ce Line Art: Use consistent scene icon in add menu 2021-03-14 23:15:34 -04:00
f92155e135 Line Art: Close panel in object tab by default 2021-03-14 23:12:07 -04:00
b589940174 LineArt: Added back bounding_area->linked_lines access to fix chaining problem. 2021-03-14 12:50:22 +08:00
fdaa780e4e LineArt: Comment grammar and clarity fixes in lineart_chain.c 2021-03-13 21:27:40 +08:00
af8cc21f91 LineArt: Add back fuzzy chaining option in the UI. 2021-03-13 20:39:09 +08:00
8c94e8e98d LineArt: Comment ending style fix. 2021-03-13 09:49:17 +08:00
a4abf09334 LineArt: Clean up the comments. 2021-03-13 09:43:57 +08:00
489c0fd013 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-13 09:00:37 +08:00
Bastien Montagne
b591919172 CLOG: add support for substring matching.
So that `--log "*undo*"` matches any log identifier containing `undo`.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10647
2021-03-13 08:59:00 +08:00
ad94a235e0 Fix heap buffer overflow appending/linking from a blend file
Add new function `blo_bhead_is_id_valid_type()` to correctly check the
blend file block type.

File block type codes have four bytes, and two of those are only in use
when these blocks contain ID datablocks (like `"OB\0\0"`). However,
there are other types defined in `BLO_blend_defs.h` that have four
bytes, like `TEST`, `ENDB`, etc.

The function `BKE_idtype_idcode_is_valid(short idcode)` was used to
check for ID datablocks while reading a blend file. This only takes a
2-byte parameter, and thus its result is invalid for the 4-byte codes.
For `TEST` blocks, it would actually consider it a `TE` block, which is
a valid identifier for a Texture. This caused the heap buffer overflow,
as the datablock is not a valid ID, and thus the bytes that were
expected to form an ID name actually encode something completely
different.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D10703
2021-03-13 08:59:00 +08:00
2bc444763b Fix T82532: Sculpt fails to redo the first sculpt session stroke
Sculpt undo relied on having a mode-changing undo step to properly
apply changes.

However this isn't the case with startup files or when mixing
global undo steps with sculpt (see T82851, also fixed).

Undo stepping logic follows image_undosys_step_decode_undo.
2021-03-13 08:59:00 +08:00
6a1ea4a63c Fix another crash in LibOverride resync code.
Another case where newly overridden ID (stored in `newid` of its linked
reference) gets immediately deleted in old broken overrides.

Re T86501.
2021-03-13 08:59:00 +08:00
d966a57a22 Fix compiler warning when building Cycles without Embree 2021-03-13 08:59:00 +08:00
7eb9ec5441 Cleanup: fix clang-tidy errors when COM_debug is active. 2021-03-13 08:59:00 +08:00
e45492f859 Cleanup: Compiler warnings with COM_TM_NOTHREAD active. 2021-03-13 08:59:00 +08:00
c9bbd5945c Cleanup: document FileSelectAssetLibraryUID::type
No functional changes.
2021-03-13 08:59:00 +08:00
04e451a79f LibOverride: Add a new operation to Outliner to enforce resync of hierarchies.
This is basically done by ignoring override operations from old override
affecting ID pointer properties, when the new (destination) one is not
NULL.

Fix T86501: New object added to overridden collection doesn't show up in linking file on Resync.

This is more of a work-around actually, since there is no real way to
fix the issue in a fully automated and consistent way, it is caused by
older blender files being saved with 'broken' overrides.

WARNING: This cannot ensure that some purposedly edited/overridden ID
pointer properties won't be lost in the process.
2021-03-13 08:59:00 +08:00
eaa00daa34 Fix first part of T86501: Crash during resync process.
Code would end up freeing some of the newly created overrides, which
were assigned to the matching linked ID's `newid` pointer, accessed
again further down the code.

Note that this is not a normal expected situation, and it won't give a
proper resync result anyway, but it might happen in some complicated
corner cases, and also quite often when dealing with older .blend files.
2021-03-13 08:59:00 +08:00
35ca2a8737 IDRemap: Add option to also remap internal runtime ID pointers.
In some cases (advanced, low-level), we also want to remap pointers like
`ID.newid` or `ID.orig_id`.

Only known case currently is `id_delete`, to avoid leaving potential access to freed memory. See next commit and T86501.
2021-03-13 08:59:00 +08:00
139c4f1398 LibQuery: Add an option to process internal runtime ID pointers.
In some cases (advanced, low-level code) we also want to process ID
pointers like `ID.newid` or `ID.orig_id`.
2021-03-13 08:59:00 +08:00
210909e142 Fix T86455: vertex color baking issue with sculpt vertex colors
Baking to Vertex Colors would always bake to sculpt vertex colors (if
such a layer is present) even if those are not enabled in the
experimental preferences. This would bake without an error but leave the
user without a result to look in the viewport.

Now check if sculpt vertex colors are enabled and only bake to them in
that case.

Maniphest Tasks: T86455

Differential Revision: https://developer.blender.org/D10692
2021-03-13 08:59:00 +08:00
d06caba58f Cleanup: remove workaround for MSVC PyTypeObject declarations
This is no longer needed for MSVC-2017.
2021-03-13 08:59:00 +08:00
1333a3ba5c Cleanup: set the window manager to the updated context on load
While this happened to be corrected by code that runs afterwards,
leaving this in an invalid state could cause problems in the future.
2021-03-13 08:59:00 +08:00
c5c542089c Cleanup: make_source_archive.py minor changes & comments
- Add notes on portability.
- Use encoding argument for all file IO.
- Use integer math to calculate major/minor version, while float
  division should be fine prefer matching Blender.
2021-03-13 08:59:00 +08:00
39cdad0b0c Cleanup: incorrect doxy section title
Also correct typo.
2021-03-13 08:59:00 +08:00
3bb7dffd5c Cleanup: break out of loop early 2021-03-13 08:59:00 +08:00
b9c75c67dd Cleanup: redundant flag check 2021-03-13 08:59:00 +08:00
8b3c5feb31 Cleanup: redundant outliner includes 2021-03-13 08:59:00 +08:00
8042cc9613 Fix else after return and NULL pointer value assignment 2021-03-12 17:07:37 +01:00
89f9f9b4f5 Trigger baking progress bar refresh 2021-03-12 17:01:23 +01:00
23d631a869 LineArt: Add new frames when no frame existed in modifier 2021-03-12 23:01:13 +08:00
37cfe9992d LineArt: Baking flags for UI. 2021-03-12 21:59:57 +08:00
a8b950316f LineArt: Unused variable fix 2021-03-12 21:47:10 +08:00
d40048b01a LineArt: Using object list for baking job 2021-03-12 21:28:02 +08:00
03a94ff42e Lineart: remove TODO in object_ops.c 2021-03-12 19:32:47 +08:00
d123aea358 LineArt: Fix wrong return value for cheking LRT_GPENCIL_IS_BAKING 2021-03-12 19:29:05 +08:00
fbb7036b5b LineArt: change ED_ to MOD_ 2021-03-12 19:23:57 +08:00
4dbbeed050 Remove the remaining WITH_LINEART cmake variables 2021-03-12 11:50:45 +01:00
c4f6859938 LineArt: Fix desctription string ending. 2021-03-12 13:06:20 +08:00
1bdd255793 LineArt: Baking buttons rename. 2021-03-12 12:52:29 +08:00
0d0a90fe38 LineArt: Remove 'hide_viewport' in collection panel so it won't accidentally be deactivated. 2021-03-12 12:52:09 +08:00
49441a3595 LineArt: General cleanups for names and order. 2021-03-12 12:36:04 +08:00
af29a17c32 LineArt: use name lineart_get_bounding_area_deep() to clarify. 2021-03-12 12:29:03 +08:00
2dece71d52 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-12 12:25:16 +08:00
84c653fb76 LineArt: Guard modifiers from depsgraph when baking. 2021-03-12 09:46:55 +08:00
fcafc06829 LineArt: Bake canceling now operative. 2021-03-12 09:24:44 +08:00
ae68912364 LineArt: Bounding area duplicated code removal. 2021-03-12 09:14:05 +08:00
b96c04b53a LineArt: Naming and comments clean up. 2021-03-12 09:09:53 +08:00
c806ce9cdb Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-12 07:05:55 +08:00
4dd037dd20 Merge branch 'master' into temp-lineart-contained 2021-03-11 09:55:10 +01:00
2c329f91fe LineArt: Baking and clearing notifier updated. 2021-03-10 13:46:22 +08:00
0a5cb8d8c9 LineArt: involk/exec fix for operators 2021-03-10 13:19:31 +08:00
d317741149 LineArt: use LRT_ITER_ALL_LINES_NEXT for iteration. 2021-03-10 12:40:05 +08:00
b48f69becc Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-10 08:00:31 +08:00
3f254bb955 Merge branch 'master' into temp-lineart-contained 2021-03-09 15:55:40 +01:00
c61691b954 Merge branch 'master' into temp-lineart-contained
Conflicts:
	release/scripts/addons
	source/tools
2021-03-08 15:49:12 +01:00
dda815dea2 Merge branch 'master' into temp-lineart-contained 2021-03-05 19:20:01 +01:00
4427139c6b LineArt: Progress reporting when baking. 2021-03-05 22:28:05 +08:00
012c8b56ed LineArt: Use job system for baking. 2021-03-05 22:12:43 +08:00
f593a8ae15 Lineart: Re-apply truangulation fix as MOD_TRIANGULATE_QUAD_FIXED 2021-03-05 20:58:59 +08:00
3b82c57132 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-05 19:59:52 +08:00
2c400731bd Merge branch 'master' into temp-lineart-contained 2021-03-01 16:40:55 +01:00
7853aa3060 Merge branch 'temp-lineart-contained' of git.blender.org:blender into temp-lineart-contained 2021-02-25 15:44:50 +01:00
bc9ab19771 Merge branch 'master' into temp-lineart-contained 2021-02-25 15:44:25 +01:00
b6f8608912 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-02-25 18:22:34 +08:00
d4cfa9e752 Merge branch 'master' into temp-lineart-contained
Conflicts:
	release/datafiles/locale
	release/scripts/addons
	release/scripts/addons_contrib
	source/tools
2021-02-24 16:08:08 +01:00
9b04f61c0e LineArt: Remove missing flag in previous commit 2021-02-20 20:06:29 +01:00
fd0a9d0483 LineArt: Remove WITH_LINEAR and merge projects
As Lineart can be considered a grease pencil feature is not logic to have a flag that only adds problems.

Also, the bf_gpencil_lineart has been removed and all code set inside bf_gpencil_modifiers.
2021-02-20 18:06:45 +01:00
874ecabc91 Lineart: Chnage modifier to use new default system
Now all defaults are defined in `DNA_gpencil_modifier_defaults.h`
2021-02-20 16:23:09 +01:00
7bf2108e4b Merge branch 'master' into temp-lineart-contained 2021-02-20 15:37:07 +01:00
43c43b8d48 Lineart: Fix memory leak in lineart_ops.c (Early return caused memory in list not freed). 2021-02-19 10:58:19 +08:00
24fbb449c6 Lineart: Fixed uninitialized variables. 2021-02-19 10:49:44 +08:00
6f9f45aa4b WIP bake buttons
Buggy and naming and settings needs to change probably.
See TODOs in the code
2021-02-15 01:59:03 +01:00
79ef330aad Cleanup: Remove duplicate definition 2021-02-12 18:32:34 +01:00
f564cda079 Cleanup more unused variables and functions 2021-02-12 01:41:58 +01:00
7446f90707 Cleanup various lineart files, add FIXME comments. 2021-02-12 00:13:14 +01:00
e9120950d8 Fix build issues. 2021-02-11 17:06:21 +01:00
0e59d72b04 Merge branch 'master' into temp-lineart-contained 2021-02-11 14:36:02 +01:00
1d3c721b05 Merge branch 'master' into temp-lineart-contained 2021-02-07 18:55:44 +01:00
be65d12707 Merge branch 'master' into temp-lineart-contained 2021-01-25 10:46:26 +01:00
eb65d5fb09 Fix building with and without WITH_LINEART 2021-01-14 21:28:06 +01:00
93e9068372 Merge branch 'lanpr-under-gp' into temp-lineart-contained 2020-12-21 15:43:21 +08:00
c5a59fba58 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-12-21 15:43:03 +08:00
1e18ffdf14 Merge branch 'lanpr-under-gp' into temp-lineart-contained 2020-12-21 15:40:31 +08:00
b30687b2ca LineArt: Proper Use of BMesh operator to remove doubles. 2020-12-21 15:40:12 +08:00
4143d59823 LineArt: Complete UI in the modifier. 2020-12-19 13:57:44 +08:00
1222a08fca Merge remote-tracking branch 'origin/lanpr-under-gp' into temp-lineart-contained
# Conflicts:
#	extern/ceres/README.blender
#	release/scripts/startup/bl_ui/space_userpref.py
#	source/blender/blenkernel/BKE_gpencil_curve.h
#	source/blender/blenkernel/BKE_gpencil_geom.h
#	source/blender/blenkernel/BKE_layer.h
#	source/blender/blenkernel/BKE_screen.h
#	source/blender/blenkernel/intern/gpencil_curve.c
#	source/blender/blenkernel/intern/layer_utils.c
#	source/blender/blenloader/intern/versioning_290.c
#	source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl
#	source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
#	source/blender/editors/gpencil/annotate_paint.c
#	source/blender/editors/gpencil/gpencil_convert.c
#	source/blender/editors/gpencil/gpencil_edit.c
#	source/blender/editors/gpencil/gpencil_intern.h
#	source/blender/editors/gpencil/gpencil_interpolate.c
#	source/blender/editors/gpencil/gpencil_merge.c
#	source/blender/editors/gpencil/gpencil_mesh.c
#	source/blender/editors/gpencil/gpencil_paint.c
#	source/blender/editors/gpencil/gpencil_select.c
#	source/blender/editors/gpencil/gpencil_trace_ops.c
#	source/blender/editors/gpencil/gpencil_utils.c
#	source/blender/editors/interface/interface_panel.c
#	source/blender/editors/physics/physics_pointcache.c
#	source/blender/editors/space_buttons/buttons_context.c
#	source/blender/editors/space_outliner/space_outliner.c
#	source/blender/editors/space_view3d/view3d_placement.c
#	source/blender/makesdna/DNA_userdef_types.h
#	source/blender/makesrna/intern/rna_scene.c
#	source/blender/makesrna/intern/rna_space.c
#	source/blender/python/gpu/gpu_py_shader.c
2020-12-19 12:55:33 +08:00
c2f0ee013b LineArt: Merge changes 2020-12-19 12:47:59 +08:00
4885b649ef Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/blenloader/intern/versioning_290.c
#	source/blender/makesdna/DNA_brush_types.h
#	source/blender/makesdna/DNA_gpencil_modifier_types.h
#	source/blender/makesrna/intern/rna_scene.c
#	source/tools
2020-12-19 12:04:26 +08:00
de9cfde08b LineArt: Ris for New APIs 2020-12-19 12:01:52 +08:00
4a76934ba3 Outliner: Fix memory errors in runtime data
Fix a heap-use-after-free when duplicating outliner editors, and fully
free runtime data when freeing outliner editors.
2020-12-19 12:00:35 +08:00
63ceade783 GPencil: Missing initialization in previous commit 2020-12-19 12:00:35 +08:00
2474b6c789 GPencil: Cleanup clang format 2020-12-19 12:00:35 +08:00
8ff765a036 GPencil: Fix unreported crash in some cases when duplicate a stroke
Some pointers were not initialized.
2020-12-19 12:00:35 +08:00
d598132c96 GPencil: Fix callback parameter list error
In the previous commit the bGPDframe parameter was removed, but this parameter is required to keep the same function signature.
2020-12-19 12:00:35 +08:00
2946762975 Collections: Prevent setting scene collection color tag from rna
It should not be possible to set the scene collection's color tag
through rna. Also adds a missing notifier for setting the collection
color tag from python.
2020-12-19 12:00:35 +08:00
38ddbfa959 UI: Remove remaining uses of old collection icon
After rB452a1c7b3838 there were still a few cases where the old
collection icon was used in the interface. Replace these with the new
filled collection icon.
2020-12-19 12:00:35 +08:00
d4133b2227 GPencil: Fix compiler warning, unused variable 2020-12-19 12:00:35 +08:00
dce2506392 GPencil: Merge GSoC curve edit mode
Differential Revision: https://developer.blender.org/D8660

This patch is the result of the GSoC 2020 "Editing Grease Pencil Strokes
Using Curves" project. It adds a submode to greasepencil edit mode that
allows for the transformation of greasepencil strokes using bezier
curves. More information about the project can be found
here: https://wiki.blender.org/wiki/User:Filedescriptor/GSoC_2020.
2020-12-19 12:00:35 +08:00
53e1e6a98f Cleanup: Make panel type flag names more clear
The overlap with the `Panel` flags that start with "PNL" was quite
confusing because wasn't clear which enum a flag was from. The
new names are a bit longer, but the clarity is worth it.
2020-12-19 12:00:35 +08:00
9e42403aa6 Cleanup: Move PanelType flag from DNA to BKE header
Since this flag isn't saved in files and PanelType itself is defined in
BKE, the flag makes more sense there.
2020-12-19 12:00:35 +08:00
f4bbc84197 GPencil: Remove ID from operators to fix T82597
Instead to use the ID of the object, now the parameter is an Enum with Selected object or New.

If use selected mode, the first grease pencil object selected is used. If none of the selected objects is a grease pencil object, a new object is created.

Small cleanup changes to the original patch.

Differential Revision: https://developer.blender.org/D9529
2020-12-19 12:00:35 +08:00
cdd182d09d LibOverride: Adjust PointCache operators to properly handle overrides.
LibOverrides only support a small sub-set of PointCache features for now
(one cannot add new caches, baking in memory is not supported...).

Part of first step of T82503: support disk cache in liboverrides.
2020-12-19 12:00:35 +08:00
1703e652a0 LibOverride: Do not tag overrides for complete recalc.
This was done as some sort of safety, but should not actually be needed,
and including tags like `ID_RECALC_POINT_CACHE` e.g. makes usage of
point caches impossible with liboverrides (since it would systematically
invalidate all cache on file load).

In theory we should not have to tag anything here in fact, RNA accessors
are supposed to take care of it, but for now we keep the
`ID_RECALC_COPY_ON_WRITE` one.

Part of first step of T82503: support disk cache in liboverrides.
2020-12-19 12:00:35 +08:00
2b838a96b2 LibOverride: Make PointCache RNA properties overridable.
Note that due to convoluted layout of point caches in RNA (active one
also storing list of all available ones), we'll often have the
pointcache overrides rules twice. Should not be a huge problem,
practically speaking.

Part of first step of T82503: support disk cache in liboverrides.
2020-12-19 12:00:35 +08:00
640b732959 Ceres: Update to upstream version 2.0.0
We already were using one of earlier RC of the library, so there is no
expected big changes. Just making the update official, using official
version and stating it in the readme file.
2020-12-19 12:00:35 +08:00
904a2a620a CMake: Extend strict flags cancellation flags
Becomes rather annoying to duplicate them across C/C++ GCC/Clang sets,
almost as if the test should test both C and C++, and to do it for all
compilers.

Solves strict warning in the upstream of Ceres library.
2020-12-19 12:00:35 +08:00
adda1d2b23 Revert "Codesign: Versioning code to support older branches"
This reverts commit 9d172f007e.

Got a second thought and remembered why it was not done in the first place.
The issue here is that the server needs to communicate codesign result back
and that must happen within the new protocol. So if the client talks old
protocol it is possible to receieve data from it, but is not possible to
communicate result back to it.
2020-12-19 12:00:35 +08:00
8f3a7d7f3e Cleanup: use IMB_FTYPE_NONE instead of 0 for imbuf format comparison
Image format code checked the file type against an enum except for
zero which is used when the format can't be detected.

Also add doc-strings to some of the image file type callbacks.
2020-12-19 12:00:35 +08:00
eca13099de Fix building after 2e53b646f6f02ab112e0823b9577ff2e1920faaeq 2020-12-19 12:00:35 +08:00
61f1b9f559 GPencil: Remove "angle_split" from Multiply modifier. 2020-12-19 12:00:35 +08:00
df598a9a5d Object: show preview plane for add-object tool
The orientation & depth settings are used to show the preview plane
that is used when adding the object.
2020-12-19 11:59:52 +08:00
4b1fe6616d Codesign: Versioning code to support older branches
Turns out it is easier to have suboptimal versioning code on the server
side than to deal with branches where changes are to be merged into.
2020-12-19 11:59:52 +08:00
79f94f66cf refactor vec_roll_to_mat3_normalized() for clarity
the function vec_roll_to_mat3_normalized() has a bug as described in T82455. This Differential is only for refactoring the code such that it becomes more clear what the function does and how the bug can be fixed. This differential is supposed to not introduce any functional changes.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9410
2020-12-19 11:59:52 +08:00
Ivan Perevala
b46a90e9a1 UI: Adaptive HDRI preview resolution
HDRI preview should have resolution dependent on dpi, viewport scale and HDRI gizmo size.
This patch uses a LOD to render a more round sphere.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D9382
2020-12-19 11:59:52 +08:00
YimingWu
cfca5dcb39 Adding 3D_POLYLINE_UNIFORM_COLOR to PyGPU shader API
This would allow python script to access `lineWidth` uniform when drawing lines
without using `glLineWidth`.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D9518
2020-12-19 11:59:52 +08:00
Manuel Castilla
a7307edbe1 Fix CalculateStandardDeviationOperation incorrect results for R G B channels
Standard deviation formula wasn't being applied correctly when selecting
R G B cases. Issue is there since Blender 2.64 as it was incorrectly
ported over from the previous compositor.

Reviewed By: Sergey Sharybin, Jeroen Bakker

Differential Revision: https://developer.blender.org/D9384
2020-12-19 11:59:52 +08:00
Jun Mizutani
283aa33605 Add An Opacity Slider to Overlay Wireframe
This patch adds an opacity slider to the wireframe overlay. The previous
wireframe in dense geometry scenes could be too dark and sometimes the
user just wants an impression of the geometry during modelling.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D7622
2020-12-19 11:59:52 +08:00
798749ac71 UI: make add object tool experimental
Some changes here are planned which need feedback from users before
declaring this ready for the next release.
2020-12-19 11:59:52 +08:00
8cc87c4946 BLI_math: add floor_power_of_10, ceil_power_of_10
Add utility functions to get the floor/ceiling of a float value
to the next power of 10.
2020-12-19 11:59:52 +08:00
e7fc0965d6 Cleanup: Remove unecessary logic in panel code
Also use short for panel flag arguments to functions since it matches
the type in DNA, and remove a comment that isn't helpful.
2020-12-19 11:59:52 +08:00
d9b1e6a8c9 Cleanup: Simplify panel activate state function
This commit moves some of the logic around so that the logic in
panel_activate_state is clearly separated by the state being activated.
There are fewer nested and redundant checks, and it's easier to see
the progression of interaction with the panel handler.
2020-12-19 11:59:52 +08:00
282d12663f LineArt: Ris for New APIs 2020-11-15 12:24:23 +08:00
0c0686bd1a Merge branch 'master' into lanpr-under-gp
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	source/blender/blenloader/intern/versioning_290.c
#	source/blender/makesdna/DNA_gpencil_modifier_types.h
#	source/tools
2020-11-15 11:07:21 +08:00
02dd1f110c LineArt: removed unreferenced scene from object_add.c 2020-11-13 16:50:30 +08:00
0c1003c7c8 Merge branch 'lanpr-under-gp' into temp-lineart-contained 2020-11-13 10:43:31 +08:00
87636e93f2 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-13 10:42:44 +08:00
eb2b85de6c LineArt: Revert accidental changes 2020-11-13 10:37:16 +08:00
3dbdf69b58 LineArt: cleanup unnecessary includes. 2020-11-13 10:33:54 +08:00
dba084a659 LineArt: "collection flags"->"Restrictions" 2020-11-13 10:23:17 +08:00
1870205455 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-12 17:34:00 +08:00
dfa4a80e9a LineArt: Remove lineart_share 2020-11-12 17:28:28 +08:00
733c707b16 Merge branch 'lanpr-under-gp' into temp_lineart_contained 2020-11-12 16:13:13 +08:00
3ef840fa2d Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-12 16:12:43 +08:00
7acf84a011 LinrArt: Running line art modifier. 2020-11-12 15:05:08 +08:00
64218999ef LineArt: Cmake stuff migration. 2020-11-12 13:30:34 +08:00
ddd10dbc1b LineArt: Remove modifiers access. 2020-11-12 11:28:17 +08:00
4fffd9273f LineArt: Remove SceneLineArt. 2020-11-12 11:00:14 +08:00
257742dd5d LineArt: Move files to gpencil modifier folder. 2020-11-12 10:38:09 +08:00
72f0947c12 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-11 12:26:56 +08:00
64f573c8b5 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-10 10:50:26 +08:00
351cf10bf2 LineArt: reduce chaining_image_threshold to 0.001 to prevent errorous chaining. 2020-11-10 10:47:41 +08:00
50ff559544 LineArt: Reduce geometry threshold default to 0.01 2020-11-10 10:37:20 +08:00
6b6052713c Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-09 16:27:21 +08:00
a60b3071b5 LineArt: Fix transparency mask lost in angle splitting process 2020-11-09 16:20:47 +08:00
0bed1158e0 LineArt: "Match" checkbox put on top of mask bits. 2020-11-09 16:01:13 +08:00
85899dd8ae Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-07 20:22:34 +08:00
e5310101fa LineArt: Vertex weight transfer index error now fixed. 2020-11-07 20:20:44 +08:00
67852caf0b Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	CMakeLists.txt
#	source/blender/blenloader/intern/readfile.c
#	source/blender/blenloader/intern/writefile.c
2020-11-07 15:07:01 +08:00
22875e3ab0 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-05 10:43:51 +08:00
eade6d3ae5 LineArt: Added scene line art option. 2020-11-05 10:43:18 +08:00
ac90022760 LineArt: do not restrict GP object selectable 2020-11-05 10:10:36 +08:00
6d3ce4cf07 LineArt: chaining occlusion info assignment to last possible vert. 2020-11-05 10:09:10 +08:00
05089352b8 LineArt: Use array for lineart_push/append_points. 2020-11-05 09:00:41 +08:00
51f07e1652 LineArt: Use ICON_OUTLINER_COLLECTION for collection icon 2020-11-05 08:39:51 +08:00
2c35b091bf LineArt: Cleanup warnings 2020-11-04 19:02:53 +08:00
96ef8ed07f LineArt: rna info updated 2020-11-04 18:07:05 +08:00
d1dee06e5e Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-04 17:58:30 +08:00
24a97e07ee LineArt: default value assignments. 2020-11-04 17:57:24 +08:00
3da9bee809 LineArt: compiler error fixes. 2020-11-04 16:20:10 +08:00
4d382591ff LineArt: naming and description fixes. 2020-11-04 16:07:23 +08:00
418d99d2c7 LineArt: code format changes. 2020-11-04 15:26:25 +08:00
bd9a8de00c LineArt: LISTBASE_FOREACH modifications. 2020-11-04 15:02:50 +08:00
2700d8509f LineArt: UI and property name changes 2020-11-04 14:49:58 +08:00
e5c3317527 LineArt: Collection panel UI fixex 2020-11-04 14:44:36 +08:00
2f953ef6e9 LineArt: Flag sync for "no camera" to "has camera" situation. 2020-11-04 09:38:31 +08:00
f475abdad2 LineArt: Main panel UI logic for no active camera scenario. 2020-11-04 09:26:23 +08:00
de02909d02 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-04 09:09:31 +08:00
31f13c2ae7 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-03 14:56:51 +08:00
2ff102e651 LineArt: reduce chaining_geometry_threshold to 0.01 to reduce small bleedings in a typical scene. 2020-11-02 16:40:51 +08:00
dc96fdda01 LineArt: Support line preview in edit mode. 2020-11-02 09:46:04 +08:00
6f8ebd5e50 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-02 09:21:09 +08:00
5efc132c2c Merge remote-tracking branch 'origin/lanpr-under-gp' into lanpr-under-gp 2020-10-31 18:29:56 +08:00
bb80b1278c LineArt: Further value tweaks for the UI. 2020-10-31 17:00:48 +08:00
ee4069e460 LineArt: Default values and description clean up. 2020-10-31 16:48:39 +08:00
abbe7c9e6a LineArt: Modifier UI cleanup. 2020-10-31 16:48:23 +08:00
dfe08487a4 LineArt: UI logic fixe for object line art panel. 2020-10-31 16:13:28 +08:00
00e7a89f81 LineArt: Main panel UI optimizations. 2020-10-31 16:06:04 +08:00
bd46b40756 LineArt: COLLECTION_HAS_OBJECT_CACHE_INSTANCED flag clear 2020-10-31 15:58:43 +08:00
603dfdcc9d Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-31 15:25:58 +08:00
cba8012cd9 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenloader/intern/readfile.c
#	source/blender/blenloader/intern/writefile.c
2020-10-30 12:47:09 +08:00
c4304b3e0f Lineart: Remove cursor progress call to avoid BadCursor error. 2020-10-29 12:33:15 +08:00
009314d417 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-29 12:14:56 +08:00
dd9fce0ba0 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-28 18:11:14 +08:00
18a6508505 LineArt: comment fixes. 2020-10-28 14:44:51 +08:00
7354580f5d Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-28 11:39:43 +08:00
35d16ff452 LineArt: Python formatting fix. 2020-10-28 11:24:36 +08:00
bea6d5ebd4 LineArt: Formatting. 2020-10-28 10:59:22 +08:00
8732277b8c LineArt: Move OP exec functions into lineart_ops.c 2020-10-28 10:52:25 +08:00
dbdd026fb3 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-28 10:37:25 +08:00
8ff66f0183 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/scripts/startup/bl_ui/properties_material_gpencil.py
2020-10-27 20:24:52 +08:00
88eb5b43c3 LineArt: Cancel running calculation when unchecked auto update. 2020-10-27 20:12:25 +08:00
1c35405ec4 LineArt: stage info updated 2020-10-24 22:27:10 +08:00
c99754dabc Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-24 22:26:12 +08:00
e1800eb8e5 LineArt: handle eval_ob == NULL case when rl->object_ref is removed. 2020-10-23 16:27:42 +08:00
34d7559ffe LineArt: Discard outside lines 2020-10-23 09:17:48 +08:00
661fa309f1 LineArt: Use separate adjacent info for clipping 2020-10-23 08:57:23 +08:00
097bb6065c Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-23 07:51:16 +08:00
d1152b069a LineArt: type compatible with MSVC 2020-10-23 07:51:11 +08:00
d58c2568bb LineArt: Reduced vert intersecting data size. 2020-10-22 17:19:51 +08:00
8adb6b3595 LineArt: Reduced triangle intersecting data size. 2020-10-22 17:19:33 +08:00
4775d79df5 LineArt: Intersection vert data now allocated in extended way. 2020-10-22 16:45:49 +08:00
257f620f75 LineArt: Use global vert index to detect share_edge 2020-10-22 13:07:14 +08:00
b985019186 LineArt: Fix vertex group name induced early return in modifier. 2020-10-22 13:01:06 +08:00
67f28300c0 LineArt: Hacked culling adjacent data 2020-10-22 11:29:18 +08:00
fb52b3b69d Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
2020-10-22 11:08:53 +08:00
78a6c9cfb0 LineArt: Fixing cull adjacent 2020-10-21 21:20:56 +08:00
aecceb7b1e LineArt: Line iterator fixed 2020-10-21 19:28:36 +08:00
8d9c76f43a LineArt: Culling function updated to new structure. 2020-10-21 18:08:39 +08:00
bbcc73607c LineArt: Change RenderLine to a single-way link list. 2020-10-21 17:11:42 +08:00
9ec833266c LineArt: Removed rt->rl. 2020-10-21 15:38:32 +08:00
626ab18f18 Lineart: Prior to removing rt->rl. 2020-10-21 14:45:02 +08:00
4ca8357baf LineArt: Compute contour before culling. 2020-10-21 12:57:04 +08:00
b35611632f LineArt: Remove duplicated canceling 2020-10-21 12:20:22 +08:00
ba4a481c91 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-21 11:46:44 +08:00
50578422f4 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-19 20:39:03 +08:00
6c54cdaab5 LineArt: Limit near-by bounding area look up to only one level. 2020-10-19 20:38:27 +08:00
d142b5605e LineArt: Chaning lookup in near by bounding areas. 2020-10-19 20:25:40 +08:00
624bb6c9e2 LineArt: Fuzzy logic fix. 2020-10-19 20:22:44 +08:00
77030d813e LineArt: Use "Show Clipping Boundaries" for clarity 2020-10-19 17:33:11 +08:00
70867ff74e LineArt: Vertex group input will select all when filter is empty 2020-10-19 15:12:20 +08:00
3a00152fe7 LineArt: Option for remove doubles when loading mesh. 2020-10-19 14:34:17 +08:00
d244a66175 LineArt: make format 2020-10-19 12:56:11 +08:00
ed0341ca4c LineArt: Ortho camera clipping bug fixed. 2020-10-19 12:52:20 +08:00
bb25a7a59a LineArt: Remove unused default value in multiple stroke modifier. 2020-10-19 11:43:19 +08:00
2d8d86359c Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-19 11:26:37 +08:00
40ba7e7392 LineArt: Clipped crease line does not show. Fixed. 2020-10-15 19:50:21 +08:00
717c9f0682 LineArt: apply camera scale before matrix 2020-10-15 19:38:53 +08:00
8bfaf0152b Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-15 18:39:09 +08:00
d6eb20701a Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-14 22:43:51 +08:00
fe8800eaae LineArt: Memory debug info. 2020-10-14 22:42:21 +08:00
f4c22820f0 LineArt: Line cut reduction 2020-10-14 20:53:14 +08:00
970d4ad696 LineArt: default crease value changes to degrees. 2020-10-14 19:04:50 +08:00
fe578d7c7d Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-14 18:39:10 +08:00
4f52220fbf Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-05 21:24:40 +08:00
d2e86c49aa Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-05 15:39:06 +08:00
bc7af55b7a LineArt: Fix compiler warnings for windows. 2020-10-04 15:45:11 +08:00
ff71b67f75 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/makesrna/intern/rna_gpencil_modifier.c
2020-10-04 12:41:33 +08:00
43770adf13 LineArt: Use max weight among groups for selection. 2020-10-03 13:33:44 +08:00
9eefbdfc51 LineArt: Smooth weight option. 2020-10-03 12:15:30 +08:00
bb231515e5 LineArt: Fix uncaught memory leak in stroke generation. 2020-10-03 11:38:21 +08:00
c28f0e55c1 LineArt: Option for matching input/output vertex group names. 2020-10-03 11:34:35 +08:00
6d53c218de Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-03 10:57:52 +08:00
0c15f1ed3e LineArt: CD_MDEFORMVERT flag in viewport evaluation. 2020-10-02 16:58:16 +08:00
97656f68e1 LineArt: Fixed render vert linking in intersection stage. 2020-10-02 15:08:05 +08:00
ecb734cd02 LineArt: vertex group data matching. 2020-10-02 14:46:13 +08:00
52ef81f848 LineArt: data copying and mofifier UI for vgroup. 2020-10-02 13:38:32 +08:00
6b8b0024db LineArt: Vertex group data structure changes. 2020-10-02 12:47:56 +08:00
cfb867fdaf LineArt: GPencil modifier API changes. 2020-10-02 12:03:06 +08:00
945222740f Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-02 11:49:48 +08:00
8b2694a005 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/python/mathutils/mathutils_Matrix.c
2020-10-01 21:38:54 +08:00
Ivan Perevala
36c273b68c UI: Motion Tracking: Fix description of K2 coefficient
Fixed description of K2 coefficient. It is second coefficient

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D9050
2020-10-01 21:37:15 +08:00
91b0bfc809 Cleanup: spelling 2020-10-01 21:37:15 +08:00
691183242b Cleanup: remove full-stop from description 2020-10-01 21:37:15 +08:00
162277f050 Cleanup: use angle-brackets for email addresses
This is already the most widely used convention.

Use this so `make check_spelling_c` will ignore all email addresses.
2020-10-01 21:37:15 +08:00
49b3691c23 Cleanup: sort cmake file lists 2020-10-01 21:37:15 +08:00
5796c1455f Cleanup: sort struct declarations 2020-10-01 21:37:15 +08:00
da87ee1d05 Cleanup: Make function private
The "UI_panel_set_expand_from_list_data" doesn't need to be in the
public API since it's just called every time an instanced panel is added.
This commit just sets the expansion automatically and adjusts some
naming to account for the moved function.
2020-10-01 21:37:15 +08:00
a8e7d15fa0 Fix use after free deleting object with modifier panels visible
It's necessary to check if the panels are active before accessing their
data. Thanks to @ankitm for reporting this.
2020-10-01 21:37:15 +08:00
a319af986a Cleanup: Use LISTBASE_FOREACH macro in outliner code 2020-10-01 21:37:15 +08:00
81ad816441 UI: Remove second person in warning message
This phrasing can feel like an accusation, and a simpler phrase
gets across the idea just as well.
2020-10-01 21:37:15 +08:00
Pablo Dobarro
c95015bf96 Sculpt: Preserve Mesh visibility from edit mode using the Face Sets
Before this change, when users switch from edit mode to sculpt mode, the
entire mesh would be visible. Even if in the edit mesh mode part of it was
set to invisible.

With this change the visibility is preserved, by creating a separate face set
for the visible and invisible parts of the mesh and setting their initial visibility.

Implementation details: This adds a function to initialize a new Face Set
 datalayer taking the current mesh visibility into account which is stored
in the ME_HIDE flag of the vertices.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8901
2020-10-01 21:37:15 +08:00
f0b5fceac2 Sculpt: Line Project Gesture tool
This tool projects all vertices to the right of the plane defined by the
line gesture towards the plane. By doing this, this tool can create cuts
and plane surfaces in the mesh without modifying the geometry or using
boolean operations, so it is much faster than bisecting the mesh for
cases where the geometry was going to be remeshed afterwards.

Added as experimental as it does not have icon.

Reviewed By: sergey, Severin

Differential Revision: https://developer.blender.org/D9021
2020-10-01 21:37:15 +08:00
310d85678e API Docs: Correct syntax for bpy.utils.register_class 2020-10-01 21:37:15 +08:00
nutti
bcaed55995 API Docs: Fix corrupted document of gpu.select.load_id
The Python API document of gpu.select.load_id does not follow rst format.
c.f. https://docs.blender.org/api/current/gpu.select.html

This patch fixes it.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D8547
2020-10-01 21:37:15 +08:00
62c8f77395 API docs: Fix sytax error for delaunay_2d_cd
Alternative solution to https://developer.blender.org/D8546
2020-10-01 21:37:15 +08:00
Ankit Meel
0a87fd4b92 Fix T81100: ccl::Node: ASan SEGV due to bad pointer
`SOCKET_OFFSETOF` was added in the initial commit {rBec51175f1fd6c91d5}
when `offsetof` [1] was not supported well enough. GCC and LLVM
support it since C++17.

Other two changes: type and size check can be done without creating
an invalid address too.

[1] https://cppreference.com/w/cpp/types/offsetof

Reviewed By: campbellbarton, brecht

Maniphest Tasks: T81100

Differential Revision: https://developer.blender.org/D9042
2020-10-01 21:37:15 +08:00
fe0b6b564b API Docs: Use raises field list syntax
See 
https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#info-field-lists
2020-10-01 21:37:15 +08:00
89565e0631 Fix unreported Eisenbug leading to a crash when reading a blend file.
This took more than a day to fully investigate and understand, one of
the reasons being that the probability of the issue to show up was
extremely low, and subjected to very specific random factors.

Root of the issue is that, in some very rare cases, a newly read ID
might get the exact same memory address as the one it had when the blend
file was saved.

In that case, `BKE_workspace_active_set` would return immediately, since
the pointer to the active workspace would remain unchanged. But that
lead to having an unset NULL active layout pointer, which would crash
when attempting to get e.g. the active screen.

For the record, I ran into this when running a specific build (master
with one flag added to the `LIB_ID_CREATE` ones, with value `1 << 3`),
using a specific set of options (`--background --factory-startup -noaudio`),
and passing the .blend file from T80090 as argument.
2020-10-01 21:37:15 +08:00
d704c293c2 Fix (unrepported) utterly broken logic in readfile for Workspaces.
Remove the attempt to update the active layout pointers of each window
from whithin `direct_link_workspace`.

This piece of code was a nonsense for at least to critical reasons:
* Do not, never, ever, access data from another datablock within the
  direct_link_... functions. Just don't. Don't try to be smart.
* Since it was trying (and failing) to update the active layout of every
  window for every workspace, it was effectively setting those
  `act_layout` pointers to NULL (remapping can only ever happen once,
  trying to remap and already remapped new pointer is bound to fail in
  any case).

Luckily (and funnily), this piece of code was actually harmless, since
setting the active layout would be overridden/redone later, in
`lib_link_windowmanager`, when updating their `workspace_hook` in
`lib_link_workspace_instance_hook`.

Note that the similar horror with `WorkSpaceDataRelation->parent` (which
points at a window) is kept for now, because that one is needed. Hope to
refactor it soon though.
2020-10-01 21:37:15 +08:00
cc13cac397 Property Search: Set expansion properly for child panels
Although I haven't seen this cause any visible errors, there is some
incorrect handling for setting panel expansion during search:
 - Properly check if child panel is active first
 - Don't stop traversal at headerless panels that could theoretically
   have children
2020-10-01 21:37:15 +08:00
179d94e407 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-29 22:16:36 +08:00
82422c8d1f LineArt: 2d Intersection function ratio check improvements. 2020-09-27 19:15:31 +08:00
6fb70a29de LineArt: Deg representation of crease threashold. 2020-09-27 15:13:14 +08:00
b9d063ab59 LineArt: Reliable line type determination. 2020-09-27 12:58:17 +08:00
7cc23f317b LineArt: Better logic for usage flags. 2020-09-27 11:38:25 +08:00
2ed35a9f93 LineArt: Collection "no intersection" flag 2020-09-27 11:02:53 +08:00
cb39e2800f LineArt: Object "No Intersection" flag. 2020-09-27 10:45:52 +08:00
94c0d3a4cc Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-27 07:56:10 +08:00
33aef1b100 LineArt: Fix rna_lineart_auto_update_set() error 2020-09-25 21:33:04 +08:00
157f4f37ad LineArt: Fixed viewport auto update. 2020-09-25 20:38:57 +08:00
7b38f90bd1 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-25 20:08:45 +08:00
f3fd29d609 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-24 08:31:17 +08:00
03853fb303 LineArt: Capability of rendering in "lock interface" mode. 2020-09-23 18:40:25 +08:00
bb936cfb6a LineArt: Clearing flag guard before framebuffer creation. 2020-09-23 17:28:14 +08:00
0bcf788c61 LineArt: Baking keyframes only. 2020-09-23 11:30:45 +08:00
78dc814112 LineArt: Preview ranges and skipping in baking. 2020-09-23 10:32:35 +08:00
03d50cddb3 LineArt: Compiler warning 2020-09-23 10:03:19 +08:00
d7fe06b35b Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-23 09:19:09 +08:00
4b51eb5743 LineArt: revert to original object relation linking in modifier depsgraph. 2020-09-23 00:10:05 +08:00
ce55b10522 LineArt: Vector 2D intersection typo fix. 2020-09-22 20:37:10 +08:00
24ab978a67 LineArt: Vertical camera FOV improper scale. 2020-09-22 20:30:21 +08:00
0a42b85fc4 Lineart: fixing Bounding area issues. 2020-09-22 14:15:14 +08:00
992735589d LineArt: No double caching during one update, even with multiple modifiers. 2020-09-22 12:20:07 +08:00
6b91c61a4f Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-22 10:50:14 +08:00
69e46f11dd LineArt: Debug print in modifier. 2020-09-22 10:48:18 +08:00
a603f3ad53 LineArt: Instanced collection child function bug. 2020-09-21 23:52:35 +08:00
11c94ad244 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenkernel/intern/scene.c
2020-09-21 23:02:43 +08:00
ca7838d76a Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-20 22:45:34 +08:00
42e710b87a Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-18 23:30:17 +08:00
c5302b95de LineArt: Strict thread sync. 2020-09-18 23:17:50 +08:00
416ca93300 LineArt: Draw freestyle marks in viewport as well. 2020-09-18 21:02:58 +08:00
639d92f1ed LineArt: Temp fix for using in motion blur situation. (Doubles render time) 2020-09-18 20:16:35 +08:00
3f76836e72 LineArt: Mac compatibility. 2020-09-18 14:00:09 +08:00
12e07cf9de LineArt: Supplimental debug information. 2020-09-18 13:22:28 +08:00
a7d6caf94e Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/editors/object/CMakeLists.txt
2020-09-18 13:13:26 +08:00
92104a822d Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/makesdna/DNA_collection_types.h
#	source/blender/makesrna/intern/rna_collection.c
2020-09-16 18:19:44 +08:00
1a5106c0d1 Merge branch 'master' into lanpr-under-gp 2020-09-15 15:27:32 +02:00
dc6cdfb8d5 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-15 13:34:20 +08:00
7567d8959e Merge branch 'master' into lanpr-under-gp 2020-09-14 15:30:41 +02:00
175d684470 LineArt: Fix Depth comparason error in intersection line occlusion stage. 2020-09-13 22:36:12 +08:00
08503a9062 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/gpencil_modifiers/CMakeLists.txt
#	source/blender/makesrna/intern/CMakeLists.txt
2020-09-13 22:07:57 +08:00
a75700a775 LineArt: Fix merge problem 2020-09-11 17:08:42 +02:00
46dc226b23 Merge branch 'master' into lanpr-under-gp
Conflicts:
	source/blender/blenloader/intern/writefile.c
2020-09-11 17:06:04 +02:00
62d3a0d1ec LineArt: Clipped line switch. 2020-09-11 17:16:41 +08:00
bbba3c7e72 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-11 15:16:35 +08:00
2ac3613084 LineArt: Fixed clipping line data link for new iteration path in contour detection. 2020-09-11 11:37:51 +08:00
a78e132bf4 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-11 11:23:13 +08:00
5130c9e7a6 LineArt: Far clipping 2020-09-11 00:11:47 +08:00
617a60f8b7 LineArt: Typo 2020-09-10 23:27:03 +08:00
c50483f548 LineArt: Update viewport when changing ObjectLineArt settings. 2020-09-10 21:22:37 +08:00
90e05b47cd LineArt: Own crease setting for Object. 2020-09-10 21:12:58 +08:00
d8d0ae39a3 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-10 19:54:47 +08:00
fdfd5dcdf1 LineArt: Fix UI ptr code. 2020-09-10 19:54:01 +08:00
5eaa709063 LineArt: API fixes. 2020-09-10 11:58:22 +08:00
df558cb605 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/editors/include/ED_geometry.h
#	source/blender/editors/lineart/lineart_ops.c
#	source/blender/editors/mesh/editmesh_intersect.c
#	source/blender/editors/object/object_facemap_ops.c
#	source/blender/gpu/CMakeLists.txt
#	source/blender/gpu/intern/gpu_batch.cc
#	source/blender/gpu/intern/gpu_context_private.hh
#	source/blender/gpu/intern/gpu_immediate.cc
#	source/blender/gpu/intern/gpu_immediate_private.hh
#	source/blender/gpu/intern/gpu_platform_private.hh
#	source/blender/gpu/intern/gpu_primitive_private.h
#	source/blender/gpu/intern/gpu_query.cc
#	source/blender/gpu/opengl/gl_batch.cc
#	source/blender/gpu/opengl/gl_context.cc
#	source/blender/gpu/opengl/gl_drawlist.cc
#	source/blender/gpu/opengl/gl_immediate.cc
#	source/blender/python/intern/bpy_rna_ui.h
2020-09-10 09:56:05 +08:00
501d064ee9 Cleanup: GPU: Remove unused attr_binding and primitive code 2020-08-31 22:23:21 +08:00
a47a64d9e4 GPUImmediate: GL backend isolation
This is part of the Vulkan backend task T68990.

This is mostly a cleanup, however, there is a small change:
We don't use a special Vertex Array binding function for Immediate
anymore and just reuse the one for batches.
This might create a bit more state changes but this could be fixed
easily if it causes perf regression.

# Conflicts:
#	source/blender/gpu/intern/gpu_context.cc
2020-08-31 22:23:21 +08:00
bfe222561c GLContext: Fix framebuffer deletion to GPUContext
This has more meaning as it's the base class who holds the pointer.

# Conflicts:
#	source/blender/gpu/opengl/gl_context.cc
2020-08-31 22:23:21 +08:00
a823597548 Cleanup: GPU_immediate: Change assert to BLI_assert 2020-08-31 22:23:21 +08:00
Germano Cavalcante
adfa705804 Fix T79973: Re-ordering face maps messes up the names of other face maps
Use a remap function instead a swap.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D8739
2020-08-31 22:23:21 +08:00
2604bade6c Cleanup: reduce variable scope 2020-08-31 22:23:21 +08:00
d0e2ce54ac Cleanup: reduce variable scope and use LISTBASE_FOREACH 2020-08-31 22:23:21 +08:00
6d5794e6bc Fix T80126: Alembic Import dialogue has overwrite protection UI
Use `FILE_OPENFILE` when importing, rather than `FILE_SAVE`.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D8715
2020-08-31 22:23:21 +08:00
7c0068c10f Linux: 2.90 release information in appdata 2020-08-31 22:23:21 +08:00
964071403a Cleanup: Resolve unused variable warning in lite build 2020-08-31 22:23:21 +08:00
9282b3b936 LineArt: Enable vector line intersection code (isect_v2_v2) 2020-08-31 22:23:21 +08:00
383c9717b5 LineArt: Better line intersection function and handling. 2020-08-31 22:23:21 +08:00
7efa3cec8b LineArt: CMake clean up. 2020-08-31 22:23:21 +08:00
f18f6d5354 LineArt: DNA/RNA cleanup. 2020-08-31 15:07:19 +08:00
0e1dd86c5b LineArt: Names clean up. 2020-08-31 15:03:27 +08:00
10f8a79f6a Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-31 10:49:49 +08:00
b45728bbc0 LineArt: added ratio() after interp() functions in math lib. 2020-08-30 10:43:52 +08:00
f14bb97cbf Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-30 10:23:51 +08:00
00eee5090d Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	build_files/cmake/config/blender_full.cmake
#	build_files/cmake/config/blender_lite.cmake
#	build_files/cmake/config/blender_release.cmake
2020-08-29 12:26:18 +08:00
5f4be7f48e LineArt: Better desctiption for enable linked objects 2020-08-29 12:24:57 +08:00
60881cf8d9 Cleanup 'make vertex parent' operator code.
More localized variables, avoid ugly 'offset by one' index usage in
favor of explicit `INDEX_UNSET` define, etc.

No behavior change expected from this commit.
2020-08-29 12:24:57 +08:00
954c79fe51 Fix T80135: Duplicate doesn't preserve active spline
Checks to preserve the active spline on duplication
required an active vertex too.

Now having no active vertex doesn't prevent duplicate
from keeping the spline active.

Reviewed by: @mano-wii

Ref D8729
2020-08-29 12:24:57 +08:00
a55c383752 Cleanup: use doxy sections in interface_panels.c 2020-08-29 12:24:57 +08:00
b51ebc6785 Cleanup: spelling 2020-08-29 12:24:57 +08:00
64438d679f LineArt: Slope throw away threshold in lineart_LineIntersectTest2d() 2020-08-29 11:29:13 +08:00
b8cf5b7215 LineArt: More fluent viewport manipulation (canceling sequence optimization) 2020-08-28 13:06:14 +08:00
27307a2be6 LineArt: Better manuverability with quick cancel. 2020-08-28 12:41:29 +08:00
328b28cf06 LineArt: Feature line compatible clipping. 2020-08-28 11:34:28 +08:00
bba9a70c00 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-28 10:10:28 +08:00
7e063e00ac Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-27 21:19:21 +08:00
7b6e6ef977 LineArt: Splitting limit for dense triangle situations. 2020-08-27 21:13:33 +08:00
64362a1c13 LineArt: Prompt on baking finish. 2020-08-27 11:39:16 +08:00
1fa0102959 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-27 09:59:28 +08:00
450f3498ca LineArt: Basic background task canceling. 2020-08-26 22:54:26 +08:00
ccef1c234a LineArt: Back-transform strokes to allow gp to sit at other positions. 2020-08-26 20:58:09 +08:00
59c47ac6d1 LineArt: Disable line art object viewport selection by default. 2020-08-26 20:36:51 +08:00
54a7adbe79 LineArt: Prevent crash when using any sort of moving operators. 2020-08-26 20:31:34 +08:00
856265b0d8 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-26 20:18:08 +08:00
6a02e9186b Merge branch 'master' into lanpr-under-gp 2020-08-26 10:11:28 +02:00
1198a68f25 Merge branch 'master' into lanpr-under-gp 2020-08-25 10:37:48 +02:00
8f611fd0bb Merge branch 'master' into lanpr-under-gp 2020-08-23 16:24:35 +02:00
19b5f837b1 Merge branch 'master' into lanpr-under-gp 2020-08-22 13:11:05 +02:00
0c95f4f774 LineArt: "Intersection Only" flag for objects/collections 2020-08-21 21:32:44 +08:00
b3decec480 Merge branch 'master' into lanpr-under-gp 2020-08-21 09:49:21 +02:00
15ca1f8823 LineArt: Remove debug print. 2020-08-20 21:45:14 +08:00
aa07f958fa LineArt: GPencil modifier flag change to mode (wrong use of variable). 2020-08-20 18:11:56 +08:00
a8703111c4 LineArt: guard for no camera situations. 2020-08-20 17:30:50 +08:00
9dfff48b99 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-20 15:07:11 +08:00
6b255bd9bb LineArt: Support for edge split. 2020-08-20 15:03:02 +08:00
d81206066d LineArt: Camera shifting aspect ratio fix. 2020-08-20 14:15:22 +08:00
02cdabddcb LineArt: BKE_scene_graph_update_for_newframe() new api. 2020-08-20 13:34:11 +08:00
ac04fdb1d9 Merge branch 'master' into lanpr-under-gp 2020-08-19 19:53:38 +02:00
886c2936b0 Merge branch 'master' into lanpr-under-gp 2020-08-19 07:52:12 +02:00
b5c8596096 Merge branch 'master' into lanpr-under-gp
Conflicts:
	source/blender/editors/space_buttons/CMakeLists.txt
2020-08-18 16:14:11 +02:00
9061c6919f Merge branch 'master' into lanpr-under-gp 2020-08-18 11:04:02 +02:00
518b8a469d Merge branch 'master' into lanpr-under-gp 2020-08-17 11:30:52 +02:00
fded457fcb LineArt: The line art panel in material is for mesh not for grease pencil. 2020-08-17 10:50:59 +08:00
cc7a57c34e LineArt: Move Linea Art mask panel as subpanel
Also moved to properties_material_gpencil.py
2020-08-16 18:35:23 +02:00
15855dcbcd LineArt: Fix compiler warnings and clang format 2020-08-16 18:19:31 +02:00
c3735cc332 LineArt: "Match" option in modifier settings. 2020-08-16 21:52:44 +08:00
09b2374ac0 LineArt: Transparency mask selection in modifier. 2020-08-16 16:49:18 +08:00
a326688c69 LineArt: Transparency mask data in Material. 2020-08-16 12:05:45 +08:00
9a9b7c3213 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-16 11:01:16 +08:00
f79dea97df Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenloader/intern/versioning_280.c
2020-08-15 13:13:42 +08:00
2eaf5ec228 LineArt: Prevent lines showing inside text object surface, disable crease. 2020-08-14 19:10:07 +08:00
d1ca1b1338 LineArt: metaballs/texts/curves/surfaces support. 2020-08-14 16:17:33 +08:00
3d1ea081cf LineArt: enable/disable duplicated objects in line art. 2020-08-14 15:36:39 +08:00
33f24a5db2 Line Art: file r/w pointer clean-up for collection->object_cache_instanced. 2020-08-14 14:57:48 +08:00
e25fb868d7 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-14 13:59:43 +08:00
1e7a51daa6 LineArt: Linked files now support collection-in-collection type of linking. 2020-08-13 23:10:56 +08:00
b76ffc6e04 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-13 21:55:43 +08:00
6ea694ceb8 Merge branch 'master' into lanpr-under-gp 2020-08-13 10:01:39 +02:00
5ca4e75d95 Merge branch 'master' into lanpr-under-gp 2020-08-12 22:59:09 +02:00
2103a1d145 Merge branch 'master' into lanpr-under-gp 2020-08-11 15:34:55 +02:00
30dfe126a6 Merge branch 'master' into lanpr-under-gp 2020-08-11 08:21:11 +02:00
b132cba50a Merge branch 'master' into lanpr-under-gp 2020-08-10 15:36:08 +02:00
c3d1e690cf Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-10 20:32:03 +08:00
64ea607ce4 LineArt: Memory sync fixes for animation rendering. 2020-08-09 21:56:35 +08:00
3e42356af1 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenkernel/intern/scene.c
#	source/blender/makesdna/DNA_gpencil_modifier_types.h
2020-08-09 19:48:41 +08:00
b99a5e70a1 LineArt: Guard more for very short cut situations. 2020-08-06 22:24:38 +08:00
2fec1a99c2 LineArt: Intersection lines can now be selected by different collections if fully contained. 2020-08-06 14:46:41 +08:00
0e9ebfe053 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-06 09:51:03 +08:00
77971dc662 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/tools
2020-08-05 19:51:28 +08:00
716a772d1a LineArt: use LISTBASE_FOREACH in lineart_chain.c 2020-08-03 22:59:34 +08:00
ac220268c8 LineArt: cleanup function names. 2020-08-03 21:41:15 +08:00
77e2f9629d LineArt: Cleanup extra modifications caused by merging and stuff. 2020-08-03 21:26:49 +08:00
5c660f0ff4 LineArt: Remove obsolete BKE_scene_ functions. 2020-08-03 20:17:37 +08:00
100d1c395c Merge branch 'master' into lanpr-under-gp 2020-08-03 12:35:49 +02:00
c52aab8b72 Merge branch 'master' into lanpr-under-gp 2020-08-01 12:13:29 +02:00
a3044f4733 Merge branch 'master' into lanpr-under-gp 2020-08-01 11:21:45 +02:00
0de0b8f335 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-01 10:45:46 +08:00
d84ba71149 LineArt: Memory utility changed to size_t instead of int. 2020-07-31 23:43:41 +08:00
31b9fa4e9a Merge branch 'master' into lanpr-under-gp 2020-07-31 12:44:41 +02:00
d842334b24 Merge branch 'master' into lanpr-under-gp 2020-07-31 12:06:11 +02:00
7ecfb0bca8 Merge branch 'master' into lanpr-under-gp 2020-07-30 16:24:14 +02:00
3402f6dec0 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-30 21:33:08 +08:00
d44a93f411 LineArt: Memory optimizations by removing obsolete variables. 2020-07-29 23:48:02 +08:00
9a04768b8b LineArt: Removing more fields in render data structure to save memory. 2020-07-29 23:32:14 +08:00
59714f2a00 LineArt: Remove RenderTriangle::gc. This variable was never really used. 2020-07-29 22:58:13 +08:00
3d33971422 LineArt: Don't call angle splitting when threshold is minimal. 2020-07-29 22:51:09 +08:00
cd9317e74e LineArt: Near clipping intersection hack. 2020-07-29 22:51:09 +08:00
653c6819d4 LineArt: Fix baking crash. 2020-07-29 22:51:09 +08:00
56e6cccefb LineArt: Fix compiler warnings 2020-07-29 13:34:03 +02:00
b33dc98893 LineArt: Remove angle splitting properties in multiply modifier. 2020-07-29 18:24:44 +08:00
d84ec55cff LineArt: Fix typo errors in tooltips 2020-07-29 12:00:27 +02:00
a7bdfd86e9 LineArt: Angle splitting using deg instead of rad. 2020-07-29 17:56:30 +08:00
2a4e6aaf48 LineArt: Allow applying of the modifier. 2020-07-29 16:54:19 +08:00
c7b0368803 Merge branch 'master' into lanpr-under-gp 2020-07-29 10:39:22 +02:00
b82d1cc4c7 LineArt: Internal angle splitting function. 2020-07-29 16:01:42 +08:00
77b00ef498 LineArt: Fix long line not registering bug. 2020-07-29 15:09:05 +08:00
9f4d79d02a LineArt: Adjacent triangle hack. 2020-07-29 14:29:51 +08:00
c760d3069c LineArt: Do not offset near-clip in culling stage. 2020-07-29 13:43:16 +08:00
73747311d5 LineArt: Obsolete functions clean up. 2020-07-29 12:11:30 +08:00
1f9d955faf LineArt: Use linear W for back-transform. 2020-07-29 12:11:18 +08:00
3abb56792d Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/editors/space_buttons/buttons_context.c
2020-07-29 11:18:58 +08:00
474e2aef72 Fix small typo in the lineart clipping calculations 2020-07-28 18:25:21 +02:00
ef01d800ec LineArt: NDC to Viewport z depth optimization and near clipping decision change. 2020-07-28 23:11:21 +08:00
839fba88b9 GPencil: Cleanup comments 2020-07-28 16:59:25 +02:00
a4f3f5cec3 LineArt: Fix compiler warnings 2020-07-28 16:40:29 +02:00
a416b3e210 LineArt: Cleanup enum callback for quick line art. 2020-07-28 17:40:28 +08:00
3817355e88 LineArt: Conditinal showing of quick line art options. 2020-07-28 17:26:58 +08:00
77aa5edffd LineArt: (missedd a new file). 2020-07-28 16:40:38 +08:00
91767d7e88 LineArt: Quick line art set-up in add objects menu. 2020-07-28 16:39:51 +08:00
153815a856 Merge branch 'master' into lanpr-under-gp 2020-07-28 09:14:11 +02:00
ab3b1aa3bf LineArt: Don't retain line art buffer result after modifier evaluation. 2020-07-28 13:44:10 +08:00
20b39e4bd6 LineArt: Memory allocation now dynamically stretch each pool for better efficiency and large model handling. 2020-07-28 12:14:42 +08:00
29f160a7a8 LineArt: Don't allow frame number 0 to be baked. 2020-07-28 11:53:29 +08:00
5fc69361be LineArt: Ensure notification of line art gpencil objects when enable/disableing line art. 2020-07-28 11:49:15 +08:00
5222521bc7 LineArt: Don't retain strokes when disabled auto_update. Also prevent render dead-lock. 2020-07-28 11:05:49 +08:00
03f56a9fd6 LineArt: Fix frame cleaning at the wrong time. 2020-07-28 10:34:41 +08:00
a7ed36c803 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-28 09:21:44 +08:00
7afee455b1 LineArt: Fix compiler warnings 2020-07-27 16:53:23 +02:00
0dd6a7647c Merge branch 'master' into lanpr-under-gp 2020-07-27 16:49:01 +02:00
aaa2da3e6d Merge branch 'master' into lanpr-under-gp 2020-07-27 10:50:24 +02:00
1652026cb7 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-27 11:22:00 +08:00
c53504a5b5 LineArt: Performance improvements. 2020-07-26 21:52:28 +08:00
0c96ae6724 LineArt: Pre-sample in the modifier. 2020-07-26 12:07:24 +08:00
56cfae9ef0 LineArt: Remove duplicated "Calculate Intersections" switch. 2020-07-26 11:38:50 +08:00
c89742c5b1 LineArt: Global line type flags. 2020-07-26 11:33:52 +08:00
b29749af5f LineArt: Fix force line type when connecting to intersection lines, 2020-07-26 11:12:25 +08:00
56183da948 LineArt: Global line type selection. 2020-07-26 11:07:06 +08:00
7a489cd639 LineArt: Force line types for situations in fuzzy chaining. 2020-07-26 10:48:10 +08:00
0ef3f6760f Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-26 10:10:40 +08:00
7f57b9f2c1 LineArt: Restore collection and object panels for usage flag settings. 2020-07-26 00:20:32 +08:00
cbbc9e69c5 Merge branch 'master' into lanpr-under-gp 2020-07-25 16:25:11 +02:00
cf365828d8 LineArt: double point chaining algorithm 2020-07-25 17:56:54 +08:00
9b7b93b206 LineArt: Optimization for avoiding loops in chaining 2020-07-25 16:21:46 +08:00
15a012de17 Revert "Merge remote-tracking branch 'DarkdefenderRepo/npr_tess_2_90' into lanpr-under-gp"
This reverts commit ceb3b7098c, reversing
changes made to ef2189542d.
2020-07-25 12:27:36 +08:00
ceb3b7098c Merge remote-tracking branch 'DarkdefenderRepo/npr_tess_2_90' into lanpr-under-gp 2020-07-24 23:57:16 +08:00
ef2189542d LineArt: Use separate function for getting closest end point in chain. 2020-07-24 22:48:25 +08:00
7fea51be5a Merge branch 'master' into lanpr-under-gp 2020-07-24 16:24:38 +02:00
ce3447c064 LineArt: Random color debug for generated strokes. 2020-07-24 21:41:47 +08:00
8c0845eb7e Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/makesrna/intern/rna_space.c
2020-07-24 18:13:02 +08:00
5753786bae Merge branch 'master' into lanpr-under-gp 2020-07-23 13:17:16 +02:00
173d690149 LineArt: Optimize details in chaining code. 2020-07-22 19:55:56 +08:00
9784c5021b Merge remote-tracking branch 'origin/lanpr-under-gp' into lanpr-under-gp 2020-07-22 18:49:02 +08:00
4503af102d LineArt: Fuzzy chaining option and UI. 2020-07-22 18:48:56 +08:00
d5d73554c0 Merge branch 'master' into lanpr-under-gp 2020-07-22 11:18:36 +02:00
494b75c654 LineArt: Remove duplicated "use" phrase in modifier UI. 2020-07-22 14:08:40 +08:00
b08d72d2c8 LineArt: Optimize chaining code for better handling for organic features. 2020-07-22 13:19:53 +08:00
e586101619 Merge branch 'master' into lanpr-under-gp 2020-07-21 15:54:59 +02:00
24bce50e58 LineArt: Guard early in the modifier for stopping calculation when there's no active keyframe present. 2020-07-21 19:32:21 +08:00
3cd09680a0 LineArt: Revert accidental changes in constraint.c 2020-07-21 18:31:56 +08:00
18754b54b1 LineArt: Completely remove now obsolete LineLayer structure. 2020-07-21 17:35:37 +08:00
e22c86cbc3 LineArt: Cleanup function names into _lineart_category_operation() format. 2020-07-21 17:10:47 +08:00
f58c3f94c9 Merge remote-tracking branch 'origin/lanpr-under-gp' into lanpr-under-gp 2020-07-21 16:03:44 +08:00
c4a4f6ebce Merge branch 'master' into lanpr-under-gp 2020-07-20 20:22:12 +02:00
9971dcc073 Merge branch 'master' into lanpr-under-gp 2020-07-20 11:12:12 +02:00
338cef6158 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-19 19:26:58 +08:00
8cdcc3703b Merge branch 'master' into lanpr-under-gp 2020-07-18 10:35:12 +02:00
61aad4f0ab Merge branch 'master' into lanpr-under-gp 2020-07-17 16:46:42 +02:00
5927aaafb7 Merge branch 'master' into lanpr-under-gp 2020-07-16 17:45:48 +02:00
c7d0ad77b0 Merge branch 'master' into lanpr-under-gp 2020-07-16 08:17:11 +02:00
38a66b5f1a LineArt: Fix isDisabled function
* The layer is not a pointer, but a name.
* Don't execute if it's disabled.
2020-07-15 23:35:24 +02:00
501489c55e LineArt: Disable modifier when source/target isn't properly set 2020-07-15 23:21:23 +08:00
7316aeb433 LineArt: Do not block the process when applying modifier with auto update turned off. 2020-07-15 22:49:17 +08:00
47985f0ea0 LineArt: Fix multiple calls to clearing frame when have multiple modifier on baking. 2020-07-15 18:58:26 +08:00
bd7308e951 LineArt: use DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN to support instanced collections and view layer flag. 2020-07-15 18:30:13 +08:00
f8ad9f1f8a LineArt: Remove LRT_ENABLED flag. 2020-07-15 18:23:38 +08:00
1250e862e3 LineArt: UI fixes. 2020-07-15 17:42:26 +08:00
5c74c712a9 LineArt: Thickness and strength moved into the modifier. 2020-07-15 17:30:06 +08:00
6fc5b82375 LineArt: use G.debug_value==4000 for line art logs. 2020-07-15 17:07:26 +08:00
ef8ee6b2fd LineArt: Precise and fast cutting point back-transform. 2020-07-15 15:03:45 +08:00
7675d3e6e2 LineArt: Overwrite frame flag now supported for baking. 2020-07-15 13:40:35 +08:00
c4057a0e86 LineArt: Restore original frame after baking is done. 2020-07-15 13:31:02 +08:00
3d13c7ebbc LineArt: Take account of hidden modifiers in render and viewport. 2020-07-15 13:27:33 +08:00
0fd17d27ed LineArt: Property in main panel will trigger auto update in the viewport. 2020-07-15 13:15:23 +08:00
2696d9b293 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-15 11:29:36 +08:00
695ad46107 LineArt: Cleanup some texts 2020-07-14 19:28:33 +02:00
a045a2dac6 LineArt: Fix compiler errors in Windows 2020-07-14 17:35:05 +02:00
98ce3d23a9 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-14 23:09:14 +08:00
8fabcb8372 LineArt: Use orig_id for all object filtering. 2020-07-14 22:49:50 +08:00
07153475ab LineArt: Cleanup code. 2020-07-14 21:32:30 +08:00
4de6902afe Merge branch 'master' into lanpr-under-gp 2020-07-14 10:44:11 +02:00
24c9b37e4b LineArt: Cleanup format 2020-07-13 22:58:43 +02:00
4139347532 Merge branch 'master' into lanpr-under-gp 2020-07-13 10:39:28 +02:00
8c01374ed6 Merge branch 'master' into lanpr-under-gp 2020-07-11 20:30:50 +02:00
023e4a5935 Merge branch 'master' into lanpr-under-gp 2020-07-10 17:11:21 +02:00
cce663421e Merge branch 'master' into lanpr-under-gp 2020-07-09 15:47:29 +02:00
6cbb2ffb0c LineArt: Use LISTBASE_FOREACH 2020-07-07 23:30:41 +08:00
19d73bd6b2 LineArt: Null handling when gpencil target is an empty object. 2020-07-07 23:06:30 +08:00
49ebb8095c Merge remote-tracking branch 'origin/lanpr-under-gp' into lanpr-under-gp 2020-07-07 23:01:32 +08:00
7b96cd604a LineArt: Fix conflict on evaluation when baking. 2020-07-07 23:01:26 +08:00
9f6c0715ec LineArt: Replace Loop by LISTBASE_FOREACH 2020-07-07 16:37:56 +02:00
3be3892d85 Merge branch 'master' into lanpr-under-gp 2020-07-07 16:21:17 +02:00
a4d3e6bd47 Merge branch 'master' into lanpr-under-gp 2020-07-07 16:20:11 +02:00
1699d79b42 LineArt: Fix compiler errors and warnings in Windows 2020-07-07 16:19:54 +02:00
25de3e5294 LineArt: Handle accidental scene->master_collection == NULL situation. 2020-07-07 21:21:05 +08:00
7f6efc6769 LineArt: Bake button in render panel. 2020-07-07 20:51:14 +08:00
84e504dd3b LineArt: Obsolete operators cleaned up. 2020-07-07 20:04:39 +08:00
342a51c38c Cleanup: naming conventions in lineart_cpu.c 2020-07-07 19:17:42 +08:00
214a2c637f LineArt: Continue last commit. (git GUI problem) 2020-07-07 18:16:13 +08:00
bbb32cf494 LineArt: Continue last commit. 2020-07-07 18:15:33 +08:00
3f273fbc96 LineArt: Update calculation progress on progress bar and cursor. 2020-07-07 18:05:35 +08:00
302d9b38a7 LineArt: No need to use DEG_SCENE_PARAMETERS now because we have good object relations. 2020-07-07 16:40:23 +08:00
d4f9a1c134 LineArt: Include Depsgraph mode to grease pencil modifiers callback 2020-07-07 10:12:48 +02:00
afc0b5875e LineArt: Making settings panel visible in all engines. 2020-07-07 14:08:54 +08:00
6b216909c7 LineArt: Don't create frames in gpencil modifier. 2020-07-07 14:02:53 +08:00
5186330893 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-07 13:41:55 +08:00
4679d1857f Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-06 14:39:23 +08:00
fac0a317cb Port smooth countour modifier to 2.90 2020-07-06 03:05:16 +02:00
c80318c84c LineArt: Fix compiler warnings 2020-07-04 16:25:00 +02:00
6f262f79ff Cleanup: Continue last commit 2020-07-04 19:41:07 +08:00
05ffc6fbcb LANPR: Master thickness and strength added. 2020-07-04 19:40:35 +08:00
4bea9c0d2b LANPR: Add related object relationship with modifier when using collection source. 2020-07-04 19:18:44 +08:00
7d28cbf05f LANPR: Remove obsolete UI in render panel. 2020-07-04 18:56:43 +08:00
365df4b5aa LANPR: Removed excessive scene relationship in updateDepsgraph. 2020-07-04 17:22:02 +08:00
0bf58275f6 LANPR: show strokes when rendering. 2020-07-04 17:17:02 +08:00
49152c98a5 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenkernel/intern/gpencil.c
2020-07-04 13:56:23 +08:00
248585b3cc LANPR: Contour/Freestyle mark distinguish. 2020-07-03 18:32:52 +08:00
cde5978cf7 LANPR: Suspected memory issue when generating gp strokes fixed. 2020-07-03 16:27:02 +08:00
928da5b65a LANPR: Modifier property now updates viewport. 2020-07-03 15:15:28 +08:00
ee0a9a26da LANPR: Viewport now redraws when grease pencil update is finished in the background. 2020-07-03 14:59:19 +08:00
44ba7b7e1e LANPR: Collection usage flag now effective. 2020-07-03 14:41:12 +08:00
6e64a8d900 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
2020-07-03 14:22:53 +08:00
152d2c5184 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/makesrna/intern/rna_object.c
2020-07-02 12:52:08 +08:00
53b1c2c278 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-29 19:30:43 +08:00
a945849f66 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-29 12:20:41 +08:00
ec9ec3b134 Cleanup: Pointer assignment cast and modifier iteration. 2020-06-28 23:06:39 +08:00
f19ed441b8 Cleanup: Remove target settings in CollectionLineart. 2020-06-28 22:37:39 +08:00
fcec150c50 Cleanup: lanpr RNA name fixes. 2020-06-28 21:52:14 +08:00
da7964ea49 LANPR: Modifier apply now works for all line types. 2020-06-28 21:45:45 +08:00
3e39b45fa4 LANPR: Modifier apply now partially working. 2020-06-28 21:29:32 +08:00
c6fd4b97d0 LANPR: Modifier code cleanup. 2020-06-28 21:02:44 +08:00
35430988c1 LANPR: Fix Append segfault by removing BLO_expand() for a wrong pointer. 2020-06-28 20:53:36 +08:00
624994718d LANPR: Clear picked flags for modifier line picking use. 2020-06-28 19:51:01 +08:00
705a77765d LANPR: Collection mode depsgraph relationship with scene added. 2020-06-28 17:37:56 +08:00
09f72c5dba LANPR: Auto update for modifier now works in dg. 2020-06-28 17:26:43 +08:00
f2873a2f03 LANPR: Modifier stroke generation code now funcional. 2020-06-28 14:58:45 +08:00
74dd526809 Merge remote-tracking branch 'origin/lanpr-under-gp' into lanpr-under-gp 2020-06-28 14:20:45 +08:00
f2c5b7ea86 LANPR: generateStrokes functions added. 2020-06-28 14:18:51 +08:00
c963898200 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-28 12:40:04 +08:00
8f1d640a6f LANPR: GP Lineart modifier file r/w now working. 2020-06-27 21:54:44 +08:00
5b16ae068b LANPR: GP modifier basic UI complete. 2020-06-27 21:24:24 +08:00
dea7176dba LANPR: Modifier properties added. 2020-06-27 20:38:46 +08:00
77115c8832 LANPR: Main panel should also show in Workbench. 2020-06-27 19:02:47 +08:00
141fa711e4 LANPR: Added back chaining threshold values. 2020-06-27 18:06:46 +08:00
e09d0b1330 LANPR: Object LANPR panel name change to Lineart. 2020-06-27 16:21:54 +08:00
554ae0bd05 LANPR: UI name fixes. 2020-06-27 16:11:52 +08:00
cc2a1954d9 Refactor: LANPR file names changed to lineart. 2020-06-27 16:08:38 +08:00
cb676fa7da Refactor: All struct names changed to Lineart 2020-06-27 15:58:01 +08:00
ef33474ed2 Refactor: DNA names and python references for LANPR. 2020-06-27 15:27:41 +08:00
0abac43019 Refactor: Rename LANPR to LineArt in DNA and compiler options 2020-06-27 14:50:53 +08:00
ac56bf75c0 Refactor: (Continue files for last commit) 2020-06-27 14:32:47 +08:00
dad2db3bc9 Refactor: ED_lanpr functions renamed to ED_lineart 2020-06-27 14:32:04 +08:00
b6f390f6a9 Refactor: some struct names for LANPR in editor module changed to eLineArt. 2020-06-27 14:15:27 +08:00
0aed42f8a7 Refactor: Keep up with readfiles.c API changes for LANPR 2020-06-27 12:14:59 +08:00
39419bf99f Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-27 11:52:29 +08:00
bf9680f0b4 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-26 21:26:24 +08:00
44f66c3808 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-26 14:14:21 +08:00
19ba395d99 LANPR: Added placeholder modifier in GP. 2020-06-25 17:50:47 +08:00
c8f3e4cc6c LANPR: Use only (0,1) for crease threshold. 2020-06-25 17:29:27 +08:00
db211c8edd LANPR: Version bumper moved to latest. 2020-06-25 17:26:49 +08:00
26609e2639 LANPR: Fixed occlusion level detection. 2020-06-25 17:20:15 +08:00
1b7ea80690 LANPR: Fix ambiguous occlusion level when having overlapping points on chaining . 2020-06-25 16:18:55 +08:00
941ed655a8 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	CMakeLists.txt
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/editors/space_buttons/CMakeLists.txt
2020-06-25 14:09:03 +08:00
a3dc4a472d Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/blenloader/intern/readfile.c
2020-06-21 16:29:31 +08:00
a180717911 Fix Wrong struct reference. 2020-06-11 18:23:07 +08:00
1b856226f7 LANPR: object_foreach_id() now takes care of target reference too. 2020-06-11 18:02:51 +08:00
29d02c7c30 LANPR: Fix baking finish flag. 2020-06-11 12:55:23 +08:00
78490a7837 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenkernel/intern/scene.c
2020-06-11 12:37:54 +08:00
80011e847d LANPR: Baking in frame range is now working. 2020-06-10 22:56:23 +08:00
4273836cdc LANPR: Fix deleting GP cause UI crash problem. 2020-06-10 21:58:21 +08:00
26e91f4f1e LANPR: Thread monitoring memory leak fixed. 2020-06-10 21:04:55 +08:00
231bfe46a4 LANPR: Fix undo memory conflict in threaded calculations 2020-06-10 19:49:53 +08:00
e9ad44e368 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-10 18:34:10 +08:00
497633df39 LANPR: Background calculation now doesn't block user input. (Messy code for now) 2020-06-08 15:51:00 +08:00
9803f4502d Cleanup: Compiler debug flags. 2020-06-08 14:24:51 +08:00
b0dda64a95 LANPR: Fixed crashes during duplicate point removal in chain connecting. 2020-06-08 14:20:54 +08:00
56ebc769a6 LANPR: Fix readfile.c node tree linking error from merge. 2020-06-08 12:11:38 +08:00
cbe77c9110 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-08 12:03:03 +08:00
48a7fcdf75 LANPR: Duplicating points in chaining stage is taken care of. 2020-06-07 22:03:44 +08:00
46cd0a12d4 LANPR: ob->imat now untouched by LANPR geometry loading. Normal flipping bug solved. 2020-06-07 21:06:26 +08:00
b211885d0f LANPR: Remove chaining flag. 2020-06-07 20:50:27 +08:00
43df7f9f6a LANPR: GP Target now recalculate geometry (using DEG_id_tag thing) automatically. 2020-06-07 20:30:04 +08:00
050e6bdea7 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenloader/intern/readfile.c
#	source/blender/blenloader/intern/writefile.c
#	source/blender/makesrna/intern/rna_collection.c
2020-06-07 20:09:56 +08:00
35d83ade04 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-04 22:28:23 +08:00
117c0c18a3 LANPR: Memory copy/deleting implemented into depsgrapgh callback. No leaks now. 2020-06-04 22:27:54 +08:00
c2ce9fdee9 LANPR: Chaininng panel is re-configured and shown. 2020-06-04 21:47:05 +08:00
fc3f80d1bb LANPR: Init and deinit triggers in ed_utils.c 2020-06-04 21:42:53 +08:00
0ae685b584 Removed LANPR engine and made LANPR working under Pure GP. 2020-06-04 21:20:35 +08:00
bfbf0bb7f7 Merge remote-tracking branch 'origin/master' into temp-lanpr-review
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
2020-06-04 18:57:28 +08:00
3b52dfe549 Merge remote-tracking branch 'origin/master' into temp-lanpr-review
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	source/blender/blenkernel/intern/lib_query.c
2020-05-30 16:34:11 +08:00
cd54abd2c1 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2020-05-16 23:08:40 +08:00
f7770cb97b Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2020-02-01 10:35:40 +08:00
b47883a990 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2020-02-01 10:25:32 +08:00
b5abbc40a0 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-12-13 13:42:27 +08:00
c2c6447229 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-12-10 22:13:06 +08:00
191b890883 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-12-09 14:04:57 +08:00
f83f168c92 LANPR: Typo "identity". 2019-12-04 20:47:39 +08:00
7804323e33 LANPR: CPU mode win_mat fix attempt. 2019-12-04 20:15:45 +08:00
89e01395a8 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-12-04 20:15:33 +08:00
781c9f5206 LANPR: Grease pencil mode init code fix. 2019-12-03 20:23:43 +08:00
6f7f80775d LANPR: Warning messages for gpu cache overflow. 2019-12-03 13:48:48 +08:00
8b041081c3 LANPR: chaining vertex count fixed. 2019-12-03 13:44:05 +08:00
7f81bb4931 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-12-03 13:30:50 +08:00
2243de9a90 LANPR: Don't use background intersection calculation for GPU mode. 2019-11-29 23:17:00 +08:00
798e93b634 Cleanup: Missing bracket. 2019-11-28 18:44:32 +08:00
ca43179932 LANPR: Camera shift value assign. 2019-11-28 14:50:46 +08:00
6967d60c4b Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-28 14:50:40 +08:00
1c2b864155 LANPR: Remove debug print in triangle clipping 2019-11-28 13:29:49 +08:00
cb47cc14cd LANPR: Removed camera references in RenderBuffer. Safe for thread ops. 2019-11-28 13:27:13 +08:00
352eb65a57 LANPR: Locking parent thread when loading scenes into lanpr. 2019-11-28 12:38:33 +08:00
8eb44bfb81 LANPR: Renderbuffer creation changed to re-init. 2019-11-28 11:48:59 +08:00
acd8fae2d8 LANPR: Const qualifiers for some of the functions 2019-11-28 11:39:21 +08:00
Julian Eisel
541fb672ec Always write LANPR data if set
Gerneral rule of thumb: Don't delete user data without permission.
Data-blocks are a whole different and difficult story. Users may have
disabled just for a render, reloading the file shouldn't make their
settings go lost.
2019-11-27 17:19:41 +01:00
Julian Eisel
6ccd672fee Fix crash on disabling collection LANPR
Also:
* Avoid duplicated copy code (copy code performed already and wouldn't actually run)
* Cleanup freeing
2019-11-27 17:10:27 +01:00
Julian Eisel
cf38c4d49f Fix NULL-ptr mem-copy 2019-11-27 16:03:21 +01:00
12bf6ee36c LANPR: Build option CMakeLists add LANPR. 2019-11-27 22:51:35 +08:00
Julian Eisel
4227b81826 Fix wrong dereferences 2019-11-27 15:38:31 +01:00
Julian Eisel
cf623d8e7b Address some minor warnings 2019-11-27 15:36:36 +01:00
Julian Eisel
692f20604c Run clang-format on all changed files 2019-11-27 15:35:17 +01:00
9f35ef219f LANPR: Collection visibility flags should be visible in all engines. 2019-11-27 22:21:31 +08:00
aa4ff9e5d3 LANPR: Fixing CollectionLANRP file r/w. 2019-11-27 22:09:35 +08:00
1e801df3ef LANPR: Use pointer to save collection LANPR config. 2019-11-27 21:10:38 +08:00
f8384c0d2d Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-27 19:41:17 +08:00
5aa70ac589 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-27 10:18:09 +08:00
c2fbf7668d LANPR: Remove LANPR_LineLayerComponent struct as it's no more used. 2019-11-24 22:02:29 +08:00
365faddd79 LANPR: Fix chain point count error. 2019-11-24 20:55:16 +08:00
c508138e95 LANPR: CMake option in the RNA. 2019-11-24 20:48:47 +08:00
0476090983 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-24 20:43:53 +08:00
7da7d97aff Cleanup: LANPR compilder flags, missing registers, and some other fixes. 2019-11-22 19:17:54 +08:00
9b27248c64 LANPR: Some comments on the occlusion function 2019-11-22 18:27:03 +08:00
b95f15862e Cleanup: Get rid of real/tmat/tnsvector stuff in LANPR internal code. 2019-11-22 18:10:20 +08:00
232e13d4cb Cleanup: variable capitalizations. 2019-11-22 18:02:25 +08:00
96d470c0e2 LANPR: Versioning code move to the latest. 2019-11-22 17:37:15 +08:00
7e577c4857 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-22 17:29:36 +08:00
66aa0a2181 LANPR: dpix_shader_error type and rna definition fixes. 2019-11-20 21:32:54 +08:00
ba5c4414b0 Cleanup: Function logic and unused variables. 2019-11-20 21:30:13 +08:00
ec9cdd6e51 LANPR: Fix multisample texture functions and engine registering functions. 2019-11-20 20:56:56 +08:00
b3d226ffdb CLeanup: fix property context item descriptions. 2019-11-20 20:25:57 +08:00
bdd96da5eb Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-20 20:20:38 +08:00
43419e4c32 LANPR: Removed unused DRW_texture_create_2d_multisample function. 2019-11-20 17:20:42 +08:00
dc9f9faff7 Merge remote-tracking branch 'origin/master' into arcpatch-D5442 2019-11-20 16:11:51 +08:00
f2f2f5f6c7 Cleanup: Code style and dead code stuff. 2019-11-20 16:11:10 +08:00
9c7f536251 LANPR: Fix cmake option in render to allow lanpr callback for gp updates. 2019-11-20 16:02:29 +08:00
a921c5f239 Cleanup: dead codes and commentaries. 2019-11-20 15:44:33 +08:00
bb38766ba6 LANPR: Clipping topology data error fixed.
Also cleaned up some dead code inside.
2019-11-20 15:01:04 +08:00
45eb04adc8 Merge remote-tracking branch 'origin/master' into arcpatch-D5442 2019-11-20 13:21:35 +08:00
ee7785510b Cleanup: TNS_THREAD_LINE_COUNT commenting. 2019-11-18 22:14:32 +08:00
db12505f51 Cleanup: Fix compiler warnings. 2019-11-18 22:08:48 +08:00
314439e652 Cleanup: Remove snake mode structures in ED_lanpr.h 2019-11-18 21:48:34 +08:00
9a9fa3a206 Merge remote-tracking branch 'origin/master' into arcpatch-D5442 2019-11-18 21:46:25 +08:00
c3799f1c31 LANPR: Fix various code issues. 2019-11-17 20:29:17 +08:00
ef1cd34e8d Merge remote-tracking branch 'origin/master' into arcpatch-D5442 2019-11-17 20:10:38 +08:00
dba890910d LANPR: Still enable auto update checkbox when no active camera is persent. 2019-11-15 20:37:20 +08:00
3bcdf06a54 Merge branch 'master' into arcpatch-D5442 2019-11-15 20:30:19 +08:00
1924e96f7d LANPR: Fix asset errors and material marking errors. 2019-11-15 20:06:36 +08:00
YimingWu
e9df7caf19 LANPR line rendering (summer of code)
LANPR Patch

This is the patch for soc-2019-npr branch. Now modified as containing only LANPR changes

This patch **doesn't include** the following:

- GPencil modifiers.
- Smooth contour modifier.
- SVG.
- Affected UI scripts.
- Freestyle changes.

Those above will be submitted in other diffs.

Differential Revision: https://developer.blender.org/D5442
2019-11-15 11:46:33 +08:00
876 changed files with 14924 additions and 10132 deletions

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

@@ -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

@@ -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

@@ -1223,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):
@@ -2316,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

@@ -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

@@ -603,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 && view_layer.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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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,

View File

@@ -137,7 +137,7 @@ class GHOST_SystemCocoa : public GHOST_System {
bool processEvents(bool waitForEvent);
/**
* Handle User request to quit, from Menu bar Quit, and Cmd+Q
* Handle User request to quit, from Menu bar Quit, and Command+Q
* Display alert panel if changes performed since last save
*/
void handleQuitRequest();

View File

@@ -121,7 +121,7 @@ GHOST_TSuccess GHOST_SystemSDL::init()
void GHOST_SystemSDL::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
SDL_DisplayMode mode;
SDL_GetDesktopDisplayMode(0, &mode); /* note, always 0 display */
SDL_GetDesktopDisplayMode(0, &mode); /* NOTE: always 0 display. */
width = mode.w;
height = mode.h;
}
@@ -129,7 +129,7 @@ void GHOST_SystemSDL::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32
void GHOST_SystemSDL::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(0, &mode); /* note, always 0 display */
SDL_GetCurrentDisplayMode(0, &mode); /* NOTE: always 0 display. */
width = mode.w;
height = mode.h;
}
@@ -468,8 +468,8 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
assert(window != NULL);
GHOST_TKey gkey = convertSDLKey(sdl_sub_evt.keysym.scancode);
/* note, the sdl_sub_evt.keysym.sym is truncated,
* for unicode support ghost has to be modified */
/* NOTE: the `sdl_sub_evt.keysym.sym` is truncated,
* for unicode support ghost has to be modified. */
/* printf("%d\n", sym); */
if (sym > 127) {
switch (sym) {
@@ -755,5 +755,5 @@ void GHOST_SystemSDL::putClipboard(GHOST_TInt8 *buffer, bool selection) const
GHOST_TUns64 GHOST_SystemSDL::getMilliSeconds()
{
return GHOST_TUns64(SDL_GetTicks()); /* note, 32 -> 64bits */
return GHOST_TUns64(SDL_GetTicks()); /* NOTE: 32 -> 64bits. */
}

View File

@@ -1197,8 +1197,8 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
// Don't call ToUnicodeEx on dead keys as it clears the buffer and so won't allow diacritical
// composition.
else if (MapVirtualKeyW(vk, 2) != 0) {
// todo: ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here).
// Could be up to 24 utf8 bytes.
/* TODO: #ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here).
* Could be up to 24 utf8 bytes. */
if ((r = ToUnicodeEx(
vk, raw.data.keyboard.MakeCode, state, utf16, 2, 0, system->m_keylayout))) {
if ((r > 0 && r < 3)) {
@@ -1634,7 +1634,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
/* Reset pointer pen info if pen device has left tracking range. */
if (pointerInfo.pointerType == PT_PEN && !IS_POINTER_INRANGE_WPARAM(wParam)) {
if (pointerInfo.pointerType == PT_PEN) {
window->resetPointerPenInfo();
eventHandled = true;
}

View File

@@ -302,9 +302,9 @@ GHOST_TUns8 GHOST_SystemX11::getNumDisplays() const
void GHOST_SystemX11::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
if (m_display) {
/* note, for this to work as documented,
/* NOTE(campbell): for this to work as documented,
* we would need to use Xinerama check r54370 for code that did this,
* we've since removed since its not worth the extra dep - campbell */
* we've since removed since its not worth the extra dependency. */
getAllDisplayDimensions(width, height);
}
}
@@ -1044,33 +1044,30 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
GHOST_TKey gkey;
#ifdef USE_NON_LATIN_KB_WORKAROUND
/* XXX Code below is kinda awfully convoluted... Issues are:
*
* - In keyboards like latin ones, numbers need a 'Shift' to be accessed but key_sym
* is unmodified (or anyone swapping the keys with xmodmap).
*
* - XLookupKeysym seems to always use first defined keymap (see T47228), which generates
* keycodes unusable by ghost_key_from_keysym for non-Latin-compatible keymaps.
/* XXX: Code below is kinda awfully convoluted... Issues are:
* - In keyboards like latin ones, numbers need a 'Shift' to be accessed but key_sym
* is unmodified (or anyone swapping the keys with `xmodmap`).
* - #XLookupKeysym seems to always use first defined key-map (see T47228), which generates
* key-codes unusable by ghost_key_from_keysym for non-Latin-compatible key-maps.
*
* To address this, we:
*
* - Try to get a 'number' key_sym using XLookupKeysym (with virtual shift modifier),
* in a very restrictive set of cases.
* - Fallback to XLookupString to get a key_sym from active user-defined keymap.
* - Try to get a 'number' key_sym using #XLookupKeysym (with virtual shift modifier),
* in a very restrictive set of cases.
* - Fallback to #XLookupString to get a key_sym from active user-defined key-map.
*
* Note that:
* - This effectively 'lock' main number keys to always output number events
* (except when using alt-gr).
* - This enforces users to use an ASCII-compatible keymap with Blender -
* but at least it gives predictable and consistent results.
* - This effectively 'lock' main number keys to always output number events
* (except when using alt-gr).
* - This enforces users to use an ASCII-compatible key-map with Blender -
* but at least it gives predictable and consistent results.
*
* Also, note that nothing in XLib sources [1] makes it obvious why those two functions give
* different key_sym results...
* different key_sym results.
*
* [1] http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/KeyBind.c
*/
KeySym key_sym_str;
/* Mode_switch 'modifier' is AltGr - when this one or Shift are enabled,
/* Mode_switch 'modifier' is `AltGr` - when this one or Shift are enabled,
* we do not want to apply that 'forced number' hack. */
const unsigned int mode_switch_mask = XkbKeysymToModifiers(xke->display, XK_Mode_switch);
const unsigned int number_hack_forbidden_kmods_mask = mode_switch_mask | ShiftMask;

View File

@@ -556,7 +556,7 @@ static SDL_Cursor *sdl_ghost_CreateCursor(
return cursor;
}
/* TODO, this is currently never freed but it won't leak either. */
/* TODO: this is currently never freed but it won't leak either. */
static SDL_Cursor *getStandardCursorShape(GHOST_TStandardCursor shape)
{
if (sdl_std_cursor_array[0] == NULL) {
@@ -576,7 +576,7 @@ static SDL_Cursor *getStandardCursorShape(GHOST_TStandardCursor shape)
DEF_CURSOR(left_ptr, GHOST_kStandardCursorDefault);
DEF_CURSOR(right_ptr, GHOST_kStandardCursorRightArrow);
DEF_CURSOR(left_ptr, GHOST_kStandardCursorLeftArrow);
DEF_CURSOR(umbrella, GHOST_kStandardCursorInfo); // TODO, replace this one.
DEF_CURSOR(umbrella, GHOST_kStandardCursorInfo); /* TODO: replace this one. */
DEF_CURSOR(pirate, GHOST_kStandardCursorDestroy);
DEF_CURSOR(question_arrow, GHOST_kStandardCursorHelp);
DEF_CURSOR(watch, GHOST_kStandardCursorWait);

View File

@@ -38,6 +38,7 @@
#include <assert.h>
#include <math.h>
#include <shellscalingapi.h>
#include <string.h>
#include <windowsx.h>
@@ -80,13 +81,10 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
m_wintab(NULL),
m_lastPointerTabletData(GHOST_TABLET_DATA_NONE),
m_normal_state(GHOST_kWindowStateNormal),
m_user32(NULL),
m_user32(::LoadLibrary("user32.dll")),
m_parentWindowHwnd(parentwindow ? parentwindow->m_hWnd : HWND_DESKTOP),
m_debug_context(is_debug)
{
wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
RECT win_rect = {left, top, (long)(left + width), (long)(top + height)};
DWORD style = parentwindow ?
WS_POPUPWINDOW | WS_CAPTION | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SIZEBOX :
WS_OVERLAPPEDWINDOW;
@@ -105,27 +103,10 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
*/
}
/* Monitor details. */
MONITORINFOEX monitor;
monitor.cbSize = sizeof(MONITORINFOEX);
monitor.dwFlags = 0;
GetMonitorInfo(MonitorFromRect(&win_rect, MONITOR_DEFAULTTONEAREST), &monitor);
/* Constrain requested size and position to fit within this monitor. */
width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect.right - win_rect.left);
height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect.bottom - win_rect.top);
win_rect.left = min(max(monitor.rcWork.left, win_rect.left), monitor.rcWork.right - width);
win_rect.right = win_rect.left + width;
win_rect.top = min(max(monitor.rcWork.top, win_rect.top), monitor.rcWork.bottom - height);
win_rect.bottom = win_rect.top + height;
/* Adjust to allow for caption, borders, shadows, scaling, etc. Resulting values can be
* correctly outside of monitor bounds. Note: You cannot specify WS_OVERLAPPED when calling. */
AdjustWindowRectEx(&win_rect, style & ~WS_OVERLAPPED, FALSE, extended_style);
/* But never allow a top position that can hide part of the title bar. */
win_rect.top = max(monitor.rcWork.top, win_rect.top);
RECT win_rect = {left, top, (long)(left + width), (long)(top + height)};
adjustWindowRectForClosestMonitor(&win_rect, style, extended_style);
wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
m_hWnd = ::CreateWindowExW(extended_style, // window extended style
s_windowClassName, // pointer to registered class name
title_16, // pointer to window name
@@ -140,81 +121,78 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
0); // pointer to window-creation data
free(title_16);
m_user32 = ::LoadLibrary("user32.dll");
if (m_hWnd) {
RegisterTouchWindow(m_hWnd, 0);
// Register this window as a droptarget. Requires m_hWnd to be valid.
// Note that OleInitialize(0) has to be called prior to this. Done in GHOST_SystemWin32.
m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
if (m_dropTarget) {
::RegisterDragDrop(m_hWnd, m_dropTarget);
}
// Store a pointer to this class in the window structure
::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
if (!m_system->m_windowFocus) {
// Lower to bottom and don't activate if we don't want focus
::SetWindowPos(m_hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
// Store the device context
m_hDC = ::GetDC(m_hWnd);
GHOST_TSuccess success = setDrawingContextType(type);
if (success) {
// Show the window
int nCmdShow;
switch (state) {
case GHOST_kWindowStateMaximized:
nCmdShow = SW_SHOWMAXIMIZED;
break;
case GHOST_kWindowStateMinimized:
nCmdShow = (m_system->m_windowFocus) ? SW_SHOWMINIMIZED : SW_SHOWMINNOACTIVE;
break;
case GHOST_kWindowStateNormal:
default:
nCmdShow = (m_system->m_windowFocus) ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE;
break;
}
::ShowWindow(m_hWnd, nCmdShow);
#ifdef WIN32_COMPOSITING
if (alphaBackground && parentwindowhwnd == 0) {
HRESULT hr = S_OK;
// Create and populate the Blur Behind structure
DWM_BLURBEHIND bb = {0};
// Enable Blur Behind and apply to the entire client area
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
bb.fEnable = true;
bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
// Apply Blur Behind
hr = DwmEnableBlurBehindWindow(m_hWnd, &bb);
DeleteObject(bb.hRgnBlur);
}
#endif
// Force an initial paint of the window
::UpdateWindow(m_hWnd);
}
else {
// invalidate the window
::DestroyWindow(m_hWnd);
m_hWnd = NULL;
}
if (m_hWnd == NULL) {
return;
}
// Initialize Wintab
/* Store the device context. */
m_hDC = ::GetDC(m_hWnd);
if (!setDrawingContextType(type)) {
::DestroyWindow(m_hWnd);
m_hWnd = NULL;
return;
}
RegisterTouchWindow(m_hWnd, 0);
/* Register as drop-target. #OleInitialize(0) required first, done in GHOST_SystemWin32. */
m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
::RegisterDragDrop(m_hWnd, m_dropTarget);
/* Store a pointer to this class in the window structure. */
::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
if (!m_system->m_windowFocus) {
/* If we don't want focus then lower to bottom. */
::SetWindowPos(m_hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
/* Show the window. */
int nCmdShow;
switch (state) {
case GHOST_kWindowStateMaximized:
nCmdShow = SW_SHOWMAXIMIZED;
break;
case GHOST_kWindowStateMinimized:
nCmdShow = (m_system->m_windowFocus) ? SW_SHOWMINIMIZED : SW_SHOWMINNOACTIVE;
break;
case GHOST_kWindowStateNormal:
default:
nCmdShow = (m_system->m_windowFocus) ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE;
break;
}
::ShowWindow(m_hWnd, nCmdShow);
#ifdef WIN32_COMPOSITING
if (alphaBackground && parentwindowhwnd == 0) {
HRESULT hr = S_OK;
/* Create and populate the Blur Behind structure. */
DWM_BLURBEHIND bb = {0};
/* Enable Blur Behind and apply to the entire client area. */
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
bb.fEnable = true;
bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
/* Apply Blur Behind. */
hr = DwmEnableBlurBehindWindow(m_hWnd, &bb);
DeleteObject(bb.hRgnBlur);
}
#endif
/* Force an initial paint of the window. */
::UpdateWindow(m_hWnd);
/* Initialize Wintab. */
if (system->getTabletAPI() != GHOST_kTabletWinPointer) {
loadWintab(GHOST_kWindowStateMinimized != state);
}
/* Allow the showing of a progress bar on the taskbar. */
CoCreateInstance(
CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (LPVOID *)&m_Bar);
}
@@ -268,6 +246,47 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
}
}
void GHOST_WindowWin32::adjustWindowRectForClosestMonitor(LPRECT win_rect,
DWORD dwStyle,
DWORD dwExStyle)
{
/* Get Details of the closest monitor. */
HMONITOR hmonitor = MonitorFromRect(win_rect, MONITOR_DEFAULTTONEAREST);
MONITORINFOEX monitor;
monitor.cbSize = sizeof(MONITORINFOEX);
monitor.dwFlags = 0;
GetMonitorInfo(hmonitor, &monitor);
/* Constrain requested size and position to fit within this monitor. */
LONG width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect->right - win_rect->left);
LONG height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect->bottom - win_rect->top);
win_rect->left = min(max(monitor.rcWork.left, win_rect->left), monitor.rcWork.right - width);
win_rect->right = win_rect->left + width;
win_rect->top = min(max(monitor.rcWork.top, win_rect->top), monitor.rcWork.bottom - height);
win_rect->bottom = win_rect->top + height;
/* With Windows 10 and newer we can adjust for chrome that differs with DPI and scale. */
GHOST_WIN32_AdjustWindowRectExForDpi fpAdjustWindowRectExForDpi = nullptr;
if (m_user32) {
fpAdjustWindowRectExForDpi = (GHOST_WIN32_AdjustWindowRectExForDpi)::GetProcAddress(
m_user32, "AdjustWindowRectExForDpi");
}
/* Adjust to allow for caption, borders, shadows, scaling, etc. Resulting values can be
* correctly outside of monitor bounds. Note: You cannot specify WS_OVERLAPPED when calling. */
if (fpAdjustWindowRectExForDpi) {
UINT dpiX, dpiY;
GetDpiForMonitor(hmonitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY);
fpAdjustWindowRectExForDpi(win_rect, dwStyle & ~WS_OVERLAPPED, FALSE, dwExStyle, dpiX);
}
else {
AdjustWindowRectEx(win_rect, dwStyle & ~WS_OVERLAPPED, FALSE, dwExStyle);
}
/* But never allow a top position that can hide part of the title bar. */
win_rect->top = max(monitor.rcWork.top, win_rect->top);
}
bool GHOST_WindowWin32::getValid() const
{
return GHOST_Window::getValid() && m_hWnd != 0 && m_hDC != 0;
@@ -287,9 +306,13 @@ void GHOST_WindowWin32::setTitle(const char *title)
std::string GHOST_WindowWin32::getTitle() const
{
char buf[s_maxTitleLength]; /* CHANGE + never used yet. */
::GetWindowText(m_hWnd, buf, s_maxTitleLength);
return std::string(buf);
std::wstring wtitle(::GetWindowTextLengthW(m_hWnd) + 1, L'\0');
::GetWindowTextW(m_hWnd, &wtitle[0], wtitle.capacity());
std::string title(count_utf_8_from_16(wtitle.c_str()) + 1, '\0');
conv_utf_16_to_8(wtitle.c_str(), &title[0], title.capacity());
return title;
}
void GHOST_WindowWin32::getWindowBounds(GHOST_Rect &bounds) const

View File

@@ -43,6 +43,9 @@ class GHOST_DropTargetWin32;
// typedefs for user32 functions to allow dynamic loading of Windows 10 DPI scaling functions
typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND);
typedef BOOL(API *GHOST_WIN32_AdjustWindowRectExForDpi)(
LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi);
struct GHOST_PointerInfoWin32 {
GHOST_TInt32 pointerId;
GHOST_TInt32 isPrimary;
@@ -98,6 +101,14 @@ class GHOST_WindowWin32 : public GHOST_Window {
*/
~GHOST_WindowWin32();
/**
* Adjusts a requested window rect to fit and position correctly in monitor.
* \param win_rect: pointer to rectangle that will be modified.
* \param dwStyle: The Window Style of the window whose required size is to be calculated.
* \param dwExStyle: The Extended Window Style of the window.
*/
void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle);
/**
* Returns indication as to whether the window is valid.
* \return The validity of the window.

View File

@@ -274,7 +274,7 @@ static void setViewPortGL(GHOST_WindowHandle hWindow)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-w, w, -h, h, 5.0, 60.0);
/* glOrtho(0, bnds.getWidth(), 0, bnds.getHeight(), -10, 10); */
// glOrtho(0, bnds.getWidth(), 0, bnds.getHeight(), -10, 10);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);

View File

@@ -60,7 +60,7 @@
#include "GPU_init_exit.h"
extern int datatoc_bfont_ttf_size;
extern char datatoc_bfont_ttf[];
extern char const datatoc_bfont_ttf[];
typedef struct _LoggerWindow LoggerWindow;
typedef struct _MultiTestApp MultiTestApp;

View File

@@ -86,6 +86,13 @@ class COLLECTION_PT_lineart_collection(CollectionButtonsPanel, Panel):
row = layout.row()
row.prop(collection, "lineart_usage")
layout.prop(collection, "lineart_use_intersection_mask")
row = layout.row(align=True, heading="Masks")
row.active = collection.lineart_use_intersection_mask
for i in range(0,8):
row.prop(collection, "lineart_intersection_mask", index=i, text=str(i), toggle=True)
classes = (
COLLECTION_PT_collection_flags,

View File

@@ -505,6 +505,7 @@ class ConstraintButtonsPanel:
self.target_template(layout, con)
layout.prop(con, "remove_target_shear")
layout.prop(con, "mix_mode", text="Mix")
self.space_template(layout, con)

View File

@@ -20,6 +20,7 @@
import bpy
from bpy.types import Menu, Panel, UIList
from rna_prop_ui import PropertyPanel
from collections import defaultdict
class MESH_MT_vertex_group_context_menu(Menu):
@@ -117,7 +118,7 @@ class MESH_UL_shape_keys(UIList):
split = layout.split(factor=0.66, align=False)
split.prop(key_block, "name", text="", emboss=False, icon_value=icon)
row = split.row(align=True)
row.emboss = 'UI_EMBOSS_NONE_OR_STATUS'
row.emboss = 'NONE_OR_STATUS'
if key_block.mute or (obj.mode == 'EDIT' and not (obj.use_shape_key_edit_mode and obj.type == 'MESH')):
row.active = False
if not item.id_data.use_relative:
@@ -566,6 +567,89 @@ class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, Panel):
_property_type = bpy.types.Mesh
class MESH_UL_attributes(UIList):
display_domain_names = {
'POINT': "Vertex",
'EDGE': "Edge",
'FACE': "Face",
'CORNER': "Face Corner",
}
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
data_type = attribute.bl_rna.properties['data_type'].enum_items[attribute.data_type]
domain_name = self.display_domain_names.get(attribute.domain, "")
split = layout.split(factor=0.50)
split.emboss = 'NONE'
split.prop(attribute, "name", text="")
sub = split.row()
sub.alignment = 'RIGHT'
sub.active = False
sub.label(text="%s%s" % (domain_name, data_type.name))
class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
bl_label = "Attributes"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
def draw(self, context):
mesh = context.mesh
layout = self.layout
row = layout.row()
col = row.column()
col.template_list(
"MESH_UL_attributes",
"attributes",
mesh,
"attributes",
mesh.attributes,
"active_index",
rows=3,
)
col = row.column(align=True)
col.operator("geometry.attribute_add", icon='ADD', text="")
col.operator("geometry.attribute_remove", icon='REMOVE', text="")
self.draw_attribute_warnings(context, layout)
def draw_attribute_warnings(self, context, layout):
attributes_by_name = defaultdict(list)
ob = context.object
mesh = ob.data
builtin_attribute = object()
def add_builtin(name):
attributes_by_name[name].append(builtin_attribute)
def add_attributes(layers):
for layer in layers:
attributes_by_name[layer.name].append(layer)
add_builtin("position")
add_builtin("material_index")
add_builtin("shade_smooth")
add_builtin("normal")
add_builtin("crease")
add_attributes(mesh.attributes)
add_attributes(mesh.uv_layers)
add_attributes(mesh.vertex_colors)
add_attributes(ob.vertex_groups)
colliding_names = [name for name, layers in attributes_by_name.items() if len(layers) >= 2]
if len(colliding_names) == 0:
return
layout.label(text="Name Collisions: {}".format(", ".join(colliding_names)), icon='INFO')
classes = (
MESH_MT_vertex_group_context_menu,
MESH_MT_shape_key_context_menu,
@@ -574,6 +658,7 @@ classes = (
MESH_UL_shape_keys,
MESH_UL_uvmaps,
MESH_UL_vcols,
MESH_UL_attributes,
DATA_PT_context_mesh,
DATA_PT_vertex_groups,
DATA_PT_shape_keys,
@@ -581,6 +666,7 @@ classes = (
DATA_PT_vertex_colors,
DATA_PT_sculpt_vertex_colors,
DATA_PT_face_maps,
DATA_PT_mesh_attributes,
DATA_PT_normals,
DATA_PT_texture_space,
DATA_PT_remesh,

View File

@@ -291,12 +291,23 @@ class MATERIAL_PT_lineart(MaterialButtonsPanel, Panel):
mat = context.material
lineart = mat.lineart
layout.prop(lineart, "use_transparency")
layout.prop(lineart, "use_material_mask")
row = layout.row(align=True, heading="Masks")
row.active = lineart.use_transparency
row.active = lineart.use_material_mask
for i in range(8):
row.prop(lineart, "use_transparency_mask", text=str(i), index=i, toggle=True)
row.prop(lineart, "use_material_mask_bits", text=str(i), index=i, toggle=True)
row = layout.row(align=True, heading="Custom Occlusion")
row.prop(lineart, "use_mat_occlusion", text="")
sub = row.row(align=False)
sub.active = lineart.use_mat_occlusion
sub.prop(lineart, "mat_occlusion", slider=True, text="Levels")
row = layout.row(align=True, heading="Custom occlusion effectiveness")
row.active = lineart.use_occlusion_effectiveness
row.prop(lineart, "use_occlusion_effectiveness", text="")
row.prop(lineart, "occlusion_effectiveness", slider=True)
classes = (

View File

@@ -162,6 +162,14 @@ class SEQUENCER_HT_header(Header):
if tool_settings.use_proportional_edit:
row.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
tool_settings = context.tool_settings
row = layout.row(align=True)
row.prop(tool_settings, "use_snap_sequencer", text="")
sub = row.row(align=True)
sub.popover(panel="SEQUENCER_PT_snapping")
layout.separator_spacer()
row = layout.row(align=True)
row.prop(st, "show_strip_overlay", text="", icon='OVERLAY')
sub = row.row(align=True)
@@ -2264,6 +2272,28 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel):
bl_category = "Strip"
class SEQUENCER_PT_snapping(Panel):
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'HEADER'
bl_label = ""
def draw(self, context):
tool_settings = context.tool_settings
sequencer_tool_settings = tool_settings.sequencer_tool_settings
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
col = layout.column(heading="Snap to", align=True)
col.prop(sequencer_tool_settings, "snap_to_current_frame" )
col.prop(sequencer_tool_settings, "snap_to_hold_offset")
col = layout.column(heading="Ignore", align=True)
col.prop(sequencer_tool_settings, "snap_ignore_muted", text="Muted Strips")
col.prop(sequencer_tool_settings, "snap_ignore_sound",text="Sound Strips")
classes = (
SEQUENCER_MT_change,
SEQUENCER_HT_tool_header,
@@ -2333,6 +2363,8 @@ classes = (
SEQUENCER_PT_annotation,
SEQUENCER_PT_annotation_onion,
SEQUENCER_PT_snapping,
)
if __name__ == "__main__": # only for live edit.

View File

@@ -509,6 +509,13 @@ geometry_node_categories = [
NodeItem("GeometryNodeCurveLength"),
NodeItem("GeometryNodeCurveReverse"),
]),
GeometryNodeCategory("GEO_PRIMITIVES_CURVE", "Curve Primitives", items=[
NodeItem("GeometryNodeCurvePrimitiveCircle"),
NodeItem("GeometryNodeCurveStar"),
NodeItem("GeometryNodeCurveSpiral"),
NodeItem("GeometryNodeCurveQuadraticBezier"),
NodeItem("GeometryNodeCurvePrimitiveBezierSegment"),
]),
GeometryNodeCategory("GEO_GEOMETRY", "Geometry", items=[
NodeItem("GeometryNodeBoundBox"),
NodeItem("GeometryNodeConvexHull"),
@@ -540,7 +547,7 @@ geometry_node_categories = [
NodeItem("GeometryNodeSubdivisionSurface"),
NodeItem("GeometryNodeSubdivide"),
]),
GeometryNodeCategory("GEO_PRIMITIVES", "Mesh Primitives", items=[
GeometryNodeCategory("GEO_PRIMITIVES_MESH", "Mesh Primitives", items=[
NodeItem("GeometryNodeMeshCircle"),
NodeItem("GeometryNodeMeshCone"),
NodeItem("GeometryNodeMeshCube"),

View File

@@ -351,8 +351,7 @@ static void blf_font_ensure_ascii_kerning(FontBLF *font,
* characters.
*/
/* Note,
* blf_font_ensure_ascii_table(font, gc); must be called before this macro */
/* NOTE: `blf_font_ensure_ascii_table(font, gc);` must be called before this macro. */
#define BLF_UTF8_NEXT_FAST(_font, _gc, _g, _str, _i, _c, _glyph_ascii_table) \
if (((_c) = (_str)[_i]) < 0x80) { \
@@ -376,8 +375,7 @@ static void blf_font_ensure_ascii_kerning(FontBLF *font,
ft_kerning_default : \
(FT_UInt)FT_KERNING_UNFITTED)
/* Note,
* blf_font_ensure_ascii_kerning(font, gc, kern_mode); must be called before this macro */
/* NOTE: `blf_font_ensure_ascii_kerning(font, gc, kern_mode);` must be called before this macro. */
#define BLF_KERNING_STEP_FAST(_font, _kern_mode, _g_prev, _g, _c_prev, _c, _pen_x) \
{ \

View File

@@ -406,7 +406,7 @@ static void blf_texture_draw(const unsigned char color[4],
float y2)
{
/* Only one vertex per glyph, geometry shader expand it into a quad. */
/* TODO Get rid of Geom Shader because it's not optimal AT ALL for the GPU */
/* TODO: Get rid of Geom Shader because it's not optimal AT ALL for the GPU. */
copy_v4_fl4(GPU_vertbuf_raw_step(&g_batch.pos_step),
x1 + g_batch.ofs[0],
y1 + g_batch.ofs[1],

View File

@@ -55,7 +55,7 @@
*/
/*
* Note: This structure is read-only, for all practical purposes.
* NOTE: This structure is read-only, for all practical purposes.
* At some point in the future, we may want to consider
* creating a replacement structure that implements a proper
* abstract mesh kernel interface. Or, we can leave this
@@ -89,7 +89,7 @@ struct Object;
struct Scene;
/*
* Note: all mface interfaces now officially operate on tessellated data.
* NOTE: all mface interfaces now officially operate on tessellated data.
* Also, the mface origindex layer indexes mpolys, not mfaces.
*/

View File

@@ -151,7 +151,7 @@ typedef struct PoseTree {
struct bArmature *BKE_armature_add(struct Main *bmain, const char *name);
struct bArmature *BKE_armature_from_object(struct Object *ob);
int BKE_armature_bonelist_count(struct ListBase *lb);
int BKE_armature_bonelist_count(const struct ListBase *lb);
void BKE_armature_bonelist_free(struct ListBase *lb, const bool do_id_user);
void BKE_armature_editbonelist_free(struct ListBase *lb, const bool do_id_user);

View File

@@ -39,7 +39,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 6
#define BLENDER_FILE_SUBVERSION 7
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file

View File

@@ -218,7 +218,7 @@ BVHTree *bvhtree_from_mesh_looptri_ex(struct BVHTreeFromMesh *data,
ThreadMutex *mesh_eval_mutex);
BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
struct Mesh *mesh,
const struct Mesh *mesh,
const BVHCacheType bvh_cache_type,
const int tree_type);

View File

@@ -164,7 +164,8 @@ bool BKE_collection_move(struct Main *bmain,
bool BKE_collection_cycle_find(struct Collection *new_ancestor, struct Collection *collection);
bool BKE_collection_cycles_fix(struct Main *bmain, struct Collection *collection);
bool BKE_collection_has_collection(struct Collection *parent, struct Collection *collection);
bool BKE_collection_has_collection(const struct Collection *parent,
const struct Collection *collection);
void BKE_collection_parent_relations_rebuild(struct Collection *collection);
void BKE_main_collections_parent_relations_rebuild(struct Main *bmain);

View File

@@ -121,6 +121,7 @@ void BKE_curve_material_remap(struct Curve *cu, const unsigned int *remap, unsig
void BKE_curve_smooth_flag_set(struct Curve *cu, const bool use_smooth);
ListBase *BKE_curve_nurbs_get(struct Curve *cu);
const ListBase *BKE_curve_nurbs_get_for_read(const struct Curve *cu);
int BKE_curve_nurb_vert_index_get(const struct Nurb *nu, const void *vert);
void BKE_curve_nurb_active_set(struct Curve *cu, const struct Nurb *nu);
@@ -153,9 +154,10 @@ void BKE_curve_editNurb_keyIndex_delCV(struct GHash *keyindex, const void *cv);
void BKE_curve_editNurb_keyIndex_free(struct GHash **keyindex);
void BKE_curve_editNurb_free(struct Curve *cu);
struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu);
const struct ListBase *BKE_curve_editNurbs_get_for_read(const struct Curve *cu);
void BKE_curve_bevelList_free(struct ListBase *bev);
void BKE_curve_bevelList_make(struct Object *ob, struct ListBase *nurbs, bool for_render);
void BKE_curve_bevelList_make(struct Object *ob, const struct ListBase *nurbs, bool for_render);
ListBase BKE_curve_bevel_make(const struct Curve *curve);
void BKE_curve_forward_diff_bezier(

View File

@@ -112,7 +112,7 @@ enum {
};
/* How to map a source layer to a destination layer, for types supporting multi-layers.
* Note: if no matching layer can be found, it will be created. */
* NOTE: if no matching layer can be found, it will be created. */
enum {
DT_LAYERS_ACTIVE_DST = -1, /* Only for DT_LAYERS_FROMSEL_ACTIVE. */
DT_LAYERS_NAME_DST = -2,

View File

@@ -87,13 +87,11 @@ bool BKE_displist_has_faces(const struct ListBase *lb);
void BKE_displist_make_curveTypes(struct Depsgraph *depsgraph,
const struct Scene *scene,
struct Object *ob,
const bool for_render,
const bool for_orco);
const bool for_render);
void BKE_displist_make_curveTypes_forRender(struct Depsgraph *depsgraph,
const struct Scene *scene,
struct Object *ob,
struct ListBase *dispbase,
const bool for_orco,
struct Mesh **r_final);
void BKE_displist_make_mball(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
void BKE_displist_make_mball_forRender(struct Depsgraph *depsgraph,

View File

@@ -227,9 +227,9 @@ struct FCurve *BKE_fcurve_find_by_rna_context_ui(struct bContext *C,
/* Binary search algorithm for finding where to 'insert' BezTriple with given frame number.
* Returns the index to insert at (data already at that index will be offset if replace is 0)
*/
int BKE_fcurve_bezt_binarysearch_index(struct BezTriple array[],
float frame,
int arraylen,
int BKE_fcurve_bezt_binarysearch_index(const struct BezTriple array[],
const float frame,
const int arraylen,
bool *r_replace);
/* fcurve_cache.c */

View File

@@ -66,8 +66,8 @@ typedef struct EditFont {
} EditFont;
bool BKE_vfont_is_builtin(struct VFont *vfont);
void BKE_vfont_builtin_register(void *mem, int size);
bool BKE_vfont_is_builtin(const struct VFont *vfont);
void BKE_vfont_builtin_register(const void *mem, int size);
void BKE_vfont_free_data(struct VFont *vfont);
struct VFont *BKE_vfont_builtin_get(void);

View File

@@ -90,7 +90,7 @@ typedef struct GPencilPointCoordinates {
float pressure;
} GPencilPointCoordinates;
int BKE_gpencil_stroke_point_count(struct bGPdata *gpd);
int BKE_gpencil_stroke_point_count(const struct bGPdata *gpd);
void BKE_gpencil_point_coords_get(struct bGPdata *gpd, GPencilPointCoordinates *elem_data);
void BKE_gpencil_point_coords_apply(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data);
void BKE_gpencil_point_coords_apply_with_mat4(struct bGPdata *gpd,

View File

@@ -71,12 +71,12 @@ void BKE_keyblock_copy_settings(struct KeyBlock *kb_dst, const struct KeyBlock *
char *BKE_keyblock_curval_rnapath_get(struct Key *key, struct KeyBlock *kb);
/* conversion functions */
/* Note: 'update_from' versions do not (re)allocate mem in kb, while 'convert_from' do. */
/* NOTE: 'update_from' versions do not (re)allocate mem in kb, while 'convert_from' do. */
void BKE_keyblock_update_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
void BKE_keyblock_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
void BKE_keyblock_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt);
int BKE_keyblock_curve_element_count(struct ListBase *nurb);
int BKE_keyblock_curve_element_count(const struct ListBase *nurb);
void BKE_keyblock_curve_data_transform(const struct ListBase *nurb,
const float mat[4][4],
const void *src,

View File

@@ -92,7 +92,7 @@ bool BKE_layer_collection_activate(struct ViewLayer *view_layer, struct LayerCol
struct LayerCollection *BKE_layer_collection_activate_parent(struct ViewLayer *view_layer,
struct LayerCollection *lc);
int BKE_layer_collection_count(struct ViewLayer *view_layer);
int BKE_layer_collection_count(const struct ViewLayer *view_layer);
struct LayerCollection *BKE_layer_collection_from_index(struct ViewLayer *view_layer,
const int index);
@@ -107,8 +107,8 @@ void BKE_layer_collection_local_sync_all(const struct Main *bmain);
void BKE_main_collection_sync_remap(const struct Main *bmain);
struct LayerCollection *BKE_layer_collection_first_from_scene_collection(
struct ViewLayer *view_layer, const struct Collection *collection);
bool BKE_view_layer_has_collection(struct ViewLayer *view_layer,
const struct ViewLayer *view_layer, const struct Collection *collection);
bool BKE_view_layer_has_collection(const struct ViewLayer *view_layer,
const struct Collection *collection);
bool BKE_scene_has_object(struct Scene *scene, struct Object *ob);
@@ -367,7 +367,7 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter);
struct ObjectsInViewLayerParams {
uint no_dup_data : 1;
bool (*filter_fn)(struct Object *ob, void *user_data);
bool (*filter_fn)(const struct Object *ob, void *user_data);
void *filter_userdata;
};
@@ -388,7 +388,7 @@ struct ObjectsInModeParams {
int object_mode;
uint no_dup_data : 1;
bool (*filter_fn)(struct Object *ob, void *user_data);
bool (*filter_fn)(const struct Object *ob, void *user_data);
void *filter_userdata;
};
@@ -412,8 +412,8 @@ struct Object **BKE_view_layer_array_from_objects_in_mode_params(
BKE_view_layer_array_from_bases_in_mode_params( \
view_layer, v3d, r_len, &(const struct ObjectsInModeParams)__VA_ARGS__)
bool BKE_view_layer_filter_edit_mesh_has_uvs(struct Object *ob, void *user_data);
bool BKE_view_layer_filter_edit_mesh_has_edges(struct Object *ob, void *user_data);
bool BKE_view_layer_filter_edit_mesh_has_uvs(const struct Object *ob, void *user_data);
bool BKE_view_layer_filter_edit_mesh_has_edges(const struct Object *ob, void *user_data);
/* Utility macros that wrap common args (add more as needed). */

View File

@@ -99,6 +99,8 @@ void BKE_lib_override_library_main_resync(struct Main *bmain,
void BKE_lib_override_library_delete(struct Main *bmain, struct ID *id_root);
void BKE_lib_override_library_make_local(struct ID *id);
struct IDOverrideLibraryProperty *BKE_lib_override_library_property_find(
struct IDOverrideLibrary *override, const char *rna_path);
struct IDOverrideLibraryProperty *BKE_lib_override_library_property_get(

View File

@@ -91,7 +91,7 @@ enum {
ID_REMAP_FORCE_USER_REFCOUNT = 1 << 8,
};
/* Note: Requiring new_id to be non-null, this *may* not be the case ultimately,
/* NOTE: Requiring new_id to be non-null, this *may* not be the case ultimately,
* but makes things simpler for now. */
void BKE_libblock_remap_locked(struct Main *bmain,
void *old_idv,

View File

@@ -100,7 +100,7 @@ typedef struct MainIDRelations {
/* Mapping from an ID pointer to all of its parents (IDs using it) and children (IDs it uses).
* Values are `MainIDRelationsEntry` pointers. */
struct GHash *relations_from_pointers;
/* Note: we could add more mappings when needed (e.g. from session uuid?). */
/* NOTE: we could add more mappings when needed (e.g. from session uuid?). */
short flag;

View File

@@ -128,7 +128,8 @@ struct Mesh *BKE_mesh_copy_for_eval(struct Mesh *source, bool reference);
/* These functions construct a new Mesh,
* contrary to BKE_mesh_from_nurbs which modifies ob itself. */
struct Mesh *BKE_mesh_new_nomain_from_curve(struct Object *ob);
struct Mesh *BKE_mesh_new_nomain_from_curve_displist(struct Object *ob, struct ListBase *dispbase);
struct Mesh *BKE_mesh_new_nomain_from_curve_displist(const struct Object *ob,
const struct ListBase *dispbase);
bool BKE_mesh_ensure_facemap_customdata(struct Mesh *me);
bool BKE_mesh_clear_facemap_customdata(struct Mesh *me);
@@ -151,7 +152,7 @@ int BKE_mesh_nurbs_to_mdata(struct Object *ob,
struct MPoly **r_allpoly,
int *r_totloop,
int *r_totpoly);
int BKE_mesh_nurbs_displist_to_mdata(struct Object *ob,
int BKE_mesh_nurbs_displist_to_mdata(const struct Object *ob,
const struct ListBase *dispbase,
struct MVert **r_allvert,
int *r_totvert,
@@ -298,7 +299,7 @@ void BKE_mesh_recalc_looptri_with_normals(const struct MLoop *mloop,
struct MLoopTri *mlooptri,
const float (*poly_normals)[3]);
/* *** mesh_evaluate.c *** */
/* *** mesh_normals.c *** */
void BKE_mesh_calc_normals_mapping_simple(struct Mesh *me);
void BKE_mesh_calc_normals_mapping(struct MVert *mverts,
@@ -493,6 +494,8 @@ void BKE_mesh_calc_normals_split_ex(struct Mesh *mesh,
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loopnors)[3]);
void BKE_mesh_set_custom_normals_from_vertices(struct Mesh *mesh, float (*r_custom_vertnors)[3]);
/* *** mesh_evaluate.c *** */
void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly,
const struct MLoop *loopstart,
const struct MVert *mvarray,

View File

@@ -115,7 +115,7 @@ enum {
MREMAP_USE_INTERP,
/* ***** Target's loops ***** */
/* Note: when islands are given to loop mapping func,
/* NOTE: when islands are given to loop mapping func,
* all loops from the same destination face will always be mapped
* to loops of source faces within a same island, regardless of mapping mode. */
MREMAP_MODE_LOOP = 1 << 26,

View File

@@ -45,7 +45,7 @@ void BKE_mesh_runtime_reset(struct Mesh *mesh);
void BKE_mesh_runtime_reset_on_copy(struct Mesh *mesh, const int flag);
int BKE_mesh_runtime_looptri_len(const struct Mesh *mesh);
void BKE_mesh_runtime_looptri_recalc(struct Mesh *mesh);
const struct MLoopTri *BKE_mesh_runtime_looptri_ensure(struct Mesh *mesh);
const struct MLoopTri *BKE_mesh_runtime_looptri_ensure(const struct Mesh *mesh);
bool BKE_mesh_runtime_ensure_edit_data(struct Mesh *mesh);
bool BKE_mesh_runtime_clear_edit_data(struct Mesh *mesh);
bool BKE_mesh_runtime_reset_edit_data(struct Mesh *mesh);

View File

@@ -156,10 +156,10 @@ enum eNlaTime_ConvertModes {
/* convert from global time to strip time - for evaluation */
NLATIME_CONVERT_EVAL = 0,
/* convert from global time to strip time - for editing corrections */
// XXX old 0 invert
/* XXX: old 0 invert. */
NLATIME_CONVERT_UNMAP,
/* convert from strip time to global time */
// xxx old 1 invert
/* XXX: old 1 invert. */
NLATIME_CONVERT_MAP,
};

View File

@@ -965,7 +965,7 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree,
/** \name Shader Nodes
* \{ */
/* note: types are needed to restore callbacks, don't change values */
/* NOTE: types are needed to restore callbacks, don't change values. */
/* range 1 - 100 is reserved for common nodes */
/* using toolbox, we add node groups by assuming the values below
* don't exceed NODE_GROUP_MENU for now. */
@@ -1132,7 +1132,7 @@ void ntreeGPUMaterialNodes(struct bNodeTree *localtree,
// #define RRES_OUT_SUBSURFACE_COLOR 30
// #define RRES_OUT_DEBUG 31
/* note: types are needed to restore callbacks, don't change values */
/* NOTE: types are needed to restore callbacks, don't change values. */
#define CMP_NODE_VIEWER 201
#define CMP_NODE_RGB 202
#define CMP_NODE_VALUE 203
@@ -1439,6 +1439,11 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
#define GEO_NODE_SEPARATE_COMPONENTS 1059
#define GEO_NODE_CURVE_SUBDIVIDE 1060
#define GEO_NODE_RAYCAST 1061
#define GEO_NODE_CURVE_PRIMITIVE_STAR 1062
#define GEO_NODE_CURVE_PRIMITIVE_SPIRAL 1063
#define GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER 1064
#define GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT 1065
#define GEO_NODE_CURVE_PRIMITIVE_CIRCLE 1066
/** \} */

View File

@@ -243,7 +243,7 @@ void BKE_object_dimensions_set(struct Object *ob, const float value[3], int axis
void BKE_object_empty_draw_type_set(struct Object *ob, const int value);
void BKE_object_boundbox_flag(struct Object *ob, int flag, const bool set);
void BKE_object_boundbox_calc_from_mesh(struct Object *ob, struct Mesh *me_eval);
void BKE_object_boundbox_calc_from_mesh(struct Object *ob, const struct Mesh *me_eval);
void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden);
bool BKE_object_minmax_dupli(struct Depsgraph *depsgraph,
struct Scene *scene,

View File

@@ -329,7 +329,7 @@ bool BKE_pbvh_is_deformed(struct PBVH *pbvh);
* - allow the compiler to eliminate dead code and variables
* - spend most of the time in the relatively simple inner loop */
/* note: PBVH_ITER_ALL does not skip hidden vertices,
/* NOTE: PBVH_ITER_ALL does not skip hidden vertices,
* PBVH_ITER_UNIQUE does */
#define PBVH_ITER_ALL 0
#define PBVH_ITER_UNIQUE 1
@@ -474,7 +474,7 @@ bool BKE_pbvh_node_vert_update_check_any(PBVH *pbvh, PBVHNode *node);
// void BKE_pbvh_node_BB_reset(PBVHNode *node);
// void BKE_pbvh_node_BB_expand(PBVHNode *node, float co[3]);
bool pbvh_has_mask(PBVH *pbvh);
bool pbvh_has_mask(const PBVH *pbvh);
void pbvh_show_mask_set(PBVH *pbvh, bool show_mask);
bool pbvh_has_face_sets(PBVH *pbvh);

View File

@@ -172,7 +172,7 @@ void BKE_shaderfx_copydata_ex(struct ShaderFxData *fx,
void BKE_shaderfx_copy(struct ListBase *dst, const struct ListBase *src);
void BKE_shaderfx_foreach_ID_link(struct Object *ob, ShaderFxIDWalkFunc walk, void *userData);
bool BKE_shaderfx_has_gpencil(struct Object *ob);
bool BKE_shaderfx_has_gpencil(const struct Object *ob);
void BKE_shaderfx_blend_write(struct BlendWriter *writer, struct ListBase *fxbase);
void BKE_shaderfx_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb);

View File

@@ -32,6 +32,7 @@
#include "BKE_attribute_math.hh"
struct Curve;
struct ListBase;
class Spline;
using SplinePtr = std::unique_ptr<Spline>;
@@ -546,4 +547,6 @@ struct CurveEval {
void assert_valid_point_attributes() const;
};
std::unique_ptr<CurveEval> curve_eval_from_dna_curve(const Curve &curve);
std::unique_ptr<CurveEval> curve_eval_from_dna_curve(const Curve &curve,
const ListBase &nurbs_list);
std::unique_ptr<CurveEval> curve_eval_from_dna_curve(const Curve &dna_curve);

View File

@@ -48,7 +48,7 @@ char *txt_to_buf(struct Text *text, int *r_buf_strlen);
void txt_clean_text(struct Text *text);
void txt_order_cursors(struct Text *text, const bool reverse);
int txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case);
bool txt_has_sel(struct Text *text);
bool txt_has_sel(const struct Text *text);
int txt_get_span(struct TextLine *from, struct TextLine *to);
void txt_move_up(struct Text *text, const bool sel);
void txt_move_down(struct Text *text, const bool sel);
@@ -85,8 +85,8 @@ bool txt_uncomment(struct Text *text);
void txt_move_lines(struct Text *text, const int direction);
void txt_duplicate_line(struct Text *text);
int txt_setcurr_tab_spaces(struct Text *text, int space);
bool txt_cursor_is_line_start(struct Text *text);
bool txt_cursor_is_line_end(struct Text *text);
bool txt_cursor_is_line_start(const struct Text *text);
bool txt_cursor_is_line_end(const struct Text *text);
int txt_calc_tab_left(struct TextLine *tl, int ch);
int txt_calc_tab_right(struct TextLine *tl, int ch);

View File

@@ -161,7 +161,7 @@ struct MovieTrackingMarker *BKE_tracking_marker_get_exact(struct MovieTrackingTr
struct MovieTrackingMarker *BKE_tracking_marker_ensure(struct MovieTrackingTrack *track,
int framenr);
/* Get marker position, possibly interpolating interpolating gap between keyframed/tracked markers.
/* Get marker position, possibly interpolating gap between key-framed/tracked markers.
*
* The result marker frame number is set to the requested frame number. Its flags are 0 if the
* marker is interpolated, and is set to original marker flag if there were no interpolation

View File

@@ -178,7 +178,7 @@ UndoStack *BKE_undosys_stack_create(void);
void BKE_undosys_stack_destroy(UndoStack *ustack);
void BKE_undosys_stack_clear(UndoStack *ustack);
void BKE_undosys_stack_clear_active(UndoStack *ustack);
bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name);
bool BKE_undosys_stack_has_undo(const UndoStack *ustack, const char *name);
void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain);
void BKE_undosys_stack_init_from_context(UndoStack *ustack, struct bContext *C);
UndoStep *BKE_undosys_stack_active_with_type(UndoStack *ustack, const UndoType *ut);

View File

@@ -93,7 +93,7 @@ set(SRC
intern/boids.c
intern/bpath.c
intern/brush.c
intern/bvhutils.c
intern/bvhutils.cc
intern/cachefile.c
intern/callbacks.c
intern/camera.c
@@ -190,6 +190,7 @@ set(SRC
intern/mesh_mapping.c
intern/mesh_merge.c
intern/mesh_mirror.c
intern/mesh_normals.c
intern/mesh_remap.c
intern/mesh_remesh_voxel.c
intern/mesh_runtime.c

View File

@@ -829,7 +829,7 @@ static void mesh_calc_modifier_final_normals(const Mesh *mesh_input,
}
if (do_loop_normals) {
/* Compute loop normals (note: will compute poly and vert normals as well, if needed!) */
/* Compute loop normals (NOTE: will compute poly and vert normals as well, if needed!). */
BKE_mesh_calc_normals_split(mesh_final);
BKE_mesh_tessface_clear(mesh_final);
}
@@ -973,7 +973,7 @@ static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md,
static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
Scene *scene,
Object *ob,
int useDeform,
const bool use_deform,
const bool need_mapping,
const CustomData_MeshMasks *dataMask,
const int index,
@@ -1068,7 +1068,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
BKE_modifiers_clear_errors(ob);
/* Apply all leading deform modifiers. */
if (useDeform) {
if (use_deform) {
for (; md; md = md->next, md_datamask = md_datamask->next) {
const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type);
@@ -1076,10 +1076,6 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
continue;
}
if (useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) {
continue;
}
if (mti->type == eModifierTypeType_OnlyDeform && !sculpt_dyntopo) {
if (!deformed_verts) {
deformed_verts = BKE_mesh_vert_coords_alloc(mesh_input, &num_deformed_verts);
@@ -1128,7 +1124,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
continue;
}
if (mti->type == eModifierTypeType_OnlyDeform && !useDeform) {
if (mti->type == eModifierTypeType_OnlyDeform && !use_deform) {
continue;
}
@@ -1173,10 +1169,6 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
continue;
}
if (useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) {
continue;
}
/* Add orco mesh as layer if needed by this modifier. */
if (mesh_final && mesh_orco && mti->requiredDataMask) {
CustomData_MeshMasks mask = {0};
@@ -1412,7 +1404,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
* we need to apply these back onto the Mesh. If we have no
* Mesh then we need to build one. */
if (mesh_final == nullptr) {
/* Note: this check on cdmask is a bit dodgy, it handles the issue at stake here (see T68211),
/* NOTE: this check on cdmask is a bit dodgy, it handles the issue at stake here (see T68211),
* but other cases might require similar handling?
* Could be a good idea to define a proper CustomData_MeshMask for that then. */
if (deformed_verts == nullptr && allow_shared_mesh &&
@@ -1937,7 +1929,7 @@ static void mesh_build_data(struct Depsgraph *depsgraph,
mesh_calc_modifiers(depsgraph,
scene,
ob,
1,
true,
need_mapping,
dataMask,
-1,
@@ -2162,7 +2154,7 @@ Mesh *mesh_create_eval_final(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 1, false, dataMask, -1, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, true, false, dataMask, -1, false, false, nullptr, &final, nullptr);
return final;
}
@@ -2176,7 +2168,7 @@ Mesh *mesh_create_eval_final_index_render(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 1, false, dataMask, index, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, true, false, dataMask, index, false, false, nullptr, &final, nullptr);
return final;
}
@@ -2189,7 +2181,7 @@ Mesh *mesh_create_eval_no_deform(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 0, false, dataMask, -1, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, false, false, dataMask, -1, false, false, nullptr, &final, nullptr);
return final;
}
@@ -2202,7 +2194,7 @@ Mesh *mesh_create_eval_no_deform_render(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 0, false, dataMask, -1, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, false, false, dataMask, -1, false, false, nullptr, &final, nullptr);
return final;
}
@@ -2426,7 +2418,7 @@ static void dm_debug_info_layers(DynStr *dynstr,
for (type = 0; type < CD_NUMTYPES; type++) {
if (CustomData_has_layer(cd, type)) {
/* note: doesn't account for multiple layers */
/* NOTE: doesn't account for multiple layers. */
const char *name = CustomData_layertype_name(type);
const int size = CustomData_sizeof(type);
const void *pt = getElemDataArray(dm, type);

View File

@@ -120,7 +120,7 @@ static void action_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src,
for (fcurve_src = action_src->curves.first; fcurve_src; fcurve_src = fcurve_src->next) {
/* Duplicate F-Curve. */
/* XXX TODO pass subdata flag?
/* XXX TODO: pass subdata flag?
* But surprisingly does not seem to be doing any ID refcounting... */
fcurve_dst = BKE_fcurve_copy(fcurve_src);

View File

@@ -336,7 +336,7 @@ AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const int flag)
* BKE_id_copy_ex().
* So in case we do copy the ID and its sub-IDs in bmain, silence the 'no usercount' flag for
* the sub-IDs copying.
* Note: This is a bit weak, as usually when it comes to recursive ID copy. Should work for
* NOTE: This is a bit weak, as usually when it comes to recursive ID copy. Should work for
* now, but we may have to revisit this at some point and add a proper extra flag to deal with
* that situation. Or refactor completely the way we handle such recursion, by flattening it
* e.g. */
@@ -1563,7 +1563,7 @@ void BKE_animdata_blend_write(BlendWriter *writer, struct AnimData *adt)
BLO_write_string(writer, aor->rna_path);
}
/* TODO write the remaps (if they are needed) */
/* TODO: write the remaps (if they are needed). */
/* write NLA data */
BKE_nla_blend_write(writer, &adt->nla_tracks);

View File

@@ -2746,7 +2746,7 @@ static void animsys_evaluate_nla_for_keyframing(PointerRNA *ptr,
}
}
/** Note: Although we early out, we can still keyframe to the non-pushed action since the
/** NOTE: Although we early out, we can still keyframe to the non-pushed action since the
* keyframe remap function detects (r_context->strip.act == NULL) and will keyframe without
* remapping.
*/
@@ -3126,7 +3126,7 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt)
*
* 3) Drivers/expressions are evaluated on top of this, in an order where dependencies are
* resolved nicely.
* Note: it may be necessary to have some tools to handle the cases where some higher-level
* NOTE: it may be necessary to have some tools to handle the cases where some higher-level
* drivers are added and cause some problematic dependencies that
* didn't exist in the local levels...
*

View File

@@ -50,8 +50,8 @@ void animviz_settings_init(bAnimVizSettings *avs)
/* path settings */
avs->path_bc = avs->path_ac = 10;
avs->path_sf = 1; /* xxx - take from scene instead? */
avs->path_ef = 250; /* xxx - take from scene instead? */
avs->path_sf = 1; /* XXX: Take from scene instead? */
avs->path_ef = 250; /* XXX: Take from scene instead? */
avs->path_viewflag = (MOTIONPATH_VIEW_KFRAS | MOTIONPATH_VIEW_KFNOS);

View File

@@ -358,7 +358,7 @@ bArmature *BKE_armature_from_object(Object *ob)
return NULL;
}
int BKE_armature_bonelist_count(ListBase *lb)
int BKE_armature_bonelist_count(const ListBase *lb)
{
int i = 0;
LISTBASE_FOREACH (Bone *, bone, lb) {
@@ -2405,9 +2405,9 @@ static void pose_proxy_sync(Object *ob, Object *from, int layer_protected)
BKE_pose_rest(frompose, false);
/* copy over all of the proxy's bone groups */
/* TODO for later
/* TODO: for later
* - implement 'local' bone groups as for constraints
* Note: this isn't trivial, as bones reference groups by index not by pointer,
* NOTE: this isn't trivial, as bones reference groups by index not by pointer,
* so syncing things correctly needs careful attention */
BLI_freelistN(&pose->agroups);
BLI_duplicatelist(&pose->agroups, &frompose->agroups);
@@ -2543,7 +2543,7 @@ static int rebuild_pose_bone(
* (grand-(grand-(...)))-child (as processed by the recursive, depth-first nature of this
* function) of the previous sibling.
*
* Note: In most cases there is nothing to do here, but pose list may get out of order when some
* NOTE: In most cases there is nothing to do here, but pose list may get out of order when some
* bones are added, removed or moved in the armature data. */
bPoseChannel *pchan_prev = pchan->prev;
const Bone *last_visited_bone = *r_last_visited_bone_p;

View File

@@ -18,7 +18,7 @@
* \ingroup bli
*/
/* TODO,
/* TODO:
* currently there are some cases we don't support.
* - passing output paths to the visitor?, like render out.
* - passing sequence strips with many images.

View File

@@ -379,10 +379,10 @@ static void brush_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old)
BKE_lib_id_swap(NULL, id_new, id_old);
/* `id_new` now has content from `id_old`, we need to ensure those old ID pointers are valid.
* Note: Since we want to re-use all old pointers here, code is much simpler than for Scene. */
* NOTE: Since we want to re-use all old pointers here, code is much simpler than for Scene. */
BKE_library_foreach_ID_link(NULL, id_new, brush_undo_preserve_cb, reader, IDWALK_NOP);
/* Note: We do not swap IDProperties, as dealing with potential ID pointers in those would be
/* NOTE: We do not swap IDProperties, as dealing with potential ID pointers in those would be
* fairly delicate. */
SWAP(IDProperty *, id_new->properties, id_old->properties);
}

View File

@@ -21,9 +21,9 @@
* \ingroup bke
*/
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <cstring>
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -46,15 +46,15 @@
/** \name BVHCache
* \{ */
typedef struct BVHCacheItem {
struct BVHCacheItem {
bool is_filled;
BVHTree *tree;
} BVHCacheItem;
};
typedef struct BVHCache {
struct BVHCache {
BVHCacheItem items[BVHTREE_MAX_ITEM];
ThreadMutex mutex;
} BVHCache;
};
/**
* Queries a bvhcache for the cache bvhtree of the request type
@@ -74,14 +74,14 @@ static bool bvhcache_find(BVHCache **bvh_cache_p,
if (r_locked) {
*r_locked = false;
}
if (*bvh_cache_p == NULL) {
if (*bvh_cache_p == nullptr) {
if (!do_lock) {
/* Cache does not exist and no lock is requested. */
return false;
}
/* Lazy initialization of the bvh_cache using the `mesh_eval_mutex`. */
BLI_mutex_lock(mesh_eval_mutex);
if (*bvh_cache_p == NULL) {
if (*bvh_cache_p == nullptr) {
*bvh_cache_p = bvhcache_init();
}
BLI_mutex_unlock(mesh_eval_mutex);
@@ -94,7 +94,7 @@ static bool bvhcache_find(BVHCache **bvh_cache_p,
}
if (do_lock) {
BLI_mutex_lock(&bvh_cache->mutex);
bool in_cache = bvhcache_find(bvh_cache_p, type, r_tree, NULL, NULL);
bool in_cache = bvhcache_find(bvh_cache_p, type, r_tree, nullptr, nullptr);
if (in_cache) {
BLI_mutex_unlock(&bvh_cache->mutex);
return in_cache;
@@ -113,11 +113,11 @@ static void bvhcache_unlock(BVHCache *bvh_cache, bool lock_started)
bool bvhcache_has_tree(const BVHCache *bvh_cache, const BVHTree *tree)
{
if (bvh_cache == NULL) {
if (bvh_cache == nullptr) {
return false;
}
for (BVHCacheType i = 0; i < BVHTREE_MAX_ITEM; i++) {
for (int i = 0; i < BVHTREE_MAX_ITEM; i++) {
if (bvh_cache->items[i].tree == tree) {
return true;
}
@@ -127,7 +127,7 @@ bool bvhcache_has_tree(const BVHCache *bvh_cache, const BVHTree *tree)
BVHCache *bvhcache_init(void)
{
BVHCache *cache = MEM_callocN(sizeof(BVHCache), __func__);
BVHCache *cache = (BVHCache *)MEM_callocN(sizeof(BVHCache), __func__);
BLI_mutex_init(&cache->mutex);
return cache;
}
@@ -137,7 +137,7 @@ BVHCache *bvhcache_init(void)
* as that will be done when the cache is freed.
*
* A call to this assumes that there was no previous cached tree of the given type
* \warning The #BVHTree can be NULL.
* \warning The #BVHTree can be nullptr.
*/
static void bvhcache_insert(BVHCache *bvh_cache, BVHTree *tree, BVHCacheType type)
{
@@ -152,10 +152,10 @@ static void bvhcache_insert(BVHCache *bvh_cache, BVHTree *tree, BVHCacheType typ
*/
void bvhcache_free(BVHCache *bvh_cache)
{
for (BVHCacheType index = 0; index < BVHTREE_MAX_ITEM; index++) {
for (int index = 0; index < BVHTREE_MAX_ITEM; index++) {
BVHCacheItem *item = &bvh_cache->items[index];
BLI_bvhtree_free(item->tree);
item->tree = NULL;
item->tree = nullptr;
}
BLI_mutex_end(&bvh_cache->mutex);
MEM_freeN(bvh_cache);
@@ -197,9 +197,10 @@ float bvhtree_ray_tri_intersection(const BVHTreeRay *ray,
float dist;
#ifdef USE_KDOPBVH_WATERTIGHT
if (isect_ray_tri_watertight_v3(ray->origin, ray->isect_precalc, v0, v1, v2, &dist, NULL))
if (isect_ray_tri_watertight_v3(ray->origin, ray->isect_precalc, v0, v1, v2, &dist, nullptr))
#else
if (isect_ray_tri_epsilon_v3(ray->origin, ray->direction, v0, v1, v2, &dist, NULL, FLT_EPSILON))
if (isect_ray_tri_epsilon_v3(
ray->origin, ray->direction, v0, v1, v2, &dist, nullptr, FLT_EPSILON))
#endif
{
return dist;
@@ -247,7 +248,7 @@ static void mesh_faces_nearest_point(void *userdata,
t0 = vert[face->v1].co;
t1 = vert[face->v2].co;
t2 = vert[face->v3].co;
t3 = face->v4 ? vert[face->v4].co : NULL;
t3 = face->v4 ? vert[face->v4].co : nullptr;
do {
float nearest_tmp[3], dist_sq;
@@ -264,7 +265,7 @@ static void mesh_faces_nearest_point(void *userdata,
t1 = t2;
t2 = t3;
t3 = NULL;
t3 = nullptr;
} while (t2);
}
@@ -300,7 +301,7 @@ static void editmesh_looptri_nearest_point(void *userdata,
const float co[3],
BVHTreeNearest *nearest)
{
const BVHTreeFromEditMesh *data = userdata;
const BVHTreeFromEditMesh *data = (const BVHTreeFromEditMesh *)userdata;
BMEditMesh *em = data->em;
const BMLoop **ltri = (const BMLoop **)em->looptris[index];
@@ -339,7 +340,7 @@ static void mesh_faces_spherecast(void *userdata,
t0 = vert[face->v1].co;
t1 = vert[face->v2].co;
t2 = vert[face->v3].co;
t3 = face->v4 ? vert[face->v4].co : NULL;
t3 = face->v4 ? vert[face->v4].co : nullptr;
do {
float dist;
@@ -360,7 +361,7 @@ static void mesh_faces_spherecast(void *userdata,
t1 = t2;
t2 = t3;
t3 = NULL;
t3 = nullptr;
} while (t2);
}
@@ -457,7 +458,7 @@ static void mesh_edges_nearest_point(void *userdata,
}
}
/* Helper, does all the point-spherecast work actually. */
/* Helper, does all the point-sphere-cast work actually. */
static void mesh_verts_spherecast_do(int index,
const float v[3],
const BVHTreeRay *ray,
@@ -484,7 +485,7 @@ static void editmesh_verts_spherecast(void *userdata,
const BVHTreeRay *ray,
BVHTreeRayHit *hit)
{
const BVHTreeFromEditMesh *data = userdata;
const BVHTreeFromEditMesh *data = (const BVHTreeFromEditMesh *)userdata;
BMVert *eve = BM_vert_at_index(data->em->bm, index);
mesh_verts_spherecast_do(index, eve->co, ray, hit);
@@ -600,7 +601,7 @@ static BVHTree *bvhtree_from_mesh_verts_create_tree(float epsilon,
const BLI_bitmap *verts_mask,
int verts_num_active)
{
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (verts_mask) {
BLI_assert(IN_RANGE_INCL(verts_num_active, 0, verts_num));
@@ -637,9 +638,9 @@ static void bvhtree_from_mesh_verts_setup_data(BVHTreeFromMesh *data,
data->tree = tree;
data->cached = is_cached;
/* a NULL nearest callback works fine
/* a nullptr nearest callback works fine
* remember the min distance to point is the same as the min distance to BV of point */
data->nearest_callback = NULL;
data->nearest_callback = nullptr;
data->raycast_callback = mesh_verts_spherecast;
data->vert = vert;
@@ -658,7 +659,7 @@ BVHTree *bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
{
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
bool lock_started = false;
@@ -671,7 +672,7 @@ BVHTree *bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data,
bvhtree_balance(tree, true);
/* Save on cache for later use */
/* printf("BVHTree built and saved on cache\n"); */
// printf("BVHTree built and saved on cache\n");
bvhcache_insert(*bvh_cache_p, tree, bvh_cache_type);
data->cached = true;
}
@@ -687,9 +688,9 @@ BVHTree *bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data,
memset(data, 0, sizeof(*data));
data->tree = tree;
data->em = em;
data->nearest_callback = NULL;
data->nearest_callback = nullptr;
data->raycast_callback = editmesh_verts_spherecast;
data->cached = bvh_cache_p != NULL;
data->cached = bvh_cache_p != nullptr;
}
return tree;
@@ -699,11 +700,11 @@ BVHTree *bvhtree_from_editmesh_verts(
BVHTreeFromEditMesh *data, BMEditMesh *em, float epsilon, int tree_type, int axis)
{
return bvhtree_from_editmesh_verts_ex(
data, em, NULL, -1, epsilon, tree_type, axis, 0, NULL, NULL);
data, em, nullptr, -1, epsilon, tree_type, axis, BVHTREE_FROM_VERTS, nullptr, nullptr);
}
/**
* Builds a bvh tree where nodes are the given vertices (note: does not copy given mverts!).
* Builds a bvh tree where nodes are the given vertices (NOTE: does not copy given `vert`!).
* \param vert_allocated: if true, vert freeing will be done when freeing data.
* \param verts_mask: if not null, true elements give which vert to add to BVH tree.
* \param verts_num_active: if >= 0, number of active verts to add to BVH tree
@@ -724,7 +725,7 @@ BVHTree *bvhtree_from_mesh_verts_ex(BVHTreeFromMesh *data,
{
bool in_cache = false;
bool lock_started = false;
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
in_cache = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, &lock_started, mesh_eval_mutex);
}
@@ -732,11 +733,11 @@ BVHTree *bvhtree_from_mesh_verts_ex(BVHTreeFromMesh *data,
if (in_cache == false) {
tree = bvhtree_from_mesh_verts_create_tree(
epsilon, tree_type, axis, vert, verts_num, verts_mask, verts_num_active);
bvhtree_balance(tree, bvh_cache_p != NULL);
bvhtree_balance(tree, bvh_cache_p != nullptr);
if (bvh_cache_p) {
/* Save on cache for later use */
/* printf("BVHTree built and saved on cache\n"); */
// printf("BVHTree built and saved on cache\n");
BVHCache *bvh_cache = *bvh_cache_p;
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
in_cache = true;
@@ -807,7 +808,7 @@ static BVHTree *bvhtree_from_mesh_edges_create_tree(const MVert *vert,
int tree_type,
int axis)
{
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (edges_mask) {
BLI_assert(IN_RANGE_INCL(edges_num_active, 0, edge_num));
@@ -817,7 +818,7 @@ static BVHTree *bvhtree_from_mesh_edges_create_tree(const MVert *vert,
}
if (edges_num_active) {
/* Create a bvh-tree of the given target */
/* Create a BVH-tree of the given target */
tree = BLI_bvhtree_new(edges_num_active, epsilon, tree_type, axis);
if (tree) {
for (int i = 0; i < edge_num; i++) {
@@ -871,7 +872,7 @@ BVHTree *bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
{
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
bool lock_started = false;
@@ -883,7 +884,7 @@ BVHTree *bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data,
epsilon, tree_type, axis, em, edges_mask, edges_num_active);
bvhtree_balance(tree, true);
/* Save on cache for later use */
/* printf("BVHTree built and saved on cache\n"); */
// printf("BVHTree built and saved on cache\n");
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
data->cached = true;
}
@@ -899,9 +900,9 @@ BVHTree *bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data,
memset(data, 0, sizeof(*data));
data->tree = tree;
data->em = em;
data->nearest_callback = NULL; /* TODO */
data->raycast_callback = NULL; /* TODO */
data->cached = bvh_cache_p != NULL;
data->nearest_callback = nullptr; /* TODO */
data->raycast_callback = nullptr; /* TODO */
data->cached = bvh_cache_p != nullptr;
}
return tree;
@@ -911,7 +912,7 @@ BVHTree *bvhtree_from_editmesh_edges(
BVHTreeFromEditMesh *data, BMEditMesh *em, float epsilon, int tree_type, int axis)
{
return bvhtree_from_editmesh_edges_ex(
data, em, NULL, -1, epsilon, tree_type, axis, 0, NULL, NULL);
data, em, nullptr, -1, epsilon, tree_type, axis, BVHTREE_FROM_VERTS, nullptr, nullptr);
}
/**
@@ -939,7 +940,7 @@ BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data,
{
bool in_cache = false;
bool lock_started = false;
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
in_cache = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, &lock_started, mesh_eval_mutex);
}
@@ -953,7 +954,7 @@ BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data,
BVHCache *bvh_cache = *bvh_cache_p;
/* Save on cache for later use */
/* printf("BVHTree built and saved on cache\n"); */
// printf("BVHTree built and saved on cache\n");
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
in_cache = true;
}
@@ -988,7 +989,7 @@ static BVHTree *bvhtree_from_mesh_faces_create_tree(float epsilon,
const BLI_bitmap *faces_mask,
int faces_num_active)
{
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (faces_num) {
if (faces_mask) {
@@ -998,8 +999,8 @@ static BVHTree *bvhtree_from_mesh_faces_create_tree(float epsilon,
faces_num_active = faces_num;
}
/* Create a bvh-tree of the given target */
/* printf("%s: building BVH, total=%d\n", __func__, numFaces); */
/* Create a BVH-tree of the given target. */
// printf("%s: building BVH, total=%d\n", __func__, numFaces);
tree = BLI_bvhtree_new(faces_num_active, epsilon, tree_type, axis);
if (tree) {
if (vert && face) {
@@ -1050,7 +1051,7 @@ static void bvhtree_from_mesh_faces_setup_data(BVHTreeFromMesh *data,
/**
* Builds a bvh tree where nodes are the given tessellated faces
* (note: does not copy given mfaces!).
* (NOTE: does not copy given mfaces!).
* \param vert_allocated: if true, vert freeing will be done when freeing data.
* \param face_allocated: if true, face freeing will be done when freeing data.
* \param faces_mask: if not null, true elements give which faces to add to BVH tree.
@@ -1074,7 +1075,7 @@ BVHTree *bvhtree_from_mesh_faces_ex(BVHTreeFromMesh *data,
{
bool in_cache = false;
bool lock_started = false;
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
in_cache = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, &lock_started, mesh_eval_mutex);
}
@@ -1082,11 +1083,11 @@ BVHTree *bvhtree_from_mesh_faces_ex(BVHTreeFromMesh *data,
if (in_cache == false) {
tree = bvhtree_from_mesh_faces_create_tree(
epsilon, tree_type, axis, vert, face, numFaces, faces_mask, faces_num_active);
bvhtree_balance(tree, bvh_cache_p != NULL);
bvhtree_balance(tree, bvh_cache_p != nullptr);
if (bvh_cache_p) {
/* Save on cache for later use */
/* printf("BVHTree built and saved on cache\n"); */
// printf("BVHTree built and saved on cache\n");
BVHCache *bvh_cache = *bvh_cache_p;
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
in_cache = true;
@@ -1117,7 +1118,7 @@ static BVHTree *bvhtree_from_editmesh_looptri_create_tree(float epsilon,
const BLI_bitmap *looptri_mask,
int looptri_num_active)
{
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
const int looptri_num = em->tottri;
if (looptri_num) {
@@ -1128,11 +1129,11 @@ static BVHTree *bvhtree_from_editmesh_looptri_create_tree(float epsilon,
looptri_num_active = looptri_num;
}
/* Create a bvh-tree of the given target */
/* printf("%s: building BVH, total=%d\n", __func__, numFaces); */
/* Create a BVH-tree of the given target */
// printf("%s: building BVH, total=%d\n", __func__, numFaces);
tree = BLI_bvhtree_new(looptri_num_active, epsilon, tree_type, axis);
if (tree) {
const struct BMLoop *(*looptris)[3] = (void *)em->looptris;
const BMLoop *(*looptris)[3] = (const BMLoop *(*)[3])em->looptris;
/* Insert BMesh-tessellation triangles into the bvh tree, unless they are hidden
* and/or selected. Even if the faces themselves are not selected for the snapped
@@ -1169,7 +1170,7 @@ static BVHTree *bvhtree_from_mesh_looptri_create_tree(float epsilon,
const BLI_bitmap *looptri_mask,
int looptri_num_active)
{
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (looptri_mask) {
BLI_assert(IN_RANGE_INCL(looptri_num_active, 0, looptri_num));
@@ -1179,8 +1180,8 @@ static BVHTree *bvhtree_from_mesh_looptri_create_tree(float epsilon,
}
if (looptri_num_active) {
/* Create a bvh-tree of the given target */
/* printf("%s: building BVH, total=%d\n", __func__, numFaces); */
/* Create a BVH-tree of the given target */
// printf("%s: building BVH, total=%d\n", __func__, numFaces);
tree = BLI_bvhtree_new(looptri_num_active, epsilon, tree_type, axis);
if (tree) {
if (vert && looptri) {
@@ -1247,7 +1248,7 @@ BVHTree *bvhtree_from_editmesh_looptri_ex(BVHTreeFromEditMesh *data,
/* BMESH specific check that we have tessfaces,
* we _could_ tessellate here but rather not - campbell */
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
bool lock_started = false;
bool in_cache = bvhcache_find(
@@ -1260,7 +1261,7 @@ BVHTree *bvhtree_from_editmesh_looptri_ex(BVHTreeFromEditMesh *data,
epsilon, tree_type, axis, em, looptri_mask, looptri_num_active);
/* Save on cache for later use */
/* printf("BVHTree built and saved on cache\n"); */
// printf("BVHTree built and saved on cache\n");
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
}
bvhcache_unlock(bvh_cache, lock_started);
@@ -1276,7 +1277,7 @@ BVHTree *bvhtree_from_editmesh_looptri_ex(BVHTreeFromEditMesh *data,
data->nearest_callback = editmesh_looptri_nearest_point;
data->raycast_callback = editmesh_looptri_spherecast;
data->em = em;
data->cached = bvh_cache_p != NULL;
data->cached = bvh_cache_p != nullptr;
}
return tree;
}
@@ -1285,7 +1286,7 @@ BVHTree *bvhtree_from_editmesh_looptri(
BVHTreeFromEditMesh *data, BMEditMesh *em, float epsilon, int tree_type, int axis)
{
return bvhtree_from_editmesh_looptri_ex(
data, em, NULL, -1, epsilon, tree_type, axis, 0, NULL, NULL);
data, em, nullptr, -1, epsilon, tree_type, axis, BVHTREE_FROM_VERTS, nullptr, nullptr);
}
/**
@@ -1312,7 +1313,7 @@ BVHTree *bvhtree_from_mesh_looptri_ex(BVHTreeFromMesh *data,
{
bool in_cache = false;
bool lock_started = false;
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
in_cache = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, &lock_started, mesh_eval_mutex);
}
@@ -1329,7 +1330,7 @@ BVHTree *bvhtree_from_mesh_looptri_ex(BVHTreeFromMesh *data,
looptri_mask,
looptri_num_active);
bvhtree_balance(tree, bvh_cache_p != NULL);
bvhtree_balance(tree, bvh_cache_p != nullptr);
if (bvh_cache_p) {
BVHCache *bvh_cache = *bvh_cache_p;
@@ -1437,19 +1438,22 @@ static BLI_bitmap *looptri_no_hidden_map_get(const MPoly *mpoly,
/**
* Builds or queries a bvhcache for the cache bvhtree of the request type.
*
* \note This function only fills a cache, and therefore the mesh argument can
* be considered logically const. Concurrent access is protected by a mutex.
*/
BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
struct Mesh *mesh,
const struct Mesh *mesh,
const BVHCacheType bvh_cache_type,
const int tree_type)
{
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
BVHCache **bvh_cache_p = (BVHCache **)&mesh->runtime.bvh_cache;
ThreadMutex *mesh_eval_mutex = (ThreadMutex *)mesh->runtime.eval_mutex;
bool is_cached = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, NULL, NULL);
const bool is_cached = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, nullptr, nullptr);
if (is_cached && tree == NULL) {
if (is_cached && tree == nullptr) {
memset(data, 0, sizeof(*data));
return tree;
}
@@ -1458,7 +1462,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
case BVHTREE_FROM_VERTS:
case BVHTREE_FROM_LOOSEVERTS:
if (is_cached == false) {
BLI_bitmap *loose_verts_mask = NULL;
BLI_bitmap *loose_verts_mask = nullptr;
int loose_vert_len = -1;
int verts_len = mesh->totvert;
@@ -1480,7 +1484,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
bvh_cache_p,
mesh_eval_mutex);
if (loose_verts_mask != NULL) {
if (loose_verts_mask != nullptr) {
MEM_freeN(loose_verts_mask);
}
}
@@ -1493,7 +1497,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
case BVHTREE_FROM_EDGES:
case BVHTREE_FROM_LOOSEEDGES:
if (is_cached == false) {
BLI_bitmap *loose_edges_mask = NULL;
BLI_bitmap *loose_edges_mask = nullptr;
int loose_edges_len = -1;
int edges_len = mesh->totedge;
@@ -1516,7 +1520,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
bvh_cache_p,
mesh_eval_mutex);
if (loose_edges_mask != NULL) {
if (loose_edges_mask != nullptr) {
MEM_freeN(loose_edges_mask);
}
}
@@ -1538,7 +1542,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
mesh->mface,
num_faces,
false,
NULL,
nullptr,
-1,
0.0,
tree_type,
@@ -1561,7 +1565,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
int looptri_len = BKE_mesh_runtime_looptri_len(mesh);
int looptri_mask_active_len = -1;
BLI_bitmap *looptri_mask = NULL;
BLI_bitmap *looptri_mask = nullptr;
if (bvh_cache_type == BVHTREE_FROM_LOOPTRI_NO_HIDDEN) {
looptri_mask = looptri_no_hidden_map_get(
mesh->mpoly, looptri_len, &looptri_mask_active_len);
@@ -1584,7 +1588,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
bvh_cache_p,
mesh_eval_mutex);
if (looptri_mask != NULL) {
if (looptri_mask != nullptr) {
MEM_freeN(looptri_mask);
}
}
@@ -1603,7 +1607,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
break;
}
if (data->tree != NULL) {
if (data->tree != nullptr) {
#ifdef DEBUG
if (BLI_bvhtree_get_tree_type(data->tree) != tree_type) {
printf("tree_type %d obtained instead of %d\n",
@@ -1631,15 +1635,15 @@ BVHTree *BKE_bvhtree_from_editmesh_get(BVHTreeFromEditMesh *data,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
{
BVHTree *tree = NULL;
BVHTree *tree = nullptr;
bool is_cached = false;
memset(data, 0, sizeof(*data));
if (bvh_cache_p) {
is_cached = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, NULL, NULL);
is_cached = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, nullptr, nullptr);
if (is_cached && tree == NULL) {
if (is_cached && tree == nullptr) {
return tree;
}
}
@@ -1650,31 +1654,55 @@ BVHTree *BKE_bvhtree_from_editmesh_get(BVHTreeFromEditMesh *data,
switch (bvh_cache_type) {
case BVHTREE_FROM_EM_VERTS:
if (is_cached == false) {
tree = bvhtree_from_editmesh_verts_ex(
data, em, NULL, -1, 0.0f, tree_type, 6, bvh_cache_type, bvh_cache_p, mesh_eval_mutex);
tree = bvhtree_from_editmesh_verts_ex(data,
em,
nullptr,
-1,
0.0f,
tree_type,
6,
bvh_cache_type,
bvh_cache_p,
mesh_eval_mutex);
}
else {
data->nearest_callback = NULL;
data->nearest_callback = nullptr;
data->raycast_callback = editmesh_verts_spherecast;
}
break;
case BVHTREE_FROM_EM_EDGES:
if (is_cached == false) {
tree = bvhtree_from_editmesh_edges_ex(
data, em, NULL, -1, 0.0f, tree_type, 6, bvh_cache_type, bvh_cache_p, mesh_eval_mutex);
tree = bvhtree_from_editmesh_edges_ex(data,
em,
nullptr,
-1,
0.0f,
tree_type,
6,
bvh_cache_type,
bvh_cache_p,
mesh_eval_mutex);
}
else {
/* Setup BVHTreeFromMesh */
data->nearest_callback = NULL; /* TODO */
data->raycast_callback = NULL; /* TODO */
data->nearest_callback = nullptr; /* TODO */
data->raycast_callback = nullptr; /* TODO */
}
break;
case BVHTREE_FROM_EM_LOOPTRI:
if (is_cached == false) {
tree = bvhtree_from_editmesh_looptri_ex(
data, em, NULL, -1, 0.0f, tree_type, 6, bvh_cache_type, bvh_cache_p, mesh_eval_mutex);
tree = bvhtree_from_editmesh_looptri_ex(data,
em,
nullptr,
-1,
0.0f,
tree_type,
6,
bvh_cache_type,
bvh_cache_p,
mesh_eval_mutex);
}
else {
/* Setup BVHTreeFromMesh */
@@ -1694,7 +1722,7 @@ BVHTree *BKE_bvhtree_from_editmesh_get(BVHTreeFromEditMesh *data,
break;
}
if (data->tree != NULL) {
if (data->tree != nullptr) {
#ifdef DEBUG
if (BLI_bvhtree_get_tree_type(data->tree) != tree_type) {
printf("tree_type %d obtained instead of %d\n",
@@ -1763,7 +1791,7 @@ BVHTree *BKE_bvhtree_from_pointcloud_get(BVHTreeFromPointCloud *data,
{
BVHTree *tree = BLI_bvhtree_new(pointcloud->totpoint, 0.0f, tree_type, 6);
if (!tree) {
return NULL;
return nullptr;
}
for (int i = 0; i < pointcloud->totpoint; i++) {
@@ -1774,7 +1802,7 @@ BVHTree *BKE_bvhtree_from_pointcloud_get(BVHTreeFromPointCloud *data,
data->coords = pointcloud->co;
data->tree = tree;
data->nearest_callback = NULL;
data->nearest_callback = nullptr;
return tree;
}

View File

@@ -289,7 +289,7 @@ static DerivedMesh *cdDM_from_mesh_ex(Mesh *mesh,
if (mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) {
dm->dirty |= DM_DIRTY_NORMALS;
}
/* TODO DM_DIRTY_TESS_CDLAYERS ? Maybe not though,
/* TODO: DM_DIRTY_TESS_CDLAYERS ? Maybe not though,
* since we probably want to switch to looptris? */
CustomData_merge(&mesh->vdata, &dm->vertData, cddata_masks.vmask, alloctype, mesh->totvert);

View File

@@ -991,7 +991,7 @@ static void cloth_hair_update_bending_targets(ClothModifierData *clmd)
return;
}
/* XXX Note: we need to propagate frames from the root up,
/* XXX NOTE: we need to propagate frames from the root up,
* but structural hair springs are stored in reverse order.
* The bending springs however are then inserted in the same
* order as vertices again ...
@@ -1049,7 +1049,7 @@ static void cloth_hair_update_bending_rest_targets(ClothModifierData *clmd)
return;
}
/* XXX Note: we need to propagate frames from the root up,
/* XXX NOTE: we need to propagate frames from the root up,
* but structural hair springs are stored in reverse order.
* The bending springs however are then inserted in the same
* order as vertices again ...
@@ -1883,7 +1883,7 @@ static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
cloth_hair_update_bending_rest_targets(clmd);
}
/* note: the edges may already exist so run reinsert */
/* NOTE: the edges may already exist so run reinsert. */
/* insert other near springs in edgeset AFTER bending springs are calculated (for selfcolls) */
for (int i = 0; i < numedges; i++) { /* struct springs */

View File

@@ -79,7 +79,8 @@ static bool collection_object_remove(Main *bmain,
static CollectionChild *collection_find_child(Collection *parent, Collection *collection);
static CollectionParent *collection_find_parent(Collection *child, Collection *collection);
static bool collection_find_child_recursive(Collection *parent, Collection *collection);
static bool collection_find_child_recursive(const Collection *parent,
const Collection *collection);
/** \} */
@@ -114,7 +115,7 @@ static void collection_copy_data(Main *bmain, ID *id_dst, const ID *id_src, cons
((collection_src->id.flag & LIB_EMBEDDED_DATA) != 0));
/* Do not copy collection's preview (same behavior as for objects). */
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0 && false) { /* XXX TODO temp hack */
if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0 && false) { /* XXX TODO: temp hack. */
BKE_previewimg_id_copy(&collection_dst->id, &collection_src->id);
}
else {
@@ -1521,9 +1522,9 @@ static CollectionChild *collection_find_child(Collection *parent, Collection *co
return BLI_findptr(&parent->children, collection, offsetof(CollectionChild, collection));
}
static bool collection_find_child_recursive(Collection *parent, Collection *collection)
static bool collection_find_child_recursive(const Collection *parent, const Collection *collection)
{
LISTBASE_FOREACH (CollectionChild *, child, &parent->children) {
LISTBASE_FOREACH (const CollectionChild *, child, &parent->children) {
if (child->collection == collection) {
return true;
}
@@ -1536,7 +1537,7 @@ static bool collection_find_child_recursive(Collection *parent, Collection *coll
return false;
}
bool BKE_collection_has_collection(Collection *parent, Collection *collection)
bool BKE_collection_has_collection(const Collection *parent, const Collection *collection)
{
return collection_find_child_recursive(parent, collection);
}
@@ -1705,7 +1706,7 @@ void BKE_main_collections_parent_relations_rebuild(Main *bmain)
for (Collection *collection = bmain->collections.first; collection != NULL;
collection = collection->id.next) {
if (collection->tag & COLLECTION_TAG_RELATION_REBUILD) {
/* Note: we do not have easy access to 'which collections is root' info in that case, which
/* NOTE: we do not have easy access to 'which collections is root' info in that case, which
* means test for cycles in collection relationships may fail here. I don't think that is an
* issue in practice here, but worth keeping in mind... */
collection_parents_rebuild_recursive(collection);
@@ -1895,7 +1896,7 @@ static void layer_collection_flags_restore_recursive(LayerCollection *layer_coll
* and now we moved a new collection to be part of the background this collection should
* probably be disabled.
*
* Note: If we were to also keep the exclude flag we would need to re-sync the collections.
* NOTE: If we were to also keep the exclude flag we would need to re-sync the collections.
*/
layer_collection->flag = flag->flag | (layer_collection->flag & LAYER_COLLECTION_EXCLUDE);
}
@@ -2202,8 +2203,8 @@ void BKE_scene_objects_iterator_end(BLI_Iterator *iter)
* Generate a new GSet (or extend given `objects_gset` if not NULL) with all objects referenced by
* all collections of given `scene`.
*
* \note: This will include objects without a base currently (because they would belong to excluded
* collections only e.g.).
* \note This will include objects without a base currently
* (because they would belong to excluded collections only e.g.).
*/
GSet *BKE_scene_objects_as_gset(Scene *scene, GSet *objects_gset)
{

View File

@@ -295,7 +295,7 @@ void BKE_colorband_init_from_table_rgba(ColorBand *coba,
const int array_len,
bool filter_samples)
{
/* Note, we could use MAXCOLORBAND here, but results of re-sampling are nicer,
/* NOTE: we could use MAXCOLORBAND here, but results of re-sampling are nicer,
* avoid different behavior when limit is hit. */
if (array_len < 2) {
/* No Re-sample, just de-duplicate. */
@@ -420,7 +420,7 @@ bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
cbd1 = coba->data;
/* Note: when ipotype >= COLBAND_INTERP_B_SPLINE,
/* NOTE: when ipotype >= COLBAND_INTERP_B_SPLINE,
* we cannot do early-out with a constant color before first color stop and after last one,
* because interpolation starts before and ends after those... */
ipotype = (coba->color_mode == COLBAND_BLEND_RGB) ? coba->ipotype : COLBAND_INTERP_LINEAR;
@@ -490,7 +490,7 @@ bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
}
if (ELEM(ipotype, COLBAND_INTERP_B_SPLINE, COLBAND_INTERP_CARDINAL)) {
/* ipo from right to left: 3 2 1 0 */
/* Interpolate from right to left: `3 2 1 0`. */
float t[4];
if (a >= coba->tot - 1) {

View File

@@ -638,7 +638,7 @@ static void curvemap_make_table(const CurveMapping *cumap, CurveMap *cuma)
cuma->mintable = clipr->xmin;
cuma->maxtable = clipr->xmax;
/* hrmf... we now rely on blender ipo beziers, these are more advanced */
/* Rely on Blender interpolation for bezier curves, support extra functionality here as well. */
bezt = MEM_callocN(cuma->totpoint * sizeof(BezTriple), "beztarr");
for (int a = 0; a < cuma->totpoint; a++) {
@@ -873,7 +873,7 @@ static int sort_curvepoints(const void *a1, const void *a2)
/* ************************ more CurveMapping calls *************** */
/* note; only does current curvemap! */
/* NOTE: only does current curvemap! */
void BKE_curvemapping_changed(CurveMapping *cumap, const bool rem_doubles)
{
CurveMap *cuma = cumap->cm + cumap->cur;
@@ -1267,9 +1267,9 @@ void BKE_curvemapping_blend_read(BlendDataReader *reader, CurveMapping *cumap)
BLI_INLINE int get_bin_float(float f)
{
int bin = (int)((f * 255.0f) + 0.5f); /* 0.5 to prevent quantisation differences */
int bin = (int)((f * 255.0f) + 0.5f); /* 0.5 to prevent quantization differences */
/* note: clamp integer instead of float to avoid problems with NaN */
/* NOTE: clamp integer instead of float to avoid problems with NaN. */
CLAMP(bin, 0, 255);
return bin;

View File

@@ -299,7 +299,10 @@ void BKE_constraint_mat_convertspace(Object *ob,
mul_m4_m4m4(mat, imat, mat);
/* Use pose-space as stepping stone for other spaces. */
if (ELEM(to, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_PARLOCAL)) {
if (ELEM(to,
CONSTRAINT_SPACE_LOCAL,
CONSTRAINT_SPACE_PARLOCAL,
CONSTRAINT_SPACE_OWNLOCAL)) {
/* Call self with slightly different values. */
BKE_constraint_mat_convertspace(
ob, pchan, cob, mat, CONSTRAINT_SPACE_POSE, to, keep_scale);
@@ -315,6 +318,17 @@ void BKE_constraint_mat_convertspace(Object *ob,
BKE_armature_mat_pose_to_bone(pchan, mat, mat);
}
}
/* pose to owner local */
else if (to == CONSTRAINT_SPACE_OWNLOCAL) {
/* pose to local */
if (pchan->bone) {
BKE_armature_mat_pose_to_bone(pchan, mat, mat);
}
/* local to owner local (recursive) */
BKE_constraint_mat_convertspace(
ob, pchan, cob, mat, CONSTRAINT_SPACE_LOCAL, to, keep_scale);
}
/* pose to local with parent */
else if (to == CONSTRAINT_SPACE_PARLOCAL) {
if (pchan->bone) {
@@ -336,17 +350,59 @@ void BKE_constraint_mat_convertspace(Object *ob,
}
case CONSTRAINT_SPACE_LOCAL: /* ------------ FROM LOCALSPACE --------- */
{
/* local to owner local */
if (to == CONSTRAINT_SPACE_OWNLOCAL) {
if (pchan->bone) {
copy_m4_m4(diff_mat, pchan->bone->arm_mat);
if (cob && cob->pchan && cob->pchan->bone) {
invert_m4_m4(imat, cob->pchan->bone->arm_mat);
mul_m4_m4m4(diff_mat, imat, diff_mat);
}
zero_v3(diff_mat[3]);
invert_m4_m4(imat, diff_mat);
mul_m4_series(mat, diff_mat, mat, imat);
}
}
/* local to pose - do inverse procedure that was done for pose to local */
else {
if (pchan->bone) {
/* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */
BKE_armature_mat_bone_to_pose(pchan, mat, mat);
}
/* use pose-space as stepping stone for other spaces */
if (ELEM(to,
CONSTRAINT_SPACE_WORLD,
CONSTRAINT_SPACE_PARLOCAL,
CONSTRAINT_SPACE_CUSTOM)) {
/* call self with slightly different values */
BKE_constraint_mat_convertspace(
ob, pchan, cob, mat, CONSTRAINT_SPACE_POSE, to, keep_scale);
}
}
break;
}
case CONSTRAINT_SPACE_OWNLOCAL: { /* -------------- FROM OWNER LOCAL ---------- */
/* owner local to local */
if (pchan->bone) {
/* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */
BKE_armature_mat_bone_to_pose(pchan, mat, mat);
copy_m4_m4(diff_mat, pchan->bone->arm_mat);
if (cob && cob->pchan && cob->pchan->bone) {
invert_m4_m4(imat, cob->pchan->bone->arm_mat);
mul_m4_m4m4(diff_mat, imat, diff_mat);
}
zero_v3(diff_mat[3]);
invert_m4_m4(imat, diff_mat);
mul_m4_series(mat, imat, mat, diff_mat);
}
/* use pose-space as stepping stone for other spaces */
if (ELEM(to, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_PARLOCAL, CONSTRAINT_SPACE_CUSTOM)) {
if (to != CONSTRAINT_SPACE_LOCAL) {
/* call self with slightly different values */
BKE_constraint_mat_convertspace(
ob, pchan, cob, mat, CONSTRAINT_SPACE_POSE, to, keep_scale);
ob, pchan, cob, mat, CONSTRAINT_SPACE_LOCAL, to, keep_scale);
}
break;
}
@@ -358,7 +414,11 @@ void BKE_constraint_mat_convertspace(Object *ob,
}
/* use pose-space as stepping stone for other spaces */
if (ELEM(to, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_CUSTOM)) {
if (ELEM(to,
CONSTRAINT_SPACE_WORLD,
CONSTRAINT_SPACE_LOCAL,
CONSTRAINT_SPACE_OWNLOCAL,
CONSTRAINT_SPACE_CUSTOM)) {
/* call self with slightly different values */
BKE_constraint_mat_convertspace(
ob, pchan, cob, mat, CONSTRAINT_SPACE_POSE, to, keep_scale);
@@ -470,7 +530,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
/* when not in EditMode, use the 'final' evaluated mesh, depsgraph
* ensures we build with CD_MDEFORMVERT layer
*/
Mesh *me_eval = BKE_object_get_evaluated_mesh(ob);
const Mesh *me_eval = BKE_object_get_evaluated_mesh(ob);
BMEditMesh *em = BKE_editmesh_from_object(ob);
float plane[3];
float imat[3][3], tmat[3][3];
@@ -488,17 +548,17 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
float normal[3] = {0.0f, 0.0f, 0.0f};
float weightsum = 0.0f;
if (me_eval) {
MDeformVert *dvert = CustomData_get_layer(&me_eval->vdata, CD_MDEFORMVERT);
const MDeformVert *dvert = CustomData_get_layer(&me_eval->vdata, CD_MDEFORMVERT);
int numVerts = me_eval->totvert;
/* check that dvert is a valid pointers (just in case) */
if (dvert) {
MDeformVert *dv = dvert;
MVert *mv = me_eval->mvert;
/* get the average of all verts with that are in the vertex-group */
for (int i = 0; i < numVerts; i++, dv++, mv++) {
MDeformWeight *dw = BKE_defvert_find_index(dv, defgroup);
for (int i = 0; i < numVerts; i++) {
const MDeformVert *dv = &dvert[i];
const MVert *mv = &me_eval->mvert[i];
const MDeformWeight *dw = BKE_defvert_find_index(dv, defgroup);
if (dw && dw->weight > 0.0f) {
float nor[3];
@@ -867,7 +927,7 @@ static void default_get_tarmat_full_bbone(struct Depsgraph *UNUSED(depsgraph),
/* This following macro should be used for all standard single-target *_flush_tars functions
* to save typing and reduce maintenance woes.
* Note: the pointer to ct will be changed to point to the next in the list (as it gets removed)
* NOTE: the pointer to ct will be changed to point to the next in the list (as it gets removed)
* (Hopefully all compilers will be happy with the lines with just a space on them. Those are
* really just to help this code easier to read)
*/
@@ -889,7 +949,7 @@ static void default_get_tarmat_full_bbone(struct Depsgraph *UNUSED(depsgraph),
/* This following macro should be used for all standard single-target *_flush_tars functions
* to save typing and reduce maintenance woes. It does not do the subtarget related operations.
* Note: the pointer to ct will be changed to point to the next in the list (as it gets removed)
* NOTE: the pointer to ct will be changed to point to the next in the list (as it gets removed)
* (Hopefully all compilers will be happy with the lines with just a space on them. Those are
* really just to help this code easier to read)
*/
@@ -1088,7 +1148,7 @@ static void childof_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
}
}
/* XXX note, con->flag should be CONSTRAINT_SPACEONCE for bone-childof, patched in readfile.c */
/* XXX NOTE: con->flag should be CONSTRAINT_SPACEONCE for bone-childof, patched in `readfile.c`. */
static bConstraintTypeInfo CTI_CHILDOF = {
CONSTRAINT_TYPE_CHILDOF, /* type */
sizeof(bChildOfConstraint), /* size */
@@ -1205,7 +1265,7 @@ static void vectomat(const float vec[3],
u[2] = 1;
}
/* note: even though 'n' is normalized, don't use 'project_v3_v3v3_normalized' below
/* NOTE: even though 'n' is normalized, don't use 'project_v3_v3v3_normalized' below
* because precision issues cause a problem in near degenerate states, see: T53455. */
/* project the up vector onto the plane specified by n */
@@ -1459,7 +1519,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
unit_m4(ct->matrix);
/* note: when creating constraints that follow path, the curve gets the CU_PATH set now,
/* NOTE: when creating constraints that follow path, the curve gets the CU_PATH set now,
* currently for paths to work it needs to go through the bevlist/displist system (ton)
*/
@@ -1476,7 +1536,10 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
* to get a time factor. */
curvetime /= cu->pathlen;
if (cu->flag & CU_PATH_CLAMP) {
Nurb *nu = cu->nurb.first;
if (!(nu && nu->flagu & CU_NURB_CYCLIC) && cu->flag & CU_PATH_CLAMP) {
/* If curve is not cyclic, clamp to the begin/end points if the curve clamp option is on.
*/
CLAMP(curvetime, 0.0f, 1.0f);
}
}
@@ -1540,8 +1603,8 @@ static void followpath_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *
/* un-apply scaling caused by path */
if ((data->followflag & FOLLOWPATH_RADIUS) == 0) {
/* XXX: Assume that scale correction means that radius
* will have some scale error in it - Campbell. */
/* XXX(campbell): Assume that scale correction means that radius
* will have some scale error in it. */
float obsize[3];
mat4_to_size(obsize, cob->matrix);
@@ -2232,17 +2295,47 @@ static void translike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
bConstraintTarget *ct = targets->first;
if (VALID_CONS_TARGET(ct)) {
float target_mat[4][4];
copy_m4_m4(target_mat, ct->matrix);
/* Remove the shear of the target matrix if enabled.
* Use Y as the axis since it's the natural default for bones. */
if (data->flag & TRANSLIKE_REMOVE_TARGET_SHEAR) {
orthogonalize_m4_stable(target_mat, 1, false);
}
/* Finally, combine the matrices. */
switch (data->mix_mode) {
case TRANSLIKE_MIX_REPLACE:
copy_m4_m4(cob->matrix, ct->matrix);
copy_m4_m4(cob->matrix, target_mat);
break;
/* Simple matrix multiplication. */
case TRANSLIKE_MIX_BEFORE_FULL:
mul_m4_m4m4(cob->matrix, target_mat, cob->matrix);
break;
case TRANSLIKE_MIX_AFTER_FULL:
mul_m4_m4m4(cob->matrix, cob->matrix, target_mat);
break;
/* Aligned Inherit Scale emulation. */
case TRANSLIKE_MIX_BEFORE:
mul_m4_m4m4_aligned_scale(cob->matrix, ct->matrix, cob->matrix);
mul_m4_m4m4_aligned_scale(cob->matrix, target_mat, cob->matrix);
break;
case TRANSLIKE_MIX_AFTER:
mul_m4_m4m4_aligned_scale(cob->matrix, cob->matrix, ct->matrix);
mul_m4_m4m4_aligned_scale(cob->matrix, cob->matrix, target_mat);
break;
/* Fully separate handling of channels. */
case TRANSLIKE_MIX_BEFORE_SPLIT:
mul_m4_m4m4_split_channels(cob->matrix, target_mat, cob->matrix);
break;
case TRANSLIKE_MIX_AFTER_SPLIT:
mul_m4_m4m4_split_channels(cob->matrix, cob->matrix, target_mat);
break;
default:
@@ -3788,7 +3881,7 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
unit_m4(targetMatrix);
INIT_MINMAX(curveMin, curveMax);
/* XXX - don't think this is good calling this here - campbell */
/* XXX(campbell): don't think this is good calling this here. */
BKE_object_minmax(ct->tar, curveMin, curveMax, true);
/* get targetmatrix */
@@ -4239,7 +4332,7 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
float mat[4][4];
float no[3] = {0.0f, 0.0f, 0.0f};
/* TODO should use FLT_MAX.. but normal projection doenst yet supports it */
/* TODO: should use FLT_MAX.. but normal projection doesn't yet supports it. */
hit.index = -1;
hit.dist = (scon->projLimit == 0.0f) ? BVH_RAYCAST_DIST_MAX : scon->projLimit;
@@ -5006,7 +5099,7 @@ static void followtrack_project_to_depth_object_if_needed(FollowTrackContext *co
}
Object *depth_object = context->depth_object;
Mesh *depth_mesh = BKE_object_get_evaluated_mesh(depth_object);
const Mesh *depth_mesh = BKE_object_get_evaluated_mesh(depth_object);
if (depth_mesh == NULL) {
return;
}
@@ -6266,7 +6359,7 @@ void BKE_constraints_solve(struct Depsgraph *depsgraph,
* (T26014 and T25725), since some constraints may not convert the solution back to the input
* space before blending but all are guaranteed to end up in good "world-space" result.
*/
/* Note: all kind of stuff here before (caused trouble), much easier to just interpolate,
/* NOTE: all kind of stuff here before (caused trouble), much easier to just interpolate,
* or did I miss something? -jahka (r.32105) */
if (enf < 1.0f) {
float solution[4][4];

View File

@@ -442,6 +442,15 @@ ListBase *BKE_curve_editNurbs_get(Curve *cu)
return NULL;
}
const ListBase *BKE_curve_editNurbs_get_for_read(const Curve *cu)
{
if (cu->editnurb) {
return &cu->editnurb->nurbs;
}
return NULL;
}
short BKE_curve_type_get(const Curve *cu)
{
int type = cu->type;
@@ -2049,7 +2058,7 @@ static void calc_bevel_sin_cos(
static void tilt_bezpart(const BezTriple *prevbezt,
const BezTriple *bezt,
Nurb *nu,
const Nurb *nu,
float *tilt_array,
float *radius_array,
float *weight_array,
@@ -2114,8 +2123,8 @@ static void tilt_bezpart(const BezTriple *prevbezt,
if (radius_array) {
if (nu->radius_interp == KEY_CU_EASE) {
/* Support 2.47 ease interp
* Note! - this only takes the 2 points into account,
* giving much more localized results to changes in radius, sometimes you want that */
* NOTE: this only takes the 2 points into account,
* giving much more localized results to changes in radius, sometimes you want that. */
*radius_array = prevbezt->radius + (bezt->radius - prevbezt->radius) *
(3.0f * fac * fac - 2.0f * fac * fac * fac);
}
@@ -2481,7 +2490,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
cross_v3_v3v3(cross_tmp, bevp1->tan, bevp1->dir);
normalize_v3(cross_tmp);
tri_to_quat(bevp1->quat, zero, cross_tmp, bevp1->tan); /* XXX - could be faster */
tri_to_quat(bevp1->quat, zero, cross_tmp, bevp1->tan); /* XXX: could be faster. */
/* bevp0 = bevp1; */ /* UNUSED */
bevp1 = bevp2;
@@ -2550,8 +2559,8 @@ static void make_bevel_list_segment_2D(BevList *bl)
static void make_bevel_list_2D(BevList *bl)
{
/* note: bevp->dir and bevp->quat are not needed for beveling but are
* used when making a path from a 2D curve, therefore they need to be set - Campbell */
/* NOTE(campbell): `bevp->dir` and `bevp->quat` are not needed for beveling but are
* used when making a path from a 2D curve, therefore they need to be set. */
BevPoint *bevp0, *bevp1, *bevp2;
int nr;
@@ -2611,7 +2620,7 @@ static void make_bevel_list_2D(BevList *bl)
}
}
static void bevlist_firstlast_direction_calc_from_bpoint(Nurb *nu, BevList *bl)
static void bevlist_firstlast_direction_calc_from_bpoint(const Nurb *nu, BevList *bl)
{
if (nu->pntsu > 1) {
BPoint *first_bp = nu->bp, *last_bp = nu->bp + (nu->pntsu - 1);
@@ -2646,7 +2655,7 @@ void BKE_curve_bevelList_free(ListBase *bev)
BLI_listbase_clear(bev);
}
void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
void BKE_curve_bevelList_make(Object *ob, const ListBase *nurbs, const bool for_render)
{
/*
* - convert all curves to polys, with indication of resol and flags for double-vertices
@@ -2691,7 +2700,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
is_editmode = 1;
}
LISTBASE_FOREACH (Nurb *, nu, nurbs) {
LISTBASE_FOREACH (const Nurb *, nu, nurbs) {
if (nu->hide && is_editmode) {
continue;
}
@@ -3649,7 +3658,7 @@ static bool tridiagonal_solve_with_limits(float *a,
* is affected by all other points of the curve segment, in practice the influence
* decreases exponentially with distance.
*
* Note: this algorithm assumes that the handle horizontal size is always 1/3 of the
* NOTE: this algorithm assumes that the handle horizontal size is always 1/3 of the
* of the interval to the next point. This rule ensures linear interpolation of time.
*
* ^ height (co 1)
@@ -5078,6 +5087,15 @@ ListBase *BKE_curve_nurbs_get(Curve *cu)
return &cu->nurb;
}
const ListBase *BKE_curve_nurbs_get_for_read(const Curve *cu)
{
if (cu->editnurb) {
return BKE_curve_editNurbs_get_for_read(cu);
}
return &cu->nurb;
}
void BKE_curve_nurb_active_set(Curve *cu, const Nurb *nu)
{
if (nu == NULL) {

View File

@@ -168,7 +168,7 @@ static bool calc_curve_deform(
*
* Now for Neg Up XYZ, the colors are all dark, and ordered clockwise - Campbell
*
* note: moved functions into quat_apply_track/vec_apply_track
* NOTE: moved functions into quat_apply_track/vec_apply_track
*/
copy_qt_qt(quat, new_quat);
copy_v3_v3(cent, co);

View File

@@ -257,9 +257,10 @@ static SplinePtr spline_from_dna_poly(const Nurb &nurb)
return spline;
}
std::unique_ptr<CurveEval> curve_eval_from_dna_curve(const Curve &dna_curve)
std::unique_ptr<CurveEval> curve_eval_from_dna_curve(const Curve &dna_curve,
const ListBase &nurbs_list)
{
Vector<const Nurb *> nurbs(*BKE_curve_nurbs_get(&const_cast<Curve &>(dna_curve)));
Vector<const Nurb *> nurbs(nurbs_list);
std::unique_ptr<CurveEval> curve = std::make_unique<CurveEval>();
curve->resize(nurbs.size());
@@ -295,6 +296,11 @@ std::unique_ptr<CurveEval> curve_eval_from_dna_curve(const Curve &dna_curve)
return curve;
}
std::unique_ptr<CurveEval> curve_eval_from_dna_curve(const Curve &dna_curve)
{
return curve_eval_from_dna_curve(dna_curve, *BKE_curve_nurbs_get_for_read(&dna_curve));
}
/**
* Check the invariants that curve control point attributes should always uphold, necessary
* because attributes are stored on splines rather than in a flat array on the curve:

View File

@@ -105,8 +105,10 @@ typedef struct LayerTypeInfo {
/**
* default layer name.
* note! when NULL this is a way to ensure there is only ever one item
* see: CustomData_layertype_is_singleton() */
*
* \note when NULL this is a way to ensure there is only ever one item
* see: CustomData_layertype_is_singleton().
*/
const char *defaultname;
/**
@@ -329,7 +331,7 @@ static void layerInterp_normal(const void **sources,
int count,
void *dest)
{
/* Note: This is linear interpolation, which is not optimal for vectors.
/* NOTE: This is linear interpolation, which is not optimal for vectors.
* Unfortunately, spherical interpolation of more than two values is hairy,
* so for now it will do... */
float no[3] = {0.0f};
@@ -1594,7 +1596,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 14: CD_ORCO */
{sizeof(float[3]), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 15: CD_MTEXPOLY */ /* DEPRECATED */
/* note, when we expose the UV Map / TexFace split to the user,
/* NOTE: when we expose the UV Map / TexFace split to the user,
* change this back to face Texture. */
{sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 16: CD_MLOOPUV */
@@ -3805,7 +3807,7 @@ void *CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int
return POINTER_OFFSET(block, data->layers[layer_index + n].offset);
}
/* Gets from the layer at physical index n, note: doesn't check type. */
/* Gets from the layer at physical index n, NOTE: doesn't check type. */
void *CustomData_bmesh_get_layer_n(const CustomData *data, void *block, int n)
{
if (n < 0 || n >= data->totlayer) {
@@ -4974,7 +4976,7 @@ void CustomData_data_transfer(const MeshPairRemap *me_remap,
size_t tmp_buff_size = 32;
const void **tmp_data_src = NULL;
/* Note: NULL data_src may happen and be valid (see vgroups...). */
/* NOTE: NULL data_src may happen and be valid (see vgroups...). */
if (!data_dst) {
return;
}
@@ -4991,7 +4993,7 @@ void CustomData_data_transfer(const MeshPairRemap *me_remap,
else {
const LayerTypeInfo *type_info = layerType_getInfo(data_type);
/* Note: we can use 'fake' CDLayers, like e.g. for crease, bweight, etc. :/ */
/* NOTE: we can use 'fake' CDLayers, like e.g. for crease, bweight, etc. :/. */
data_size = (size_t)type_info->size;
data_step = laymap->elem_size ? laymap->elem_size : data_size;
data_offset = laymap->data_offset;

View File

@@ -361,9 +361,9 @@ bool cdf_write_open(CDataFile *cdf, const char *filename)
cdf->writef = f;
/* fill header */
/* Fill header. */
header = &cdf->header;
/* strcpy(, "BCDF"); // terminator out of range */
/* Copy "BCDF" (string terminator out of range). */
header->ID[0] = 'B';
header->ID[1] = 'C';
header->ID[2] = 'D';

View File

@@ -691,7 +691,7 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(ListBase *r_map
}
if (data_dst_to_delete) {
/* Note:
/* NOTE:
* This won't affect newly created layers, if any, since tot_dst has not been updated!
* Also, looping backward ensures us we do not suffer
* from index shifting when deleting a layer. */
@@ -764,7 +764,7 @@ static bool data_transfer_layersmapping_cdlayers(ListBase *r_map,
}
}
else if (fromlayers == DT_LAYERS_ACTIVE_SRC || fromlayers >= 0) {
/* Note: use_delete has not much meaning in this case, ignored. */
/* NOTE: use_delete has not much meaning in this case, ignored. */
if (fromlayers >= 0) { /* Real-layer index */
idx_src = fromlayers;

View File

@@ -716,7 +716,7 @@ MDeformWeight *BKE_defvert_ensure_index(MDeformVert *dvert, const int defgroup)
return dw_new;
}
/* TODO. merge with code above! */
/* TODO: merge with code above! */
/**
* Adds the given vertex to the specified vertex group, with given weight.
@@ -1334,7 +1334,7 @@ bool data_transfer_layersmapping_vgroups(ListBase *r_map,
const size_t elem_size = sizeof(*((MDeformVert *)NULL));
/* Note:
/* NOTE:
* VGroups are a bit hairy, since their layout is defined on object level (ob->defbase),
* while their actual data is a (mesh) CD layer.
* This implies we may have to handle data layout itself while having NULL data itself,
@@ -1357,7 +1357,7 @@ bool data_transfer_layersmapping_vgroups(ListBase *r_map,
}
if (fromlayers == DT_LAYERS_ACTIVE_SRC || fromlayers >= 0) {
/* Note: use_delete has not much meaning in this case, ignored. */
/* NOTE: use_delete has not much meaning in this case, ignored. */
if (fromlayers >= 0) {
idx_src = fromlayers;
@@ -1373,7 +1373,7 @@ bool data_transfer_layersmapping_vgroups(ListBase *r_map,
}
if (tolayers >= 0) {
/* Note: in this case we assume layer exists! */
/* NOTE: in this case we assume layer exists! */
idx_dst = tolayers;
BLI_assert(idx_dst < BLI_listbase_count(&ob_dst->defbase));
}

View File

@@ -135,7 +135,7 @@ void BKE_displist_normals_add(ListBase *lb)
LISTBASE_FOREACH (DispList *, dl, lb) {
if (dl->type == DL_INDEX3) {
if (dl->nors == nullptr) {
dl->nors = (float *)MEM_callocN(sizeof(float[3]), "dlnors");
dl->nors = (float *)MEM_callocN(sizeof(float[3]), __func__);
if (dl->flag & DL_BACK_CURVE) {
dl->nors[2] = -1.0f;
@@ -147,7 +147,7 @@ void BKE_displist_normals_add(ListBase *lb)
}
else if (dl->type == DL_SURF) {
if (dl->nors == nullptr) {
dl->nors = (float *)MEM_callocN(sizeof(float[3]) * dl->nr * dl->parts, "dlnors");
dl->nors = (float *)MEM_callocN(sizeof(float[3]) * dl->nr * dl->parts, __func__);
vdata = dl->verts;
ndata = dl->nors;
@@ -328,7 +328,7 @@ static void curve_to_displist(const Curve *cu,
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__);
/* Add one to the length because of 'BKE_curve_forward_diff_bezier'. */
dl->verts = (float *)MEM_mallocN(sizeof(float[3]) * (samples_len + 1), "dlverts");
dl->verts = (float *)MEM_mallocN(sizeof(float[3]) * (samples_len + 1), __func__);
BLI_addtail(r_dispbase, dl);
dl->parts = 1;
dl->nr = samples_len;
@@ -382,7 +382,7 @@ static void curve_to_displist(const Curve *cu,
else if (nu->type == CU_NURBS) {
const int len = (resolution * SEGMENTSU(nu));
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__);
dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), "dlverts");
dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), __func__);
BLI_addtail(r_dispbase, dl);
dl->parts = 1;
dl->nr = len;
@@ -395,7 +395,7 @@ static void curve_to_displist(const Curve *cu,
else if (nu->type == CU_POLY) {
const int len = nu->pntsu;
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__);
dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), "dlverts");
dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), __func__);
BLI_addtail(r_dispbase, dl);
dl->parts = 1;
dl->nr = len;
@@ -491,7 +491,7 @@ void BKE_displist_fill(const ListBase *dispbase,
const int triangles_len = BLI_scanfill_calc_ex(&sf_ctx, scanfill_flag, normal_proj);
if (totvert != 0 && triangles_len != 0) {
DispList *dlnew = (DispList *)MEM_callocN(sizeof(DispList), "filldisplist");
DispList *dlnew = (DispList *)MEM_callocN(sizeof(DispList), __func__);
dlnew->type = DL_INDEX3;
dlnew->flag = (dl_flag_accum & (DL_BACK_CURVE | DL_FRONT_CURVE));
dlnew->rt = (dl_rt_accum & CU_SMOOTH);
@@ -499,8 +499,8 @@ void BKE_displist_fill(const ListBase *dispbase,
dlnew->nr = totvert;
dlnew->parts = triangles_len;
dlnew->index = (int *)MEM_mallocN(sizeof(int[3]) * triangles_len, "dlindex");
dlnew->verts = (float *)MEM_mallocN(sizeof(float[3]) * totvert, "dlverts");
dlnew->index = (int *)MEM_mallocN(sizeof(int[3]) * triangles_len, __func__);
dlnew->verts = (float *)MEM_mallocN(sizeof(float[3]) * totvert, __func__);
/* vert data */
int i;
@@ -630,7 +630,7 @@ static float displist_calc_taper(Depsgraph *depsgraph,
(DispList *)taperobj->runtime.curve_cache->disp.first :
nullptr;
if (dl == nullptr) {
BKE_displist_make_curveTypes(depsgraph, scene, taperobj, false, false);
BKE_displist_make_curveTypes(depsgraph, scene, taperobj, false);
dl = (DispList *)taperobj->runtime.curve_cache->disp.first;
}
if (dl) {
@@ -681,8 +681,7 @@ void BKE_displist_make_mball(Depsgraph *depsgraph, Scene *scene, Object *ob)
BKE_displist_free(&(ob->runtime.curve_cache->disp));
}
else {
ob->runtime.curve_cache = (CurveCache *)MEM_callocN(sizeof(CurveCache),
"CurveCache for MBall");
ob->runtime.curve_cache = (CurveCache *)MEM_callocN(sizeof(CurveCache), __func__);
}
BKE_mball_polygonize(depsgraph, scene, ob, &ob->runtime.curve_cache->disp);
@@ -1068,7 +1067,7 @@ static void displist_surf_indices(DispList *dl)
dl->totindex = 0;
int *index = dl->index = (int *)MEM_mallocN(sizeof(int[4]) * (dl->parts + 1) * (dl->nr + 1),
"index array nurbs");
__func__);
for (int a = 0; a < dl->parts; a++) {
@@ -1092,31 +1091,29 @@ static void displist_surf_indices(DispList *dl)
}
}
static void displist_make_surf(Depsgraph *depsgraph,
const Scene *scene,
Object *ob,
ListBase *dispbase,
Mesh **r_final,
const bool for_render,
const bool for_orco)
static void evaluate_surface_object(Depsgraph *depsgraph,
const Scene *scene,
Object *ob,
const bool for_render,
ListBase *r_dispbase,
Mesh **r_final)
{
ListBase nubase = {nullptr, nullptr};
BLI_assert(ob->type == OB_SURF);
const Curve *cu = (const Curve *)ob->data;
ListBase *deformed_nurbs = &ob->runtime.curve_cache->deformed_nurbs;
if (!for_render && cu->editnurb) {
BKE_nurbList_duplicate(&nubase, BKE_curve_editNurbs_get(const_cast<Curve *>(cu)));
BKE_nurbList_duplicate(deformed_nurbs, BKE_curve_editNurbs_get_for_read(cu));
}
else {
BKE_nurbList_duplicate(&nubase, &cu->nurb);
BKE_nurbList_duplicate(deformed_nurbs, &cu->nurb);
}
bool force_mesh_conversion = false;
if (!for_orco) {
force_mesh_conversion = BKE_curve_calc_modifiers_pre(
depsgraph, scene, ob, &nubase, &nubase, for_render);
}
bool force_mesh_conversion = BKE_curve_calc_modifiers_pre(
depsgraph, scene, ob, deformed_nurbs, deformed_nurbs, for_render);
LISTBASE_FOREACH (Nurb *, nu, &nubase) {
LISTBASE_FOREACH (const Nurb *, nu, deformed_nurbs) {
if (!(for_render || nu->hide == 0) || !BKE_nurb_check_valid_uv(nu)) {
continue;
}
@@ -1127,10 +1124,10 @@ static void displist_make_surf(Depsgraph *depsgraph,
if (nu->pntsv == 1) {
const int len = SEGMENTSU(nu) * resolu;
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), "makeDispListsurf");
dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), "dlverts");
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__);
dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), __func__);
BLI_addtail(dispbase, dl);
BLI_addtail(r_dispbase, dl);
dl->parts = 1;
dl->nr = len;
dl->col = nu->mat_nr;
@@ -1150,9 +1147,9 @@ static void displist_make_surf(Depsgraph *depsgraph,
else {
const int len = (nu->pntsu * resolu) * (nu->pntsv * resolv);
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), "makeDispListsurf");
dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), "dlverts");
BLI_addtail(dispbase, dl);
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__);
dl->verts = (float *)MEM_mallocN(len * sizeof(float[3]), __func__);
BLI_addtail(r_dispbase, dl);
dl->col = nu->mat_nr;
dl->charidx = nu->charidx;
@@ -1177,13 +1174,8 @@ static void displist_make_surf(Depsgraph *depsgraph,
}
}
if (!for_orco) {
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
curve_calc_modifiers_post(
depsgraph, scene, ob, dispbase, for_render, force_mesh_conversion, r_final);
}
BKE_nurbList_free(&nubase);
curve_calc_modifiers_post(
depsgraph, scene, ob, r_dispbase, for_render, force_mesh_conversion, r_final);
}
static void rotateBevelPiece(const Curve *cu,
@@ -1252,8 +1244,8 @@ static void fillBevelCap(const Nurb *nu,
const float *prev_fp,
ListBase *dispbase)
{
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), "makeDispListbev2");
dl->verts = (float *)MEM_mallocN(sizeof(float[3]) * dlb->nr, "dlverts");
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__);
dl->verts = (float *)MEM_mallocN(sizeof(float[3]) * dlb->nr, __func__);
memcpy(dl->verts, prev_fp, sizeof(float[3]) * dlb->nr);
dl->type = DL_POLY;
@@ -1403,67 +1395,47 @@ static void calc_bevfac_mapping(const Curve *cu,
}
}
static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
const Scene *scene,
Object *ob,
ListBase *dispbase,
const bool for_render,
const bool for_orco,
Mesh **r_final)
static void evaluate_curve_type_object(Depsgraph *depsgraph,
const Scene *scene,
Object *ob,
const bool for_render,
ListBase *r_dispbase,
Mesh **r_final)
{
BLI_assert(ELEM(ob->type, OB_CURVE, OB_FONT));
const Curve *cu = (const Curve *)ob->data;
/* we do allow duplis... this is only displist on curve level */
if (!ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) {
return;
}
if (ob->type == OB_SURF) {
displist_make_surf(depsgraph, scene, ob, dispbase, r_final, for_render, for_orco);
return;
}
ListBase nubase = {nullptr, nullptr};
bool force_mesh_conversion = false;
BKE_curve_bevelList_free(&ob->runtime.curve_cache->bev);
/* We only re-evaluate path if evaluation is not happening for orco.
* If the calculation happens for orco, we should never free data which
* was needed before and only not needed for orco calculation. */
if (!for_orco) {
if (ob->runtime.curve_cache->anim_path_accum_length) {
MEM_freeN((void *)ob->runtime.curve_cache->anim_path_accum_length);
}
ob->runtime.curve_cache->anim_path_accum_length = nullptr;
}
ListBase *deformed_nurbs = &ob->runtime.curve_cache->deformed_nurbs;
if (ob->type == OB_FONT) {
BKE_vfont_to_curve_nubase(ob, FO_EDIT, &nubase);
BKE_vfont_to_curve_nubase(ob, FO_EDIT, deformed_nurbs);
}
else {
BKE_nurbList_duplicate(&nubase, BKE_curve_nurbs_get(const_cast<Curve *>(cu)));
BKE_nurbList_duplicate(deformed_nurbs, BKE_curve_nurbs_get_for_read(cu));
}
if (!for_orco) {
force_mesh_conversion = BKE_curve_calc_modifiers_pre(
depsgraph, scene, ob, &nubase, &nubase, for_render);
}
bool force_mesh_conversion = BKE_curve_calc_modifiers_pre(
depsgraph, scene, ob, deformed_nurbs, deformed_nurbs, for_render);
BKE_curve_bevelList_make(ob, &nubase, for_render);
BKE_curve_bevelList_make(ob, deformed_nurbs, for_render);
if ((cu->flag & CU_PATH) ||
DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) {
BKE_anim_path_calc_data(ob);
}
/* If curve has no bevel will return nothing */
ListBase dlbev = BKE_curve_bevel_make(cu);
/* no bevel or extrude, and no width correction? */
if (BLI_listbase_is_empty(&dlbev) && cu->width == 1.0f) {
curve_to_displist(cu, &nubase, for_render, dispbase);
curve_to_displist(cu, deformed_nurbs, for_render, r_dispbase);
}
else {
const float widfac = cu->width - 1.0f;
BevList *bl = (BevList *)ob->runtime.curve_cache->bev.first;
Nurb *nu = (Nurb *)nubase.first;
const BevList *bl = (BevList *)ob->runtime.curve_cache->bev.first;
const Nurb *nu = (Nurb *)deformed_nurbs->first;
for (; bl && nu; bl = bl->next, nu = nu->next) {
float *data;
@@ -1475,7 +1447,7 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
if (BLI_listbase_is_empty(&dlbev)) {
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), "makeDispListbev");
dl->verts = (float *)MEM_mallocN(sizeof(float[3]) * bl->nr, "dlverts");
BLI_addtail(dispbase, dl);
BLI_addtail(r_dispbase, dl);
if (bl->poly != -1) {
dl->type = DL_POLY;
@@ -1523,9 +1495,9 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
LISTBASE_FOREACH (DispList *, dlb, &dlbev) {
/* for each part of the bevel use a separate displblock */
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), "makeDispListbev1");
dl->verts = data = (float *)MEM_mallocN(sizeof(float[3]) * dlb->nr * steps, "dlverts");
BLI_addtail(dispbase, dl);
DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__);
dl->verts = data = (float *)MEM_mallocN(sizeof(float[3]) * dlb->nr * steps, __func__);
BLI_addtail(r_dispbase, dl);
dl->type = DL_SURF;
@@ -1621,62 +1593,51 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
}
if (bottom_capbase.first) {
BKE_displist_fill(&bottom_capbase, dispbase, bottom_no, false);
BKE_displist_fill(&top_capbase, dispbase, top_no, false);
BKE_displist_fill(&bottom_capbase, r_dispbase, bottom_no, false);
BKE_displist_fill(&top_capbase, r_dispbase, top_no, false);
BKE_displist_free(&bottom_capbase);
BKE_displist_free(&top_capbase);
}
}
}
BKE_displist_free(&dlbev);
}
BKE_displist_free(&dlbev);
if (!(cu->flag & CU_DEFORM_FILL)) {
curve_to_filledpoly(cu, dispbase);
curve_to_filledpoly(cu, r_dispbase);
}
if (!for_orco) {
if ((cu->flag & CU_PATH) ||
DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) {
BKE_anim_path_calc_data(ob);
}
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
curve_calc_modifiers_post(
depsgraph, scene, ob, dispbase, for_render, force_mesh_conversion, r_final);
}
curve_calc_modifiers_post(
depsgraph, scene, ob, r_dispbase, for_render, force_mesh_conversion, r_final);
if (cu->flag & CU_DEFORM_FILL && !ob->runtime.data_eval) {
curve_to_filledpoly(cu, dispbase);
curve_to_filledpoly(cu, r_dispbase);
}
BKE_nurbList_free(&nubase);
}
void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
const Scene *scene,
Object *ob,
const bool for_render,
const bool for_orco)
const bool for_render)
{
/* The same check for duplis as in do_makeDispListCurveTypes.
* Happens when curve used for constraint/bevel was converted to mesh.
* check there is still needed for render displist and orco displists. */
if (!ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) {
return;
}
BLI_assert(ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT));
BKE_object_free_derived_caches(ob);
if (!ob->runtime.curve_cache) {
ob->runtime.curve_cache = (CurveCache *)MEM_callocN(sizeof(CurveCache),
"CurveCache for curve types");
ob->runtime.curve_cache = (CurveCache *)MEM_callocN(sizeof(CurveCache), __func__);
}
ListBase *dispbase = &(ob->runtime.curve_cache->disp);
Mesh *mesh_eval = nullptr;
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, for_render, for_orco, &mesh_eval);
if (ob->type == OB_SURF) {
evaluate_surface_object(depsgraph, scene, ob, for_render, dispbase, &mesh_eval);
}
else {
evaluate_curve_type_object(depsgraph, scene, ob, for_render, dispbase, &mesh_eval);
}
if (mesh_eval != nullptr) {
BKE_object_eval_assign_data(ob, &mesh_eval->id, true);
@@ -1685,19 +1646,19 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
boundbox_displist_object(ob);
}
void BKE_displist_make_curveTypes_forRender(Depsgraph *depsgraph,
const Scene *scene,
Object *ob,
ListBase *dispbase,
const bool for_orco,
Mesh **r_final)
void BKE_displist_make_curveTypes_forRender(
Depsgraph *depsgraph, const Scene *scene, Object *ob, ListBase *r_dispbase, Mesh **r_final)
{
if (ob->runtime.curve_cache == nullptr) {
ob->runtime.curve_cache = (CurveCache *)MEM_callocN(sizeof(CurveCache),
"CurveCache for Curve");
ob->runtime.curve_cache = (CurveCache *)MEM_callocN(sizeof(CurveCache), __func__);
}
do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, true, for_orco, r_final);
if (ob->type == OB_SURF) {
evaluate_surface_object(depsgraph, scene, ob, true, r_dispbase, r_final);
}
else {
evaluate_curve_type_object(depsgraph, scene, ob, true, r_dispbase, r_final);
}
}
void BKE_displist_minmax(const ListBase *dispbase, float min[3], float max[3])
@@ -1730,10 +1691,10 @@ static void boundbox_displist_object(Object *ob)
/* object's BB is calculated from final displist */
if (ob->runtime.bb == nullptr) {
ob->runtime.bb = (BoundBox *)MEM_callocN(sizeof(BoundBox), "boundbox");
ob->runtime.bb = (BoundBox *)MEM_callocN(sizeof(BoundBox), __func__);
}
Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
const Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob);
if (mesh_eval) {
BKE_object_boundbox_calc_from_mesh(ob, mesh_eval);
}

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