1
1

Compare commits

...

1646 Commits

Author SHA1 Message Date
fcb3aeec24 Fix T98708: Crash on startup - OpenGL4.2 without conservative depth.
Intel iGPU (HD4000) supports OpenGL 4.4 but doesn't support conservative
depth. (GL_ARB_conservative_depth). This change will only check for the
availability of the extension.
2022-06-15 09:09:43 +02:00
4acbb84efa GHOST/Wayland: resolve glitch drawing the software cursor
When grab was disabled, the software cursor would remain displayed
in the image view. Ensure an additional redraw is done to clear the
cursor.
2022-06-15 15:45:50 +10:00
2770010224 GHOST/Wayland: fractional scaling support
GHOST_GetDPIHint now returns a value that takes fractional scaling into
account. Otherwise the integer scale is used since Wayland's API's use
integer scale values exclusively.

Use the same method as SDL to calculate the fractional scale.
2022-06-15 15:30:44 +10:00
08f5219d1c Cleanup: use int32_t[2] for Wayland display size variables 2022-06-15 14:34:06 +10:00
46f93ac6be Cleanup: unused argument warning 2022-06-15 14:30:07 +10:00
04a75c90d5 Cleanup: Move function definition to correct file
Function `SEQ_transform_handle_overlap` was declared in sequencer module
header file, but it was defined in editor/transform module.

Move definition to sequencer module.
2022-06-14 22:24:36 +02:00
20ba130315 Fix T72831: Incorrect animation handling when strips overlap
Function `SEQ_transform_seqbase_shuffle_time` did not have access to
strip effects, and therefore could not handle their animation. Since
now transformation knows what strips can't be directly moved, but their
position depends on other strips, this collection of strips is passed as
argument, so animation can be offset correctly.
2022-06-14 21:55:59 +02:00
a59fedb0bf Fix T98168: Meta strips do not copy animation to another scene
Copy animation for strips that are inside metas.
2022-06-14 20:13:45 +02:00
6737f89e49 Fix T98718: Face Is Planar Node Not handling Certain Conditions
The comparison between dot products of each point of the poly were
not taking into consideration negative values. FLT_MIN was used rather
than -FLT_MAX due to a misunderstanding of the FLT_MIN definition.

Maniphest Tasks: T98718

Differential Revision: https://developer.blender.org/D15161
2022-06-14 12:53:50 -05:00
7a24fe372c Fix T98879: PBVH active attrs only optimization is buggy
PBVH draw has an optimization where it only sends the
active attribute to the GPU in workbench mode.  This
fails if multiple viewports are open with a mix of
workbench and EEVEE mode; it also causes severe lag
if any workbench viewport is in material mode.

There are two solutions: either add the code in sculpt-dev
that checks for EEVEE viewports at the beginning of each frame,
or integrate pbvh draw properly inside the draw manager
and let it handle which attributes should go to the GPU.
2022-06-14 10:02:30 -07:00
f5e7221fbd Cleanup: Fix const correctness of attribute search function
Retrieving a mutable custom data layer from a const ID
should not be possible.
2022-06-14 17:26:07 +02:00
b690f4c2e6 Fix T98875: Adding camera background image shows error
Don't show an error if no operator property is set at all that can be
used to find an image file or ID for dropping. The caller can decide if
this is an error that needs reporting or a valid case, like it is here.
2022-06-14 17:07:40 +02:00
06780aa4e6 Fix T98797: VSE Slip Strip Contents doesn't work properly
Caused by oversight in 7afcfe111a - code relied on fact, that strip
boundary holds old value until updated.

Calculate new offsets based on stored orignal offsets.
2022-06-14 17:04:19 +02:00
25f18e6c49 Cleanup: Snake case for variable name 2022-06-14 16:41:43 +02:00
0f06de8072 Attributes: Add null check in color attribute duplicate operator
It's potentially possible that the attribute duplication could fail,
for whetever reason. There is no great reason not to be safe in
this high-level code.
2022-06-14 16:41:43 +02:00
58a67e6fb6 Attributes: Adjustments to duplicate attribute API function
Use a name argument, for the same reasons as 6eea5f70e3.
Also reuse the layer and unique name creation in `BKE_id_attribute_new`
instead of reimplementing it. Also include a few miscellaneous cleanups
like using const variables and `std::string`.
2022-06-14 16:41:43 +02:00
3012eca350 Fix T98700: Regression: Crash when recursively nesting NLA meta strips
The `update_active_strip_from_listbase()` function took meta-strips in
the "source" list into account, but didn't recurse into the
corresponding meta-strip of the "destination" list. This is now fixed.

`update_active_strip_from_listbase()` needed a few changes to resolve
the issue:
- It was renamed to `find_active_strip_from_listbase()` to limit its
  reponsibility to just finding the active strip. It now leaves the
  assignment to the caller. This reduces the number of parameters by 1
  and makes recursion simpler.
- The destination strips are now, like the source strips, passed as
  `ListBase`, so that both source & dest can be recursed simultaneously.
2022-06-14 16:25:20 +02:00
67254ea37c Outliner: Sanitize material unlinking callback, report errors
The callback would just assume that it's only called on materials, which
may in fact not be the case. It could also be called for other ID types
and layer collections (see `outliner_do_libdata_operation()`). Properly
check this now.

Also avoid faling silently when the object or object-data to unlink from
couldn't be determined. Report this to the user. Operators that just do
nothing are confusing.
2022-06-14 16:21:12 +02:00
e772087ed6 Fix T98753: Outliner Unlink material in Blender File mode crashes
This issue was only exposed by ba49345705. The ID pointer of the
material's parent tree-element wasn't actually pointing to an ID, but to
the list-base containing the IDs. It was just unlikely to cause issues
in practice, although an assert was thrown.

Just don't do anything if the object or object-data to unlink the
material from could not be found. The following commit will introduce a
error message about this.
2022-06-14 16:21:12 +02:00
c7942c31b2 Fix: Don't allow duplicate color attribute operator in edit mode
The internal function relies on `CustomData_copy_data_layer` currently,
which doesn't work for BMesh. Support could be added as a special case
for BMesh, but in the meantime avoid bugs by just changing the poll.
2022-06-14 16:01:52 +02:00
ca9d65cc97 Fix T98813: crash with GPU subdiv in edit mode and instanced geometry
Instancing with geometry nodes uses just the evaluated Mesh, and ignores the
Object that it came from. That meant that it would try to look up the subsurf
modifier on the instancer object which does not have the subsurf modifier.

Instead of storing a session UUID and looking up the modifier data, store a
point to the subsurf modifier runtime data. Unlike the modifier data, this
runtime data is preserved across depsgraph CoW. It must be for the subdiv
descriptor contained in it to stay valid along with the draw cache.

As a bonus, this moves various Mesh_Runtime variables into the subsurf runtime
data, reducing memory usage for meshes not using subdivision surfaces.

Also fixes T98693, issues with subdivision level >= 8 due to integer overflow.

Differential Revision: https://developer.blender.org/D15184
2022-06-14 14:54:25 +02:00
4e96d71ddb Render report: better wording for reference image updating
The old text was suggesting to run `BLENDER_TEST_UPDATE=1 ctest` for
failed tests. Now it's more clear that this is for the regeneration of
reference (ground truth) images, and that it will not touch passing test
cases.

It now also mentions to commit the new reference images to SVN, driving
the point home that this is for updating those, and not for making
failing tests succeed in general.

Over-the-shoulder reviewed by: @sergey
2022-06-14 13:02:39 +02:00
Sonny Campbell
d209629806 Fix T85729: Crash when exporting for USD and Alembic
Ensure the "null" node graph, which is the root node of the export
graph, always exists.

The crash occured when "Use Settings For" was set to Render, "Visible
Objects Only" was ticked, and a single parent object is in the scene but
disabled for render.

Because the only object attached to the root of the project was disabled
for export, there was no "null" root node added to the export graph.
This change will always add an empty "null" node with no children to the
graph at the start. Other objects will get added to its children as
required.

Reviewed By: sybren

Maniphest Tasks: T85729

Differential Revision: https://developer.blender.org/D15182
2022-06-14 12:29:56 +02:00
28f4fc664f Cleanup: Variable name style in STL importer
Designate private variable names as described by the style guide,
and also add `num` at the end of variable names rather than at
the beginning, as discussed in T85728.
2022-06-14 12:04:58 +02:00
4475c38c5c Fix T98715: Crash drag-dropping collection from outliner to ID property
The value of disabled buttons shouldn't be changed through dropping onto
it. Check for the disabled state in the drop operator poll, so the
dragging code will change the cursor to show that dropping isn't
possible at the given cursor location.
2022-06-14 11:56:51 +02:00
06e0776175 obj: disable vertex color tests until it produces identical results across platforms 2022-06-14 12:53:41 +03:00
e903403b41 Curves: support adding keymap items for operators
* Add a new keymap for `curves.*` operators. This is mainly for
  edit mode operators, but since we don't have edit mode yet,
  these operators are also exposed in sculpt mode currently.
* Fix the naming of the "sculpt curves" keymap.
2022-06-14 10:53:06 +02:00
c654a92237 Fix use after free error in 827fa81767 2022-06-14 18:01:51 +10:00
c1d295e905 Fix crash in 827fa81767
Missing null pointer check.
2022-06-14 17:36:18 +10:00
e1f15e3b32 Fix T98782: ignore OBJ face normal indices if no normals are present
Some OBJ files out there (see T98782) have face definitions that
contain vertex normal indices, but the files themselves don't
contain any vertex normals. The code was doing a "hey, that's an
invalid index" and skipping these faces. But the old python importer
was silently ignoring these normal indices, so do the same here.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15177
2022-06-14 10:23:28 +03:00
1b4f35f6a5 obj: vertex colors support in importer and exporter
Adds support for vertex colors to OBJ I/O.

Importer:

- Supports both "xyzrgb" and "MRGB" vertex color formats.
- Whenever vertex color is present in the file for a model, it is
  imported and a Color attribute is created (per-vertex, full float
  color data type). Color coming from the file is assumed to be sRGB,
  and is converted to linear upon import.

Exporter:

- Option to export the vertex colors. Defaults to "off", since not
  all 3rd party software supports vertex colors.
- When the option is "on", if a mesh has a color attribute layer,
  the active one is exported in "xyzrgb" form. If the mesh has
  per-face-corner colors, they are averaged on the vertices.
  Colors are converted from linear to sRGB upon export.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15159
2022-06-14 10:19:02 +03:00
827fa81767 Fix cursor coordinates being quantized to the window scale in Wayland
- Apply the scale before converting cursor coordinates to int.
- Store sub-pixel cursor coordinates internally since
  this is what Wayland uses.
- Use `wl_fixed_t xy[2]` for storing coordinates as it simplifies
  assigning/passing x/y coordinates to an argument / variable.
- Also fix drag-and-drop coordinates which ignored scale.
2022-06-14 16:59:33 +10:00
f001c85772 Cleanup: don't define wayland window methods as private
This meant the system couldn't call window methods unless the window
was cast to GHOST_Window.
2022-06-14 15:07:24 +10:00
97f894881c GHOST/Wayland add tablet support
Add support for tablet pressure, tilt and type detection
(eraser, pen.. etc).

There is currently an inconsistency where the tablets cursor is scaled
larger than the mouse cursor (when the UI is scaled). Although there
doesn't seem to be a way to control this from the client.
2022-06-14 14:53:41 +10:00
74e9605455 blend_render_info: minor improvements to file parsing
- Stop once `ENDB` is reached, as files could include additional data.

- Prevent the possibility of an infinite loop from malformed BHEAD
  blocks that could seek backwards in the file.
2022-06-14 14:30:15 +10:00
6c31bd80e3 Cleanup: spelling 2022-06-14 14:30:13 +10:00
b5a5c24396 Cleanup: redundant function calls 2022-06-14 14:30:11 +10:00
0bd6b3e5a0 Cleanup: unused argument, variable warnings 2022-06-14 14:30:09 +10:00
f89ea052f7 Cleanup: remove the need for image scale using a context
Scaling an image shouldn't depend on the current context.
2022-06-14 14:30:06 +10:00
9a063e85a5 Cleanup: quiet unused variable warning 2022-06-14 14:30:04 +10:00
67f5596f19 Fix T98866: GPU subdiv crash in edit mode with loose geometry
The BMesh case was missing when extracting the loose edges flags used for
display, so the code was crashing on unitialized `MEdge` pointer.
2022-06-14 01:39:28 +02:00
77b34a00f9 Fix T97987: Can not keyframe strip mirror in Y axis
Property shared row with toggle for mirror in X axis, so clicking on
decorator added only keyframe for X axis toggle.
2022-06-13 22:35:36 +02:00
afde12e066 Outliner performance: Only expand sub-trees if needed
Before this, we would build the sub-trees of some elements, just to
remove them afterwards. In big files, this would sometimes build ten
thousands of elements unnecessarily. Now support not building those
sub-trees in the first place.

Performance tests in a Sprite Fright production file (release build):
- View Layer display mode, reduced Outliner tree rebuilding from ~45ms
  to 12-17ms
- Library Overrides display mode, Hierarchies view, reduced tree
  rebuilding from 5-6s(!) to 220ms
2022-06-13 22:06:08 +02:00
988fc24930 Fix T93500: Sequence.fps returns 0 when proxy is used
Caused by `seq_open_anim_file` early returning if anim struct exists,
exen if it's not initialized. To ensure `anim` struct is initialized
when `openfile` argument is true, don't do early return.
2022-06-13 20:46:39 +02:00
3b7ce70232 Fix T94499: Knife missed clipping check
The knife BVH raycast functionality was missing a check to discard
points which were clipped.
2022-06-13 19:28:48 +01:00
1c5f09e8a8 Fix T93469: Image not moving in proportion to mouse
Apply scale factor when preview aspect ratio is not 1:1.
2022-06-13 20:12:35 +02:00
1243c2bdae Fix VSE: Effect strip has length of 1 frame when added
Length was set properly when added, but it was clamped by function
`seq_time_effect_range_set`

Add early return for generator effects where offsets can be used
normally.
2022-06-13 18:29:51 +02:00
40d700c6fb UI: Use "bl_order" for UI child panels
The "bl_order" property on add-on UI panels can be used to put
them in a specific order regardless of the order of registering.
This patch makes this ordering also possible for panels inside panels.

Differential Revision: https://developer.blender.org/D15174
2022-06-13 18:27:50 +02:00
e2993719a8 IO: update documentation for HierarchyIterator::weak_export
The documentation for `HierarchyIterator::weak_export` mentions a feature
that was removed at some point. Another example is used to illustrate its
functionality.

No functional changes.
2022-06-13 16:17:00 +02:00
5abe127b3d GPencil: Use better sampling limits.
The problem with T98683 is that sampling interval can be set to very small,
resulting in very dense points. This patch attempts to optimize that a little bit.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15180
2022-06-13 22:13:16 +08:00
85fde25178 LineArt: General code cleanups.
- Use uintxx_t for all 8/16/64 bit integer types.
- Removed prepend_edge_direct thingy which is no longer needed in current edge iterator model.
- Minor code path adjustments like only copies view vector when necessary etc.
- Correctly handle ies==NULL in edge cutting function.
- White spaces and comments etc.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15181
2022-06-13 22:13:16 +08:00
10850f0db9 Cleanup: Use more specific includes for grease pencil modifiers
Also remove unused includes in some cases.
This should make these files recompile less often.
2022-06-13 16:02:44 +02:00
19e0b60f3e Cycles: MetalDeviceQueue - capture of multiple dispatches, and some tidying
This patch adds a new mode of gpu capture (env var `CYCLES_DEBUG_METAL_CAPTURE_SAMPLES`) to capture a block of dispatches between "reset" calls. It also fixes member data naming inconsistencies and adds some missing OS version checks.

Screenshot showing .gputrace capture in Xcode 14.0 beta (using `CYCLES_DEBUG_METAL_CAPTURE_SAMPLES="1"` and `CYCLES_DEBUG_METAL_CAPTURE_LIMIT="10"`):

{F13155703}

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D15179
2022-06-13 13:42:07 +01:00
5ada2afb6d Cleanup: fix various typos
Found via codespell -q 3 -S ./intern,./extern -L ans,ba,bording,datas,eiter,fiter,hist,inout,lod,ot,parm,parms,pixelx,pres,te

Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D15155
2022-06-13 13:17:32 +02:00
434133a631 Cleanup: Remove unused variable and parameter in pbvh_update_draw_buffers 2022-06-13 02:46:35 -07:00
9634f7fae3 Cleanup: Move dragging code for buttons to own file
Moves code for managing dragging data from buttons to a separate file.
This way all this closely related code is in one location, making it
easier to see how it all relates, and easier to find.
2022-06-13 11:15:39 +02:00
16f5d51109 Fix T98735: GPU subdiv displays normals for all elements
The normals flags were not setup properly which made normals for all
elements (vertices, faces) to be drawn when using the normals overlay.
Also remove usage of uints for the flag in the APIs.
2022-06-13 06:20:46 +02:00
c55dac9904 Fix T98745: Anchored mode not working for sculpt smear brush 2022-06-12 12:30:46 -07:00
afe57c4001 Fix T98784: PBVH gpu layout check being ignored
Moved gpu vert format checking outside of pbvh_update_draw_buffers,
which isn't called in every code path of BKE_pbvh_draw_cb. This led
to the draw cache being partially populated by old draw buffers
that were subsequently freed, causing a crash.
2022-06-12 12:12:41 -07:00
37097ae62a Fix T98714: Cursor grab restores to the initial location in Wayland
While Wayland can't warp the cursor, it can set a hint for the cursor
restore location when removing the lock.
2022-06-13 00:20:31 +10:00
3ac656d367 GHOST/Wayland: set the minimum window size
Setting Blender's window 1x1 can happen by accident & causes problems,
set the minimum size as all other GHOST implementations do.
2022-06-12 18:21:23 +10:00
7a849678c9 Fix GHOST/Wayland setting the window size
Zoom in the animation player wasn't working:

- The internal window size value wasn't being updated.
- The window size event wasn't being sent.
2022-06-12 17:48:56 +10:00
07a5869cf6 Fix GHOST/Wayland accessing Ctrl & Alt modifier keys
Only the Shift key was working with GHOST's getModifierKeys method.
Now all modifiers are accessible, since there is no way of detecting
left/right modifiers both are set.
2022-06-12 17:48:56 +10:00
ac2a56d7f3 Fix GHOST/Wayland display glitches on startup
Address two glitches on window creation:

- The DPI was zero until the `surface_enter` callback ran which happens
  after redrawing, causing the splash to display with incorrect scale
  before refreshing once the callback had run.

- The window scale was always 1, even when all outputs were HI-DPI.
  Now the maximum scale of all outputs is used. This isn't fool proof in
  the case of multiple monitors having different scales, however it
  doesn't seem possible to detect the scale used ahead of time
  (details in code-comment).
2022-06-12 17:46:39 +10:00
019df1fa73 Cleanup: use int[2] for window size & pending window size
Also store 'size_pending' with scale applied as it's confusing to only
apply scale to one of the size values.
2022-06-12 17:45:54 +10:00
4c7b0804f8 Cleanup (GPU): Improve efficiency of circle drawing. 2022-06-12 17:49:25 +12:00
cc4d46d91e Fix unreported: Choose nsegments for 2D rotation gizmo based on screen scale.
This mostly affects large rotation gizmos at high DPI.
Without this patch, they appear as 32-gons instead of circles.
2022-06-12 17:47:15 +12:00
9d7e731444 Fix unreported: 2D Gizmo bounding box updated to use gizmo scale. 2022-06-12 17:39:35 +12:00
f24d32f791 Fix T98517: Curve Fill Node creating extra edges.
The delaunay2d function, with mode CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES
sometimes didn't eat away all of the edges. Doing a prepass to remove
the outer edges until they hit the constraints solves this problem.
2022-06-11 12:33:27 -04:00
922861c5dc Cleanup: minor changes to GHOST/Wayland window output access
- Use a window method to handle updating the window after scale changes.
  This avoids the need for methods that return mutable references to
  DPI & scale.
- Remove window.outputs() method that returned window->system->outputs
  as it is misleading to expose these as window outputs when the outpurs
  returned are all known outputs.
- Use a vector instead of an unordered_set to store window outputs,
  while a 'set' does make sense, it means the outputs can't be accessed
  in the order they're added which may be useful for further changes.
- Use early returns.
2022-06-11 21:03:58 +10:00
add1da52ad Fix T97362: forward slashes in USD texture paths
Ensuring that relative paths to textures in exported USDs use
forward slash separators, for cross-platform compatibility.
2022-06-10 15:07:45 -04:00
9e622e1d02 LineArt: Clean up LineartRenderBuffer.
This patch does code clean ups in `LineartRenderBuffer` because it's
grown kinda big and we need better way to organize those variables inside.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15172
2022-06-10 22:49:37 +08:00
f6268f921a USD import: Handle material name collisions
This is a partial fix for T90535.

Added Material Name Collision USD import menu option, to specify
the behavior when USD materials in different namespaces have the
same name.

The Material Name Collision menu options are

- Make Unique: Import each USD material as a unique Blender material.
- Reference Existing: If a material with the same name already
exists, reference that instead of importing.

Previously, the default behavior was to always keep the existing
material. This was causing an issue in the ALab scene, where
dozens of different USD materials all have the same name,
usdpreviewsurface1, so that only one instance of these materials
would be imported.

Reviewed by: Sybren

Differential Revision: https://developer.blender.org/D14869
2022-06-10 10:15:09 -04:00
717ab5aeae LibOverride: Consider animated/driven properties as part of the 'system override' ones in the Outliner.
Conceptually animated/driven properties are not controlled by the
liboverride system anymore, even though they may generate override
operations. So consider them as part of the 'system overrides' category,
and hide them by default in the Outliner.
2022-06-10 15:56:55 +02:00
4d0f7c3dcd LibOverride: Add util to check if a given Override Property is animated.
Searches in available animdata for fcuve(s) with matching RNA path.
2022-06-10 15:56:55 +02:00
f5d0a40122 RNA path: add util to find the char in an RNA path where the array indexing starts.
Usefull to easily trim away the 'aray index' part of an RNA path, e.g.
when searching for an FCurve (which never contains that index part in
its RNA path).
2022-06-10 15:56:55 +02:00
07341d7b32 Liboverride: Add rna array index return value to BKE_lib_override_rna_property_find.
Very useful e.g. for dealing with FCurves search.
2022-06-10 15:56:55 +02:00
9cad614ad5 Fix T98756: GPencil Set Vertex Color Attribute does not color unpainted
The operator set the color but the factor of the mix value was not updated and as the default value was 0, the color was not vivible and only worked when the stroke was previously painted.
2022-06-10 15:25:56 +02:00
Ramil Roosileht
9670c649d8 Fix regression in the recent unit system change
Resolves unit tests failure since the D15085.
Also addressed API documentation and formatting format.

Differential Revision: https://developer.blender.org/D15162
2022-06-10 11:17:14 +02:00
a24a28db7b Cleanup: inconsistent naming with recent locking checks in Wayland 2022-06-10 18:58:37 +10:00
d83a418c45 Fix T98727: Dynamic Paint does not update normals
Caused by {rB6a3c3c77b3eb}.

Displacement and wave were tagging the original mesh normals dirty,
instead the result's normals need tagging. Seems like a typo in above
commit (similar to rBfe43c170831f).

Maniphest Tasks: T98727

Differential Revision: https://developer.blender.org/D15165
2022-06-10 10:52:42 +02:00
28f852ccc3 Fix T98758: Crash setting the clipboard in Wayland
Accessing the clipboard in wayland wasn't thread safe,
use locks for the clipboard, drag & drop data access and when
setting the systems clipboard.
2022-06-10 18:42:34 +10:00
00aa57594c Fix dropping files in Wayland
There were two problems dropping files into blender:

- The inputs `focus_pointer` was NULL, causing a crash.
- The wl_data_device_manager version was set to 1, causing the Blender
  window to close (when dropping files in gnome-shell 42).

Resolve by storing the drop surface separately from the pointer surface
and bump the device manager version to 3.
2022-06-10 18:36:10 +10:00
178c184825 GHOST/Wayland: define a log handler to help tracking down errors
Many errors involving mis-use or unexpected situations report an
error and close Blender's window buy don't crash, making it difficult
to track down when the error occurs.

Define an error handler prints the error and a back-trace,
it can also be useful for setting a break-point
2022-06-10 18:36:10 +10:00
2601b9832d GHOST: add back-trace handler to the API
Add a back-trace handler to GHOST, so error handlers can include a
back-trace (when supported).

No functional changes.
2022-06-10 18:36:10 +10:00
eb9fa052a1 Clenaup: use early returns in GHOST/Wayland 2022-06-10 18:36:10 +10:00
6a11cd036c Cleanup: Clang tidy 2022-06-10 10:29:35 +02:00
aebca2bd65 Fix: Missing include 2022-06-10 10:11:49 +02:00
e6548c03f9 UI: Sculpt Curves Slide icon 2022-06-09 17:17:58 +02:00
32ee2ffc7d Fix: Crash in selection paint brush with empty curves 2022-06-09 15:40:07 +02:00
14d1ad8dd8 FCurve: optimize search from an RNA path + index.
By checking the index value first instead of a full fledge string
comparision in `BKE_fcurve_find`, we can make that code significatly
faster (from about 10% in a Heist production file to over 45% in a
heavily animated test file).

While this code was already very fast (a few microseconds per call
typically), it gets called a lot from the UI (several hundreds of time
per refresh), among other things.

NOTE: the `UNLIKELY` hint is responsible for 25% to 30% of the
speed improvement.
2022-06-09 15:17:20 +02:00
6d726192be Fix variable being used without being initialized 2022-06-09 10:11:14 -03:00
f37a37cafe Fix GHOST/Wayland memory leak when copying text 2022-06-09 21:32:49 +10:00
41c7c744eb Cleanup: use C-style comments, add missing doxy section 2022-06-09 21:31:08 +10:00
ed15900473 Cleanup: use const variables & arguments 2022-06-09 21:26:48 +10:00
8a6cbcf386 Curves: Port delete geometry node to the new curves type
Add a method to remove points from the new curves type, just like
the existing curve removal function. No functional changes are expected.
The code is simpler because all data is just stored as attributes, but
also different because the point data for all curves is stored in the same
arrays.

Similar performance improvements as other commits in T95443 are
expected, expecially for cases where there are many small curves.

Differential Revision: https://developer.blender.org/D15130
2022-06-09 13:09:04 +02:00
0fddff027e Cleanup: Unused but set variable in Cycles Metal profiler 2022-06-09 10:20:26 +02:00
a91c8d8efa Fix T98686: Cant rename local NLA tracks within a local library override data-block.
We need a specific exception to general rule 'no rename of anim channels
in liboverride data' for the locally-inserted NLA tracks.
2022-06-09 09:50:27 +02:00
62dece5c86 Cleanup: return true/false instead of 0/1 when returnin boolean. 2022-06-09 09:37:19 +02:00
38bfa53081 Fix T78815: Redraw UV Editor on collection visibility change 2022-06-09 17:39:56 +12:00
0926495de4 UI: Tooltip Edit - Copy to selected button
This commit changes the tool tip for the "Copy To Selected Button" operator.
The exiting tool tip for this operator suggests that it will "copy property to selected objects or bones".

However, it will only copies the property value to the selected objects or bones if the property already exists on the selected items.
It does not copy the property.

Differential Revision: https://developer.blender.org/D14528
2022-06-08 23:26:15 -04:00
a632260828 Cleanup: Removed unused variable 2022-06-08 22:28:46 -04:00
96f88511ee Fix T98688: Snapping not working in curve objects with evaluated geometry
It's an old behavior. Not really considered a bug.

But snapping to faces is already supported in this case.
And allowing snapping to other elements is not disruptive.
2022-06-08 21:49:11 -03:00
132e58610d Cleanup: spelling in comments & variables 2022-06-09 10:27:20 +10:00
3bdf1c11fb Cleanup: warnings 2022-06-09 10:17:39 +10:00
84906d47dc Cleanup: format 2022-06-09 10:11:25 +10:00
8b8fbffeea Fix software cursor being used with absolute events in Wayland
The software cursor was being enabled with absolute events,
causing a problem with absolute tablet events.

This caused both cursors to be visible at once when using a tablet
(with D15152 applied).
2022-06-09 10:11:25 +10:00
8a02696724 Fix assert triggered when snapping to evaluated geometry of a Curve
Curves can have a Mesh evaluated, but only objects of type Mesh have
EditMesh.

This bug is harmless because `sctx->editmesh_caches.remove(value)` only
works with pointers and `BKE_editmesh_from_object(ob_eval)`, even though
it doesn't actually return a `BMEditMesh`, it still returns a pointer
that doesn't exist as a key.
2022-06-08 20:52:34 -03:00
530f2abb9b Cleanup: quiet warnings 2022-06-09 09:48:37 +10:00
4ff9c0f4e3 Fix armatures not visible in VR
Now that VR offscreen drawing accounts for object type visibility,
armatures should be displayed when specified.
2022-06-09 06:59:03 +09:00
371fc68678 Paint: Fix Image Editor Cursor Disappearing (T90120)
This patch fixes T90120.  The fundamental problem is that 2d and the old 3d paint modes share a single Paint struct, ToolSettings->imapaint.  This patch is a temporary fix until the new 3d paint mode (which has its own Paint struct) is released.

The patch works by listening for `NC_SCENE|ND_MODE` inside `image_listener` in `space_image.c`.   It does not use `ED_space_image_paint_update` since that requires a `bMain.`  Instead it calls `paint_cursor_start` (which is promoted to `ED_paint_cursor_start`).  `image_paint_poll` is also promoted to an `ED_` function.

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D14946
Ref D14946
2022-06-08 12:37:29 -07:00
285a68b7bb Sculpt: PBVH Draw Support for EEVEE
This patch adds support for PBVH drawing in EEVEE.

Notes:
  # PBVH_FACES only.  For Multires we'll need an API to get/cache attributes.  DynTopo support will be merged in later with sculpt-dev's DynTopo implementation.
  # Supports vertex color and UV attributes only; other types can be added fairly easily though.
  # Workbench only sends the active vertex color and UV layers to the GPU.
  # Added a new draw engine API method, DRW_cdlayer_attr_aliases_add.  Please review.
  # The vertex format object is now stored in the pbvh.

Reviewed By: Clément Foucault & Brecht Van Lommel & Jeroen Bakker
Differential Revision: https://developer.blender.org/D13897
Ref D13897
2022-06-08 12:30:01 -07:00
Dennis Ranish
9c28f0eb37 D14823: Adds operator to duplicate the active color attribute layer
Fixes T97706

Adds operator to duplicate the active color attribute layer.
Adds `"Color Attribute Specials"` menu to color attribute ui to access the `"geometry.color_attribute_duplicate"` operator.
Internally adds a function that duplicates a referenced CustomDataLayer
- `BKE_id_attribute_duplicate` mostly copies the existing `BKE_id_attribute_new`
- but gets the type and domain from the referenced layer
- and copies the data from the old layer into the new layer

Reviewed By: Joseph Eagar & Hans Goudey & Julien Kaspar
Differential Revision: https://developer.blender.org/D14823
Ref D14823
2022-06-08 12:10:32 -07:00
Ramil Roosileht
f69c565a33 D15085: Fix numbers jumping in edit voxel size widget
Introduces an option for BKE_unit_value_as_string to skip stripping of zeroes, thus reducing flickering when using edit voxel size widget.

{F13125416}

Reviewed By: Julien Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D15085
Ref D15085
2022-06-08 11:51:29 -07:00
fe4e646405 Fix: Incorrect curves and pointcloud bounding boxes
The generic bounds utility used an incorrect initial value. The value
cannot be zero-initialized, because that breaks the case where all
values are greater than zero.
2022-06-08 18:40:14 +02:00
a3e7280bd8 LibOverride: Make 'image/movieclip user` properties editable. 2022-06-08 18:00:42 +02:00
8843705f65 Fix (unreported) missing rna path for some background image properties.
RNA camera code did not handle path for its image/movieclip users
sub-data, and moviclip RNA struct definition did not have a rna path
function at all.
2022-06-08 18:00:42 +02:00
d62e6f1225 RNA nodetree: improve ImageUser path helper.
Refactor the code, and optimize it slightly (no need e.g. to check for
nodes when the nodetree is of a type that cannot have image user nodes).
2022-06-08 18:00:42 +02:00
1a71f9d2b8 Curves: use radius of middle point to determine curve shape
See {rBb69aad60bda23a53482b2c2ae98715c23a715bc8}
for more details.
2022-06-08 16:52:13 +02:00
cc1cc46099 Fix: incorrect curve parameter for catmull rom curves 2022-06-08 16:42:46 +02:00
17971b8a5b Fix: Heap buffer overflow in new curves set type node 2022-06-08 16:16:45 +02:00
9e393fc2f1 Curves: Port set type node to new data-block
This commit ports the "Set Spline Type" node to the new curves type.
Performance should be improved in similar ways to the other refactors
from the conversion task (T95443). Converting to and from Catmull Rom
curves is now supported. There are a few cases where a lot of work can
be skipped: when the number of points doesn't change, and when the
types already match the goal type.

The refactor has a few other explicit goals as well:
 - Don't count on initialization of attribute arrays when they are
   first allocated.
 - Avoid copying the entire data-block when possible.
 - Make decisions about which attributes to copy when changing curves
   more obvious.
 - Use higher-level methods to copy data between curve points.
 - Optimize for the common cases of single types and full selections.
 - Process selected curves of the same types in the same loop.

The Bezier to NURBS conversion is written by Piotr Makal (@pmakal).

Differential Revision: https://developer.blender.org/D14769
2022-06-08 15:37:46 +02:00
Dilith Jayakody
520be607e8 Fix T98624: Curve Pen NURBS extrusion creates duplicates
The initial point count check was only being done for Bezier curves.
This revision fixes T98624 by adding the check for NURBS curves as well.

Reviewed By: HooglyBoogly

Maniphest Tasks: T98624

Differential Revision: https://developer.blender.org/D15140
2022-06-08 18:37:09 +05:30
7a751327fa Fix T98620: Video sequencer screen corruption occurs when resizing.
Added Windows/Intel GPU to the list of work-a-rounds. This will
reduce the performance when using Intel GPUs on all platforms.
2022-06-08 13:15:28 +02:00
ca29376e00 Cleanup: Move sculpt_automasking.c to c++ 2022-06-08 03:33:18 -07:00
b52760a023 Fix T98565: remove unused BRUSH_PAINT icon definition
This could spam the console with errors (potentionally slowing down in
cases).

Was added in rBeae36be372a6, but not used.

Maniphest Tasks: T98565

Differential Revision: https://developer.blender.org/D15113
2022-06-08 11:21:43 +02:00
fe746b2738 Cleanup: Remove unnecessary namespace specification 2022-06-08 11:04:00 +02:00
5b0e9bd975 Cleanup: Use const variables/pointers 2022-06-08 10:48:19 +02:00
6eea5f70e3 Attributes: Use names instead of layers for some functions
This mirrors the C++ attribute API better, separates the implementation
of attributes from CustomData slightly, and makes functions simpler,
clearer, and safer.

Also fix an issue with removing an attribute caused by 97712b018d
meant the first attribute with the given type was removed instead of
the attribute with the given name.
2022-06-08 10:48:19 +02:00
1af652d42e Fix: Improve poll for convert attribute operator
Converting an attribute does not work from edit mode because
there is no attribute API implemented for BMesh, so disable the
operation in that mode and add a poll message.
2022-06-08 10:48:19 +02:00
83fd3767d3 Fix T98618: Drivers don't automatically update when changing active camera
Active camera is a property of Scene, so need to take scene changes into
account for such drivers to work reliably.

The fix covers all the common cases of such configurations, but some of
them might not be yet fully supported. Mainly cases when the target ID
is not covered by the copy-on-write mechanism.

There is a fuller explanation available in the code for the ease of reading
by the future generations.

Differential Revision: https://developer.blender.org/D15146
2022-06-08 09:12:14 +02:00
8d09a12414 Correct missing doxy-sections in 1269bcce81 2022-06-08 16:19:35 +10:00
1269bcce81 Cleanup: use doxy sections for wayland listeners 2022-06-08 16:05:36 +10:00
8edd1d8aa5 CMake: optionally disable OBJ, STL & GPencil SVG support
The following CMake options have been added (enabled by default),
except for the lite build configuration.

- WITH_IO_STL
- WITH_IO_WAVEFRONT_OBJ
- WITH_IO_GPENCIL (for grease pencil SVG importing).
  Note that it was already possible to disable grease pencil export
  by disabling WITH_PUGIXML & WITH_HARU.

This is intended to keep the lite builds fast and small for building,
linking & execution.

Reviewed By: iyadahmed2001, aras_p, antoniov, mont29

Ref D15141
2022-06-08 13:29:32 +10:00
a1d2efd190 GHOST/Wayland: draw a software-cursor when wrapping cursor motion
As Wayland doesn't support moving the cursor, draw a cross-hair cursor
at the location used by Blender.

Without this, the cursor was locked at the location where grab started,
making some actions unusable since the cursor location was invisible.

Resolves T77311.
2022-06-08 13:16:14 +10:00
b3e0101a35 GHOST/Wayland: non-wrapping grab no longer locks the cursor
Grab which didn't wrap would lock the cursor, making actions such
as resizing areas lock the cursor in-place.

Confine the cursor to the window instead.

This behavior was also used for X11 when grabbing the cursor was first
supported but could lock the system if Blender froze while grabbing so
it was disabled [0].

For Wayland this shouldn't be a problem as compositors implement grab
in a way that prevents the client from locking the system.

[0]: 3e3d2b7a4c
2022-06-08 11:45:44 +10:00
173a15bcda BLI: Math: Add description and test to ceil_to_multiple and divide_ceil
I took the decision to assert on unexpected value as the behavior of these
functions are not consistent across the whole integer domain.
2022-06-07 20:08:39 +02:00
a857156578 UI: Curves Sculpt density + smooth brushes
More information in the svn log. But basically the smooth brush
is re-using the previous one we had for hair, and the density is
representing the hair root points that are removed to reach the
desired density.

Those brushes are used by D15134.
2022-06-07 19:08:07 +02:00
3e7d977886 IME Cleanup: Removal of BLT_lang_is_ime_supported
Removal of BLT_lang_is_ime_supported which is always returns true and
is no longer needed.

See D11800 for more details.

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

Reviewed by Campbell Barton
2022-06-07 10:03:26 -07:00
9fda233897 Cleanup: Use const pointers in attribute API 2022-06-07 18:55:56 +02:00
d39e0f9616 Fix: Incorrect logic in attribute search function
If a geometry does not have CustomData for a certain domain,
it may still have CustomData on other domains. In that case
we need to continue to the other domains instead of returning.
This worked for meshes because the domains are all at the
start of the `info` array. It didn't work for curves.
2022-06-07 18:38:39 +02:00
627d42cd56 Merge branch 'blender-v3.2-release'
# Conflicts:
#	source/blender/draw/engines/eevee/shaders/volumetric_vert.glsl
2022-06-07 18:32:34 +02:00
ec493d79fa BLI: Math: Add math::divide_ceil and math::ceil_to_multiple
`math::divide_ceil` is just the vector implementation of `divide_ceil_u`.

`math::ceil_to_multiple` is similar but finaly multiply by the divisor.
It is handy to handle tile buffers resolutions.
2022-06-07 18:31:06 +02:00
b568f445a5 Fix T98647: EEVEE: Camera Data Node's View Vector Broken
Fix regression and remove duplicated computation.
2022-06-07 18:14:16 +02:00
391485f412 Fix EEVEE: Shader error when using volume temperature or color attributes
This bug was unreported. This was triggering a linking error caused by
the vertex shader not having a local version of `attr_load_temperature_post`
and `attr_load_color_post`.
2022-06-07 18:13:09 +02:00
60442b0292 Fix T98091: EEVEE: Volume: Crash caused by non-present grid
This was caused by the `copy_m4_m4` trying to copy the `object_to_texture`
from `drw_grid` which was `nullptr`.

Fixing this also exposed that rendering such volumes (without any valid
grid attributes) is not supported and we should follow what Cycles does.

Differential Revision: https://developer.blender.org/D15147
2022-06-07 18:12:19 +02:00
7974d2bff6 CustomData: Add function to free a named layer
This can be useful to avoid unnecessary boilerplate in various users
of the CustomData API. Split from D14685 and D14769.
2022-06-07 18:00:30 +02:00
9c029a3eb0 Fix T98621: Image does not update when tweaking strip properties
Problem was caused by `startdisp` and `enddisp` still being used after changes
implemented in rB7afcfe111aac.
2022-06-07 17:02:40 +02:00
Monique Dewanchand
e62a33e572 Nodes: Show node description in Node add menu
Though no nodes have descriptions currently, this patch makes it
possible to add descriptions that display in the add menu, for
custom node systems and existing builtin nodes.

Differential Revision: https://developer.blender.org/D14963
2022-06-07 15:40:31 +02:00
ccf0d22e92 Fix T98626: Mesh Deform modifier stops working on a linked collection upon undo.
Regression from rBb66368f3fd9c, we still need to store all data on undo
writes, since overrides are not re-applied after undo/redo.
2022-06-07 15:30:05 +02:00
b69aad60bd Curves: use root/tip radius of the first curve in the viewport
Viewport drawing does not support a per point radius attribute yet.
Instead, it has a fixed set of radius parameters that are used for all
curves in the same object. Now those radii are retrieved from the
radius attribute of the points on the first curve. This allows users
to control the radius of curves to some degree until proper per-point
radius is supported.
2022-06-07 15:03:58 +02:00
Martijn Versteegh
1203bd58be Fix: Make renaming attributes check uniqueness on all domains
This function only checked for uniqueness in the current domain,
while attribute names should be unique among all domains within
a geometry.

Differential Revision: https://developer.blender.org/D15144
2022-06-07 14:52:27 +02:00
503bcaf1a2 Marker drawing: don't restore GPU line width
Adhere to the documented use of `GPU_line_width()` and don't restore the
previously set line width.
2022-06-07 14:36:45 +02:00
f49efed953 Curves: fix transforms in Add brush
Symmetry should be applied in the space of the curves object,
not in the space of the surface object.
2022-06-07 14:21:02 +02:00
3b7e314a28 Cleanup: remove dead code 2022-06-07 14:21:02 +02:00
d422715094 Fix drawing increments after running Spin gizmo
Caused by {ea182deeb9cdd2a9137e98eb0072f57c0fb1e09f}.
2022-06-07 09:12:20 -03:00
1456f30b02 Cleanup: potential dereferencing of a NULL pointer
If `cancel` is `false`, `NULL` `inter` pointer dereferencing could occur.

Currently I haven't found a case where this can happen.

But it's best to avoid.
2022-06-07 09:01:46 -03:00
2918a3a2a3 Cleanup: spelling in comments, minor formatting tweaks 2022-06-07 21:22:55 +10:00
1e0e1ad20f Cleanup: note that checking only the left modifiers isn't a mistake 2022-06-07 21:22:55 +10:00
2935b6a2ac Add Instance Offset operators to Collections property panel
Add three operators to the Collections properties panel:

- `object.instance_offset_to_cursor`, which is already available from
  the Object properties panel. The operator works on the active
  collection, though, so it's weird to not have it in the Collections
  panel.
- `object.instance_offset_from_object` is a new operator, which performs
  the same operation as above, but then based on the active object's
  evaluated world position.
- `object.instance_offset_to_cursor` is also new, and performs the
  opposite of the first operator: it moves the 3D cursor to the
  collection's instance offset.

The first two operators make it easier to set the instance offset. The
last operator makes it possible to actually see the offset in the 3D
viewport; drawing it using some overlay could also work, but that would
be more effort to get right, and then snapping the 3D cursor would still
be useful.

The operators are placed in a popup menu, as to not clutter the
interface too much with various buttons.

Reviewed By: dfelinto, eyecandy

Differential Revision: https://developer.blender.org/D14966
2022-06-07 13:10:13 +02:00
3a8a44b3f9 Keymap: use both left/right modifier keys
Use both left/right modifier keys for:

- Fly Mode.
- Walk Mode.
- Area Split.
- Sculpt Detail Map.
- Sculpt Expand.
- Standard Modal Map

Resolves T98638.
2022-06-07 21:03:08 +10:00
16934c198a LibOverride: Attempt to improve handling of cyclic deps between libraries.
Those cyclic dependencies (lib_A depends on a texture from lib_B, which
links geometry from lib_A) are bad, but previous code did not always
helped much in idendtifying to actuall issue point.

Now, reduce maximum 'recursion' level to 100 (this should already never
be reached in practice), and additionally report warnings when reaching
level 90, so that user gets more context data to identify more easily
the culprit.
2022-06-07 12:53:04 +02:00
Michael Jones
4412e14708 Cycles: Useful Metal backend debug & profiling functionality
This patch adds some useful debugging & profiling env vars to the Metal backend:

- `CYCLES_METAL_PROFILING`: output a per-kernel timing report at the end of the render
- `CYCLES_METAL_DEBUG`: enable per-dispatch tracing (very verbose)
- `CYCLES_DEBUG_METAL_CAPTURE_KERNEL`: enable programatic .gputrace capture for a specified kernel index

Here's an example of the timing report with `CYCLES_METAL_PROFILING` enabled:

```
---------------------------------------------------------------------------------------------------
Kernel name                                 Total threads   Dispatches     Avg. T/D    Time   Time%
---------------------------------------------------------------------------------------------------
integrator_init_from_camera                   657,407,232          161    4,083,274   0.24s   0.51%
integrator_intersect_closest                1,629,288,440          681    2,392,494  15.18s  32.12%
integrator_intersect_shadow                   751,652,291          470    1,599,260   5.80s  12.28%
integrator_shade_background                   304,612,074          263    1,158,220   1.16s   2.45%
integrator_shade_surface                    1,159,764,041          676    1,715,627  20.57s  43.52%
integrator_shade_shadow                       598,885,847          418    1,432,741   1.27s   2.69%
integrator_queued_paths_array               2,969,650,130          805    3,689,006   0.35s   0.74%
integrator_queued_shadow_paths_array          593,936,619          379    1,567,115   0.14s   0.29%
integrator_terminated_paths_array              22,205,417          155      143,260   0.05s   0.10%
integrator_sorted_paths_array               2,517,140,043          676    3,723,579   1.65s   3.50%
integrator_compact_paths_array                648,912,748          155    4,186,533   0.03s   0.07%
integrator_compact_states                      20,872,687          155      134,662   0.14s   0.29%
integrator_terminated_shadow_paths_array      374,100,675          438      854,111   0.16s   0.33%
integrator_compact_shadow_paths_array         503,768,657          438    1,150,156   0.05s   0.10%
integrator_compact_shadow_states               37,664,941          202      186,460   0.23s   0.50%
integrator_reset                               25,165,824            6    4,194,304   0.06s   0.12%
film_convert_combined_half_rgba                 3,110,400            6      518,400   0.00s   0.01%
prefix_sum                                            676          676            1   0.19s   0.40%
---------------------------------------------------------------------------------------------------
                                                                 6,760               47.27s 100.00%
---------------------------------------------------------------------------------------------------
```

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15044
2022-06-07 11:08:39 +01:00
4fc7e1a880 Cleanup: Correct comments 2022-06-07 11:55:52 +02:00
4637f3e83c Merge branch 'blender-v3.2-release' 2022-06-07 10:52:38 +02:00
58d350b489 GPUMaterial: Make compilation fail when reusing failed GPUPass
This avoid leaving a `GPUMaterial` in a `GPU_MAT_QUEUED` state which would
block rendering.

Fix T98603: Hang when saving project in material preview mode

Maniphest Tasks: T98603

Differential Revision: https://developer.blender.org/D15135
2022-06-07 10:48:13 +02:00
dcbbdc89ea Cleanup: Fix missing-braces warning in draw manager
Good side effect of the change is that it makes it so that the
size of an array is more likely to be calculated at a compile time.

More ideally we'll be using bli::Array instead of the bare array,
but that is outside of the scope of this change.
2022-06-07 10:35:33 +02:00
9ccc21dde3 VSE preview transform autokeying improvements
NOTE: this patch originated in T98015 which was split into multiple
reports. While it could be split into multiple patches these are very
much related so keeping as one for now

This patch fixes the following issues:

[1] autokeying transforms in preview only creates keyframes if there is
an FCurve already
[2] autokeying transforms in preview only creates keyframes for
rotation/scale if rotating/scaling around cursor (should keyframe
position as well)
[3] autokeying transforms in preview does not work during animation
playback

For [1], a param was added to `ED_autokeyframe_property` which can tweak
its default behavior of only creating keyframes on already keyed
properties (which was fine because this is mostly called from buttons
where this behavior is desired). Callers such as gizmos (or the VSE in
our case) can use this additional param so that keyframes are also
created on "not-yet-keyframed" properties.

For [2], the pivot is checked and position properties also keyed if
necessary (which is also consistent with the way objects are keyed in
the 3DView)

For [3], `animrecord_check_state` was changed to be able to work on
scenes as well and the transform system in the VSE preview was made
aware of the screen's `animtimer`.

NOTE: there are still things to be improved for keyframing in the VSE,
the most obvious is probably a `keyframe_insert` operator (with
keyingsets)

Fixes T98429, T98430, T98431

Maniphest Tasks: T98015, T98431, T98430, T98429

Differential Revision: https://developer.blender.org/D15047
2022-06-07 09:53:11 +02:00
4580c18c56 Correct error in 7c4826d971 2022-06-07 17:42:11 +10:00
Joseph Faulkner
b77494ec61 Fix T98527 : corrected label for Korean language in Blender preferences
Patch changes label from '한국 언어' to '한국어'

Reviewed By: persun, PratikPB2123, mont29

Maniphest Tasks: T98527

Differential Revision: https://developer.blender.org/D15120
2022-06-07 09:35:27 +02:00
7c4826d971 Fix T98552: Experimental Tweak Select: Curve handle tweak is difficult
The previous fix [0] only resolved the issue for RMB select,
this works for the tweak tool with LMB select.

[0]: 0f73a27b76
2022-06-07 16:53:54 +10:00
99847cd642 OBJ: Use filename as the default object name
To match the existing Python .obj importer, and to make it easier for
the user to determine which object is which, use the filename for the
default object name instead of "New object".

Differential Revision: https://developer.blender.org/D15133
2022-06-06 22:38:02 -07:00
b4d3ca624e Logging: remove unnecessary newlines 2022-06-07 15:01:03 +10:00
263371dc4e Cleanup: spelling in comments, additional white space 2022-06-07 15:01:03 +10:00
243891104f Cleanup: use doxy sections for mask add operators & functions 2022-06-07 14:40:51 +10:00
af6a68217f Cleanup: format 2022-06-07 14:40:51 +10:00
ea182deeb9 Remove workaround for drawing the rotation gizmo
Since [0], transform gizmos are no longer hidden during transform.

The same can be observed for rotation gizmos.

However, as a workaround for these rotation gizmos, there was already a
drawing utility running.

With the gizmo and the utility this drawing is now being done twice.

So remove the utility/workaround and update the gizmo accordingly.

[0] {648350e456490f8d6258e7de9bf94d3a6a34dbb2}

Differential Revision: https://developer.blender.org/D9542
2022-06-07 00:38:23 -03:00
b3101abcce blend_render_info: Zstd support, skip redundant file reading & cleanup
- Use a context manager to handle file handlers (closing both in the
  case of compressed files).

- Seek past BHead data instead of continually reading
  (checking for 'REND').

- Write errors to the stderr (so callers can differentiate it from the
  stdout).

- Use `surrogateescape` in the unlikely event of encoding errors
  so the result is always a string (possible with files pre 2.4x).

- Remove '.blend' extension check as it excludes `.blend1` files
  (we can assume the caller is passing in blend files).

- Define `__all__` to make it clear only one function is intended
  to be used.
2022-06-07 13:15:56 +10:00
56ede578e7 Cleanup: compiler warnings: unused args, missing include, parenthesis 2022-06-07 11:50:10 +10:00
Iyad Ahmed
7c511f1b47 STL: Add new C++ based STL importer
A new experimentatl STL importer, written in C++. Roughly 7-9x faster than the
Python based one.

Reviewed By: Aras Pranckevicius, Hans Goudey.
Differential Revision: https://developer.blender.org/D14941
2022-06-06 20:57:38 +03:00
14fc89f38f Geometry Nodes: Add Instance Scale Input Node
A field input node for the scale of each top-level instance transform.
The scale can be set with the "Scale Instances" node, but previously
could not be retrieved.

Differential Revision: https://developer.blender.org/D15132
2022-06-06 12:02:59 -05:00
3a57f5a9cf Geometry Nodes: Instance Rotation Node
A field input node for the rotation of each top-level instance transform.
The rotation can be set with the "Rotate Instances" node, but previously
could not be retrieved.

Differential Revision: https://developer.blender.org/D15131
2022-06-06 11:50:13 -05:00
f700aa67ac Geometry Nodes: Fix Assert in Duplicate Elements
The original assert did not take into account the offset size in the loop being -1. The tests were then run in non-debug mode, so while the mesh regressions still passed, the false positive asserts that happened were not caught.

Differential Revision: https://developer.blender.org/D15136
2022-06-06 11:15:24 -05:00
128aa7f3b0 Geometry Nodes: Fix Assert in Duplicate Elements
The original assert did not take into account the offset size in the loop being -1. The tests were then run in non-debug mode, so while the mesh regressions still passed, the false positive asserts that happened were not caught.

Differential Revision: https://developer.blender.org/D15136
2022-06-06 11:10:27 -05:00
3772dda4ab Refactor: Snap-related. Clarified attribute names and refactored #defines into enums
The transformation snapping code contains a bunch of `#define`s, some ambiguously or incorrectly named attributes.  This patch contains refactored code to improve this.  This patch does (should) not change functionality of snapping.

Clarified ambiguously / incorrectly named attributes.

  - "Target" is used to refer to the part of the source that is to be snapped (Active, Median, Center, Closest), but several other areas of Blender use the term "target" to refer to the thing being snapped to and "source" to refer to the thing getting snapped.  Moreover, the implications of the previous terms do not match the descriptions.  For example: `SCE_SNAP_TARGET_CENTER` does not snap the grabbed geometry to the center of the target, but instead "Snap transforamtion center onto target".
  - "Select" refers to the condition for an object to be a possible target for snapping.
  - `SCE_SNAP_MODE_FACE` is renamed to `SCE_SNAP_MODE_FACE_RAYCAST` to better describe its affect and to make way for other face snapping methods (ex: nearest).

Refactored related `#define` into `enum`s.  In particular, constants relating to...

  - `ToolSettings.snap_flag` are now in `enum eSnapFlag`
  - `ToolSettings.snap_mode` are now in `enum eSnapMode`
  - `ToolSettings.snap_source` (was `snap_target`) are now in `enum eSnapSourceSelect`
  - `ToolSettings.snap_flag` (`SCE_SNAP_NO_SELF`) and `TransSnap.target_select` are now in `enum eSnapTargetSelect`

As the terms became more consistent and the constants were packed together into meaningful enumerations, some of the attribute names seemed ambiguous.  For example, it is unclear whether `SnapObjectParams.snap_select` referred to the target or the source.  This patch also adds a small amount of clarity.

This patch also swaps out generic types (ex: `char`, `short`, `ushort`) and unclear hard coded numbers (ex: `0`) used with snap-related enumerations with the actual `enum`s and values.

Note: I did leave myself some comments to follow-up with further refactoring.  Specifically, using "target" and "source" consistently will mean the Python API will need to change (ex: `ToolSettings.snap_target` is not `ToolSettings.snap_source`).  If the API is going to change, it would be good to make sure that the used terms are descriptive enough.  For example, `bpy.ops.transform.translate` uses a `snap` argument to determine if snapping should be enabled while transforming.  Perhaps `use_snap` might be an improvement that's more consistent with other conventions.

This patch is (mostly) a subset of D14591, as suggested by @mano-wii.

Task T69342 proposes to separate the `Absolute Grid Snap` option out from `Increment` snapping method into its own method.  Also, there might be reason to create additional snapping methods or options.  (Indeed, D14591 heads in this direction).  This patch can work along with these suggestions, as this patch is trying to clarify the snapping code and to prompt more work in this area.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D15037
2022-06-06 10:56:22 -04:00
a094cdacf8 BLI: fix memory error when moving VArray_Span
The issue was that the new span still referenced data that was potentially
stored in the old VArray_Span.
2022-06-06 14:01:25 +02:00
7eb2018a0b Fix Windows compiler error
This error was introduced in 176d7bcc2e

Fix provided by @deadpin
2022-06-06 09:42:36 +02:00
bb9647b703 PyDocs: remove sphinx-intl
Cop paste mistake from rB3cd283a424ec92ef85e1856d66f0baa4d2253fc5
2022-06-05 23:13:26 -04:00
3cd283a424 Py Docs: Update Sphinx and dependencies
- Adds python 3.10 support
- Slightly improves performance
2022-06-05 23:05:48 -04:00
011d9cce19 UI: offset scale gizmos instead of scaling their shape
Scaling handles while dragging could be distracting, especially at
extreme values where handles could become large on-screen.

Now all gizmos are shown while scaling.

GIZMO_GT_arrow_3d now now support changing their length while being
dragged as well as negative lengths.
2022-06-06 12:48:49 +10:00
bb34afac56 Cleanup: quiet compiler warning 2022-06-06 12:45:42 +10:00
8589f60546 Curves: Port bounding box node to the new curves type
Avoid the conversion to and from the old type, which could
be a substantial improvement in somce cases.
2022-06-05 21:05:13 +02:00
c7e4c43072 Cleanup: Remove unused BKE_spline.hh includes 2022-06-05 21:00:03 +02:00
93a68f2a90 Curves: Fix overallocation for curve attributes when deleting curves
Curve attributes were allocated to the size of the point domain, which
wouldn't cause bad behavior, just potentially worse performance.
2022-06-05 20:00:06 +02:00
270a24cc64 Fix: incorrect operator warning 2022-06-05 17:51:37 +02:00
545d469879 Cleanup: Move wm_event_system.c to C++
This allows the use of C++ data structures to simplify code and
improve performance.
2022-06-05 16:47:42 +02:00
c4e11122c5 Geometry Nodes: Use fields for delete geometry inversion
The separate geometry and delete geometry nodes often invert the
selection so that deleting elements from a geometry can be implemented
as copying the opposite selection of elements. This should make the two
nodes faster in some cases, since the generic versions of selection
creation functions (i.e. from d3a1e9cbb9) are used instead
of the single threaded code that was used for this node.

The change also makes the deletion/separation code easier to
understand because it doesn't have to pass around the inversion.
2022-06-05 16:46:20 +02:00
72ea37ae5f UI: align gizmo scale handles to both Y and Z axes
This resolves a minor inconsistency displaying the scale gizmo handles
since they're cubes it's noticeable when they're not axes aligned.
2022-06-05 23:43:07 +10:00
648350e456 UI: show gizmo while transforming
When interacting with translate/rotate/scale gizmo, show the gizmo while
it's in use. There are some exceptions to this, as showing all scale
gizmos while scaling causes the gizmos to become large & distracting so
in this case only the gizmo being dragged is shown.

Resolves T63743.
2022-06-05 23:21:50 +10:00
d450a791c3 Cleanup: assign operator type flags in their initialization
Some operators OR'ed the existing flags in a way that made it seem
the value might already have some values set.
Replace this with assignment as no flags are set and the convention
with almost all operators is to write the value directly.
2022-06-05 23:05:38 +10:00
4e3ce04855 Cleanup: Use shorter variable name 2022-06-05 12:37:45 +02:00
e37eebf16f Cleanup: Comments and formatting in mesh extract headers
Also remove accidentally committed WIP commented code.
2022-06-05 12:15:31 +02:00
899ec8b6b8 Curves: use uv coordinates to attach curves to mesh
This implements the new way to attach curves to a mesh surface using
a uv map (based on the recent discussion in T95776).

The curves data block now not only stores a reference to the surface object
but also a name of a uv map on that object. Having a uv map is optional
for most operations, but it will be required later for animation (when the
curves are supposed to be deformed based on deformation of the surface).

The "Empty Hair" operator in the Add menu sets the uv map name automatically
if possible. It's possible to start working without a uv map and to attach the
curves to a uv map later on. It's also possible to reattach the curves to a new
uv map using the "Curves > Snap to Nearest Surface" operator in curves sculpt
mode.

Note, the implementation to do the reverse lookup from uv to a position on the
surface is trivial and inefficient now. A more efficient data structure will be
implemented separately soon.

Differential Revision: https://developer.blender.org/D15125
2022-06-05 12:14:32 +02:00
176d7bcc2e Cleanup: Move remaining mesh draw code to C++
After this commit, all mesh data extraction and drawing code is in C++,
including headers, making it possible to use improved types for future
performance improvements and simplifications.

The only non-trivial changes are in `draw_cache_impl_mesh.cc`,
where use of certain features and macros in C necessitated larger
changes.

Differential Revision: https://developer.blender.org/D15088
2022-06-05 12:04:58 +02:00
31da775ec2 Fix compiling debug build 2022-06-05 12:04:24 +02:00
Pablo Dobarro
e90ba74d3e D15041: Sculpt: Elastic Transform
This implements transform modes for the transform tool and Elastic
Transform. This mode uses the Kelvinlets from elastic deform to apply
the transformation to the mesh, using the cursor radius to control the
elasticity falloff.

{F9269771}

In order for this to work, the transform tool uses incremental mode when
elastic transform is enabled. This allows to integrate the displacement of
the Kelvinet in multiple steps.

Review By: Sergey Sharbin & Daniel Bystedt & Julian Kaspar & Campbell
Barton

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

Ref D15041
2022-06-04 13:50:28 -07:00
e230ccaf8c Fix Wintab button tracking logic.
Shifted flag for buttons changed was incorrectly compared with
unshifted packet flag to determine button press state.

Also fix button tracking storage; button flags are 32 bits whereas the
member variable was 8.

Differential Revision: https://developer.blender.org/D14915
2022-06-04 09:39:32 -07:00
db5ffdd1a4 Cleanup: Use const for retrieved custom data layers 2022-06-04 17:12:17 +02:00
6572ad8620 Cleanup: Use const, make format 2022-06-04 16:51:20 +02:00
a5190dce9d Mesh: Only check dirty normals flag of current domain
The code that checked whether vertex normals needed to be recalculated
was checking the dirty tag for face normals and vertex normals, in an
attempt at increased safety. However, those tags are always set
together anyway. Only checking the vertex dirty tag allows potentially
allocating or updating the normals on the two domains independently,
which could allow further skipping of calculations in some cases.
2022-06-04 16:30:57 +02:00
23f8fc38d9 Cleanup: Remove unnecessary struct keywords 2022-06-04 13:31:30 +02:00
9531eb24b3 Fix T98580: image flip/invert/resize don't work on active UDIM tile 2022-06-03 19:42:22 +02:00
8e02b53ae7 Sculpt: Fix zeroing of last position on stroke start
Fixes bug where clicking in empty space resets
viewport pivot in rotate around active mode
to zero.
2022-06-03 10:41:05 -07:00
2681e480ea Fix T98579: image save operators changing file path to absolute 2022-06-03 19:25:57 +02:00
da45c12bef Merge branch 'blender-v3.2-release' 2022-06-03 19:02:46 +02:00
34f94a02f3 Fix use of OpenGL interop breaking in Hydra viewports that do not support it
Rendering directly to a resource using OpenGL interop and Hgi
doesn't work in Houdini, since it never uses the resulting resource
(it does not call `HdRenderBuffer::GetResource`). But since doing
that simultaneously disables mapping (`HdRenderBuffer::Map` is
not implemented then), nothing was displayed. To fix this, keep
track of whether a Hydra viewport does support displaying a Hgi
resource directly, by checking whether
`HdRenderBuffer::GetResource` is ever called and only enable use
of OpenGL interop if that is the case.

Differential Revision: https://developer.blender.org/D15090
2022-06-03 18:56:30 +02:00
3fe7d049d2 Fix new curve objects showing as UNKNOWN in the outliner
The fix is to unify with the name we had for the old Curves objects.

That means that we will see them bothi (old and new curves) in the outliner
(under two different categories but with different names).

This is considered to be a temporary solution until we remove the old
curve system entirely.
2022-06-03 18:40:14 +02:00
5cc118fc09 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-06-03 17:10:16 +02:00
7f7ed8e098 Fix T98571: corrupted face selection drawing with GPU subdivision
Simple typo in rB55e3930b253e.
2022-06-03 17:09:44 +02:00
6b9a3be03d Cleanup: clang-format 2022-06-03 16:55:21 +02:00
e7156be86e Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-06-03 16:13:51 +02:00
0b38b8dafa Spreadsheet Editor: Support int 8 attribute
This was leading to some crashes and warnings such as:

"Code marked as unreachable has been executed. Please report this as a bug."

Differential Revision: https://developer.blender.org/D15116
2022-06-03 16:13:28 +02:00
e73fd4f0c0 Fix (unreported) important memory leak in Boolean modifier using a Collection operand and Fast mode.
Code handling repetitive boolean operations when using several objects
from a Collection would not handle result mesh properly, re-creating for
each object without properly freeing it.

Further more, existing code was effectively converting the BMesh to mesh
twice, including a modification of the initial (input) mesh, which
modifiers should never do!

Removed the extra useless conversion, which also gives a small
improvement in performances:

With as simple of a scene as four objects (three operands in a
collection, and the modified one) totalling 20k vertices/faces, this
commit:
* Avoids 2MB memory leak per evaluation (!).
* Speeds up boolean evaluation by 5-10%.

Found while investigating some production files of the Project Heist
here at the Blender Studio.
2022-06-03 16:07:05 +02:00
691ab3fc46 Fix (unreported) invalid debug timing code in Boolean modifier code. 2022-06-03 16:07:05 +02:00
1a3ac2f750 Tests: Add basic testing for boolean modifiers.
Test basic Difference operation with both a single Objetc and a
collection of three objects as operands, using BMesh (aka 'FAST') mode.
2022-06-03 16:07:05 +02:00
5d9ebea15d Cleanup: remove unused code 2022-06-03 16:02:04 +02:00
12722bd354 Curves: Add surface UV map name property
In the latest discussions about curves/hair mesh attachement
information (T95776), it was decided to use UV coordinates to
store where on the mesh each root is. For that, we have to specify
which of the UV map attributes to use for UV lookups.

This property isn't used yet, but it will be shortly when refactoring
the attachement information in the add brush and the to particle
system conversion.

Differential Revision: https://developer.blender.org/D15115
2022-06-03 15:54:03 +02:00
2780c7e312 Cleanup: deduplicate resampling curve after moving last point 2022-06-03 15:40:18 +02:00
074010ad6d Fix T98570: Cycles AOVs not working in background shader
Must include the AOV writing feature in background shader evaluation.

Differential Revision: https://developer.blender.org/D15114
2022-06-03 15:34:31 +02:00
9d8fb80f21 Eevee/Workbench: store 8 bit image textures as half float for some color spaces
Same as in Cycles, this is needed for some color space conversions that don't
compress well to byte sRGB, like for example Filmic sRGB.

Ref T68926
2022-06-03 15:25:23 +02:00
4c4056579b Fix typo in colorspace description 2022-06-03 15:25:23 +02:00
d040e1da4f Constraints: introduce wrapper functions to access target lists.
Instead of directly accessing constraint-specific callbacks
in code all over blender, introduce two wrappers to retrieve
and free the target list.

This incidentally revealed a place within the Collada exporter
in BCAnimationSampler.cpp that didn't clean up after retrieving
the targets, resulting in a small memory leak. Fixing this should
be the only functional change in this commit.

This was split off from D9732.

Differential Revision: https://developer.blender.org/D13844
2022-06-03 16:18:26 +03:00
284a3431ae Cycles: Fix rendering of packed UDIM tiles with different sizes
The packed image loader was not aware of the fact that UDIM tiles
can be of a different size.

Exposed Python API required to access this information. It has the
same complexity as the "regular" packed files: in both cases the
ImBuf will be acquired and released to access the information.

While the current workflow of packing UDIMs is not very streamlined,
it is still possible and is something what the studio is using here.

Test file:
{F13130516}

Expected behavior achieved with this patch: a bigger checker board
pattern in viewport render

Actual behavior prior to this patch: either memory corruption, or
wrong/black render result on the plane

Differential Revision: https://developer.blender.org/D15111
2022-06-03 14:23:23 +02:00
fa5cf5360c Merge branch 'blender-v3.2-release' 2022-06-03 14:11:48 +02:00
cf6c8ae01b Fix T98573: Rescaling Image by python wrong
This did not refresh the Image editor, but more importantly this now
appeared cropped (a regression from the partial image updater).

Solved in the RNA function by:
- calling BKE_image_partial_update_mark_full_update
- sending appropriate notifier

Maniphest Tasks: T98573

Differential Revision: https://developer.blender.org/D15110
2022-06-03 14:08:21 +02:00
6b84465352 Cleanup: remove dead code 2022-06-03 13:51:05 +02:00
0a2a8d702a Fix: Curves sculpt mode keymaps missing in preferences
These changes make the curves sculpt mode keymap consistent
with other modes. They now show up in the keymap, for potential
editing of tool shortcuts, etc. I don't fully understand this system,
but at least these changes should make it consistent.

Differential Revision: https://developer.blender.org/D15112
2022-06-03 13:41:16 +02:00
3b51d9065c Cleanup: deduplicate retrieving data from context in curves brushes 2022-06-03 13:39:59 +02:00
5c6053ccb1 Fix misaligned address error when rendering 3D curves in the viewport with Cycles and OptiX 7.4
Acceleration structures in the viewport default to building with the fast
build flag, but the intersection program used for curves was queried with
the fast trace flag. The resulting mismatch caused an exception in the
intersection kernel. Since it's difficult to predict whether dynamic or static
acceleration structures are going to be built at the time of kernel loading,
this fixes the mismatch by always using the fast trace flag for curves.
2022-06-03 12:24:13 +02:00
Angus Stanton
50976657ac Geometry Nodes: Show supported types in geo socket tooltip
Show the supported geometry types returned by geometry
node socket declarations in the socket inspection tooltip.

Differential Revision: https://developer.blender.org/D14802
2022-06-03 10:11:06 +02:00
4eb5163b18 Fix T98459: vertex weight paste/copy inconsistent
In the editmode sidebar, pasting a particular vertex's weight in a
single group was not behaving the same as copying for all groups [in
that the former dis not copy to unassigned vertices whereas the later
did copy to unassigned vertices].

This behaves like this since the introduction in {rB70fd2320c8d2}, but
there does not seem to be a good reason for this?

Now make this consistent and use `BKE_defvert_copy_index` in both cases
(instead of earlying out if unassigned, this will make sure this will
also copy to unassigned).

Maniphest Tasks: T98459

Differential Revision: https://developer.blender.org/D15062
2022-06-03 09:50:45 +02:00
16d329da28 Compositor: add pre/post/cancel handlers and background job info
Main motivation is from T54314 where there was no way to read from a
Viewer image datablock after the compositor has run.
The only solution there was to do a full rerender (which obviously takes
much longer). Adding a handler avoids having to rerender.

This uses new syntax from rBf4456a4d3c97 and also adds "COMPOSITE" as a
job type that can be queried by `bpy.app.is_job_running`.

NOTE: there is another issue when multiple viewers are used and these
get active via RNA (compo execution is not triggered there yet -- unlike
when a viewer is selected in the Editor -- this is an issue of
`ED_node_set_active` vs. only `nodeSetActive`, but this will be tackled
separately)

Maniphest Tasks: T54314

Differential Revision: https://developer.blender.org/D15078
2022-06-03 09:45:08 +02:00
9babe39de9 LineArt: Include minor fixes in branch that's missing in master. 2022-06-03 15:36:27 +08:00
cf5529af12 Cleanup: remove gizmo transform workaround which is no longer needed
Now gizmos forward the original event to transform so assuming an LMB
event is no longer needed.
2022-06-03 15:08:11 +10:00
e87082d8a7 Cleanup: spelling in comments 2022-06-03 15:08:11 +10:00
379672ca0b Cleanup: remove unused, commented MTexFace assignments 2022-06-03 15:08:11 +10:00
9ad19b0453 Merge branch 'blender-v3.2-release' 2022-06-03 13:15:35 +10:00
c4701a027f Fix T98558: island selection in UV editor can crash
Regression in [0]. When zoomed in, we can be within the face of an
island but too far from an edge, in this case
uv_find_nearest_face_multi_ex is used instead of
uv_find_nearest_edge_multi with the consequence that hit.l cannot be
used in uvedit_uv_select_test (it is NULL).

Instead, use uvedit_face_select_test instead in this case.

[0]: d356edf420

Reviewed By: campbellbarton

Ref D15100
2022-06-03 13:14:20 +10:00
1fb36e9a7c Cleanup: DRW: Overlay: Make simple fragment shaders local
This avoids reusing gpu shader files that have different requirements.
2022-06-02 23:50:29 +02:00
4a72b64c7b Cleanup: Split large block of versioning code to separate function
Large blocks of versioning code should be separate to keep
`blo_do_versions_300` more readable.
2022-06-02 22:26:34 +02:00
545b9ddc34 Cleanup: Simplify curves toolbar drawing logic
Use `elif` to clarify that only one case happens.
2022-06-02 22:18:07 +02:00
049e42ef20 Cleanup: DRW: Added basic_ prefix to all *.glsl files in basic/shaders
This is needed to avoid potential naming collision with other engines.
2022-06-02 21:25:38 +02:00
c15e913df8 Cleanup: DRW: Added overlay_ prefix to all *.glsl files in overlay/shaders
This is needed to avoid potential naming collision with other engines
2022-06-02 21:08:05 +02:00
7f47f187c1 EEVEE-Next: Fix compilation of hair domain materials
Also fix formating of `curves_attribute_element_id` which was copy pasted.

# Conflicts:
#	source/blender/draw/engines/eevee_next/shaders/eevee_attributes_lib.glsl
2022-06-02 20:00:05 +02:00
b5fe0f02be Cleanup: DRW: Added overlay_ prefix to all *_info.hh files in overlay 2022-06-02 19:58:10 +02:00
73d8015aa3 Fix T79801: openvdb cache does not support Unicode paths on windows
"Fix" should be taken with a grain of salt, this will fix
the issue on win10 1903 and newer.

OpenVDB uses boosts memory mapped files which call
CreateFileA in the back-end when you feed it a
regular string.

now the encoding for CreateFileA will be whatever the
default is for the system, it internally turns it into
a wide string with said encoding and calls CreateFileW.

This change changes that encoding to UTF-8 for just
blender so we can use utf-8 with any of the narrow
api functions. This is a manifest change and only win10
1903 will look for it, so that sadly limits the fix
to only a subset of users.

While ideally we would have fixed the issue our selves,
some of the calls to openvdb::io::file::open are beyond
our control (ie from inside USD or Mantaflow)

Note: This only changes the behaviour in regard to Win32
API functions, regular CRT functions like fopen or if_stream will
still not accept utf-8 filenames.

Differential Revision: https://developer.blender.org/D14981
Reviewed by: brecht
2022-06-02 11:18:43 -06:00
2b80bfe9d0 Color Management: add Filmic sRGB as an image colorspace
A typical use case is when you want to render with the Filmic view transform, but
composite an existing image in the background that should not be affected by the
view transform.

With this colorspace it's possible to do an inverse Filmic transform, render
everything in scene linear space, and then apply the Filmic transform again.

This is pretty basic in that this is not going to take into account the full view
transform including looks, curves and exposure. But it can be helpful anyway.

Ref T68926
2022-06-02 18:49:04 +02:00
33f5e8f239 Cycles: load 8 bit image textures as half float for some color spaces
For non-raw, non-sRGB color spaces, always use half float even if that uses
more memory. Otherwise the precision loss from conversion to scene linear or
sRGB (as natively understood by the texture sampling) can be too much.

This also required a change to do alpha association ourselves instead of OIIO,
because in OIIO alpha multiplication happens before conversion to half float
and that gives too much precision loss.

Ref T68926
2022-06-02 18:04:38 +02:00
10488d54d9 Cleanup: Use const pointers 2022-06-02 18:02:48 +02:00
91c44920dd Fix: Build error after merge from release branch 2022-06-02 18:02:32 +02:00
3cd6ccd968 Merge branch 'blender-v3.2-release' 2022-06-02 17:54:17 +02:00
2d9c5f3dcf Fix T98556: Crash with extrude node in edit mode
The original index layer was not initialized properly.
Supporting original indices properly for this node is
doable, but for now it is better to simply initialize them
to the "none" value to fix the crash.

Differential Revision: https://developer.blender.org/D15105
2022-06-02 17:53:35 +02:00
96a47af413 Fix T98546: Crash with multires bake and zero levels
The problem was that copying a `CDDerivedMesh` (`CDDM_copy`) doesn't
copy the `vert_normals` reference that it takes from a mesh. Since this
entire area is almost completely broken anyway (mainly in terms of
ownership handling), for now we can just avoid copying the `DerivedMesh`
in the zero levels case.

Longer term, this area should be refactored to remove `DerivedMesh`
and use the newer subdivision evaluation system.

Differential Revision: https://developer.blender.org/D15099
2022-06-02 17:46:38 +02:00
9e43a57d22 Cycles: fix missing attribute update
Differential Revision: https://developer.blender.org/D15102
2022-06-02 16:42:53 +02:00
9580f23596 install_deps: Add support for oneAPI Level Zero library. 2022-06-02 15:53:50 +02:00
1174cdc914 install_deps: raise default ffmpeg version to 5.0, minimum 4.0.
Ref. T98555.
2022-06-02 15:53:50 +02:00
9bb7de274d USD: Enable operator presets when exporting
This patch enables operator presets for USD exports.
The export menu has many options, so enabling the feature
will help users manage their export settings in the same
way they can with other filetypes.

Same as {rB1d668b635632}

Differential Revision: https://developer.blender.org/D14896
2022-06-02 15:07:54 +02:00
432c4c74eb LineArt: Speedup construction of quad trees.
Using multithread for `add_triangles` to speed up quad tree building.
Each thread would lock its respective tile to work on triangle insertion,
intersection calculation, tile splitting and triangle array extension.

Reviewed By: Sebastian Parborg (zeddb), Sergey Sharybin (sergey)

Ref D14953
2022-06-02 20:46:08 +08:00
Bastien Montagne
901791944d Anim: Refactor 'F-curve from rna path' code.
Move into its own new function the the low-level logic to search for a
given RNA path in Action F-curves, then driver F-curves of a given AnimData.

This deduplicates code from `BKE_fcurve_find_by_rna_context_ui` and
`id_data_find_fcurve`, and will allow for future more usages of this
functionality.

Differential Revision: https://developer.blender.org/D15068
2022-06-02 12:28:50 +02:00
3ca76ae0e8 Cleanup: remove "<pep8 compliant>" from headers
It can be assumed that all scripts comply with basic pep8 formatting
regarding white-space, indentation etc.

Also remove note in best practices page & update `tests/python/pep8.py`.

If we want to exclude some scripts from make format,
this can be done by adding them to `ignore_files` in:
source/tools/utils_maintenance/autopep8_format_paths.py

Or using `# nopep8` for to ignore for individual lines.

Ref T98554
2022-06-02 20:16:20 +10:00
48bb144fea PyDoc: reference enum instead of inlining 2022-06-02 20:16:20 +10:00
f4456a4d3c Expose background job info to Python
Add `bpy.app.is_job_running(job_type)` as high-level indicator. Job
types currently exposed are `WM_JOB_TYPE_RENDER`,
`WM_JOB_TYPE_RENDER_PREVIEW`, and `WM_JOB_TYPE_OBJECT_BAKE`, as strings
with the `WM_JOB_TYPE_` prefix removed. The functions can be polled by
Python code to determine whether such background work is still ongoing
or not.

Furthermore, new app handles are added for
`object_bake_{pre,complete,canceled}`, which are called respectively
before an object baking job starts, completes sucessfully, and stops due
to a cancellation.

Motivation: There are various cases where Python can trigger the
execution of a background job, without getting notification that that
background job is done. As a result, it's hard to do things like
cleanups, or auto-quitting Blender after the work is done.

The approach in this commit can easily be extended with other job types,
when the need arises. The rendering of asset previews is one that's
likely to be added sooner than later, as there have already been
requests about this.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D14587
2022-06-02 11:20:17 +02:00
40ecf9d606 Merge branch 'blender-v3.2-release' 2022-06-02 10:05:56 +02:00
33eeed5b3c Fix T98538 EEVEE: Geometry input node breaks with Displacement Texture
This was due to older drivers not honoring varying attributes shadowing by
local variables. Renaming the input argument fixes the issue.
2022-06-02 10:05:14 +02:00
d73adfdc86 PyDoc: changes to the generated conf.py file
- Set the highlight language to python3 (excludes python2 syntax).
- Set the encoding for code highlighting to utf-8 (no need to detect).
- Update deprecated variable name.
- Remove redundant unicode prefixed string.
2022-06-02 15:02:25 +10:00
0f73a27b76 Fix T98552: Experimental Tweak Select: Curve handle tweak is difficult
When this preference is enabled, use selection behavior matching the
graph editor. We may want to make this default (see T98552).
2022-06-02 13:55:06 +10:00
ef3f33dfd3 Cleanup: quiet warnings, remove unused arguments 2022-06-02 13:47:54 +10:00
7afcfe111a VSE: Make time operations self-contained
This patch makes it possible to manipulate strips without need to use
update functions to recalculate effect and meta strips.

Prior to this change function `SEQ_time_update_sequence` had to be used
to update mainly effects and meta strips. This was implemented in a way
that relied on sorted list of strips, which can't always be done and in
rare cases this approach failed.

In case of meta strips, `seqbase` had to be passed and compared with
"active" one to determine whether meta strip should be updated or not.
This is especially weak system that is prone to bugs when functions are
used by python API functions.

Finally, other strip types had startdisp` and `enddisp` fields updated
by this function and a lot of code relied on these fields even if strip
start, length and offsets are available. This is completely
unnecessary.

Implemented changes:
All effects and meta strips are updated when strip handles are moved or
strip is translated, without need to call any update function.

Function `SEQ_time_update_sequence` has been split to
`SEQ_time_update_meta_strip_range` and
`seq_time_update_effects_strip_range`. These functions should be only
used within sequencer module code. Meta update is used for versioning,
which is only reason for it not being declared internally.

Sequence fields `startdisp` and `enddisp` are now only used for
effects to store strip start and end points. These fields should be
used only internally within sequencer module code.
Use function `SEQ_time_*_handle_frame_get` to get strip start and end
points.

To update effects and meta strips with reasonable performance, cache
for "parent" meta strip and attached effects is added to
`SequenceLookup` cache, so it shares invalidation mechanisms.
All caches are populated during single iteration.

There should be no functional changes.

Differential Revision: https://developer.blender.org/D14990
2022-06-02 03:16:20 +02:00
604409b8c7 Cleanup: undeclared warning 2022-06-02 10:07:07 +10:00
f60ac5068a PyDoc: remove CSS override for scrolling long enum lists
Adding a scroll-bar to in-line lists has the down-side that it cuts
of text including warnings or notes that can be included, see: T87008.

Now enums are referenced [0] this is no longer needed, reverting [1].

[0]: 1c6b66c9cf
[1]: 1e8f266591
2022-06-02 10:03:00 +10:00
fb08353f38 Cleanup: replace ParamBool and PBool with bool for GEO_uv API
Also improve const correctness and type correctness.

Reviewed By: brecht

Ref D15075
2022-06-02 09:52:51 +10:00
b450a8c851 Cleanup: remove unused area smoothing logic for UV unwrap
This used to run when holding Shift while unwrapping until 2006 when it
was removed [0].

[0]: e66b5e5cd5

Reviewed By: brecht

Ref D15075
2022-06-02 09:47:01 +10:00
68150b666c Fix T92952: Knife inconsistent angle printout
Knife could display incorrect snapping angle printout in
header/footer because it was not always updated after angle snapping
calculations.
2022-06-01 21:20:53 +01:00
129ea355c8 GPencil: Add support to name new layer when moving to layer
To make it consistent with collections, now it's possible to name the new layer created using the `Move to Layer` option.

Differential Revision: https://developer.blender.org/D15092
2022-06-01 18:25:12 +02:00
bff9841465 Merge branch 'blender-v3.2-release' 2022-06-01 15:44:19 +02:00
a493956eaa Release schedule: Entering Bcon4 for Blender 3.2 (RC) 2022-06-01 15:39:52 +02:00
a1e6245650 Merge branch 'blender-v3.2-release' 2022-06-01 15:04:54 +02:00
e72b86d3cb Fix T98469: Crash trying to add an object to a linked collection that is linked to multiple scenes.
Crash happened because code could not find a valid base in current scene
after adding the object, added some checks for that.

Root of the issue was wrong assumptions in `BKE_object_add` logic, which
would pick the first valid ancestor collection in case initially
selected collection was not editable. In some case, this could pick a
collection not instanced in the current scene's view layer, leading to
not getting a valid base for the newly added object.

Addressed this by adding a new variant of `BKE_collection_object_add`,
`BKE_collection_viewlayer_object_add`, which ensures final collection is
in given viewlayer.
2022-06-01 15:04:34 +02:00
c667069a12 Merge branch 'blender-v3.2-release' 2022-06-01 14:55:26 +02:00
7dd0258d4a Fix T98536: geometry nodes wrong selection on duplicate edges
Code was using the loop [which is looping over the selection] index as
an index for the lookup into the edges directly, but needs to be a
lookupinto the IndexMask.

Also renamed the variable (as used elsewhere) to make this more clear.

If accepted, would be nice to still get this into 3.2.

Maniphest Tasks: T98536

Differential Revision: https://developer.blender.org/D15089
2022-06-01 14:53:35 +02:00
ae0b68e129 Merge branch 'blender-v3.2-release' 2022-06-01 22:46:17 +10:00
e0f3c23ac0 Fix T98370: Shift+RMB Select nodes doesn't work with the tweak tool
The tweak tool was toggling node selection twice, as the selection
key-map is already accounted for in the node key-map there is no need
to duplicate the actions in the tweak tool.
2022-06-01 22:45:45 +10:00
e9eae1b857 Curves: Avoid optimization to avoid storing selection for now
This optimization should be restored when there is proper vizualization
for the selection attributes.
2022-06-01 11:57:38 +02:00
110c90b3cf LineArt: Adding a intersection timer.
This is for conveinence of perfomance comparison.
2022-06-01 16:59:46 +08:00
d3b3d72303 Fix T98520: Sculpt operators can unintentionally clear multires mask
Typo in {rBcf69652618fe}.

Maniphest Tasks: T98520

Differential Revision: https://developer.blender.org/D15087
2022-06-01 10:48:56 +02:00
e5ab1495e5 Merge branch 'blender-v3.2-release' 2022-06-01 10:30:30 +02:00
da7bc51210 Fix failing Cycles Metal MNEE test on buildbot, by disabling it
It appears that Metal and MNEE are still not working.
2022-06-01 10:28:09 +02:00
38acd14fb7 Tweak Object duplicate_move macro tooltips.
Since we have two macros, we can at least have proper different tooltips
for each.
2022-06-01 09:29:42 +02:00
71ce47a71d LineArt: Temporary fix for object loading iterator.
Use `DEG_OBJECT_ITER_BEGIN`for loading objects, this iterator is
technially unsafe to use *during* depsgraph evaluation,
see https://developer.blender.org/D14997 for detailed explainations.
2022-06-01 14:35:33 +08:00
1bf35f1b19 Cleanup: minor changes to sphinx_doc_gen
- Remove unused pymethod2sphinx.
- Correct exception string formatting.
- Define encoding for file reading with execfile(..).
2022-06-01 15:48:20 +10:00
61a7e5be18 Cleanup: '*' prefix C-comment blocks 2022-06-01 15:38:48 +10:00
4cab98f8be Cleanup: spelling in comments, use doxy sections 2022-06-01 15:38:48 +10:00
0f29f2c3e6 Cleanup: remove redundant const qualifiers for scalar & enum types 2022-06-01 15:38:48 +10:00
44bac4c8cc Cleanup: use 'e' prefix for enum types
- CustomDataType -> eCustomDataType
- CustomDataMask -> eCustomDataMask
- AttributeDomain -> eAttrDomain
- NamedAttributeUsage -> eNamedAttrUsage
2022-06-01 15:38:48 +10:00
ca346d2176 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-06-01 07:02:32 +02:00
54d076b20d Fix T98526: broken corner attributes with GPU subdivision
Although reusing the same patch coordinate for all corner pointing the
same vertex works for interpolation vertices, it does work for
interpolation face varying attributes. So we need to keep the original
patch coordinates around for face varying interpolation. This was caused
by the previous fix (a5dcae0c64).
2022-06-01 07:02:05 +02:00
46cb24e7c2 Merge branch 'blender-v3.2-release' 2022-06-01 14:31:55 +10:00
0e8d6c2828 Cleanup: conversion from enum/int warning 2022-06-01 14:30:57 +10:00
65e7d49939 Fix T89726: Fix hitbox of axis gizmo in UV Editor
Use the scale from the wmGizmo.matrix_final as a reference for the
arrow head-size.

Reviewed By: campbellbarton

Ref D15056
2022-06-01 14:23:37 +10:00
ee57afe7e1 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-31 21:09:35 -07:00
12642bdeab Fix T96984: Create new image.browse operator for uiTemplateImage layouts
The existing BUTTONS_OT_file_browse operator that's used for
uiTemplateImage layouts fails to work correctly with UDIM textures.

This is mainly due to it not realizing that it must tokenize the
filepath before signaling that an update has been made. It also doesn't
work correctly when executing its SHIFT-click behavior to open the image
in an external application. Lastly, it doesn't set the filters to Images
and Movies which is suboptimal for the user.

The new operator takes the unique features of BUTTONS_OT_file_browse
and creates a customized variant better suited for images.

Differential Revision: https://developer.blender.org/D14824
2022-05-31 20:57:33 -07:00
b38a59881b Merge branch 'blender-v3.2-release' 2022-05-31 16:35:22 -07:00
6cee404914 GPU subdiv: Fix edit mode vertex color not being uploaded properly
Also cleaned up the code a tad bit.  Note that I
found two more bugs:

* GPU subdivision attribute interpolation
  is producing visual artifacts.
* "Show on cage" mode for subdivision surface
  just shows black colors.
2022-05-31 16:32:42 -07:00
75162ab8c2 Fix T97408: Temporary fix for attribute convert undo
Sculpt undo now detects if an attribute layer has
changed type/domain and unconverts it back.  This
is a temporary workaround to a more fundamental
bug in the undo system.

Memfile undo assumes it can always rebuild the
application state from the prior undo step,
which isn't true with incremental undo systems.

The correct fix is to push an extra undo step prior
to running an operator if an incremental undo system
is active and the operator is using memfile undo.
2022-05-31 15:46:09 -07:00
79cee340a8 Merge branch 'blender-v3.2-release' 2022-05-31 12:45:24 -07:00
511a08585d Fix T98364: Remove improper OPTYPE_UNDO flags
Removed OPTYPE_UNDO flags from the swap brush colors and
sample color operators.  These types of operators are
not supposed to be undoable in the first place.  Also
memfile undo is too buggy for it.
2022-05-31 12:43:07 -07:00
b9f29a0f64 Merge branch 'blender-v3.2-release' 2022-05-31 20:44:56 +02:00
0f47506cde Fix T98501: setting node socket default value is very slow
The issue was that the extend socket (the last empty socket in
Input/Output nodes) was repeatedly removed and added again,
which caused more updates than necessary. Now, the extend
socket is kept if it existed already.

Differential Revision: https://developer.blender.org/D15084
2022-05-31 20:43:53 +02:00
5c80bcf8c2 Functions: speedup preparing multi-function parameters
My benchmark which spend most time preparing function parameters
takes `250 ms` now, from `510 ms` before. This is mainly achieved by
doing less unnecessary work and by giving the compiler more inlined
code to optimize.

* Reserve correct vector sizes and use unchecked `append` function.
* Construct `GVArray` parameters directly in the vector, instead of
  moving/copying them in the vector afterwards.
* Inline some constructors, because that allows the compiler understand
  what is happening, resulting in less code.

This probably has negilible impact on the user experience currently,
because there are other bottlenecks.

Differential Revision: https://developer.blender.org/D15009
2022-05-31 20:41:01 +02:00
484ea573af Merge branch 'blender-v3.2-release' 2022-05-31 19:24:56 +02:00
dc389a6152 Fix T98454: subdivision doesn't propagate int attributes
Differential Revision: https://developer.blender.org/D15083
2022-05-31 19:23:52 +02:00
a1830859fa Curves: Add soft selection in sculpt mode
This commit adds a float selection to curve control points or curves,
a sculpt tool to paint the selection, and uses the selection influence
in the existing sculpt brushes.

The selection is the inverse of the "mask" from mesh sculpt mode
currently. That change is described in more detail here: T97903

Since some sculpt tools are really "per curve" tools, they use the
average point selection of all of their points. The delete brush
considers a curve selected if any of its points have a non-zero
selection.

There is a new option to choose the selection domain, which affects how
painting the selection works. You can also turn the selection off by
clicking on the active domain.

Sculpt brushes can be faster when the selection is small, because
finding selected curves or points is generally faster than the
existing brush intersection and distance checks.

The main limitation currently is that we can't see the selection in the
viewport by default. For now, to see the selection one has to add a
simple material to the curves object as shown in the differential
revision. And one has to switch to Material Preview in the 3d view.

Differential Revision: https://developer.blender.org/D14934
2022-05-31 19:00:24 +02:00
96f20ddc1e Geometry Nodes: Don't allow UI attributes as modifier field inputs
This is an extension of 4669178fc3, applying the same changes to
attributes chosen in the field inputs of the geometry nodes modifier.
If a UI/internal attribute is used, the attribute name button will
have a red alert. Adding a disabled hint is currently a bit more complex.

Also hide UI attributes in attribute search for the named attribute node.

Part of D14934
2022-05-31 18:58:54 +02:00
610619c203 Merge branch 'blender-v3.2-release' 2022-05-31 17:35:16 +02:00
a40b611128 Cleanup: Improve const correctness of ID functions
These functions don't change their inputs, so they can be const,
which is a bit more intuitive and clean to use for callers.

Differential Revision: https://developer.blender.org/D14943
2022-05-31 17:31:32 +02:00
f2cd7e08fe Fix Cycles MNEE not working for Metal
Move MNEE to own kernel, separate from shader ray-tracing. This does introduce
the limitation that a shader can't use both MNEE and AO/bevel, but that seems
like the better trade-off for now.

We can experiment with bigger kernel organization changes later.

Differential Revision: https://developer.blender.org/D15070
2022-05-31 17:24:43 +02:00
908dfd5e0d Merge branch 'blender-v3.2-release' 2022-05-31 10:15:40 -05:00
52cb24a779 Fix T98500: Wrong Selection in Duplicate Points
Differential Revision: https://developer.blender.org/D15071
2022-05-31 10:07:56 -05:00
3060b98842 Cleanup: Simplify dependencies for GMP math header
Previously, the base math headers included GMP headers in all cases.
This was problematic because we don't want all modules that use the
math headers to depend on GMP, and the unnecessary includes could
theoretically have detrimental effects to compile times.

Now `BLI_math_mpq.hh` depends on `BLI_math_base.hh`, so if a file
needs to use exact arithmatic, it can just include the former.

Differential Revision: https://developer.blender.org/D15079
2022-05-31 16:55:14 +02:00
a746cef825 Cleanup: Move lib_override.c to C++
This will allow easier const correctness and use of
nicer data structures like `Vector` and `Map`.
2022-05-31 16:19:50 +02:00
d356a4f280 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-31 16:18:42 +02:00
a5dcae0c64 Fix T97877: broken shadows with GPU subdivision
Issues stems from the mesh not being watertight. This was caused by
floating point precision issues when evaluating patch coordinates at
patch boundaries (loops/corners in different patches pointing to the same
vertex). To fix this we ensure that all loops pointing to the same vertex
share the same patch coordinate. This keeps code simple, and does not
require to track precision issues in floating point math all over the
place.
2022-05-31 16:18:08 +02:00
3d66ee8c97 Intern/atomic: Fix const qualifier for atomic_load_ptr. 2022-05-31 21:05:15 +08:00
e37027634b Intern/atomic: Adding atomic_load/store_ptr support.
We need to provide _ptr ones with _z ones on the API level.

Reviewed By: Sergey Sharybin (sergey)

Ref D15076
2022-05-31 20:09:39 +08:00
4669178fc3 Attributes: Hide internal UI attributes and disallow procedural access
This commit hides "UI attributes" described in T97452 from the UI lists
in mesh, curve, and point cloud properties, and disallow accessing them
in geometry nodes.

Internal UI attributes like selection and hiding values should use the
attribute system for simplicity and performance, but we don't want to
expose those attributes in the attribute panel, which is meant for
regular user interaction. Procedural access may be misleading or cause
problems, as described in the design task above.

These attributes are added by two upcoming patches: D14934, D14685

Differential Revision: https://developer.blender.org/D15069
2022-05-31 13:20:16 +02:00
39c14f4e84 Merge branch 'blender-v3.2-release' 2022-05-31 12:29:41 +02:00
765c16bbd0 Fix wrong asset dropped when dragging from loc. of just cleared asset
See previous commit for an explanation of what went wrong. Similar to
the fix there, we also have to update the dragged data (e.g. the
data-block) referenced by the button.

Committing separately since this could cause further issues.
2022-05-31 12:28:58 +02:00
75ef51cc80 Fix T95394: Crash when dragging from location of just cleared asset
In Blender buttons are recreated over redraws, except of the active
button which is kept alive, and replaces the new version of itself in
the new redraw. In order to do that, the button needs to be recognized.
This process of recognizing and matching buttons from different redraws
isn't always bullet-proof. That's okay-ish, but we have to make sure
that the relevant data of the old active button is updated with the
newest data.

Here the matching would go wrong, and the new active button was
recognized as the old active button, which was in fact removed when the
asset was cleared. This patch makes sure the image buffer attached to
the buttons is updated when buttons were recognized as matching.

Note that the dragging will still use the wrong data-block, this will be
fixed in the following commit.
2022-05-31 12:27:52 +02:00
9301cc74ee Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-31 12:15:37 +02:00
344a8fb3d4 Fix T97086: corrupted UVs with GPU subdivision
When multiple objects are in edit mode, UVs for the objects, except for
the first one (in rendering order) appear corrupted. The corruption is
because the UVs are not evaluated as the compute shader is not bound,
thus we read unitialized memory.

We keep track of the currently bound shader in the GPU context in order
to avoid unnecessary shader switches in case the same shader is used in
consecutive calls. However, the shader used by the OpenSubdiv evaluator
is not part of Blender and therefore not tracked via the GPU context.

When extracting UVs for multiple objects, we only ever run a single
shader (FVar evaluation). However, between the compute calls, we also
call the OpenSubdiv stencil evaluation shader, which uses `glUseProgram`
modifying the current program, outside of our control, which then also
unbinds the Blender compute shader making the compute dispatch fail ("No
active compute shader").

The fact that extracting the UVs for the first rendered object works is
because another (Blender) shader was bound in the GPU context prior to
our binding of our evaluation shader.

To fix this, we remember, in the OpenSubdiv evaluator, the current
program so that it can be reset after the stencil program is done.

Differential Revision: https://developer.blender.org/D15064
2022-05-31 12:15:02 +02:00
0d7e0ffdb5 Cleanup: tabs to spaces for CMake files & sort file-lists 2022-05-31 18:18:24 +10:00
e82141b6b4 Do not provide python libraries for linking if building python module
When building blender as a python module, such as for inclusion in a
wheel, it is not permitted to link against python libraries.
This diff does so by simply unsetting the library when building blender
as a python module, instead of the more heavyweight solution of
switching to the cmake FindPython module.

Reviewed By: LazyDodo, campbellbarton

Ref D15012
2022-05-31 18:18:24 +10:00
247ceca629 Merge branch 'blender-v3.2-release' 2022-05-31 10:06:22 +02:00
18a17d4291 Fix T98403: Crash applying modifiers on non-mesh objects
The operator assumed it was called on a mesh object, which has
mostly been the case because of lack of support for other object
types, but the new curves object is supported, which is the situation
in the report.

Differential Revision: https://developer.blender.org/D15063
2022-05-31 10:05:48 +02:00
Iyad Ahmed
a30e67813d OBJ: Enable undo for experimental OBJ importer
The new OBJ importer operator didn't register an undo event.
This commit enables the register and undo flags for the operator.

Reviewed By: Bastien Montagne, Aras Pranckevicius, Serhiy Striletksy
Differential Revision: https://developer.blender.org/D15051
2022-05-31 11:00:14 +03:00
a3a138b41b Merge branch 'blender-v3.2-release' 2022-05-31 09:52:32 +02:00
5fdd367786 Merge branch 'blender-v3.2-release' 2022-05-31 09:52:03 +02:00
Julien Kaspar
1ebc0ebdc0 UI: Correct sculpt tooltips
Some of the tools in sculpt mode were still referring to the previously  experimental sculpt vertex colors.
They should instead refer to color attributes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15073
2022-05-31 09:51:26 +02:00
993fd985f0 Cleanup: remove UV handling from OBJECT_OT_modifier_convert
It doesn't make sense to merge UV's when applying a particle-system.
2022-05-31 17:42:44 +10:00
c338388354 Cleanup: rename ED_object_modifier_convert to make it's use clearer
This function is specific to particle-systems which wasn't obvious,
leading to an error in [0] which added UV handling which doesn't make
sense.
2022-05-31 17:40:02 +10:00
c8058e51ee RNA: add macros for EnumPropertyItem layout elements
Add the following macros for enums as support for these features wasn't
all that obvious and there were some inconsistencies in their use.

- RNA_ENUM_ITEM_HEADING(name, description)
- RNA_ENUM_ITEM_SEPR
- RNA_ENUM_ITEM_SEPR_COLUMN
2022-05-31 14:19:06 +10:00
1c6b66c9cf PyDoc: replace in-lined enum references with links where possible
Avoid in-lining large enums such as icons and event types, linking
to them instead.

This mitigates T76453, where long enums took a lot of space in the docs,
this was a problem with `UILayout` where each icon argument would list
all icons. [0] worked around the issue using CSS to scroll the list.
However this has the draw-back where some items are clipped in a way
that's not obvious, see: T87008.

The reason this isn't a complete solution is that Python defined enums
aren't written into their own pages which can be linked to, although
currently there are no large Python enums included in the API docs.
All in-lined enums are now under 20 items.

[0]: 1e8f266591
2022-05-31 14:19:06 +10:00
94444aaadf PyDoc: de-duplicate enums for rna_rna.c & bpy_props.c
Lists of items for bpy.props were duplicated 3 times, now all enums are
defined once in rna_rna.c and referenced from bpy.props doc-strings.
2022-05-31 14:19:06 +10:00
fb86f3ee18 PyDoc: document static enums from RNA_enum_items.h
Create a page for every enum in RNA_enum_items.h, which includes
the enum values and the doc-string for each item.

Each page creates a references which the API reference can be linked to
via the same name as the enum, so :ref:`rna_enum_icon_items` links
to the list of icons for e.g.

This has two main advantages:

- No need to manually duplicate enum values in the doc-strings of
  functions defined in Python's C/API (not RNA defined functions),
  `bpy.props` for example.

- The generated Python API docs can reference these instead of including
  the enums in-line - resulting in unreasonably long lists in the case
  if icons and event types (for example).

These changes will be made separately.
2022-05-31 14:18:32 +10:00
ed2a345402 PyAPI: add _bpy.rna_enum_items_static() for accessing internal enum data
This is method is intended for internal use
(introspection for generating API docs).
2022-05-31 14:07:08 +10:00
7056c7520a RNA: avoid non-standard enum item (enum section using single space)
Also removes stray semicolon in RNA_enum_items.h
2022-05-31 14:07:06 +10:00
ca59391704 Cleanup: Remove outdated comment 2022-05-30 19:30:52 +02:00
Dominik Fill
f523fb1dc9 Fix T96157: Make size of Frame Node label independent from Line Width
This commits corrects the calculation of the Frame Node label size,
making it independent of the 'Line Width' user preference.

Since `U.dpi` is actually DPI divided by `U.pixelsize` and `U.pixelsize`
is calculated from line-width multiplying by `U.pixelsize` undoes
the connection between line-width and label size.
It now stays the same, regardless of the line-width setting.

Reviewed By: Julian Eisel, Harley Acheson

Differential Revision: https://developer.blender.org/D14338
2022-05-30 19:26:03 +02:00
Dominik Fill
c8cef83fae Fix T96157: Make size of Frame Node label independent from Line Width
This commits corrects the calculation of the Frame Node label size,
making it independent of the 'Line Width' user preference.

Since `U.dpi` is actually DPI divided by `U.pixelsize` and `U.pixelsize`
is calculated from line-width multiplying by `U.pixelsize` undoes
the connection between line-width and label size.
It now stays the same, regardless of the line-width setting.

Reviewed By: Julian Eisel, Harley Acheson

Differential Revision: https://developer.blender.org/D14338
2022-05-30 19:19:07 +02:00
b24e091c5a Cleanup: Move attribute.c to C++ 2022-05-30 18:06:39 +02:00
3f9376851b Cleanup: Clang tidy
Mostly duplicate includes, also use nullptr, and using default
member initializers.
2022-05-30 17:46:44 +02:00
3437cf155e LibOverride: Add full support for camera's background images.
Add support for adding (inserting) new background images into an
override of a linked Camera ID.

Request from the Blender studio.

This ended up being more involved than expected as it uncovered some
latent issues with existing background images code. Noticiably, a new
`BKE_camera_background_image_copy` had to be added to handle copying
of background images in a proper, generic ID-management way.
2022-05-30 17:43:22 +02:00
a5d9b3442d Cleanup: Move attribute domain count out of enum
The number of attribute domains is not an attribute domain.
This way it doesn't have to be handled in switch statements.

Differential Revision: https://developer.blender.org/D15065
2022-05-30 17:30:37 +02:00
4267c6280a Fix (unreported) missing rna_path function for BackgroundImage struct. 2022-05-30 17:16:13 +02:00
dd2ed1c55c Cleanup: report errors instead of asserting in case of missing local data on file read.
While this should never happen, this is not a critical failure
preventing Blender to work.
2022-05-30 16:58:27 +02:00
fb62fcf071 Fix polling function for background image removal not checking linked ID.
Linked ID is (almost) never editable... Also rename that function to add
the `_poll` suffix.
2022-05-30 16:58:27 +02:00
e7544e3ce4 Fix (unreported) wrong ID usercount handling in background images removal.
Assuming that an ID pointer is NULL because another 'source type'
property has some specific value is utterly wrong and a gateway to
usercounting bugs.
2022-05-30 16:58:27 +02:00
c1277c5d25 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-30 16:44:22 +02:00
6856290514 Fix T98253: Gpencil Lineart crashes when undoing creation of linked copy
These lines were not used now because the handling of copy data has changed.

Assigning the `eval` data can produce unexpected result, especially since everywhere ID_RECALC_TRANSFORM is used, we also do a copy on write. That should take care of `ob->data` for the eval object.
2022-05-30 16:39:27 +02:00
cd6551d4eb Cleanup: use class instead of struct 2022-05-30 16:28:13 +02:00
fc1ae52994 Fix T98444: Image.save_render not using scene output file type
Also simplify logic because (source == IMA_SRC_VIEWER) and
ELEM(type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) are the same
thing.
2022-05-30 16:24:12 +02:00
de610d06a6 Cleanup: make format 2022-05-30 16:17:25 +02:00
65bd9974d1 Cleanup: make format 2022-05-30 16:16:25 +02:00
afd81e26af Fix T98446: Spreadsheets filter not working on Name column 2022-05-30 16:11:52 +02:00
a9a4bcc3d1 Fix building: stub for OpenSubdiv
Building problem introduced on 24e74f8bef. It affects `make lite`
and other builds that skip OpenSubdiv.
2022-05-30 16:10:22 +02:00
a775389823 Merge branch 'blender-v3.2-release' 2022-05-30 15:42:38 +02:00
70171cdfdf Fix T98488: GPencil weightpaint not visible if first point is no weight
The problem was because the check was done with the total weights of the first element of the array and if this was null or 0, the weights were not duplicated.

As this bug was introduced fixing T97150 due a problem in the weight data, now instead to duplicate all stroke data to create the perimeter for the PDF/SVG, only the points are duplicated because the weights are not needed. This fix the original bug and also reduce the memory used by the export process.
2022-05-30 15:42:08 +02:00
6a59cf0530 Nodes: add separately allocated runtime data for nodes and sockets
This is a follow up to rBbb0fc675822f313c5546a2498a162472c2571ecb.
Now the same kind of run-time data is added to nodes and sockets.

Differential Revision: https://developer.blender.org/D15060
2022-05-30 15:32:16 +02:00
1f85877263 Fix T98461: Crash running screenshot from the command-line
When launching Blender with a script creating a screenshot, the Outliner
tree wasn't initialized and built properly. That is because at this
stage, all visible regions were only tagged for a non-rebuild redraw,
not a full redraw. So ensure all regions are tagged for a full redraw
immediately after file reading. Usually the full redraw would be caused
by a file-read notifier, but the Python expression/script is executed
before notifiers are handled.

Note that even before this was crashing, the Outliner would be empty in
the created screenshot.

Additionally adds an assert to the Outliner to note assumptions
explicitly, rather than crashing later.
2022-05-30 15:17:50 +02:00
Pratik Borhade
a8471459fd Fix T98445: Knife Tool always cuts through
Minor error in if condition used for early return.

Ref D15050
2022-05-30 22:29:16 +10:00
ec8365b9ed Fix building without opensubdiv 2022-05-30 22:29:16 +10:00
7f877ee042 Merge branch 'blender-v3.2-release' 2022-05-30 14:09:13 +02:00
fbeec91abf Cleanup: fix various typos
Contributed by luzpaz

Differential Revision: https://developer.blender.org/D15057
2022-05-30 14:09:07 +02:00
24e74f8bef Fix T98449: Cycles crash changing frame after recent changes
Subdivision did not properly update when evaluating first without and then with
orco coordinates. Now update the subdivision evaluator settings every time, and
reallocate the vertex data buffer when needed.

there is an additional issue in this file where orco coordinates are not
available immediately on the first frame when they should be, and only appear
on the second frame. However that is an old limitation related to the depsgraph
not getting re-evaluated on viewport display mode changes, here we just fix the
crash.
2022-05-30 14:06:03 +02:00
ddebb0f783 Cleanup: Fix typo
Contributed by @luzpaz

Differential Revision: https://developer.blender.org/D15058
2022-05-30 14:05:15 +02:00
bb0fc67582 Nodes: add separately allocated run-time data for bNodeTree
`bNodeTree` has a lot of run-time embedded in it currently. Having a separately
allocated run-time struct has some benefits:
* Run-time data is not stored in files.
* Makes it easy to use c++ types as run-time data.
* More clear distinction between what data only exists at run-time and which doesn't.

This commit doesn't move all run-time data to the new struct yet, only the data where
I know for sure how it is used. The remaining data can be moved separately.

Differential Revision: https://developer.blender.org/D15033
2022-05-30 12:54:07 +02:00
2f77b2daac Nodes: call init function for new node trees in ntreeAddTree
Issue found in D15033, for some more info see comments there.
2022-05-30 12:44:42 +02:00
ce1dd44c68 Merge branch 'blender-v3.2-release' 2022-05-30 03:22:31 -07:00
Bastien Montagne
878a805ae8 Cleanup/simplify BKE_fcurve_find_by_rna_context_ui code.
From reading the code it looks like at some point the code was expecting
the `tptr` PointerRNA to change during the loop? But currently it did
not make any sense to have this complex looping and multi-checking of
RNA path and animdata, since the RNA pointer (and therefore its
`owner_id`) is never modified...

NOTE: there could be much more cleanup done in that area, goal of this
commit is mainly to simplify the logic by removing all the (seamingly)
dead code.

Differential Revision: https://developer.blender.org/D15026
2022-05-30 12:02:10 +02:00
f1c29b9bd3 Fix T98368: Shading artifacts on paint/mask anchored sculpt brushes
I'm not sure what is causing this.  Vertex normals get corrupted
for paint and mask sculpt brushes but not the normal geometric
ones.  Since we don't actually need to recalculate normals
here to begin with I've just disabled it.  The code now
calls the appropriate node mark update function based on
the sculpt tool.
2022-05-30 02:48:04 -07:00
fc3c589b18 Merge branch 'blender-v3.2-release' 2022-05-30 10:14:00 +02:00
a7bda30ca8 Curves: make tangent computation more robust
Previously, when there were multiple curve points at the same or
almost the same position, the computed tangent was unpredictable.

Now, the handling of this case is more explicit, making it more
predictable. In general, when there are duplicate points, it will just use
tangents from neighboring points now.

Also fixes T98209.

Differential Revision: https://developer.blender.org/D15016
2022-05-30 10:12:06 +02:00
16746e8ec2 Cleanup: Tweak geometry component comments 2022-05-30 08:59:58 +02:00
3c0d7152c8 Merge branch 'blender-v3.2-release' 2022-05-29 14:25:53 -05:00
cc4b6c6476 Fix T98400: Duplicate node crash 2022-05-29 14:25:17 -05:00
32bf6455a0 Fix T98400: Duplicate node crash 2022-05-29 14:19:05 -05:00
218f23935c Fix: Failed assert for evaluated lengths of single point curves
Since 2d80f814cc, curves always have evaluated points,
but single point curves do no have any evaluated segments, and the
leading zero length isn't stored in the curves length cache.
2022-05-29 13:43:25 +02:00
86cfc30aac Cleanup: Fix warning from typo in include directive 2022-05-29 11:02:30 +02:00
3152d68b70 Cleanup: Simplify custom data file writing process
Previously the function had a fair amount of ugly boilerplate to avoid
allocating the temporary layers array, and then free it if necessary.
`blender::Vector` solves that problem more elegantly. Passing a span,
using references in a few cases, and using a switch statement also make
the functions simpler.

This refactoring is in preparation for D14583 and D14685.

Differential Revision: https://developer.blender.org/D15011
2022-05-29 11:02:10 +02:00
93e4b15767 Cleanup: clang-tidy for GHOST X11/SDL/Wayland/NULL backends
Also early exit in some functions.
2022-05-29 13:25:58 +10:00
13373a6ccd Merge branch 'blender-v3.2-release' 2022-05-28 22:25:08 -03:00
49368c734b Fix (unreported): cyclic snap of curve handles
The logic of skipping selected handles was inverted
and confusing.
2022-05-28 22:24:43 -03:00
812a9728f8 Select Similar: hide 'compare' from UI when not used
When the 'compare' is not used for the resulting selection, just hide
it. This is the case for 'Vertex Groups' atm (where only membership is
taken into account).

Similar to rB9dc9692b0979.

Differential Revision: https://developer.blender.org/D14979
2022-05-28 12:32:25 +02:00
314e5cb889 XR: Fix controller flicker when switching action sets
This could happen when switching between custom action sets that both
had controller pose actions. Problem was that controller data is
cleared when changing action sets, and this clearing was done when
handling WM events, which always occurs after XR controller data is
updated from GHOST.

Now, instead of activating the action set immediately, delay activation
until just before the next XR actions sync.
2022-05-28 17:23:27 +09:00
16166f69be Fix pasting text from Blender in GHOST/Wayland
The nil terminator character shouldn't be included, causing an extra
character to be added in some cases.
2022-05-28 16:06:54 +10:00
5dfff02437 Fix switching between different grab types with GHOST/Wayland
Since [0], using the view navigation gizmo crashed with Wayland.
This only worked previously because GHOST_kGrabWrap was ignored.

Now the previous grab state is disabled before switching to a new
grab state.

[0]: da9e14b0b9
2022-05-28 15:56:09 +10:00
138a4846e2 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-27 22:16:14 -07:00
86baf6e3ed Re-fix T97366: Support single-file UDIMs
The original fix for T97366 was too restrictive and breaks real-world
cases of single-file UDIM textures. See D13297 for an example.

This patch effectively reverts the original fix and instead fixes the
downstream code to accept single-file ranges as necessary.

Note: This means it is very important for users to make use of the
"UDIM detection" option during `image.open` or drag n' drop scenarios in
order to declare their intent when loading their files.

Differential Revision: https://developer.blender.org/D14853
2022-05-27 22:11:52 -07:00
3f1f4df3fd Fix unreported misuse of Win32 clipboard API
An ASAN build highlighted a longstanding bug during ctrl+c operations
inside various text widgets. The existing code had mismatched memory
lock/unlock calls and was using the wrong allocator.

Fix the code surrounding `SetClipboardData` to be correct per MSDN:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setclipboarddata

Differential Revision: https://developer.blender.org/D15039
2022-05-27 20:52:52 -07:00
712b0496c1 Merge branch 'blender-v3.2-release' 2022-05-27 20:22:12 +02:00
967f96ee2e Fix T98270: Cycles shows black with color values > 65K in GPU render
After recent changes to Nishita sky to clamp negative colors, the pixels ended
up a bit brighter which lead to them exceeding the half float max value. The
CUDA float to half function seems to need clamping.
2022-05-27 20:14:15 +02:00
7b65086fdf Cleanup: Use new macro for deprecated ID types
Uses the macro introduced in b45f410b31 where it makes sense.
2022-05-27 19:15:58 +02:00
da1dd98101 Merge branch 'blender-v3.2-release' 2022-05-27 19:13:59 +02:00
bd2f9a16fb Merge branch 'blender-v3.2-release' 2022-05-27 17:06:58 +02:00
Arye Ramaty
52c1f983cb UI: add missing tooltips for the shader node options
Differential Revision: https://developer.blender.org/D14878
2022-05-27 17:05:48 +02:00
b45f410b31 Fix T97790: Crash in Outliner "Blender File" mode with old files
IPO data-block types are deprecated since 2.5. Don't show them in the
Outliner at all.

Differential Revision: https://developer.blender.org/D15049
2022-05-27 17:03:25 +02:00
Jagannadhan Ravi
74cf22c42c Fix T96397: Cycles missing HIP support for gfx1035 devices
Such as AMD Radeon RX 6700S.

Differential Revision: https://developer.blender.org/D13495
2022-05-27 16:59:40 +02:00
3a4f2131c2 Fix Cycles not rendering byte precision vertex domain colors
Code was not yet updated to use generic attributes for vertex colors. This also
makes generic attributes work for adaptive subdivision.
2022-05-27 16:55:49 +02:00
9fef80c663 Merge branch 'blender-v3.2-release' 2022-05-27 14:23:00 +02:00
bf6aa5d63d GPencil: Fix unreported Bake animation error
This bug was introduced in commit https://developer.blender.org/rB5188c14718c56e4d088d3c5bb3ce3ed9ed8b7bdc because the object transform was not applied when baking the object.

Thanks to @frogstomp for the head up.
2022-05-27 14:22:09 +02:00
abf8750dbc Cleanup: Cycles, fix "parameter unused" warning
Fix "parameter unused" warning that shows up when building without NanoVDB.

No functional changes.
2022-05-27 13:01:01 +02:00
5b40c48f85 Merge branch 'blender-v3.2-release' 2022-05-27 12:58:07 +02:00
5417b8434a Fix T97918: Crash when changing "Frame All" shortcut from context menu
After removing the default 'Home' shortcut for "Frame All", a NDOF (3D
Mouse) default shortcut was still available for the operator. The event
filtering introduced in 4357fb63db was missing the NDOF filtering
logic. So while the context menu correctly found the NDOF keymap item,
its actual shortcut change/removal code incorrectly filtered out the
NDOF keymap items and thus failed to find the item.
2022-05-27 12:55:24 +02:00
802f107e38 Merge branch 'blender-v3.2-release' 2022-05-27 12:16:31 +02:00
e5c65709a2 Fix T98379: Wrong evaluation when deactivating/activating collections
This is a regression caused by a230445cae.

The internal cause of the issue was that the synchronization component
was no longer tagged as visible (and hence not evaluated) as it not
connected to any directly visible IDs.

Changed the logic in a way that if any component of an ID is evaluated
the synchronization component will be evaluated as well.

The naming of the flag in the component node is a bit confusing, but
for the simplicity of the change for the upcoming release left it
unchanged.
2022-05-27 12:09:14 +02:00
Colin Basnett
8d53ead69b Fix T97500: NLA strip names drawn outside strip
Fix T97500 by removing the logic that for some unknown reason draws the
entire string if the min/max were swapped.

This function is only called in two places, once here in the NLA, and
the VSE. The bug only materializes in the NLA though.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14742
2022-05-27 11:26:52 +02:00
Colin Basnett
f45a735aad Fix T97974: Marker line affected by NLA strip mute
Fix T97974 by having the marker rendering code explicitly set the
required line width.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14890
2022-05-27 11:13:06 +02:00
84189a6340 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-27 11:03:56 +02:00
f41c7723c9 GPU: Remove cached full/scaled image texture.
full scaled image isn't used anymore. It was added to use a different scale when
displaying an image in the image editor. This was replaced by the image engine
redesign.

This change will reduce complexity of {T98375}.
2022-05-27 10:52:49 +02:00
5625a21fc7 Fix fuzzy ID deletion user count check.
`BKE_id_delete` should only check for consistency of user count with
regards to the tags and flags of the ID, not 'protect' nor even warn in
case a 'fake user' ID is deleted (such higher-level checks are to be
handled by higher-level code).

Also replace the assert + debug print by a CLOG error, this avoids
'assert crash' while still failing tests, and always producing a useful
message.

Fixes T98374 and T98260.
2022-05-27 10:49:53 +02:00
da9e14b0b9 Fix GHOST_kGrabHide in Wayland
Dragging number buttons wasn't grabbing the cursor and would stop
when the pointer reached the screen edge & wasn't setting the cursor
visible on completion.
2022-05-27 16:48:20 +10:00
46456a59c4 GHOST/Wayland: support mouse buttons 4-7 2022-05-27 15:55:56 +10:00
7aad4d459e Cleanup: unused argument warnings 2022-05-27 14:51:48 +10:00
6d4f16a776 Fix non-square cursor creation in GHOST/SDL
Currently all cursors are square, so this didn't show up as a bug.
2022-05-27 14:39:21 +10:00
49032a8ca5 Fix error checking the search callback
Error in [0] caused the `set` callback be checked as the search callback.

[0]: 3f3d82cfe9
2022-05-27 14:28:13 +10:00
ae39abe7f3 Fix "day" unit length
The day is currently specified as 90000 seconds which is 25 hours.
Obviously this is wrong, and this commit changes it to 86400s/24 hours.

Differential Revision: https://developer.blender.org/D15034
2022-05-26 18:10:16 +02:00
fdc2b7bfa4 Intern: Adding atomic_load/store support for different types.
Mostly using built-in `__atomic` functions, with a special code path
using `MemoryBarrier()`on windows.

Authored By: Sergey Sharybin (sergey)

Reviewed By: Sergey Sharybin (sergey), Ray molenkamp (LazyDodo)

Ref D15020
2022-05-26 23:06:36 +08:00
bf53956914 Fix T98385: Color attributes not working with GPU subdivision
Contrary to coarse extraction, GPU extraction uses the same buffer for
the coarse data, only the final GPU buffer needs to be offset.
2022-05-26 15:12:30 +02:00
55e3930b25 Fix T98392: GPU subdivision crash with knife tools
The face dots normals may not be always requested, thus leading to a
crash by null pointer dereference.
2022-05-26 14:52:45 +02:00
d6badf6fde Merge branch 'blender-v3.2-release' 2022-05-26 21:25:59 +10:00
2a367689d4 Merge branch 'blender-v3.2-release' 2022-05-26 21:25:54 +10:00
38a2576ace Fix display error after sorting mesh elements
Sorting faces caused the tessellation data to be outdated,
making faces show the wrong materials.

Re-calculate tessellation when re-ordering faces.
2022-05-26 21:23:19 +10:00
790fe55c52 Fix Blender 2.7x keymap faulure to select & drag multiple nodes
A follow up on the fix for T98145 for the 2.7x keymap.
2022-05-26 21:06:44 +10:00
fdb1a7b5e1 Cleanup: struct PHandle merged with alias typedef void ParamHandle
Reviewed By: brecht

Ref D15021
2022-05-26 20:04:54 +10:00
374ce5dcb4 Merge branch 'blender-v3.2-release' 2022-05-26 16:00:15 +10:00
3131107ba3 Fix T94857: 'Gizmo Operator' from python templates spins when dragged
Callbacks used in the gizmo operator template don't support updating
while being dragged, set the EXCLUDE_MODAL flag so the offsets
aren't accumulated. Also fix the offset being applied twice to the
move gizmo.
2022-05-26 15:53:17 +10:00
ae5d3fa2d0 UI: use visible regions when showing candidates for operators data-path
When expanding the data path for the context, use Context.temp_override
to extract context members. Without this, only context-members available
in the preferences were used which misses members which are likely to
be useful.

Iterate over all windows, areas and regions showing unique member as
candidates. The search is limited to WINDOW/PREVIEW region types, the
preferences space type is also excluded. See the doc-string for
rna_path_prop_search_for_context for additional notes on this.
2022-05-26 14:15:59 +10:00
3f3d82cfe9 UI support for showing candidates for string properties
Currently strings are used for cases where a list of identifiers would
be useful to show.

Add support for string properties to reference a callback to populate
candidates to show when editing a string. The user isn't prevented from
typing in text not found in this list, it's just useful as a reference.

Support for expanding the following strings has been added:

- Operator, menu & panel identifiers in the keymap editor.
- WM operators that reference data-paths expand using the
  Python-consoles auto-complete functionality.
- Names of keying sets for insert/delete keyframe operators.

Details:

- `bpy.props.StringProperty` takes an option `search` callback.

- A new string callback has been added, set via
  `RNA_def_property_string_search_func` or
  `RNA_def_property_string_search_func_runtime`.

- Addresses usability issue highlighted by T89560,
  where setting keying set identifiers as strings isn't practical.

- Showing additional right-aligned text in the search results is
  supported but disabled by default as the text is too cramped in most
  string search popups where the feature would make sense. It could be
  enabled as part of other layout tweaks.

Reviewed By: brecht

Ref D14986
2022-05-26 12:16:35 +10:00
11480763b6 Cleanup: format 2022-05-26 12:13:45 +10:00
dc6fe73e70 Outliner: Make use of new C++ based functional iterators
(Not meant to cause user visible changes.)

Makes use of the new iterators introduced in the previous commit. Some
benefits:
- Shorter, simpler, easier to read & understand
- Deduplicates logic
- Centralizes iteration logic, making it easier to replace tree storage
  (as planned), see previous commit.
- Avoids having to pass (sub-)tree to iterate around (often redundant
  since it's just `SpaceOutliner.tree`, even though `SpaceOutliner` is
  already passed).
- Function arguments that are only passed to the recursive call are
  recognized as unused (found and removed a few).

Also does some general cleanups while refactoring the code for the
iterators. Use `const`, use references (signals null is not expected),
early-exit (see 16fd5fa656), remove redundant arguments, etc.
2022-05-25 23:21:15 +02:00
a4a7af4732 Outliner: New C++ based functional tree iterators
(Not meant to cause user visible changes.)

Adds some first new iterators to traverse over tree elements with a
functional syntax. Functional because it meant to be used with C++
lambdas.
For example, this common pattern:
```lang=cpp
void some_recursive_function(SpaceOutliner *space_outliner, ListBase *tree, ...)
{
  LISTBASE_FOREACH (TreeElement *, te, tree) {
    /* ... do something with the element ... */

    /* Recurse into open children. */
    if (TSELEM_OPEN(TREESTORE(te), space_outliner) {
      some_recursive_function(&te->subtree, ...);
    }
  }
}
```
Gets simplified to this:
```lang=cpp
void some_function(SpaceOutliner &space_outliner, ...)
{
  tree_iterator::all_open(space_outliner, [&](TreeElement *te) {
    /* ... do something with the element ... */
  });
}
```

We can add more iterators, e.g. some that support early exiting or
skipping children, returning a custom type, only act on selected
elements, etc.

The following commit will convert a bunch of code to use these. Some
further benefits will become visible there. Not all cases are straight
forward to convert, but hopefully more and more code can be refactored
to work with this. This deduplicates and centralizes the iteration
logic, which will later make it much easier to refactor how the tree
storage is done (e.g. move it to `SpaceOutliner_Runtime` and use a
better container than `ListBase`).
2022-05-25 23:20:05 +02:00
f3c03982e5 Outliner: Fix warning icon not bubbling up correctly to collapsed parent
Design is to have warnings in the sub-tree of a collapsed element show
up next to the collapsed element. But if inside the collapsed element,
there was a uncollapsed one containing yet another element with a
warning, that warning wouldn't "bubble up" to the collapsed parent.

Issue was that the warning lookup would only recurse into collapsed
elements, rather than all elements inside of a collapsed element.

While the actual fix for this could've been simpler, I decided to rework
this code entirely. Recursively querying the warning message is now done
separately from drawing the message once found, which makes the code
easier to follow and implements the single responsibility principle
better.
2022-05-25 20:16:17 +02:00
6feca52349 Outliner: Use general warning mechanics for library overrides
Library overrides were basically using their own system to display
warnings for tree elements, even though for other display elements we
have a more general solution. With the previous commit this has been
generalized further and made trivial to extend.
2022-05-25 20:16:17 +02:00
f1df685f57 Outliner: Refactor element warning and mode column querying
Uses a inheritance based approach for querying warning of tree elements
and the mode column support of display modes.

For the warnings, tree elements can override the
`AbstractTreeElement::getWarning()` method and return a warning string.
The UI will draw the warning column with warning icons. This makes the
warning column more generalized and easier to extend to more use-cases.
E.g. library override elements will use this after a followup commit.

To support mode toggles a display mode can now just return true in the
`AbstractTreeDisplay::supportsModeColumn()` method. This makes it
trivial to add mode columns to other display modes, and less error prone
because there's no need to hunt down a bunch of display mode checks in
different places.
2022-05-25 20:16:17 +02:00
Pablo Dobarro
1a516bb714 Fix T83519: Line Gesture flip state not updating without a mouse move event
The wm_gesture_tag_redraw function was only called on mouse move, so the
flip state preview was not updating just by pressing the F key.

Reviewed By: Severin

Maniphest Tasks: T83519

Differential Revision: https://developer.blender.org/D9779
2022-05-25 18:36:19 +02:00
496394daad UI: Curves Sculpt pinch icon 2022-05-25 17:33:29 +02:00
a337e7738f BLI: use no_unique_address attribute
Even though the `no_unique_address` attribute has only been standardized
in C++20, compilers seem to support it with C++17 already. This attribute
allows reducing the memory footprint of structs which have empty types as
data members (usually that is an allocator or inline buffer in Blender).
Previously, one had to use the empty base optimization to achieve the same
effect, which requires a lot of boilerplate code.

The types that benefit from this the most are `Vector` and `Array`, which
usually become 8 bytes smaller. All types which use these core data structures
get smaller as well of course.

Differential Revision: https://developer.blender.org/D14993
2022-05-25 16:28:07 +02:00
f381c31ac6 UI: Update icons after the latest changes in the generator script
There should be no visible change. The difference is mostly on how we
changed the rounding to handle the conversion from color space to the
new linear space of the attribute colors.

To convert the materials in icon_geom.blend I used:

```
import bpy
from mathutils import Color

def convert_material(material):
  if not material.use_nodes:
    return

  if not material.node_tree:
    return

  node_tree = material.node_tree
  for node in node_tree.nodes:
    if node.type != 'RGB':
      continue

      color_original = node.outputs[0].default_value
      color_new = Color(color_original[:3]).from_srgb_to_scene_linear()
      color = (*color_new, color_original[3])
      node.outputs[0].default_value = color

def main():
  for material in bpy.data.materials:
    convert_material(material)

main()
```
2022-05-25 15:56:48 +02:00
288e7d0af0 Tool Icons: Support curve and objects with modifiers + color space fix
This allows for the new tool icons to use geometry nodes.

In order to do this I also had to use the new API for accessing the
attributes (instead of vertex colors). Which in turn requires a few
changes to use linear color space.

I went ahead and updated the entire code to use the linear space
everywhere. I will update the icon files manually to make sure the final
result is similar to what we have now.

Note: We now use round instead of int. That plus the changes regarding the
color space will lead to some icons to change slightly (no perceived
visual change).

Differential Revision: https://developer.blender.org/D14988
2022-05-25 15:56:48 +02:00
e8eb67bb04 Merge branch 'blender-v3.2-release' 2022-05-25 15:11:06 +02:00
841a354412 Cleanup: Link/append: Remove useless proxy handling code.
This was not effectively doing anything anymore, time to remove it.
2022-05-25 15:09:52 +02:00
b0d2a435a1 Cleanup: Further tweaks to RNA path API const'ness of PointerRNA parameter.
`RNA_path_struct_property_py` cannot get const `ptr` parameter for now
(usage of `RNA_struct_find_property`).

Also make `RNA_path_resolve_` functions take a const PointerRNA
parameter.
2022-05-25 15:09:07 +02:00
a072a264b6 Fix vertex format for mesh attributes with GPU subdivision
A global variable was mistakenly used here which would accumulate the
vertex attributes (leading to an assertion failure after a while), use
the wrong number of components depending on the attribute data type,
among other issues.
2022-05-25 14:51:29 +02:00
ef59c8295f Fix T98355: Line art crash when switch to mesh edit mode.
This fix will ensure not to load any meshes that's being edited, thus
avoiding crashes.

Ref D15022
2022-05-25 20:43:58 +08:00
c27be07d89 Fix T98365: Overlay: Blender 3.2.0 Beta crashes on startup
This was caused by a wrong mass rename on a piece of code used only on
older hardware.
2022-05-25 14:39:58 +02:00
98b66dc040 Fix T96080: hiding elements does not work with GPU subdiv
Faces, edges, and vertices are still shown when GPU subdivision is
actived. This is because the related edit mode flags were ignored by the
subdivision code.

The flags are now passed to the various compute shaders mostly as part of
the extra coarse data, also used for e.g. selection. For loose edges, a
temporary buffer is created when extracting them. Loose vertices are
already taken into account as it reuses the routines for coarse mesh
extraction, although `MeshRenderData.use_hide` was not initialized,
which is fixed now.
2022-05-25 14:31:06 +02:00
MOD
c980ed27f0 Geometry Nodes: skip Capture Attribute node if output is not needed
This results in a speedup if the capture attribute is only needed
under specific circumstances (e.g. when a switch further down the
line is true). Previously, the input field was always evaluated.

Differential Revision: https://developer.blender.org/D15018
2022-05-25 13:58:02 +02:00
53f7c22022 Fix T98359: Handle object that has no feature lines.
In case of line art "occlusion only" or contour not enabled, it's possible for an object
to not produce any feature lines.

This patch checks that to prevent freeing a NULL pointer.
2022-05-25 19:23:23 +08:00
332d87375d UI: Fix ops.sculpt.cloth_filter icon
This icon was using a material with a slightly different shade of
purple. I removed all the duplicated materials in icons_geom.blend
and this was the only "functional" change (though it is not noticeable).
2022-05-25 12:56:51 +02:00
c64e9c6ae2 Cleanup: Add more const'ness to RNA API.
This commit makes PointerRNA passed to RNA path API const.
Main change was in the `path` callback for RNA structs, and indirectly
the `getlength` callback of properties.
2022-05-25 12:23:11 +02:00
4949dd54eb Merge branch 'blender-v3.2-release' 2022-05-25 11:23:53 +02:00
cb3b9358bf Fix T98344: Crash opening file with proxy.
Weird file where the proxy object has a `proxy_group` pointer, which
does not instantiate any collection...
2022-05-25 11:22:17 +02:00
6ec0f62e3f Merge branch 'blender-v3.2-release' 2022-05-25 10:37:14 +02:00
a4e7a5aa4f Fix link/append code not properly setting correct ID in context items.
When appending an already linked data, `BKE_blendfile_append` would not
properly substitute the `item->new_id` pointer of link/append context
items with the local duplicate of the linked ID.

This would cause drag'n'drop of assets to work incorrectly in some
cases. Fixes part of T95706 and T97320.
2022-05-25 10:32:34 +02:00
adaf92b4ab Cleanup: knife tool
- Use early return and continue to reduce right-shift.
- Rename `lv` to `tri_cos` for storing triangle coordinates.
- Reduce variable scope.
2022-05-25 17:49:12 +10:00
80e007fe8c Merge branch 'blender-v3.2-release' 2022-05-25 17:20:10 +10:00
c9a9763e36 Merge branch 'blender-v3.2-release' 2022-05-25 17:20:08 +10:00
aab947eb46 Fix T98349: Knife project resulting selection is wrong
Regression in [0] which removed the call to BVH-tree recalculation
before calculating the selection.

Instead of recalculating the BVH-tree, postpone recalculating mesh data
until after the selection has been calculated.

[0]: 6e77afe6ec
2022-05-25 17:16:25 +10:00
26c6ec5594 Cleanup: remove context argument from EDBM_mesh_knife
Added in [0] but isn't needed as all needed variables are in the
ViewContext. Avoid passing in the context is it makes debugging
issues with MESH_OT_knife_project more difficult to investigate since
it's possible values written to the ViewContext are ignored.

[0]: 6e77afe6ec
2022-05-25 17:16:23 +10:00
8f0612b781 Merge branch 'blender-v3.2-release' 2022-05-25 08:50:15 +02:00
08324ba2c1 Fix T98350: Crash when using clone tool + sequence.
When no image user is known the last used frame of the image is used to
read a frame. When partial updating an image there is always an image user
that would use a zerod out image user, meaning the frame number is set to 0
when using the clone tool.

This fix syncs the frame with the last used frame of the image to ensure
that the buffer exists. There is a bailout in the overlay_edit_uv.c.
2022-05-25 08:46:18 +02:00
e69f3d7db1 GPU: Updated comment about HQ normals workaround. 2022-05-25 08:03:52 +02:00
1ec01b2142 Merge branch 'blender-v3.2-release' 2022-05-25 08:01:58 +02:00
603d3c90a5 GPU: Fix issue that negated HQ normals workaround.
Thanks Germano for pointing it out.
2022-05-25 08:00:53 +02:00
57b87feda1 PyDoc: suppress duplicate object description warning
RenderEngine.render is both a method and an attribute,
while this should be avoided it's not causing a problem in practice
so quiet the warning when generating docs.

Sphinx now builds docs without any warnings.
2022-05-25 13:43:01 +10:00
d46647040d PyDoc: fix generated output for gpu.shader
Inclining built-in shader descriptions used the wrong indentation level.

Link to the built-in shaders instead which avoids the indentation error
and de-duplicates the list which is already shown on the page.
2022-05-25 13:35:39 +10:00
ceff1c2f65 Cleanup: spelling, unbalanced doxy sections 2022-05-25 12:46:55 +10:00
ae73bd3d9e Cleanup: use doxy sections for mathutils types
Also minor improvements & corrections to comments.
2022-05-25 12:37:27 +10:00
b0da080c2c Drag & drop: Use session UUID of IDs instead of name for dropping
Dropping would pass the name of the ID to drop to the properties of the
drop operator. This would then lookup the ID by name. With linking
and/or library overrides, multiple IDs of the same name and type may
exist, which is why the session UUID should be used instead. All
operators used for dropping support this now and the drop code passes
the session UUID instead of the name.

Also see 917c096be6 and 8f79fa9c67.

Some drop operators were already using the session UUIDs. This converts
the remaining ones. The "name" property is kept working as before, since
some scripts use this.

Side-effect: The "Name" property won't show up in the Adjust Last
Operation anymore, which was the case for some of these operators, and
its value won't be remembered over multiple executions of the operator.
Both were not at all useful from what I can tell, and I doubt this was
done intentionally.
2022-05-24 17:08:02 +02:00
7b778166db Cleanup: Use new helpers for passing IDs from drag & drop to operators
There are now some generalized helpers for passing IDs from drag & drop
to operators via operator properties, mostly introduced in 917c096be6
and 8f79fa9c67. These can be used in a bunch of places to reduce
duplicated code and explicitly share a common solution.

Side-effect: The "Name" property won't show up in the Adjust Last
Operation anymore, and its value won't be remembered over multiple
executions of the operator. Both were not at all useful from what I can
tell, and I doubt this was done intentionally.
2022-05-24 17:08:02 +02:00
25d216724b Cleanup: make format 2022-05-24 15:53:16 +02:00
cd412b4454 Drag & drop: Invert priority of name and session UUID in ID lookups
Continuation of 8f79fa9c67 and 917c096be6. The ID's session UUID is
now always priotitized over its name to lookup the ID from drop-box or
operator properties. bc3dbf109c shows what happens if the name happens
to be set for whatever reason and the session UUID isn't prioritized.
2022-05-24 15:36:41 +02:00
961db61fb8 Merge branch 'blender-v3.2-release' 2022-05-24 15:23:13 +02:00
bc3dbf109c Fix T95706: Material asset not applied if appended and then linked
8f79fa9c67 was an attempt to fix this already, but it didn't quite
work. Problem was that the tooltip was messing with the drop-box and
operator properties, setting the name property for its own internal
logic. This name property would then be used rather than the session
UUID to query the material, which gave the wrong material (linking can
result in multiple IDs of the same type with the same name). A followup
commit will further sanitize this.
2022-05-24 15:22:18 +02:00
463077a3d5 Fix possible lingering around of ID after asset dropping failed
More and more of the drop operations are being switched to use the ID's
session UUID rather than the name, but the cleanup after a drop operator
was cancelled assumed they would set the name. They will now first
attempt to use the session UUID and fallback to the name if needed.
2022-05-24 15:21:38 +02:00
258f6cbf93 Merge branch 'blender-v3.2-release' 2022-05-24 15:04:37 +02:00
bfec666dbc Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-24 15:04:00 +02:00
a40a269062 Fix (studio-reported) bad re-assigning of new liboverride from ID template widget.
Shift-click on the 'linked' button in an ID template widget would fail
to properly remap that usage of the linked ID to the newly created
liboverride.
2022-05-24 15:03:04 +02:00
10aa2fa902 Redraw Motion Paths panel after creating motion path
Add notifier such that the Motion Paths panel in the Object Properties tab
gets redrawn, after using the Create Motion Path button.

The reason it didn't update was that the button actually triggers a popup,
and then executes in the context of that popup. It now actually emits a
`ND_DRAW_ANIMVIZ` notifier, and ensures that the panel redraws on that.
2022-05-24 14:57:30 +02:00
2da7977e3e Depsgraph: Implement backtrace functionality
The goal is to make it easier to track down sources of errors during
the dependency graph builder.

With this change whenever a relation can not be added a trace to the
entity which requested the relation will be printed. For example:

```
Failed to add relation "Copy Location"
Could not find op_from: OperationKey(type: BONE, component name: 'MissingBone', operation code: BONE_DONE)

Trace:

Depth    Type                     Name
-----    ----                     ----
1        Object                   Armature.001
2        Pose Channel             Bone
3        Constraint               Copy Location
```

On an implementation detail traced places where `checkIsBuiltAndTag`
is called, with some additional places to help tracking pose channels,
constraints, and modifiers.

Further improvements in granularity are possible, but that could happen
as a followup development once the core part is proven to work.

An example of such improvement would be to have entries in the trace
which will indicate NLA and drivers building. Currently it might be
a bit confusing to see IDs in the trace referenced from driver.

Even with such limitation the current state of the patch brings a
very valuable information (some information is much better than no
information at all).

Differential Revision: https://developer.blender.org/D15017
2022-05-24 14:48:51 +02:00
089175bb1f Merge branch 'blender-v3.2-release' 2022-05-24 13:17:20 +02:00
f29ff7fb7e Fix T98152: Named Attribute node changes data type for non-existant attributes
Skip changing the data type in the node if it is not known.
2022-05-24 11:55:44 +02:00
2ca66d541a Cleanup: Correct misleading comment in UI code 2022-05-24 11:31:19 +02:00
bc1eb513ab Fix buttons not being grayed out
Was using the wrong bitfield in flag comparisons for the drawing code.
The input handling wouldn't be affected. Own mistake in 0d73113452.
2022-05-24 11:31:19 +02:00
Jeroen Bakker
cd77bf44d4 Merge branch 'blender-v3.2-release' 2022-05-24 11:16:48 +02:00
Jeroen Bakker
d1340e1bb2 Fix T97828: Split normals not visible on certain platforms.
It is a know issue that split normals aren't supported when using high
quality normals in the viewport. Some AMD platforms were pushed to use
high quality normals to work around a driver bug where 1010102 texture
formats `GL_INT_2_10_10_10_REV` wasn't uploaded to the GPU.

This change will remove commonly used polaris platforms from the
work-around. This has been tested with a RX480 against the latest AMD
whql drivers (22.5.1). Users need to ensure that they use the latest
drivers that are available on their platform.

Although this change doesn't fix the underlying issue to support edit
normals when high quality normals are enabled. It will not force that
common platforms cannot use a feature as their platform is forced into
using a work-around.
2022-05-24 11:14:10 +02:00
b84264fbc5 Merge branch 'blender-v3.2-release' 2022-05-24 10:40:52 +02:00
ec5b53a018 Fix T98247 EEVEE: Regression: Shader To RGB not displaying textures
This was caused by the nodetree branch duplication not handling incoming
links to the copied node, making all bsdfs nodes use their default values.
2022-05-24 10:35:24 +02:00
174c3ffb4a Fix T98268: replace string node des not handle empty strings correctly
Just use an existing function from blenlib instead of implementing a new version.
2022-05-24 10:21:02 +02:00
123f4db9bd Cleanup: Else after return in depsgraph code 2022-05-24 10:07:54 +02:00
2ea6a0dd4d Fix T98328: missing depsgraph update after adding node group
Adding node groups can change depsgraph relations, so the depsgraph
has to be rebuild.
2022-05-24 10:05:52 +02:00
e07b1b8316 Fix T98317: equal vs not-equal modes in compare node are not exact opposites
For vectors and colors to be not equal, it is enough when they are not equal
in one component.
2022-05-24 09:49:58 +02:00
cd968a3273 EEVEE: support Curves attributes rendering
This adds support to render Curves attributes in EEVEE.

Each attribute is stored in a texture derived from a VBO. As the
shading group needs the textures to be valid upon creation, the
attributes are created and setup during its very creation, instead
of doing it lazily via create_requested which we cannot rely on
anyway as contrary to the mesh batch, we do cannot really tell if
attributes need to be updated or else via some `DRW_batch_requested`.

Since point attributes need refinement, and since attributes are all
cast to vec4/float4 to account for differences in type conversions
between Blender and OpenGL, the refinement shader for points is
used as is. The point attributes are stored for each subdivision level
in CurvesEvalFinalCache. Each subdivision level also keeps track of the
attributes already in use so they are properly updated when needed.

Some basic garbage collection was added similar to what is done
for meshes: if the attributes used over time have been different
from the currently used attributes for too long, then the buffers
are freed, ensuring that stale attributesare removed.

This adds `CurvesInfos` to the shader creation info, which stores
the scope in which the attributes are defined. Scopes are stored
as booleans, in an array indexed by attribute loading order which
is also the order in which the attributes were added to the material.
A mapping is necessary between the indices used for the scoping, and
the ones used in the Curves cache, as this may contain stale
attributes which have not been garbage collected yet.

Common utilities with the mesh code for handling requested
attributes were moved to a separate file.

Differential Revision: https://developer.blender.org/D14916
2022-05-24 05:02:57 +02:00
64a5a7ade1 Merge branch 'blender-v3.2-release' 2022-05-23 22:38:05 -03:00
5744e7d247 Fix GPUIndexBuf not working in python
Since rBb47c5505aa37, Batchs containing GPUIndexBuf initialized via
a PyObject with buffer protocol no longer work.

This was because of an unsafe optimization in the GPUIndexBuf module
for Python.

So remove this micro-optimization.
2022-05-23 22:37:30 -03:00
bb6f0b085e Merge branch 'blender-v3.2-release' 2022-05-24 11:01:38 +10:00
d55e1caa75 Fix T98185: Assertion saving while fullscreen
When saving from the menu the region was not set,
causing the last region in `area->regionbase` to be used
as the region was assigned before comparison.
2022-05-24 10:59:48 +10:00
c968dae054 Fix T98141: Strip rotation is limited to +/360 degrees
This limiting prevented visual keyframing from working correctly and is
not consistent with object rotation, so limiting is removed.
2022-05-23 23:28:21 +02:00
8eda776eef Fix T98057: Adjustment layer blend mode not optimal
Since adjustment layer is meant to replace original image, cross blend
mode is more optimal than alpha over. Same goes for multicam type.
2022-05-23 23:27:07 +02:00
770510915c Merge branch 'blender-v3.2-release' 2022-05-23 22:26:27 +02:00
bdab538b30 Fix Eevee blackbody wrong with non-default scene linear color space
* Port over new code tables from Cycles
* Convert Rec.709 to scene linear for lookup table.
* Move code for wavelength and blackbody to IMB so they can access the
  required transforms, which are not in blenlib.
* Remove clamping from blackbody shader to bypass the texture read.
  Since it's variable now easiest to just always read from the texture
  than pass additional parameters.
* Fold XYZ to RGB conversion into the wavelength table.

Ref T68926
2022-05-23 22:09:44 +02:00
a22ad7fbd3 Fix T98036: Cycles blackbody inaccurate for low temperature and wide gamut
Regenerate blackbody RGB curve fit to not clamp values, and extend down to
800K since it does now change below 965K.

Note that as before, blackbody is only defined in the range 800K to 12000K
and has a fixed value outside of that. But within that range there should
be no more unnecessary gamut clamping.
2022-05-23 22:07:59 +02:00
2655f47ca3 Revert "LineArt: Use CAS for add_triangles."
This reverts commit 14a5a91e0e.

This caused build errors on x64+arm mac builds and some versions
of MSVC, reverting for now till a better solution is found.
2022-05-23 13:11:17 -06:00
b2e5fc72c8 Merge branch 'blender-v3.2-release' 2022-05-23 21:08:01 +02:00
8f79fa9c67 Fix further issues when mixing link & append for asset drag & drop
917c096be6 applied to objects only, this also applies the same fix for
the general 3D View drop operations, e.g. used for dragging materials,
images, worlds, etc.

This is needed to fix T95706, but apparently something else is still
going on. Needs further investigation.
2022-05-23 21:00:01 +02:00
0d6dda4555 Cleanup: Move new utilities for ID lookup operator properties
Move them to a more accessible place, so that other operators in
different files can use them. The following commit needs this.
2022-05-23 20:59:55 +02:00
02c5ca2f22 Fix possible issues when mixing link & append for asset drag & drop
The operators to handle object drag and drop (from the asset browser,
outliner, etc.) used the object name to find the object to add and
place. This is problematic with linking and/or library overrides, since
this may lead to multiple objects with the same name. So the wrong
object would be used by the drop operators.

Partially fixes T97320. T95706 probably needs the same fix but for
materials.

As a side-effect, the "Name" button won't show up in the Adjust Last
Operation panel anymore. This isn't really useful, and I doubt this was
ever intentionally exposed in the UI.
2022-05-23 20:59:47 +02:00
9039fbaa9c Asset Browser: Show "Current File" icon in sidebar source field
If the asset is stored in the current file, display the corresponding
icon in the "Source" button in the sidebar. This is a nice indicator and
helps users learn what this icon represents (it's used in the main
region without text too).
2022-05-23 20:11:42 +02:00
917c096be6 Fix possible issues when mixing link & append for asset drag & drop
The operators to handle object drag and drop (from the asset browser,
outliner, etc.) used the object name to find the object to add and
place. This is problematic with linking and/or library overrides, since
this may lead to multiple objects with the same name. So the wrong
object would be used by the drop operators.

Partially fixes T97320. T95706 probably needs the same fix but for
materials.

As a side-effect, the "Name" button won't show up in the Adjust Last
Operation panel anymore. This isn't really useful, and I doubt this was
ever intentionally exposed in the UI.
2022-05-23 20:11:37 +02:00
ffa262c9f8 obj: remove unneeded CTX_data_ensure_evaluated_depsgraph
As discussed on the chat and pointed out in D15015, that call is
not needed there (none of the other importers do it either).
2022-05-23 20:43:53 +03:00
9e45af530a Fix T98293: Scene stats info not updated after new OBJ import
The importer was not doing a notification that the scene has changed, so
the bottom status bar scene stats info was not updated right after the
new OBJ import.

Reviewed By: Julian Eisel
Differential Revision: https://developer.blender.org/D15015
2022-05-23 20:42:27 +03:00
a8c81ffa83 Cycles: Add half precision float support for volumes with NanoVDB
This patch makes it possible to change the precision with which to
store volume data in the NanoVDB data structure (as float, half, or
using variable bit quantization) via the previously unused precision
field in the volume data block.
It makes it possible to further reduce memory usage during
rendering, at a slight cost to the visual detail of a volume.

Differential Revision: https://developer.blender.org/D10023
2022-05-23 19:08:01 +02:00
14a5a91e0e LineArt: Use CAS for add_triangles.
Using the atomic "compare and swap" method in add_triangles stage
dramatically speeds up the add_triangles call and significantly reduced
the overall calculation time. This is currently the fastest method we
have experimented with so far.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14953
2022-05-24 00:28:52 +08:00
54f357ed2a Merge branch 'blender-v3.2-release' 2022-05-23 18:17:00 +02:00
ec95f4a5df Fix T96878: When interface translation is enabled, grease pencil layer name is translated in menu.
Those type of entries have to be tagged as not translatable...
2022-05-23 18:16:04 +02:00
0e6d70fec9 Fix "Open Clip" operator in Clip Editor broken
Steps to reproduce were:
- Open Clip Editor
- Call "Open Clip" (e.g. Alt+O)
- Select video file

The file wouldn't be loaded into the Clip Editor.

Caused by 7849b56c3c.
2022-05-23 18:01:11 +02:00
d91711bc85 Fix for crash opening the file selector multiple times
This is part of a fix for T88570, where the file selector would crash
when activated multiple times.

Calling save multiple times would free the operator, leaving a dangling
pointer which was used when panels were visible that accessed the
"active_operator".

Reviewed By: Severin

Ref D14905
2022-05-23 18:01:11 +02:00
bc8e030a84 Fix T88570: Crash when saving after pressing ctrl+S twice.
Existing code to replace the file operation was failing when done from
the window for the file operation itself.

Basically, this patch does two things:
- Implement a well defined window context to use as the "owner" or
  "root" of the File Browser. This will be used for managing the File
  Browser and to execute the file operation, even after the File Browser
  was closed.
- Ensure the context is valid when dealing with file File Browser event
  handlers.

Previously the window context just wasn't well defined and just happened
to work well enough in most cases. Addressing this may unveil further
issues, see T88570#1355740.

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

Reviewed by: Campbell Barton
2022-05-23 18:01:11 +02:00
2b9dfff6f3 Cleanup: GPU: Remove gpu_shader_common_obinfos_lib.glsl
This has been replaced by `draw_object_infos`.
2022-05-23 17:20:12 +02:00
09b7e141d2 Fix T98251: EEVEE: Regression: Wrong normalmaps on scaled objects
This was caused by a missing `normalize`.
2022-05-23 17:20:12 +02:00
e4de0d28c4 EEVEE: Fix unreported broken normal map node modes
A compilation error was making it impossible to use normal map modes other
than tangent.
2022-05-23 17:20:12 +02:00
bce37bc52a Cleanup: GPU: Remove gpu_shader_common_obinfos_lib.glsl
This has been replaced by `draw_object_infos`.
2022-05-23 17:19:37 +02:00
7542dc460f Fix T98251: EEVEE: Regression: Wrong normalmaps on scaled objects
This was caused by a missing `normalize`.
2022-05-23 17:16:15 +02:00
5565d79057 EEVEE: Fix unreported broken normal map node modes
A compilation error was making it impossible to use normal map modes other
than tangent.
2022-05-23 17:13:57 +02:00
16fd5fa656 Cleanup: Early-exit in button handling code, minor cleanups
This should decrease cognitive load because:
- Intention is more explicit
- Shorter visual scope of branches (no need to search for matching
  closing brackets and `else` blocks)
- Visually less busy code because condition-checks and code that
  "actually does things" are separated, with less indentation
- Avoids chaining together a bunch of conditions to a single `if`

Also: Use `const`, correct comment placement, whitespace improvements.
2022-05-23 16:55:43 +02:00
7f1a5f2567 Merge branch 'blender-v3.2-release' 2022-05-23 16:33:04 +02:00
Johannes J
f4d31fbf6c DRW: Fix signed/unsigned mismatches in shader code
Fix the following error messages on Blender startup
since commit 308a12ac64.

This commit fixes T98194.

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D15007
2022-05-23 16:30:18 +02:00
85e3e3be5b Merge branch 'blender-v3.2-release' 2022-05-23 16:24:50 +02:00
aea59428eb Fix T98128: EEVEE: Regression: Inverted surface normal on MacOS Intel GPU
This seems to be caused by the `!` used in conjunction with a macro.
Using the macro directly as condition does not exhibit this issue.
2022-05-23 16:23:50 +02:00
63cf0d0890 Fix T98196: Crash when moving tweaked NLA strip with empty track below
`BKE_nlastrip_find_active()` and `update_active_strip()` now do a more
thorough search for the active strip, by also recursing into
meta-strips.

There were some assumptions in the NLA code that the active strips is
contained in the active track. This assumption turned out to be false:
when there is a meta-strip, the active strip could be inside that, and
then it's not contained in `active_track.strips` directly.

Apart from the above, there are other situations in which the track
pointed to by `AnimData::act_track` does *not* contain the active strip
(even indirectly).

Both these cases can happen when the transform system is moving a strip
that's in tweak mode. Entering tweak mode doesn't just search for the
active track/strip, but also falls back to the last-selected ones. This
means that the track/strip pointers & flags can be out of sync with
what's being tweaked/transformed. Because of this, the assumption that
there is any relation between "active strip" and "active track" has been
removed from the `update_active_strip()` function.

All this searching could be prevented by passing the `AnimData` to the
code that duplicates tracks & strips. That way, when the active
track/strip is dup'ed, the `AnimData` pointers can be updated as well.
That would require more refactoring and thus could introduce other bugs,
so that's left for later.
2022-05-23 16:12:09 +02:00
Aleš Jelovčan
82d7234ed9 GPencil: A Ping Pong effect to Time modifier
This patch adds 4th option to Time offset modifier Modes.

It loops from start frame to end frame and then back to start in reverse direction.
In other words it is a combination of Normal and Reverse mode.

Especially with offset control it adds the ability to create easy looping animations such as cheering crowds, flowers opening and closing at different offsets.

Reviewed By: #grease_pencil, antoniov, pepeland, mendio

Differential Revision: https://developer.blender.org/D14965
2022-05-23 16:03:04 +02:00
698e394e7e Merge branch 'blender-v3.2-release' 2022-05-23 16:02:52 +02:00
9bb4bf5748 Fix missing 64bit casts when calculating Cycles render buffer offset
Found those missing casts while looking into a crash report made in
the Blender Chat. Was unable to reproduce the crash, but the casts
should totally be there to avoid integer overflow.
2022-05-23 15:59:52 +02:00
3e4f84d10d Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-23 15:57:33 +02:00
eb5e7d0a31 Cleanup: clarify what is scene linear color space in conversion conversion
* Rename ambiguous rgb to scene_linear in some places
* Precompute matrices to directly go to scene instead of through XYZ
* Make function signatures more consistent
2022-05-23 15:34:50 +02:00
469ee7ff15 Python API: add mathutils.Color functions to convert color spaces
Between scene linear and sRGB, XYZ, linear Rec.709 and ACES2065-1.

And add some clarifications about color spaces in the docs.

Fixes T98267

Ref T68926

Differential Revision: https://developer.blender.org/D14989
2022-05-23 15:34:50 +02:00
09292b89c3 Fix wrong mouse tolerance in mask editor
There are two issues. The biggest one was that a pixel value was used
to compare a squared distance meaning the tolerance was too strict.
The other issue was that the tolerance in pixels was different to what
the tracking mode is using.

The user-level change is that now it should be easier to tweak the
mask shape.
2022-05-23 15:22:08 +02:00
00506d7a86 Cleanup: Unused field in sculpt DeleteOperation 2022-05-23 15:03:41 +02:00
2f2d13b8c6 Fix T97237: dragging custom node group asset adds broken node
Differential Revision: https://developer.blender.org/D15013
2022-05-23 14:43:20 +02:00
eba6900b08 Fix T98305: Image.save not working for generated images with filepath
This is a place where the API function and operator should differ, for the API
manually setting the filepath and then saving should work. For the UI there is
no filepath visible, so it should open Save As even if there was a filepath set
for example from before changing an image type to Generated.
2022-05-23 12:30:11 +02:00
a833c7f4a5 Fix T98283: Regression: crash when opening file that has Collision modifier on liboverride object
Some RNA property update callbacks can already generate such modifier,
and only one is allowed per object, so had to adapt code actually adding
new modifiers in liboverride apply codebase.
2022-05-23 12:13:33 +02:00
f626fc27f9 Fix T98316: geometry nodes stop updating after duplication
This was a missing depsgraph update.
2022-05-23 12:13:33 +02:00
3fe1079ecf Fix T98258: Duplicated last vertex after GPencil sample.
Also fixed an unreported issue of incorrect interpolation of thickness.

Reviewed By: Aleš Jelovčan (frogstomp), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15005
2022-05-23 12:13:33 +02:00
2d67b375a1 Fix T98231: missing update when material output is in group
Differential Revision: https://developer.blender.org/D14998
2022-05-23 12:13:33 +02:00
62a2b92b6b Fix T98283: Regression: crash when opening file that has Collision modifier on liboverride object
Some RNA property update callbacks can already generate such modifier,
and only one is allowed per object, so had to adapt code actually adding
new modifiers in liboverride apply codebase.
2022-05-23 12:11:09 +02:00
a5409d2b59 Fix T98316: geometry nodes stop updating after duplication
This was a missing depsgraph update.
2022-05-23 11:29:55 +02:00
f4101ba4a1 LineArt: Fix adjacent edge sorting.
The sorting end element should be `start+len` not `start+len-1`.
2022-05-23 16:20:23 +08:00
c4e5a7d59a Fix T98258: Duplicated last vertex after GPencil sample.
Also fixed an unreported issue of incorrect interpolation of thickness.

Reviewed By: Aleš Jelovčan (frogstomp), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15005
2022-05-23 16:17:00 +08:00
f4a01c8a8b Fix T98101: Handle single point curves in delete brush
The 3D brush utility and the delete brush only considered segments,
so they did not handle single points. Fix by adding special cases for
single point curves.

Differential Revision: https://developer.blender.org/D14944
2022-05-23 09:47:17 +02:00
8f3847aef3 Fix: Sample pressure properly for 3D curves sculpt brushes
For the "Sphere" 3D brushes, the depth and radius are only sampled at
the beginning of the stroke. This didn't work when tablet pressure is
used as a factor for the brush radius. Now the 3D brush depth is found
with the max radius (as if the pressure was 1.0), but the pressure
factor is used afterwards.

Restructuring the way the brush executors stored the radius made
the change a bit clearer, which is where most of the diff comes from.

Differential Revision: https://developer.blender.org/D15002
2022-05-23 09:44:12 +02:00
b81f1b8cf1 Fix T98231: missing update when material output is in group
Differential Revision: https://developer.blender.org/D14998
2022-05-23 09:11:17 +02:00
f93b237194 Merge branch 'blender-v3.2-release' 2022-05-23 08:16:50 +02:00
4418536f69 Fix T98321: Image.update doesn't update the image editor.
Missing call to partial update.
2022-05-23 08:14:38 +02:00
ad33e68348 Cleanup: remove "texture" from ED_mesh_uv_texture_* funcitons
This name made sense when UV's and textures were stored in the same
layer (MTFace & TFace).
2022-05-23 12:43:28 +10:00
1e882b8657 PyDoc: quiet output and minor cleanup
Suppress printing unnecessary output when generating docs.
2022-05-23 12:37:28 +10:00
4d509fd6e1 Fix error in sphinx_doc_gen.py when logging
Regression in 45ed325443
2022-05-23 12:37:22 +10:00
c92f137a75 Merge branch 'blender-v3.2-release' 2022-05-23 12:37:08 +10:00
47b0ca85cd Fix float representation for Python API docs
float_as_string(1000000) resulted in 1e+06.0 which isn't valid notation.
2022-05-23 12:35:37 +10:00
341f1e444f Cleanup: formatting 2022-05-22 21:59:46 -04:00
04ed96136b Merge branch 'blender-v3.2-release' 2022-05-22 21:58:45 -04:00
568b692bcf Compositor: Fix Map Range node To/From Max default value
Mistake from rB5ef5a9fc24668aa264fe0558db9c0fb1246aa37f

Fixes T98322
2022-05-22 21:56:32 -04:00
84e55e3dc2 Fix T98320: GPencil Crash with Length and Build Modifiers
The length modifiers creates a NULL strokes and this is not handled by Build modifier.
2022-05-22 21:10:08 +02:00
d095fcd6b4 Cleanup: Fix build error after previous commit
I'm not sure how that happened, sorry for the noise.
2022-05-22 20:26:25 +02:00
e222e19d82 Cleanup: Use const arguments 2022-05-22 20:06:24 +02:00
fff8f969de Cleanup: Remove unused function
Mesh "MFace" is deprecated and shouldn't be used in any new code anyway.
2022-05-22 13:05:12 +02:00
fdb1f70468 Cleanup: fix wrong type
It's a bit surprising that this compiled. That's probably due to the
`GField` constructor, to be investigated!
2022-05-22 12:01:11 +02:00
9d9f2f1a03 GPU subdiv: smoothly interpolate orco layer
This uses the recently introduced evaluator's vertex
data to smoothly interpolate original coordinates instead
of using linear interpolation.

The orcos are interpolated at the same time as positions
and as such, the specific subdivision routine for the
orco extractor has been removed. The patch evaluation
shader uses a definition to enable code specific to
orco evaluation.

Since the orco layer may not have been requested on first
render, and since orco data is now stored in the OpenSubDiv
evaluator, the evaluator needs to be recreated if an
orco layer is suddenly available. For this, a callback
to check if the evaluator has the data was added. This is
added to the evaluator as the `Subdiv` cache stored in the
modifier is invalidated less often than the Mesh batch cache
and so leads to fewer evaluator recreations.

Differential Revision: https://developer.blender.org/D14999
2022-05-22 09:19:55 +02:00
45ed325443 PyDoc: resolve/quiet warnings for pylint
- Duplicate keys in dict.
- Redefining names.
- Unused arguments.
- Use lazy % formatting in logging functions.
2022-05-22 13:31:36 +10:00
84901adec5 PyDoc: cleanup doc-generator
- Full sentences for comments.
- Use double quotes for strings (which aren't enum ID's).
- Reduce right-shift.
2022-05-22 13:08:38 +10:00
dfb8c90324 Cleanup: Remove unused scrollbar drawing flag
Apparently this was used for progressbar drawing, which doesn't share
the code anymore.
2022-05-21 00:53:54 +02:00
0d73113452 UI Code Quality: Resolve frankenstein bit-flag usage for widget drawing
Previously we would pass button state and draw information to widget
draw callbacks in a rather hacky way. Some specific flags from
`uiBut.flag` were masked out, so their bits could be reused for also
passing `uiBut.drawflag` in the same int. Instead this commit introduces
a state-info struct that can properly hold all the relevant data.

This has the advantage that it's now easier to introduce new state data
that needs to be accessible in the widget callbacks. Since we are
running out of button flags, we plan to reorganize button flags, and
split them up into multiple bitfields. In the widget drawing code, this
would have been a hassle earlier.

Also had to add a new widget callback to draw blocks as widgets (popup
backgrounds), since that would pass block flags where we would usually
pass button flags. This wasn't nice, now it's separated more clearly.
2022-05-21 00:53:54 +02:00
029e6b5174 Geometry Nodes: String to Curves rename Max Width
This patch changes the Text Box Width socket to always have that label
instead of switching to "Max Width" when Overflow mode is picked.

Bug report: T97060

Differential Revision: https://developer.blender.org/D14909
2022-05-20 17:11:27 +02:00
bf352df27a Fix wrong USD image color space export with non-default OpenColorIO config
The names of color spaces in OpenColorIO configs can be arbitrary, so don't
use hardcoded names from our default config.
2022-05-20 17:07:37 +02:00
9b082da708 UI: rename Hue/Saturation node to Hue Saturation Value in shaders and textures
This makes it easier to search for and consistent with compositor nodes.

Differential Revision: https://developer.blender.org/D14914
2022-05-20 16:47:11 +02:00
8d65895af8 UI: Get rid of redundant UI_BUT_IMMEDIATE button flag
This flag was used to activate the hotkey input buttons (e.g. for
"Assign Shortcut") when opened in a popup. Since this was added, other
more generalized ways of getting this same behavior were implemented.
Had to tweak the hotkey button event handling a bit, but it seems to
behave exactly as before now.
2022-05-20 16:35:13 +02:00
de561280fc Cleanup: don't use variable name that matches type alias 2022-05-20 16:32:14 +02:00
b215fe82e8 Cleanup: Further simplification of loop syntax for curve segments
The same changes as 019681b984.
2022-05-20 16:00:26 +02:00
f8239cc9a0 Curves: Use only current brush location for delete brush
Currently the delete brush and some other brushes use the line
segment from the current brush position to the previous position
to find curves to interact with. However, this doesn't work well
with more advanced stroke settings that purposefully use
non-contiguous brush sample locations. This commit makes
the delete brush only use the current sample location.

Differential Revision: https://developer.blender.org/D14992
2022-05-20 13:34:30 +02:00
cea37b3127 Curves: Support pressure in sculpt brushes
Multiply the radius and strength of sculpt brushes by the pressure
when "use pressure" is turned on. The brush system isn't responsible
for this, so the pressure needs to be stored in `StrokeExtension`.

Differential Revision: https://developer.blender.org/D14996
2022-05-20 13:33:42 +02:00
a89f829f12 LibOverride: Add option to Hierarchy Creation to get all data user-editable by default.
Avoids having to manually enable data-blocks for user-edition when you
do not care about what should be edited by whom. Similar to default
behavior before introduction of system overrides (aka non-user-editable
overrides).
2022-05-20 12:02:52 +02:00
019681b984 Cleanup: Simplify loop syntax for curve points 2022-05-20 10:56:19 +02:00
47c2a876bf Merge branch 'blender-v3.2-release' 2022-05-20 10:11:09 +02:00
d4cdae29c1 Fix T98266: Crash with empty mesh boolean node
The output mesh can be null. Also reorganize the WITH_GMP
check to avoid compiling the rest of the node with GMP off.
2022-05-20 10:10:46 +02:00
1d65f7ea91 Merge branch 'blender-v3.2-release' 2022-05-20 09:50:54 +02:00
b8bd20d7e0 Fix T96810: Bitmap race condition in PBVH normal calculation
The final normalization step of sculpt normal calculation iterates over
all unique vertices in each node and marks them as done. However,
storing the done mask in a bitmap meant that multiple threads could
write to a single byte at the same time, because the bits for separate
threads could be stored in the same byte. This is not threadsafe

Fixing this issue seems to improve performance as well. First I tested
just clearing the entire bitmap after the normal calculation. Then I
tested using an array of booleans instead, which turned out to be
slightly better, and simplifies code a bit.

I tested on a Ryzen 3800x, on an 8 million polygon subdivided
Suzanne by using the grab brush with a radius large enough to
affect most of the mesh.

| Original  | Clear Entire Bitmap | Boolean Array |
| --------- | ------------------- | ------------- |
| 67.9 ms   | 59.1 ms             | 57.9 ms       |
| 1.0x      | 1.15x               | 1.17x         |

Differential Revision: https://developer.blender.org/D14985
2022-05-20 09:49:29 +02:00
Martijn Versteegh
8e02b0d5d4 Cleanup: make functions for setting clone/stencil layer more consistent
This was missing in rBf1beb3b3f60be45854285935d6bfcedf839b317c.

Differential Revision: https://developer.blender.org/D14991
2022-05-20 09:36:30 +02:00
af7502dd9b Merge branch 'blender-v3.2-release' 2022-05-20 16:46:52 +10:00
d27f4e8493 Fix popup menu memory activating labels when names matched menu items
When labels in popups (typically headings) matched the name of a button,
the label would be activated instead of the button.

This caused the unwrap menu in the UV editor not to re-select "Unwrap"
when opening a second time.
2022-05-20 16:42:35 +10:00
f049591967 Merge branch 'blender-v3.2-release' 2022-05-20 16:11:28 +10:00
f61dd33f50 Merge branch 'blender-v3.2-release' 2022-05-20 16:11:25 +10:00
f68fb81064 Fix T98145: IC keymap can't select & move multiple nodes
Regression from [0] which changed operator properties without
updating this keymap.

[0]: 4c3e91e5f5
2022-05-20 16:07:32 +10:00
838806be28 WM: return the string length from operator name conversion
- In some cases it avoids using strlen on the result.
- Use ATTR_NONNULL for all arguments.
- Remove NULL pointer check for WM_operator_bl_idname src argument.
- Rename from/to to src/dst.
2022-05-20 13:35:28 +10:00
780ad443fd Include __init__.py in bl_console_utils
Failure to include this file caused script_load_modules test to fail.
2022-05-20 12:41:44 +10:00
930e526cae Cleanup: warnings, spelling, formatting
Avoid multiple `sound.bl_rna.properties["channels"].enum_items` in
the same line. Note we might want a way to avoid having to do this.
2022-05-20 11:24:34 +10:00
42a6c226d0 CMake: fix AUDASPACE disabling WITH_PYTHON for Blender
When AUDASPACE couldn't find NUMPY, it would disable WITH_PYTHON for
the rest of Blender. Now setting the value globally is only done for
standalone AUDASPACE builds. Now it's possible to build Blender with
AUDASPACE & PYTHON but without NUMPY.

While this isn't an especially important configuration to support,
having Python mysteriously disabled is a hassle to troubleshoot.

NOTE: extern/audaspace/CMakeLists.txt has become out sync with the
original [0], it seems this is being maintained in our repository.

[0]: https://github.com/neXyon/audaspace/blob/master/CMakeLists.txt
2022-05-20 11:18:49 +10:00
c1dcc64750 CMake: disable WITH_MOD_FLUID when WITH_PYTHON=OFF 2022-05-20 11:17:32 +10:00
74a34d95d6 Cleanup: move 'console' module to 'bl_console_utils.autocomplete'
The name 'console' for a module was too generic, move into a sub-package
of bl_console_utils, so other console utilities can be added
without creating new top-level modules.
2022-05-20 10:00:40 +10:00
a42307eb65 Fix building with OpenEXR on Linux 2022-05-20 10:00:40 +10:00
f600a2aa6d IMBUF: Thumbnails of all EXR files using less RAM
Specialized thumbnailing function to create previews of all EXR image
files, regardless of type, size, or dimensions. Uses less RAM by only
loading a single row of pixels at a time.

See D14663 for more details and examples.

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

Reviewed by Brecht Van Lommel
2022-05-19 14:55:04 -07:00
1a627d528c Python API: warn that the bgl module is deprecated in the docs
This was already mentioned in the release notes but not the API docs.

Ref T80730
2022-05-19 21:21:28 +02:00
Marcos Perez
89106a695a VSE: Display sound sample rate and channels
Display information about sound media in "Source" category in side panel
similar to movie resolution and framerate.

The specs are stored in the `Sequence` struct, and are extracted at
the moment of struct creation. If the "source file" is changed,
the specs change also.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D14565
2022-05-19 21:05:23 +02:00
9e9895b055 GPencil: Avoid Automerge with Closed strokes
The algorithm is not designed to be used with Closed strokes (cyclic) and actually the result is arbitrary. In order to avoid this, now the closed strokes never are merged.

Related to T98235

Feedback by: @mendio
2022-05-19 18:05:15 +02:00
65e13cc2d2 Merge branch 'blender-v3.2-release' 2022-05-19 12:23:23 -03:00
bc6965cb98 Fix T98230: Automatic Constraint doesn't work if cursor is not moving
The change was kind of intentional on {rB21e72496a629}.

That commit made mouse movement to "select" the contraint in Auto
Constraint a requirement.

This deduplicated the code a bit, but this requirement is not
comfortable for the first "selection" of the contraint.

So the constraint "selection" is now done in two ways:
- If there is no contraint, the "selection" is done immediately;
- If there is already a constraint, the "selection" is delayed by 1 event to simulate a constraint cancellation if there is no mouse movement.
2022-05-19 12:22:30 -03:00
436a7ee651 Merge branch 'blender-v3.2-release' 2022-05-19 16:54:10 +02:00
2d5b91d6a0 Fix (studio-reported) more possibilities to edit content of linked/override collections.
Existing code for the `Move` operator, and some `Collections` panel
operations (Object properties) was absolutely not override-safe, and
sometimes not even linked-data safe.
2022-05-19 16:51:24 +02:00
eb13072399 Merge branch 'blender-v3.2-release' 2022-05-19 16:22:00 +02:00
f8ebb0e1d5 GPencil: Remove icons in Build modifer mode parameter
The list must not use icons.

Feedback by @pablovazquez
2022-05-19 16:21:25 +02:00
d0fabb318e UI: Expose new tool icon: Selection Paint
This icon will be used by the curves paint select brush.
2022-05-19 15:25:38 +02:00
f5b708d1cf Cleanup: Decrease variable scope 2022-05-19 14:08:54 +02:00
29ca935eb8 Cleanup: Remove redundant function
`BKE_object_get_evaluated_mesh` now looks inside `geometry_set_eval`.
2022-05-19 14:02:16 +02:00
4fc96e5000 Merge branch 'blender-v3.2-release'
Conflicts:
	source/blender/blenkernel/intern/lib_override.c
2022-05-19 12:04:07 +02:00
24745e8d27 Fix liboverride extreme resync times in case of libraries dependency loops.
That max number of `10000` level of recursivity was a typo (should have
been `1000`), but even that is way too high, typical sane situation
should not lead to more than a few tens of levels, so reducing the max
level to 200.

Also improve error message with more context info about the issue.

Found while investigating issues for the Blender Studio's Heist production.
2022-05-19 11:59:58 +02:00
74420d95b3 Revert "Fix liboverride extreme resync times in case of libraries dependency loops."
This reverts commit e42e4e8568.

Wrong commit, sorry for the noise.
2022-05-19 11:51:01 +02:00
e42e4e8568 Fix liboverride extreme resync times in case of libraries dependency loops.
That max number of `10000` level of recursivity was a typo (should have
been `1000`), but even that is way too high, typical sane situation
should not lead to more than a few tens of levels, so reducing the max
level to 200.

Also improve error message with more context info about the issue.

Found while investigating issues for the Blender Studio's Heist production.
2022-05-19 11:47:28 +02:00
c88de1594f Fix T98237: Double free with curve object conversion to mesh
In some cases (when there is an evaluated curve), the conversion code
would try to free the evaluated data-block twice, because freeing the
object would free it from `data_eval` and then the data-block was freed
again explicitly. Now check if the data-block is stored in `data_eval`
before freeing `object.data` manually. This is another area that's made
more complex by the fact that we change the meaning of `object.data`
for evaluated objects. The solution is more complicated than it should
be, but it works whether or not an evaluated mesh or curve exists.
2022-05-19 11:10:17 +02:00
f4cbfaded6 Cleanup: Remove unnecessary indentation 2022-05-19 10:00:12 +02:00
2e06c223cc Fix T73250: Override Library will always return to Object Mode on file opening.
Was an old known annoying issue, since the matching RNA property is
read-only we need a manual handling of this in override applying and
resyncing code.
2022-05-19 09:06:33 +02:00
5d0432a2ea Merge branch 'blender-v3.2-release' 2022-05-19 14:32:59 +10:00
a111aae415 Merge branch 'blender-v3.2-release' 2022-05-19 14:32:54 +10:00
ae11233b65 Merge branch 'blender-v3.2-release' 2022-05-19 14:32:51 +10:00
3ecc03c3d6 Fix T93779: Python is unable to set axis aligned views
It wasn't possible to temporarily orbit the view, then set back to an
axis-aligned view.

Details:

- It was possible to change RegionView3D.view_rotation while the view
  kept the axis alignment value (Top, Left, Front .. etc) which
  displayed in the viewport overlay.

  Now changing the view rotation directly or via "view_matrix" resets
  the axis-alignment - clearing when the view is no longer axis-aligned
  or assigning the newly aligned axis.

- RegionView3D.is_orthographic_side_view added in [0] could be assigned
  but wasn't useful as it treated an enum as a boolean only setting the
  RegionView3D.view to RV3D_VIEW_USER or RV3D_VIEW_FRONT.

  Now enabling this aligns the viewport rotation to it's closest
  axis-aligned orientation setting RegionView3D.view & view_axis_roll
  accordingly. Note that the "orthographic" term is misleading as the
  property only relates to axis-alignment, not to the
  perspective/orthographic setting. We could consider deprecating the
  current naming.

[0]: 63bae864f4
2022-05-19 14:31:22 +10:00
76b6741981 Fix View Roll failure to align the quaternion to the view-axis
View roll checked if the resulting roll was close to a view axis
but didn't write the aligned quaternion back to the final result.
Add ED_view3d_quat_to_axis_view_and_reset_quat since most callers
to ED_view3d_quat_to_axis_view will reset the quaternion when a view
aligned axis is found.
2022-05-19 13:06:45 +10:00
41feaa17f3 Cleanup: suppress 'address' warnings for ./extern/glew
Also add comments noting why some warnings shouldn't be added to
strict-flags.
2022-05-19 11:17:01 +10:00
e9c3af3dd7 Cleanup: always assign return args for SCULPT_paint_image_canvas_get
Asserting the variables weren't NULL raised a warning with GCC 12.1,
instead of suppressing the warning, always assign NULL which is often
expected behavior and makes the function work as documented.
2022-05-19 11:17:01 +10:00
6730c11dd9 Cleanup: quiet deprecated-copy warning with GCC 2022-05-19 11:17:01 +10:00
3e2017491a Cleanup: spelling in comments & move doc-strings to headers 2022-05-19 11:17:01 +10:00
30e666f747 Cleanup: format, reduce line length & strip trailing space 2022-05-19 11:17:01 +10:00
ae2d2c9361 DRW: GPU wrappers: Fix resize routines for StorageArrayBuffer
Resizing was not resizing the `data_` buffer. Also use `power_of_2_max_u`.
2022-05-19 00:35:36 +02:00
b16eff2bb3 EEVEE-Next: Fix error on curve prepass caused by velocity commit 2022-05-19 00:35:36 +02:00
b3e53d6daa EEVEE-Next: Fix display of compiling shader countdown
Also fix naming convention on public variable.
2022-05-19 00:35:36 +02:00
f4028630bf EEVEE-Next: Display error instead of crashing on unsupported hardware
This message will remain in effect until we bump up the minimum
hardware requirement.
2022-05-19 00:35:36 +02:00
769cdccd0e Fix assertion raised in Merge By Distance
Harmless assertion in `r_weld_mesh->wpoly_new[r_weld_mesh->wpoly_new_len++]`
that checks the size even though it has enough space.
2022-05-18 19:06:50 -03:00
22812579bb Cleanup: rename 'WeldPoly' member 'len' to 'loop_len'
This avoids confusion.
2022-05-18 18:46:28 -03:00
7ace6dc496 Fix compilation errors with 'USE_WELD_DEBUG' 2022-05-18 18:40:20 -03:00
89ccff62d2 makesdna: centralize DNA header list.
There's currently 4 places that need to be edited when adding
a DNA header, and as you can imagine, this has gotten out of
sync quite a bit.

source/blender/CMakeLists.txt - 84 headers
source/blender/makesdna/intern/CMakeLists.txt - 33 headers
source/blender/makesdna/intern/makesdna.c@includefiles - 77 headers
source/blender/makesdna/intern/makesdna.c@Disabletypes - 76 headers

This diff makes source/blender/CMakeLists.txt the only place
where we need to keep track of dna headers, less maintenance
less mistakes. For all old places there is now a comment reminding
people of the new location.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13048
2022-05-18 15:09:19 -06:00
699944572f EEVEE-Next: Fix memory leak 2022-05-18 23:01:08 +02:00
0fcfc4cc5b EEVEE-Next: Add Velocity module
This module allow tracking of object and geometry data accross time.
This commit adds no user visible changes.

It work in both viewport (*) and render mode, gives correct motion
for any camera projection type and is compatible with displacement (**).

It is a huge improvement upon the old EEVEE velocity which was only used
for motion blur and only available in render.

It is also an improvement for speed as the animated objects do not need to
be rendered a 3rd time. The code is also much cleaner: no GPUVertBuf
duplication, no GPUBatch amendment, no special cases for different geometry
types, no DRWShadingGroup per object, no double buffering of velocity.

The module is still work in progress as the final output may still be
flawed.

(*): Viewport support is already working but there might be some cases where
mapping will fail. For instance if topology changes but not vertex count.

(**): Displacement does not contribute to motion vectors. Surfaces using
displacement will have the same motion vectors as if they were not displaced.
2022-05-18 23:01:08 +02:00
33c5adba62 GPUStorageBuf: Add GPU_storagebuf_copy_sub_from_vertbuf()
This allows using the Graphic API to copy buffer data.
The GPU module do not expose untyped buffers even if that's what most API
do, so the copy function need to be strongly typed.

Contains GL backend implementation.
2022-05-18 23:01:08 +02:00
9631bb1e17 GLShader: Add glsl_shader_defines.glsl to compute shaders 2022-05-18 23:01:08 +02:00
ca780f4406 GL: Fix gl error during debug name setup for shader storage buffers 2022-05-18 23:01:08 +02:00
4fa743af85 GPUSource: Add error message on source not found
Without this, we could have crashes during static compilation of shaders
without knowing where it would come from.
2022-05-18 23:01:08 +02:00
683570c7fe DRW: Wrappers: Use runtime length of the buffer instead of the initial len
This could have produce errors especially in the iterators.
2022-05-18 23:01:08 +02:00
80811c5638 DRW: Replace StorageFlexibleBuffer with explicit get_or_resize()
This is to avoid hiding resize inside the `[]` operator.
2022-05-18 23:01:08 +02:00
790598fa60 Cleanup: BLI_math_base.h: Document power_of_2_max|min() 2022-05-18 23:01:08 +02:00
fe4ae77ded BLI: float4x4: Add == and != operators 2022-05-18 23:01:08 +02:00
c4c6ea7ea9 BLI: float4x4: Add << operator
Use nice formating to have lining up rows.
2022-05-18 23:01:07 +02:00
c34e3f0f19 DRW: Fix DRW_shgroup_buffer_texture naming
We do not need `_ex` suffix.
2022-05-18 23:01:07 +02:00
28316e0810 Cleanup: Move strip handle manipulation to time section 2022-05-18 21:43:14 +02:00
8ca9ce0986 VSE: Remove still frame offsets
To clarify term still frame: This is portion of strip that displays
static image. This area can exist before or after strip movie content.

Still frames were implemented as strip property, but this was never
displayed in panel. Only way to set still frames was to drag strip
handle with mouse or using python API. This would set either
`seq->*still` or `seq->*ofs` where * stands for `start` or `end`.

When strip had offset, it can't have still frames and vice versa, but
this had to be enforced in RNA functions and everywhere in code where
these fields are set directly. Strip can not have negative offset or
negative number of still frames.

This is not very practical approach and still frames can be simply
implemented as applying negative offset. Merging these offsets would
simplify offset calculations for example in D14962 and could make it
easier to also deprecate usage `seq->*disp` and necessity to call
update functions to recalculate strip boundaries.

For users only functional change is ability to set negative strip offset
using property in side panel.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D14976
2022-05-18 21:26:47 +02:00
214e61fc2c Cleanup: fix Cycles asan warning
Not sure why constructing a ustring inside [] is causing issues here, but
it's slightly more efficient to construct it once anyway.
2022-05-18 18:54:57 +02:00
47dbdf8dd5 Merge branch 'blender-v3.2-release' 2022-05-18 17:21:37 +02:00
14a893f20e Fix T98225: file saved with an object in sculptmode that is disabled in viewports crashes on reload
Issue revealed by rB90e12e823ff0. Hidden objects may not be fully
evaluated by the despgraph, do not attempt to restore edit/sculpt/etc.
modes for those.

Should also be backported to 2.93 LTS release.
2022-05-18 17:19:15 +02:00
b712dbe5de Merge branch 'blender-v3.2-release' 2022-05-18 17:03:19 +02:00
c56103356f Fix incorrect track search area election color
It was following the pattern area selection color instead of its own.
2022-05-18 17:03:10 +02:00
2e70af5cd5 Fix T97761: incorrect mixing of integers
Sometimes integers are mixed using float weights. In those cases
the mixed result has to be converted from into float again.
Previously, this was done using a simple cast, which was unexpected
because e.g. 14.999 would be cast to 14 instead of 15.
Now, the values are rounded properly.

This can affect existing files unfortunately without a good option
for versioning. Gladly, very few files seem to depend on the details
of the old behavior.

Differential Revision: https://developer.blender.org/D14892
2022-05-18 17:00:38 +02:00
342e12d6d9 Subdiv: support interpolating orco coordinates in subdivision surfaces
This makes changes to the opensubdiv module to support additional vertex data
besides the vertex position, that is smootly interpolated the same way. This is
different than varying data which is interpolated linearly.

Fixes T96596: wrong generated texture coordinates with GPU subdivision. In that
bug lazy subdivision would not interpolate orcos.

Later on, this implementation can also be used to remove the modifier stack
mechanism where modifiers are evaluated a second time for orcos, which is messy
and inefficient. But that's a more risky change, this is just the part to fix
the bug in 3.2.

Differential Revision: https://developer.blender.org/D14973
2022-05-18 16:45:38 +02:00
f517b3a295 Fix T98157: improve animation fps with better check in depsgraph
Previously, the depsgraph assumed that every node tree might contain
a reference to a video. This resulted noticeable overhead when there
was no video.

Checking whether a node tree contained a video was relatively expensive
to do in the depsgraph. It is cheaper now due to the structure of the new
node tree updater.

This also adds an additional run-time field to `bNodeTree` (there are
quite a few already). We should move those to a separate run-time
struct, but not as part of a bug fix.

Differential Revision: https://developer.blender.org/D14957
2022-05-18 16:42:49 +02:00
708547ab06 Merge branch 'blender-v3.2-release' 2022-05-18 21:48:34 +10:00
136a06285f Fix T88792: WindowManager.clipboard missing in Python API docs
Support RNA types using the Py/C-API PyGetSetDef defined properties.
Currently `WindowManager.clipboard` is the only instance of this.
2022-05-18 21:43:38 +10:00
8fb2a61966 Cleanup: use "filepath" instead of "filename" for full paths, fileops.c
Handle separately as fileops.c had to be tested on multiple platforms.
2022-05-18 20:26:52 +10:00
f937c186de Fix build error on WIN32 from _bpy.context_members
As of [0] which references context arrays from the Python API,
C++ name mangling caused 'node_context_dir' not to be found for WIN32.

[0]: c8edc458d1
2022-05-18 19:40:23 +10:00
3cd3a4abe3 Merge branch 'blender-v3.2-release' 2022-05-18 10:43:17 +02:00
1fcdb1ea28 Fix (unreported) crash in some rare case when making liboverride.
If making liboverride of an empty collection, this (root of override
hierarchy) collection would get untagged in code when checking for
collections that do not need to be overridden, leading to not overriding
this root collection, and later in code to using NULL pointer.
2022-05-18 10:41:01 +02:00
e8e2bdaa86 Cleanup: Naming of private members 2022-05-18 10:25:58 +02:00
c9ae9e1483 Cleanup: suppress dangling-pointer warning for GCC 12.1+ 2022-05-18 18:06:56 +10:00
df8a9648e2 Cleanup: remove redundant sequencer name checks
The `seq->name + 2` check dates back to 2009 [0] but does nothing.

[0]: 6e0c1cd4e5
2022-05-18 17:53:45 +10:00
c536791f36 Cleanup: remove unused variables, redundant assignments 2022-05-18 17:53:45 +10:00
ba2c6c90fa Merge branch 'blender-v3.2-release' 2022-05-18 09:52:53 +02:00
a820ba0d36 Fix T98216: OpenEXR: No difference in file size between ZIP, DWAA, DWAB.
Check in code would not expect major version of OpenEXR > 2.

Investigated by Jesse Yurkovich (@deadpin), thanks!
2022-05-18 09:51:11 +02:00
418184d1c1 Cleanup: 'space between backslash and return' warning. 2022-05-18 09:41:20 +02:00
6f00b1500c LineArt: Use array instead of lists for edges pending occusion query
It turns out there's no practical use for separating different edge types
before final occlusion stage, also using an array should be faster overall.
So changed those lists into one pending array, it also made the
iteration and occlusion task scheduling simpler.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14951
2022-05-18 15:34:35 +08:00
9f8254fd34 LineArt: Remove LineartEdge::obindex.
After changing the duplicated edge removal method in D14903,
these two obindex variables are no longer needed.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14949
2022-05-18 15:34:35 +08:00
369f652c80 LineArt: Use safe lineart_discard_duplicated_edges
The old method doesn't check e for array boundary.
The new method ensures it only access valid elements.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14903
2022-05-18 15:34:35 +08:00
2719869a2a LineArt: Prioritize connecting chains from the same contour loop
This change allows the chaining function to select edges
from the same contour loop first, thus reduced rouge chain
connections (connected different objects instead of chaining
inside the same object first) and improved chaining quality.

This patch also included the default value change for chain
split threshold (Now don't split by default to make initial
result as smooth as possible)

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14950
2022-05-18 15:34:34 +08:00
c8edc458d1 PyDoc: support building full API docs on macOS & WIN32
Accessing context members depended on `ctypes` to access symbols
which were hidden for macOS & WIN32.

Add an API call that doesn't require the symbols to be exported.

This allows most symbols to be hidden on Linux, see D14971.
2022-05-18 17:06:03 +10:00
88fbe94d70 Merge branch 'blender-v3.2-release' 2022-05-18 15:34:39 +10:00
77f2cb1686 Fix T98192: Crash when apply transforms after deleting an object 2022-05-18 15:33:44 +10:00
5d1cab0c2f Merge branch 'blender-v3.2-release' 2022-05-18 14:42:55 +10:00
d7053ba030 Fix T98191: Alt-LMB for node detach fails with RMB select
Regression caused by [0] which changed node selection to use
PRESS for selection and CLICK_DRAG to transform the selection.

This conflicted with Alt-LMB which would select the node then
pass-though to node.background_sample, preventing the drag event
from being activated.

Resolve by only activating background-sample when the cursor
isn't over a node or socket.

[0]: 4c3e91e5f5
2022-05-18 14:39:48 +10:00
0af772ef8a Merge branch 'blender-v3.2-release' 2022-05-18 12:19:02 +10:00
ffbeb34f5f Cleanup: format 2022-05-18 12:17:42 +10:00
c38187393a Fix T98214: UV selection crash with wire edges
Regression in ffaaa0bcbf
which removed the NULL pointer check.
2022-05-18 12:15:56 +10:00
ebb492a389 Python: log the status of '--python-use-system-env' on initialization
Report when the PYTHONPATH is expected to be used to help debug Python
initialization issues (see T98131).
2022-05-18 11:37:53 +10:00
df26f4f63a Merge branch 'blender-v3.2-release' 2022-05-17 21:23:55 +02:00
35e73aa347 Fix T98021: Crash when using scene strip as sequencer input
Issue was caused by treating such strip as meta and using
`seq->channels` directly, which is not valid for scene strips.

Pointer to channels is now provided by function
`SEQ_get_seqbase_from_sequence`.
2022-05-17 21:22:21 +02:00
Olivier Maury
b48adbc9d7 Fix T97921: Cycles MNEE issue with light path nodes
Ensure the correct total/diffuse/transmission depth is set when evaluating
shaders for MNEE, consistent with regular light shader evaluation.

Differential Revision: https://developer.blender.org/D14902
2022-05-17 21:07:49 +02:00
b3b5d4cabb Merge branch 'blender-v3.2-release' 2022-05-17 17:34:51 +02:00
83349294b1 Fix T98201: Corrution of filepaths in some case during 'make relative' process.
We need to ensure `Main.filepath` is consistent with the current path
where we are saving the .blend file, otherwise some path processing code
can produce invalid results (happens with e.g. the code syncing the two
path storages in Library IDs).
2022-05-17 17:32:23 +02:00
8fdd3aad9b Fix T98163: Cycles OSL rendering normal maps differently
Match SVM and ensure valid reflection when setting up BSDFs.
2022-05-17 16:46:37 +02:00
0609b4bb49 Fix T98052: Eevee / Workbench background render crash with GPU subdivision
The problem is that depsgraph evaluation happens before the OpenGL context
is initialized, and so modifier evaluation happens without GPU subdivision.
Later the BKE_subsurf_modifier_can_do_gpu_subdiv test in the draw code gives
a different result.

This just checks if the mesh has information for GPU subdivision in the draw
code, and if so uses it. This is only set if the test for supported GPU
subdivision passes in the modifier evaluation.

Additionally it may be good to perform OpenGL context initialization earlier
so background render can take advantage of GPU subdivision, but this is more
complicated.

Differential Revision: https://developer.blender.org/D14969
2022-05-17 16:14:15 +02:00
8c9805fc62 Revert "Outliner: Remove the 'Remap data-block usages' operation."
This reverts commit 30534deced.

After discussion and feedback from users, it's better to keep this tool
available until there is time to properly re-think the whole Outliner's
contextual menu.
2022-05-17 16:09:28 +02:00
939c2387a1 Cleanup: blendloader: add logger to writefile.c, remove some asserts.
Properly use CLOG to report info or errors in `writefile.c`, instead of
printf's.

And remove some assert when logging error reports and the issue is not
critical.
2022-05-17 16:06:54 +02:00
b759a3eac0 Cleanup: Remove asserts when logging error messages.
If we produce CLOG_ERROR messages and the error is not actually
critical, there is no point in asserting too.

Mainly related to ID user counts, and a few other ID management areas.
2022-05-17 16:06:54 +02:00
7a31229011 Cleanup: Use BLI_assert_unreachable() as example in comment of _BLI_assert_abort.
Using `BLI_assert(0)` should typically be avoided now that we have
`BLI_assert_unreachable`...
2022-05-17 16:06:54 +02:00
fb2ae6b8c5 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
9a4cb7a732 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
6d42cd8ff9 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
22bf263269 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
c6e3242e18 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
ff2d6c2ba8 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
c8b740cc00 Merge branch 'blender-v3.2-release' 2022-05-17 16:06:27 +02:00
Aleš Jelovčan
dbc439e41a Fix unreported: GPencil Time offset modifier Reverse only plays 2 times
This patch fixes long standing issue of reverse mode only performing loop 2 times and then stops displaying.

Differential revision: https://developer.blender.org/D14921
2022-05-17 15:59:11 +02:00
dbb6016e94 Cleanup: fix compiler warning 2022-05-17 15:36:22 +02:00
200e63b0bf Fix: Copy and paste error in curves RNA
Use a similar solution for meshes for curves symmetry updating.
2022-05-17 14:59:31 +02:00
ed62b65474 Cleanup: Use const in curves sculpt code
This makes it much clearer what data is supposed to be modified
and what data is just used to influence the operation. The new
`BKE_paint_brush_for_read` function isn't great design, but it
can be removed or renamed if similar changes are applied to
more places.

Also pass pointers explicitly to `sample_curves_3d_brush` rather
than reusing the `bContext`. This makes it clearer what data the
function actually needs.

Differential Revision: https://developer.blender.org/D14967
2022-05-17 13:06:14 +02:00
3ad5510427 Cleanup: Order return arguments last 2022-05-17 13:02:41 +02:00
af6765a49c EEVEE-Next: Fix missing break in switch statement 2022-05-17 12:49:00 +02:00
3ccdc362da EEVEE-Next: Add camera module 2022-05-17 12:39:02 +02:00
46114f0a36 DRW: Add DRW_view_camtexco_get() 2022-05-17 12:34:35 +02:00
c7033bdf26 DRWWrapper: Add StorageFlexibleBuffer
This buffer resizes on access.
2022-05-17 12:34:35 +02:00
65fa34f63f DRW: Add SwapChain container to allow easier usage of double buffering
The template also takes the length of the chain to allow triple buffering.
2022-05-17 12:34:35 +02:00
f9ed31b15d Merge branch 'blender-v3.2-release' 2022-05-17 11:31:59 +02:00
4301b6c896 Fix console errors about missing properties in circle select
A regression since 113b8030ce: circle selection operators does not
define properties like deselect_all and a special name callback is to
be used for those.

This is what was already done for circle select in the 3D viewport.
Some other spaces were using the generic pick operator for the circle
selection which causes error prints in the console.
2022-05-17 11:23:04 +02:00
f752eaadbd Remove incorrect poll method from object.instance_offset_from_cursor
Remove poll method from the `OBJECT_OT_instance_offset_from_cursor`
operator. It was checking for `context.active_object`, but not even doing
anything with the active object. It'll get in the way of exposing this
operator in another area of the interface, though.
2022-05-17 11:00:04 +02:00
c582a2dbd9 Merge branch 'blender-v3.2-release' 2022-05-17 18:12:41 +10:00
eddfa811da Preferences: Moved Sculpt texture paint to prototypes.
Sculpt texture paint should not be considered as a new feature just yet. There
are many designs still missing that could drive changes.
2022-05-17 10:12:22 +02:00
bdb5a50682 Update tests to account for Text.as_string not adding a trailing newline
Regression in tests from [0] tests were written to assume a newline was
added to the result of Text.as_string which is no longer the case.

[0]: f4ff36431c
2022-05-17 18:11:16 +10:00
080e506e28 Merge branch 'blender-v3.2-release' 2022-05-17 17:50:50 +10:00
fcc3a68cac Merge branch 'blender-v3.2-release' 2022-05-17 17:50:45 +10:00
a4ed0f51c1 Fix click detection for simulated events
Refactoring event click-drag detection broke click detection for
simulated events. Resolve this by sharing logic for update previous
values in `wmWindow.eventstate` for regular event handling
(no functional changes for non-simulated events). Failure to detect
clicks for simulated events broke the undo test
`test_undo.view3d_multi_mode_select` in `../lib/tests/ui_simulate/run.py`.
All undo tests now pass.
2022-05-17 17:49:40 +10:00
f4ff36431c Fix text.as_string() adding a trailing new-line
Moving Text.as_string() from Python to C [0] added an extra new-line
causing a round-trip from_string/to_string to add a new-line,
this also broke the undo test `test_undo.text_editor_simple` in
`../lib/tests/ui_simulate/run.py`.

[0]: 231eac160e
2022-05-17 17:49:32 +10:00
f11401d32a Cleanup: Deduplicate Alembic procedural bounding box mesh creation
This removes the manual construction of a box mesh in the mesh sequence
cache modifier when the Alembic procedural is enabled. It also removes
the use of `BKE_object_boundbox_get` which doesn't make sense on a
non-evaluated object.

Differential Revision: https://developer.blender.org/D14958
2022-05-17 09:41:32 +02:00
51195c17ac Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-17 00:30:54 -07:00
210d0f1b80 Fix T96414: Stencil mapping is incorrect for UDIMs
When texture painting, brush textures and brush texture masks were not
transformed to account for UDIM tiles.

Differential Revision: https://developer.blender.org/D14671
2022-05-17 00:27:23 -07:00
c93f3b4596 Cleanup: spelling in comments 2022-05-17 15:34:02 +10:00
1a740c2541 Fix T98185: Assertion saving while fullscreen
When saving from the menu the region was not set,
causing the last region in `area->regionbase` to be used
as the region was assigned before comparison.
2022-05-17 15:16:54 +10:00
48c4c409b8 Fix DPX/CINEON writing full file paths into image headers on WIN32
Use back-slashes to find the file-name component on windows.
2022-05-17 12:54:05 +10:00
5c9ab3e003 Cleanup: use term 'filepath' for full file paths 2022-05-17 12:54:05 +10:00
77ddcc4717 ImBuf: replace exit(1) with assert when writing IRIS images
In this case memory past the buffer bounds would have been written,
potentially crashing. Replace the check with an assert since this
should never happen.

Also don't call exit as failing to write a file shouldn't exit Blender.
2022-05-17 10:50:21 +10:00
7bbf101082 Cleanup: better doc-string for iris, order args & use const variables 2022-05-17 10:43:40 +10:00
1660eff1a2 Cleanup: format 2022-05-17 10:06:13 +10:00
405d32bc80 Cleanup: compiler warnings 2022-05-17 10:01:30 +10:00
8c4bd02b06 VSE: Delete Strip and Scene Data in one step
Actually, delete the strip only deletes the container, but not the linked data. This patch adds the option to delete the scene also. This is very handy for storyboarding.

Reviewed By: ISS

Maniphest Tasks: T97683

Differential Revision: https://developer.blender.org/D14794
2022-05-16 20:20:44 +02:00
be84fe4ce1 VSE: Add new Scene and Strip
This operator allows to add a new scene at the same time that the strip. This is very handy for storyboarding.

Reviewed By: ISS

Maniphest Tasks: T97678

Differential Revision: https://developer.blender.org/D14790
2022-05-16 19:46:20 +02:00
205c6d8d08 VSE: New Change Scene option in Change menu
This is a new option in `C` key menu.

Reviewed By: mendio, ISS

Maniphest Tasks: T97711

Differential Revision: https://developer.blender.org/D14807
2022-05-16 19:41:50 +02:00
6065fbb543 Fix std::optional value() build error on older macOS SDK
No longer happens on the buildbot, but for users building with an older
Xcode, still need to avoid using value().

Differential Revision: https://developer.blender.org/D14883
2022-05-16 19:08:08 +02:00
4be79da9a7 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-16 18:17:37 +02:00
a2dacefb46 Fix T96289: Crash when accessing mesh via ob.data in a driver
Fix a crash when a driver variable targets an object and uses
`data.shape_keys.key["name"].value` in its expression.

The fix consists of adding an extra relation from the targeted object's
`GEOMETRY` component to the driver evaluation. This ensures that its
`data` pointer has been evaluated by the depsgraph and is safe to
follow.

This also resolves the concern raised on rB56407432a6aa.

Reviewed by: brecht

Differential Revision: https://developer.blender.org/D14956
2022-05-16 18:16:18 +02:00
00af3e9472 Fix: Node editor "Group" panel displays for embedded node trees
Embedded node trees are not groups, since their inputs and outputs
are not exposed anywhere. So these panels should not be displayed.
2022-05-16 17:17:16 +02:00
b8c30fb80a Fix image saving incorrectly overrding non-color data color space
In such cases we should not automatically change the color space.
2022-05-16 17:04:09 +02:00
c729ddd741 LibOverride: Do not write Surface Deform modifier binding data.
Skip writing binding data and similar for override modifiers already
present in reference linked data, as this can use a lot of space, and
is fully useless data typically since we already skip writing Mesh
geometry data itself.

Ref. T97967.
2022-05-16 16:56:27 +02:00
5973950b2a LibOverride: Do not write Laplacian Deform modifier binding data.
Skip writing binding data and similar for override modifiers already
present in reference linked data, as this can use a lot of space, and
is fully useless data typically since we already skip writing Mesh
geometry data itself.

Ref. T97967.
2022-05-16 16:56:27 +02:00
e9d7c05754 LibOverride: Do not write Corrective Smooth modifier binding data.
Skip writing binding data and similar for override modifiers already
present in reference linked data, as this can use a lot of space, and
is fully useless data typically since we already skip writing Mesh
geometry data itself.

Ref. T97967.
2022-05-16 16:56:27 +02:00
b66368f3fd LibOverride: Do not write MeshDeform modifier binding data.
Skip writing binding data and similar for override modifiers already
present in reference linked data, as this can use a lot of space, and
is fully useless data typically since we already skip writing Mesh
geometry data itself.

Ref. T97967.
2022-05-16 16:56:27 +02:00
Bastien Montagne
68d203af0b Refactor modifiers writing code.
This changes is needed to give more control to modifiers' writing
callback when defined. It will allow to implement better culling of
needless data when writing e.g. modifiers from library overrides.

Ref. T97967.

Reviewed By: brecht, JacquesLucke

Differential Revision: https://developer.blender.org/D14939
2022-05-16 16:56:27 +02:00
Martijn Versteegh
f1beb3b3f6 Cleanup: make functions for setting active/render layer more consistent
The active/render layer is indexed from the first layer of that type. These functions
incorrectly subtracted the layer index of *each* layer, instead of the first one.
If there's only a single layer this doesn't matter, but when there are multiple layers
it will set the wrong active layer for consecutive layers.

I'm not aware of any actual errors caused by this, because the active and render layers are
only ever queried from the first layer of that type, but it was confusing during debugging a
related issue. This patch makes the behavior of CustomData_set_layer_active_index()
consistent with CustomData_set_layer_active() and the same for render.

Differential Revision: https://developer.blender.org/D14955
2022-05-16 16:34:25 +02:00
b98175008f Cleanup: Tracking, clarify comment 2022-05-16 15:52:54 +02:00
Jeroen Bakker
00eb7594b1 3D Texturing: Undo.
Blender can only support a single undo system per undo step. As sculpting/vertex colors are mutual exclusive operations
out approach is just to switch the undo system when painting on an image.

PBVHNodes contain a list of areas that needs to be pushed to the undo system.

Currently the undo code is in sculpt_paint_image. We should eventually support undo for color filtering and other nodes.
we might need to place it to its own compile unit so more brushes can invoke the same code.

{F13048942}

Reviewed By: brecht

Maniphest Tasks: T97479

Differential Revision: https://developer.blender.org/D14821
2022-05-16 15:42:54 +02:00
0d80c4a2a6 Merge branch 'blender-v3.2-release' 2022-05-16 15:39:34 +02:00
9bd905e73f GPencil: Refine Tooltip for Noise modifier
Feedback by @HooglyBoogly
2022-05-16 15:38:26 +02:00
9df91654dc Fix T98136: Crash undoing "Make Library Override" in some cases.
The 'OVERRIDE_HIDDEN' extra collection would often be mistakenly added
to a linked collection, which is totally forbidden and guaranteed to
crash on undo/redo.

Reworked the code instantiating that extra collection in a more generic
and hopefully robust way now.
2022-05-16 15:37:07 +02:00
f1c27b383b Merge branch 'blender-v3.2-release' 2022-05-16 15:21:27 +02:00
29a3f43da5 Python API: make Image.save and Image.save_render more consistent with operator
Previously these only supported a subset of what the save operator could do,
for example no multilayer or stereo saving, no proper color management. Now
share code with the image save operator so it's more consistent.
2022-05-16 15:20:23 +02:00
Olivier Maury
48754bc146 Fix T97867: Cycles MNEE blocky artefacts for rough refractive interfaces
Made tangent frame consistent across the surface regardless of the sample,
which was not the case with the previous algorithm. Previously, a tangent
frame would stay consistent for the same sample throughout the walk, but not
from sample to sample for the same triangle. This actually resulted in code
simplification.

Also includes additional fixes:

* Fixed an important bug that manifested itself with multiple lights in the
  scene, where caustics had abnormally low amplitude: The final light pdf did
  not include the light distribution pdf.
* Removed unnecessary orthonormal basis generation function, using cycles'
  native one instead.
* Increased solver max iteration back to 64: It turns out we sometimes need
  these extra iterations in cases where projection back to the surface takes
  many steps. The effective solver iteration count, the most expensive part,
  is actually much less than the raw iteration count.

Differential Revision: https://developer.blender.org/D14931
2022-05-16 15:11:54 +02:00
adf183eeae Fix T98153: bpy.ops.image.save_as not working from Python, after recent changes
Make exec and invoke consistent so they both use operator properties if set.
2022-05-16 13:29:22 +02:00
93bcfd19ba Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-16 13:05:57 +02:00
8c24e29338 Fix broken unit test bl_rigging_symmetrize
Fix parameters used in `self.assertAlmostEqual()` call; the code was
passing the error message to the `places` parameter.
2022-05-16 13:03:06 +02:00
cef36f4a95 Cleanup: Remove confirmation poopup from 'make override' 3DView operator.
Inherited from older versions of the code, not needed anymore in most
common cases (like making override from a local empty instantiating a
collection, or if the active object is directly overridable).
2022-05-16 12:24:42 +02:00
717c150eb1 Merge branch 'blender-v3.2-release' 2022-05-16 11:01:01 +02:00
2397287a51 Fix T96503: Assert using PropertyGroup and PointerProperty prop in Panel.
Wrong assert introduced in {rBad63d2f60e24}, added comment in code
explaining why NULL RNA pointer is a valid value to be skipped here.
2022-05-16 10:58:51 +02:00
124aae91e2 Cleanup: shadowing warning 2022-05-16 12:10:38 +10:00
7fc2804f45 Fix: Build error on Windows after recent cleanup 2022-05-15 21:59:10 +02:00
84a7641563 Cleanup: Simplify loop syntax, make function static
Use range based for loops, spans, references, and slice.
Change split from D14685, in order to simplify refactor
to the mesh hide masks.
2022-05-15 20:59:08 +02:00
1c70402c62 Cleanup: Move three mesh editors files to C++
Simplifies refactoring in D14685, allows use of better data structures.
2022-05-15 20:41:11 +02:00
7b091fbb94 Cleanup: Remove includes from DerivedMesh header
Headers should only include other headers when absolutely necessary,
to avoid unnecessary dependencies and increasing compile times.
To make this change simpler, three DerivedMesh functions with a single
use were removed.
2022-05-15 20:27:28 +02:00
024f3ddf61 Cleanup: Clang tidy 2022-05-15 19:33:37 +02:00
ee0c05e886 DRW: Remove accidentaly commited stray global variable 2022-05-15 19:24:10 +02:00
b8de9916ed Fix T98049: crash rendering multilayer EXR with some color spaces 2022-05-15 17:47:20 +02:00
e46a38942a Cleanup: Simplify loop syntax, decrease variable scope
Mostly changes split from D14685, which refactors the hide flags.
2022-05-15 15:41:46 +02:00
3e989e8c8d GPUVertBuf: Add support for binding as buffer texture
This is often needed and somehow cumbersome to set up. This will allow some
code simplifications.
2022-05-15 15:22:47 +02:00
b44cec0eca Cleanup: Remove unused DerivedMesh function 2022-05-15 12:20:13 +02:00
450a190095 Cleanup: Remove unused subsurf ccg functions
This simplifies some refactoring to mesh hide flags (see D14685).
2022-05-15 12:12:14 +02:00
901fc29df1 Cleanup: Fix compile warnings on windows 2022-05-15 11:46:38 +02:00
dcaaa5b6f4 Merge branch 'blender-v3.2-release' 2022-05-15 01:46:42 -07:00
b54abd7ede Fix T80174: Dyntopo not initializing face set values correctly
BMLog was zeroing face sets when creating new faces,
which is not valid.  They're now set to 1.
2022-05-15 01:44:09 -07:00
a46f34d9b3 Merge branch 'blender-v3.2-release' 2022-05-15 00:36:42 -07:00
f9751889df Fix T81715: Unprojected radius mode messes up sculpt texture radius
We really need to fix how unprojected radius (scene unit) works.
What happened is the paint code updates the brush's normal radius
with the current unprojected pixel radius, which was then
used by texture brush tiled mode.

To fix this I just cached the pixel radius at stroke start in
UnifiedPaintSettings->start_pixel_radius.
2022-05-15 00:33:22 -07:00
139a4b6a84 Fix: Build error due to previous commit 2022-05-14 19:46:56 +02:00
ea5bfedb49 Cleanup: Further use of const for retrieved custom data layers
Similar to cf69652618.
2022-05-14 18:57:52 +02:00
e1c8ef551f Cleanup: Use const arguments 2022-05-13 19:20:55 +02:00
c2bbd01b2f Cleanup: Use const arguments 2022-05-13 19:13:43 +02:00
7c9b6cc380 LineArt: Better behavior of smooth tolerance.
This fixes the smooth tolerance feature in master where sometimes you could
get over simplified chains and lose the shape it's supposed to be originally.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14929
2022-05-14 00:56:09 +08:00
ee363ee7b3 Cleanup: Use standard variable names for curves 2022-05-13 18:44:09 +02:00
cf69652618 Cleanup: Use const when retrieving custom data layers
Knowing when layers are retrieved for write access will be essential
when adding proper copy-on-write support. This commit makes that
clearer by adding `const` where the retrieved data is not modified.

Ref T95842
2022-05-13 18:35:22 +02:00
fa7224d8ed Merge branch 'blender-v3.2-release' 2022-05-13 18:07:31 +02:00
074c695a0d Fix T98072: Regression: When appending a Scene, the Collections that are excluded get instanced into Current Scene.
This was due to using `BKE_scene_has_object` function, which uses the
cache of bases of the viewlayers, which do not have entries for the
content of excluded collections... Now use
`BKE_collection_has_object_recursive` instead.
2022-05-13 18:05:44 +02:00
870ad7d05d Fix T96781: LineArt proper object iterator.
This patch get rid of the _incorrectly used_ DG iterator in object loading,
and uses scene objects iteration to prevent problems.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14907
2022-05-14 00:04:16 +08:00
ca2fb9bae9 Fix possible null-pointer dererence for active button data
The button returned from `UI_region_active_but_get()` is not guaranteed
to have active button data, so code can't rely on that.
2022-05-13 17:56:28 +02:00
8e717ce55a Fix crash when displaying some button tooltips
Steps to reproduce were:
- Factory startup
- Right-click in 3D View
- Move the mouse over "Shade Flat", wait for the tooltip

The changed logic in 4680331749 to lookup an active button was
incorrect. It didn't respect the priority of active button candidates.
2022-05-13 17:56:18 +02:00
Brecht Van Lommel
5baa3ecda6 Color Management: various improvements and fixes for image saving
* Respect the image file color space setitng for saving in various cases where
  it was previously ignored. Previously it would often use the sRGB or Linear
  color space even when not selected.
* For the Save As operator, add a Color Space option in the file browser to
  choose the color space of the file. Previously this was chosen automatically,
  now it's possible to e.g. resave a Linear image as Linear ACES.
* When changing the file format, the colorspace is automatically changed to an
  appropriate color space for the file format. This already happened before, but
  there was no visibility or control in the operator settings for this.
* Don't change color space when using the Save operator to save over the same
  file.
* Fix missing color space conversion for 16 bit PNGs, where it assumed wrongly
  assumed ibuf->rect would be used for saving. Add BKE_image_format_is_byte to
  more accurately test this.

Fixes T74610

Ref T68926

Differential Revision: https://developer.blender.org/D14899
2022-05-13 17:55:54 +02:00
1e4cd98f0a Fix build error without unity build after recent changes
float3 should have been declared within the blender namespace. And forward
declaration is difficult with templated classes so just include header.
2022-05-13 17:55:54 +02:00
8d43ee1b08 Fix T97518: All buttons with eyedropper highlight if one is hovered
Issue is that the operator acts on the active button, and also uses that in the
poll. So the actually active button would affect the poll of a different
button. For the superimposed icons we need to be able to execute these polls
properly for non-active buttons.

This enables temporarily overriding the active button for lookups via context.
While a bit of a hack it makes sense conceptually.

Reviewed By: Campbell Barton

Maniphest Tasks: T97518

Differential Revision: https://developer.blender.org/D14880
2022-05-13 17:55:52 +02:00
7c9c13cf83 Fix possible null-pointer dererence for active button data
The button returned from `UI_region_active_but_get()` is not guaranteed
to have active button data, so code can't rely on that.
2022-05-13 17:54:12 +02:00
908e6c7c4d Fix crash when displaying some button tooltips
Steps to reproduce were:
- Factory startup
- Right-click in 3D View
- Move the mouse over "Shade Flat", wait for the tooltip

The changed logic in 4680331749 to lookup an active button was
incorrect. It didn't respect the priority of active button candidates.
2022-05-13 17:54:12 +02:00
3f952b3ca3 Merge branch 'blender-v3.2-release' 2022-05-13 17:35:18 +02:00
c2d2cd1468 Fix: Incorrect order in geometry nodes add menu 2022-05-13 17:34:11 +02:00
a0748153b4 Tracking: Move all selection logic to operator exec()
Unlikely that users will notice this, but this makes it so that
the operator behaves consistently across its exec() and invoke()
code paths.
2022-05-13 17:21:55 +02:00
a80ad0a545 Refactor: Use coordinate in API for track selection
Currently no functional changes. Prepares for a change which will
allow to more consistently redo the track selection operator.
2022-05-13 17:18:25 +02:00
4680331749 Fix T97518: All buttons with eyedropper highlight if one is hovered
Issue is that the operator acts on the active button, and also uses that in the
poll. So the actually active button would affect the poll of a different
button. For the superimposed icons we need to be able to execute these polls
properly for non-active buttons.

This enables temporarily overriding the active button for lookups via context.
While a bit of a hack it makes sense conceptually.

Reviewed By: Campbell Barton

Maniphest Tasks: T97518

Differential Revision: https://developer.blender.org/D14880
2022-05-13 15:55:11 +02:00
6f3d155293 Merge branch 'blender-v3.2-release' 2022-05-13 23:42:06 +10:00
05b56d55e8 Fix T97386: Node socket labels swallow click/drag events
Regression caused by [0] which made `ui_but_is_interactive` consider
label buttons with tool-tips to be interactive. This prevented
the clicks to pass through to the nodes for selecting/dragging.

Resolve this by allowing buttons to be activated for the purpose
of showing tool-tips but otherwise considering them disabled
(as if the UI_BUT_DISABLED is set when handling events).

[0]: 484a914647

Reviewed By: Severin

Ref D14932
2022-05-13 23:41:03 +10:00
d6c4317f35 Fix jump when switching accurate marker sliding
As a side effect the "sticky" search area on resize/move is also
resolved now: previously attempt to move search area past to where
it could be would make it hard to move it back. Now the search area
will always respond immediately to mouse motion, even after it got
clamped.
2022-05-13 14:12:01 +02:00
7533bee58b Cleanup: Remove dead code in tracking slide operator
The code was there prior pattern area affine transform and was never
used afterwards.

After so long time it should be safe to remove the unused code.
2022-05-13 14:12:01 +02:00
94ad77100c Merge branch 'blender-v3.2-release' 2022-05-13 12:55:24 +02:00
cbc024c3ca MacOS/AMD: Drawing artifacts in VSE.
Related to the partial revert done for T97272. It seems also that the
workaround should be enabled for any MACOS platform.
2022-05-13 12:54:41 +02:00
6e2270f3d3 Merge branch 'blender-v3.2-release' 2022-05-13 12:47:33 +02:00
e30ccb9a34 Fix crash toggling marker translate with marker offset
The shortcut is G-G.

Caused by loop argument "shadowing".
2022-05-13 12:39:40 +02:00
58555ccc7a Cleanup: format (with autopep8 line wrapping applied) 2022-05-13 19:22:52 +10:00
8741cf2038 Cleanup: Proper state check in marker slide operator
The previous code was had confusing logic, but since it was acting
more as a fall-back it did not cause bugs for users.
2022-05-13 10:42:28 +02:00
42d748be34 pyproject: re-enable line wrapping for autopep8
The problem noted in the configuration file no longer occurs,
re-enabling line wrapping (E501).
2022-05-13 18:05:07 +10:00
fa9e878e79 Fix T97330: UV points missing with some modifiers
When extracting UV point indices, only the vertex points coming from the
original geometry should be drawn. For this, the routines (for subdivision
and coarse meshes) would only consider a vertex to be real if the extraction
type is `MAPPED`, and that an origin index layer on the vertices exist
with a valid origin index for the current vertex.

However, if the extraction type is `MESH`, which can happen with for
example an empty Geometry Node modifier, or with deferred subdivision,
this would consider every vertex to not be "real" and therefore hidden from
the UV editor.

This reworks the condition for "realness" to also consider a vertex to be
real if there is no origin layer on the vertices. The check on the extraction
type is removed as it becomes redundant.

This only modifies the check in the UV data extraction for point indices,
however similar checks exist throughout the extraction code, these will
be dealt with separately in master.

Differential Revision: https://developer.blender.org/D14773
2022-05-13 09:26:34 +02:00
0d1b9eabf2 Merge branch 'blender-v3.2-release' 2022-05-13 16:14:29 +10:00
3e5cb7b23e Merge branch 'blender-v3.2-release' 2022-05-13 16:14:26 +10:00
b3938d2a36 Merge branch 'blender-v3.2-release' 2022-05-13 16:14:20 +10:00
113b8030ce Fix T89909: Circle Select tool status bar doesn't match the operations
Assign get_name functions for select picking and circle select
so modifier keys show the result of holding the modifiers.
2022-05-13 16:09:04 +10:00
470cbad51a Fix T97872: Annotation lines lost AA
Since rB2a7a01b339ad, `lineSmooth` has lost its default value of true.

rBa0a99fb25284 only fixed the problem on master.

But thanks to @hitrpr for spotting the bug in version 3.2 too.

Differential Revision: https://developer.blender.org/D14876
2022-05-12 22:22:27 -03:00
427a2c920a Cleanup: spelling in comments, capitalize tags
Also add missing task-ID reference & remove colon after \note as it
doesn't render properly in doxygen.
2022-05-13 09:29:25 +10:00
906b9f55af Cleanup: remove redundant float to byte conversion for stereo image saving
For non-stereo cases this is automatically handled by IMB_saveiff, no reason for
stereo to do this separately.

Ref D14899
2022-05-12 22:58:27 +02:00
c0df1cd1b3 Cleanup: remove redundant code and data copying image save as operator
Store ImageSaveOptions directly in operator custom data instead of copying
to/from a copy on the stack.

Ref D14899
2022-05-12 22:58:27 +02:00
1159b63a07 Cleanup: move image save options init to image_save.cc
The logic here is tightly coupled to the other image saving code.

Ref D14899
2022-05-12 22:58:27 +02:00
6044c6d09b Cleanup: remove unused function declaration 2022-05-12 22:58:27 +02:00
c09cfdb251 DRW: Fix Compilation on OSX
Caused by rBe4bb898e40ee
2022-05-12 22:10:59 +02:00
Jason Fielder
073139e329 Metal: MTLState module implementation.
MTLState module implementation and supporting functionality in MTLContext for state tracking, texture binding and sampler state caching.

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14827
2022-05-12 20:50:11 +02:00
992ae3f282 DRW: Port draw_shader to C++ 2022-05-12 20:40:23 +02:00
e4bb898e40 DRW: Port draw_hair to C++ 2022-05-12 20:40:23 +02:00
f3f7f8b37b Cleanup: Remove unused gpu_shader_geometry.glsl 2022-05-12 20:40:23 +02:00
17fc8db104 UI: Tweak Sculpting Trim icons
Update the trim icons so they don't show a dashed line. Instead they
have now a continuous red line.

This is important because the sculpting tools are planning to use the
same icons for selection as the regular tools. And those icons use
dashed line to represent selection.

Note the icon file has two new icons which are not used at the moment
(they are in the Unused collection):

* ops.generic.select_paint
* ops.generic.select_line
2022-05-12 18:55:09 +02:00
018acc5688 Build: patch USD to avoid using rdtscp instruction not available on older CPUs
Disable the new more accurate timing code, this is not needed for Blender.
In USD itself this code is disabled on macOS anyway, so it should operate fine
without it.

Ref T97950, T95206

Differential Revision: https://developer.blender.org/D14928
2022-05-12 18:38:51 +02:00
c5b67975cd Cleanup: Fix range loop construct warning 2022-05-12 17:51:03 +02:00
d634194cac Merge branch 'blender-v3.2-release' 2022-05-12 17:45:46 +02:00
2c784f44cf Cleanup: use proper naming in Warp modifier read/write code. 2022-05-12 17:45:16 +02:00
766340856d UI Code Quality: Use derived struct for hot-key buttons
`uiBut` contained a variable that was only used for these hot-key
buttons. This may also help getting rid of the `UI_BUT_IMMEDIATE` flag,
which is also only used for this button type. We are running out of
available bits for flags, so this would be useful.

Continuing the work from 49f088e2d0. Part of T74432.
2022-05-12 17:41:26 +02:00
d1f32b63eb Merge branch 'blender-v3.2-release' 2022-05-12 17:27:18 +02:00
32fd85e6f9 Fix (unreported) bad memory access in read/write code of MeshDeform modifier.
This abuse of one one size value to handle another allocated array of a
different size is bad in itself, but at least now read/write code of
this modifier should not risk invalid memory access anymore.

NOTE: invalid memory access would in practice only happen in case endian
switch would be performed at read time I think (those switches only check
for given length being non-zero, not for a NULL data pointer...).
2022-05-12 17:24:30 +02:00
b24f204e91 Cleanup: Clarify function name and comment logic
This is a bit tricky exceptional case, which originates to an original
motion tracking commit. Took a while to remember what it is ab out so
here is a comment for the future developers.
2022-05-12 17:20:54 +02:00
ccd18691fc Cleanup: Remove another unused hotkey button definition function
See f2c7b56f0f.
2022-05-12 17:05:37 +02:00
f2c7b56f0f Cleanup: Remove unused hotkey button definition function
This isn't used, and I also see any use for it short-term.
2022-05-12 16:56:14 +02:00
3693e1d8e8 Revert commits to increase button flag bitfield size
This reverts the commits 8d9d5da137,
59cd616534 and
98a04ed452.

The commits are causing issues with MSVC, see D14926. I'm working on a
different solution, but that will need some work.
2022-05-12 16:56:14 +02:00
Martijn Versteegh
c31f519954 CMake: Fix missing dependency in bf_editor_curves
curves_ops.cc uses RNA_Prototypes.h. so bf_rna
needs to build before bf_editor_curves.
2022-05-12 08:42:19 -06:00
d9effc1cc6 Fix T98071: Overlay: UV selection inverted bewteen vertex and edge select
Self describing title.

Also remove the layout inside the geometry shader as they are now generated
by the backend.
2022-05-12 15:11:07 +02:00
092cbacd8f Fix T98026 EEVEE: Refression Crash when rendering Cryptomatte passes
This was because the main `surface_vert.glsl` was changed to accomodate the
needs of the `ShaderCreateInfo` but was still used by the cryptomatte
shader. The fix is to include the same libraries as the material shaders
and bypass `attrib_load()`.
2022-05-12 13:58:14 +02:00
65d44093c9 Merge branch 'blender-v3.2-release' 2022-05-12 13:39:17 +02:00
2e8089b6bf Workaround for msvc compiler bug
https://developercommunity.visualstudio.com/t/Alias-template-inside-fold-expression-fa/10040507
2022-05-12 13:38:22 +02:00
dea5d22da1 Cleanup: remove warnings due to maybe-used variables
The variable was only used in some constexpr if-statements.
2022-05-12 13:03:12 +02:00
94a54ab554 Curves: add operator to convert hair particle system to new curves
This creates a new curves object with the name of the particle system.
The generated curves match the current evaluated state of the active hair
particle system.

Attachment information is not transferred currently.

Differential Revision: https://developer.blender.org/D14908
2022-05-12 12:55:50 +02:00
9757b4efb1 OBJ: improve new importer file parsing performance on windows
The OBJ parser was primarily using StringRef for convenience, with
functions like "skip whitespace" or "parse a number" taking an input
stringref, representing an input line, and returning a new stringref,
representing the remainder of the line. This is convenient, but does
more work than strictly needed -- while parsing, only the "beginning"
of the line ever changes by moving forward; the end of the line
always stays the same. We can change the code to take a pair of
pointers (begin of line, end of line) as input, and make the
functions return the new begin of line pointer. This makes the return
value neatly fit into a processor register, which StringRef did not.

On Windows, this does result in non-trivial speedups in the actual
OBJ file parsing part, due to Windows calling convention where return
values larger than 64 bits are returned via memory. Does not
measurably affect performance on Mac/Linux, because the calling
convention there uses a pair of 64-bit registers to return a
StringRef.

End-to-end times of importing several test files, on Windows
(VS2022 build, Ryzen 5950X):

- Monkey subdivided to level 6, no normals (220MB file): 1.25s -> 0.85s
- Rungholt minecraft level (270MB file): 7.0s -> 5.8s
- Blender 3 splash scene (2.4GB file): 49.1s -> 45.5s

The full import process has a lot of other overhead besides actual
OBJ file parsing (mostly creating actual blender objects out of
parsed data). In pure parsing, in the monkey test scene above, the
parsing part goes 1.0s -> 0.6s.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14936
2022-05-12 13:49:05 +03:00
f5077e057b Fix T97380 EEVEE: Weird motion-blur on curves
This was caused by the `mb_data->obmat[]` being wrong because they are
now shared between the particle system and the object.
But Hair need the dupli parent matrix instead of the object matrix.
Disabling `Show Emitter` option fixes the bug.

To avoid this problem, request a different `EEVEE_ObjectMotionData`
for particle systems using a different key pointer in the hash.
This is a bit dirty but there is less code polution using this workaround.

Differential Revision: https://developer.blender.org/D14911
2022-05-12 12:45:56 +02:00
207b0c2a0f Cleanup: De-duplicate region visibility logic in clip editor 2022-05-12 12:40:12 +02:00
dff11551de Merge branch 'blender-v3.2-release' 2022-05-12 20:13:16 +10:00
6f5d172d6c Fix error tagging vertices as loose in the screw modifier
Regression in 90a23dec46.
2022-05-12 20:12:36 +10:00
b04de6d180 Merge branch 'blender-v3.2-release' 2022-05-12 12:00:06 +02:00
77d3e6b439 Curves: Add notifier to update spreadsheet when sculpting 2022-05-12 11:58:11 +02:00
6dcda1b9aa Screw Modifier: avoid unnecessary normal calculation
Normals were being allocated, calculated & freed when the spin modified
merged was enabled.
2022-05-12 19:56:21 +10:00
89306a3a05 Cleanup: Use stronger typing in marker slide operator 2022-05-12 11:37:05 +02:00
87dd8dc740 Cleanup: Hide slide operator specific logic
Use a more semantically clear function in the tracking API.
2022-05-12 11:37:05 +02:00
993d17af90 Cleanup: Reduce indentation level in track slide operator 2022-05-12 11:37:05 +02:00
66dada123c Cleanup: Refactor marker area clamping
Switch from a single function with a lot of branching at its top level
to dedicated function calls with own documentation.
2022-05-12 11:37:05 +02:00
58fe38af9f Cleanup: Remove redundant marker clamping code path
Pattern is expected to be freely resized to any size, and the search
area s to become bigger when needed.

Remove confusing pattern size clamping which was actually clamping
search area.

There should be no functional changes.
2022-05-12 11:37:05 +02:00
a0e63bac02 Cleanup: Strong type for track path clear API
Replace a generic int value with an enum.

Should be no functional changes.
2022-05-12 11:37:05 +02:00
81f23ad57a Cleanup: Move tracking constants to be printable enums
Replace old-style define with an enumerator values. Also move to the
top of the file preparing for making those stronger typed.
2022-05-12 11:37:05 +02:00
ca5f832fe9 Cleanup: More proper sections in tracking code
Follows the code style
2022-05-12 11:37:05 +02:00
0c9892020b Cleanup: More proper sections in subdiv code
Follows the code style.
2022-05-12 11:37:05 +02:00
Ethan Hall
c21cc4dad5 Fix: Paint slot material assignment issues
There are two problems when adding a paint slot to an object without an
existing material. First, the `invoke` method creates a material on the
object. This modifies the object even if the operation is not executed.
Second, the fill color defaults to black when there is no existing
material (even when adding a normal, bump, or displacement layer).

This patch moves the material creation to the `exec` method.
When no material exists on the object, a default Principled BSDF is
referenced for default colors in the `invoke` method.

Differential Revision: https://developer.blender.org/D14828
2022-05-12 11:35:10 +02:00
9599c5415d Merge branch 'blender-v3.2-release' 2022-05-12 11:15:26 +02:00
cb5b33a627 Fix T98056: Screw modifier crash with normal calculation and merging
If merging is enabled, the mesh might be recreated before
the dirty flag can be cleared, which means the normals aren't
valid anymore. To fix this, clearing the dirty flag should happen
before the merging. This is an existing bug, just exposed by
more recent explicit dirty normal tagging.
2022-05-12 11:07:52 +02:00
31202ea628 Merge branch 'blender-v3.2-release' 2022-05-12 01:29:42 -07:00
0eb2244f0a color attributes: Fix broken vertex color node
Fall back onto the old behavior (use the render
color attribute) if the vertex color node's
attribute name is blank.
2022-05-12 01:29:13 -07:00
59637cf073 Merge branch 'blender-v3.2-release' 2022-05-12 17:50:11 +10:00
14175043e5 Merge branch 'blender-v3.2-release' 2022-05-12 17:50:05 +10:00
1242e8b93c Merge branch 'blender-v3.2-release' 2022-05-12 17:49:40 +10:00
295b6e8230 Fix T96367: Crash snapping to instances on an object
In rare cases the mesh has not been evaluated when snapping, this fix
just prevents the crash as is done elsewhere in Blender when the
evaluated mesh isn't available, there is a separate report (T96536)
about evaluation not working properly.
2022-05-12 17:42:43 +10:00
3b0a08b793 Cleanup: format 2022-05-12 14:07:15 +10:00
51fdf4bdfc Cleanup: discarded-qualifier warning, mixing enum/ints 2022-05-12 14:06:35 +10:00
578771ae4d UDIM: Add support for packing inside .blend files
This completes support for tiled texture packing on the Blender / Cycles
side of things.

Most of these changes fall into one of three categories:
- Updating Image handling code to pack/unpack tiled and multi-view images
- Updating Cycles to handle tiled textures through BlenderImageLoader
- Updating OSL to properly handle textures with multiple slots

Differential Revision: https://developer.blender.org/D14395
2022-05-11 20:11:44 -07:00
8d9d5da137 Cleanup (UI): Make space for more internal button flags
Having to manually increase all other flag values to be able to add a
new internal flag is quite annoying. Just make space for a few more
once.
Generally I'd say internal flags are preferable, since it increases
encapsulation. So good to avoid making this a hassle.
2022-05-11 18:29:20 +02:00
Loren Osborn
502e1a44b9 Cleanup: fix compiler warnings on macOS
Differential Revision: https://developer.blender.org/D14917
2022-05-11 18:03:26 +02:00
3e782bba71 Cleanup: Cycles, avoid 'parameter unused' warning
Avoid 'parameter unused' warning when building Cycles without
OpenImageDenoise.

No functional changes.

Over-the-shoulder reviewed by @sergey
2022-05-11 18:00:49 +02:00
007184bcf2 Enable inlining on Apple Silicon. Use new process-wide ShaderCache in order to safely re-enable binary archives
This patch is the same as D14763, but with a fix for unit test failures caused by ShaderCache fetch logic not working in the non-MetalRT case:

```
diff --git a/intern/cycles/device/metal/kernel.mm b/intern/cycles/device/metal/kernel.mm
index ad268ae7057..6aa1a56056e 100644
--- a/intern/cycles/device/metal/kernel.mm
+++ b/intern/cycles/device/metal/kernel.mm
@@ -203,9 +203,12 @@ bool kernel_has_intersection(DeviceKernel device_kernel)

   /* metalrt options */
   request.pipeline->use_metalrt = device->use_metalrt;
-  request.pipeline->metalrt_hair = device->kernel_features & KERNEL_FEATURE_HAIR;
-  request.pipeline->metalrt_hair_thick = device->kernel_features & KERNEL_FEATURE_HAIR_THICK;
-  request.pipeline->metalrt_pointcloud = device->kernel_features & KERNEL_FEATURE_POINTCLOUD;
+  request.pipeline->metalrt_hair = device->use_metalrt &&
+                                   (device->kernel_features & KERNEL_FEATURE_HAIR);
+  request.pipeline->metalrt_hair_thick = device->use_metalrt &&
+                                         (device->kernel_features & KERNEL_FEATURE_HAIR_THICK);
+  request.pipeline->metalrt_pointcloud = device->use_metalrt &&
+                                         (device->kernel_features & KERNEL_FEATURE_POINTCLOUD);

   {
     thread_scoped_lock lock(cache_mutex);
@@ -225,9 +228,9 @@ bool kernel_has_intersection(DeviceKernel device_kernel)

   /* metalrt options */
   bool use_metalrt = device->use_metalrt;
-  bool metalrt_hair = device->kernel_features & KERNEL_FEATURE_HAIR;
-  bool metalrt_hair_thick = device->kernel_features & KERNEL_FEATURE_HAIR_THICK;
-  bool metalrt_pointcloud = device->kernel_features & KERNEL_FEATURE_POINTCLOUD;
+  bool metalrt_hair = use_metalrt && (device->kernel_features & KERNEL_FEATURE_HAIR);
+  bool metalrt_hair_thick = use_metalrt && (device->kernel_features & KERNEL_FEATURE_HAIR_THICK);
+  bool metalrt_pointcloud = use_metalrt && (device->kernel_features & KERNEL_FEATURE_POINTCLOUD);

   MetalKernelPipeline *best_pipeline = nullptr;
   for (auto &pipeline : collection) {

```

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14923
2022-05-11 16:20:59 +01:00
59cd616534 UI: Update rest of UI code for increased button flag bitfield
Needed after 98a04ed452.
2022-05-11 17:07:02 +02:00
8d528241a9 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-11 16:53:29 +02:00
2001ee6251 Fix T95710: Make Single User > Object Data Animation broken
The operator now not only checks `ob->data` for Actions to duplicate,
but also passes `ob->data` to the duplication function (instead of `ob`).
2022-05-11 16:52:43 +02:00
fa114cc4a0 Merge branch 'blender-v3.2-release' 2022-05-11 16:49:37 +02:00
06a7afb528 Fix T97947: USD will fail to export without file extension
Now add a default ".usdc" file extension if no (or the wrong) extension
is given instead of presenting the user with the error that "no suitable
USD plugin to write is found".

This is in line with how other exporters do this.

Maniphest Tasks: T97947

Differential Revision: https://developer.blender.org/D14895
2022-05-11 16:45:20 +02:00
a4382badb9 Curves: Adjust sculpt mode UI layouts
This patch adjusts the UI layouts for the tool header and the tool
properties in sculpt mode in a few ways. The goals are to better group
related settings, keep fundamental settings easily accessible, fix the
availability of some options, and make better use of space.

1. Remove ID template in tool header
2. Rename "Add Amount" to "Count" for add brush
3. Add "use pressure" toggles to radius and strength sliders
4. Move strength falloff to a popover
5. Move many "Add" brush settings to popover called "Curve Shape"
6. Move two "Grow/Shrink" options to a popover called "Scaling"
7. Don't display "Falloff" panel in properties when it has no effect

See the differential revision for screenshots and more reasoning.

Differential Revision: https://developer.blender.org/D14922
2022-05-11 15:47:49 +02:00
6599d2f03b Fix: Crash with empty curves add interpolate points
The neighbors for an added curve can be empty.
In that case use the constant value instead of interpolating.
2022-05-11 15:40:49 +02:00
e354ba701a Fix T97330: GPU Subdiv compiler error.
GLSL has different max number of ssbo per glsl stage.
This patch checks if the number of compute ssbo blocks matches
our requirements for the GPU Subdiv, before enabling it.

Some platforms allow more ssbo bindings then blocks per stage.
2022-05-11 15:29:52 +02:00
3eb3d363e1 Fix: Build error on windows.
Issue introduced by rBeef98e66cf9e

BLI_math_rotation.h uses M_PI which
gets defined inside BLI_math_base.h
2022-05-11 07:28:48 -06:00
edd892166d Fix T97330: GPU Subdiv compiler error.
GLSL has different max number of ssbo per glsl stage.
This patch checks if the number of compute ssbo blocks matches
our requirements for the GPU Subdiv, before enabling it.

Some platforms allow more ssbo bindings then blocks per stage.
2022-05-11 15:22:01 +02:00
007e95c259 Merge branch 'blender-v3.2-release' 2022-05-11 15:15:45 +02:00
a3f9862262 Fix (unreported) crash in Outliner Overrides Properties view in invalid cases.
We cannot try to get RNA info when the rna path of an override property
is invalid.
2022-05-11 15:14:44 +02:00
87978ff560 Cleanup: rename BLI_str_format_attribute_domain_size
This is useful without any functionality specific to attribute domains,
rename to `BLI_str_format_decimal_unit` to follow naming of a similar
function `BLI_str_format_byte_unit`.
2022-05-11 22:53:02 +10:00
fbf92f5967 Merge branch 'blender-v3.2-release' 2022-05-11 14:03:44 +02:00
b9d02b9ced Fix T97895: Eevee support for Geometry Nodes Color Attributes.
Geometry nodes can generate color attributes that aren't on point or corner domain.
When not found in these domains it will be processed as a common attribute.
2022-05-11 14:01:47 +02:00
Pablo Vazquez
eef98e66cf Mesh: Add Auto Smooth option to Shade Smooth operator
Add a property to the **Shade Smooth** operator to quickly enable the Mesh `use_auto_smooth` option.

The `Angle` property is exposed in the **Adjust Last Operation** panel to make it easy to tweak on multiple objects without having to go to the Properties editor.

The operator is exposed in the `Object` menu and `Object Context Menu`.

=== Demo ===

{F13066173, size=full}

Regarding the implementation, there are multiple ways to go about this (like making a whole new operator altogether), but I think a property is the cleanest/simplest.

I imagine there are simpler ways to achieve this without duplicating the `use_auto_smooth` property in the operator itself (getting it from the Mesh props?), but I couldn't find other operators doing something similar.

Reviewed By: #modeling, mont29

Differential Revision: https://developer.blender.org/D14894
2022-05-11 13:21:59 +02:00
6bd270f3af Fix "Open Clip" operator in Clip Editor broken
Steps to reproduce were:
- Open Clip Editor
- Call "Open Clip" (e.g. Alt+O)
- Select video file

The file wouldn't be loaded into the Clip Editor.

Caused by 7849b56c3c.
2022-05-11 13:18:45 +02:00
8c233cfd78 Merge branch 'blender-v3.2-release' 2022-05-11 20:58:59 +10:00
5045968f24 Revert "Gizmo: optimize intersection tests, fix selection bias"
Manually revert commit [0] as it caused problems macOS (reported T96435).

- Includes fixes from [1] & [2].
- T98037 TODO has been created to keep track of this feature.

Thanks to @jbakker & @sergey for investigating this issue as I wasn't
able to reproduce the bug.

[0]: 0cb5eae9d0
[1]: cb986446e2
[2]: cc8fe1a1cb
2022-05-11 20:55:10 +10:00
61202f6f74 Merge branch 'blender-v3.2-release' 2022-05-11 12:48:23 +02:00
49173399f3 Fix T97173: Color Attributes shading turns black after switching mode.
Sculpt colors tagged the custom data as already created (cd_used), but
should have been tagged as being requested (cd_needed).
2022-05-11 12:44:04 +02:00
b765ea52af Cleanup: Use single quotes for Python enum string 2022-05-11 12:12:11 +02:00
2f799f893e Fix: Hide empty panel in curves sculpt mode tool settings
This panel is empty after rB5b24291be1e0
2022-05-11 12:10:40 +02:00
74a5fb734a Fix: Spline parameter node broken for Catmull Rom curves
Subtracting one from the evaluated index could make the index -1.
That was only necessary for Bezier curves due to the specifics of
the "bezier_evaluated_offsets".
2022-05-11 11:33:52 +02:00
30534deced Outliner: Remove the 'Remap data-block usages' operation.
This feature is very advanced, and the way it was exposed in the
Outliner was very confusing at best.

It remains available through the Python API (`ID.user_remap`) e.g.
2022-05-11 11:25:02 +02:00
2d9a6e4f68 Outliner: Remove 'rename library' feature.
This was historically the only way to change/fix paths of library files
in Blender. However, only changing the path then required a manual
reload of the library, which could be skipped by user, or a save/reload
of the working .blend file, which could lead to corruption of advanced
library usages like overrides.

Prefferred, modern way to change path of a library is to use the
Relocate operation instead. Direct path modification remains possible
through RNA (python console or the Data API view in the Outliner.
2022-05-11 11:25:02 +02:00
be9800e8da Update Ceres to latest upstream version 2.1.0
This release deprecated the Parameterization API and the new Manifolds
API is to be used instead. This is what was done in the Libmv as part
of this change.

Additionally, remove the bundling scripts. Nowadays those are only
leading to a duplicated work to maintain.

No measurable changes on user side is expected.
2022-05-11 09:33:45 +02:00
b30cb05c14 Cleanup: spelling in comments/strings
D14918 from @linux_dr with some other changes included.
2022-05-11 17:02:06 +10:00
Jun Mizutani
195986a719 Fix: Curves interpolate point count option missing from panels
Added in 8852191b77

Differential Revision: https://developer.blender.org/D14919
2022-05-11 08:56:26 +02:00
8650c2b614 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:39 +10:00
82a70ffe40 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:37 +10:00
c0546ff953 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:33 +10:00
0c5a7ca117 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:31 +10:00
ec53e9fa69 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:28 +10:00
ae683a22c6 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:25 +10:00
87d74d03bf Merge branch 'blender-v3.2-release' 2022-05-11 16:34:22 +10:00
8e476c414c Merge branch 'blender-v3.2-release' 2022-05-11 16:34:17 +10:00
690ecaae20 Fix T97153: Knife project crashes
Knife projection BVH-tree lookup could use invalid indices since the
mesh being cut is also used for BVH intersection tests.

Solve by storing triangle indices when knife project is used so a
triangle index can always be used to look up original coordinates of a
triangle.
2022-05-11 16:28:37 +10:00
067f0d40ae Fix knife tool use-after free on completion
Regression in [0] accessed knife data after it had been freed.

[0]: f87029f7b1
2022-05-11 16:28:37 +10:00
a652568570 Cleanup: use 'num' / 'size' suffix instead of 'sz'
GPU code used `sz` as an abbreviation for size, as well as a few other
places. Use size where this represents a size in bytes, see: T85728.
2022-05-11 13:40:09 +10:00
2fa2612b06 Cleanup: use '_num' / '_count' suffix instead of '_ct'
Use num & count (for counters), in drawing code, see: T85728.
2022-05-11 13:38:00 +10:00
42e275a7d4 Cleanup: use '_num' suffix, mostly for curves & spline code
Replace tot/amount & size with num, in keeping with T85728.
2022-05-11 13:38:00 +10:00
8f1a11c35a WM: clear wmEvent.flag for file-select events
Harmless but could cause file-select events to have WM_EVENT_IS_REPEAT
set which logged a warning as this is only intended for keyboard events.
2022-05-11 11:02:01 +10:00
17ab0342ac Cleanup: spelling in comments
Revert change from [0] that assumed UNORM was a mis-spelling of UNIFORM.

[0]: 2c75857f9f
2022-05-11 11:02:01 +10:00
0091c97b32 Cleanup: use '_num' suffix instead of '_size' for CurveGeometry
Follow conventions from T85728.
2022-05-11 11:02:01 +10:00
f9e0b94c2f Cleanup: format 2022-05-11 11:02:01 +10:00
baf8ec2e54 Cleanup: use doxy sections for node_edit.cc 2022-05-11 11:02:01 +10:00
046b45749c Fix cursor snap not acting on selected UVs
Regression in rBd2271cf939.
2022-05-10 21:22:16 -03:00
1bb7fda600 CMake: Fix noisy PUGIXML warning.
When doing a lite build, a warning is displayed
that due to PUGIXML being off WITH_CYCLES_OSL
is being disabled as well.

If WITH_CYCLES is off this is just useless
noise.

this diff changes the warning to only emit when
WITH_CYCLES is on.
2022-05-10 16:38:20 -06:00
b47c5505aa Fix T96892 Overlay: Hiding all of a mesh in edit mode causes visual glitch
This is caused by the geometry shader used by the edit mode line drawing.
If the drawcall uses indexed drawing and if the index buffer only contains
restart indices, it seems the result is 1 glitchy invocation of the
geometry shader.

Workaround by tagging these special case index buffers and bypassing
their drawcall.
2022-05-10 23:36:16 +02:00
74228e2cd2 Fix T97945: Cycles baking max distance is wrong
It was effectively sqrt(max_distance) before this fix.

Thanks to Omar Emara for identifying the solution.
2022-05-10 20:55:03 +02:00
81b797af66 Fix T97908: Cycles missing motion from on pointcloud generated by geometry nodes
Assume geometry is always potentially animated, since we can't use our heuristic
to detect if the object is potentially animated by looking at modifiers on the
object.

The main original reason for this check was to avoid evaluating subdivision
surfaces for many static objects, which is not happening here anyway.
2022-05-10 20:45:30 +02:00
28240f78ce UI: Geometry Nodes Icon
Geometry Nodes (new) icon. So far we were using the generic node-tree
icon for geometry nodes, not anymore.

The new icon is composed of 4 spheres that is a reference to the
original pebbles demo. Scattering points was also the turning point for
the project (which originally was focusing on dynamic effects), and to
this day is one of the first steps for everything procedural such as
hair.

Note that the modifier icon is still showing as white in the outliner.
The alternative is to be blue everywhere.

Patch review and feedback by Hans Goudey.

Icon creation in collaboration with Pablo Vazquez.
2022-05-10 19:33:49 +02:00
Mikhail Matrosov
dcce4a59a0 Fix T97966: Cycles shadow terminator offset wrong for scaled object instances
Differential Revision: https://developer.blender.org/D14893
2022-05-10 18:53:14 +02:00
Olivier Maury
dc55e095e6 Fix T97056: Cycles MNEE not working with glass and pure refraction BSDFs
Differential Revision: https://developer.blender.org/D14901
2022-05-10 18:51:02 +02:00
c171c99fa1 Fix part of T97895: Cycles not rendering edge domain attributes
These aren't really ideal for rendering, but better to show something. Edge
values are averaged at vertices.
2022-05-10 18:29:00 +02:00
8852191b77 Curves: Interpolate point count in add brush
This commit adds an option to interpolate the number of control points
in new curves based on the count in neighboring existing curves. The
idea is to provide a more automatic default than manually controlling
the number of points in a curve, so users don't have to think about
the resolution quite as much.

Internally, some utilities for creating new curves are extracted to a
new header file. These can be used for the various nodes and operators
that create new curves.

The top-bar UI will be adjusted in a separate patch, probably moving
all of the settings that affect the size and shape of the new curves
into a popover.

Differential Revision: https://developer.blender.org/D14877
2022-05-10 18:28:02 +02:00
6f7959f55f Merge branch 'blender-v3.2-release' 2022-05-10 19:12:02 +03:00
3bc037a7eb Fix T96399: New 3.1 OBJ exporter is missing Path Mode setting
New OBJ exporter is missing "Path Mode" setting for exporting .mtl
files. The options that used to be available were: Auto, Absolute,
Relative, Match, Strip Path, Copy. All of them are important. The new
behavior (without any UI option to control it) curiously does not match
any of the previous setting. New behavior is like "Relative, but to the
source blender file, and not the destination export file".

Most of the previous logic was only present in Python based code
(bpy_extras.io_utils.path_reference and friends). The bulk of this
commit is porting that to C++.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14906
2022-05-10 18:58:10 +03:00
9c2613d1b6 Merge branch 'blender-v3.2-release' 2022-05-10 17:57:41 +02:00
1dd1772419 LibOverride: Fix memory leak in resyncing code. 2022-05-10 17:43:01 +02:00
0134ab4b56 LibOverride: Fix bad ID getting hierarchy root updated.
Followup to rB6c679aca1770c37.
2022-05-10 17:42:00 +02:00
6c679aca17 LibOverride: Make process checking validity of hierarchy roots more robust.
Code was not really designed to hanlde corrupted (e.g. local ID) root
hierarchies, now it should handle better those invalid cases and restore
proper sane situation as best as possible.

Fixes crashes with some corrupted files from Blender studio.
2022-05-10 17:32:31 +02:00
cd349dc402 LineArt: Use thread safe bound box.
The old method is not thread safe, which will lead to minor
memory leaks. This patch fixed that.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14904
2022-05-10 22:01:07 +08:00
c60b570841 Remove debug code enabled in previous commit. 2022-05-10 15:54:59 +02:00
d9d81cb1ff 3d texture painting: Use center uv pixel as anchor.
Previously the bottom left of a pixel was used during pixel extraction what resulted in
that the pixels were moved a bit to the bottom left. By using the center uv pixel the
extracted pixels are more balanced and would improve future features like seam bleeding.
2022-05-10 15:52:28 +02:00
b4b85c5ce2 Merge branch 'blender-v3.2-release' 2022-05-10 23:04:37 +10:00
de71cdb35d Merge branch 'blender-v3.2-release' 2022-05-10 23:04:26 +10:00
4c3e91e5f5 Fix T96520 Node editor: Tweak fails with unselected nodes
Use the same method for node selection and dragging that is used
in the 3D viewport and UV editor. Instead of relying on a modal
operator - use the keymap to handle click/drag events.

Details:

Failure to transform unselected nodes was caused by [0] & [1] however
detecting drag relied on specific behavior which I don't think we should
be depending on.

This error happened when selection was defined both in the key-map for
the tool and for the node-editor.

- The left mouse button would activate selection in both the tool
  and "Node Editor" keymap.

- The first selection would return `FINISHED | PASS_THROUGH` when
  selecting a previously unselected node.

- The same PRESS would trigger a second selection would return
  `RUNNING_MODAL | PASS_THROUGH`,
  (starting a NODE_OT_select as a modal operator).

  - In 3.1 (with tweak events) the modal operator would then exit and
    fall-back to the tweak event which would transform the selected
    nodes.

  - In 3.2 (as of [0]) the PRESS that starts the modal operator is
    considered "handled" and prevents drag event from being detected.

The correct behavior in this case isn't obvious:
If a modal operator starts on pressing a button, using that same the
release to generate drag/click events is disputable.

Even in the case or 3.1 it was inconsistent as tweak events were
generated but click events weren't.

Note: after investigating this bug it turns out a similar issue already
existed in 2.91 and all releases afterwards. While the bug is more
obscure, it's also caused by the tweak event being interrupted as
described here, this commit resolves T81824 as well.

[0]: 4d0f846b93
[1]: 4986f71848

Reviewed By: Severin

Ref D14499
2022-05-10 23:01:56 +10:00
9173dd24ad Fix for crash opening the file selector multiple times
This is part of a fix for T88570, where the file selector would crash
when activated multiple times.

Calling save multiple times would free the operator, leaving a dangling
pointer which was used when panels were visible that accessed the
"active_operator".

Reviewed By: Severin

Ref D14905
2022-05-10 22:56:22 +10:00
502c3d6c21 Cleanup: remove non-existent include
guardedalloc was already included.
2022-05-10 22:56:03 +10:00
15021968c1 DrawManager: Hide lock acquire behind experimental feature.
The acquire locking of the draw manager introduced other issues.
The current implementation was a hacky solution as we know that the
final solution is something totally different {T98016}.

Related issues:
* {T97988}
* {T97600}
2022-05-10 14:31:20 +02:00
b38cd1bcbe Fix: Missing curves type count cache update in add brush 2022-05-10 14:27:36 +02:00
4ffeb2d449 DrawManager: Hide lock acquire behind experimental feature.
The acquire locking of the draw manager introduced other issues.
The current implementation was a hacky solution as we know that the
final solution is something totally different {T98016}.

Related issues:
* {T97988}
* {T97600}
2022-05-10 14:01:02 +02:00
3893ba5d67 Merge branch 'blender-v3.2-release' 2022-05-10 13:09:12 +02:00
7849b56c3c Fix T88570: Crash when saving after pressing ctrl+S twice.
Existing code to replace the file operation was failing when done from
the window for the file operation itself.

Basically, this patch does two things:
- Implement a well defined window context to use as the "owner" or
  "root" of the File Browser. This will be used for managing the File
  Browser and to execute the file operation, even after the File Browser
  was closed.
- Ensure the context is valid when dealing with file File Browser event
  handlers.

Previously the window context just wasn't well defined and just happened
to work well enough in most cases. Addressing this may unveil further
issues, see T88570#1355740.

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

Reviewed by: Campbell Barton
2022-05-10 12:36:43 +02:00
061995775f Fix T95298 ImageEditor: Multi-view images fail to display properly
This was because the shader had wrong output slot order.

This also add a note about why the order is reversed compared to the
texture binding.
2022-05-10 12:33:18 +02:00
a74a267767 Cleanup: Move mesh primitive cube to the geometry module
This allows easy reuse elsewhere in Blender.
2022-05-10 10:21:42 +02:00
77c0e79805 Merge branch 'blender-v3.2-release' 2022-05-10 10:01:10 +02:00
2a2e47b20c Curves: Add disabled message for add empty hair operator
Ref 2ba081f59b
2022-05-10 09:41:04 +02:00
439f86ac89 Fix T97272: Lag when resizing viewports.
Viewports where cleared explicitly due to compatibility reasons with Intel iGPUs.
This slowed down other platforms as well, this wasn't noticeable on all platforms.

This patch will be more selective when to enable the workaround.
Currently only for iGPUs on Mac + Linux.
2022-05-10 08:48:51 +02:00
08a39d32a9 Merge branch 'blender-v3.2-release' 2022-05-10 08:30:56 +02:00
11aa237858 Eevee: Fix GLSL compilation error.
Introduced by {35594f4b92fa4cbb5b848f447b7a3323e572b676}.
Some platforms do not support temp variables to be used as inout parameter.

Detected on Mac with Intel iGPU.
2022-05-10 08:30:21 +02:00
bc256a4507 Fix T50398: Constrain to Image Bounds failed with 2D cursor pivot
Use more robust logic for "Constrain to Image Bounds" when scaling UVs.

Reviewed By: campbellbarton

Ref D14882
2022-05-10 14:42:08 +10:00
501ec81d3e Merge branch 'blender-v3.2-release' 2022-05-09 19:52:27 -07:00
Ramil Roosileht
4bb90b8f4c D14887: Fix artifacts in hue filter
The hue color filter now wraps correctly.  Fixes T97768.

Reviewed By: Julien Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D14887
Ref D14887
2022-05-09 19:46:22 -07:00
ccb4e29873 Merge branch 'blender-v3.2-release' 2022-05-10 11:16:27 +10:00
e7464dffbc Merge branch 'blender-v3.2-release' 2022-05-10 11:16:23 +10:00
1c1e842879 Fix T86358: Use per face aspect correction for primitive UV projections
During UV unwrapping, Cube Projection, Sphere Projection, Cylinder
Projection and Project From View (in the 3D Viewport), when "Correct
Aspect" toggle is active, it now uses a query cache to perform a
per-face aspect ratio ("per_face_aspect") correction for the active
image of each face.

Reviewed By: campbellbarton

Ref D14852
2022-05-10 11:14:59 +10:00
a4c2060b91 Fix T97545 GPU: Crash caused by uncommented quote char in source string
Some drivers completely forbid quote characters even in unused
preprocessor directives.

This patch adds a debug build check for all `.glsl` files that need to
be manually handled. For shared headers with `#include` directives, we
need to do runtime patching of the source to remove the quote.

Also fix an instance of the quotes check failing in `eevee_next`.
2022-05-10 00:47:44 +02:00
b468255453 Cleanup: Return early 2022-05-09 23:59:28 +02:00
b6b94f878f Merge branch 'blender-v3.2-release' 2022-05-09 23:52:44 +02:00
7301547ca7 EEVEE: Fix missing CLOSURE_DEFAULT 2022-05-09 23:52:31 +02:00
35594f4b92 Fix T97985 EEVEE: Shader mixing not working correctly when reusing shader nodes
This was caused by the `Closure` members being added to the final contribution
more than once. The workaround is to clear the members once a closure has
been added to the final contribution. I used `inout` on `Closure` inputs
so that the render engine implementation of mix and add closure nodes
can do its own thing. The nodegraph handling of inout was changed for this
to work.
2022-05-09 23:52:31 +02:00
10865c8f34 Deps/CMake: Add missing dependencies for OCIO
OCIO could build before pystring and imath due to
OCIO missing the dependencies on these two projects

No rebuild required as the build would have failed
during the libs build if you ran into this issue.
2022-05-09 13:34:33 -06:00
6e2b0a38f0 Fix T97984: GPUCodegen: crash when loading demo file
This was caused by the name buffer not being ensured in all cases.

Change the behavior and always create the `NameBuffer`.
2022-05-09 20:06:27 +02:00
bfa1c077cb Fix T97983 EEVEE: Tangent Normal of Curves info behaves differently in Eevee
Curve tangent was correctly mistaken with curve normal.

This patch fixes the name of the output in the glsl function and make curve
attributes more explicit (with `curve_` prefix).

This also improve the normal computation by making it per pixel to match
cycles.

Also ports the changes to eevee-next.
2022-05-09 20:06:27 +02:00
bda9a1b103 Cleanup: simplify filling curve batch cache buffers
Write to arrays directly instead of using the "step" utility.
2022-05-09 18:37:39 +02:00
c2e26406c5 Cleanup: use different hardcoded shape to make the root/tip radius useful
Those settings are intended to be removed at some point, but for now they
are still needed because the radius attribute isn't supported.
2022-05-09 18:37:39 +02:00
Brecht Van Lommel
f4827d08bc Build: disable usage of GLEW, CLEW, CUDA, GLFW in OpenSubdiv
The previous 3.1 libraries (accidentally) used glApi instead of GLEW and were
working for GPU subdivision, so revert to that. There's a suspected conflict
with Blender's own bundled GLEW or other issue with GLEW, causing the crash in
T97737.

The current GPU subdivision implementation does not need OpenCL, CUDA or GLFW.
So also remove libraries needed for that. It's simpler to stick to compute
shaders in OpenGL/Vulkan/Metal and not involve additional APIs.

Ref T95206

Differential Revision: https://developer.blender.org/D14898
2022-05-09 18:30:04 +02:00
78f61bf8c1 Fix T97906: OpenEXR files with lower case xyz channel names not read correctly
Adds some utility functions to avoid using toupper() which depends on the
locale and should not be used for this type of parsing.
2022-05-09 18:28:24 +02:00
c2737913db BLI: Avoid invoking tbb for small parallel_reduce calls
Apply a change similar to e130903060 for
`parallel_reduce`, just like `parallel_for`. I measured a performance
improvement in viewport FPS of at least 10% with 1 million small
instances (one bottleneck was computing many small bounding boxes).
2022-05-09 18:21:50 +02:00
892562b7bf Cleanup: Remove incorrect statement after recent refactor 2022-05-09 18:00:47 +02:00
f9d7313bb7 Fix T97853: Crash with edit mode X-ray and subdivision
The mesh drawing code used a different mesh to check whether or not to
draw face dots and to actually retrieve them. The fix is moving the
responsibility of determining whether to use subsurf face dots to the
creation of `MeshRenderData` where the mesh used for drawing is
known, rather than doing it at a higher level.

Differential Revision: https://developer.blender.org/D14855
2022-05-09 17:39:22 +02:00
686abf1850 Fix T97853: Crash with edit mode X-ray and subdivision
The mesh drawing code used a different mesh to check whether or not to
draw face dots and to actually retrieve them. The fix is moving the
responsibility of determining whether to use subsurf face dots to the
creation of `MeshRenderData` where the mesh used for drawing is
known, rather than doing it at a higher level.

Differential Revision: https://developer.blender.org/D14855
2022-05-09 17:36:54 +02:00
e0e95f7895 Refactor: Move resample curves code to the geometry module
This commit moves the code for the resample curves node to the geometry
module, to allow reusing it in any editor. Split from D14870.
2022-05-09 17:33:41 +02:00
9f8f35008c Move particle system modifier to C++
The modifier is supposed to create a Curves data block soon, which
helps with the transition to the new Curves object in drawing code.
Utilities for the new Curves object are mostly in C++.
2022-05-09 16:59:48 +02:00
5823e749dc Merge branch 'blender-v3.2-release' 2022-05-09 16:35:25 +02:00
43e31d26a9 Fix T97927: bpy.utils.units.to_string uses wrong units for velocity, acceleration, lens length, and power
`TEMPERATURE` type was also missing, not only the new-ish
`TIME_ABSOLUTE` one...

Added a static assert on the size of the `bpyunits_ucategories_items`
array, and a comment on anonymous enum of `B_UNIT_`, in the hope this
won't happen again in the future.
2022-05-09 16:34:11 +02:00
6f773b1a4f Cleanup: typo in variable name. 2022-05-09 16:34:11 +02:00
36e330bd9c UI: Layout tweaks to Curve Guide force field min/max distance
For consistency with other force fields and other areas in Blender.

* Align "Use Max" and "Maximum Distance" in one line.
* Rename "Maximum Distance" to "Max Distance"
* Rename "Minimum Distance" to "Min Distance"
* Move "Minimum Distance" below maximum.
2022-05-09 16:08:45 +02:00
865cdff426 Cleanup: Replace UNUSED with comments (CPP style). 2022-05-09 15:08:34 +02:00
17429fe5e5 GPencil: Tooltip and UI text changes
Apply @pablovazquez feedback.
2022-05-09 14:52:52 +02:00
82060c1697 Remove unused compile flag on linux x86 GCC platforms
The "cast-align" warning is only triggered on Arm CPUs when using GCC.
Currently the only officialy supported ARM platform is the Mac platform
where we use Clang. So this warning never triggers.
2022-05-09 14:30:57 +02:00
95ff5e6d89 Merge branch 'blender-v3.2-release' 2022-05-09 13:40:10 +02:00
0f7da9a72f GPU: Unable to compile material shaders.
This fixes a threading issues when material shaders with textures are used.
It localizes the names of the samplers.
2022-05-09 13:32:13 +02:00
Ethan-Hall
719c86c0a6 Fix: compiler warnings due to recent commit
This is a fix for warnings caused by the patch b96cdbcf7a.

Differential Revision: https://developer.blender.org/D14891
2022-05-09 13:06:42 +02:00
b508999d8d Merge branch 'blender-v3.2-release' 2022-05-09 12:45:16 +02:00
b1b6994129 Minor typo fixes in UI messages. 2022-05-09 12:44:21 +02:00
b8432c2c8e Tweak i18n messages extraction script to avoid unwanted messages.
Code would add a bit too often the identifier of an RNA class to
translated messages, this is only needed if there is no valid label
available for it.
2022-05-09 12:40:26 +02:00
025959da23 Fix T97915: Regression: Blender doesn't translate viewpoint menu items.
Another mistake in rBdb3f5ae48aca.
2022-05-09 12:36:56 +02:00
Colin Basnett
4ac6177b8d Fix T97529: NLA track buttons still work when hidden
NLA track option buttons (lock track, etc.) now no longer respond to
clicks when they are hidden.

The bug stems from the fact that there was duplicate input handling
going on for the buttons: once in the normal button UI system, and then
again in the `mouse_nla_channels` function. The logic in
`mouse_nla_channels` does not inspect whether or not the setting button
is there or not, it just assumes that it is.

This function should no longer be handling mouse input for buttons
(there is even comment suggesting that the button handling to be
deprecated) since the button UI system already handles it. Therefore,
the button handling code has been removed from that
`mouse_nla_channels`.

In addition, the redundant mouse button handling for pressing the "Push
Down Action" button has also been removed from this function as well.

Reviewed By: sybren, lichtwerk

Differential Revision: https://developer.blender.org/D14868
2022-05-09 12:15:16 +02:00
9913196470 Geometry Nodes: use .a_ prefix for anonymous attribute names
Ref T97452.
2022-05-09 11:59:27 +02:00
b651754890 Merge branch 'blender-v3.2-release' 2022-05-09 10:38:53 +02:00
6b95e75d2f Silenced compilation warning in freestyle. 2022-05-09 10:38:46 +02:00
cc3c15fbdd GPU: Fix crash deferred shader compilation.
On certain systems when eevee is used in a 3d viewport could crash. It
happened more often on slower systems or systems with slower glsl compilers.

For example an Intel Mac Mini. The cause was that even if a GPUMaterial
was in used it could be freed.
2022-05-09 09:54:26 +02:00
Ethan-Hall
b96cdbcf7a UI: Add color attribute create to canvas selector
The purpose of this patch is to add the option to create a color
attribute paint slot from the canvas selector when in material mode.

See the discussion here: T97346

---
|Add Image Paint Slot|Add Color Attribute Paint Slot|
|{F13016547 size=full}|{F13032911 size=full}|

Reviewed By: HooglyBoogly, joeedh

Differential Revision: https://developer.blender.org/D14724
2022-05-09 08:21:45 +02:00
Shashank Shekhar
90298c24a2 EEVEE & Viewport: Add a built-in shader called 3D_IMAGE, and expose to the python API
Adds an example python script to the documentation for the 3D_IMAGE shader.

The **use-case** is to draw textures with 3D vertex positions, in XR views as well as non-XR views (in a simpler manner).

**Testing**: I've tested that this compiles and works on my Macbook (with the example python script included in this change). I don't have access to a Windows or Linux machine right now, but this change doesn't look platform-specific and no new glsl shaders have been added or edited by this change. I'll try to get access to a Windows machine, but if someone does have one, I'd be really grateful if they could try this change. Thanks!

**Problem addressed**: The existing 2D_IMAGE shader (exposed in the python API) gets near-clipped when drawn in the
XR view, regardless of the near-clip settings. Additionally, the 2D_IMAGE shader only accepts 2D
positions for the image vertices, which means drawing textures in 3D requires providing
2D coordinates and then pushing a transform-rotate-scale matrix to the GPU, even for
non-XR (i.e. WINDOW) views. The 3D_IMAGE shader is simpler: it accepts 3D vertex positions, and doesn't require
any additional work by the scripter.

**Workaround**: The current workaround is to use custom shaders in the python script.

**Non-intrusive change**: No new glsl shaders were added. This change just bundles two existing shaders: the vertex shader used
by the 3D_IMAGE_MODULATE_ALPHA shader, and the fragment shader used by the 2D_IMAGE shader.

Reviewed By: #eevee_viewport, jbakker

Differential Revision: https://developer.blender.org/D14832
2022-05-09 08:07:37 +02:00
78e7b20c0f Fix T96683: Mipmaps are inaccurate for UDIM textures
For some reasons the mipmap count was not set to max during creation.
Probably it was mistaken with the UDIM tilemap texture which is only
1D and has only one mipmap.
2022-05-07 19:11:34 +02:00
90663acfd5 EEVEE: Fix missing function implementation for volumetric materials
This was leading to linking errors.

Fixes T97779 Regression: World volume noise stopped working
2022-05-07 18:47:48 +02:00
014cdd3441 Fix T97600 Regression: rendering in new window displays flickers
This is because some drivers / GPU actually still do double buffer swapping
but others don't. Adding this do ensure the background color of the first
redraw.

Note that this fix was not tested on the problematic hardware and might not
solve the issue.
2022-05-07 17:38:05 +02:00
9f2e995c3e Fix T97796 EEVEE: Regression: Alpha clipped materials rendered as alpha hashed
This was because the alpha clip thresholding was previously done in the
material nodes codegen. Now it is the responsibility of the engine to
implement it.

This adds a loose uniform that is set by EEVEE itself to control the clip
behavior.
2022-05-07 15:00:37 +02:00
3a035a4417 Fix T97881 EEVEE: First Specular and SSS closure not contributing on alpha blended material
This was because the evaluation was still being deferred just like for the
opaque case.
2022-05-07 13:18:16 +02:00
b28e261753 GPUShader: Add static compilation to clipped shader variations
This allows testing them for errors.
2022-05-07 12:25:40 +02:00
2a2261d7e1 Cleanup: Remove the OSL <UVTILE> workaround
Partially reverts rB46ae0831134 now that we have a new version of
OSL/OIIO that supports <UVTILE> directly.

Differential Revision: https://developer.blender.org/D14851
2022-05-06 21:41:31 -07:00
23be3294ff XR: Expose the OpenXR user paths in the event data for XR events
The use-case is to allow an event handler (in C or a plugin) to
distinguish which hand produced the XR event.

The alternative is to register separate actions for each hand (e.g.
"trigger_left" and "trigger_right"), and duplicate the device bindings
(Oculus, HTC Vive, etc) for each action. Other than the problem of code
duplication, this isn't conceptually efficient since "trigger_left" and
"trigger_right" both represent the same event "trigger", and the
identity of the hand that produced that event is just a property of
that event.

Adds two string fields to the XrEventData called user_path and
user_path_other. The user_path_other field will be populated if the
event is a bimanual one (i.e. two-handed). This follows the pattern
used by the rest of the XrEventData struct for bimanual events (e.g.
state, state_other).

Reviewed By: muxed-reality
2022-05-07 11:39:26 +09:00
98a04ed452 UI: Increase bitfield size for button flags
We were running out of bits :) Only one was left (which D14880 proposes to
use).
2022-05-06 23:48:51 +02:00
5e40c342ae UI: Remove weird looking right aligned text in texture properties
The text would start somewhere in the middle of the line, and just look placed
wrong. Plus it would seem like it's cut off (esp. since we don't add a period).
2022-05-06 23:37:28 +02:00
aee8e49031 Fix T97751: New OBJ IO - File Browser doesn't filter by .obj/.mtl
Makes the File Browser filter by .obj and .mtl files by default again. Note
that this commit focuses on fixing this specific bug, further
refactors/tweaks/fixes are planned (see D14863).

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

Reviewed by: Aras Pranckevicius
2022-05-06 23:05:38 +02:00
aae2ff49f5 Fix T97751: New OBJ IO - File Browser doesn't filter by .obj/.mtl
Makes the File Browser filter by .obj and .mtl files by default again. Note
that this commit focuses on fixing this specific bug, further
refactors/tweaks/fixes are planned (see D14863).

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

Reviewed by: Aras Pranckevicius
2022-05-06 23:03:59 +02:00
92d0ed3000 Merge branch 'blender-v3.2-release' 2022-05-06 16:44:18 +02:00
Demeter Dzadik
26d375467b bpy_extras: Add utilities for getting ID references
An alternate to D14839, implemented in Python and
relying on bpy.data.user_map(). That function
gives us a mapping of what ID is referenced by
what set of IDs. The inverse of this would also
be useful, which is now available from
bpy_extras.id_map_utils.get_id_reference_map().

From there, we can use get_all_referenced_ids()
to get a set of all IDs referenced by a given ID
either directly or indirectly.

To get only the direct references, we can simply
pass the ID of interest as a key to the dictionary
returned from get_id_reference_map().

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D14843
2022-05-06 16:42:59 +02:00
Jeroen Bakker
a7417ba845 DrawManager: Make instance data persistent.
When resizing a viewport all engine instance data was cleared.
This wasn't the intended design and lead to performance regressions
in the image engine.

This patch makes sure that the instance data isn't cleared when
the viewport size changes. When using instance data, draw engines
are responsible to update the textures accordingly.

This could also reduce flickering/stalling when resizing the viewport
in eevee-next.

Fixes T95428.

Reviewed By: fclem

Maniphest Tasks: T95428

Differential Revision: https://developer.blender.org/D14874
2022-05-06 16:17:39 +02:00
a0a99fb252 Fix T97872: Annotation lines lost AA
Since rB2a7a01b339ad, `lineSmooth` has lost its default value of true.

So set the value when creating the shader.

Differential Revision: https://developer.blender.org/D14876
2022-05-06 11:07:14 -03:00
f23f831e91 Clang-tidy: Don't warn about unrecognized compiler flags
When using GCC, clang-tidy will still use clang under the hood but GCC
flags will still be passed. Therefore we will ignore any warnings about
unrecognized flags as we don't care about this when running clang-tidy.
2022-05-06 15:26:54 +02:00
763b8f1423 Clang-tidy: Ignore variable name length and .c/.cc include warnings
After some internal discussion it was decided that we should ignore name
variable length tidy warnings. Otherwise we would have warnings for
every variable that is under three characters long.

Additionally we will also ignore any warnings when including non header
files as the Unity library in our build system uses this excessively
2022-05-06 15:26:54 +02:00
dd2df5ceb0 Fix: Comments in clang-tidy checks list is not allowed
Clang-tidy will not parse any options after the comment.
2022-05-06 15:26:54 +02:00
2ba081f59b Curves: disable Empty Hair operator when there is no active mesh 2022-05-06 15:17:44 +02:00
cdd2c8bd07 Merge branch 'blender-v3.2-release' 2022-05-06 15:07:00 +02:00
acafc7327e Fix T97466: Assert when pack sound in blender DEBUG.
This was very old code from 2008, totaly invalid with new depgraph &
evaluation system, now we just need to tag the Sound ID for update.
2022-05-06 15:05:26 +02:00
edc92f779e Curves: support converting legacy curves to new curves object
This extends the existing object type conversion operator.

Currently, it is limited to converting to curves when the evaluated
source mesh actually has curves. This might not be the case when
it is converted to a mesh by some modifier during evaluation.

Differential Revision: https://developer.blender.org/D14872
2022-05-06 14:39:36 +02:00
c7bffc8fa2 obj: move parsing utilities out of io_common, since they are fairly obj specific
As pointed out in https://developer.blender.org/rB213cd39b6db387bd88f12589fd50ff0e6563cf56#341113,
the utilities are quite OBJ specific due to treating backslash as a line
continuation character. It's unlikely that other formats need that.

No functionality changes, just pure code move (and renamed tests so that
their names reflect obj).

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D14871
2022-05-06 14:54:09 +03:00
bdfee6d831 EEVEE: Refactor curve nodes
This patches rewrites the GPU shaders of curve nodes for easier future
development. This is a non-functional change. The new code avoids code
duplication by moving common code into BKE curve mapping functions. It
also avoids ambiguous data embedding into the gradient vectors that are
passed to vectors and reduces the size of uniforms uploaded to the
shader by avoiding redundancies.

This is needed in preparation for the viewport compositor, which will
utilize and extend this implementation.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14689
2022-05-06 13:33:23 +02:00
8f6f28a0dc GPU: Move common shaders into a common directory
This patch moves some of the utility library shaders into a common
directory and makes the necessary renames across shaders. Additionally,
material-specific transform functions were moved outside of math utils
into a separate transform_utils.glsl file.

This is needed in preparation for the viewport compositor, which will
make use of some of those utilities and will require all material
specific bit to be removed out of those files.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14688
2022-05-06 12:58:14 +02:00
f5428736a7 Cleanup: Trailing white-space 2022-05-06 12:32:11 +02:00
d02b8c1c3b UI: Expand the Snap Curves to Surface operator
The different methods are too different. It is worth having them as
individual choices by the users.

Differential Revision: https://developer.blender.org/D14873
2022-05-06 12:30:46 +02:00
Ramil Roosileht
90042b7d79 Switch viewport shading for color tools in solid mode
This patch implements T97613, switching viewport shading when using Color Filter and Mask By Color

ALSO, this patch makes it so viewport shading color switches only when SOLID mode is chosen, to prevent color switching when using other shading modes, without user noticing it.
{F13049889}

Reviewed By: JulienKaspar, joeedh, jbakker

Maniphest Tasks: T97613

Differential Revision: https://developer.blender.org/D14765
2022-05-06 12:30:09 +02:00
b1517e26e2 Curves: use old Add > Curve menu for new curves object
* Removes the `Curves` menu (leaving only `Curve`).
* The `Curve > Random` option is still useful for testing, but it's under
  the second experimental flag so that it is turned off when only the
  "master ready" features are enabled.

Differential Revision: https://developer.blender.org/D14861
2022-05-06 12:06:57 +02:00
Piotr Makal
ce3dd12371 USD: add volume/VDB export
Add support for volume (OpenVDB) USD export:

- Allows to export both static and animated volumes.
- Supports volumes that have OpenVDB data from files or are generated in
  Blender with 'Mesh to Volume' modifier.
- For volumes that have generated data in Blender it also exports
  corresponding .vdb files. Those files are saved in a new folder named
  "volumes".
- Slightly changes the USD export UI panel. "Relative Texture Paths"
  becomes "Relative Paths" (and has separate UI box) as the
  functionality will now apply to both textures and volumes. Disabling
  of this option due to "Materials" checkbox being turned off has been
  removed.

Reviewed By: sybren, makowalski

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

Manifest Task: T95407
2022-05-06 11:43:43 +02:00
f3b56246d1 Cleanup: improve const correctness in material API 2022-05-06 11:40:23 +02:00
eac403b6e1 BLI: Add float3x3
This patch adds a float3x3 class that represents a 3x3 matrix. The class
can be used to represent a 2D affine transformation stored in a 3x3
matrix in column major order. The class provides various constructors
and processing methods, which utilizes the existing mat3 utilities in
BLI. Corresponding tests were also added.

This is needed by the upcoming viewport compositor to represent domain
transformations.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14687
2022-05-06 11:22:10 +02:00
908976b09a Merge branch 'blender-v3.2-release' 2022-05-06 11:12:58 +02:00
84756b68e6 Add documentation about Image/ImBuf to python/RNA API.
Related to T95616, the relationship between Image ID and ImBuf 'cached'
buffers can be fairly confusing when using the RNA API.

Reviewed By: campbellbarton, jbakker

Differential Revision: https://developer.blender.org/D14833
2022-05-06 11:11:33 +02:00
477066adee Fix: Handle default better in curves type count cache
When the curve types array isn't allocated, the default type
is Catmull Rom. Because the type counts are calculated eagerly,
they must be in a valid state.
2022-05-06 10:58:54 +02:00
12a1fa9cf4 Cleanup: format 2022-05-06 18:27:44 +10:00
2c75857f9f Cleanup: spelling in comments, use doxygen comments 2022-05-06 17:56:59 +10:00
ae9ef28126 Merge branch 'blender-v3.2-release' 2022-05-06 17:49:29 +10:00
62450e8485 WM: suppress assertion when switching tools
Changing the object mode outside the 3D view would trigger this
assertion. This was harmless, only assert for space types that
define the tools mode.
2022-05-06 17:44:32 +10:00
Andrii Symkin
e58b18888c GHOST: Add support for precision touchpad gestures on Windows
This patch adds support for precision touchpad gestures on Windows 8.1
and newer using Direct Manipulation API. Gestures work exactly like on
macOS, with full support for pan/pinch and inertia. This works by
creating a viewport with a fake scrollable which is reset after every
gesture and converts any changes to the content's transform into GHOST
trackpad events (as explained [here](https://bugzilla.mozilla.org/show_bug.cgi?id=890878)).
The code is based on the implementation from the [Chromium project](https://chromium.googlesource.com/chromium/src/+/refs/heads/master/content/browser/renderer_host/direct_manipulation_helper_win.cc).

Tested on Windows 10.

Fixes {T70754}, {T69264}.

Demo:{F8520272}

Reviewed By: nicholas_rishel

Differential Revision: https://developer.blender.org/D7660
2022-05-06 00:40:27 -07:00
4a4f0a70eb Merge branch 'blender-v3.2-release' 2022-05-06 16:22:58 +10:00
693aa573db Fix T96585: Intersect(Knife) tool is selecting wrong edges
Regression caused by [0] which flushed selection from vertices -> edges,
causing additional edges to be selected. Now selected is flushed based
on the mode, instead of all elements. Note that these function names
could be improved to make it clearer how these flushing functions are
different.

Also skip flushing unless selection is performed.

[0]: 55c82d8380
2022-05-06 16:18:04 +10:00
4dc6d14bdc Merge branch 'blender-v3.2-release' 2022-05-06 13:43:57 +10:00
11f3a388ed Merge branch 'blender-v3.2-release' 2022-05-06 13:43:54 +10:00
11a7da675f Merge branch 'blender-v3.2-release' 2022-05-06 13:43:51 +10:00
e1476ca310 Cleanup: quiet missing-declarations warnings 2022-05-06 13:43:20 +10:00
929a210608 Fix T97758: Applying modifiers bakes shape-keys
Regression in [0] which is useful when applying modifiers as a shape-key
but not when applying modifiers which keeps the existing shape-keys.

[0]: 65c5ebf577
2022-05-06 13:40:54 +10:00
fcbd81fb0f Win32: WM_SETTINGCHANGE lParam Check for NULL
Check that lParam is non-NULL in WM_SETTINGCHANGE message handler.

See D14867 for details.

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

Reviewed by Jesse Yurkovich
2022-05-05 17:48:55 -07:00
1b566b70c1 Fix T95308, T93913: Cycles mist pass wrong with SSS shader
It was wrongly writing passes twice, for both the surface entry and exit points.
We can skip code for filtering closures, emission and holdout also, as these do
nothing with only a subsurface diffuse closure present.
2022-05-05 22:01:45 +02:00
e4931ab86d Cleanup: clang format 2022-05-05 21:57:08 +02:00
108963d508 Merge branch 'blender-v3.2-release' 2022-05-05 21:01:54 +02:00
75a051a6ab Fix T93246: Cycles wrong volume shading after transparent surface
The Russian roulette probability was not taken into account for volumes in all
cases. It should not be left out from the SD_HAS_ONLY_VOLUME case.
2022-05-05 20:51:01 +02:00
4fa71be89a UI: Sort Force Field enums alphabetically
For consistency with the rest of Blender.

* Use a blank icon for "None" type, so the label aligns with the rest.
* Use "None" instead of "Nothing" for Kink type dropdown entry.
2022-05-05 18:00:16 +02:00
26cda38985 Docs: Clarify docs for BMesh methods
The previous docs for `normal_update` methods of `BMVert`, `BMEdge`,
`BMFace`, and `BMesh` were not clear on some behaviors.  These
behaviors are listed in D14370.  This commit updates the docs to be
clearer.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D14370
2022-05-05 11:08:01 -04:00
26bc584e01 Cleanup: Better const correctness for DEG_get_eval_flags_for_id
The ID is not modified by this function, so it can be const.

Needed to tweak const correctness for original ID accessor as
well. Additionally, did the same for accessor of evaluated ID
for symmetry.
2022-05-05 15:52:57 +02:00
47ba541853 Merge branch 'blender-v3.2-release' 2022-05-05 15:39:58 +02:00
b891c72d2d Fix T97575: Toggling fullscreen causes compositor recalc
The root of the issue is that compositor is using refresh mechanism
to handle recalc.

The safest fix which does not require deep refactor is to check to
whether node space was tagged for refresh from listener (currently
it is listeners which are responsible for tackling compositor tree
recalc).

Differential Revision: https://developer.blender.org/D14856
2022-05-05 15:35:59 +02:00
b968e2bf48 Outliner: add icons for nodegroups
These were missing in "Blender File" view.

before
{F13053175}
after
{F13053176}

Differential Revision: https://developer.blender.org/D14859
2022-05-05 14:44:31 +02:00
6fa5d520b8 Cycles: Add support for parallel compilation of OptiX module
OptiX 7.4 adds support for splitting the costly creation of an OptiX
module into smaller tasks that can be executed in parallel on a
thread pool.
This is only really relevant for the "shader_raytrace" kernel variant
as the main one is small and compiles fast either way. It sheds of
a few seconds there (total gain is not massive currently, since it is
difficult for the compiler to split up the huge shading entry point
that is the primary one taking up time, but it is still measurable).

Differential Revision: https://developer.blender.org/D14845
2022-05-05 14:35:41 +02:00
5b24291be1 Curves: move curve sculpt settings out of advanced panel 2022-05-05 14:15:09 +02:00
48f7574716 Merge branch 'blender-v3.2-release' 2022-05-05 15:01:28 +03:00
1830a3dfb5 Fix T97863: new OBJ importer issues with extra whitespace after "f" keywords
While possible extra whitespace after all OBJ/MTL keywords was properly
skipped, it was not done for the "f" (face definition) keyword.

While at it, also support indented keywords, i.e. extra whitespace at
the beginning of the line.

There's a tiny bit of performance drop while importing (e.g. importing
blender 3.0 splash scene: 53.38sec -> 54.21sec on my machine). But
correctness is more important.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14854
2022-05-05 14:59:46 +03:00
ad119d327e Curves: change default name of curves object to Curves 2022-05-05 13:01:39 +02:00
bff9bf728e Fix T97774: don't crash when no brush is selected 2022-05-05 12:52:19 +02:00
611b82621d Merge branch 'blender-v3.2-release' 2022-05-05 20:44:48 +10:00
69c7ff1649 Cleanup: unused parameter warning 2022-05-05 12:43:16 +02:00
be0417d690 Cleanup: Move curve length field input to blenkernel
To use in the geometry module when the resample curves code
is moved there (T97448).
2022-05-05 12:41:48 +02:00
756710800c File missing from 78fc5ea1c3 2022-05-05 20:40:56 +10:00
78fc5ea1c3 Workaround T81065: Merge UV's when applying modifiers
Support merging UV's that share the same vertex and are very close when
applying modifiers.

This is needed to prevent UV's becoming "detached" which can happen when
applying the subdivision surface modifier.

This regression was caused by [0] which removed selection threshold for
nearby coordinates. While restoring the UV selection threshold could be
done - some selection operations that walk around connected UV fans
wouldn't behave in a deterministic way (such as select shortest path).
There are also other cases where UV's may be compared without a
threshold such as tangent calculation and exporters which have their own
logic to handling UV's.

Also resolves T86896, T89903.

[0]: b88dd3b8e7

Reviewed By: sergey

Ref D14841
2022-05-05 20:36:15 +10:00
18bcd8321a Curves: show warning when using Add brush without surface 2022-05-05 12:24:24 +02:00
622c4e4953 Cleanup: Further clarification and renaming of curve field inputs
Differentiate the total length of curves and the accumulated length
at each control point.
2022-05-05 12:21:36 +02:00
c7a345bd60 Merge branch 'blender-v3.2-release' 2022-05-05 20:18:44 +10:00
960a1ddd85 Merge branch 'blender-v3.2-release' 2022-05-05 20:18:41 +10:00
598917f49b Fix T97874: Python exception after undo with image space visible
Ensure tools are initialized with the correct area type set.
2022-05-05 20:13:10 +10:00
7e02c90103 Fix WM_toolsystem_refresh_screen_all failing to refresh tools
Error in 3e1baa7d53.
2022-05-05 20:13:10 +10:00
dbba5c4df9 Curves: control number of control points in new curves
Previously, the number of control points in a new curve was hardcoded.

Differential Revision: https://developer.blender.org/D14857
2022-05-05 12:11:50 +02:00
b4fa74e812 Cleanup: Rename field input class name 2022-05-05 12:07:46 +02:00
09f769bde5 Curves: show Front Faces Only option in tools panel 2022-05-05 12:07:35 +02:00
8d78c3152e Curves: unify "Front Faces Only" name with mesh sculpt mode 2022-05-05 12:07:10 +02:00
a85df96b4f Merge branch 'blender-v3.2-release' 2022-05-05 11:59:34 +02:00
94533ca4b8 Cleanup: EEVEE: Fix clang-tidy warnings and unused var warning 2022-05-05 11:55:13 +02:00
3505d948c6 DRW: Hair: Fix shader compilation of transform feedback shader
Introduced by rBadbe71c3faba.
2022-05-05 11:44:31 +02:00
9ebf8a0c35 Cleanup: Use unsigned short for mesh flag
Solves the compilation warning about sign change when the
default flags are cast from int to short.
2022-05-05 11:38:51 +02:00
060c5a7fa2 Cleanup: Remove unnecessary logic for resample curves node
After 2d80f814cc, we can assume that curves always have at least one
evalauted point, so this complication isn't necessary anymore.
2022-05-05 11:30:16 +02:00
b4fb2a6980 Cleanup: Add comment about mininum curve length 2022-05-05 10:22:21 +02:00
8b54e05e33 Cleanup: sort cmake file lists 2022-05-05 17:33:43 +10:00
eb837ba17e Cleanup: format 2022-05-05 17:33:43 +10:00
6513ce258f Geometry Nodes: Improve performance of mesh to points node
There are fancier possibilities for improvements, like taking ownership
of existing arrays in some cases, but this patch takes a simpler brute
force approach for now.

The first change is to move from the previous loop to using the new
`materialize_compressed_to_uninitialized` method on virtual arrays,
which adds only the selected values to the output. That is a nice
improvement in some cases, corresponding to the "Without Threading"
column in the chart below.

The next change is to call that function in parallel on slices of
the output. To avoid generating too much code, we can avoid
templating based on the type and devirtualizing completely.

The test input is a 4 million point grid, generated by the grid
primitive node. Color and 2D vector attributes were also transferred
to the points.

| Test      | Before | Final No Threading | Final  | Change |
| --------- | ------ | ------------------ | ------ | ------ |
| All Verts | 209 ms | 186 ms             | 170 ms | 0.8x   |
| 1%        | 148 ms | 143 ms             | 133 ms | 0.9x   |
| All Faces | 326 ms | 303 ms             | 87 ms  | 0.27x  |
| 1%  Faces | 70 ms  | 68 ms              | 34 ms  | 0.49x  |

Differential Revision: https://developer.blender.org/D14661
2022-05-05 09:28:46 +02:00
0f567ada9d Docs: add doc-string for BMFace.mat_nr struct member 2022-05-05 17:18:50 +10:00
ddbac88c08 Win32: Dark Mode Title Bar Color
Blender will respect Windows "Dark Mode" setting for title bar color.

See D14847 for details.

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

Reviewed by Ray Molenkamp
2022-05-04 20:19:10 -07:00
836fbb90aa Cleanup: mark library locations as advanced 2022-05-05 11:38:19 +10:00
e33c15951b Cleanup: spelling in comments 2022-05-05 10:55:51 +10:00
d0c2fd0570 Cleanup: use 'r_' prefix for return arguments 2022-05-05 10:44:25 +10:00
d3c895fc41 Cleanup: shadow and format warnings 2022-05-05 10:44:25 +10:00
777b72b5cb Cleanup: unused argument warnings 2022-05-05 10:44:25 +10:00
73fa571598 Merge branch 'blender-v3.2-release' 2022-05-04 21:43:56 -03:00
adbe71c3fa Fix T97835: crash when creating hair particle system on Mac
Recently `gpu_shader_3D_smooth_color_frag.glsl` had the uniform declarations removed.

For shaders without `ShaderCreateInfo` that require this source this results in the error:
```
ERROR (gpu.shader): hair_refine_shader_transform_feedback_workaround_create FragShader:
      |
   54 |   fragColor = finalColor;
      |
      | gpu_shader_3D_smooth_color_frag.glsl:5:0: Error: Use of undeclared identifier 'fragColor'
      | gpu_shader_3D_smooth_color_frag.glsl:5:0: Error: Use of undeclared identifier 'finalColor'
      |
   55 |   fragColor = blender_srgb_to_framebuffer_space(fragColor);
      |
      | gpu_shader_3D_smooth_color_frag.glsl:6:0: Error: Use of undeclared identifier 'fragColor'
      | gpu_shader_3D_smooth_color_frag.glsl:6:0: Error: Use of undeclared identifier 'fragColor'
```

So port that shader to use `ShaderCreateInfo`.
2022-05-04 21:42:38 -03:00
8960c6e060 IMBUF: Faster JPEG Thumbnails
Make preview thumbnails of JPEG files in less time and with less RAM.

See D14727 for more details.

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

Reviewed by Brecht Van Lommel
2022-05-04 16:55:59 -07:00
Juanfran Matheu
ed0964c976 UI: Add Gizmos toggle to SpaceImage
This patch adds the show_gizmo and show_gizmo_navigate properties to the Image and UV editors.

Image Editor:
{F13026317}
UV Editor:
{F13026319}

VIDEO:
{F13026324}

Reviewed By: #user_interface, campbellbarton

Differential Revision: https://developer.blender.org/D14755
2022-05-05 00:23:25 +02:00
f11dba8892 Fix Cycles world light group confusing UI
Move to a subpanel of the Settings panel. Otherwise it seems like it's a
setting of one of the shader nodes.
2022-05-04 21:23:18 +02:00
0fa1c65ee3 Fix T95644: Cycles doesn't update modified object attributes on GPU
evice_update_preprocess is supposed to detect modified attributes and flag the
device_vector for a copy through device_update_flags. However, since object
attributes are only created in device_update_attributes afterwards, they can't
be included in that check.

Change the function that actually updates the device_vector to tag it as
modified as soon as its content gets updated.

Differential Revision: https://developer.blender.org/D14815
2022-05-04 20:07:19 +02:00
54f447ecde Fix T96718: Cycles invalid pixels when using bump normal for light emission
A shader node setup accidentally used the bump normal as emission. Bump
mapping nodes are excluded from light shader evaluation to reduce kernel size
and register pressure, but in that case should write zero instead of leaving
memory uninitialized.

Thanks to Lukas for helping identify the cause.
2022-05-04 20:01:04 +02:00
ac9ebc9de3 Fix Cycles division by zero in material preview render
If the render gets cancelled before the first sample finishes.
2022-05-04 20:01:04 +02:00
319a772b7f Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-04 19:37:48 +02:00
fc0f6d19ad Fix T96845: artifacts with GPU subdivision and mirror modifier
The coarse polygon count was set to the one of the BMesh instead of
the the one of the mesh used for subdivision, which caused the
compute shaders to output wrong data.
2022-05-04 19:31:53 +02:00
5d7ee44406 Fix T95527: wrong motion blur with rigid bodies
This index is not meant for the point cache data array, it's already offset.
2022-05-04 19:28:17 +02:00
1a98bec40e Subdivision node: add input for vertex creases
This adds an input to the Subdivision node to specify a field to use
for controling vertex creases. Common code with edge creasing was
extracted into utility functions to avoid redundancy.

Differential Revision: https://developer.blender.org/D14199
2022-05-04 18:59:08 +02:00
Hallam Roberts
82df48227b Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
  "Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
  "Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
  nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
  "Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
  "Separate RGB/HSV" nodes.

Python addons have not been updated to the new nodes yet.

**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.

**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.

Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
7d41e1ed40 Merge branch 'blender-v3.2-release' 2022-05-04 17:30:26 +02:00
60772baebf Fix T97709: Compositor: Scenes are being set to no users after doing a full copy.
Similar issue/solution as in rB5188c14718c5 from this Monday actually,
there may be more of those still lurking around... Quite surprising they
all get reported now, this behavior has been in Blender since years.
2022-05-04 17:29:50 +02:00
8ff5836766 Merge branch 'blender-v3.2-release' 2022-05-04 17:19:25 +02:00
b5c3885bf0 Fix T97851: GPencil Bake object transform operator wrong transformation
The problem was the layer transformation was already applied in the layer and if we apply in the bake, we are doing double transformation.

Differential Revision: https://developer.blender.org/D14844
2022-05-04 17:18:58 +02:00
Germano Cavalcante
d2271cf939 Transform: use a threshold for UV snapping
Unlike 3Dview snapping, UV snapping is always done to the UV closest to
the mouse cursor, no matter the distance.

From the user's point of view, this appears to be an inconsistency (See
{T93538}).

Therefore, set a minimum distance for snapping and, as in 3D View and
highlight the snap with a drawing of a circle.

Release Note: https://wiki.blender.org/wiki/Reference/Release_Notes/3.3/Modeling

Reviewed By: #uv_editing, campbellbarton

Maniphest Tasks: T93538

Differential Revision: https://developer.blender.org/D13873
2022-05-04 12:08:17 -03:00
5559ea59a1 Cycles: mark all CUDA 11.x versions as supported
All released versions appear to work fine. Also slightly change wording.
2022-05-04 17:07:39 +02:00
b5b6ae06f9 Build: update outdated description of WITH_TBB option 2022-05-04 17:07:39 +02:00
08daeb9472 LineArt: Clean up file name and license.
lineart_cpp_bridge.cpp changed to .cc
2022-05-04 22:32:50 +08:00
03aba8046e LineArt: Object loading optimization
This patch replaces BMesh conversion into index-based triangle adjacent
lookup method, and use multithread in many steps to speed up object
loading for line art.

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

Reviewed By: Sebastian Parborg (zeddb)
2022-05-04 22:11:33 +08:00
8bd0ed6bd2 Curves: show direction in panel for Grow / Shrink brush settings 2022-05-04 15:37:59 +02:00
a0d139076c Silenced compilation warning on clang. 2022-05-04 15:04:30 +02:00
a52fbeadb1 Merge branch 'blender-v3.2-release' 2022-05-04 15:02:55 +02:00
54b293237e Fix T97375: changing node tree from Python is very slow
The issue was that the `NodeTreeRef` acceleration data structure was
rebuild much more often than necessary. That happened because the
Map Range node accidentally tagged the node tree for change even
though it did not actually change.

Differential Revision: https://developer.blender.org/D14842
2022-05-04 15:02:19 +02:00
82bf11e73f Cleanup: unused parameter 2022-05-04 14:36:16 +02:00
dc1793e85b Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-04 14:33:13 +02:00
d86d7c935e Fix T97827: material preview not displaying textures
Caused by rB281bcc1c1dd6 which did not properly made use
of `vec4` for UVs which are now loaded as attributes.
2022-05-04 14:30:52 +02:00
5162135e14 Curves: add second experimental option for new curves tools
Now there are two experimental feature options:
* "New Curves Type": Enables the new data type and a couple of tools
  that are meant to be in the first release that comes with the new curves object.
* "New Curves Tools": This is only available when the new curve type is available
  as well. It mainly exists to keep some tools experimental even after the initial
  curves object is release officially.
  * For now this only includes the curves edit mode which is not usable yet and
    probably won't be for the initial release.

Differential Revision: https://developer.blender.org/D14840
2022-05-04 14:18:42 +02:00
3bdda67e50 Merge branch 'blender-v3.2-release' 2022-05-04 15:11:25 +03:00
cbeb8770cc Fix T97794: new OBJ importer does not handle quoted MTL paths
Fixes T97794 (which is a reintroduction of an older issue T67266 that
has been fixed in the python importer, but the fix was not in the C++
one). Some software produces OBJ files with mtllib statements like
mtllib "file name in quotes.mtl", and the new importer was not stripping
the quotes away.

While at it, I noticed that MTLParser constructor was taking a StringRef
and treating it as a zero-terminated string, which is not necessarily
the case. Fixed that by explicitly using a StringRefNull type.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14838
2022-05-04 15:10:54 +03:00
48c0738d4a Cleanup: Adjust variable names, miscellaneous changes
Use `src` and `dst` instead of less common variable names,
less redundant logic, simpler use of const, and "typename"
for template arguments instead of "class".
2022-05-04 14:10:22 +02:00
9ee9dd257f Curves: Add method to find indices for curve type in a selection
For example, this can be used to find the indices of all Bezier curves
inside an existing selection. The important part is that it is optimized
for the case when all curves have the same type.
2022-05-04 13:55:13 +02:00
16011e34f0 Curves: Optimize filling all curves with a single type
If all curves are selected for setting the new type,
skip counting the types and just set it directly.
2022-05-04 13:55:13 +02:00
7d7047058a Merge branch 'blender-v3.2-release' 2022-05-04 13:00:04 +02:00
Yann Lanthony
b31f5b8ce7 GPencil: Apply layer transforms to visible frames
Fix regression described in T97799.

Apply layer transform and layer parenting to all visible frames, i.e. active frame + onion skinning frames.

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T97799

Differential Revision: https://developer.blender.org/D14829
2022-05-04 12:58:57 +02:00
0f2cc50fc6 Cleanup: Avoid asan overflow warning for RNG seed 2022-05-04 12:58:45 +02:00
caeea212cf Merge branch 'blender-v3.2-release' 2022-05-04 12:28:05 +02:00
302584bd6e Fix T97831: Curve to mesh node can create invalid wire mesh
When the profile only has one control point, its segment count was
determined incorrectly. There needs to be a special case for a single
control point, when there are no segments even if the curve is cyclic.
2022-05-04 12:26:59 +02:00
14d845192a Merge branch 'blender-v3.2-release' 2022-05-04 19:32:12 +10:00
e7ba34599c Merge branch 'blender-v3.2-release' 2022-05-04 19:32:09 +10:00
79e94caa6b Fix error pasting text containing tabs
Regression in [0] which missed updating the string length
when converting tabs to spaces - the pasted string would be shorter.

[0]: e2f4c4db8d
2022-05-04 19:28:11 +10:00
5f8f436dca Allow surface deform when target mesh increases number of vertices
A studio request actually.

The goal is to cover rather typical situation: when the mesh was
bound to target when the target was on subdivision level 0 but
uses a higher subdivision level for rendering. Example of such
setup is a facial hair bound to the face.

The idea of this change is to use first N vertices from the target
where N is the number of vertices on target during binding process.
While this sounds a bit arbitrary it covers typical modifier setup
used for rigging. Arguably, it is not more arbitrary than using a
number of polygons (which is how the modifier was checking for
changes on target before this change).

Quite straightforward change. A bit tricky part was to not break
the behavior since before this change we did not track number of
vertices sued when binding. The naming I'm also not super happy
with and just followed the existing one. Ideally the variables in
DNA will be prefixed with `target_` but doing it for an existing
field would mean compatibility change, and only using prefix for
the new field will introduce weird semantic where the polygons
count will be even more easily confused with a count on the
deforming mesh.

Differential Revision: https://developer.blender.org/D14830
2022-05-04 10:56:33 +02:00
aa1fb4204d Cleanup: More clear name in surface deform modifier
Make it explicit that counter is about target mesh.

Use DNA rename for it so that the files stay compatible.

Also renamed some purely runtime fields to replace `t`
prefix with `target` as the short `t` is super easy
to miss.

Differential Revision: https://developer.blender.org/D14835
2022-05-04 10:56:33 +02:00
2d80f814cc Curves: Use copied original data for invalid NURBS curves
NURBS curves can be invalid when the order is less than the number
of points, or in a few other situations. Currently the evaluated data of
an invalid NURBS curve is empty. This is inconvenient because it
requires checking for empty curves when it otherwise wouldn't be
necessary. This patch replaces that fallback with copying the original
data to the evaluated points. This makes conceptual sense too, as if
the curve couldn't be evaluated-- which wouldn't necessarily delete it.

Usually the UI protects against this happening, but it's currently
possible to create an invalid curve with some operations like the
delete geometry node.

Differential Revision: https://developer.blender.org/D14837
2022-05-04 10:27:46 +02:00
7dc94155f6 Curves: support symmetry in curves sculpting brushes
This adds support for X/Y/Z symmetry for all brushes in curves
sculpt mode. In theory this can be extended to support radial
symmetry, but that's not part of this patch.

It works by essentially applying a brush stroke multiple with
different transforms. This is similiar to how symmetry works in
mesh sculpt mode, but is quite different from how it worked in
the old hair system (there it tried to find matching hair strands
on both sides of the surface; if none was found, symmetry did
not work).

Differential Revision: https://developer.blender.org/D14795
2022-05-04 09:51:32 +02:00
0375720e28 Fix T95165: Custom Normals tools dont update immediately.
Recalc selection count at the end of the circle selection.
This was removed from circle selection as it became a performance
bottleneck, helas some operators rely on it.
2022-05-04 09:22:17 +02:00
aa21087d56 Merge branch 'blender-v3.2-release' 2022-05-04 14:02:23 +10:00
78e8fae346 Merge branch 'blender-v3.2-release' 2022-05-04 14:02:21 +10:00
b1cd3be0d0 Merge branch 'blender-v3.2-release' 2022-05-04 14:02:18 +10:00
f8c8abae38 Merge branch 'blender-v3.2-release' 2022-05-04 14:02:15 +10:00
0383047257 Cleanup: quiet strict-prototypes warning 2022-05-04 14:01:18 +10:00
2a89509e45 License headers: add missing license headers
Add missing license headers based on files in the same directory.
2022-05-04 13:58:53 +10:00
10b1e993f4 Cleanup: make format 2022-05-04 13:52:22 +10:00
8cb30c079d Cleanup: duplicating doc-strings 2022-05-04 13:44:23 +10:00
db63945c36 Docs: add doc-string for ED_view3d_viewcontext_init_object 2022-05-04 11:20:04 +10:00
dc57ab8941 Cleanup: quiet strict-prototypes warning 2022-05-04 11:07:19 +10:00
e86b62f195 Fix wrong task priority for particle distribution and tanget computation
These kinds of depsgraph evaluations should not be marked as low priority as
this could negatively affect playback performance. Low priority should mainly
be used for background tasks.
2022-05-03 23:08:29 +02:00
5b2a6b6ebb Fix T96880: viewport render animation hangs Blender
Isolate frame writing task so that multithreaded image operations don't cause
the thread to start writing another frame. If that happens we may reach the
MAX_SCHEDULED_FRAMES limit, and cause the render thread and writing threads to
deadlock waiting for each other.

Additionally, don't set task priority to low because this may cause the task
scheduler to be slow in scheduling the write and color management tasks.
2022-05-03 23:08:29 +02:00
502c707e0e Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-03 22:59:31 +02:00
Ethan-Hall
1d668b6356 Alembic: Enable operator presets when exporting
This patch enables operator presets for Alembic exports.
The export menu has many options, so enabling the feature
will help users manage their export settings in the same
way they can with other filetypes.

This also fixes restoring the default operator value for
setting the frame range.

Differential Revision: https://developer.blender.org/D12849
2022-05-03 22:58:18 +02:00
281bcc1c1d Fix T93179: geonodes UVs and Vertex colors do not work in EEVEE
Overwriting UV map or vertex color data in Geometry nodes will move the
layers to another CustomData channel, and as such, will make attribute
lookup fail from the UVMap and Vertex Color nodes in EEVEE as the
CustomDataType will also be modified (i.e. no longer `CD_MTFACE` or
`CD_MCOL`).

As discussed in T93179, the solution is to use `CD_PROP_AUTO_FROM_NAME`
so that the render engine is able to find the attributes. This also makes
EEVEE emulate Cycles behaviour in this regard. `attr_load_uv` and
`attr_load_color` are also removed in favor of the generic attribute
API in the various GLSL shaders.

Although `CD_PROP_AUTO_FROM_NAME` is now used even for UV maps, the
active UV map is still used in case the attribute name is empty, to
preserve the old behavior.

Differential Revision: https://developer.blender.org/D13730
2022-05-03 22:50:04 +02:00
94205e1d02 Fix T96822: Cycles motion blur + persistent data not updating properly
At the frame before/after an object starts moving, it's transform may not be
modified but its motion would be and requires an update.
2022-05-03 22:16:08 +02:00
947f8ba300 Fix T96338: GPU subdiv crash switching to UV editing
The crash is caused as the data for the UV editor is requested before
the data for the mesh as a separate draw update. Since building the UV
stretch angle buffer requires the position buffer, the latter is not
created yet in this case.

To fix this, create a local position buffer from the subdivision data. An
alternate fix was considered to remove the dependency on the position
buffer by interpolating on the GPU the coarse stretch angle buffer but
this did work. Maybe this will be revisited.
2022-05-03 18:02:10 +02:00
04df0a3b8c Sculpt Curves Puff icon 2022-05-03 17:49:10 +02:00
2062116924 BPY types: add default Geometry Node poll function
Contrary to `CompositorNodeCustomGroup` or `ShaderNodeCustomGroup`,
`GeometryNodeCustomGroups` have to define their own poll function.
This is because their is no predefined poll function for `GeometryNode`,
and it may not be clear for addon developers why `GeometryNode` would
be special here.

This adds `GeometryNode` to `bpy_types.py` and defines such a function
for it like for other builtin node types.

Differential Revision: https://developer.blender.org/D14775
2022-05-03 17:43:03 +02:00
9fb98735ea Refactor: Use boolean array for curves delete brush
No functional or performance changes expected. This change
makes it simpler to run multiple operation "delete" operations
but only reallocate the curves data arrays a single time.
2022-05-03 17:41:09 +02:00
f586c3ba21 Merge branch 'blender-v3.2-release' 2022-05-03 14:49:53 +03:00
5962db093f Fix T97793, Fix T97795: Use correct defaults for missing values in new OBJ importer
- Fix T97793: when a UV coordinate after vt is missing, use zero. While
  at it, also use zeroes for positions & normals, since "maximum
  possible float" is very likely to cause issues in imported meshes.
- Fix T97795: use 1.0 default if -bm value is missing, instead of zero.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14826
2022-05-03 14:45:44 +03:00
5f5e7ac317 Fix T97757: Some MTL import correctness issues in the new OBJ importer
Fix several correctness issues where the new OBJ/MTL importer was not
producing the same results as the old one, mostly because the code for
some reason had slightly different logic. Fixes T97757:

- When .obj file tries to use a material that does not exist, the code
  was continuing to use the previous material, instead of creating new
  default one, as the previous importer did.
- Previous importer was always searching/parsing "foo.mtl" for a
  "foo.obj" file, even if the file itself does not contain
  "mtllib foo.mtl" statement. One file from T97757 repros happens to
  depend on that, so resurrect that behavior.
- When IOR (Ni) or Alpha (d) are not specified in .mtl file, do not
  wrongly set -1 values to the blender material.
- When base (Kd) or emissive (Ke) colors are not specified in the .mtl
  file, do not set them on the blender material.
- Roughness and metallic values used by viewport shading were not set
  onto blender material.
- The logic for when metallic was set to zero was incorrect; it should
  be set to zero when "not using reflection", not when "mtl file does
  not contain metallic".
- Do not produce a warning when illum value is not spelled out in .mtl
  file, treat as default (1).
- Parse illum as a float just like python importer does, as to not
  reintroduce part of T60135.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14822
2022-05-03 14:44:49 +03:00
11d075f07d Cleanup: Move color attribute enums to be reusable
These enum property arrays are used by a few patches
in review. Moving them here means they don't have to
be duplicated.
2022-05-03 12:23:17 +02:00
Nate Rupsis
61e8310b75 NLA: improve visibility of action & active channel
Selecting Action channel in NLA now sets the context in the N-panel. The
actively selected channel is now also drawn in a different way, so that
it's visible which one is selected.

Old:
- The NLA sidebar didn't refresh with the creation of a new action.
- There was no indication of the action channel being selected.

New:
- NLA side bar now refreshed when keyframes are added (new action is created)
- Clicking on the action channel now gives visual indication of being selected

Reviewed By: RiggingDojo, sybren

Maniphest Tasks: T97372

Differential Revision: https://developer.blender.org/D14820
2022-05-03 12:00:42 +02:00
46d7bcc068 Merge branch 'blender-v3.2-release' 2022-05-03 10:56:24 +02:00
a2e3005b42 Fix VSE view clamping not working
Clamping was set up, but `v2d->cur` was never actually modified.
2022-05-03 10:55:05 +02:00
2ea9d1fccf Fix T97720: Fix meta strip shows incorrect mute state.
Caused by only checking mute state for meta strip itself and not the
children.
2022-05-03 10:55:05 +02:00
6b74c8e486 Merge branch 'blender-v3.2-release' 2022-05-03 10:34:46 +02:00
20f819d708 Fix T95541: Broken vertex weight with mirror modifier.
Regression from rB1a7757b0bc69/rBa0acb9bd0cc0. Special handling
(averaging) of weights on merged center vertices also requires to be
'reversed' when new correct merge order is used, compared to previous
behavior.
2022-05-03 10:33:38 +02:00
cd1044fb2b Merge branch 'blender-v3.2-release' 2022-05-03 18:33:24 +10:00
31bf70e35c Merge branch 'blender-v3.2-release' 2022-05-03 18:33:21 +10:00
cfdec85cd9 Cleanup: auto-format 2022-05-03 18:32:12 +10:00
4824cad580 GNUmakefile: include autopep8 in the "make format" target
Run autopep8 as well as clang-format when calling "make format",
the PATHS argument is passed to both utilities which will only operate
on files they support.

For example: `make format PATHS=release/scripts` formats Python scripts,
`make format PATHS=source/blender/blenlib` would format C/C++.
If users really want they can format C/C++ & Python files at the same
time since both formatting utilities filter on file extension.

`make format PATHS="release/scripts/startup/nodeitems_builtins.py source/creator/creator.c"`

A LIBDIR variable has been added to the GNUmakefile to simplify
references to this directory which can be one of 3 possible values.

Reviewed By: sybren, brecht

Ref D14789
2022-05-03 18:32:00 +10:00
61b65e9c9b Merge branch 'blender-v3.2-release' 2022-05-03 18:24:29 +10:00
4196772ae8 Merge branch 'blender-v3.2-release' 2022-05-03 18:24:26 +10:00
3a002bff7a Merge branch 'blender-v3.2-release' 2022-05-03 18:24:22 +10:00
74dfb7ca23 Fix T97731: Python traceback no longer includes line-numbers
Regression caused by [0] that caused the error message to be
created based on a normalized exception (which hid line numbers).

PyC_ExceptionBuffer{_Simple} & BPy_errors_to_report
no longer clears the exception.

This could have been resolved by changing python_script_error_jump
however that would involve changes to reference counting that are more
risky (noted in code-comment).

[0]: 2d2baeaf04
2022-05-03 18:22:54 +10:00
a821a2db3d Cleanup: remove redundant PyErr_Clear calls after PyErr_Fetch 2022-05-03 18:22:54 +10:00
1fc95d829f CMake: fix error building when CUDA_NVCC_EXECUTABLE is missing 2022-05-03 18:22:54 +10:00
f5dc675537 Merge branch 'blender-v3.2-release' 2022-05-03 10:21:35 +02:00
daa9edc9be Fix T97744: Speed effect causes memory leak
Leak was caused because output image buffer was initialized twice. Once
in speed effect strip and then by cross effect strip used for
interpolation feature.
2022-05-03 10:20:41 +02:00
fd98403211 Fix T97733: Crash when adding new scene
Caused by NULL dereference if sequencer data does not exist.
2022-05-03 10:20:41 +02:00
8e71ba12e5 Merge branch 'blender-v3.2-release' 2022-05-03 09:50:32 +02:00
f80e4f0046 Fix T93272: Material index mapping missing for mesh boolean node
This commit implements copying of materials and material indices from
all of the boolean node's input meshes. The materials are added to the
final mesh in the order that they appear when looking through the
materials of the input meshes in the same order of the multi-socket
input node.

All material remapping is done with mesh-level materials. Object-level
materials are not considered, since the meshes don't come from objects.

Merging all materials rather than just the materials on the first mesh
requires a change to the boolean-mesh conversion. This subtly changes
the behavior for object linked materials, but in a good way I think;
now the material remap arrays are respected no matter the number
of materials on the first mesh input.

Differential Revision: https://developer.blender.org/D14788
2022-05-03 09:47:40 +02:00
af2740abc0 Fix T97718: Crash using "Text on Curve"
8e4c3c6a24 mistakenly used the `vec` argument
of `BKE_where_on_path` like it was optional. Fix by
making that argument optional too.
2022-05-03 09:47:40 +02:00
00fb44797a Fix T97543: Changing multipass images doesn't update the image.
Code was partial migrated from the previous image engine. Missing multilayered
images.
2022-05-03 09:47:40 +02:00
cc0c4c17f0 Fix T95752: crash 'Select Linked' after loopcut in multiobject editmode
This was reported explicitly for originally being in face selectmode,
but could also crash when in vertex selectmode (when doing multiple
cuts).

The reason here is that `MESH_OT_loopcut` switches to edge select mode
(needed for `TRANSFORM_OT_edge_slide`, done in `ringsel_finish`), but was
only doing this on the active object's editmesh, all other participating
meshes would keep their selectmode which would now be out of sync with
both the active object's editmesh and scene settings for these.

This causes problems later in 'Select Linked'. Here, a mixture of
objects are used. First the viewcontext is set up with the active
object, then all participating objects are iterated (changing the
viewcontext to another object), then `unified_findnearest` would use that
changed viewcontext which would now contain the last object iterated. To
repeat: this could now have a different selectmode than the active
object which is later **again** used to get the nearest `BMElem` from in
`EDBM_elem_from_selectmode`. So in the failing case, we could get an
edge (but no face because of edge selectmode) from `unified_findnearest`,
`EDBM_elem_from_selectmode` would return NULL though (edge provided, but
in face selectmode), leading to the crash.

To solve this I assume it is best to change selectmode on all
participating meshes in multi-object editmode loopcut if necessary so
these are always in sync for following operations.
Alternatively, `Select Linked` (and probably lots more operators) would
have to be tweaked to pay closer attention which object is really used
to get selectmode from.

Note the selectmode is actually set back from edge selectmode in certain
cases (see `USE_LOOPSLIDE_HACK`), this patch changes that as well to act
on all participating meshes.

Maniphest Tasks: T95752

Differential Revision: https://developer.blender.org/D14791
2022-05-03 09:46:18 +02:00
1a6d0ec71c Fix T93272: Material index mapping missing for mesh boolean node
This commit implements copying of materials and material indices from
all of the boolean node's input meshes. The materials are added to the
final mesh in the order that they appear when looking through the
materials of the input meshes in the same order of the multi-socket
input node.

All material remapping is done with mesh-level materials. Object-level
materials are not considered, since the meshes don't come from objects.

Merging all materials rather than just the materials on the first mesh
requires a change to the boolean-mesh conversion. This subtly changes
the behavior for object linked materials, but in a good way I think;
now the material remap arrays are respected no matter the number
of materials on the first mesh input.

Differential Revision: https://developer.blender.org/D14788
2022-05-03 09:28:35 +02:00
c09c3246eb Fix T97718: Crash using "Text on Curve"
8e4c3c6a24 mistakenly used the `vec` argument
of `BKE_where_on_path` like it was optional. Fix by
making that argument optional too.
2022-05-03 09:25:28 +02:00
3d96fd6fd6 Fix T97543: Changing multipass images doesn't update the image.
Code was partial migrated from the previous image engine. Missing multilayered
images.
2022-05-03 09:12:00 +02:00
56039e30c7 Merge branch 'blender-v3.2-release' 2022-05-03 09:10:57 +02:00
38a4d96a90 Fix T97507: Crash when deleting adjustment layer
Issue was not properly fixed in 3cef9ebaf8 due to oversight.
`SEQ_get_channels_by_seq` returned pointer to `seqbase` instead of `channels`.
2022-05-03 08:47:27 +02:00
e4e5d7781e Fix T97547: Stereo rendering crash.
Viewports weren't drawn as they couldn't get a lock. Resulted in compositing
uninitialized viewports. Fixed by checking that both views were drawn.
2022-05-03 08:21:08 +02:00
e62b5e867d Cleanup: spelling in comments 2022-05-03 15:11:27 +10:00
ab7379ae62 Merge branch 'blender-v3.2-release' 2022-05-03 14:58:09 +10:00
4ee8dfa8b3 Fix use after free error when exiting a temp screen
Regression in [0] caused by checking the screen after event handling.

[0]: d4bdf21929
2022-05-03 14:50:40 +10:00
80c8a7dcb0 Merge branch 'blender-v3.2-release' 2022-05-03 13:27:20 +10:00
8810d0cecd Fix T85379: Cube projection size parameter is wrong
The input size was doubled & inverted.
2022-05-03 13:26:46 +10:00
e5a738af6d Merge branch 'blender-v3.2-release' 2022-05-03 09:49:09 +10:00
ecc2ec724e Cleanup: quiet shadow warning 2022-05-03 09:43:56 +10:00
79d4740eda Cleanup: use context.temp_override
Remove use of deprecated operator context passing.

Also minor clarification in the context.temp_override docs.
2022-05-03 09:32:28 +10:00
309b6319a0 Cleanup: quiet unused variable warning 2022-05-03 09:32:27 +10:00
Henrik Dick
fd7384a751 Merge branch 'blender-v3.2-release' 2022-05-02 22:18:21 +02:00
Henrik Dick
62ef1c08af GPencil: Fix envelope modifier deform mode thickness
The thickness in the deform mode was just correct if the radius when
drawing a stroke was set to 20. Now all factors that influence the
stroke thickness are considered in deform mode.

Differential Revision: https://developer.blender.org/D14691
2022-05-02 22:13:38 +02:00
0d9e22d43c GPencil: New Noise modifier random in Keyframes only
This is for some animation styles that usually copy and paste keyframes and they want avoid that both frames look equal, but they don't want noise randomness changes in the inbetween frames.

The patch adds a new random `Mode` option to select when the noise change.

Reviewed By: pepeland

Maniphest Tasks: T97099

Differential Revision: https://developer.blender.org/D14566
2022-05-02 17:36:58 +02:00
b1e0be0d25 Merge branch 'blender-v3.2-release' 2022-05-02 16:06:42 +02:00
ab5d52a6db GPencil: New Sculpt Auto masking options
Now it's possible to use auto masking at 3 levels:

* Stroke
* Layer
* Material

The masking options can be combined and allows to limit the effect of the sculpt brush.

Diff Revision: https://developer.blender.org/D14589
2022-05-02 16:05:04 +02:00
5188c14718 Fix T97688: Deleting a scene with a scene strip causes the referenced scene to have zero users
Relinking code would weirdly enough allow clearing of extra/fake user
status on IDs used by affected ID, which would be utterly wrong.

Fairly unclear why this was working OK in reported case before rBa71a513def20,
could not spot any obvious reason just from reading code...

Also, in `libblock_remap_data_update_tags`, only transfer fake user
status if `new_id` is not NULL (otherwise that would have removed that
falg from `old_id`, without actually transferring it to anything).
2022-05-02 15:58:53 +02:00
263f56ba49 Add RNA accessor for 'extra user' ID tag,
Not expected to be used directly by users, but very handy to have around
for investigations and debugging.
2022-05-02 15:58:53 +02:00
4c3efb4320 Cleanup: fix "parameter unused" warning
No functional changes.
2022-05-02 14:34:31 +02:00
e07ac34b3f Merge branch 'blender-v3.2-release' 2022-05-02 12:21:15 +02:00
Ethan-Hall
3d5f5c2d9a Color Attributes: Add initial fill color option
This patch adds allows the user to select the initial fill color when
adding a new color attribute layer.

---
{F13035372}

Reviewed By: JulienKaspar, joeedh

Differential Revision: https://developer.blender.org/D14743
2022-05-02 12:18:23 +02:00
38394e1a32 GPU: Remove OCIO workaround for Apple.
OCIO shader was ported to use GPUShaderCreateInfo a while ago. That
made this workaround not needed anymore.

Best to remove it before the release.
2022-05-02 12:15:21 +02:00
d0948dfb17 Merge branch 'blender-v3.2-release' 2022-05-02 11:58:20 +02:00
b54c6a20aa Curves: fix brush position is not under mouse cursor
This was mostly noticable in the case of the Delete brush, when
clicking somewhere in empty space. It used the closest point on
a curve as brush position.
2022-05-02 11:36:42 +02:00
1b0da28038 EEVEE: Fix compiler warning 2022-05-02 11:22:57 +02:00
951fae3578 Revert "Blender 3.2 splashscreen"
This reverts commit d1cbfc81bb.
2022-05-02 11:06:38 +02:00
4f3b562506 Revert "Blender 3.2 - Beta"
This reverts commit da46ed9116.
2022-05-02 11:06:21 +02:00
0c80a0acd8 Merge branch 'blender-v3.2-release' 2022-05-02 11:05:53 +02:00
d1cbfc81bb Blender 3.2 splashscreen
Credits: Oksana Dobrovolska
2022-05-02 10:38:59 +02:00
da46ed9116 Blender 3.2 - Beta
* BLENDER_VERSION_CYCLE set to beta
* Update pipeline_config.yaml to point to 3.2 branches and svn tags
* Update and uncomment BLENDER_VERSION in download.cmake
2022-05-02 10:35:39 +02:00
46b32c9d7b Blender 3.3 bcon1 - alpha
Bump the version number for the new release cycle.
2022-05-02 10:28:30 +02:00
12baea1b8e EEVEE: Fix compilation on MSVC 2022-05-02 10:09:46 +02:00
8ece0816d9 EEVEE: Rewrite: Implement nodetree support with every geometry types
This commit introduce back support for all geometry types and all nodetree support.
Only the forward shading pipeline is implemented for now.

Vertex Displacement is automatically enabled for now.

Lighting & Shading is placeholder.

Related Task: T93220

# Conflicts:
#	source/blender/draw/engines/eevee_next/eevee_engine.cc
#	source/blender/gpu/CMakeLists.txt
2022-05-02 09:35:45 +02:00
f0f44fd92f Curves: support spherical delete brush
Differential Revision: https://developer.blender.org/D14797
2022-05-02 09:18:57 +02:00
a5644f9a28 Cleanup: GPUBuiltinShader: Remove old shader interfaces
This leaves some of the unresolved case where we still need both
implementation.
2022-05-02 01:31:24 +02:00
aaab3c8ad4 Cleanup: GPUShader: Make style consistent in builtin_shader_stages 2022-05-02 01:05:35 +02:00
f0118e9aca GPUShader: Remove GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE
This had only one use and it was for debugging. Remove the shader for now.
This also simplifies the debug drawing even if slower.
2022-05-02 00:57:32 +02:00
5e5e198bbe GPUShader: Port 3D uniform color clipped shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-02 00:44:58 +02:00
0676963809 GPUShader: Port dashed line shaders to use shaderCreateInfo
This should have no functional changes.

This reduce the complexity of the shader by only supporting 2 colors.
We never use more than 2 color in practice and this makes usage not require
a UBO.
2022-05-02 00:35:49 +02:00
2a7a01b339 GPUShader: Port polyline shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-01 23:54:41 +02:00
aa34706aac Fix T97545 DRW: Crash cause by invalid " char in glsl source
Some old compiler do not like this character even if inside an `#error`
directive.
2022-05-01 22:42:07 +02:00
3f0c09f6dd GPUShaderCreateInfo: Add validation for overlapping vertex attribute
Those are usually not supported but some driver silently fix them and most
just silently fail (rendering error).
2022-05-01 22:28:38 +02:00
fc872d738e GPUShader: Port 2D widget shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-01 21:12:59 +02:00
a330b9b0ea GL: Add attribute-less shader workaround for MacOS to the backend
This workaround and the issue was described in D4490. This makes sure
any shader using `shaderCreateInfo` will benefit from the same workaround.
2022-05-01 20:54:33 +02:00
631506d9c3 External Engine: Reuse depth only shader from Basic engine
This removes the usage of `GPU_shader_create_from_info_name()`.
2022-05-01 19:35:37 +02:00
eba06fee49 Basic Engine: Port depth shader (object selection) to shaderCreateInfo
This should have no functional changes.
2022-05-01 19:35:37 +02:00
c87f6242b9 Fix T97644: new 3.2 obj importer does not set blend mode for eevee
The old python importer had a "if do_transparency, set blend_method to
BLEND" type of logic. This bit was missing in the new importer; it was
only setting the eevee blend method when a transparency texture was
present, but not in other cases of transparency (as driven by MTL
"illum" mode).

Reviewd By: Howard Trickey
Differential Revision: https://developer.blender.org/D14783
2022-05-01 20:10:21 +03:00
33518f9da1 Fix T97417: OBJ: support tab and other whitespace characters after obj/mtl keywords
Even if available OBJ/MTL format documentations don't explicitly specify
which characters can possibly separate keywords & arguments, turns out
some files out there in the wild use TAB character after the line
keywords. Which is something the new 3.2 importer was not quite
expecting (T97417).

Fix this by factoring out a utility function that checks if line starts
with a keyword followed by any whitespace, and using that across the
importer. Also fix some other "possible whitespace around name-like
parts" of obj/mtl parser as pointed out by the repro files in T97417.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14782
2022-05-01 20:07:03 +03:00
30d1d4579e Cleanup: Overlay: Remove unused extern datatoc and shader library
These are not needed anymore.
2022-05-01 18:47:51 +02:00
6cad9c7964 Overlay: Port particle display shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 18:40:48 +02:00
d02d1129f7 Overlay: Port particle edit shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 18:17:37 +02:00
6861ef62a6 Overlay: Port sculpt mask shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 18:07:16 +02:00
cc268238ea Overlay: Port wireframe shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 17:39:32 +02:00
ba22aa8797 Overlay: Port facing shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 17:14:30 +02:00
e59cc3a814 Overlay: Port gpencil canvas shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 17:07:20 +02:00
d33801e2bf Overlay: Port image empty shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 16:30:51 +02:00
1c992cc647 Overlay: Fix non functional outline on wireframe
This was caused by rB6e5877c189df5d6c2dfcaa44ba4c3c9a8b387998.
2022-05-01 15:37:37 +02:00
0dfb6eddc0 Overlay: Port motion path shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-01 15:37:37 +02:00
0c44b03b09 Overlay: Port 2D image overlay shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-01 15:37:37 +02:00
df0616bcd0 Nodes: Fix T90233
- Fix default_value initialization of custom node tree interface:

  This was crashing when adding a custom interface socket to a tree.
  The node_socket_set_typeinfo function was called too early, creating a
  default float socket, which then doesn't match the socket type after
  changing to the custom type.

  The node_socket_set_typeinfo only allocates and initializes
  default_value when it isn't already set. That is because the function is
  used either when creating new sockets or to initialize typeinfo after
  loading files. So default_value has to be either null or has to be
  matching the current type already.

- Fix RNA flag for string return value of the valid_socket_type callback:

  String return values of registerable RNA functions need a
  PROP_THICK_WRAP flag since they don't have a fixed buffer to write into.
2022-05-01 09:27:22 +01:00
171851a6c8 Material: Hide material output socket Thickness as it is not used for now
This is a EEVEE-Next feature that is not yet implemented. Ideally the
socket should only be displayed when EEVEE is in the selected target
engine.
2022-05-01 10:09:23 +02:00
Nate Rupsis
5ff931149b Updating Graph editor channels pin tool tip
Reviewed By: Blendify

Maniphest Tasks: T97631

Differential Revision: https://developer.blender.org/D14766
2022-04-30 23:12:44 -04:00
12217714c7 Overlay: Port depth only & uniform_color shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 23:56:31 +02:00
86b37748a7 Overlay: Port background shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 23:54:52 +02:00
6e5877c189 Overlay: Port outline shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 23:13:27 +02:00
69a43069e8 Overlay: Port edit gpencil shaders to use shaderCreateInfo
This should have (mostly) no functional changes.

Support for clipping was added to the shaders but it is not enabled for now
as we wait for the Gpencil engine to support clipping.
2022-04-30 21:11:55 +02:00
Germano Cavalcante
57b4efc250 Overlay: port paint shaders to use 'GPUShaderCreateInfo'
Simple port.

Also a description of how each shader is used has been added.

NOTE: The shader created using `OVERLAY_shader_paint_vertcol` cannot be tested.
Apparently it is created but not used.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14812
2022-04-30 14:50:57 -03:00
fc40356ed8 Overlay: Port edit lattice shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 19:35:51 +02:00
a8e6ee17cc Overlay: Port edit curves shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 19:20:37 +02:00
669349bfe4 Overlay: Port edit uv shaders to use shaderCreateInfo
This should have no functional changes.

Removed `antialiasing_vert.glsl` becaus it was actually a duplicate of
`common_fullscreen_vert.glsl`.
2022-04-30 18:25:05 +02:00
b95601fa1a Overlay: Port edit uv shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 17:37:19 +02:00
237857cc26 Overlay: Port volume shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 16:30:09 +02:00
ac88123e29 Fix T96576: Light leaking when using normal maps with Multiscatter GGX
The Multiscatter GGX code was missing the same-side checks for incoming and
outgoing directions w.r.t. to shading and geometry normal.

Should not be needed for the Glass variant since it intentionally has both
reflection and transmission.
2022-04-30 13:49:45 +02:00
5c92c04518 XR: Add object extras, object types visibility session options
This allows object extras such as image-empties to be shown in the VR
viewport/headset display. Being able to see reference images in VR can
be useful for architectural walkthroughs and 3D modeling applications.

Since users may not want to see all object extras (lights, cameras,
etc.), per-object-type visibility settings are also added as session
options.

By slightly refactoring the definition of the 3D View object types
visibility panel (note: no functional changes), the VR Scene Inspection
add-on can show a similar panel without duplicating code. When VR
selection is possible in the future, the object type select options can
also be enabled.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14220
2022-04-30 16:23:43 +09:00
Ramil Roosileht
2fc6563a59 D14808: Use saturation as multiplier for saturation filter
A change proposed in T97697, using existing saturation as a multiplier for the filter operation
{F13038602}

Review By: Joseph Eagar, Julian Kaspar
Differential Revision: https://developer.blender.org/D14808
Ref D14808
2022-04-29 20:12:45 -07:00
eaa63c7d68 Overlay: Port extra shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-29 20:38:42 +02:00
fc2c22e90c Cycles: Hydra fixes for stageMetersPerUnit and OpenGL context on Windows
Add "stageMetersPerUnit" render setting for USD files that have that set to
something other than the default (e.g. exported by Blender).

And fix a crash when an application creates a Hydra render pass on a thread
that does not have an OpenGL context current.
2022-04-29 19:19:39 +02:00
9b92ce9dc0 Cycles: add USD as a file format for Cycles standalone rendering
Long term, this should replace the XML format. This reuses the Hydra render
delegate implementation, and so supports the same features. The same command
line options and GUI work for both XML and USD also.

The implementation of this is still disabled, waiting for some refactoring of
USD library linking. However we want the Cycles code to be in sync between
repositories for the 3.2 release.

Ref T96731
2022-04-29 19:19:19 +02:00
060a50a5f7 Cycles: refactor Hydra render delegate building
* Leave code for building the render delegate against other applications and
  their USD libraries to the Cycles repository, since this is not a great fit.
  In the Blender repository, always use Blender's USD libraries now that they
  include Hydra support.
* Hide non-USD symbols from the hdCycles shared library, to avoid library
  version conflicts.
* Share Apple framework linking between the standalone app and plugin.
* Add cycles_hydra module, to be shared between the standalone app and plugin.
* Bring external libs code in sync with standalone repo, adding various missing
  libraries.
* Move some cmake include directories to the top level cycles source folder
  because we need to control their global order, to ensure we link against the
  correct headers with mixed Blender libraries and external USD libraries.
2022-04-29 19:03:06 +02:00
074a8558b7 Fix rendering of wire curves when used as custom bone objects
In the current code we do not render any curves if they have not been
converted to meshes. This change makes the custom bone drawing try to
render mesh objects first and then falls back to curve objects if there
is no mesh data available.

Reviewed By: Clement

Differential Revision: http://developer.blender.org/D14804
2022-04-29 18:22:32 +02:00
3eb9b4dfbc Windows: make.bat change python detection order
Given we are officially on 3.10 now, look
for that version first, followed by any future
version before falling back to 3.9
2022-04-29 10:13:01 -06:00
a6f951b464 Cycles: make Hydra display driver optional, for USD without OpenGL
OpenGL support was removed from Blender's USD precompiled libraries. This
is currently only useful when building against other applications anyway.
2022-04-29 18:08:41 +02:00
e0315a5ef0 Cycles: add profiling command line argument to standalone
Like --cycles-print-stats for Blender.
2022-04-29 18:08:41 +02:00
1a8a69d318 Cleanup: Fix harmless runtime error about null pointer in Outliner tree code.
While the reference would never be used in case of NULL pointer, this
bit of code was not really clear and nice, so make it less ambiguous
now. Also add early return in case a NULL idv pointeris actually passed.
2022-04-29 17:57:46 +02:00
3c7a6718dd Fix T95480: Crash when relocating libraries in some cases.
While code deleting old (relocated to new ones) IDs would work fine in
typical cases, it would fail badly in others, when e.g. drivers would
create 'reversed' dependency from the obdata ID to the object ID.

This commit uses a less efficient, but much safer method. It also
ensures no relocated old IDs is left over in the file (previous version
could easily leave some old IDs from the old library until a full
save/reload cycle happened).
2022-04-29 17:57:46 +02:00
4d464a946a Fix (unreported) library relocating code making indirectly linked IDs direct.
While relatively minor issue, it could become fairly annoying in a big
project, since once an ID is tagged as directly linked it tend to remain
as such.

Now also force indirect tagging when loading new IDs as part of a lib
relocation process, since the ones actually directly linked will be
tagged as such later on.
2022-04-29 17:57:46 +02:00
d779b15485 Fix (unreported) bad handling of ID usercount increment in remapping code.
While this only had minor potential effect, both code incrementing
usercount of newly remapped IDs were wrong.

Original one would by-pass any 'ensured user' handling, newer one would
systematically make the ID directly linked...

`id_us_plus_no_lib` is to be used here.
2022-04-29 17:57:46 +02:00
f44a34fc55 BKE_lib_remap: add comment note about some remapping options.
Fact that those options are only used in a specific case, and that the
same behavior is ensured in a different part of the code in other cases,
is fairly confusing and unfortunate... At least document it.
2022-04-29 17:57:46 +02:00
3b7bce45d2 Fix T97686 DRW: Freeze when switching to material preview or render view
This was caused by the compilation job being created suspended (to avoid
UI slowdown because of the material Preview Icons). The suspended job
wasn't passing the `WM_jobs_test` in `DRW_deferred_shader_remove` and
the material would still be in the compile queue with its status equal to
`GPU_MAT_QUEUED`. This would block the main thread in the waiting loop.
But since the job manager timer needs to execute in the main thread, the
compilation job was never being pushed out of its suspended state.
This lead to a complete lock situation.

The solution is to use `WM_jobs_customdata_from_type` which does exactly
what we need.

Also fixed a nullptr free.
2022-04-29 17:57:38 +02:00
9ef727d3d4 Cycles: make internal integrator defaults match Blender more closely
This does not affect Blender integration, but gives better defaults for
Cycles standalone.
2022-04-29 17:39:04 +02:00
0634bb24ee Cleanup: remove unused server app after network render was removed 2022-04-29 17:39:04 +02:00
0c317e23bf Cleanup: fix various Cycles build warnings with non-default options
* Float/double promotion warnings were mainly meant for avoiding slow
  operatiosn in the kernel. Limit it to that to avoid hard to fix warnings
  in Hydra.
* Const warnings in Hydra iterators.
* Unused variable warnings when building without glog.
* Wrong camera enum comparisons in assert.
* PASS_UNUSED is not a pass type, only for pass offsets.
2022-04-29 17:39:04 +02:00
5d84d9b0d6 Cleanup: Simplify job custom data query API
There were two calls to access job's custom data. One of them
ignored job type, the other one ignored job owner.

Now there is a single function to access job's custom data.
If the job type or owner is not relevant NULL or WM_JOB_TYPE_ANY
can be passes explicitly.

Differential Revision: https://developer.blender.org/D14803
2022-04-29 16:49:52 +02:00
2f49908a5e NLA: Key influence when pushing down to NLA
When pushing down an Action onto an NLA track, set the new Strip's
influence to the Action's influence. This is done by setting a key due
to the way the NLA Strip influence works (it's either animated, or
ignored).

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D14719
2022-04-29 16:28:02 +02:00
baae87ce86 Fix: Incorrect custom data maxlayers in rare files
For a single day in 2015 between rBff3d535bc2a6309 and rB945f32e66d6ada,
custom data structs could be written with an incorrect maxlayer field.
This means that custom data structs read from those files would think
they have more space to add new layers than they actually did, causing
a crash if more layers were added. This was found while investigating
a crash from D14365 which adds new face corner layers in versioning.

The fix is to reset all maxlayer integers to totlayer, which is
done when writing files in current Blender anyway.

The file tests/render/motion_blur/camera_zoom_blur_perspective.blend
has this problem as it was added on 2015-07-21, right between the two
commits. Adding three custom data layers in versioning code would crash.

The problem was originally found and investigated by Martijn Versteegh
(@Baardaap), thanks!

Differential Revision: https://developer.blender.org/D14786
2022-04-29 09:20:10 -05:00
473a2c83ea Cleanup: fix unused parameter warning
Fix 'unused parameter' warning when building without OpenColorIO.

No functional changes.
2022-04-29 16:13:23 +02:00
a7db7f88b0 Fix CMake error in new builds after previous NanoVDB fix 2022-04-29 15:38:21 +02:00
1d9c050188 Fix wrong cast from uint to int (2)
Error in rB3d877c8a0d06
2022-04-29 10:22:49 -03:00
a323ada701 Fix wrong cast from uint to int
Error in rB3d877c8a0d06
2022-04-29 10:19:58 -03:00
Demeter Dzadik
7fd11d9c7f T95386: Add Discontinuity (Euler) filter to Dope Sheet.
Add the Discontinuity (Euler) Filter operator to the Dope Sheet->Key
menu, so it's not only available from the Graph Editor->Key menu. On
request of @pablico, see T95386.

This required changing a poll function which is used by a bunch of other
operators, which seemed scary at first, but my thinking is that if an
operator can execute in the Graph Editor, then it should also be able to
execute in the Dope Sheet. I think the only reason this wouldn't be true
is if we were storing animation data in the UI itself, which of course
we don't. So I hope this is okay.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14015
2022-04-29 15:17:27 +02:00
3d877c8a0d Select Engine: port shader to use 'GPUShaderCreateInfo'
Simple port with a few cosmetic changes:
- Attribute named "color" for indices VBO is now called "index"
- The indices VBO is now composed of `int`s instead of `uint`s (this simplifies the source)

Differential Revision: https://developer.blender.org/D14800
2022-04-29 10:15:04 -03:00
a111a0f1e1 Fix missing NanoVDB patch for HIP support, after unifying with OpenVDB
This patch has also been contributed upstream, so will not be needed anymore
soon. Also automatically clear cached variables for new nanovdb location in
libs.
2022-04-29 15:12:46 +02:00
a1b21a3503 CMake: harvest nanovdb from its new location
NanoVDB is now bundled with OpenVDB (since rBb9c37608a9e) instead of a
separate package.

This still doesn't include our patch to support AMD HIP; that'll be
committed separately soon.
2022-04-29 14:34:25 +02:00
d442782dbe Fix Cycles versioning code after recent change
Need to use get() instead of is_property_set() for properties
which are not defined as Property.
2022-04-29 11:49:53 +02:00
62eb190d4e Cleanup: Remove old filter property.
It was kept for forward compatibility during 2.7x.

Reference rB5a45ccaf3e5102ee571599fa9f26a78ac1f6d0f4
2022-04-29 10:36:19 +02:00
fcb0090842 GLState: Avoid possible undefined behavior in state comparison
The bitwise XOR used to compute the delta (`changed`) might produce NaN and
thus produce undefined behavior when comparing to another float (because of
float promotion).
2022-04-29 09:10:07 +02:00
65e7219706 Fix T97097: Color filter saturate affects non-colors
Saturation is now tested for > 0.001 instead of != 0.
We may wish to turn the limit into an operator property
in the future.
2022-04-28 23:24:10 -07:00
cc8fe1a1cb Fix T97120: Gizmo fails to select in orthographic view
Regression in exposed by 49fc4449e7.
2022-04-29 16:21:23 +10:00
7f0163118b Fix T97608: Sculpt sample color op is missing pmap
Add missing call to BKE_sculpt_update_object_for_edit.
2022-04-28 23:19:06 -07:00
720e19a833 Fix T62945: Hotkeys not showing up in brush tooltips 2022-04-28 23:13:53 -07:00
9dadd8bdb1 Fix T97124: Area light size gizmo unselectable
Workaround for MS-Windows NVidia/LLVMPipe combination failing to select
the gizmo unless depth-test was used.
2022-04-29 13:13:30 +10:00
0b5cf91b89 Cleanup: use 'use_' prefix for RNA boolean 2022-04-29 09:43:03 +10:00
1e23304fbc Cleanup: missing declaration warnings & spelling in comments 2022-04-29 09:27:46 +10:00
9a25a34e42 shader_builder: fix build issue on windows
shader_builder had no manifest set, leading
to the classic common control version being
loaded which in turn caused an import error
and made the executable fail to initialize.
2022-04-28 16:57:46 -06:00
4b96517e20 Build: disable Metal for USD libraries also, it fails to build without OpenGL
This only affects macOS.

Ref D14792
2022-04-28 23:49:56 +02:00
f38f12cbbc Cleanup: silence unused variable warnings 2022-04-28 18:41:44 -03:00
810f33d434 Fix: Missing translation in node socket inspection 2022-04-28 15:11:26 -05:00
Ethan-Hall
708fabe3d7 Fix: Socket inspection error for data-block sockets
After rB47276b847017, for certain socket types such as object or
material, the name of the item is not obtained correctly leading
the tooltip to display random non-character memory values as text.

Differential Revision: https://developer.blender.org/D14762
2022-04-28 15:06:24 -05:00
8095875dff Fix T97151: Curve vertex parenting crash with dependency cycle
When the object's position depends on the geometry and the geometry
depends on the object's position, we can't count on the object's
evaluated geometry to be available. Lattices and mesh objects have
equivalent checks in this vertex parenting function.

Differential Revision: https://developer.blender.org/D14781
2022-04-28 14:58:52 -05:00
4b7ed584a8 Cleanup: Overlay: Avoid local variable shadowing 2022-04-28 21:44:15 +02:00
d5f3351f55 Overlay: Port UDIM Grid shader to shaderCreateInfo
Simple Straight forward port.
2022-04-28 21:43:54 +02:00
308a12ac64 Overlay: Port Grid shader to shaderCreateInfo and other code cleanup
Along with the port to createInfo this also:
- Packs constant uniforms in a UBO.
- Share enum declaration and unify names
- Makes codeflow easier to undestand.
- Split grid data to its own struct.

# Conflicts:
#	source/blender/draw/engines/overlay/overlay_grid.c
2022-04-28 21:13:04 +02:00
3d9f0280ff Fix T93899: Incorrect decorator buttons for geometry nodes vector/colors
For properties exposed to the geometry nodes modifier, decorators didn't
work at all for colors and it only worked on the X component of vectors.
The fix is to use -1 for the RNA index of the decorator button instead
of 1, which lets the UI code figure out what to do with arrays.
2022-04-28 13:46:42 -05:00
Ethan-Hall
1425b356b8 UI: Fix consistency issues with attribute tooltips and icons
This patch modifies tooltips of attributes and UV maps to resolve
inconsistencies. It also restores the vertex color icon that went
missing from the UI lists when color attributes replaced vertex colors.

Fixes T97614

Differential Revision: https://developer.blender.org/D14768
2022-04-28 13:08:52 -05:00
c722993ef1 Fix T94467: Cycles baking of normal pass slower than before cycles-x 2022-04-28 19:55:12 +02:00
5b1ec08f04 Fix T93546: Fill curve node ignores last point of non-cylic curves
The node is meant to consider all curves cyclic, which means that it
shouldn't account for one fewer segment on non-cyclic curves.
2022-04-28 11:50:55 -05:00
2d7957727c Fix: Incorrect conversion from C bitfield syntax
Recent cleanups 9a8669ac81 and 1c790555a0
incorrectly interpereted the bitfield width syntax as a default
value. Also resolve two other compilation warnings.
2022-04-28 11:19:12 -05:00
Sebastian Herholz
fbc884d2a8 Ensure BSDF evals and pdfs are zero on invalid samples
Currently, the `eval` and `pdf` are not explicitly set to zero when a BSDF sample is invalid (e.g., below the upper hemisphere), when calling
`bsdf_sample` or `bsdf_eval`. It is assumed that `eval` and `pdf` are set to zero before these functions are called, which can cause problems if not.

This patch fixes this potential problem by explicitly setting `eval` and `pdf` to zero when the sampled direction is invalid.

I also added a sanity check if `eval` and `pdf` are valid (i.e., >= 0.f).
The check is activated when build in debug mode and with the `WITH_CYCLES_DEBUG` set to `ON`.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D14776
2022-04-28 18:14:06 +02:00
Sebastian Herholz
bd327e3bf3 Fix: Sky models can return negative values
When converting from XYZ to RGB it can happen, in some sky models, that the resulting RGB values are negative.
Atm, this is not considered and the returned values for the sky model can be negative.

This patch clamps the returned RGB values to be `= 0.f`

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D14777
2022-04-28 18:14:06 +02:00
Christophe Hery
110eb23005 Fix T97056: Cycles MNEE caustics treated as direct instead of indirect light
This fixes wrong render passs and bounce limits.

Differential Revision: https://developer.blender.org/D14737
2022-04-28 18:00:11 +02:00
4296c1fe25 Fix T97142: When Exporting GPencil, File Dialog Shows No Subfolders
The export had missing the `FILE_TYPE_FOLDER` flag.
2022-04-28 17:58:24 +02:00
099120e54a Cleanup: Fix compiler warnings 2022-04-28 10:53:50 -05:00
Ethan-Hall
024386bb89 UI: Improvements to "Add Color Attribute" menu
Allow the session to save the choice for domain and data type since
it is highly likely that the user intends to use the same settings
for subsequent color attributes.

Use expanded button selectors for domain and data type since there
are only two options for each.

Differential Revision: https://developer.blender.org/D14785
2022-04-28 10:47:23 -05:00
f4718d52f3 Snap Gizmo: update props using gizmo's snap_state
A snap state can be replaced by another snap state of a gizmo or cursor.

The snap gizmo should only change its state, not the current state.

It's not really a problem currently.
2022-04-28 12:41:50 -03:00
16b6d4aeb3 Deps:Specify versions for implicit python modules
D14686 added autopep8 which implicitly dragged in
toml and pycodestyle which were not versioned, this
diff adds explicit versions of these deps so there
won't be any version changes if we rebuild in the
future.

Reviewed By: brecht, sybren

Differential Revision: https://developer.blender.org/D14793
2022-04-28 09:37:22 -06:00
44b318bd22 Fix T97527: multiview camera suffix not working with more than 4 characters
Thanks to Germano Cavalcante for finding the solution.
2022-04-28 17:36:07 +02:00
853713336f Fix non-face oriented snap cursor in dragdrop
If the measure gizmo is enabled, its snap state is used in the snap update.

As it does not require a plane, the orientation of the plane is not
calculated.

However, the calculation of the plane's orientation must prevail over
the states.
2022-04-28 12:33:16 -03:00
91bd63a196 CMake: Reduce dependencies of USD
`PXR_ENABLE_OSL_SUPPORT=OFF`: OpenShadingLanguage is an optional
dependency of the Imaging module. However, since that module was
included for its support for converting primitive shapes (sphere, cube,
etc.) to geometry, OSL is not necessary. Disabling it will make it
simpler to build Blender; currently only Cycles uses OSL.

`PXR_ENABLE_GL_SUPPORT=OFF`: GL support on Linux also links to X11
libraries. Enabling it would break headless or Wayland-only builds.
OpenGL support would be useful if someone wants to work on a Hydra
viewport in Blender; when that's actually being worked on, we could
patch in a new PXR_ENABLE_X11_SUPPORT option (to separate OpenGL from
X11) and contribute it upstream.

`PXR_BUILD_OPENIMAGEIO_PLUGIN=OFF`: It's used for loading image textures
in Hydra Storm / Embree renderers which we don't use.

Reviewed By: LazyDodo, brecht, makowalski

Differential Revision: https://developer.blender.org/D14792
2022-04-28 17:16:04 +02:00
22f5c05cb3 Snap Cursor: split 'ED_view3d_cursor_snap_data_get'
Split 'ED_view3d_cursor_snap_data_get' into 'update' and 'get' functions

Sometimes we just want to update and sometimes we just get the result.

Make it clear.
2022-04-28 11:28:37 -03:00
17769489d9 VSE: Add option to limit timeline view height
When height is limited, it is defined by space occupied by strips,
but at least channels 1 to 7 will be always visible. This allows it to
easily overview timeline content by zooming out to maximum extent in Y
axis and panning in X axis.

More channels can be "created" on demand by moving strip to higher
channel. When strip is removed and highest channel becomes empty, view
will stay as is until it is moved down. Then new highest point is
remembered and it is not possible to pan upwards until strip is moved to
higher channel.

Limiting takes into account height of scrubbing and markers area as
well as scrollers. This means that when zoomed out to maximum extent,
no strips are obstructed by fixed UI element.

Fixes T57976

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14263
2022-04-28 16:14:51 +02:00
b1b153b88c Cleanup: Improve const correctness of shape key functions 2022-04-28 09:10:50 -05:00
4412cbc6d1 Cleanup: Make RNA function comment more readable
This complex comment was hard to parse visually.
There was some odd line breaking going on, and together with no
indentation for the continued lines, it was just a blob of text with no
visual structure. You wouldn't see easily where the description of an
argument started or ended.
2022-04-28 16:06:09 +02:00
c9c95201d0 Fix T97679: Retrieving shape key normals modifies vertices
Caused by not using the proper duplicated `MVert` array.
Error in b0aaf6ff4a.
2022-04-28 08:45:31 -05:00
0ad73bb965 Geometry Nodes: Add default attribute name to field inputs/outputs
Geometry node group inputs and outputs get a new property that controls
the attribute name used for that field input/output when assigning the
node group to a modifier for the first time. If the default name is assigned
to an input, the default "Use attribute name" is true .

In order to properly detect when a node group is first assigned,
the modifier now clears its properties when clearing the node group.

Ref T96707

Differential Revision: https://developer.blender.org/D14761
2022-04-28 08:39:30 -05:00
b0e47ffdcf UI: Sort VSE modifiers alphabetically 2022-04-28 14:40:31 +02:00
77794b1a7b VSE: Add precise drag and drop and strip previews
This patch adds the drag and drop strip previews in the VSE.
It also adds two new functions to the drag and drop API.

1. "draw_in_view" for callbacks that wants to draw elements in local viewport coordinates
2. "on_drag_start" that can be used for prefetching data only once at the start of the drag.

Reviewed By: Julian, Campbell

Differential Revision: http://developer.blender.org/D14560
2022-04-28 12:55:51 +02:00
Falk David
16fe767d00 GPencil: Fix offset modifier performance regression
When using an offset modifier on a grease pencil object, the performance
could be impacted due to the randomize option introduced by rB6a2bc40e0131.
Even if the option was not used (offset, rotation, scale set to zero), the modifier
would still compute the random transformation matrix.

The patch checks if the randomization is used and only then caluclates the matrix.

Reviewed By: #grease_pencil, antoniov

Differential Revision: https://developer.blender.org/D14553
2022-04-28 12:38:28 +02:00
e8102aea13 Cleanup: fix warning due to unused variable
This warning exists in gcc 9.4.0, apparently because the variable
is not used in some `constexpr` code paths.
2022-04-28 12:21:39 +02:00
37ede15e63 Blender 3.2 Beta - Subversion bump 2022-04-28 11:40:42 +02:00
Kevin C. Burke
eed8c2e655 Fix T96476: Equalize Handles not working on all keyframes
As the default handle type in Blender is 'Auto Clamped' the Equalize
Handles operator will often appear to have no affect on the selected
keyframes on which it is run. If either of the keyframes' handle types
are 'Auto', 'Auto Clamped', or 'Vector', this patch will convert the
handles to 'Aligned'.

Reviewed By: sybren

Maniphest Tasks: T96476

Differential Revision: https://developer.blender.org/D14345
2022-04-28 11:15:50 +02:00
198a763944 Cleanup: spelling in comments
Also use back-slashes for doxy commands.
2022-04-28 14:03:49 +10:00
eb4b79c556 Cleanup: unbalanced doxy sections, add some sections 2022-04-28 14:03:47 +10:00
9e2d80c49e Cleanup: format 2022-04-28 14:03:46 +10:00
74a44e816c Fix error holding stack memory in a uniform
Caused by db622b5a0b
2022-04-28 13:59:20 +10:00
8399375098 Cleanup: Reword comment, rename variables
Use "transform" instead of "obmat", because the meshes
don't necessarily come from objects.
2022-04-27 18:53:56 -05:00
52a5f68562 Revert "Cycles: Enable inlining on Apple Silicon for 1.1x speedup"
This reverts commit b82de02e7c. It is causing
crashes in various regression tests.

Ref D14763
2022-04-28 00:46:43 +02:00
3558f565f1 Fix T97498, T97651: crash in Cycles with TBB 2021 after recent changes 2022-04-28 00:24:13 +02:00
0539208f97 Fix T97666: Blender not starting on macOS 10.14 after library upgrade 2022-04-28 00:24:10 +02:00
e2cd5c6748 EEVEE: Add shader compilation progress in the viewport
Since rBfa43c47c7cb8446b632a4c0f712162ba615fe51f the progress bar do not
show the compilation progress. This was misleading as users could think
it could be canceled or prevent rendering.

Now we just show how many shaders are still in the compilation queue inside
each viewport. This number is more accurate than the percentage that was
previously displayed in the progress bar.
2022-04-28 00:16:18 +02:00
9c82c00b32 GPUMaterial: Rework the deferred compilation to not use double locks
This uses refcounter instead of double thread mutexes. This should be
more robust and avoir use after free situation.

Also remove redundant structures and the use of scene as the job owner.
2022-04-28 00:16:18 +02:00
676198f57f GPUMaterial: Use GPU_MAT_CREATED as a default 2022-04-28 00:16:18 +02:00
c6ce2be496 Fix T97627: Revert Window Redraw When Saving
Removal of the `WM_redraw_windows` call in `wm_file_write` introduced
in rB7a9cfd08a8d7415ff004809cf62570be9152273e as that can cause
crashing while saving from a script.

See D14780 for more details.

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

Reviewed by Campbell Barton
2022-04-27 15:07:34 -07:00
b60f3fe6ad Cleanup: Remove disabled optimization code
Addressing the TODO from the comment isn't a priority at the moment,
and should be solved a bit more generally anyway.
2022-04-27 16:40:30 -05:00
bfb4dcaa1a Fix T97235: PBVH draw cache invalidation bug
The PBVH draw cache wasn't being invalidated in
all cases.  It is now invalidated whenever a PBVH
node's draw buffers are freed.
2022-04-27 13:05:06 -07:00
f3d5114c41 Fix T93285: Wrong instance order when instancing a collection
At least on the Mac, `std::sort` sometimes passes the same value in the
`a` and `b` parameters.

The `true` return is only for cases where `a` is less than `b`.
2022-04-27 11:18:37 -03:00
ce115a2786 GPUCodegen: Fix broken materials after rB478eb3a0e6ed 2022-04-27 16:13:45 +02:00
69a720abb0 Fix broken obj tests from earlier commit
rB08731d70bf66 was not properly checking if subdivision needs to be
evaluated on the CPU.

Thanks Ray Molenkamp for noticing.
2022-04-27 16:02:34 +02:00
478eb3a0e6 GPUCodegen: Keep copy of attribute name in the GPUCodegenCreateInfo
This is to avoid use after free when the `GPUPass` gets compiled after the
original `GPUMaterial` used to create it was freed.

The issue was introduced by rBfa3bd17ae873
2022-04-27 16:01:41 +02:00
c01e33d6ca GPUCodegen: Use spin lock to protect the pass refcounter.
This is not performance critical so using the same global lock should not
pose any issue.
2022-04-27 16:01:41 +02:00
163f6a17e4 Fix T96434: bad performance with viewport statistics and GPU subdivision
The subdivision is always recomputed on the CPU when displaying stats
if the mesh is animated which leads to bad performance.

This caches the subdivision topology counters from the draw code in the
mesh runtime and uses them for the viewport statistics.

Differential Revision: https://developer.blender.org/D14774
2022-04-27 15:30:17 +02:00
08731d70bf Fix T96327: data transfer crash with GPU subdivision
The crash is caused as the subdivision wrapper does not have loop
normals, which are generally computed at the end of the modifier stack
evaluation via `mesh_calc_modifier_final_normals`. (Note that they are
initially computed, but deleted by the subdivision wrapper creation.)

This records in the mesh runtime whether loop normals should have been
computed and computes them alongside the subdivision wrapper.

Differential Revision: https://developer.blender.org/D14489
2022-04-27 14:03:03 +02:00
c5a4159bee Cleanup: format 2022-04-27 14:01:45 +02:00
Jason Fielder
db622b5a0b Metal: GLSL Compatibility - Hosting default uniform values.
There are a number of shaders, most notably grid_frag.glsl, which rely on default assignments to uniform values within shaders. This is not currently supported by the shader uniform push model implemented for the Metal backend, wherein uniform updates are pushed as a singular block of data. Any default assignment would become over-written.

As such, adding assignments of these default values in the high-level, to ensure the correct value is written for all APIs. This likely impacts Vulkan push-constants as well.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14555
2022-04-27 13:00:51 +02:00
cdd4354c81 Metal: MTLTexture core implementation for Metal backend, with minimal surrounding functionality.
This covers implementation of the GPUTexture abstraction for the Metal backend, with additional utility functionality as required.

Some components have been temporarily disabled pending dependencies on upcoming Metal backend components, and these will be addressed as the backend is fleshed out.

One core challenge addressed in the Metal backend is the requirement for read/update routines for textures. MTLBlitCommandEncoders offer a limited range of the full functionality provided by OpenGLs texture update and read functions such that a series of compute kernels have been implemented to provide advanced functionality such as data format conversion and partial/swizzled component updates.

This diff is provided in full, but if further division is required for purposes of code review, this can be done.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14543
2022-04-27 12:36:56 +02:00
68ca12a7fc Fix T96283: last disabled subsurf is used for GPU subdivision
When more than one, consecutive, subdivision modifier is used on a Mesh,
the last subsurf modifier is used for GPU subdivision even though it
might be disabled. This is because retrieving the last subsurf modifier
in the draw code did not check whether the modifier was disabled or not.

To fix this, the session UUID of the modifier which delegated evaluation
to the GPU code is cached and used in the draw to select the right subsurf
modifier.

Differential Revision: https://developer.blender.org/D14488
2022-04-27 10:22:07 +02:00
9a8669ac81 Cleanup: Use bool, remove unnecessary struct keywords 2022-04-26 18:45:40 -05:00
1f270cf99b Snap: Use Map and unique_ptr for snap cache
Use C++ types instead of GHash to make code easier to read and simpler.

Differential Revision: https://developer.blender.org/D14758
2022-04-26 18:33:05 -05:00
b82de02e7c Cycles: Enable inlining on Apple Silicon for 1.1x speedup
This is a stripped down version of D14645 without the scene specialisation optimisations.

The two major changes in this patch are:

- Enables more aggressive inlining on Apple Silicon resulting in a 1.1x speedup and 10% reduction in spill, at the cost of longer pipeline build times
- Revival of shader binary archives through a new ShaderCache which is shared between MetalDevice instances using the same physical MTLDevice. This mitigates the extra compile times via explicit caching (rather than, as before, relying on the implicit system shader cache which can be purged without notice)

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14763
2022-04-26 22:17:16 +01:00
994da7077d Outliner: Add icon column to toggle if library overrides are editable
Adds a column to the right in the Library Overrides Hierarchies view
mode to toggle editability of library overrides.

Note that making a library override non-editable currently involves
clearing all overridden properties. This is an arguable design choice,
we should probably at least warn the user before doing this.

Part of T95802.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D14653
2022-04-26 22:30:33 +02:00
83c8f996f1 UI: Add callback for comparing button identity
The code to compare buttons from the previous to the current frame, to
see if they match (an thus should keep the same state) was quite
generic, and didn't allow much flexibility/customization. For some
cases this isn't enough, and a more specific comparison is needed. Say
if some buttons don't actually store comparable data themselves, only
via the button context. This was the case in D14653.
2022-04-26 22:26:15 +02:00
5fe1624b0e UI: Support setting context for buttons without layout
It was possible to set context pointers for buttons via the layout, but
not for buttons in places where the layout system wasn't used (where
buttons are placed manually). This is needed for buttons in the
Outliner, see D14653.
2022-04-26 22:23:52 +02:00
8016d8a4bd deps_builder/robinmap: remove file copy on windows
- It's not needed, since it's a build time dependency only.
- It was setup to copy to the wrong folder.
2022-04-26 11:02:16 -06:00
296b261299 build_deps.cmd: prevent over-subscription of the cpu.
/maxcpucount:1 and /m are the same option with the latter
one using all cores available, leading to the situation
where msbuild would start N side by side project builds
that all tried to use N cores as well. leading to severe
memory and compute starvation during the deps build.
2022-04-26 10:50:41 -06:00
d8ef52ca47 Fix: some multi-functions are executed more than once
The good thing is that this fix also makes function evaluation a bit faster.
2022-04-26 17:41:16 +02:00
3e7ee3f3bc Geometry Nodes: Move named attribute nodes out of experimental
Remove the experimental option for named attributes nodes show they are
always available.

Ref T91742
2022-04-26 10:18:30 -05:00
ae94e36cfb Geometry Nodes: refactor array devirtualization
Goals:
* Better high level control over where devirtualization occurs. There is always
  a trade-off between performance and compile-time/binary-size.
* Simplify using array devirtualization.
* Better performance for cases where devirtualization wasn't used before.

Many geometry nodes accept fields as inputs. Internally, that means that the
execution functions have to accept so called "virtual arrays" as inputs. Those
 can be e.g. actual arrays, just single values, or lazily computed arrays.
Due to these different possible virtual arrays implementations, access to
individual elements is slower than it would be if everything was just a normal
array (access does through a virtual function call). For more complex execution
functions, this overhead does not matter, but for small functions (like a simple
addition) it very much does. The virtual function call also prevents the compiler
from doing some optimizations (e.g. loop unrolling and inserting simd instructions).

The solution is to "devirtualize" the virtual arrays for small functions where the
overhead is measurable. Essentially, the function is generated many times with
different array types as input. Then there is a run-time dispatch that calls the
best implementation. We have been doing devirtualization in e.g. math nodes
for a long time already. This patch just generalizes the concept and makes it
easier to control. It also makes it easier to investigate the different trade-offs
when it comes to devirtualization.

Nodes that we've optimized using devirtualization before didn't get a speedup.
However, a couple of nodes are using devirtualization now, that didn't before.
Those got a 2-4x speedup in common cases.
* Map Range
* Random Value
* Switch
* Combine XYZ

Differential Revision: https://developer.blender.org/D14628
2022-04-26 17:12:34 +02:00
9a53599180 Geometry Nodes: rename used attributes panel
The new name is `Internal Dependencies`.
* Is more inline with the general goal of the panel.
* Can also show which external objects are used in the node tree in the future.

This name was choosen in the geometry nodes submodule meeting (2022-04-25).

Differential Revision: https://developer.blender.org/D14752
2022-04-26 16:58:53 +02:00
7b16ddeb5a BLI: small optimization to retrieving CPPType from static type 2022-04-26 16:56:21 +02:00
e9334c5df8 Geometry Nodes: Avoid parallel_for_each with a single geometry
The large call stack can be slightly annoying, and it's possible that
invoking TBB in this case corresponds to some overhead like
e130903060.
2022-04-26 09:24:26 -05:00
5c5ec837b3 Utils: Add macro for C++ default arguments in C headers
This macro allows defining a default argument for when the translation
unit is compiled in C++. Otherwise (in C), the argument has to be passed
explicitly.

A couple of benefits:
* Default arguments are a nice quality-of-life feature in C++. It's
  annoying if these can't be used in C++ files, just because the header
  with the function declaration still needs to be C compatible.
* Adds useful information to the API declaration. E.g. that an argument
  can be nullptr.
* Should help us to move to using default arguments more, helping
  readability (arguably)

Used in D14653.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D14654
2022-04-26 15:47:19 +02:00
96bdd65e74 Curves: Support applying geometry nodes modifier
This commit adds support for the curves object to the apply modifier
operator. A warning is added when the evaluated result of the modifier
doesn't contain any curves data.

Differential Revision: https://developer.blender.org/D14730
2022-04-26 08:07:54 -05:00
db45292d8e Cleanup: Move anonymous attribute removal to geometry component
Implementing removal of anonymous attributes with `GeometryComponent`
instead of `Mesh` makes it more reusable for other types like curves.
2022-04-26 08:06:04 -05:00
b7458f909c Curves: add "Curves" to brush names
Differential Revision: https://developer.blender.org/D14748
2022-04-26 13:10:45 +02:00
Colin Marmond
4e57b6ce77 Animation: Sensible frame range for motion paths
Motion paths can now be initialised to more sensible frame ranges,
rather than simply 1-250:

    - Scene Frame Range
    - Selected Keyframes
    - All Keyframes

Reviewed By: sybren, looch, dfelinto, pablico

Maniphest Tasks: T93047

Differential Revision: https://developer.blender.org/D13687
2022-04-26 12:33:35 +02:00
6cf148227b WM: disable redraw timer in background mode
Crashing in background mode was reported as part of T78854,
disable via the poll function to give a useful error in background mode.
2022-04-26 19:21:12 +10:00
2492d9852b Fix memory leak in Context.temp_override
Add missing check as the context override dict may have been copied
since it was assigned, also initialize the context manager with
PyType_Ready, while it didn't cause any errors - it's expected
that all types are initialized.
2022-04-26 16:51:20 +10:00
e0e737b72b Cleanup: line length for Python scripts 2022-04-26 15:16:11 +10:00
e3724d29ff Cleanup: autopep8 2022-04-26 15:03:04 +10:00
802bc8e233 pyproject: enable aggressive, ignore E501 (line wrapping)
Aggressive needs to be enabled for many useful edits to take effect,
the ignore list is currently used to disable edits that may need
further checks/investigation before they're enabled.

Note that aggressive was already enabled for the:
source/tools/utils/autopep8_clean.py script which was previously used
when applying autopep8.
2022-04-26 14:59:41 +10:00
a28fd0ceb5 Correct over allocation in "Fix Vertex Group Deform" operator
The pointer size was incorrectly being used instead of the float size.
2022-04-26 14:33:04 +10:00
6d12bc9e91 Cleanup: use boolean arguments and return values 2022-04-26 14:25:58 +10:00
a9d1b3d7e3 Cleanup: replace in-line swapping with SWAP macro
Also use bool array for true/false values.
2022-04-26 14:24:44 +10:00
a32f447c54 Cleanup: remove NULL check and outdated comment 2022-04-26 14:02:49 +10:00
c63a6d3057 Cleanup: names in text functions
- Use filepath instead of file.
- Use relbase instead of relpath.

In both cases the new names are used more frequently throughout
exiting functions.
2022-04-26 13:59:54 +10:00
0f583d9d60 PyAPI: support persistent handlers for class & static methods
Support methods being used as persistent callbacks.

Resolves T97555.
2022-04-26 13:47:24 +10:00
07e2bd443e Fix bone "auto-name by axis" failure to clip long names
Failure to clip automatic-names meant named could end with a "." for e.g.

Error in [0] meant the clipped text was copied then
immediately overwritten.

[0]: 354e6b9c18
2022-04-26 13:46:04 +10:00
3221766820 Fix string escaping in override versioning and modifier renaming 2022-04-26 13:46:02 +10:00
a003547a37 Cleanup: unused return value warning 2022-04-26 13:46:00 +10:00
3ea6dbfe73 Cleanup: simplify text copying string operations
- De-duplicate txt_new_linen & txt_new_line.
- Don't accept NULL as input for txt_new_linen & txt_new_line
  (callers can pass in an empty string instead).
- Avoid duplicate strlen calls in txt_new_linen.
- Use memcpy when the length of the string is known in txt_delete_sel &
  BKE_text_load_ex.
2022-04-26 13:45:59 +10:00
98ad294d17 Fix: Correctly copy and update curve type counts cache
Missing from f431be224f.
2022-04-25 18:48:35 -05:00
96834a7bac Fix T97595: Modifier attribute output broken for vertex groups
`attribute_try_create` didn't understand that the vertex group
attribute already existed because it only looks for names in custom
data layers when the domain matches. Using `attribute_exists`
unfortunately requires another loop through all attribute names,
but that should be optimized separately in the future anyway.

Differential Revision: https://developer.blender.org/D14756
2022-04-25 16:44:30 -05:00
3b4b2bcb13 Cleanup: Remove redundant vertex normal dirty tags
Applying the coordinates already tags the normals dirty
2022-04-25 16:30:06 -05:00
c20b99b70c Vertex Paint: Fix brush color space
The brush color wasn't being converted
to scene linear space properly.
2022-04-25 13:24:22 -07:00
a8331d8c9d Cleanup: remove unused function parameter 2022-04-25 13:14:07 -07:00
2bc0e8d304 Fix T81452: Incorrect trim lasso radius
Added a fallback path to compute the
cursor radius for when the stroke
starts over a blank area of space
(in which case SCULPT_cursor_geometry_update
fails).
2022-04-25 13:12:04 -07:00
891268aa82 Mesh: Make vertex normal property read-only
This commit makes the `MeshVertex.normal` property read-only.
In practice it already was, since the value could be overwritten at any
time if code requests updated normals, so this just clarifies that
position and avoids misleading users.

Differential Revision: https://developer.blender.org/D14696
2022-04-25 14:50:57 -05:00
8e1b16534d Fix: Incorrect implicit enum conversion
Hardcode Catmull Rom curves for now, since nothing else is implemented.
2022-04-25 14:48:14 -05:00
2fd8fa8f84 Geometry Nodes: Add "Named" to "Remove Attribute" node name
The goal is to be consistent with the other two nodes that deal with
named attributes. Ref T97512
2022-04-25 14:45:12 -05:00
42878ffc26 Fix T97597: vertex paint initialization was
called by weight paint mode,
	    causing a crash
2022-04-25 12:32:03 -07:00
38eed4ada3 Fix T97553: SCULPT_handles_colors_report called for non-sculpt brushes 2022-04-25 12:26:02 -07:00
296d734344 Sculpt: Remove hardcoded setting of
auto-iteration property in mask filter

Note: Auto-iteration is still set manually
for increase/decrease contrast.  These should
probably become their own operators.
2022-04-25 12:15:48 -07:00
185d9627b3 Fix T97423: Make mask filter less confusing
by showing redo panel.

The A hotkey has "auto iteration" enabled by default,
which calculates the number of times to run the filter
using a heuristic based on vertex count.

To make clear to the user what is going on the redo
panel is now shown for the mask filter operator.

NOTE: I discovered the source of the bug where sculpt
operators' redo panels were greyed out.  The name
fed to SCULPT_undo_push_begin must match the operator
name.  I've added a comment in sculpt_intern explaining
this.
2022-04-25 12:07:55 -07:00
f431be224f Curves: Cache the number of curves of each type
Remembering the number of curves of every type makes it fast to know
whether processing specific to a single curve type has to be done.
This information was accessed in quite a few places, so this should be
an overall reduction in overhead for the new curves type.

The cache is computed eagerly, in other words every time after changing
the curve types. In order to reduce verbosity I added helper functions
for some common ways to set the types.

Differential Revision: https://developer.blender.org/D14732
2022-04-25 13:40:07 -05:00
845e2ed3a2 Cleanup: Use const for smoot scrolling function 2022-04-25 18:15:14 +02:00
e99cb91530 Transform Snap Refactor: dedicate ghash to different SnapData types
Changes:
- Remove `BLI_memarena` (Use `MEM_cnew` and `MEM_delete` to allocate cached data)
- Implement `snap_object_data_mesh_free_ensure` and `snap_object_data_editmesh_free_ensure` and skip need to get original key Object for editmesh data
- Use `BMEditMesh` as key for editmesh `Ghash`
- Make a better distinction between `SnapObjectData`s. (`SnapData_Mesh` and `SnapData_EditMesh`)
2022-04-25 12:40:01 -03:00
d30f701e84 Cleanup: Turn some 'eTFlag' into macros
Some of the enum values are a mixture of others and make it difficult
for the IDE to identify them.

Separating these values makes debugging easier.
2022-04-25 12:35:56 -03:00
35dc4ba9e2 Fix T97401: Snap options ignored for Nurbs surfaces
The editing data of a `SURF`s is similar to that of Curves and should be supported for snapping.

But unlike Curve objects, for snapping, only support the nurb points if the object is in edit mode.

This matches the solution for Meshes and avoids having to create a kind
of "boundbox" for the SURF nurb points.
2022-04-25 12:35:55 -03:00
6963703801 Nodes: show overlays in node editor even when nodes are collapsed 2022-04-25 16:39:13 +02:00
2b3f7c6481 Geometry Nodes: improve attribute dependency overlay
* Adjust width based on node width, necessary to make the longer name below work.
* Show "X Named Attributes" in the overlay.
* Use "Accessed named attributes" in the tooltip.

Differential Revision: https://developer.blender.org/D14751
2022-04-25 16:28:26 +02:00
09710d5f2a Geometry Nodes: show timing overlay above attributes overlay 2022-04-25 16:03:34 +02:00
26afa23b3b Fix: use natural string sorting for attribute names 2022-04-25 16:00:58 +02:00
c2751f8a11 Cleanup: fix unused variable warning in paint_vertex.cc
No functional changes.
2022-04-25 16:00:15 +02:00
654bc35bc8 Geometry Nodes: improve ui when trying to remove built-in attributes
* If removing an attribute failed (even though it exists), don't log it as being used.
* Make warning message a bit more informative.

Differential Revision: https://developer.blender.org/D14750
2022-04-25 15:52:38 +02:00
Pratik Borhade
0a86ab6639 Fix T96925: Fast diagonal movement in walk navigation
View moves faster with two active directions.
This is probably because `dvec` is not normalized when moving in two directions.
Normalizing this direction vector will fix the problem.

Differential Revision: https://developer.blender.org/D14729
2022-04-25 15:46:00 +02:00
Brecht Van Lommel
d2a01bb7cb Build: add autopep8 to bundled Python packages
For use in "make format" to automatically format Python code, see D14686.

Differential Revision: https://developer.blender.org/D14716
2022-04-25 15:45:03 +02:00
0310638e94 Fix build error on Linux + Clang 10 after recent changes to BLI_any
Differential Revision: https://developer.blender.org/D14749
2022-04-25 15:38:20 +02:00
ab032fba39 CMake: harvest zero-level SO files
Zero-level is built as shared library at the moment, so better to harvest
`*.so*` instead of `*.a`.
2022-04-25 15:26:37 +02:00
42368f2ef4 Revert "CMake: add harvesting of fmt library"
This reverts commit 7c55a7ccca. `fmt` is
only a build-time OIIO dependency and doesn't need to be bundled with
Blender.
2022-04-25 14:37:01 +02:00
1640fbe7c6 CMake: add ^NANOVDB to variables to reset after library upgrade
Cycles needed this to build properly after switching to the newly built
libraries.
2022-04-25 14:28:06 +02:00
7c55a7ccca CMake: add harvesting of fmt library
The library was built with `make deps`, but not installed. Now it is.
2022-04-25 14:26:42 +02:00
b4a4004fb1 Fix memory leak in cryptomatte
Since cbf033c055 the `matte_id` will be allocated in the node
storage for the forward compatibility purposes. However, this
field was never freed, leading to memory leak.

Causes annoying popup on macOS when running Cycles tests,
for example render_passes_cryptomatte_asset.blend

Differential Revision: https://developer.blender.org/D14728
2022-04-25 12:00:51 +02:00
a2d32960b4 BLI: optimize constructing new virtual array
Differential Revision: https://developer.blender.org/D14745
2022-04-25 11:51:34 +02:00
Brad Clark
c63d64a2ce NLA: Add Bake Action to the NLA edit menu
Add Bake Action to the NLA edit menu to aid discoverablity and allow
people to understand that Bake Action is part of working with the NLA.

Part of the NLA road map improvement project for the Animation Module.
This was a community request to add access to the Bake without needing
to turn on developer tools in the preferences and then use search in the
NLA for bake.

It seems this was always intended, as the operator is called `nla.bake`.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14575
2022-04-25 11:42:46 +02:00
416ef3b6b2 Cleanup: spelling in comments 2022-04-25 16:37:42 +10:00
0efe581a5b Cleanup: add missing doxy sections in customdata 2022-04-25 16:34:28 +10:00
29b9187b32 VSE: Update first thumbnail when moving handle
When handles are moved, job is created only for strips that need to
update first thumbnail.

ref T91618
2022-04-25 04:34:15 +02:00
17eb8a9ceb Cleanup: remove special cases for getting internal span or single
Those are handled in the called function already.
2022-04-24 14:33:33 +02:00
dc7f88fd15 BLI: prioritize detecting single values higher than detecting spans
In some contexts, single values can be handled more efficiently than spans.
2022-04-24 14:32:03 +02:00
bba757ef81 Cleanup: various minor changes
- Add missing doxy-section for Apply Parent Inverse Operator
- Use identity for None comparison in Python.
- Remove newline from operator doc-strings.
- Use '*' prefix multi-line C comment blocks.
- Separate filenames from doc-strings.
- Remove break after return.
2022-04-24 13:41:03 +10:00
a6504aa64b Cleanup: clang-format 2022-04-24 13:41:03 +10:00
99fff90eab pyproject: remove settings that cause other uses of autopep8 to fail
While the ability to run `autopep8 .` to format Blender's Python code
is handy, the settings to perform this can conflict with other uses
of autopep8 (which editors may use to auto-format on save).

Some arguments now need to be passed in, e.g:

    autopep8 . --in-place --recursive --jobs=0

We'll likely include this in `make format` convenience target so the
details for invoking autopep8 shouldn't be an issue in the long term.
2022-04-24 13:41:02 +10:00
c486da0238 Mikktspace: Reduce number of data queries to caller
The current code for computing tangents is not exactly fast.
This has been a long-standing issue, and recently came up again with T97378.

The main bottleneck is fetching the mesh data, since it's handled through a callback system and each vertex might have its data queried dozens of times.

I've tried a lot of things to optimize `mikktspace.c`, but unfortunately most weren't that useful:
- Vectorizing SVec3 gives a ~5% speedup, but I'm not sure if the additional ~70 lines of code are worth it
- Keeping an internal copy of the data instead of re-querying all the time helps a lot (~50-60% time reduction), but requires a lot of extra memory (~100 byte per face)
- Going C++ and replacing the internal quicksort with std::sort shows no difference
- Restructuring the entire file to be a header-only library so that the callbacks can be inlined gives ~10% reduction, but is a major change and deviation from the original library

In the end, two simple fixes that actually help remain:
- Don't re-query the number of faces in each loop iteration
- Don't bother looking for identical vertices if there's only one vertex with that hash

With this, time for the test case in T97378 goes from 6.64sec to 4.92sec. It's something I guess.

I feel like completely refactoring this library would not be a bad idea at some point, but for now it does the job...

Differential Revision: https://developer.blender.org/D14675
2022-04-23 15:09:41 +02:00
cfce5a32a7 Fix a failing bmesh_bevel test by fixing buffer overflow.
The uv fix just submitted had a bug where I forgot to wrap around
after adding 1. This apparently worked anyway in a debug build
but not in release build, hence the buildbot tests were failing.
2022-04-22 22:39:05 -04:00
6787cc13d4 Bake: add UDIM tile baking support
Works for both Cycles and multires bake. Triangles are baked to multiple
UDIM images if they span across them, though such UV layouts are generally
discouraged as there is no filtering across UDIM tiles.

The bake margin currently only works within UDIM tiles. For the extend method
this is logical, for the adjacent faces method it may be useful to support
copying pixels from other UDIM tiles, though this seems somewhat complicated.

Fixes T95190

Ref T72390
2022-04-22 23:15:45 +02:00
bdc537e0a7 Fix deprecation warning when building with OpenVDB 9
Based on patch by Sebastian Parborg.
2022-04-22 23:15:41 +02:00
ac8beb4fda Fix T97453: Blender crash when selecting Caching checkbox in VSE
Merge Audaspace fixes from upstream.
2022-04-22 22:36:04 +02:00
ff6098345a Cleanup: Clang tidy, unused variable warnings
Also remove unnecessary uses of `struct` and add const in one place.
2022-04-22 12:41:25 -05:00
7f726b48ac Cleanup: Remove unused variables, adjust comments 2022-04-22 11:48:53 -05:00
Olivier Maury
58be9708bf Cycles: removed UV requirement for MNEE, along with fixes and cleanups
Remove need for shadow caustic caster geometry to have a UV layout. UVs were
useful to maintain a consistent tangent frame across the surface while
performing the walk. A consistent tangent frame is necessary for rough
surfaces where a normal offset encodes the sampled h, which should point
towards the same direction across the mesh.

In order to get a continuous surface parametrization without UVs, the
technique described in this paper was implemented:

"The Natural-Constraint Representation of the Path Space for Efficient
 Light Transport Simulation" (Supplementary Material), SIGGRAPH 2014.

In addition to implementing this feature:
* Shadow caustic casters without smooth normals are now ignored (triggered
  some refactoring and cleaning).
* Hit point calculation was refactored using existing utils functions,
  simplifying the code.
* The max number of solver iterations was reduced to 32, a solution is
  usually found by then.
* Added generalized geometry term clamping (transfer matrix calculation can
  sometimes get unstable).
* Add stop condition to Newton solver for more consistent CPU and GPU result.
* Add support for multi scatter GGX refraction.

Fixes T96990, T96991

Ref T94120

Differential Revision: https://developer.blender.org/D14623
2022-04-22 18:31:15 +02:00
d8abac7357 LibOverride: Add hierarchy creation from IDTemplate UI widget.
This is fairly tricky to perform, since there is often very limited
contextual information available about the 'active' hierarchy to
override.

This commit is a first step, it is expected to handle decently well
cases like objects and obdata (recreating necessary object and
collection hierarchy, and/or hooking it to a potential existing
hierarchy), at least in most common cases.

Ref: {T95707}.
2022-04-22 18:22:58 +02:00
e96623c19b Fix: Build error on macOS after previous commit 2022-04-22 11:21:19 -05:00
b38491b407 Re-fix some comments in bmesh_bevel.c.
The UV fix just committed had gotten out of sync with some changes
that had been made inside some comments (spelling and folding).
2022-04-22 11:59:05 -04:00
5b87862ddc Curves: Further split of curves draw code from particles
Extends the changes started in f31c3f8114 to completely separate
much of the DRW curves code from the particle hair drawing. In the short
term this increases duplication, but the idea is to simplify development
by making it easier to do larger changes to the new code, and the new
system will replace the particle hair at some point.

After this, only the shaders themselves are shared.

Differential Revision: https://developer.blender.org/D14699
2022-04-22 10:44:01 -05:00
Martijn Versteegh
8f05a547d5 BMesh: Add additional attribute access macros
Add macros to get/set boolean attributes, to set float2/float3
attributes and to get float2/float3 attributes via pointer access.
Needed for D14365 and further generic attribute integration.

Differential Revision: https://developer.blender.org/D14708
2022-04-22 10:35:44 -05:00
984cd552f0 Fix T56625: Bevel sometimes made zero area UV faces.
This substantially redoes the logic by which bevel chooses, for
the middle segment when there are an odd number of segments,
which face to interpolate in, and which vertices to snap to which
edges before doing that interpolation. It changes the UV layouts
of a number of the regression tests, for the better.
An example, in the reference bug, is a cube with all seams, unwrapped
and then packed with some margin around them, now looks much
better in UV space when there are an odd number of segments.
2022-04-22 11:32:27 -04:00
a7c65ef4cb Fix T96498: Modifiers affect multiple curve objects
The original mistake I made in b9febb54a4 was thinking
that the input curve object data to `BKE_displist_make_curveTypes`
was already copied from the original. I think I misread some of its
`ID` flags. This commit places the result of curves evaluation in a
duplicated curve instead, and copies the edit mode pointers
necessary for drawing overlays. `Curve` needs to know not to
free those pointers.

I still don't have a full understanding of why some of the tactics I've
used work and others don't. I've probably tried around 8 different
solutions at this point, and this is the best I came up with.

The dependency graph seems to have some handling of edit mode
pointers that make the edit mode overlays work if the evaluated
result is only an empty curve created by the evaluated geometry set.
This doesn't work with the current method and I need to set the
edit mode pointers at the end of evaluation explicitly.

We're constrained by the confusing duality of the old curves system
combined with the new design using the evaluated geometry set.
Older areas of Blender expect the evaluated `Curve` to be a copy
of the original, even if it was replaced by some arbitrary evaluated mesh.

Differential Revision: https://developer.blender.org/D14561
2022-04-22 10:27:15 -05:00
75aa5ecbda Fix (unreported): Placement Tool not orienting the Object to normal
Regression introduced in
{rB721335553ccb5ce4f7a374b958b7d65befa319df}.

`plane_omat` is only computed if `snap_state->draw_plane` is `true`.
2022-04-22 12:15:13 -03:00
fe43c17083 Fix: Assert failure with certain screw modifier settings
Caused by a typo/mistake in rB6a3c3c77b3ebdbcd4455.
2022-04-22 10:03:36 -05:00
024a4da6b3 Fix various typos and other UI messages issues. 2022-04-22 16:19:05 +02:00
535c9308ef Fix T97429: Translateable Unit Names Missing in the File.
Added some regex magic in i18n py module to also extract UI names from
all of our units definitions.

Those enum values are fully dynamically generated, so they cannot be
extracted from RNA introspection.
2022-04-22 16:19:05 +02:00
Ramil Roosileht
50f0103059 Change vertex paint icon color (fix)
Apply standard green tool color to vertex paint tools, to keep icon
color palette more consistent

https://developer.blender.org/D14694
2022-04-22 15:53:43 +02:00
9c279723da Fix Data Transfer Projected Face/Edge Interpolated mode is wrong
Caused by {rBcfa53e0fbeed}

Above commit mixed up source and destination meshes causing bad lookups
on calculated normals.

Now make sure we get normals from our destination mesh to project along.

Note this was only reported for Projected Face Interpolated mode, but
same was true for Projected Edge Interpolated mode (though that one is a
bit weird to test since I think there is generally something wrong with
that mode -- with or without rBcfa53e0fbeed).

Fixes T97528

Maniphest Tasks: T97528

Differential Revision: https://developer.blender.org/D14726
2022-04-22 15:28:12 +02:00
5179b8236b Fix accessing attribute data in editmode
When in mesh editmode, attributes point to bmesh customdata, the
attribute data is empty since custom data is stored per element instead
of a single array there (same es UVs etc.).
Opposed to e.g. UVs, general attributes were not setting their data
length/size to zero in case of editmode though, which could lead to
- crash in Outliner Data Api view [that was reported in T95922]
- RuntimeError such as the following:
```
RuntimeError: bpy_prop_collection[index]: internal error, valid index 0
given in 8 sized collection, but value not found
```

Now check for mesh editmode in `BKE_id_attribute_data_length` (and
return zero in that case).
Alternatively, the check could also be done in
`rna_Attribute_data_length` only (such as UVs do in
`rna_MeshUVLoopLayer_data_length`).

Ref D11998
Fixes T95922

Maniphest Tasks: T95922

Differential Revision: https://developer.blender.org/D14714
2022-04-22 15:25:11 +02:00
048c769774 Fix T97277: Tweak drag transforming is broken for masks (RMB select)
Regression in 4d0f846b93,
passing selection through to drag relied on tweak events running
even when the press event was handled which is not the case for drag.
2022-04-22 17:36:09 +10:00
Ramil Roosileht
b226236b01 Fix - Display correct units in "Edit voxel size" widget
Fix for T84962
Before the patch, edit voxel size always displayed voxel size without units, just as a number in meters.
Now it changes like in the voxel remesh panel and shows correct units
Video:
{F13009428}

In adaptive mode:
{F13009435}

Reviewed By: JulienKaspar

Maniphest Tasks: T84962

Differential Revision: https://developer.blender.org/D14682
2022-04-22 08:09:18 +02:00
Ramil Roosileht
d724d3ae58 Change viewport shading text from "Color" to "Attribute"
This change from T97104

Reviewed By: JulienKaspar, jbakker

Maniphest Tasks: T97104

Differential Revision: https://developer.blender.org/D14620
2022-04-22 08:06:21 +02:00
Ramil Roosileht
33d102e5b2 Reorder sculpt tools
Changed tool order as proposed in [[ https://developer.blender.org/T97206 | T97206 ]]
{F12987559}

Reviewed By: JulienKaspar, jbakker

Maniphest Tasks: T97206

Differential Revision: https://developer.blender.org/D14612
2022-04-22 08:05:45 +02:00
48f369d63a Fix: VSE channels region visible in preview
Hide region for preview and sequencer/preview combined view.
2022-04-22 02:51:10 +02:00
30acc5f9cd pyproject: add configuration for autopep8
This adds pyproject.toml, needed to configure defaults for autopep8.

The file is auto-discovered in a similar way to .clang-format, other
tools could be configured here too. For now just configure autopep8 so
this can be enabled in IDE's without causing unexpected edits such as
wrapping lines over 80 columns in width.

Now autopep8 can be used from the root directory by running: autopep8 .

This uses multiple-jobs to run autopep8 over all Python scripts except
paths that are explicitly ignored in exclude defined by pyproject.toml.

Reviewed By: mont29, brecht, sybren

Ref D14686
2022-04-22 10:13:39 +10:00
2547c3c70c Cleanup: spelling in comments 2022-04-22 10:11:48 +10:00
Brecht Van Lommel
179100c021 Cycles: enable AMD RDNA GPU support on Linux
This enables building of HIP binaries for AMD RDNA and RDNA2 GPUs.

This requires the 22.10 / ROCm 5.1 driver.

Ref T91571

Differential Revision: https://developer.blender.org/D14360
2022-04-22 00:11:55 +02:00
ce95856f2d Fix: VSE channels area has no background
Draw area background even when there is no sequencer data.
2022-04-21 23:40:36 +02:00
74b9c351b9 Fix: Use alphabetical order in geometry nodes add menu 2022-04-21 14:10:02 -05:00
65e4c91bec Fix: Memory leak writing to builtin attribute from modifier
If the attribute already existed, but had a different domain or data type
than the user tried to write to it with (i.e. writing to `position` with
a float), then the data from field evaluation wasn't freed.

This restructures the geometry nodes modifier attribute writing process
to solve that problem and remove some of the nested if statements
that made the process confusing.

One case that still doesn't work is writing to a builtin attribute from
a different domain. If `OutputAttribute` gets that feature then that
could be supported here too.

Differential Revision: https://developer.blender.org/D14706
2022-04-21 14:05:16 -05:00
9de3ed5c82 Fix T97490: snap to multiple objects with linked data can crash
The problem is old.

rB52be06301257 (fixed by rB4b35d6950d4f) just masked it.

`Object->data`, on evaluated objects, is not a safe pointer to get
objects with the same `BMEditData`.

Use `Object->runtime.data_orig` instead.
2022-04-21 14:08:17 -03:00
9a9a46df46 Cleanup: Remove unused argument to mesh modifier evaluation 2022-04-21 12:02:13 -05:00
Germano Cavalcante
e2d8b6dc06 gpu.types.GPUBatch: warn about deprecated primitive types
As `GPU_PRIM_LINE_LOOP` is not supported on Vulkan or Metal and
`GPU_PRIM_TRI_FAN` is not supported on Metal, they will be removed in
future releases.

So it is important to inform users that they are obsolete and may not
be supported for a long time.

Release Notes: https://wiki.blender.org/wiki/Reference/Release_Notes/3.2/Python_API

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D14679
2022-04-21 12:52:38 -03:00
f807e6effe Cleanup: don't use allocation variables in OpenColorIO config
These are only needed for the legacy GPU renderer, which we don't use.
2022-04-21 17:34:46 +02:00
f991f5ad51 Color Management: add ACEScg to the default configuration
For more easily reading and writing ACEScg EXR files.
2022-04-21 17:34:46 +02:00
f6d5d01715 Fix T97502: Issues/crashes with "color_attributes" AttributeGroup
Property collection functions were not really in sync which could result
in crashes in UI_LISTS.

The reason is that attributes of type color defined on domains other than
Points or Corners are still valid, but should really be skipped for the
special "color_attributes".
`rna_AttributeGroup_color_length` itself was fine here, it skips these,
but the iterator (`rna_AttributeGroup_color_iterator_begin` /
`rna_Attributes_noncolor_layer_skip`) wasnt, so when a UI_LIST
filter_items() would iterate the collection it would actually get
results were it shouldnt.

Now check a suiting domain in `rna_Attributes_noncolor_layer_skip` as
well.

Maniphest Tasks: T97502

Differential Revision: https://developer.blender.org/D14717
2022-04-21 16:18:05 +02:00
b9799dfb8a Geometry Nodes: better support for byte color attributes
Since {rBeae36be372a6b16ee3e76eff0485a47da4f3c230} the distinction
between float and byte colors is more explicit in the ui. So far, geometry
nodes couldn't really deal with byte colors in general. This patch fixes that.
There is still only one color socket, which contains float colors. Conversion
to and from byte colors is done when read from or writing to attributes.

* Support writing to byte color attributes in Store Named Attribute node.
* Support converting to/from byte color in attribute conversion operator.
* Support propagating byte color attributes.
* Add all the implicit conversions from byte colors to the other types.
* Display byte colors as integers in spreadsheet.

Differential Revision: https://developer.blender.org/D14705
2022-04-21 16:11:26 +02:00
aca083fbf3 Nodes: raise exception when creating node group input/output fails
Previously this would silently return `None`.
Now the behavior is similar to when new sockets are added to a node.
2022-04-21 15:48:02 +02:00
75a9830d84 install_deps: Update USD to 22.03.
Add back a patch wrongly removed by rBb9c37608a9e9, and add another fix,
for gcc11 build support.

Re {T95206}.
2022-04-21 15:35:12 +02:00
c196ca3740 Functions: fix procedure executor not writing output in correct buffer
The issue was that the executor would forget about the caller provided
storage if the variable is destructed.
2022-04-21 15:29:18 +02:00
0178e694b7 Geometry Nodes: show used named attributes in modifier
This adds a new subpanel to the geometry nodes modifier which is just
used to display information about used attributes.

* A new panel is used because adding this information anywhere else
  clutters the ui too much imo.
* The general layout is similar to that in the tooltip. I found it to be more
  trouble than it's worth to share this code.

Possible future improvements:
* Don't show the panel if there are no used named attributes.
* Add some heuristics to determine which named attributes the user does
  not have to care about because they are only used in the node group
  and don't affect anything else.

Differential Revision: https://developer.blender.org/D14701
2022-04-21 15:10:07 +02:00
ed971a19fa Curves: show sculpt tool settings in panels
Ref T97444.

Differential Revision: https://developer.blender.org/D14700
2022-04-21 14:51:37 +02:00
Colin Basnett
2882cbe685 Fix T97497: NLA strip names are now properly contained within the strip bounds
Very easy fix, the bug seemed to be a result of a typo on the right-most margin.

Old: {F13013777}

New: {F13013782}

Maniphest Tasks: T97497

Differential Revision: https://developer.blender.org/D14711
2022-04-21 10:45:17 +02:00
2e3edb6995 Fix Empty "Only Axis Aligned" viewing angle depends on object scale
This was projecting the unnormalized z scale axis onto the plane defined
by the view vector. If object scale was very small, this made the empty
still visible at viewing angles far from the object axis.

Now use the normalized z scale axis to make this work the same at all
object scales.

Fixes T97004.

Maniphest Tasks: T97004

Differential Revision: https://developer.blender.org/D14557
2022-04-21 10:36:06 +02:00
298e9c7ebd Fix T97465: Moving compositor BG image cannot be cancelled
This was possible with the gizmo, but no using the operator (e.g. from
the sidebar).

Now store original offsets and reset to these on calcel (ESC or RMB).

Maniphest Tasks: T97465

Differential Revision: https://developer.blender.org/D14704
2022-04-21 10:30:41 +02:00
01333cb47f Sculpt: fix missing null pointer check
in workbench_engine.c
2022-04-21 00:58:45 -07:00
c342b3cede Fix T95932: Auto-close text breaks outliner drag-n-drop
Text inserted via TEXT_OT_insert would always have auto-close
logic applies which interfered any insertion of literal strings
containing brackets.

Now auto-closing brackets is restricted to characters read from
events from the operators invoke functions.
2022-04-21 17:56:56 +10:00
4d9ddb4a77 Cleanup: clang format 2022-04-21 09:37:20 +02:00
7a943428de Cleanup: fix various warnings after recent commit 2022-04-21 09:36:39 +02:00
14f2d37ad1 Vertex paint: Fix debug compile error and a
few warnings.
2022-04-21 00:18:12 -07:00
b0c428c063 Fix T97185: Data transfer modifier doesn't display
individual layers.

A few RNA property strings were misspelled.
2022-04-21 00:04:58 -07:00
6f190f7f43 Fix T97469: Sculpt colors crash in multiresolution or dynamic topology modes.
Sculpt paint tools now pop up an error message if
dynamic topology or multires are enabled.

Implementation notes:

* SCULPT_vertex_colors_poll is now a static function in sculpt_ops.c.
  It is now used solely by the legacy color attribute conversion
  operators (SCULPT_OT_vertex_to_loop_colors and SCULPT_OT_loop_to_vertex_colors)
  and should be deleted when they are.
* There is a new method, SCULPT_handles_colors_report, that returns true if
  the sculpt session can handle color attributes; otherwise it returns false
  and displays an error message to the user.
2022-04-20 23:38:55 -07:00
575ade22d4 Commit D14179: Revamp Vertex Paint With C++
- Verrtex paint mode has been refactored into C++ templates.
  It now works with both byte and float colors and point
  & corner attribute domains.
- There is a new API for mixing colors (also based
  on C++ templates).  Unlike the existing APIs byte
  and float colors are interpolated identically.
  Interpolation does happen in a squared rgb space,
  this may be changed in the future.
- Vertex paint now uses the sculpt undo system.

Reviewed By: Brecht Van Lommel.

Differential Revision: https://developer.blender.org/D14179
Ref D14179
2022-04-20 22:14:03 -07:00
Jon Denning
c6ed879f9a Text Editor: add Python 3.10 soft keywords to builtinfunc list
Python 3.10 has added "soft keywords" [0] to their list of identifiers.
This patch adds these soft keywords to the list of builtin functions
that the text editor searches for when highlighting Python code.

The only soft keywords that Python 3.10 current has are: `match`,
`case`, and `_`, but more will likely be added in future versions.

Currently, the `_` soft keyword is ignored from highlighting. It is a
wildcard matching pattern when used with `case` (similar to `default`
for `switch`es in C/C++), but `_` is far more often used in other
contexts where highlighting the `_` might seem strange. For example,
ignoring elements when unpacking tuples (`_, g, _, a = color`).

This patch also updates the commented Python code for creating the list
of keywords, for convenience.

Before:

{F13012878}

After:

{F13012880}

Example from PEP-636 [1]

Note: These soft keywords are only reserved under specific contexts.
However, in order for the text editor to know when the keywords are used
in the appropriate contexts, the text editor would need a full-blown
Python grammar [2] parser. So, for now, these keywords are simply added
in along with the other keywords in order to highlight them in the text
editor.

[0]: https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
[1]: https://peps.python.org/pep-0636/#matching-specific-values
[2]: https://docs.python.org/3/reference/grammar.html

Ref D14707
2022-04-21 12:35:41 +10:00
5fc488559c Cleanup: explicitly disable autopep8 for rna_manual_reference
Currently the "exclude" option for autopep8 isn't as reliable as it
should be since passing in absolute paths to autopep8 causes
the paths not to match. See: D14686 for details.

So explicitly disable autopep8 in this generated file (the generator
has already been updated).

Also use spaces for indentation otherwise autopep8 re-indents them.
This seems like a bug in autopep8 since it's changing lines with
autopep8 disabled. Use a workaround instead of looking into a fix since
it's simpler for all our Python files to use spaces instead of tabs and
there isn't much benefit mixing indentation for scripts.
2022-04-21 11:16:25 +10:00
b719fa267a Fix typo in previous commit 2022-04-21 02:26:54 +02:00
0c3d2461b7 Cleanup: VSE effect relationship checking
Use `SEQ_relation_is_effect_of_strip` for checking effect-input
relationship where this is applicable.
2022-04-21 02:01:10 +02:00
Shrey Aggarwal
502f3debf9 Fix T70844: Incorrect snappping of strips when effects attached
Sometimes, when moving strip with 2 input effect attached and causing
strip overlap, this overlap is resolved incorrectly - too big offset
is applied. This is because effects are not taken into consideration
when "shuffeling" to resolve overlap.

To fix usual cases (transitions), overlap between strip and it's effect
is considered to be impossible.

There are edge cases, but these would be much more complicated to
implement and could have negative impact on performance.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D14578
2022-04-21 02:01:10 +02:00
ok what
e16ff4132e VSE: Add frame selected operator for preview
This operator moves the view to show the selected visible strips.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D14222
2022-04-21 02:01:10 +02:00
2bd9cbe405 Fix T97254: VSE channel mute does mute sound
Add missing RNA update function
2022-04-21 02:01:10 +02:00
3cef9ebaf8 Fix T97356: Crash when adding adjustment layer strip
Crash was caused by incorrectly assuming, that rendered strip is meta
when editing code in bulk, but this wasn't true and strip had no
channels initialized, which caused crash on NULL dereference.

Correct approach is to find list of channels where on same level as
rendered strip, similar to how `SEQ_get_seqbase_by_seq` function works
for list of strips.
2022-04-21 02:01:10 +02:00
b67ccc333a GL: Change array macro to not conflict with opensubdiv variable names
Fix T97449 GPU subdivision: Crash on adding subdivision surface modifier
2022-04-20 21:32:03 +02:00
4a03c5acf9 Revert "Fix GPU subdivision: Crash on adding subdivision surface modifier"
The fix does not fix the case of shaders comming from the OpenSubdiv API.

This reverts commit f5191b8760.
2022-04-20 21:32:03 +02:00
8d2da45f98 Revert "Fix Cycles HIP assuming warp size 32"
This reverts commit 390b9f1305. It seems to
break things on Linux for unknown reasons, so leave it out for now. A solution
to this will be required for Vega cards though.
2022-04-20 18:09:23 +02:00
3a6813ea65 LibOverride: Make 'custom bone shape' and 'bbone custom handle' non-overridable.
There is not much point in having those editable in overrides, and since
those are pointers, their value always differs from ref linked ID vs.
local override one, generating 'noise' in Outliner's override property
view.
2022-04-20 17:03:05 +02:00
Jung Jaeyun
56d1d19c88 UI: Add option to create color attribute directly from canvas selector.
Added + and - buttons to create and delete color attributes from canvas selector.

{T97345}

{F13006374}

Reviewed By: jbakker, Ethan1080

Maniphest Tasks: T97345

Differential Revision: https://developer.blender.org/D14672
2022-04-20 16:55:33 +02:00
604c33e694 Build: updates for Blender to build against new 3.2 libraries
Building against the existing 3.1 libraries should continue to work, until
the precompiled libraries are committed for all platforms.

* Enable WebP by default.
* Update Windows for new library file names.
* Automatically clear outdated CMake cache variables when upgrading to new
  libraries.
* Fix static library linking order issues on Linux for OpenEXR and OpenVDB.

Implemented by Ray Molenkamp, Sybren Stüvel and Brecht Van Lommel.

Ref T95206
2022-04-20 16:42:16 +02:00
b9c37608a9 Build: upgrade many library dependencies to new versions for Blender 3.2
This only updates the build system, precompiled libraries for the various
platforms will be committed over the coming week.

New:
fmt 8.0.0
level_zero v1.7.15
pystring v1.1.3
robinmap v0.6.2
webp 1.2.2

Updated:
alembic 1.8.3
blosc 1.21.1
boost 1.78.0
embree 3.13.3
ffmpeg 5.0
fftw 3.3.10
flac 1.3.4
imath 3.1.4
ispc v1.17.0
jpeg 2.1.3
ogg 1.3.5
oidn 1.4.3
openal 1.21.1
opencolorio 2.1.1
openexr 3.1.4
openimageio v2.3.13.0
openjpeg 2.4.0
opensubdiv v3_4_4
openvdb 9.0.0
osl 1.11.17.0
sdl 2.0.20
tbb 2020_u3
tiff 4.3.0
usd 22.03
vorbis 1.3.7
vpx 1.11.0
x264 35fe20d1b
zlib 1.2.12

Implemented by Ray Molenkamp, Sybren Stüvel and Brecht Van Lommel.

Ref T95206
2022-04-20 16:42:16 +02:00
7cb6fb0183 Cleanup: Remove redundant types from custom data masks
Colors and byte colors are already included in `CD_MASK_PROP_ALL`.
2022-04-20 09:12:40 -05:00
03ec505fa5 Cleanup: Rename CD_MLOOPCOL to CD_PROP_BYTE_COLOR
The "PROP" in the name reflects its generic status, and removing
"LOOP" makes sense because it is no longer associated with just
mesh face corners. In general the goal is to remove extra semantic
meaning from the custom data types.
2022-04-20 09:10:10 -05:00
0385e2f1f9 PBVH: Pass Mesh to extract internals.
More mesh data is required when extracting the UV seams. This is an
API change for to support this future enhancement.
2022-04-20 13:42:51 +02:00
5b8a3ccd37 Fix T94775: Buggy liboverride default apply code for items insertion in RNA collections.
For some reason, the rework of liboverride handling of Collection items
insertion (rB33c5e7bcd5e5) completely missed to update accordingly the
default liboverride apply code...

Many thanks to Wayde Moss (@GuiltyGhost) for the investigation and
proposed solution.
2022-04-20 11:05:54 +02:00
97dbcf9746 Fix (unreported) huge liboverride slow-down due to non-disabled UV layer props.
Was revealed by yesterday's fix (rB6f56bd4083f9).
2022-04-20 10:10:29 +02:00
8adc7cad00 Fix compilation without OpenVDB 2022-04-20 09:58:42 +02:00
31a2feceb8 Cleanup: remove unused curves toolsetting 2022-04-20 09:51:14 +02:00
f5191b8760 Fix GPU subdivision: Crash on adding subdivision surface modifier
This was caused by the use of a reserved keyword macro that is not
directly used but causes an error on some compiler.

Change the occurences to not match the macros.
2022-04-20 09:12:02 +02:00
65a1fcdaf7 Cleanup: run autopep8 on tests/performance/benchmark
This file was skipped by source/tools/utils/autopep8_clean.py
since it doesn't have a .py extension, running the autopep8 tool
recursively detects Python scripts without extensions.
2022-04-20 17:07:46 +10:00
67a4908bfc Cleanup: re-run autopep8 with E401 enabled
Put imports on their own line which was almost always the case already.
2022-04-20 16:26:49 +10:00
3adef61942 Cleanup: run autopep8 on release/scripts/presets 2022-04-20 16:21:04 +10:00
41b8e0316a Cleanup: use autopep8 on release/lts 2022-04-20 16:18:42 +10:00
28e068b55c Cleanup: run autopep8 on release/scripts/freestyle 2022-04-20 16:18:30 +10:00
8898251584 Cleanup: run autopep8 on intern/cycles/
Disable autopep8 for the block that yields passes in list_render_passes,
for better readability.
2022-04-20 16:10:05 +10:00
11dd7941af Cleanup: run autopep8 with max-line-length=120 (missed a file) 2022-04-20 15:55:17 +10:00
67516d0dae Cleanup: run autopep8 with max-line-length=120 2022-04-20 15:47:24 +10:00
8ed8fa80f4 Cleanup: use autopep8 for bl_i18n_utils.settings
Disable autopep8 for some regex blocks that use indentation
to signify regex grouping.
2022-04-20 15:39:36 +10:00
08dbd3bc7f Cleanup: run autopep8 on release/scripts/modules/ 2022-04-20 15:12:10 +10:00
38d8b088e7 Cleanup: run autopep8 on release/scripts/templates_py 2022-04-20 15:11:22 +10:00
c2cdbe1e88 Cleanup: run autopep8 on doc/ 2022-04-20 15:10:14 +10:00
df3316cbe9 Cleanup: run autopep8 on build_files/
Replace multiple hashes with over-lines for make_source_archive.py.
2022-04-20 15:08:46 +10:00
972a697f82 PyAPI: improve deprecation warning for bpy.ops context override
- Increase the stack level so the reported line number references
  script authors code (not Blender's wrapper function).
- Include the operator name and poll/call usage in the warning.
2022-04-20 13:17:16 +10:00
feea852b10 Fix crash passing no arguments to Context.temp_override 2022-04-20 13:01:14 +10:00
9364e17936 Docs: update examples to use Context.temp_override 2022-04-20 12:49:13 +10:00
f438344cf2 PyAPI: temporary context override support
Support a way to temporarily override the context from Python.

- Added method `Context.temp_override` context manager.
- Special support for windowing variables "window", "area" and "region",
  other context members such as "active_object".
- Nesting context overrides is supported.
- Previous windowing members are restored when the context exists unless
  they have been removed.
- Overriding context members by passing a dictionary into operators in
  `bpy.ops` has been deprecated and warns when used.

This allows the window in a newly loaded file to be used, see: T92464

Reviewed by: mont29

Ref D13126
2022-04-20 12:19:35 +10:00
6d9268c2c7 PyAPI: utility functions for parsing typed RNA arguments
These functions can be used with PyArg_ParseTupleAndKeywords
(and related functions) to take typed RNA arguments without
having to extract and type-check them separately.

No functional changes, extracted from D13126.
2022-04-20 12:16:11 +10:00
16afff2ddc Cleanup: spelling in comments 2022-04-20 10:41:31 +10:00
42717596d0 Cleanup: clang-format 2022-04-20 10:41:31 +10:00
f8f8edbe1a Cleanup: unused argument warning 2022-04-20 10:41:31 +10:00
Nate Rupsis
75ccfa63d0 UI: Fix typo in Apply Parent Inverse tooltip
There's a small typo in the tool tip for applying the Parent Inverse. This patch fixes that typo

old:
{F13010751}

new:
{F13010749}

Reviewed By: Blendify

Maniphest Tasks: T97437

Differential Revision: https://developer.blender.org/D14693
2022-04-19 20:40:59 -04:00
6a3c3c77b3 Mesh: Avoid unnecessary normal calculation and dirty tags
This is mostly a cleanup to avoid hardcoding the eager calculation of
normals it isn't necessary, by reducing calls to `BKE_mesh_calc_normals`
and by removing calls to `BKE_mesh_normals_tag_dirty` when the mesh
is newly created and already has dirty normals anyway. This reduces
boilerplate code and makes the "dirty by default" state more clear.
Any regressions from this commit should be easy to fix, though the
lazy calculation is solid enough that none are expected.
2022-04-19 17:08:02 -05:00
9ec94c3882 Cleanup: Don't recalculate normals in versioning code
Normals are not read from files anymore, calculating them in versioning
is unnecessary and wasteful.
2022-04-19 16:51:58 -05:00
d813ee55fd Fix: Incorrect info message in set material node
The node does have support for curves since c4f7f59c65.
2022-04-19 13:20:19 -05:00
5a06996722 Fix: Assert when sculpting empty curves 2022-04-19 12:09:29 -05:00
67962824e9 GPU: Fix Adresse Sanitizer errors 2022-04-19 19:03:40 +02:00
37d298391e Cleanup: GPUMaterial: Remove GPU_material_is_volume_shader 2022-04-19 19:03:40 +02:00
2890c11cd7 Cycles: add support for volume motion blur
This adds support for rendering motion blur for volumes, using their
velocity field. This works for fluid simulations and imported VDB
volumes. For the latter, the name of the velocity field can be set per
volume object, with automatic detection of velocity fields that are
split into 3 scalar grids.

A new parameter is also added to scale velocity for more artistic control.

Like for Alembic and USD caches, a parameter to set the unit of time in
which the velocity vectors are expressed is also added. For Blender gas
simulations, the velocity unit should always be in seconds, so this is
only exposed for volume objects which may come from external OpenVDB
files.

These parameters are available under the `Render` panels for the fluid
domain and the volume object data properties respectively.

Credits: kernel advection code from Tangent Animation's Blackbird based
on earlier work by Geraldine Chua

Differential Revision: https://developer.blender.org/D14629
2022-04-19 17:07:53 +02:00
56cfd60d43 Cleanup: remove unused code 2022-04-19 16:50:25 +02:00
Robert Guetzkow
721a9bc35c Fix T97338: Correct reference count for COM handling and removal of gotos
The fix ensures that the reference count for `IShellItem *pSI` is decremented,
preventing a memory leak. For `IFileOperation *pfo` the decrement of the
reference count is only attempted when `CoCreateInstance` is successful.
Additionally, the gotos have been replaced with nested if/else statements.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14681
2022-04-19 16:30:22 +02:00
Germano Cavalcante
3e98331a09 PyGPU: remove outdated function 'code_from_builtin'
Since shader sources are now parsed on demand via `GPUShaderCreateInfo`,
sources are not available to be read via
`GPU_shader_get_builtin_shader_code`.

Currently this results in a crash as the code tries to read `NULL`
pointers.

`GPU_shader_get_builtin_shader_code` was created with the intention of
informing the user how a builtin shader works, thus "replacing"
detailed documentation.

Therefore this function doesn't really have a practical use in an addon.

So, instead of updating the function (which would require several
changes to the gpu module), remove it and improve the documentation.

Release Notes: https://wiki.blender.org/wiki/Reference/Release_Notes/3.2/Python_API#Breaking_Changes

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14678
2022-04-19 11:23:51 -03:00
47de3659f0 improve hover tip for 'Lock Object Modes' property 2022-04-19 15:58:28 +02:00
6f56bd4083 Fix wrong logic in comparison code of RNA collection proerties.
Noted as part of T94775 investigation by Wayde Moss (@GuiltyGhost),
thanks!

NOTE: this mistake probably did not have any pratical impact in current
code, at least for overrides.
2022-04-19 15:53:54 +02:00
767939231d DRW: Volume: Fix warning about unused variable 2022-04-19 14:47:09 +02:00
058ce64be0 Fix: Uninitialized paint brush when using byte textures.
This is a fix for the 3d texturing brush.
2022-04-19 12:31:00 +02:00
14a2706886 EEVEE: Fix compilation caused by missing file 2022-04-19 12:27:27 +02:00
fa3bd17ae8 GPU: Replace GPUMaterialVolumeGrid by GPUMaterialAttribute
This is to make the codegen and shading nodes object type agnostic. This
is essential for flexibility of the engine to use the nodetree as it see
fits.

The essential volume attributes struct properties are moved to the
`GPUMaterialAttribute` which see its final input name set on creation.

The binding process is centralized into `draw_volume.cc` to avoid
duplicating the code between multiple engines. It mimics the hair attributes
process.

Volume object grid transforms and other per object uniforms are packed into
one UBO per object. The grid transform is now based on object which simplify
the matrix preparations.

This also gets rid of the double transforms and use object info orco factors
for volume objects.

Tagging @brecht because he did the initial implementation of Volume Grids.
2022-04-19 12:09:18 +02:00
1e3f4c70ab Material: Add name to default shaders
Improve debugging experience.
2022-04-19 12:09:18 +02:00
c2c17cc076 Workbench: Volume: Fix errors about unboud texture 2022-04-19 12:09:18 +02:00
6296cb5129 DRW: Centralize smoke domain texture management
This code was duplicated in multiple engines. Now it is the draw manager
responsability to manage the throwaway fluid textures.
2022-04-19 12:09:18 +02:00
eccc9d8eba Cleanup: Remove unused function in Cycles queue
Noticed while looking into oneAPI patch.

Seems to be unused, without clear indication why/when it might be
needed. Removing the function simplifies adding the new backend.

Differential Revision: https://developer.blender.org/D14652
2022-04-19 10:32:07 +02:00
3035235def Cleanup: run autopep8 on tests/ 2022-04-19 15:25:55 +10:00
58d86527ae Cleanup: run autopep8 on release/scripts/startup/ 2022-04-19 15:07:04 +10:00
8c25889bb6 Refactor: Move mesh face dot tag out of MVert
Continuing the refactors described in T93602, this commit moves
the face dot tag set by the subdivision surface modifier out of
`MVert` to `MeshRuntime`. This clarifies its status as runtime data
and allows further refactoring of mesh positions in the future.

Before, `BKE_modifiers_uses_subsurf_facedots` was used to check
whether subsurf face dots should be drawn, but now we can just check
if the tags exist on the mesh. Modifiers that create new new geometry
or modify topology will already remove the array by clearing mesh
runtime data.

Differential Revision: https://developer.blender.org/D14680
2022-04-18 23:48:43 -05:00
775f0d76d5 Fix missing C/Python methods in API docs
The following methods weren't included in API docs.

- BlendDataLibraries.load
- BlendDataLibraries.write
- Text.region_as_string
- Text.region_from_string
2022-04-19 13:08:48 +10:00
7e045094c1 PyDoc: quiet warnings for duplicate members bpy.context 2022-04-19 12:19:08 +10:00
f401741544 PyDoc: remove multiple children properties for Bone type
This doesn't cause any functional change as the RNA property
of Bone wasn't overridden by the _GenericBone's property,
however the `children` property was documented twice, causing a warning.
2022-04-19 12:18:53 +10:00
76acc5e999 PyDoc: fix including literal text immediately after function args
Literal text from examples could be included directly after function
arguments, this caused a warning with mis-matching indentation.
2022-04-19 12:17:58 +10:00
adcce654e3 Cleanup: Use correct capitalization of "F-Curve" 2022-04-18 20:17:41 -04:00
Colin Basnett
549f68149d UI: Fix typo in UI description for bpy.types.ActionFCurves.remove function
The UI description for the `bpy.types.ActionFCurves.remove` was incorrect;
seemingly a copy-paste typo from the `rna_Action_groups_remove` function.

Reviewed By: sybren, Blendify

Differential Revision: https://developer.blender.org/D14659
2022-04-18 20:11:45 -04:00
b90e892a17 Fix call of 'BLI_assert' instead 'BLI_assert_msg'
Error in 5da02548e9
2022-04-18 19:15:46 -03:00
5da02548e9 Cleanup: remove redundant 'DEG_get_original_object' call
The `BMEditMesh` pointer is the same in the original or evaluated mesh.

Also a clang-format was missed.
2022-04-18 19:00:55 -03:00
a0c2d6bf85 Transform: small optimization in snap to edit mesh
In some cases, selected elements do not contribute to snapping.
So ignore these elements when creating the edit meshes bound box.
2022-04-18 18:25:16 -03:00
bec057a453 Fix assert on meshes without mloop in snap code
Meshes without loops are still valid for snapping.
2022-04-18 18:24:50 -03:00
03d39a04a3 Fix T97002: Preserve multi socket link order
Preserve multi socket link order when copying nodes or adding a new
group input sockets by linking directly to multi inputs from the group
input node's extension socket.

This is done by also copying the `multi_input_socket_index` when
the new links are created by copying existing or temporary links.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D14535
2022-04-18 22:28:03 +02:00
314b27850c Cleanup: Remove incorrect comment 2022-04-18 14:08:29 -05:00
95cce6f6b0 Cleanup: Move object_modifier.c to C++
This allows using C++ only APIs/data structures, and potentially
simplifies adding support to apply modifiers for the Curves object.
2022-04-18 12:40:23 -05:00
98fc998c70 Cleanup: Clang tidy
- Inconsistent parameter names
- Else after return
- Braces around statements
- Qualified auto
- Also (not clang tidy): Pass StringRef by value, unused parameter
2022-04-18 12:36:37 -05:00
fc58368263 Build: link with GameController and CoreHaptics frameworks on macOS
In preparation of upcoming SDL upgrade, which uses these.
2022-04-18 19:14:36 +02:00
2cb76a6c8d Cleanup: consistently use parallel_for without tbb namespace in Cycles 2022-04-18 19:14:36 +02:00
029b0df81a Fix Cycles blackbody shader not taking into account OpenColorIO config
Keep the existing Rec.709 fit and convert to other colorspace if needed, it
seems accurate enough in practice, and keeps the same performance for the
default case.
2022-04-18 19:14:34 +02:00
41b3feea85 Fix Cycles build error with latest TBB after recent changes
From changes in 869a46df29, ref D14454
2022-04-18 18:49:35 +02:00
Angus Stanton
ccd2e89d37 Fix T94559: Copying geometry node group does not copy animation data
Reimplement copy geometry node groups in C. The version implemented in
Python could also manually copy the animation data, but it's more
standard to do this with `BKE_id_copy_ex` and `LIB_ID_COPY_ACTIONS`.

Differential Revision: https://developer.blender.org/D14615
2022-04-18 10:15:30 -05:00
ef2b8c1c3a Nodes: Remove unnecessary RNA pointer creation
`rna_NodeSocket_refine` and `rna_Node_refine` take significant time
when building the `NodeTreeRef` acceleration data structure, but they
aren't used at all. This commit removes their eager calculation and
instead creates them on-demand in the `rna()` functions. They also
aren't inlined to avoid including `RNA_prototypes.h` in the header.

Differential Revision: https://developer.blender.org/D14674
2022-04-18 10:12:17 -05:00
933fed2a17 Minor tweaks to labels/tooltips of override operation in the Outliner. 2022-04-18 12:21:33 +02:00
bf80dc2bd4 Add debugging info for Wintab activated by argument --debug-wintab.
Bonus: Added docs for `--debug-ghost`.

Differential Revision: https://developer.blender.org/D14610
2022-04-17 15:21:59 -07:00
213cd39b6d OBJ: further optimize, cleanup and harden the new C++ importer
Continued improvements to the new C++ based OBJ importer.

Performance: about 2x faster.
- Rungholt.obj (several meshes, 263MB file): Windows 12.7s -> 5.9s, Mac 7.7s -> 3.1s.
- Blender 3.0 splash (24k meshes, 2.4GB file): Windows 97.3s -> 53.6s, Mac 137.3s -> 80.0s.
- "Windows" is VS2022, AMD Ryzen 5950X (32 threads), "Mac" is Xcode/clang 13, M1Max (10 threads).
- Slightly reduced memory usage during import as well.

The performance gains are a combination of several things:
- Replacing `std::stof` / `std::stoi` with C++17 `from_chars`.
- Stop reading input file char-by-char using `std::getline`, and instead read in 64kb chunks, and parse from there (taking care of possibly handling lines split mid-way due to chunk boundaries).
- Removing abstractions for splitting a line by some char,
- Avoid tiny memory allocations: instead of storing a vector of polygon corners in each face, store all the corners in one big array, and per-face only store indices "where do corners start, and how many". Likewise, don't store full string names of material/group names for each face; only store indices into overall material/group names arrays.
- Stop always doing mesh validation, which is slow. Do it just like the Alembic importer does: only do validation if found some invalid faces during import, or if requested by the user via an import setting checkbox (which defaults to off).
- Stop doing "collection sync" for each object being added; instead do the collection sync right after creating all the objects.

Cleanup / Robustness:

This reworking of parser (see "removing abstractions" point above) means that all the functions that were in `parser_string_utils` file are gone, and replaced with different set of functions. However they are not OBJ specific, so as pointed out during review of the previous differential, they are now in `source/blender/io/common` library.

Added gtest coverage for said functions as well; something that was only indirectly covered by obj tests previously.

Rework of some bits of parsing made the parser actually better able to deal with invalid syntax. E.g. previously, if a face corner were a `/123` string, it would have incorrectly treated that as a vertex index (since it would get "hey that's one number" after splitting a string by a slash), instead of properly marking it as invalid syntax.

Added gtest coverage for .mtl parsing; something that was not covered by any tests at all previously.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14586
2022-04-17 22:07:43 +03:00
a3eb4027c2 Fix T97095: export of Poly curves, export crash when object contains multiple curve types
- Was not exporting "Poly" curves at all,
- Had a crash when a single object contains multiple curves of different types -- it had a check for "is this nurbs compatible?" only for the first curve, and then proceeded to treat the other curves as nurbs as well, without checking for validity.

Fixed both issues by doing the same logic as in the old python exporter:
- Poly curves are supported,
- Treat object as "nurbs compatible" only if all the curves within it are nurbs compatible.

Added test coverage in the gtest suite. While at it, made "all_curves" test use the "golden obj file template" style test, instead of a manually coded test that checks intermediate objects but does not check the final exported result.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14611
2022-04-17 21:59:55 +03:00
b32cb0266c Fix T96824: New 3.1 OBJ exporter writes incorrect polygon/vertex groups in some cases
The new 3.1 OBJ exporter code had incorrect code to determine which vertex group a polygon belongs to -- for each vertex, it was only looking at the first vertex group it has, and not using the group weight either.

This 99% fixes T96824, but not 100% on the user's submitted mesh -- exactly two faces from that mesh get assigned a different group compared to the old exporter. Either choice is "correct" given that on these two faces there are two vertex groups with equal contribution. The old Python exporter was picking the group based on internal python group name map order, whereas the new C++ exporter is picking the group with the lowest index, in case of ties. I'm not sure if it's possible to fix this TBH, will have to wait until the importer is also C++.

While at it, the new vertex group calculation code was doing a lot of redundant work for each and every face (traversing group lists several times, allocating & freeing memory), so I fixed that. Exporting a 6-level subdivided Monkey mesh with 30 vertex groups was taking 810ms, now takes 330ms.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14500
2022-04-17 21:54:51 +03:00
e88807e71c Cleanup: Use C++ Array type 2022-04-17 13:30:30 -05:00
b9f1b64801 USD/Ctest: Add basic USD-Imaging test.
This adds a basic unit test to check USD has been correctly
build with imaging components to support building both with
the old and new libs, it automatically adds the test when it
detects a library with imaging enabled. (platform devs will
have to pay attention it runs the test to validate the libs
build correctly)

For future use in the code it also defines a USD_HAS_IMAGING
define one could check if we're building against an USD lib
that has it (just because we build/ship with it, doesn't
mean downstream builds will ship with it, so we'll have
to be a little pro-active there)

Reviewed By: sybren

Differential Revision:https://developer.blender.org/D14456
2022-04-16 15:32:48 -06:00
98eb111568 Fix T97366: Misdetection of numbers as UDIMs in certain filepaths
In some circumstances singular files with numbers in their name (like
turntable-1080p.png or frame-1042.png) might be detected as a UDIM.

The root cause in this particular instance was because `BKE_image_get_tile_info`
believed this file to be a tiled texture and replaced the filename with
a tokenized version of it. However, later on, the code inside `image_open_single`
did not believe it was tiled because only 1 file was detected and our
tiled textures require at least 2. This discrepancy lead to the broken
filename situation.

This was a regression since rB180b66ae8a1f as that introduced the
tokenization changes.

Differential Revision: https://developer.blender.org/D14667
2022-04-16 14:18:08 -07:00
2b191cd2b4 Mask by color now auto-creates a
color attribute if one does not exist,
and no longer passes through to the
translate tool on tweak grab.
2022-04-15 18:49:38 -07:00
8eb40d2063 This patch changes Sculpt Multi-Plane Scrape tool icon to be red and have a little outline around the color, like the other scraping tools T97271
Also, as a suggestion, this patch changes Mask By Color and Color Filter to be the same shade of green as paint and smear tool icons

{F12998856}

{F12998857}

{F12998858}

Reviewed By: Julian Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D14632
Ref D14632
2022-04-15 18:06:47 -07:00
dc5ae10692 Fix T96988: Merge by distance node crash with certain input
If the `wpoly` vector was small, the `wpoly_new` pointer could point
to part of its inline buffer on the stack, which becomes invalid out of
that scope. Instead, store `wpoly_new` as a span, and assign it properly
from the moved vector.
2022-04-15 16:55:15 -05:00
cb3c233ed3 Cleanup: Return early 2022-04-15 16:44:15 -05:00
65194f47b0 UI: Improve wording for some USD export descriptions
The HIG mentions that redundant words like "Enables" or "Activates"
shouldn't be used for tooltips of boolean properties. In this case
"When checked" was the redundant language that was implied by
the checkbox itself-- convention is to just state what the property
does when it's on.

Also change a few conjugations to the imperative and simplify
wording slightly, in order to be more consistent with language
elsewhere in Blender, and to be a bit more direct.

Differential Revision: https://developer.blender.org/D14644
2022-04-15 13:50:54 -05:00
ad324316ce Fix: Missing Null Check
Introduced by my recent commit: {rB3acbe2d1e933}

Lead to crash when insert_keyframe_direct() was called. Keyframing
crashed for NLA special properties (influence, animated_time),
driven properties, etc.
2022-04-15 13:45:00 -04:00
089e701191 Fix T97363: Duplicate elements node doesn't tag loose edges 2022-04-15 12:38:34 -05:00
4e6c0669e3 Cleanup: fix warning for differing parameter names 2022-04-15 13:21:07 -04:00
0f9057390d Cleanup: Clang tidy 2022-04-15 11:59:02 -05:00
7484f274dc Curves: Port curve to mesh node to the new data-block
This commit changes the Curve to Mesh node to work with `Curves`
instead of `CurveEval`. The change ends up basically completely
rewriting the node, since the different attribute storage means that
the decisions made previously don't make much sense anymore.

The main loops are now "for each attribute: for each curve combination"
rather than the other way around, with the goal of taking advantage
of the locality of curve attributes. This improvement is quite
noticeable with many small curves; I measured a 4-5x improvement
(around 4-5s to <1s) when converting millions of curves to tens of
millions of faces. I didn't obverse any change in performance compared
to 3.1 with fewer curves though.

The changes also solve an algorithmic flaw where any interpolated
attributes would be evaluated for every curve combination instead
of just once per curve. This can be a large improvement when there
are many profile curves.

The code relies heavily on a function `foreach_curve_combination`
which calculates some basic information about each combination and
calls a templated function. I made assumptions about unnecessary reads
being removed by compiler optimizations. For further performance
improvements in the future that might be an area to investigate.
Another might be using a "for a group of curves: for each attribute:
for each curve" pattern to increase the locality of memory access.

Differential Revision: https://developer.blender.org/D14642
2022-04-15 10:15:48 -05:00
cc6db8921b GPU: Make viewport not acquireable during rendering
This is a partial fix to the fact that rendering with EEVEE or other GL
render engines is currently blocking the whole UI when asking to redraw
a viewport.

This patch just bypasses the viewport bind (containing the Draw Context
lock) and the following drawing. There is an update tagging to not
loose a viewport update if there was one asked.

Other queries other than view redraw (such as selection depth drawing or
offscreen drawing) will still block the whole UI as they need immediate
data feedback.

Ping @Severin for the change in `WM_draw_region_viewport_bind()`.
I'm assuming this is not an issue because it's highly unlikely to
bring up this operator during rendering. But in this case, it would just
lock as usual.

The bypassing in `DRW_notify_view_update` might be a bit overparanoid.
2022-04-15 17:09:30 +02:00
47d961a4b1 Fix: Apply tilt in curves data-block normals calculation
The ported normal calculation from ceed37fc5c neglected to
use the tilt attribute to rotate the normals around the tangents.
This commit adds that behavior back, adding a new math header file
to avoid duplicating the rotation function for normalized axes.

Differential Revision: https://developer.blender.org/D14655
2022-04-15 09:54:45 -05:00
Jeroen Bakker
e96a809a68 PBVH Pixel extractor.
This patch contains an initial pixel extractor for PBVH and an initial paint brush implementation.
PBVH is an accelleration structure blender uses internally to speed up 3d painting operations.
At this moment it is extensively used by sculpt, vertex painting and weight painting.

For the 3d texturing brush we will be using the PBVH for texture painting.
Currently PBVH is organized to work on geometry (vertices, polygons and triangles).
For texture painting this should be extended it to use pixels.

{F12995467}

Screen recording has been done on a Mac Mini with a 6 core 3.3 GHZ Intel processor.

# Scope

This patch only contains an extending uv seams to fix uv seams. This is not actually we want, but was easy to add
to make the brush usable.

Pixels are places in the PBVH_Leaf nodes. We want to introduce a special node for pixels, but that will be done
in a separate patch to keep the code review small. This reduces the painting performance when using
low and medium poly assets.

In workbench textures aren't forced to be shown. For now use Material/Rendered view.

# Rasterization process

The rasterization process will generate the pixel information for a leaf node. In the future those
leaf nodes will be split up into multiple leaf nodes to increase the performance when there
isn't enough geometry. For this patch this was left out of scope.

In order to do so every polygon should be uniquely assigned to a leaf node.

For each leaf node
   for each polygon
     If polygon not assigned
       assign polygon to node.

Polygons are to complicated to be used directly we have to split the polygons into triangles.

For each leaf node
  for each polygon
    extract triangles from polygon.

The list of triangles can be stored inside the leaf node. The list of polygons aren't needed anymore.
Each triangle has:

    poly_index.
    vert_indices
    delta barycentric coordinate between x steps.

Each triangle is rasterized in rows. Sequential pixels (in uv space) are stored in a single structure.

    image position
    barycentric coordinate of the first pixel
    number of pixels
    triangle index inside the leaf node.

During the performed experiments we used a fairly simple rasterization process by
finding the UV bounds of an triangle and calculate the barycentric coordinates per
pixel inside the bounds. Even for complex models and huge images this process is
normally finished within 0.5 second. It could be that we want to change this algorithm
to reduce hickups when nodes are initialized during a stroke.

Reviewed By: brecht

Maniphest Tasks: T96710

Differential Revision: https://developer.blender.org/D14504
2022-04-15 16:40:01 +02:00
25196f8a36 EEVEE: Support disabling all lightprobe object contribution in viewport
This is supported throught the visibility toggle. The light cache will
then only be used for world lighting. This is the behavior as light
objects.
2022-04-15 14:05:18 +02:00
2839fe9a4d Curves: initial geometry nodes support for curves objects
* Curves objects now support the geometry nodes modifier.
* It's possible to use the curves object with the Object Info node.
* The spreadsheet shows the curve data.

The main thing holding this back currently is that the drawing code
for the curves object is very incomplete. E.g. it resamples the curves
always in the end, which is not expected for curves in general.

Differential Revision: https://developer.blender.org/D14277
2022-04-15 09:08:50 +02:00
Wayde Moss
db6287873c Object: Set Parent (Keep Transform Without Inverse)
**Relevant to Artists:** This patch adds an option to the Parenting
menu, `Object (Keep Transform Without Inverse)`, and Apply menu, `Parent
Inverse`. The operators preserve the child's world transform without
using the parent inverse matrix. Effectively, we set the child's origin
to the parent. When the child has an identity local transform, then the
child is world-space aligned with its parent (scale excluded).

**Technical:** In both cases, the hidden parent inverse matrix is
generally set to identity (cleared or "not used") as long as the parent
has no shear. If the parent has shear, then this matrix will not be
entirely cleared. It will contain shear to counter the parent's shear.
This is required, otherwise the object's local matrix cannot be properly
decomposed into location, rotation and scale, and thus cannot preserve
the world transform.

If the child's world transform has shear, then its world transform is
not preserved. This is currently not supported for consistency in the
handling of shear during the other parenting ops: Parent (Keep
Transform), Clear [Parent] and Keep Transform. If it should work, then
another patch should add the support for all of them.

Reviewed By: sybren, RiggingDojo
Differential Revision: https://developer.blender.org/D14581
2022-04-14 20:25:06 -04:00
48ff456a4b Fix T96875: Envelope modifier strokes cannot be eselected with Tweak
The new created strokes were not setting the right `orig` pointers, so the select operator could not select the strokes and points.

Now, the original pointers are set in the new strokes. To set the values is necessary assign the original pointer from the reference stroke because in modifiers the stroke is evaluated, so we need back two levels: Eval->Eval->Orig
2022-04-14 21:51:38 +02:00
48d2f536e1 Fix crash when loading Blender due to recent change
Issue introduced in {rB80859a6cb272}

Only seen on Windows.

The `keyword_parse` lambda function code did not consider `\r` as a
whitespace char, resulting in a wrong parse.

(More investigation needs to be done).
2022-04-14 15:54:09 -03:00
05715eaea1 Fix: Use after free when removing attribute on instances
Assume that only one layer matches the id and return instead
of continuing to iterate over attributes after the layers have
been potentially reallocated.
2022-04-14 13:04:23 -05:00
80859a6cb2 GPU: Make nodetree GLSL Codegen render engine agnostic
This commit removes all EEVEE specific code from the `gpu_shader_material*.glsl`
files. It defines a clear interface to evaluate the closure nodes leaving
more flexibility to the render engine.

Some of the long standing workaround are fixed:
- bump mapping support is no longer duplicating a lot of node and is instead
  compiled into a function call.
- bump rewiring to Normal socket is no longer needed as we now use a global
  `g_data.N` for that.


Closure sampling with upstread weight eval is now supported if the engine needs
it.

This also makes all the material GLSL sources use `GPUSource` for better
debugging experience. The `GPUFunction` parsing now happens in `GPUSource`
creation.

The whole `GPUCodegen` now uses the `ShaderCreateInfo` and is object type
agnostic. Is has also been rewritten in C++.

This patch changes a view behavior for EEVEE:
- Mix shader node factor imput is now clamped.
- Tangent Vector displacement behavior is now matching cycles.
- The chosen BSDF used for SSR might change.
- Hair shading may have very small changes on very large hairs when using hair
  polygon stripes.
- ShaderToRGB node will remove any SSR and SSS form a shader.
- SSS radius input now is no longer a scaling factor but defines an average
  radius. The SSS kernel "shape" (radii) are still defined by the socket default
  values.

Appart from the listed changes no other regressions are expected.
2022-04-14 18:47:58 +02:00
2889 changed files with 102224 additions and 54719 deletions

View File

@@ -1,6 +1,8 @@
# The warnings below are disabled because they are too pedantic and not worth fixing.
# Some of them will be enabled as part of the Clang-Tidy task, see T78535.
# NOTE: No comments in the list below is allowed. Clang-tidy will ignore items after comments in the lists flag list.
# This is because the comment is not a valid list item and it will stop parsing flags if a list item is a comment.
Checks: >
-*,
readability-*,
@@ -14,10 +16,9 @@ Checks: >
-readability-make-member-function-const,
-readability-suspicious-call-argument,
-readability-redundant-member-init,
-readability-misleading-indentation,
-readability-use-anyofallof,
-readability-identifier-length,
-readability-function-cognitive-complexity,
@@ -35,6 +36,8 @@ Checks: >
-bugprone-redundant-branch-condition,
-bugprone-suspicious-include,
modernize-*,
-modernize-use-auto,
-modernize-use-trailing-return-type,
@@ -42,8 +45,6 @@ Checks: >
-modernize-use-nodiscard,
-modernize-loop-convert,
-modernize-pass-by-value,
# Cannot be enabled yet, because using raw string literals in tests breaks
# the windows compiler currently.
-modernize-raw-string-literal,
-modernize-return-braced-init-list

View File

@@ -34,6 +34,15 @@ indent_style = space
indent_size = 2
max_line_length = 99
# Tom's Obvious Minimal Language
[*.toml]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
max_line_length = 120
# reStructuredText
[*.rst]
charset = utf-8

View File

@@ -284,7 +284,7 @@ option(WITH_IMAGE_TIFF "Enable LibTIFF Support" ON)
option(WITH_IMAGE_DDS "Enable DDS Image Support" ON)
option(WITH_IMAGE_CINEON "Enable CINEON and DPX Image Support" ON)
option(WITH_IMAGE_HDR "Enable HDR Image Support" ON)
option(WITH_IMAGE_WEBP "Enable WebP Image Support" OFF)
option(WITH_IMAGE_WEBP "Enable WebP Image Support" ON)
# Audio/Video format support
option(WITH_CODEC_AVI "Enable Blenders own AVI file support (raw/jpeg)" ON)
@@ -300,9 +300,12 @@ option(WITH_USD "Enable Universal Scene Description (USD) Suppor
# 3D format support
# Disable opencollada when we don't have precompiled libs
option(WITH_OPENCOLLADA "Enable OpenCollada Support (http://www.opencollada.org)" ON)
option(WITH_IO_WAVEFRONT_OBJ "Enable Wavefront-OBJ 3D file format support (*.obj)" ON)
option(WITH_IO_STL "Enable STL 3D file format support (*.stl)" ON)
option(WITH_IO_GPENCIL "Enable grease-pencil file format IO (*.svg, *.pdf)" ON)
# Sound output
option(WITH_SDL "Enable SDL for sound and joystick support" ON)
option(WITH_SDL "Enable SDL for sound" ON)
option(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
if(APPLE)
option(WITH_COREAUDIO "Enable CoreAudio for audio support on macOS" ON)
@@ -439,14 +442,9 @@ endif()
# AMD HIP
if(NOT APPLE)
if(WIN32)
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" ON)
else()
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" OFF)
endif()
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" ON)
option(WITH_CYCLES_HIP_BINARIES "Build Cycles AMD HIP binaries" OFF)
set(CYCLES_HIP_BINARIES_ARCH gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 CACHE STRING "AMD HIP architectures to build binaries for")
set(CYCLES_HIP_BINARIES_ARCH gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 gfx1035 CACHE STRING "AMD HIP architectures to build binaries for")
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
endif()
@@ -491,7 +489,7 @@ if((UNIX AND NOT APPLE) OR (CMAKE_GENERATOR MATCHES "^Visual Studio.+"))
endif()
option(WITH_BOOST "Enable features depending on boost" ON)
option(WITH_TBB "Enable features depending on TBB (OpenVDB, OpenImageDenoise, sculpt multithreading)" ON)
option(WITH_TBB "Enable multithreading. TBB is also required for features such as Cycles, OpenVDB and USD" ON)
# TBB malloc is only supported on for windows currently
if(WIN32)
@@ -770,6 +768,7 @@ endif()
set_and_warn_dependency(WITH_PYTHON WITH_CYCLES OFF)
set_and_warn_dependency(WITH_PYTHON WITH_DRACO OFF)
set_and_warn_dependency(WITH_PYTHON WITH_MOD_FLUID OFF)
if(WITH_DRACO AND NOT WITH_PYTHON_INSTALL)
message(STATUS "WITH_DRACO requires WITH_PYTHON_INSTALL to be ON, disabling WITH_DRACO for now")
@@ -786,7 +785,9 @@ set_and_warn_dependency(WITH_BOOST WITH_OPENCOLORIO OFF)
set_and_warn_dependency(WITH_BOOST WITH_QUADRIFLOW OFF)
set_and_warn_dependency(WITH_BOOST WITH_USD OFF)
set_and_warn_dependency(WITH_BOOST WITH_ALEMBIC OFF)
set_and_warn_dependency(WITH_PUGIXML WITH_CYCLES_OSL OFF)
if(WITH_CYCLES)
set_and_warn_dependency(WITH_PUGIXML WITH_CYCLES_OSL OFF)
endif()
set_and_warn_dependency(WITH_PUGIXML WITH_OPENIMAGEIO OFF)
if(WITH_BOOST AND NOT (WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
@@ -811,6 +812,9 @@ set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENCOLORIO OFF)
# Haru needs `TIFFFaxBlackCodes` & `TIFFFaxWhiteCodes` symbols from TIFF.
set_and_warn_dependency(WITH_IMAGE_TIFF WITH_HARU OFF)
# USD needs OpenSubDiv, since that is used by the Cycles Hydra render delegate.
set_and_warn_dependency(WITH_OPENSUBDIV WITH_USD OFF)
# auto enable openimageio for cycles
if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
@@ -937,7 +941,10 @@ set(PLATFORM_CFLAGS)
set(C_WARNINGS)
set(CXX_WARNINGS)
# for gcc -Wno-blah-blah
# NOTE: These flags are intended for situations where where it's impractical to
# suppress warnings by modifying the code or for code which is maintained externally.
# For GCC this typically means adding `-Wno-*` arguments to negate warnings
# that are useful in the general case.
set(C_REMOVE_STRICT_FLAGS)
set(CXX_REMOVE_STRICT_FLAGS)
@@ -1457,14 +1464,6 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
endif()
endif()
#-----------------------------------------------------------------------------
# Configure Ceres
if(WITH_LIBMV)
# We always have C++11 which includes unordered_map.
set(CERES_DEFINES "-DCERES_STD_UNORDERED_MAP;-DCERES_USE_CXX_THREADS")
endif()
#-----------------------------------------------------------------------------
# Extra limits to number of jobs running in parallel for some kind os tasks.
# Only supported by Ninja build system currently.
@@ -1541,7 +1540,6 @@ endif()
if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_CAST_ALIGN -Wcast-align)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_VLA -Werror=vla)
@@ -1626,6 +1624,18 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5)
endif()
#----------------------
# Suppress Strict Flags
#
# Exclude the following warnings from this list:
# - `-Wno-address`:
# This can give useful hints that point to bugs/misleading logic.
# - `-Wno-strict-prototypes`:
# No need to support older C-style prototypes.
#
# If code in `./extern/` needs to suppress these flags that can be done on a case-by-case basis.
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
@@ -1681,6 +1691,9 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
# ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_MACROS -Wunused-macros)
# ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros)
#----------------------
# Suppress Strict Flags
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
@@ -1746,6 +1759,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
"/wd4828" # The file contains a character that is illegal
"/wd4996" # identifier was declared deprecated
"/wd4661" # no suitable definition provided for explicit template instantiation request
"/wd4848" # 'no_unique_address' is a vendor extension in C++17
# errors:
"/we4013" # 'function' undefined; assuming extern returning int
"/we4133" # incompatible pointer types

View File

@@ -120,7 +120,7 @@ Utilities
Updates git and all submodules but not svn.
* format:
Format source code using clang (uses PATHS if passed in). For example::
Format source code using clang-format & autopep8 (uses PATHS if passed in). For example::
make format PATHS="source/blender/blenlib source/blender/blenkernel"
@@ -130,6 +130,7 @@ Environment Variables
* BUILD_DIR: Override default build path.
* PYTHON: Use this for the Python command (used for checking tools).
* NPROCS: Number of processes to use building (auto-detect when omitted).
* AUTOPEP8: Command used for Python code-formatting (used for the format target).
Documentation Targets
Not associated with building Blender.
@@ -206,6 +207,27 @@ ifeq ($(OS_NCASE),darwin)
endif
endif
# Set the LIBDIR, an empty string when not found.
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU})
ifeq (, $(LIBDIR))
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_centos7_${CPU})
endif
ifeq (, $(LIBDIR))
LIBDIR:=$(wildcard ../lib/${OS_NCASE})
endif
# Use the autopep8 module in ../lib/ (which can be executed via Python directly).
# Otherwise the "autopep8" command can be used.
ifndef AUTOPEP8
ifneq (, $(LIBDIR))
AUTOPEP8:=$(wildcard $(LIBDIR)/python/lib/python3.10/site-packages/autopep8.py)
endif
ifeq (, $(AUTOPEP8))
AUTOPEP8:=autopep8
endif
endif
# -----------------------------------------------------------------------------
# additional targets for the build configuration
@@ -527,8 +549,8 @@ update_code: .FORCE
@$(PYTHON) ./build_files/utils/make_update.py --no-libraries
format: .FORCE
@PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
@PATH="${LIBDIR}/llvm/bin/:$(PATH)" $(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
@$(PYTHON) source/tools/utils_maintenance/autopep8_format_paths.py --autopep8-command="$(AUTOPEP8)" $(PATHS)
# -----------------------------------------------------------------------------

View File

@@ -29,8 +29,9 @@ cmake_minimum_required(VERSION 3.5)
include(ExternalProject)
include(cmake/check_software.cmake)
include(cmake/options.cmake)
include(cmake/versions.cmake)
include(cmake/options.cmake)
include(cmake/boost_build_options.cmake)
include(cmake/download.cmake)
if(ENABLE_MINGW64)
@@ -46,15 +47,13 @@ include(cmake/png.cmake)
include(cmake/jpeg.cmake)
include(cmake/blosc.cmake)
include(cmake/pthreads.cmake)
include(cmake/imath.cmake)
include(cmake/openexr.cmake)
include(cmake/brotli.cmake)
include(cmake/freetype.cmake)
include(cmake/freeglut.cmake)
include(cmake/glew.cmake)
include(cmake/alembic.cmake)
include(cmake/glfw.cmake)
include(cmake/clew.cmake)
include(cmake/cuew.cmake)
include(cmake/opensubdiv.cmake)
include(cmake/sdl.cmake)
include(cmake/opencollada.cmake)
@@ -75,7 +74,6 @@ endif()
include(cmake/osl.cmake)
include(cmake/tbb.cmake)
include(cmake/openvdb.cmake)
include(cmake/nanovdb.cmake)
include(cmake/python.cmake)
option(USE_PIP_NUMPY "Install NumPy using pip wheel instead of building from source" OFF)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
@@ -94,12 +92,15 @@ include(cmake/pugixml.cmake)
include(cmake/ispc.cmake)
include(cmake/openimagedenoise.cmake)
include(cmake/embree.cmake)
include(cmake/fmt.cmake)
include(cmake/robinmap.cmake)
if(NOT APPLE)
include(cmake/xr_openxr.cmake)
endif()
# OpenColorIO and dependencies.
include(cmake/expat.cmake)
include(cmake/pystring.cmake)
include(cmake/yamlcpp.cmake)
include(cmake/opencolorio.cmake)
@@ -107,8 +108,9 @@ if(BLENDER_PLATFORM_ARM)
include(cmake/sse2neon.cmake)
endif()
if(WITH_WEBP)
include(cmake/webp.cmake)
include(cmake/webp.cmake)
if(NOT APPLE)
include(cmake/level-zero.cmake)
endif()
if(NOT WIN32 OR ENABLE_MINGW64)

View File

@@ -1,30 +1,16 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(ALEMBIC_EXTRA_ARGS
-DBUILDSTATIC=ON
-DLINKSTATIC=ON
-DILMBASE_ROOT=${LIBDIR}/openexr
-DALEMBIC_ILMBASE_INCLUDE_DIRECTORY=${LIBDIR}/openexr/include/OpenEXR
-DALEMBIC_ILMBASE_HALF_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DALEMBIC_ILMBASE_IMATH_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DALEMBIC_ILMBASE_ILMTHREAD_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DALEMBIC_ILMBASE_IEX_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DALEMBIC_ILMBASE_IEXMATH_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}IexMath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DUSE_PYILMBASE=0
-DUSE_PYALEMBIC=0
-DUSE_ARNOLD=0
-DUSE_MAYA=0
-DUSE_PRMAN=0
-DUSE_HDF5=Off
-DUSE_STATIC_HDF5=Off
-DUSE_TESTS=Off
-DALEMBIC_NO_OPENGL=1
-DImath_ROOT=${LIBDIR}/imath
-DUSE_PYALEMBIC=OFF
-DUSE_ARNOLD=OFF
-DUSE_MAYA=OFF
-DUSE_PRMAN=OFF
-DUSE_HDF5=OFF
-DUSE_TESTS=OFF
-DUSE_BINARIES=ON
-DALEMBIC_ILMBASE_LINK_STATIC=On
-DALEMBIC_ILMBASE_LINK_STATIC=OFF
-DALEMBIC_SHARED_LIBS=OFF
-DGLUT_INCLUDE_DIR=""
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
)
ExternalProject_Add(external_alembic
@@ -55,6 +41,5 @@ endif()
add_dependencies(
external_alembic
external_zlib
external_openexr
)

View File

@@ -24,7 +24,6 @@ ExternalProject_Add(external_blosc
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${BLOSC_HASH_TYPE}=${BLOSC_HASH}
PREFIX ${BUILD_DIR}/blosc
PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/blosc/src/external_blosc < ${PATCH_DIR}/blosc.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/blosc ${DEFAULT_CMAKE_FLAGS} ${BLOSC_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/blosc
)

View File

@@ -1,22 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(BOOST_ADDRESS_MODEL 64)
if(BLENDER_PLATFORM_ARM)
set(BOOST_ARCHITECTURE arm)
else()
set(BOOST_ARCHITECTURE x86)
endif()
if(WIN32)
if(MSVC_VERSION GREATER_EQUAL 1920) # 2019
set(BOOST_TOOLSET toolset=msvc-14.2)
set(BOOST_COMPILER_STRING -vc142)
else() # 2017
set(BOOST_TOOLSET toolset=msvc-14.1)
set(BOOST_COMPILER_STRING -vc141)
endif()
set(BOOST_CONFIGURE_COMMAND bootstrap.bat)
set(BOOST_BUILD_COMMAND b2)
set(BOOST_BUILD_OPTIONS runtime-link=shared )
@@ -36,11 +20,6 @@ else()
set(BOOST_BUILD_COMMAND ./b2)
set(BOOST_BUILD_OPTIONS cxxflags=${PLATFORM_CXXFLAGS} --disable-icu boost.locale.icu=off)
set(BOOST_PATCH_COMMAND echo .)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(BOOST_ADDRESS_MODEL 64)
else()
set(BOOST_ADDRESS_MODEL 32)
endif()
endif()
if(WITH_BOOST_PYTHON)

View File

@@ -0,0 +1,30 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(BOOST_ADDRESS_MODEL 64)
if(BLENDER_PLATFORM_ARM)
set(BOOST_ARCHITECTURE arm)
else()
set(BOOST_ARCHITECTURE x86)
endif()
if(WIN32)
if(MSVC_VERSION GREATER_EQUAL 1920) # 2019
set(BOOST_TOOLSET toolset=msvc-14.2)
set(BOOST_COMPILER_STRING -vc142)
else() # 2017
set(BOOST_TOOLSET toolset=msvc-14.1)
set(BOOST_COMPILER_STRING -vc141)
endif()
endif()
set(DEFAULT_BOOST_FLAGS
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DBoost_ADDITIONAL_VERSIONS=${BOOST_VERSION_SHORT}
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
)

View File

@@ -1,12 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(CLEW_EXTRA_ARGS)
ExternalProject_Add(external_clew
URL file://${PACKAGE_DIR}/${CLEW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${CLEW_HASH_TYPE}=${CLEW_HASH}
PREFIX ${BUILD_DIR}/clew
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/clew -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${CLEW_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/clew
)

View File

@@ -1,13 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(CUEW_EXTRA_ARGS)
ExternalProject_Add(external_cuew
URL file://${PACKAGE_DIR}/${CUEW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${CUEW_HASH_TYPE}=${CUEW_HASH}
PREFIX ${BUILD_DIR}/cuew
PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/cuew/src/external_cuew < ${PATCH_DIR}/cuew.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/cuew -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${CUEW_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/cuew
)

View File

@@ -39,10 +39,6 @@ download_source(FREETYPE)
download_source(GLEW)
download_source(FREEGLUT)
download_source(ALEMBIC)
download_source(GLFW)
download_source(CLEW)
download_source(GLFW)
download_source(CUEW)
download_source(OPENSUBDIV)
download_source(SDL)
download_source(OPENCOLLADA)
@@ -71,9 +67,7 @@ download_source(FFMPEG)
download_source(FFTW)
download_source(ICONV)
download_source(SNDFILE)
if(WITH_WEBP)
download_source(WEBP)
endif()
download_source(WEBP)
download_source(SPNAV)
download_source(JEMALLOC)
download_source(XML2)
@@ -102,3 +96,8 @@ download_source(HARU)
download_source(ZSTD)
download_source(FLEX)
download_source(BROTLI)
download_source(FMT)
download_source(ROBINMAP)
download_source(IMATH)
download_source(PYSTRING)
download_source(LEVEL_ZERO)

View File

@@ -17,6 +17,16 @@ set(EMBREE_EXTRA_ARGS
-DTBB_STATIC_LIB=${TBB_STATIC_LIBRARY}
)
if(BLENDER_PLATFORM_ARM)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
-DEMBREE_MAX_ISA=NEON)
else()
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
-DEMBREE_MAX_ISA=AVX2)
endif()
if(TBB_STATIC_LIBRARY)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
@@ -37,26 +47,15 @@ else()
set(EMBREE_BUILD_DIR)
endif()
if(BLENDER_PLATFORM_ARM)
ExternalProject_Add(external_embree
GIT_REPOSITORY ${EMBREE_ARM_GIT}
GIT_TAG "blender-arm"
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/embree
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${DEFAULT_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/embree
)
else()
ExternalProject_Add(external_embree
URL file://${PACKAGE_DIR}/${EMBREE_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${EMBREE_HASH_TYPE}=${EMBREE_HASH}
PREFIX ${BUILD_DIR}/embree
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/embree/src/external_embree < ${PATCH_DIR}/embree.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${DEFAULT_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/embree
)
endif()
ExternalProject_Add(external_embree
URL file://${PACKAGE_DIR}/${EMBREE_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${EMBREE_HASH_TYPE}=${EMBREE_HASH}
PREFIX ${BUILD_DIR}/embree
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/embree/src/external_embree < ${PATCH_DIR}/embree.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${DEFAULT_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/embree
)
add_dependencies(
external_embree

View File

@@ -0,0 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(FMT_EXTRA_ARGS
-DFMT_TEST=Off
)
ExternalProject_Add(external_fmt
URL file://${PACKAGE_DIR}/${FMT_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FMT_HASH_TYPE}=${FMT_HASH}
PREFIX ${BUILD_DIR}/fmt
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/fmt ${DEFAULT_CMAKE_FLAGS} ${FMT_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/fmt
)

View File

@@ -1,12 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(GLFW_EXTRA_ARGS)
ExternalProject_Add(external_glfw
URL file://${PACKAGE_DIR}/${GLFW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${GLFW_HASH_TYPE}=${GLFW_HASH}
PREFIX ${BUILD_DIR}/glfw
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/glfw -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${GLFW_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/glfw
)

View File

@@ -14,8 +14,8 @@ if(WIN32)
if(BUILD_MODE STREQUAL Release)
add_custom_target(Harvest_Release_Results
COMMAND # jpeg rename libfile + copy include
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
# png
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
@@ -67,6 +67,8 @@ harvest(brotli/include brotli/include "*.h")
harvest(brotli/lib brotli/lib "*.a")
harvest(boost/include boost/include "*")
harvest(boost/lib boost/lib "*.a")
harvest(imath/include imath/include "*.h")
harvest(imath/lib imath/lib "*.a")
harvest(ffmpeg/include ffmpeg/include "*.h")
harvest(ffmpeg/lib ffmpeg/lib "*.a")
harvest(fftw3/include fftw3/include "*.h")
@@ -80,9 +82,13 @@ harvest(gmp/include gmp/include "*.h")
harvest(gmp/lib gmp/lib "*.a")
harvest(jemalloc/include jemalloc/include "*.h")
harvest(jemalloc/lib jemalloc/lib "*.a")
harvest(jpg/include jpeg/include "*.h")
harvest(jpg/lib jpeg/lib "libjpeg.a")
harvest(jpeg/include jpeg/include "*.h")
harvest(jpeg/lib jpeg/lib "libjpeg.a")
harvest(lame/lib ffmpeg/lib "*.a")
if(NOT APPLE)
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
harvest(level-zero/lib level-zero/lib "*.so*")
endif()
harvest(llvm/bin llvm/bin "clang-format")
if(BUILD_CLANG_TOOLS)
harvest(llvm/bin llvm/bin "clang-tidy")
@@ -135,13 +141,13 @@ harvest(openimagedenoise/include openimagedenoise/include "*")
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
harvest(embree/include embree/include "*.h")
harvest(embree/lib embree/lib "*.a")
harvest(openjpeg/include/openjpeg-2.3 openjpeg/include "*.h")
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
harvest(openvdb/lib openvdb/lib "*.a")
harvest(nanovdb/nanovdb nanovdb/include/nanovdb "*.h")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest(osl/bin osl/bin "oslc")
@@ -169,9 +175,10 @@ harvest(tiff/lib tiff/lib "*.a")
harvest(vorbis/lib ffmpeg/lib "*.a")
harvest(opus/lib ffmpeg/lib "*.a")
harvest(vpx/lib ffmpeg/lib "*.a")
harvest(webp/lib ffmpeg/lib "*.a")
harvest(x264/lib ffmpeg/lib "*.a")
harvest(xvidcore/lib ffmpeg/lib "*.a")
harvest(webp/lib webp/lib "*.a")
harvest(webp/include webp/include "*.h")
harvest(usd/include usd/include "*.h")
harvest(usd/lib/usd usd/lib/usd "*")
harvest(usd/plugin usd/plugin "*")

View File

@@ -0,0 +1,24 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(IMATH_EXTRA_ARGS
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF
-DIMATH_LIB_SUFFIX=${OPENEXR_VERSION_BUILD_POSTFIX}
)
ExternalProject_Add(external_imath
URL file://${PACKAGE_DIR}/${IMATH_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IMATH_HASH_TYPE}=${IMATH_HASH}
PREFIX ${BUILD_DIR}/imath
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/imath ${DEFAULT_CMAKE_FLAGS} ${IMATH_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/imath
)
if(WIN32)
ExternalProject_Add_Step(external_imath after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/imath/lib ${HARVEST_TARGET}/imath/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/imath/include ${HARVEST_TARGET}/imath/include
DEPENDEES install
)
endif()

View File

@@ -2,44 +2,52 @@
if(WIN32)
# cmake for windows
set(JPEG_EXTRA_ARGS -DNASM=${NASM_PATH} -DWITH_JPEG8=ON -DCMAKE_DEBUG_POSTFIX=d -DWITH_CRT_DLL=On)
set(JPEG_EXTRA_ARGS
-DNASM=${NASM_PATH}
-DWITH_JPEG8=ON
-DCMAKE_DEBUG_POSTFIX=d
-DWITH_CRT_DLL=On
-DENABLE_SHARED=OFF
-DENABLE_STATIC=ON
)
ExternalProject_Add(external_jpeg
URL file://${PACKAGE_DIR}/${JPEG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${JPEG_HASH_TYPE}=${JPEG_HASH}
PREFIX ${BUILD_DIR}/jpg
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/jpg
PREFIX ${BUILD_DIR}/jpeg
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpeg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/jpeg
)
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_jpeg after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/jpg/lib/jpegd${LIBEXT} ${LIBDIR}/jpg/lib/jpeg${LIBEXT}
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Release)
set(JPEG_LIBRARY jpeg-static${LIBEXT})
else()
set(JPEG_LIBRARY jpeg-staticd${LIBEXT})
endif()
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_jpeg after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/${JPEG_LIBRARY} ${LIBDIR}/jpeg/lib/jpeg${LIBEXT}
DEPENDEES install
)
endif()
else(WIN32)
# cmake for unix
set(JPEG_EXTRA_ARGS
-DWITH_JPEG8=ON
-DENABLE_STATIC=ON
-DENABLE_SHARED=OFF
-DCMAKE_INSTALL_LIBDIR=${LIBDIR}/jpg/lib)
-DCMAKE_INSTALL_LIBDIR=${LIBDIR}/jpeg/lib)
ExternalProject_Add(external_jpeg
URL file://${PACKAGE_DIR}/${JPEG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${JPEG_HASH_TYPE}=${JPEG_HASH}
PREFIX ${BUILD_DIR}/jpg
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/jpg
PREFIX ${BUILD_DIR}/jpeg
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpeg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/jpeg
)
set(JPEG_LIBRARY libjpeg${LIBEXT})

View File

@@ -0,0 +1,21 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(LEVEL_ZERO_EXTRA_ARGS
)
ExternalProject_Add(external_level-zero
URL file://${PACKAGE_DIR}/${LEVEL_ZERO_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${LEVEL_ZERO_HASH_TYPE}=${LEVEL_ZERO_HASH}
PREFIX ${BUILD_DIR}/level-zero
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/level-zero/src/external_level-zero < ${PATCH_DIR}/level-zero.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/level-zero ${DEFAULT_CMAKE_FLAGS} ${LEVEL_ZERO_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/level-zero
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_level-zero after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/level-zero ${HARVEST_TARGET}/level-zero
DEPENDEES install
)
endif()

View File

@@ -1,39 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(NANOVDB_EXTRA_ARGS
# NanoVDB is header-only, so only need the install target
-DNANOVDB_BUILD_UNITTESTS=OFF
-DNANOVDB_BUILD_EXAMPLES=OFF
-DNANOVDB_BUILD_BENCHMARK=OFF
-DNANOVDB_BUILD_DOCS=OFF
-DNANOVDB_BUILD_TOOLS=OFF
-DNANOVDB_CUDA_KEEP_PTX=OFF
# Do not need to include any of the dependencies because of this
-DNANOVDB_USE_OPENVDB=OFF
-DNANOVDB_USE_OPENGL=OFF
-DNANOVDB_USE_OPENCL=OFF
-DNANOVDB_USE_CUDA=OFF
-DNANOVDB_USE_TBB=OFF
-DNANOVDB_USE_BLOSC=OFF
-DNANOVDB_USE_ZLIB=OFF
-DNANOVDB_USE_OPTIX=OFF
-DNANOVDB_ALLOW_FETCHCONTENT=OFF
)
ExternalProject_Add(nanovdb
URL file://${PACKAGE_DIR}/${NANOVDB_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${NANOVDB_HASH_TYPE}=${NANOVDB_HASH}
PREFIX ${BUILD_DIR}/nanovdb
SOURCE_SUBDIR nanovdb
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/nanovdb/src/nanovdb < ${PATCH_DIR}/nanovdb.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/nanovdb ${DEFAULT_CMAKE_FLAGS} ${NANOVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/nanovdb
)
if(WIN32)
ExternalProject_Add_Step(nanovdb after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/nanovdb/nanovdb ${HARVEST_TARGET}/nanovdb/include/nanovdb
DEPENDEES install
)
endif()

View File

@@ -11,13 +11,12 @@ set(OPENCOLORIO_EXTRA_ARGS
-DOCIO_BUILD_GPU_TESTS=OFF
-DOCIO_USE_SSE=ON
# Manually build ext packages except for pystring, which does not have
# a CMake or autotools build system that we can easily use.
-DOCIO_INSTALL_EXT_PACKAGES=MISSING
-DHalf_ROOT=${LIBDIR}/openexr
-DHalf_STATIC_LIBRARY=ON
-DOCIO_INSTALL_EXT_PACKAGES=NONE
-Dexpat_ROOT=${LIBDIR}/expat
-Dyaml-cpp_ROOT=${LIBDIR}/yamlcpp
-Dpystring_ROOT=${LIBDIR}/pystring
-DImath_ROOT=${LIBDIR}/imath
)
if(BLENDER_PLATFORM_ARM)
@@ -30,7 +29,9 @@ endif()
if(WIN32)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
-DOCIO_INLINES_HIDDEN=OFF
-Dexpat_LIBRARY=${LIBDIR}/expat/lib/libexpatMD
-Dyaml-cpp_LIBRARY=${LIBDIR}/expat/lib/libyaml-cppmd.lib
-DImath_LIBRARY=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}
)
else()
set(OPENCOLORIO_EXTRA_ARGS
@@ -52,7 +53,8 @@ add_dependencies(
external_opencolorio
external_yamlcpp
external_expat
external_openexr
external_imath
external_pystring
)
if(WIN32)
@@ -62,7 +64,7 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib ${HARVEST_TARGET}/opencolorio/lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatMD.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pystring/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring.lib
DEPENDEES install
)
endif()
@@ -71,7 +73,7 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/Opencolorio.lib ${HARVEST_TARGET}/opencolorio/lib/OpencolorIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmdd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatdMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatdMD.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pystring/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring_d.lib
DEPENDEES install
)
endif()
@@ -79,7 +81,7 @@ else()
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND cp ${LIBDIR}/yamlcpp/lib/libyaml-cpp.a ${LIBDIR}/opencolorio/lib/
COMMAND cp ${LIBDIR}/expat/lib/libexpat.a ${LIBDIR}/opencolorio/lib/
COMMAND cp ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/libpystring.a ${LIBDIR}/opencolorio/lib/
COMMAND cp ${LIBDIR}/pystring/lib/libpystring.a ${LIBDIR}/opencolorio/lib/
DEPENDEES install
)
endif()

View File

@@ -16,12 +16,10 @@ set(OPENEXR_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBUILD_TESTING=OFF
-DOPENEXR_BUILD_BOTH_STATIC_SHARED=OFF
-DILMBASE_BUILD_BOTH_STATIC_SHARED=OFF
-DBUILD_SHARED_LIBS=OFF
-DOPENEXR_BUILD_UTILS=OFF
-DPYILMBASE_ENABLE=OFF
-DOPENEXR_VIEWERS_ENABLE=OFF
-DILMBASE_LIB_SUFFIX=${OPENEXR_VERSION_BUILD_POSTFIX}
-DOPENEXR_INSTALL_TOOLS=OFF
-DOPENEXR_INSTALL_EXAMPLES=OFF
-DImath_DIR=${LIBDIR}/imath/lib/cmake/Imath
-DOPENEXR_LIB_SUFFIX=${OPENEXR_VERSION_BUILD_POSTFIX}
)

View File

@@ -8,6 +8,7 @@ set(OIDN_EXTRA_ARGS
-DOIDN_STATIC_LIB=ON
-DOIDN_STATIC_RUNTIME=OFF
-DISPC_EXECUTABLE=${LIBDIR}/ispc/bin/ispc
-DOIDN_FILTER_RTLIGHTMAP=OFF
)
if(WIN32)

View File

@@ -23,35 +23,20 @@ else()
set(OIIO_SIMD_FLAGS)
endif()
if(WITH_WEBP)
set(WEBP_ARGS
-DWEBP_INCLUDE_DIR=${LIBDIR}/webp/include
-DWEBP_LIBRARY=${LIBDIR}/webp/lib/${LIBPREFIX}webp${LIBEXT}
)
set(WEBP_DEP external_webp)
endif()
if(MSVC)
set(OPENJPEG_FLAGS
-DOpenJpeg_ROOT=${LIBDIR}/openjpeg_msvc
-DOpenJPEG_ROOT=${LIBDIR}/openjpeg_msvc
)
else()
set(OPENJPEG_FLAGS
-DOpenJpeg_ROOT=${LIBDIR}/openjpeg
-DOpenJPEG_ROOT=${LIBDIR}/openjpeg
)
endif()
set(OPENIMAGEIO_EXTRA_ARGS
-DBUILD_SHARED_LIBS=OFF
${OPENIMAGEIO_LINKSTATIC}
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
${DEFAULT_BOOST_FLAGS}
-DUSE_LIBSQUISH=OFF
-DUSE_QT5=OFF
-DUSE_NUKE=OFF
@@ -62,7 +47,6 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_LIBHEIF=OFF
-DUSE_OPENGL=OFF
-DUSE_TBB=OFF
-DUSE_FIELD3D=OFF
-DUSE_QT=OFF
-DUSE_PYTHON=OFF
-DUSE_GIF=OFF
@@ -73,7 +57,7 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_FREETYPE=OFF
-DUSE_LIBRAW=OFF
-DUSE_OPENCOLORIO=OFF
-DUSE_WEBP=${WITH_WEBP}
-DUSE_WEBP=ON
-DOIIO_BUILD_TOOLS=${OIIO_TOOLS}
-DOIIO_BUILD_TESTS=OFF
-DBUILD_TESTING=OFF
@@ -83,14 +67,9 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DPNG_PNG_INCLUDE_DIR=${LIBDIR}/png/include
-DTIFF_LIBRARY=${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT}
-DTIFF_INCLUDE_DIR=${LIBDIR}/tiff/include
-DJPEG_LIBRARY=${LIBDIR}/jpg/lib/${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpg/include
-DJPEG_LIBRARY=${LIBDIR}/jpeg/lib/${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpeg/include
${OPENJPEG_FLAGS}
-DOpenEXR_USE_STATIC_LIBS=On
-DILMBASE_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_HALF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IMATH_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
@@ -98,8 +77,14 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_EXTERNAL_PUGIXML=ON
-DPUGIXML_LIBRARY=${LIBDIR}/pugixml/lib/${LIBPREFIX}pugixml${LIBEXT}
-DPUGIXML_INCLUDE_DIR=${LIBDIR}/pugixml/include/
${WEBP_FLAGS}
-DBUILD_MISSING_ROBINMAP=OFF
-DBUILD_MISSING_FMT=OFF
-DFMT_INCLUDE_DIR=${LIBDIR}/fmt/include/
-DRobinmap_ROOT=${LIBDIR}/robinmap
-DWebP_ROOT=${LIBDIR}/webp
${OIIO_SIMD_FLAGS}
-DOpenEXR_ROOT=${LIBDIR}/openexr
-DImath_ROOT=${LIBDIR}/imath
)
ExternalProject_Add(external_openimageio
@@ -117,12 +102,15 @@ add_dependencies(
external_png
external_zlib
external_openexr
external_imath
external_jpeg
external_boost
external_tiff
external_pugixml
external_fmt
external_robinmap
external_openjpeg${OPENJPEG_POSTFIX}
${WEBP_DEP}
external_webp
)
if(WIN32)
@@ -137,8 +125,8 @@ if(WIN32)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_openimageio after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_d.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util_d.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib
DEPENDEES install
)
endif()

View File

@@ -3,20 +3,24 @@
# Note the encoder/decoder may use png/tiff/lcms system libraries, but the
# library itself does not depend on them, so should give no problems.
set(OPENJPEG_EXTRA_ARGS -DBUILD_SHARED_LIBS=OFF)
if(WIN32)
set(OPENJPEG_EXTRA_ARGS -G "MSYS Makefiles" -DBUILD_PKGCONFIG_FILES=On)
else()
set(OPENJPEG_EXTRA_ARGS ${DEFAULT_CMAKE_FLAGS})
endif()
set(OPENJPEG_EXTRA_ARGS
${OPENJPEG_EXTRA_ARGS}
-DBUILD_SHARED_LIBS=OFF
-DBUILD_CODEC=OFF
)
ExternalProject_Add(external_openjpeg
URL file://${PACKAGE_DIR}/${OPENJPEG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENJPEG_HASH_TYPE}=${OPENJPEG_HASH}
PREFIX ${BUILD_DIR}/openjpeg
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build && ${CMAKE_COMMAND} ${OPENJPEG_EXTRA_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openjpeg -DBUILD_SHARED_LIBS=Off -DBUILD_THIRDPARTY=OFF ${BUILD_DIR}/openjpeg/src/external_openjpeg
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build && ${CMAKE_COMMAND} ${OPENJPEG_EXTRA_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openjpeg ${BUILD_DIR}/openjpeg/src/external_openjpeg
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build/ && make install
INSTALL_DIR ${LIBDIR}/openjpeg

View File

@@ -1,19 +1,25 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(OPENSUBDIV_EXTRA_ARGS
-DNO_LIB=OFF
-DNO_EXAMPLES=ON
-DNO_TUTORIALS=ON
-DNO_REGRESSION=ON
-DNO_PYTHON=ON
-DNO_MAYA=ON
-DNO_PTEX=ON
-DNO_DOC=ON
-DNO_CLEW=OFF
-DNO_OPENCL=OFF
-DNO_TUTORIALS=ON
-DGLEW_INCLUDE_DIR=${LIBDIR}/glew/include
-DGLEW_LIBRARY=${LIBDIR}/glew/lib/libGLEW${LIBEXT}
-DGLFW_INCLUDE_DIR=${LIBDIR}/glfw/include
-DGLFW_LIBRARIES=${LIBDIR}/glfw/lib/glfw3${LIBEXT}
-DNO_OMP=ON
-DNO_TBB=OFF
-DNO_CUDA=ON
-DNO_OPENCL=ON
-DNO_CLEW=ON
-DNO_OPENGL=OFF
-DNO_METAL=OFF
-DNO_DX=ON
-DNO_TESTS=ON
-DNO_GLTESTS=ON
-DNO_GLEW=ON
-DNO_GLFW=ON
-DNO_GLFW_X11=ON
)
if(WIN32)
@@ -21,30 +27,12 @@ if(WIN32)
${OPENSUBDIV_EXTRA_ARGS}
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/tbb.lib
-DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/CL
-DCLEW_LIBRARY=${LIBDIR}/clew/lib/clew${LIBEXT}
-DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include
-DCUEW_LIBRARY=${LIBDIR}/cuew/lib/cuew${LIBEXT}
)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DNO_CUDA=OFF
)
else()
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DNO_CUDA=ON
)
endif()
else()
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DNO_CUDA=ON
-DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include
-DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/CL
-DCLEW_LIBRARY=${LIBDIR}/clew/lib/static/${LIBPREFIX}clew${LIBEXT}
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTBB_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
)
endif()
@@ -76,9 +64,5 @@ endif()
add_dependencies(
external_opensubdiv
external_glew
external_glfw
external_clew
external_cuew
external_tbb
)

View File

@@ -13,6 +13,7 @@ else()
endif()
set(OPENVDB_EXTRA_ARGS
${DEFAULT_BOOST_FLAGS}
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
@@ -24,22 +25,20 @@ set(OPENVDB_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBlosc_INCLUDE_DIR=${LIBDIR}/blosc/include/
-DBlosc_LIBRARY=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT}
-DOPENVDB_ENABLE_3_ABI_COMPATIBLE=OFF
-DOPENVDB_BUILD_UNITTESTS=Off
-DOPENVDB_BUILD_PYTHON_MODULE=Off
-DBlosc_LIBRARY_RELEASE=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT}
-DBlosc_LIBRARY_DEBUG=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT}
-DOPENVDB_BUILD_UNITTESTS=OFF
-DOPENVDB_BUILD_PYTHON_MODULE=OFF
-DOPENVDB_BUILD_NANOVDB=ON
-DNANOVDB_BUILD_TOOLS=OFF
-DBlosc_ROOT=${LIBDIR}/blosc/
-DTBB_ROOT=${LIBDIR}/tbb/
-DOpenEXR_ROOT=${LIBDIR}/openexr
-DIlmBase_ROOT=${LIBDIR}/openexr
-DOPENEXR_LIBRARYDIR=${LIBDIR}/openexr/lib
# All libs live in openexr, even the ilmbase ones
-DILMBASE_LIBRARYDIR=${LIBDIR}/openexr/lib
-DOPENVDB_CORE_SHARED=${OPENVDB_SHARED}
-DOPENVDB_CORE_STATIC=${OPENVDB_STATIC}
-DOPENVDB_BUILD_BINARIES=Off
-DOPENVDB_BUILD_BINARIES=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-DILMBASE_USE_STATIC_LIBS=On
-DOPENEXR_USE_STATIC_LIBS=On
-DBLOSC_USE_STATIC_LIBS=ON
-DUSE_NANOVDB=ON
)
if(WIN32)
@@ -48,15 +47,6 @@ if(WIN32)
# needs to link pthreads due to it being a blosc dependency
set(OPENVDB_EXTRA_ARGS ${OPENVDB_EXTRA_ARGS}
-DCMAKE_CXX_STANDARD_LIBRARIES="${LIBDIR}/pthreads/lib/pthreadVC3.lib"
-DUSE_EXR=On
)
else()
# OpenVDB can't find the _static libraries automatically.
set(OPENVDB_EXTRA_ARGS ${OPENVDB_EXTRA_ARGS}
-DTbb_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
-DTbb_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
-DTbb_tbbmalloc_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbbmalloc_static${LIBEXT}
-DTbb_tbbmalloc_proxy_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbbmalloc_proxy_static${LIBEXT}
)
endif()
@@ -74,7 +64,6 @@ add_dependencies(
openvdb
external_tbb
external_boost
external_openexr
external_zlib
external_blosc
)
@@ -82,7 +71,7 @@ add_dependencies(
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(openvdb after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include/openvdb ${HARVEST_TARGET}/openvdb/include/openvdb
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include ${HARVEST_TARGET}/openvdb/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb.lib ${HARVEST_TARGET}/openvdb/lib/openvdb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll
DEPENDEES install

View File

@@ -3,7 +3,6 @@
if(WIN32)
option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/fftw3 by installing mingw64" ON)
endif()
option(WITH_WEBP "Enable building of oiio with webp support" OFF)
option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF)
cmake_host_system_information(RESULT NUM_CORES QUERY NUMBER_OF_LOGICAL_CORES)
set(MAKE_THREADS ${NUM_CORES} CACHE STRING "Number of threads to run make with")
@@ -42,29 +41,29 @@ if(WIN32)
set(LIBPREFIX "")
# For OIIO and OSL
set(COMMON_DEFINES /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
set(COMMON_DEFINES /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
if(MSVC_VERSION GREATER 1909)
set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings.
endif()
string(APPEND COMMON_MSVC_FLAGS " /bigobj")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
endif()
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MD ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MD ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
endif()
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MD /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MD /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(PLATFORM_FLAGS)
set(PLATFORM_CXX_FLAGS)

View File

@@ -3,33 +3,15 @@
if(WIN32)
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}")
set(OSL_FLEX_BISON -DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe -DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe)
set(OSL_SIMD_FLAGS -DOIIO_NOSIMD=1 -DOIIO_SIMD=sse2)
else()
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES)
set(OSL_FLEX_BISON)
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}")
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpeg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}")
endif()
set(OSL_ILMBASE_CUSTOM_LIBRARIES "${LIBDIR}/openexr/lib/Imath${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Half{OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/IlmThread${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Iex${OPENEXR_VERSION_POSTFIX}.lib")
set(OSL_EXTRA_ARGS
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
${DEFAULT_BOOST_FLAGS}
-DOpenEXR_ROOT=${LIBDIR}/openexr/
-DIlmBase_ROOT=${LIBDIR}/openexr/
-DILMBASE_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_HALF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IMATH_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOpenImageIO_ROOT=${LIBDIR}/openimageio/
-DOSL_BUILD_TESTS=OFF
-DOSL_BUILD_MATERIALX=OFF
@@ -49,10 +31,10 @@ set(OSL_EXTRA_ARGS
-DUSE_QT=OFF
-DUSE_Qt5=OFF
-DINSTALL_DOCS=OFF
${OSL_SIMD_FLAGS}
-Dpugixml_ROOT=${LIBDIR}/pugixml
-DUSE_PYTHON=OFF
-DCMAKE_CXX_STANDARD=14
-DImath_ROOT=${LIBDIR}/imath
)
ExternalProject_Add(external_osl

View File

@@ -0,0 +1,22 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(PYSTRING_EXTRA_ARGS
)
ExternalProject_Add(external_pystring
URL file://${PACKAGE_DIR}/${PYSTRING_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${PYSTRING_HASH_TYPE}=${PYSTRING_HASH}
PREFIX ${BUILD_DIR}/pystring
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_pystring.txt ${BUILD_DIR}/pystring/src/external_pystring/CMakeLists.txt
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/pystring ${DEFAULT_CMAKE_FLAGS} ${PYSTRING_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/pystring
)
if(WIN32)
ExternalProject_Add_Step(external_pystring after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pystring/lib ${HARVEST_TARGET}/pystring/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pystring/include ${HARVEST_TARGET}/pystring/include
DEPENDEES install
)
endif()

View File

@@ -15,7 +15,7 @@ ExternalProject_Add(external_python_site_packages
CONFIGURE_COMMAND ${PIP_CONFIGURE_COMMAND}
BUILD_COMMAND ""
PREFIX ${BUILD_DIR}/site_packages
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} --no-binary :all:
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} autopep8==${AUTOPEP8_VERSION} pycodestyle==${PYCODESTYLE_VERSION} toml==${TOML_VERSION} --no-binary :all:
)
if(USE_PIP_NUMPY)

View File

@@ -0,0 +1,13 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(ROBINMAP_EXTRA_ARGS
)
ExternalProject_Add(external_robinmap
URL file://${PACKAGE_DIR}/${ROBINMAP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${ROBINMAP_HASH_TYPE}=${ROBINMAP_HASH}
PREFIX ${BUILD_DIR}/robinmap
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/robinmap ${DEFAULT_CMAKE_FLAGS} ${ROBINMAP_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/robinmap
)

View File

@@ -1,11 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WITH_WEBP)
set(WITH_TIFF_WEBP ON)
else()
set(WITH_TIFF_WEBP OFF)
endif()
set(TIFF_EXTRA_ARGS
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include
@@ -14,7 +8,7 @@ set(TIFF_EXTRA_ARGS
-Dlzma=OFF
-Djbig=OFF
-Dzstd=OFF
-Dwebp=${WITH_TIFF_WEBP}
-Dwebp=OFF
)
ExternalProject_Add(external_tiff

View File

@@ -1,39 +1,72 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
# OIIO and OSL are statically linked for us, but USD doesn't know
set(USD_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DOIIO_STATIC_DEFINE /DOSL_STATIC_DEFINE")
if(BUILD_MODE STREQUAL Debug)
# USD does not look for debug libs, nor does it link them
# when building static, so this is just to keep find_package happy
# if we ever link dynamically on windows util will need to be linked as well.
set(USD_OIIO_CMAKE_DEFINES "-DOIIO_LIBRARIES=${LIBDIR}/openimageio/lib/OpenImageIO_d${LIBEXT}")
endif()
set(USD_PLATFORM_FLAGS
${USD_OIIO_CMAKE_DEFINES}
-DCMAKE_CXX_FLAGS=${USD_CXX_FLAGS}
)
endif()
set(USD_EXTRA_ARGS
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
${DEFAULT_BOOST_FLAGS}
${USD_PLATFORM_FLAGS}
# This is a preventative measure that avoids possible conflicts when add-ons
# try to load another USD library into the same process space.
-DPXR_SET_INTERNAL_NAMESPACE=usdBlender
-DOPENSUBDIV_ROOT_DIR=${LIBDIR}/opensubdiv
-DOpenImageIO_ROOT=${LIBDIR}/openimageio
-DOPENEXR_LIBRARIES=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/imath/include
-DPXR_ENABLE_PYTHON_SUPPORT=OFF
-DPXR_BUILD_IMAGING=ON
-DPXR_BUILD_TESTS=OFF
-DPXR_BUILD_EXAMPLES=OFF
-DPXR_BUILD_TUTORIALS=OFF
-DPXR_ENABLE_HDF5_SUPPORT=OFF
-DPXR_ENABLE_MATERIALX_SUPPORT=OFF
-DPXR_ENABLE_OPENVDB_SUPPORT=OFF
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
-DPXR_BUILD_MONOLITHIC=ON
# OSL is an optional dependency of the Imaging module. However, since that
# module was included for its support for converting primitive shapes (sphere,
# cube, etc.) to geometry, it's not necessary. Disabling it will make it
# simpler to build Blender; currently only Cycles uses OSL.
-DPXR_ENABLE_OSL_SUPPORT=OFF
# GL support on Linux also links to X11 libraries. Enabling it would break
# headless or Wayland-only builds. OpenGL support would be useful if someone
# wants to work on a Hydra viewport in Blender; when that's actually being
# worked on, we could patch in a new PXR_ENABLE_X11_SUPPORT option (to
# separate OpenGL from X11) and contribute it upstream.
-DPXR_ENABLE_GL_SUPPORT=OFF
# Disable Metal since USD fails to build this when OpenGL is disabled.
-DPXR_ENABLE_METAL_SUPPORT=OFF
# OIIO is used for loading image textures in Hydra Storm / Embree renderers,
# which we don't use.
-DPXR_BUILD_OPENIMAGEIO_PLUGIN=OFF
# USD 22.03 does not support OCIO 2.x
# Tracking ticket https://github.com/PixarAnimationStudios/USD/issues/1386
-DPXR_BUILD_OPENCOLORIO_PLUGIN=OFF
-DPXR_ENABLE_PTEX_SUPPORT=OFF
-DPXR_BUILD_USD_TOOLS=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-DBUILD_SHARED_LIBS=Off
# USD is hellbound on making a shared lib, unless you point this variable to a valid cmake file
# doesn't have to make sense, but as long as it points somewhere valid it will skip the shared lib.
-DPXR_MONOLITHIC_IMPORT=${BUILD_DIR}/usd/src/external_usd/cmake/defaults/Version.cmake
-DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
# USD wants the tbb debug lib set even when you are doing a release build
# Otherwise it will error out during the cmake configure phase.
-DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
# This is a preventative measure that avoids possible conflicts when add-ons
# try to load another USD library into the same process space.
-DPXR_SET_INTERNAL_NAMESPACE=usdBlender
-DPXR_ENABLE_PYTHON_SUPPORT=OFF
-DPXR_BUILD_IMAGING=OFF
-DPXR_BUILD_TESTS=OFF
-DBUILD_SHARED_LIBS=OFF
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
-DPXR_BUILD_MONOLITHIC=ON
# The PXR_BUILD_USD_TOOLS argument is patched-in by usd.diff. An upstream pull request
# can be found at https://github.com/PixarAnimationStudios/USD/pull/1048.
-DPXR_BUILD_USD_TOOLS=OFF
-DCMAKE_DEBUG_POSTFIX=_d
# USD is hellbound on making a shared lib, unless you point this variable to a valid cmake file
# doesn't have to make sense, but as long as it points somewhere valid it will skip the shared lib.
-DPXR_MONOLITHIC_IMPORT=${BUILD_DIR}/usd/src/external_usd/cmake/defaults/Version.cmake
)
ExternalProject_Add(external_usd
@@ -50,37 +83,31 @@ add_dependencies(
external_usd
external_tbb
external_boost
external_opensubdiv
)
# Since USD 21.11 the libraries are prefixed with "usd_", i.e. "libusd_m.a" became "libusd_usd_m.a".
# See https://github.com/PixarAnimationStudios/USD/blob/release/CHANGELOG.md#2111---2021-11-01
if (USD_VERSION VERSION_LESS 21.11)
set(PXR_LIB_PREFIX "")
else()
set(PXR_LIB_PREFIX "usd_")
if(NOT WIN32)
if (USD_VERSION VERSION_LESS 21.11)
set(PXR_LIB_PREFIX "")
else()
set(PXR_LIB_PREFIX "usd_")
endif()
endif()
if(WIN32)
# USD currently demands python be available at build time
# and then proceeds not to use it, but still checks that the
# version of the interpreter it is not going to use is atleast 2.7
# so we need this dep currently since there is no system python
# on windows.
add_dependencies(
external_usd
external_python
)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/ ${HARVEST_TARGET}/usd
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Release/${PXR_LIB_PREFIX}usd_m.lib ${HARVEST_TARGET}/usd/lib/lib${PXR_LIB_PREFIX}usd_m.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Release/usd_usd_m.lib ${HARVEST_TARGET}/usd/lib/usd_usd_m.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib ${HARVEST_TARGET}/usd/lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Debug/${PXR_LIB_PREFIX}usd_m_d.lib ${HARVEST_TARGET}/usd/lib/lib${PXR_LIB_PREFIX}usd_m_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Debug/usd_usd_m_d.lib ${HARVEST_TARGET}/usd/lib/usd_usd_m_d.lib
DEPENDEES install
)
endif()

View File

@@ -1,14 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(ZLIB_VERSION 1.2.11)
set(ZLIB_VERSION 1.2.12)
set(ZLIB_URI https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz)
set(ZLIB_HASH 1c9f62f0778697a09d36121ead88e08e)
set(ZLIB_HASH 5fc414a9726be31427b440b434d05f78)
set(ZLIB_HASH_TYPE MD5)
set(ZLIB_FILE zlib-${ZLIB_VERSION}.tar.gz)
set(OPENAL_VERSION 1.20.1)
set(OPENAL_VERSION 1.21.1)
set(OPENAL_URI http://openal-soft.org/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2)
set(OPENAL_HASH 556695068ce8375b89986083d810fd35)
set(OPENAL_HASH a936806ebd8de417b0ffd8cf3f48f456)
set(OPENAL_HASH_TYPE MD5)
set(OPENAL_FILE openal-soft-${OPENAL_VERSION}.tar.bz2)
@@ -18,24 +18,24 @@ set(PNG_HASH 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca)
set(PNG_HASH_TYPE SHA256)
set(PNG_FILE libpng-${PNG_VERSION}.tar.xz)
set(JPEG_VERSION 2.0.4)
set(JPEG_VERSION 2.1.3)
set(JPEG_URI https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_VERSION}.tar.gz)
set(JPEG_HASH 44c43e4a9fb352f47090804529317c88)
set(JPEG_HASH 627b980fad0573e08e4c3b80b290fc91)
set(JPEG_HASH_TYPE MD5)
set(JPEG_FILE libjpeg-turbo-${JPEG_VERSION}.tar.gz)
set(BOOST_VERSION 1.73.0)
set(BOOST_VERSION_NODOTS 1_73_0)
set(BOOST_VERSION_NODOTS_SHORT 1_73)
set(BOOST_VERSION 1.78.0)
set(BOOST_VERSION_SHORT 1.78)
set(BOOST_VERSION_NODOTS 1_78_0)
set(BOOST_VERSION_NODOTS_SHORT 1_78)
set(BOOST_URI https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_HASH 4036cd27ef7548b8d29c30ea10956196)
set(BOOST_HASH c2f6428ac52b0e5a3c9b2e1d8cc832b5)
set(BOOST_HASH_TYPE MD5)
set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz)
# Using old version as recommended by OpenVDB build documentation.
set(BLOSC_VERSION 1.5.0)
set(BLOSC_VERSION 1.21.1)
set(BLOSC_URI https://github.com/Blosc/c-blosc/archive/v${BLOSC_VERSION}.tar.gz)
set(BLOSC_HASH 6e4a49c8c06f05aa543f3312cfce3d55)
set(BLOSC_HASH 134b55813b1dca57019d2a2dc1f7a923)
set(BLOSC_HASH_TYPE MD5)
set(BLOSC_FILE blosc-${BLOSC_VERSION}.tar.gz)
@@ -45,12 +45,19 @@ set(PTHREADS_HASH f3bf81bb395840b3446197bcf4ecd653)
set(PTHREADS_HASH_TYPE MD5)
set(PTHREADS_FILE pthreads4w-code-${PTHREADS_VERSION}.zip)
set(OPENEXR_VERSION 2.5.5)
set(OPENEXR_VERSION 3.1.4)
set(OPENEXR_URI https://github.com/AcademySoftwareFoundation/openexr/archive/v${OPENEXR_VERSION}.tar.gz)
set(OPENEXR_HASH 85e8a979092c9055d10ed103062d31a0)
set(OPENEXR_HASH e990be1ff765797bc2d93a8060e1c1f2)
set(OPENEXR_HASH_TYPE MD5)
set(OPENEXR_FILE openexr-${OPENEXR_VERSION}.tar.gz)
set(IMATH_VERSION 3.1.4)
set(IMATH_URI https://github.com/AcademySoftwareFoundation/Imath/archive/v${OPENEXR_VERSION}.tar.gz)
set(IMATH_HASH fddf14ec73e12c34e74c3c175e311a3f)
set(IMATH_HASH_TYPE MD5)
set(IMATH_FILE imath-${IMATH_VERSION}.tar.gz)
if(WIN32)
# Openexr started appending _d on its own so now
# we need to tell the build the postfix is _s while
@@ -85,42 +92,21 @@ set(FREEGLUT_HASH 90c3ca4dd9d51cf32276bc5344ec9754)
set(FREEGLUT_HASH_TYPE MD5)
set(FREEGLUT_FILE freeglut-${FREEGLUT_VERSION}.tar.gz)
set(ALEMBIC_VERSION 1.7.16)
set(ALEMBIC_VERSION 1.8.3)
set(ALEMBIC_URI https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz)
set(ALEMBIC_HASH effcc86e42fe6605588e3de57bde6677)
set(ALEMBIC_HASH 2cd8d6e5a3ac4a014e24a4b04f4fadf9)
set(ALEMBIC_HASH_TYPE MD5)
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
# hash is for 3.1.2
set(GLFW_GIT_UID 30306e54705c3adae9fe082c816a3be71963485c)
set(GLFW_URI https://github.com/glfw/glfw/archive/${GLFW_GIT_UID}.zip)
set(GLFW_HASH 20cacb1613da7eeb092f3ac4f6b2b3d0)
set(GLFW_HASH_TYPE MD5)
set(GLFW_FILE glfw-${GLFW_GIT_UID}.zip)
# latest uid in git as of 2016-04-01
set(CLEW_GIT_UID 277db43f6cafe8b27c6f1055f69dc67da4aeb299)
set(CLEW_URI https://github.com/OpenCLWrangler/clew/archive/${CLEW_GIT_UID}.zip)
set(CLEW_HASH 2c699d10ed78362e71f56fae2a4c5f98)
set(CLEW_HASH_TYPE MD5)
set(CLEW_FILE clew-${CLEW_GIT_UID}.zip)
# latest uid in git as of 2016-04-01
set(CUEW_GIT_UID 1744972026de9cf27c8a7dc39cf39cd83d5f922f)
set(CUEW_URI https://github.com/CudaWrangler/cuew/archive/${CUEW_GIT_UID}.zip)
set(CUEW_HASH 86760d62978ebfd96cd93f5aa1abaf4a)
set(CUEW_HASH_TYPE MD5)
set(CUEW_FILE cuew-${CUEW_GIT_UID}.zip)
set(OPENSUBDIV_VERSION v3_4_3)
set(OPENSUBDIV_VERSION v3_4_4)
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
set(OPENSUBDIV_HASH 7bbfa275d021fb829e521df749160edb)
set(OPENSUBDIV_HASH 39ecc5caf0abebc943d1ce131855e76e)
set(OPENSUBDIV_HASH_TYPE MD5)
set(OPENSUBDIV_FILE opensubdiv-${OPENSUBDIV_VERSION}.tar.gz)
set(SDL_VERSION 2.0.12)
set(SDL_VERSION 2.0.20)
set(SDL_URI https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz)
set(SDL_HASH 783b6f2df8ff02b19bb5ce492b99c8ff)
set(SDL_HASH a53acc02e1cca98c4123229069b67c9e)
set(SDL_HASH_TYPE MD5)
set(SDL_FILE SDL2-${SDL_VERSION}.tar.gz)
@@ -130,9 +116,9 @@ set(OPENCOLLADA_HASH ee7dae874019fea7be11613d07567493)
set(OPENCOLLADA_HASH_TYPE MD5)
set(OPENCOLLADA_FILE opencollada-${OPENCOLLADA_VERSION}.tar.gz)
set(OPENCOLORIO_VERSION 2.0.0)
set(OPENCOLORIO_VERSION 2.1.1)
set(OPENCOLORIO_URI https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v${OPENCOLORIO_VERSION}.tar.gz)
set(OPENCOLORIO_HASH 1a2e3478b6cd9a1549f24e1b2205e3f0)
set(OPENCOLORIO_HASH 604f562e073f23d88ce89ed4f7f709ba)
set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
@@ -155,21 +141,37 @@ set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENIMAGEIO_VERSION 2.2.15.1)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH 3db5c5f0b3dc91597c75e5df09eb9072)
set(OPENIMAGEIO_VERSION v2.3.13.0)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/refs/tags/${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH de45fb38501c4581062b522b53b6141c)
set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
set(TIFF_VERSION 4.1.0)
# 8.0.0 is currently oiio's preferred vesion although never versions may be available.
# the preferred version can be found in oiio's externalpackages.cmake
set(FMT_VERSION 8.0.0)
set(FMT_URI https://github.com/fmtlib/fmt/archive/refs/tags/${FMT_VERSION}.tar.gz)
set(FMT_HASH 7bce0e9e022e586b178b150002e7c2339994e3c2bbe44027e9abb0d60f9cce83)
set(FMT_HASH_TYPE SHA256)
set(FMT_FILE fmt-${FMT_VERSION}.tar.gz)
# 0.6.2 is currently oiio's preferred vesion although never versions may be available.
# the preferred version can be found in oiio's externalpackages.cmake
set(ROBINMAP_VERSION v0.6.2)
set(ROBINMAP_URI https://github.com/Tessil/robin-map/archive/refs/tags/${ROBINMAP_VERSION}.tar.gz)
set(ROBINMAP_HASH c08ec4b1bf1c85eb0d6432244a6a89862229da1cb834f3f90fba8dc35d8c8ef1)
set(ROBINMAP_HASH_TYPE SHA256)
set(ROBINMAP_FILE robinmap-${ROBINMAP_VERSION}.tar.gz)
set(TIFF_VERSION 4.3.0)
set(TIFF_URI http://download.osgeo.org/libtiff/tiff-${TIFF_VERSION}.tar.gz)
set(TIFF_HASH 2165e7aba557463acc0664e71a3ed424)
set(TIFF_HASH 0a2e4744d1426a8fc8211c0cdbc3a1b3)
set(TIFF_HASH_TYPE MD5)
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
set(OSL_VERSION 1.11.14.1)
set(OSL_VERSION 1.11.17.0)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH 1abd7ce40481771a9fa937f19595d2f2)
set(OSL_HASH 63265472ce14548839ace2e21e401544)
set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
@@ -181,24 +183,18 @@ set(PYTHON_HASH 14e8c22458ed7779a1957b26cde01db9)
set(PYTHON_HASH_TYPE MD5)
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
set(TBB_VERSION 2020_U2)
set(TBB_VERSION 2020_U3)
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
set(TBB_HASH 1b711ae956524855088df3bbf5ec65dc)
set(TBB_HASH 55ec8df6eae5ed6364a47f0e671e460c)
set(TBB_HASH_TYPE MD5)
set(TBB_FILE oneTBB-${TBB_VERSION}.tar.gz)
set(OPENVDB_VERSION 8.0.1)
set(OPENVDB_VERSION 9.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH 01b490be16cc0e15c690f9a153c21461)
set(OPENVDB_HASH 684ce40c2f74f3a0c9cac530e1c7b07e)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
set(NANOVDB_GIT_UID dc37d8a631922e7bef46712947dc19b755f3e841)
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
set(NANOVDB_HASH_TYPE MD5)
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)
set(IDNA_VERSION 3.3)
set(CHARSET_NORMALIZER_VERSION 2.0.10)
set(URLLIB3_VERSION 1.26.8)
@@ -208,6 +204,9 @@ set(CYTHON_VERSION 0.29.26)
# The version of the zstd library used to build the Python package should match ZSTD_VERSION defined below.
# At this time of writing, 0.17.0 was already released, but built against zstd 1.5.1, while we use 1.5.0.
set(ZSTANDARD_VERSION 0.16.0)
set(AUTOPEP8_VERSION 1.6.0)
set(PYCODESTYLE_VERSION 2.8.0)
set(TOML_VERSION 0.10.2)
set(NUMPY_VERSION 1.22.0)
set(NUMPY_SHORT_VERSION 1.22)
@@ -222,15 +221,15 @@ set(LAME_HASH 83e260acbe4389b54fe08e0bdbf7cddb)
set(LAME_HASH_TYPE MD5)
set(LAME_FILE lame-${LAME_VERSION}.tar.gz)
set(OGG_VERSION 1.3.4)
set(OGG_VERSION 1.3.5)
set(OGG_URI http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz)
set(OGG_HASH fe5670640bd49e828d64d2879c31cb4dde9758681bb664f9bdbf159a01b0c76e)
set(OGG_HASH 0eb4b4b9420a0f51db142ba3f9c64b333f826532dc0f48c6410ae51f4799b664)
set(OGG_HASH_TYPE SHA256)
set(OGG_FILE libogg-${OGG_VERSION}.tar.gz)
set(VORBIS_VERSION 1.3.6)
set(VORBIS_VERSION 1.3.7)
set(VORBIS_URI http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz)
set(VORBIS_HASH 6ed40e0241089a42c48604dc00e362beee00036af2d8b3f46338031c9e0351cb)
set(VORBIS_HASH 0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab)
set(VORBIS_HASH_TYPE SHA256)
set(VORBIS_FILE libvorbis-${VORBIS_VERSION}.tar.gz)
@@ -240,15 +239,15 @@ set(THEORA_HASH b6ae1ee2fa3d42ac489287d3ec34c5885730b1296f0801ae577a35193d3affbc
set(THEORA_HASH_TYPE SHA256)
set(THEORA_FILE libtheora-${THEORA_VERSION}.tar.bz2)
set(FLAC_VERSION 1.3.3)
set(FLAC_VERSION 1.3.4)
set(FLAC_URI http://downloads.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz)
set(FLAC_HASH 213e82bd716c9de6db2f98bcadbc4c24c7e2efe8c75939a1a84e28539c4e1748)
set(FLAC_HASH 8ff0607e75a322dd7cd6ec48f4f225471404ae2730d0ea945127b1355155e737 )
set(FLAC_HASH_TYPE SHA256)
set(FLAC_FILE flac-${FLAC_VERSION}.tar.xz)
set(VPX_VERSION 1.8.2)
set(VPX_VERSION 1.11.0)
set(VPX_URI https://github.com/webmproject/libvpx/archive/v${VPX_VERSION}/libvpx-v${VPX_VERSION}.tar.gz)
set(VPX_HASH 8735d9fcd1a781ae6917f28f239a8aa358ce4864ba113ea18af4bb2dc8b474ac)
set(VPX_HASH 965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83)
set(VPX_HASH_TYPE SHA256)
set(VPX_FILE libvpx-v${VPX_VERSION}.tar.gz)
@@ -258,9 +257,9 @@ set(OPUS_HASH 65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d)
set(OPUS_HASH_TYPE SHA256)
set(OPUS_FILE opus-${OPUS_VERSION}.tar.gz)
set(X264_VERSION 33f9e1474613f59392be5ab6a7e7abf60fa63622)
set(X264_VERSION 35fe20d1ba49918ec739a5b068c208ca82f977f7)
set(X264_URI https://code.videolan.org/videolan/x264/-/archive/${X264_VERSION}/x264-${X264_VERSION}.tar.gz)
set(X264_HASH 5456450ee1ae02cd2328be3157367a232a0ab73315e8c8f80dab80469524f525)
set(X264_HASH bb4f7da03936b5a030ed5827133b58eb3f701d7e5dce32cca4ba6df93797d42e)
set(X264_HASH_TYPE SHA256)
set(X264_FILE x264-${X264_VERSION}.tar.gz)
@@ -270,22 +269,22 @@ set(XVIDCORE_HASH abbdcbd39555691dd1c9b4d08f0a031376a3b211652c0d8b3b8aa9be1303ce
set(XVIDCORE_HASH_TYPE SHA256)
set(XVIDCORE_FILE xvidcore-${XVIDCORE_VERSION}.tar.gz)
set(OPENJPEG_VERSION 2.3.1)
set(OPENJPEG_SHORT_VERSION 2.3)
set(OPENJPEG_VERSION 2.4.0)
set(OPENJPEG_SHORT_VERSION 2.4)
set(OPENJPEG_URI https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz)
set(OPENJPEG_HASH 63f5a4713ecafc86de51bfad89cc07bb788e9bba24ebbf0c4ca637621aadb6a9)
set(OPENJPEG_HASH 8702ba68b442657f11aaeb2b338443ca8d5fb95b0d845757968a7be31ef7f16d)
set(OPENJPEG_HASH_TYPE SHA256)
set(OPENJPEG_FILE openjpeg-v${OPENJPEG_VERSION}.tar.gz)
set(FFMPEG_VERSION 4.4)
set(FFMPEG_VERSION 5.0)
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFMPEG_HASH 42093549751b582cf0f338a21a3664f52e0a9fbe0d238d3c992005e493607d0e)
set(FFMPEG_HASH c0130b8db2c763430fd1c6905288d61bc44ee0548ad5fcd2dfd650b88432bed9)
set(FFMPEG_HASH_TYPE SHA256)
set(FFMPEG_FILE ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFTW_VERSION 3.3.8)
set(FFTW_VERSION 3.3.10)
set(FFTW_URI http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz)
set(FFTW_HASH 8aac833c943d8e90d51b697b27d4384d)
set(FFTW_HASH 8ccbf6a5ea78a16dbc3e1306e234cc5c)
set(FFTW_HASH_TYPE MD5)
set(FFTW_FILE fftw-${FFTW_VERSION}.tar.gz)
@@ -301,9 +300,9 @@ set(SNDFILE_HASH 646b5f98ce89ac60cdb060fcd398247c)
set(SNDFILE_HASH_TYPE MD5)
set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.gz)
set(WEBP_VERSION 0.6.1)
set(WEBP_VERSION 1.2.2)
set(WEBP_URI https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz)
set(WEBP_HASH b49ce9c3e3e9acae4d91bca44bb85a72)
set(WEBP_HASH b5e2e414a8adee4c25fe56b18dd9c549)
set(WEBP_HASH_TYPE MD5)
set(WEBP_FILE libwebp-${WEBP_VERSION}.tar.gz)
@@ -338,9 +337,15 @@ set(YAMLCPP_HASH b45bf1089a382e81f6b661062c10d0c2)
set(YAMLCPP_HASH_TYPE MD5)
set(YAMLCPP_FILE yaml-cpp-${YAMLCPP_VERSION}.tar.gz)
set(EXPAT_VERSION 2_2_10)
set(PYSTRING_VERSION v1.1.3)
set(PYSTRING_URI https://codeload.github.com/imageworks/pystring/tar.gz/refs/tags/${PYSTRING_VERSION})
set(PYSTRING_HASH f2c68786b359f5e4e62bed53bc4fb86d)
set(PYSTRING_HASH_TYPE MD5)
set(PYSTRING_FILE pystring-${PYSTRING_VERSION}.tar.gz)
set(EXPAT_VERSION 2_4_4)
set(EXPAT_URI https://github.com/libexpat/libexpat/archive/R_${EXPAT_VERSION}.tar.gz)
set(EXPAT_HASH 7ca5f09959fcb9a57618368deb627b9f)
set(EXPAT_HASH 2d3e81dee94b452369dc6394ff0f8f98)
set(EXPAT_HASH_TYPE MD5)
set(EXPAT_FILE libexpat-${EXPAT_VERSION}.tar.gz)
@@ -405,22 +410,21 @@ set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
set(SQLITE_HASH_TYPE SHA1)
set(SQLITE_FILE sqlite-src-3240000.zip)
set(EMBREE_VERSION 3.10.0)
set(EMBREE_VERSION 3.13.3)
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
set(EMBREE_HASH 4bbe29e7eaa46417efc75fc5f1e8eb87)
set(EMBREE_HASH f62766ba54e48a2f327c3a22596e7133)
set(EMBREE_HASH_TYPE MD5)
set(EMBREE_FILE embree-v${EMBREE_VERSION}.zip)
set(EMBREE_ARM_GIT https://github.com/brechtvl/embree.git)
set(USD_VERSION 21.02)
set(USD_VERSION 22.03)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
set(USD_HASH 1dd1e2092d085ed393c1f7c450a4155a)
set(USD_HASH e0e441a05057692a83124a1195b09eed)
set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
set(OIDN_VERSION 1.4.1)
set(OIDN_VERSION 1.4.3)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
set(OIDN_HASH df4007b0ab93b1c41cdf223b075d01c0)
set(OIDN_HASH 027093eaf5e8b4e45835b991137b38e6)
set(OIDN_HASH_TYPE MD5)
set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz)
@@ -454,9 +458,9 @@ set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
set(WL_PROTOCOLS_HASH_TYPE MD5)
set(ISPC_VERSION v1.16.0)
set(ISPC_VERSION v1.17.0)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 2e3abedbc0ea9aaec17d6562c632454d)
set(ISPC_HASH 4f476a3109332a77fe839a9014c60ca9)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
@@ -492,3 +496,9 @@ set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/${BROTLI_VERSI
set(BROTLI_HASH f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46)
set(BROTLI_HASH_TYPE SHA256)
set(BROTLI_FILE brotli-${BROTLI_VERSION}.tar.gz)
set(LEVEL_ZERO_VERSION v1.7.15)
set(LEVEL_ZERO_URI https://github.com/oneapi-src/level-zero/archive/refs/tags/${LEVEL_ZERO_VERSION}.tar.gz)
set(LEVEL_ZERO_HASH c39bb05a8e5898aa6c444e1704105b93d3f1888b9c333f8e7e73825ffbfb2617)
set(LEVEL_ZERO_HASH_TYPE SHA256)
set(LEVEL_ZERO_FILE level-zero-${LEVEL_ZERO_VERSION}.tar.gz)

View File

@@ -4,9 +4,15 @@
# library itself does not depend on them, so should give no problems.
set(WEBP_EXTRA_ARGS
-DWEBP_HAVE_SSE2=ON
-DWEBP_HAVE_SSE41=OFF
-DWEBP_HAVE_AVX2=OFF
-DWEBP_BUILD_ANIM_UTILS=OFF
-DWEBP_BUILD_CWEBP=OFF
-DWEBP_BUILD_DWEBP=OFF
-DWEBP_BUILD_GIF2WEBP=OFF
-DWEBP_BUILD_IMG2WEBP=OFF
-DWEBP_BUILD_VWEBP=OFF
-DWEBP_BUILD_WEBPINFO=OFF
-DWEBP_BUILD_WEBPMUX=OFF
-DWEBP_BUILD_EXTRAS=OFF
)
if(WIN32)

View File

@@ -37,10 +37,6 @@ graph[autosize = false, size = "25.7,8.3!", resolution = 300, overlap = false, s
external_openimageio -- external_webp;
external_openimageio -- external_opencolorio_extra;
external_openmp -- external_clang;
external_opensubdiv -- external_glew;
external_opensubdiv -- external_glfw;
external_opensubdiv -- external_clew;
external_opensubdiv -- external_cuew;
external_opensubdiv -- external_tbb;
openvdb -- external_tbb;
openvdb -- external_boost;

View File

@@ -36,19 +36,19 @@ getopt \
-o s:i:t:h \
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\
with-all,with-opencollada,with-jack,with-pulseaudio,with-embree,with-oidn,with-nanovdb,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,ver-level-zero:\
force-all,force-python,force-boost,force-tbb,\
force-ocio,force-imath,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
force-ffmpeg,force-opencollada,force-alembic,force-embree,force-oidn,force-usd,\
force-xr-openxr,\
force-xr-openxr,force-level-zero,\
build-all,build-python,build-boost,build-tbb,\
build-ocio,build-imath,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,build-usd,\
build-xr-openxr,\
build-xr-openxr,build-level-zero,\
skip-python,skip-boost,skip-tbb,\
skip-ocio,skip-imath,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-usd,\
skip-xr-openxr \
skip-xr-openxr,skip-level-zero \
-- "$@" \
)
@@ -165,6 +165,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--ver-xr-openxr=<ver>
Force version of OpenXR-SDK.
--ver-level-zero=<ver>
Force version of OneAPI Level Zero library.
Note about the --ver-foo options:
It may not always work as expected (some libs are actually checked out from a git rev...), yet it might help
to fix some build issues (like LLVM mismatch with the version used by your graphic system).
@@ -226,6 +229,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--build-xr-openxr
Force the build of OpenXR-SDK.
--build-level-zero=<ver>
Force the build of OneAPI Level Zero library.
Note about the --build-foo options:
* They force the script to prefer building dependencies rather than using available packages.
This may make things simpler and allow working around some distribution bugs, but on the other hand it will
@@ -293,6 +299,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--force-xr-openxr
Force the rebuild of OpenXR-SDK.
--force-level-zero=<ver>
Force the rebuild of OneAPI Level Zero library.
Note about the --force-foo options:
* They obviously only have an effect if those libraries are built by this script
(i.e. if there is no available and satisfactory package)!
@@ -351,7 +360,10 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
Unconditionally skip Universal Scene Description installation/building.
--skip-xr-openxr
Unconditionally skip OpenXR-SDK installation/building.\""
Unconditionally skip OpenXR-SDK installation/building.
--skip-level-zero=<ver>
Unconditionally skip OneAPI Level Zero installation/building.\""
# ----------------------------------------------------------------------------
# Main Vars
@@ -539,10 +551,10 @@ ALEMBIC_FORCE_BUILD=false
ALEMBIC_FORCE_REBUILD=false
ALEMBIC_SKIP=false
USD_VERSION="21.02"
USD_VERSION_SHORT="21.02"
USD_VERSION="22.03"
USD_VERSION_SHORT="22.03"
USD_VERSION_MIN="20.05"
USD_VERSION_MEX="22.00"
USD_VERSION_MEX="23.00"
USD_FORCE_BUILD=false
USD_FORCE_REBUILD=false
USD_SKIP=false
@@ -573,14 +585,13 @@ OIDN_SKIP=false
ISPC_VERSION="1.17.0"
FFMPEG_VERSION="4.4"
FFMPEG_VERSION_SHORT="4.4"
FFMPEG_VERSION_MIN="3.0"
FFMPEG_VERSION_MEX="5.0"
FFMPEG_FORCE_BUILD=false
FFMPEG_FORCE_REBUILD=false
FFMPEG_SKIP=false
_ffmpeg_list_sep=";"
LEVEL_ZERO_VERSION="1.7.15"
LEVEL_ZERO_VERSION_SHORT="1.7"
LEVEL_ZERO_VERSION_MIN="1.7"
LEVEL_ZERO_VERSION_MEX="2.0"
LEVEL_ZERO_FORCE_BUILD=false
LEVEL_ZERO_FORCE_REBUILD=false
LEVEL_ZERO_SKIP=false
XR_OPENXR_VERSION="1.0.22"
XR_OPENXR_VERSION_SHORT="1.0"
@@ -590,6 +601,15 @@ XR_OPENXR_FORCE_BUILD=false
XR_OPENXR_FORCE_REBUILD=false
XR_OPENXR_SKIP=false
FFMPEG_VERSION="5.0"
FFMPEG_VERSION_SHORT="5.0"
FFMPEG_VERSION_MIN="4.0"
FFMPEG_VERSION_MEX="6.0"
FFMPEG_FORCE_BUILD=false
FFMPEG_FORCE_REBUILD=false
FFMPEG_SKIP=false
_ffmpeg_list_sep=";"
# FFMPEG optional libs.
VORBIS_USE=false
VORBIS_DEV=""
@@ -781,6 +801,12 @@ while true; do
XR_OPENXR_VERSION_SHORT=$XR_OPENXR_VERSION
shift; shift; continue
;;
--ver-level-zero)
LEVEL_ZERO_VERSION="$2"
LEVEL_ZERO_VERSION_MIN=$LEVEL_ZERO_VERSION
LEVEL_ZERO_VERSION_SHORT=$LEVEL_ZERO_VERSION
shift; shift; continue
;;
--build-all)
PYTHON_FORCE_BUILD=true
BOOST_FORCE_BUILD=true
@@ -800,6 +826,7 @@ while true; do
ALEMBIC_FORCE_BUILD=true
USD_FORCE_BUILD=true
XR_OPENXR_FORCE_BUILD=true
LEVEL_ZERO_FORCE_BUILD=true
shift; continue
;;
--build-python)
@@ -857,6 +884,9 @@ while true; do
--build-xr-openxr)
XR_OPENXR_FORCE_BUILD=true; shift; continue
;;
--build-level-zero)
LEVEL_ZERO_FORCE_BUILD=true; shift; continue
;;
--force-all)
PYTHON_FORCE_REBUILD=true
BOOST_FORCE_REBUILD=true
@@ -876,6 +906,7 @@ while true; do
ALEMBIC_FORCE_REBUILD=true
USD_FORCE_REBUILD=true
XR_OPENXR_FORCE_REBUILD=true
LEVEL_ZERO_FORCE_REBUILD=true
shift; continue
;;
--force-python)
@@ -933,6 +964,9 @@ while true; do
--force-xr-openxr)
XR_OPENXR_FORCE_REBUILD=true; shift; continue
;;
--force-level-zero)
LEVEL_ZERO_FORCE_REBUILD=true; shift; continue
;;
--skip-python)
PYTHON_SKIP=true; shift; continue
;;
@@ -987,6 +1021,9 @@ while true; do
--skip-xr-openxr)
XR_OPENXR_SKIP=true; shift; continue
;;
--skip-level-zero)
LEVEL_ZERO_SKIP=true; shift; continue
;;
--)
# no more arguments to parse
break
@@ -1128,14 +1165,16 @@ OIDN_SOURCE=( "https://github.com/OpenImageDenoise/oidn/releases/download/v${OID
ISPC_BINARY=( "https://github.com/ispc/ispc/releases/download/v${ISPC_VERSION}/ispc-v${ISPC_VERSION}-linux.tar.gz" )
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
XR_OPENXR_USE_REPO=false
XR_OPENXR_SOURCE=("https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_VERSION}.tar.gz")
XR_OPENXR_SOURCE_REPO=("https://github.com/KhronosGroup/OpenXR-SDK.git")
XR_OPENXR_REPO_UID="458984d7f59d1ae6dc1b597d94b02e4f7132eaba"
XR_OPENXR_REPO_BRANCH="master"
LEVEL_ZERO_SOURCE=("https://github.com/oneapi-src/level-zero/archive/refs/tags/v${LEVEL_ZERO_VERSION}.tar.gz")
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
# C++11 is required now
CXXFLAGS_BACK=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -std=c++11"
@@ -1187,7 +1226,8 @@ You may also want to build them yourself (optional ones are [between brackets]):
* [OpenImageDenoise $OIDN_VERSION] (from $OIDN_SOURCE).
* [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).
* [Universal Scene Description $USD_VERSION] (from $USD_SOURCE).
* [OpenXR-SDK $XR_OPENXR_VERSION] (from $XR_OPENXR_SOURCE).\""
* [OpenXR-SDK $XR_OPENXR_VERSION] (from $XR_OPENXR_SOURCE).
* [OneAPI Level Zero $LEVEL_ZERO_VERSION] (from $LEVEL_ZERO_SOURCE).\""
if [ "$DO_SHOW_DEPS" = true ]; then
PRINT ""
@@ -3822,6 +3862,103 @@ compile_XR_OpenXR_SDK() {
}
# ----------------------------------------------------------------------------
# Build OneAPI Level Zero library.
_init_level_zero() {
_src=$SRC/level-zero-$LEVEL_ZERO_VERSION
_git=false
_inst=$INST/level-zero-$LEVEL_ZERO_VERSION_SHORT
_inst_shortcut=$INST/level-zero
}
_update_deps_level_zero() {
:
}
clean_Level_Zero() {
_init_level_zero
if [ -d $_inst ]; then
# Force rebuilding the dependencies if needed.
_update_deps_level_zero false true
fi
_clean
}
compile_Level_Zero() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, Level Zero will not be compiled!"
return
fi
# To be changed each time we make edits that would modify the compiled result!
level_zero_magic=1
_init_level_zero
# Force having own builds for the dependencies.
_update_deps_level_zero true false
# Clean install if needed!
magic_compile_check level-zero-$LEVEL_ZERO_VERSION $level_zero_magic
if [ $? -eq 1 -o "$LEVEL_ZERO_FORCE_REBUILD" = true ]; then
clean_Level_Zero
fi
if [ ! -d $_inst ]; then
INFO "Building Level-Zero-$LEVEL_ZERO_VERSION"
# Force rebuilding the dependencies.
_update_deps_level_zero true true
prepare_inst
if [ ! -d $_src ]; then
mkdir -p $SRC
download LEVEL_ZERO_SOURCE[@] "$_src.tar.gz"
INFO "Unpacking Level-Zero-$LEVEL_ZERO_VERSION"
tar -C $SRC -xf $_src.tar.gz
fi
cd $_src
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
# Keep flags in sync with LEVEL_ZERO_EXTRA_ARGS in level-zero.cmake!
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake $cmake_d ..
make -j$THREADS && make install
make clean
if [ ! -d $_inst ]; then
ERROR "Level-Zero-$LEVEL_ZERO_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set level-zero-$LEVEL_ZERO_VERSION $level_zero_magic
cd $CWD
INFO "Done compiling Level-Zero-$LEVEL_ZERO_VERSION!"
else
INFO "Own Level-Zero-$LEVEL_ZERO_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-level-zero option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "level-zero"
}
# ----------------------------------------------------------------------------
# Install on DEB-like
@@ -4458,6 +4595,18 @@ install_DEB() {
PRINT ""
compile_XR_OpenXR_SDK
fi
PRINT ""
if [ "$LEVEL_ZERO_SKIP" = true ]; then
WARNING "Skipping Level Zero installation, as requested..."
elif [ "$LEVEL_ZERO_FORCE_BUILD" = true ]; then
INFO "Forced Level Zero building, as requested..."
compile_Level_Zero
else
# No package currently!
PRINT ""
compile_Level_Zero
fi
}
@@ -5144,6 +5293,18 @@ install_RPM() {
# No package currently!
compile_XR_OpenXR_SDK
fi
PRINT ""
if [ "$LEVEL_ZERO_SKIP" = true ]; then
WARNING "Skipping Level Zero installation, as requested..."
elif [ "$LEVEL_ZERO_FORCE_BUILD" = true ]; then
INFO "Forced Level Zero building, as requested..."
compile_Level_Zero
else
# No package currently!
PRINT ""
compile_Level_Zero
fi
}
@@ -5721,6 +5882,18 @@ install_ARCH() {
# No package currently!
compile_XR_OpenXR_SDK
fi
PRINT ""
if [ "$LEVEL_ZERO_SKIP" = true ]; then
WARNING "Skipping Level Zero installation, as requested..."
elif [ "$LEVEL_ZERO_FORCE_BUILD" = true ]; then
INFO "Forced Level Zero building, as requested..."
compile_Level_Zero
else
# No package currently!
PRINT ""
compile_Level_Zero
fi
}
@@ -5895,6 +6068,14 @@ install_OTHER() {
INFO "Forced OpenXR-SDK building, as requested..."
compile_XR_OpenXR_SDK
fi
PRINT ""
if [ "$LEVEL_ZERO_SKIP" = true ]; then
WARNING "Skipping Level Zero installation, as requested..."
elif [ "$LEVEL_ZERO_FORCE_BUILD" = true ]; then
INFO "Forced Level Zero building, as requested..."
compile_Level_Zero
fi
}
# ----------------------------------------------------------------------------
@@ -6137,6 +6318,18 @@ print_info() {
fi
fi
# Not yet available in Blender.
#~ if [ "$LEVEL_ZERO_SKIP" = false ]; then
#~ _1="-D WITH_LEVEL_ZERO=ON"
#~ PRINT " $_1"
#~ _buildargs="$_buildargs $_1"
#~ if [ -d $INST/level-zero ]; then
#~ _1="-D LEVEL_ZERO_ROOT_DIR=$INST/level-zero"
#~ PRINT " $_1"
#~ _buildargs="$_buildargs $_1"
#~ fi
#~ fi
PRINT ""
PRINT "Or even simpler, just run (in your blender-source dir):"
PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""

View File

@@ -0,0 +1,32 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
project(pystring)
cmake_minimum_required(VERSION 3.10)
set(HEADERS
pystring.h
)
set(SOURCES
pystring.cpp
)
add_library(${PROJECT_NAME} STATIC ${HEADERS} ${SOURCES})
if(UNIX)
set(pystring_CXX_FLAGS "${pystring_CXX_FLAGS} -fPIC")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_FLAGS "${PLATFORM_COMPILE_FLAGS} ${pystring_CXX_FLAGS}"
PUBLIC_HEADER "${HEADERS}"
)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include/pystring
)

View File

@@ -1,26 +0,0 @@
--- CmakeLists.txt.orig 2015-12-31 03:46:41 -0700
+++ CMakeLists.txt 2016-04-01 13:28:33 -0600
@@ -22,3 +22,10 @@
add_executable(testcuew cuewTest/cuewTest.c include/cuew.h)
target_link_libraries(testcuew cuew ${CMAKE_DL_LIBS})
+
+install(TARGETS cuew
+ LIBRARY DESTINATION lib COMPONENT libraries
+ ARCHIVE DESTINATION lib/static COMPONENT libraries)
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/cuew.h
+ DESTINATION include/)
\ No newline at end of file
--- src/cuew.c 2016-04-01 13:41:43 -0600
+++ src/cuew.c 2016-04-01 13:41:11 -0600
@@ -15,7 +15,9 @@
*/
#ifdef _MSC_VER
+#if _MSC_VER < 1900
# define snprintf _snprintf
+#endif
# define popen _popen
# define pclose _pclose
# define _CRT_SECURE_NO_WARNINGS

View File

@@ -12,3 +12,19 @@ diff -Naur orig/common/sys/platform.h external_embree/common/sys/platform.h
#else
#define dll_export __attribute__ ((visibility ("default")))
#define dll_import
diff --git orig/common/tasking/CMakeLists.txt external_embree/common/tasking/CMakeLists.txt
--- orig/common/tasking/CMakeLists.txt
+++ external_embree/common/tasking/CMakeLists.txt
@@ -27,7 +27,11 @@
else()
# If not found try getting older TBB via module (FindTBB.cmake)
unset(TBB_DIR CACHE)
- find_package(TBB 4.1 REQUIRED tbb)
+ if (TBB_STATIC_LIB)
+ find_package(TBB 4.1 REQUIRED tbb_static)
+ else()
+ find_package(TBB 4.1 REQUIRED tbb)
+ endif()
if (TBB_FOUND)
TARGET_LINK_LIBRARIES(tasking PUBLIC TBB)
TARGET_INCLUDE_DIRECTORIES(tasking PUBLIC "${TBB_INCLUDE_DIRS}")

View File

@@ -1,43 +1,6 @@
diff -Naur external_ispc/CMakeLists.txt external_ispc_fixed/CMakeLists.txt
--- external_ispc/CMakeLists.txt 2020-04-23 17:29:06 -0600
+++ external_ispc_fixed/CMakeLists.txt 2020-05-05 09:01:09 -0600
@@ -389,7 +389,7 @@
# Link against Clang libraries
foreach(clangLib ${CLANG_LIBRARY_LIST})
- find_library(${clangLib}Path NAMES ${clangLib} HINTS ${LLVM_LIBRARY_DIRS})
+ find_library(${clangLib}Path NAMES ${clangLib} HINTS ${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIR})
list(APPEND CLANG_LIBRARY_FULL_PATH_LIST ${${clangLib}Path})
endforeach()
target_link_libraries(${PROJECT_NAME} ${CLANG_LIBRARY_FULL_PATH_LIST})
diff -Naur orig/CMakeLists.txt external_ispc/CMakeLists.txt
--- orig/CMakeLists.txt 2020-05-05 09:19:11 -0600
+++ external_ispc/CMakeLists.txt 2020-05-05 09:26:44 -0600
@@ -333,7 +333,7 @@
# Include directories
target_include_directories(${PROJECT_NAME} PRIVATE
- ${LLVM_INCLUDE_DIRS}
+ ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}
${GENX_DEPS_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
diff -Naur orig/cmake/GenerateBuiltins.cmake.txt external_ispc/cmake/GenerateBuiltins.cmake.txt
+++ orig/cmake/GenerateBuiltins.cmake 2020-05-25 13:32:40.830803821 +0200
+++ external_ispc/cmake/GenerateBuiltins.cmake 2020-05-25 13:32:40.830803821 +0200
@@ -97,6 +97,8 @@
if ("${bit}" STREQUAL "32" AND ${arch} STREQUAL "x86")
set(target_arch "i686")
+ # Blender: disable 32bit due to build issues on Linux and being unnecessary.
+ set(SKIP ON)
elseif ("${bit}" STREQUAL "64" AND ${arch} STREQUAL "x86")
set(target_arch "x86_64")
elseif ("${bit}" STREQUAL "32" AND ${arch} STREQUAL "arm")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46a8db8..f53beef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
diff -Naur ispc-1.17.0.org/CMakeLists.txt ispc-1.17.0/CMakeLists.txt
--- ispc-1.17.0.org/CMakeLists.txt 2022-01-15 01:35:15 -0700
+++ ispc-1.17.0/CMakeLists.txt 2022-02-12 12:44:24 -0700
@@ -36,8 +36,12 @@
cmake_minimum_required(VERSION 3.13)
@@ -53,7 +16,25 @@ index 46a8db8..f53beef 100644
endif()
set(PROJECT_NAME ispc)
@@ -412,6 +416,29 @@ else()
@@ -443,7 +447,7 @@
# Include directories
target_include_directories(${PROJECT_NAME} PRIVATE
- ${LLVM_INCLUDE_DIRS}
+ ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}
${XE_DEPS_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
@@ -507,7 +511,7 @@
# Link against Clang libraries
foreach(clangLib ${CLANG_LIBRARY_LIST})
- find_library(${clangLib}Path NAMES ${clangLib} HINTS ${LLVM_LIBRARY_DIRS})
+ find_library(${clangLib}Path NAMES ${clangLib} HINTS ${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIR})
list(APPEND CLANG_LIBRARY_FULL_PATH_LIST ${${clangLib}Path})
endforeach()
target_link_libraries(${PROJECT_NAME} ${CLANG_LIBRARY_FULL_PATH_LIST})
@@ -546,6 +550,29 @@
endif()
endif()
@@ -83,3 +64,15 @@ index 46a8db8..f53beef 100644
# Build target for utility checking host ISA
if (ISPC_INCLUDE_UTILS)
add_executable(check_isa "")
diff -Naur ispc-1.17.0.org/cmake/GenerateBuiltins.cmake ispc-1.17.0/cmake/GenerateBuiltins.cmake
--- ispc-1.17.0.org/cmake/GenerateBuiltins.cmake 2022-01-15 01:35:15 -0700
+++ ispc-1.17.0/cmake/GenerateBuiltins.cmake 2022-02-12 12:44:24 -0700
@@ -124,6 +124,8 @@
if ("${bit}" STREQUAL "32" AND ${arch} STREQUAL "x86")
set(target_arch "i686")
+ # Blender: disable 32bit due to build issues on Linux and being unnecessary.
+ set(SKIP ON)
elseif ("${bit}" STREQUAL "64" AND ${arch} STREQUAL "x86")
set(target_arch "x86_64")
elseif ("${bit}" STREQUAL "32" AND ${arch} STREQUAL "arm")

View File

@@ -0,0 +1,13 @@
diff -Naur external_levelzero_org/CMakeLists.txt external_levelzero/CMakeLists.txt
--- external_levelzero_org/CMakeLists.txt 2022-03-07 13:22:11 -0700
+++ external_levelzero/CMakeLists.txt 2022-03-29 13:22:15 -0600
@@ -77,9 +77,6 @@
#enabling Control Flow Guard
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /guard:cf")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf")
- # enable Spectre Mitigation
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qspectre")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre")
endif()
#CXX compiler support

View File

@@ -1,374 +0,0 @@
Index: nanovdb/nanovdb/NanoVDB.h
===================================================================
--- a/nanovdb/nanovdb/NanoVDB.h (revision 62751)
+++ b/nanovdb/nanovdb/NanoVDB.h (working copy)
@@ -152,8 +152,8 @@
#endif // __CUDACC_RTC__
-#ifdef __CUDACC__
-// Only define __hostdev__ when using NVIDIA CUDA compiler
+#if defined(__CUDACC__) || defined(__HIP__)
+// Only define __hostdev__ when using NVIDIA CUDA or HIP compiler
#define __hostdev__ __host__ __device__
#else
#define __hostdev__
@@ -461,7 +461,7 @@
/// Maximum floating-point values
template<typename T>
struct Maximum;
-#ifdef __CUDA_ARCH__
+#if defined(__CUDA_ARCH__) || defined(__HIP__)
template<>
struct Maximum<int>
{
@@ -1006,10 +1006,10 @@
using Vec3i = Vec3<int>;
/// @brief Return a single precision floating-point vector of this coordinate
-Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
+inline __hostdev__ Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
/// @brief Return a double precision floating-point vector of this coordinate
-Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
+inline __hostdev__ Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
// ----------------------------> Vec4 <--------------------------------------
@@ -1820,7 +1820,7 @@
}; // Map
template<typename Mat4T>
-void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
+__hostdev__ void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
{
float * mf = mMatF, *vf = mVecF;
float* mif = mInvMatF;
@@ -2170,7 +2170,7 @@
}; // Class Grid
template<typename TreeT>
-int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
+__hostdev__ int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
{
for (uint32_t i = 0, n = blindDataCount(); i < n; ++i)
if (blindMetaData(i).mSemantic == semantic)
@@ -2328,7 +2328,7 @@
}; // Tree class
template<typename RootT>
-void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
+__hostdev__ void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
{
min = this->root().valueMin();
max = this->root().valueMax();
@@ -2336,7 +2336,7 @@
template<typename RootT>
template<typename NodeT>
-const NodeT* Tree<RootT>::getNode(uint32_t i) const
+__hostdev__ const NodeT* Tree<RootT>::getNode(uint32_t i) const
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNode: unvalid node type");
NANOVDB_ASSERT(i < DataType::mCount[NodeT::LEVEL]);
@@ -2345,7 +2345,7 @@
template<typename RootT>
template<int LEVEL>
-const typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i) const
+__hostdev__ const typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i) const
{
NANOVDB_ASSERT(i < DataType::mCount[LEVEL]);
return reinterpret_cast<const TreeNodeT<LEVEL>*>(reinterpret_cast<const uint8_t*>(this) + DataType::mBytes[LEVEL]) + i;
@@ -2353,7 +2353,7 @@
template<typename RootT>
template<typename NodeT>
-NodeT* Tree<RootT>::getNode(uint32_t i)
+__hostdev__ NodeT* Tree<RootT>::getNode(uint32_t i)
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNode: invalid node type");
NANOVDB_ASSERT(i < DataType::mCount[NodeT::LEVEL]);
@@ -2362,7 +2362,7 @@
template<typename RootT>
template<int LEVEL>
-typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i)
+__hostdev__ typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i)
{
NANOVDB_ASSERT(i < DataType::mCount[LEVEL]);
return reinterpret_cast<TreeNodeT<LEVEL>*>(reinterpret_cast<uint8_t*>(this) + DataType::mBytes[LEVEL]) + i;
@@ -2370,7 +2370,7 @@
template<typename RootT>
template<typename NodeT>
-uint32_t Tree<RootT>::getNodeID(const NodeT& node) const
+__hostdev__ uint32_t Tree<RootT>::getNodeID(const NodeT& node) const
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNodeID: invalid node type");
const NodeT* first = reinterpret_cast<const NodeT*>(reinterpret_cast<const uint8_t*>(this) + DataType::mBytes[NodeT::LEVEL]);
@@ -2380,7 +2380,7 @@
template<typename RootT>
template<typename NodeT>
-uint32_t Tree<RootT>::getLinearOffset(const NodeT& node) const
+__hostdev__ uint32_t Tree<RootT>::getLinearOffset(const NodeT& node) const
{
return this->getNodeID(node) + DataType::mPFSum[NodeT::LEVEL];
}
@@ -3366,7 +3366,7 @@
}; // LeafNode class
template<typename ValueT, typename CoordT, template<uint32_t> class MaskT, uint32_t LOG2DIM>
-inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
+inline __hostdev__ void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
{
static_assert(LOG2DIM == 3, "LeafNode::updateBBox: only supports LOGDIM = 3!");
if (!this->isActive()) return;
Index: nanovdb/nanovdb/util/SampleFromVoxels.h
===================================================================
--- a/nanovdb/nanovdb/util/SampleFromVoxels.h (revision 62751)
+++ b/nanovdb/nanovdb/util/SampleFromVoxels.h (working copy)
@@ -22,7 +22,7 @@
#define NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED
// Only define __hostdev__ when compiling as NVIDIA CUDA
-#ifdef __CUDACC__
+#if defined(__CUDACC__) || defined(__HIP__)
#define __hostdev__ __host__ __device__
#else
#include <cmath> // for floor
@@ -136,7 +136,7 @@
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
{
const CoordT ijk = Round<CoordT>(xyz);
if (ijk != mPos) {
@@ -147,7 +147,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
{
if (ijk != mPos) {
mPos = ijk;
@@ -158,7 +158,7 @@
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
{
return mAcc.getValue(Round<CoordT>(xyz));
}
@@ -195,7 +195,7 @@
}; // TrilinearSamplerBase
template<typename TreeOrAccT>
-void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
+__hostdev__ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
{
v[0][0][0] = mAcc.getValue(ijk); // i, j, k
@@ -224,7 +224,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
#if 0
auto lerp = [](ValueT a, ValueT b, ValueT w){ return fma(w, b-a, a); };// = w*(b-a) + a
@@ -239,7 +239,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::gradient requires a floating-point type");
#if 0
@@ -270,7 +270,7 @@
}
template<typename TreeOrAccT>
-bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
+__hostdev__ bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -363,7 +363,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
@@ -370,7 +370,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[0][0][0] : BaseT::mAcc.getValue(ijk);
}
@@ -377,7 +377,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::gradient(xyz, mVal);
@@ -393,7 +393,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -406,7 +406,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -418,7 +418,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
auto lerp = [](ValueT a, ValueT b, RealT w) { return a + ValueT(w) * (b - a); };
@@ -463,7 +463,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
+inline __hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -473,7 +473,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -510,7 +510,7 @@
}; // TriquadraticSamplerBase
template<typename TreeOrAccT>
-void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
+__hostdev__ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
{
CoordT p(ijk[0] - 1, 0, 0);
for (int dx = 0; dx < 3; ++dx, ++p[0]) {
@@ -526,7 +526,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
+__hostdev__ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
{
auto kernel = [](const ValueT* value, double weight)->ValueT {
return weight * (weight * (0.5f * (value[0] + value[2]) - value[1]) +
@@ -545,7 +545,7 @@
}
template<typename TreeOrAccT>
-bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
+__hostdev__ bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -624,7 +624,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
@@ -631,7 +631,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[1][1][1] : BaseT::mAcc.getValue(ijk);
}
@@ -646,7 +646,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -657,7 +657,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -667,7 +667,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -710,7 +710,7 @@
}; // TricubicSampler
template<typename TreeOrAccT>
-void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
+__hostdev__ void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
{
auto fetch = [&](int i, int j, int k) -> ValueT& { return C[((i + 1) << 4) + ((j + 1) << 2) + k + 1]; };
@@ -929,7 +929,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mC);
@@ -937,7 +937,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {

View File

@@ -1,35 +1,16 @@
diff -Naur openvdb-8.0.0/cmake/FindIlmBase.cmake openvdb/cmake/FindIlmBase.cmake
--- openvdb-8.0.0/cmake/FindIlmBase.cmake 2020-12-24 10:13:14 -0700
+++ openvdb/cmake/FindIlmBase.cmake 2021-02-05 12:07:49 -0700
@@ -217,6 +217,12 @@
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
endif()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_IlmBase_Version_Suffix}.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
+ "_s.lib"
+ )
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
+ "_s_d.lib"
+ )
else()
if(ILMBASE_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
diff -Naur openvdb-8.0.0/cmake/FindOpenEXR.cmake openvdb/cmake/FindOpenEXR.cmake
--- openvdb-8.0.0/cmake/FindOpenEXR.cmake 2020-12-24 10:13:14 -0700
+++ openvdb/cmake/FindOpenEXR.cmake 2021-02-05 12:23:39 -0700
@@ -210,6 +210,12 @@
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
endif()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_OpenEXR_Version_Suffix}.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
+ "_s.lib"
+ )
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES
+ "_s_d.lib"
+ )
else()
if(OPENEXR_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
diff -ur openvdb-9.0.0/cmake/FindTBB.cmake openvdb/cmake/FindTBB.cmake
--- openvdb-9.0.0/cmake/FindTBB.cmake 2021-10-30 03:55:40.000000000 +0100
+++ openvdb/cmake/FindTBB.cmake 2022-03-31 11:33:15.592329750 +0100
@@ -252,7 +252,8 @@
set(_TBB_LIB_NAME "${_TBB_LIB_NAME}${TBB_DEBUG_SUFFIX}")
endif()
- find_library(Tbb_${COMPONENT}_LIBRARY_${BUILD_TYPE} ${_TBB_LIB_NAME}
+ find_library(Tbb_${COMPONENT}_LIBRARY_${BUILD_TYPE}
+ NAMES ${_TBB_LIB_NAME} ${_TBB_LIB_NAME}_static
${_FIND_TBB_ADDITIONAL_OPTIONS}
PATHS ${_TBB_LIBRARYDIR_SEARCH_DIRS}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} lib64 lib
diff -Naur openvdb-8.0.0/openvdb/openvdb/CMakeLists.txt openvdb/openvdb/openvdb/CMakeLists.txt
--- openvdb-8.0.0/openvdb/openvdb/CMakeLists.txt 2020-12-24 10:13:14 -0700
+++ openvdb/openvdb/openvdb/CMakeLists.txt 2021-02-05 11:18:33 -0700
@@ -118,3 +99,321 @@ diff -Naur openvdb-8.0.0/openvdb/openvdb/version.rc.in openvdb/openvdb/openvdb/v
+
+ END
+END
diff --git a/nanovdb/nanovdb/NanoVDB.h b/nanovdb/nanovdb/NanoVDB.h
index cc2e54b77..703d2eabc 100644
--- a/nanovdb/nanovdb/NanoVDB.h
+++ b/nanovdb/nanovdb/NanoVDB.h
@@ -161,8 +161,8 @@ typedef unsigned long long uint64_t;
#endif // __CUDACC_RTC__
-#ifdef __CUDACC__
-// Only define __hostdev__ when using NVIDIA CUDA compiler
+#if defined(__CUDACC__) || defined(__HIP__)
+// Only define __hostdev__ when using NVIDIA CUDA or HIP compiler
#define __hostdev__ __host__ __device__
#else
#define __hostdev__
@@ -611,7 +611,7 @@ struct Delta<double>
/// Maximum floating-point values
template<typename T>
struct Maximum;
-#ifdef __CUDA_ARCH__
+#if defined(__CUDA_ARCH__) || defined(__HIP__)
template<>
struct Maximum<int>
{
@@ -1176,10 +1176,10 @@ using Vec3f = Vec3<float>;
using Vec3i = Vec3<int>;
/// @brief Return a single precision floating-point vector of this coordinate
-Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
+__hostdev__ inline Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
/// @brief Return a double precision floating-point vector of this coordinate
-Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
+__hostdev__ inline Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
// ----------------------------> Vec4 <--------------------------------------
@@ -2042,7 +2042,7 @@ struct Map
}; // Map
template<typename Mat4T>
-void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
+__hostdev__ void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
{
float * mf = mMatF, *vf = mVecF;
float* mif = mInvMatF;
@@ -2486,7 +2486,7 @@ class Grid : private GridData
}; // Class Grid
template<typename TreeT>
-int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
+__hostdev__ int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
{
for (uint32_t i = 0, n = this->blindDataCount(); i < n; ++i)
if (this->blindMetaData(i).mSemantic == semantic)
@@ -2671,7 +2671,7 @@ class Tree : private TreeData<RootT::LEVEL>
}; // Tree class
template<typename RootT>
-void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
+__hostdev__ void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
{
min = this->root().minimum();
max = this->root().maximum();
@@ -3880,7 +3880,7 @@ class LeafNode : private LeafData<BuildT, CoordT, MaskT, Log2Dim>
}; // LeafNode class
template<typename ValueT, typename CoordT, template<uint32_t> class MaskT, uint32_t LOG2DIM>
-inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
+__hostdev__ inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
{
static_assert(LOG2DIM == 3, "LeafNode::updateBBox: only supports LOGDIM = 3!");
if (!this->isActive()) return;
diff --git a/nanovdb/nanovdb/util/SampleFromVoxels.h b/nanovdb/nanovdb/util/SampleFromVoxels.h
index 852123dac..e779d66cf 100644
--- a/nanovdb/nanovdb/util/SampleFromVoxels.h
+++ b/nanovdb/nanovdb/util/SampleFromVoxels.h
@@ -22,7 +22,7 @@
#define NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED
// Only define __hostdev__ when compiling as NVIDIA CUDA
-#ifdef __CUDACC__
+#if defined(__CUDACC__) || defined(__HIP__)
#define __hostdev__ __host__ __device__
#else
#include <cmath> // for floor
@@ -136,7 +136,7 @@ class SampleFromVoxels<TreeOrAccT, 0, false>
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
{
const CoordT ijk = Round<CoordT>(xyz);
if (ijk != mPos) {
@@ -147,7 +147,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
{
if (ijk != mPos) {
mPos = ijk;
@@ -158,7 +158,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
{
return mAcc.getValue(Round<CoordT>(xyz));
}
@@ -195,7 +195,7 @@ class TrilinearSampler
}; // TrilinearSamplerBase
template<typename TreeOrAccT>
-void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
+__hostdev__ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
{
v[0][0][0] = mAcc.getValue(ijk); // i, j, k
@@ -224,7 +224,7 @@ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) co
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
#if 0
auto lerp = [](ValueT a, ValueT b, ValueT w){ return fma(w, b-a, a); };// = w*(b-a) + a
@@ -239,7 +239,7 @@ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
static_assert(is_floating_point<ValueT>::value, "TrilinearSampler::gradient requires a floating-point type");
#if 0
@@ -270,7 +270,7 @@ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(con
}
template<typename TreeOrAccT>
-bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
+__hostdev__ bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
{
static_assert(is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -363,21 +363,21 @@ class SampleFromVoxels<TreeOrAccT, 1, true> : public TrilinearSampler<TreeOrAccT
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[0][0][0] : BaseT::mAcc.getValue(ijk);
}
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::gradient(xyz, mVal);
@@ -393,7 +393,7 @@ __hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, true>::zeroCrossing(Vec3T<RealT
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -406,7 +406,7 @@ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -418,7 +418,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator(
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
auto lerp = [](ValueT a, ValueT b, RealT w) { return a + ValueT(w) * (b - a); };
@@ -463,7 +463,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator(
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
+__hostdev__ inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -473,7 +473,7 @@ inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, fal
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -510,7 +510,7 @@ class TriquadraticSampler
}; // TriquadraticSamplerBase
template<typename TreeOrAccT>
-void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
+__hostdev__ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
{
CoordT p(ijk[0] - 1, 0, 0);
for (int dx = 0; dx < 3; ++dx, ++p[0]) {
@@ -526,7 +526,7 @@ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
+__hostdev__ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
{
auto kernel = [](const ValueT* value, double weight)->ValueT {
return weight * (weight * (0.5f * (value[0] + value[2]) - value[1]) +
@@ -545,7 +545,7 @@ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec
}
template<typename TreeOrAccT>
-bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
+__hostdev__ bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
{
static_assert(is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -624,14 +624,14 @@ class SampleFromVoxels<TreeOrAccT, 2, true> : public TriquadraticSampler<TreeOrA
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[1][1][1] : BaseT::mAcc.getValue(ijk);
}
@@ -646,7 +646,7 @@ __hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, true>::zeroCrossing(Vec3T<RealT
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -657,7 +657,7 @@ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -667,7 +667,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator(
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -710,7 +710,7 @@ class TricubicSampler
}; // TricubicSampler
template<typename TreeOrAccT>
-void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
+__hostdev__ void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
{
auto fetch = [&](int i, int j, int k) -> ValueT& { return C[((i + 1) << 4) + ((j + 1) << 2) + k + 1]; };
@@ -929,7 +929,7 @@ class SampleFromVoxels<TreeOrAccT, 3, true> : public TricubicSampler<TreeOrAccT>
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mC);
@@ -937,7 +937,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {

View File

@@ -48,25 +48,6 @@ diff -Naur org/CMakeLists.txt external_osl/CMakeLists.txt
set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
if (OSL_NO_DEFAULT_TEXTURESYSTEM)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 990f50d69..46ef7351d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -252,11 +252,9 @@ install (EXPORT OSL_EXPORTED_TARGETS
FILE ${OSL_TARGETS_EXPORT_NAME}
NAMESPACE ${PROJECT_NAME}::)
-
-
-
-osl_add_all_tests()
-
+if (${PROJECT_NAME}_BUILD_TESTS AND NOT ${PROJECT_NAME}_IS_SUBPROJECT)
+ osl_add_all_tests()
+endif ()
if (NOT ${PROJECT_NAME}_IS_SUBPROJECT)
include (packaging)
diff -Naur external_osl_orig/src/cmake/externalpackages.cmake external_osl/src/cmake/externalpackages.cmake
--- external_osl_orig/src/cmake/externalpackages.cmake 2021-06-01 13:44:18 -0600
+++ external_osl/src/cmake/externalpackages.cmake 2021-06-28 07:44:32 -0600

View File

@@ -10,217 +10,22 @@ diff -x .git -ur usd.orig/cmake/defaults/Packages.cmake external_usd/cmake/defau
add_definitions(${TBB_DEFINITIONS})
# --math
diff -Naur external_usd_base/cmake/macros/Public.cmake external_usd/cmake/macros/Public.cmake
--- external_usd_base/cmake/macros/Public.cmake 2019-10-24 14:39:53 -0600
+++ external_usd/cmake/macros/Public.cmake 2020-01-11 13:33:29 -0700
@@ -996,6 +996,12 @@
foreach(lib ${PXR_OBJECT_LIBS})
string(TOUPPER ${lib} uppercaseName)
list(APPEND exports "${uppercaseName}_EXPORTS=1")
+ # When building for blender, we do NOT want to export all symbols on windows.
+ # This is a dirty hack, but USD makes it impossible to do the right thing
+ # with the default options exposed.
+ if (WIN32)
+ list(APPEND exports "PXR_STATIC=1")
+ endif()
endforeach()
foreach(lib ${PXR_OBJECT_LIBS})
set(objects "${objects};\$<TARGET_OBJECTS:${lib}>")
diff -ru USD-20.11/pxr/base/tf/pxrLZ4/lz4.cpp external_usd/pxr/base/tf/pxrLZ4/lz4.cpp
--- USD-20.11/pxr/base/tf/pxrLZ4/lz4.cpp 2020-10-14 19:25:19.000000000 +0100
+++ external_usd/pxr/base/tf/pxrLZ4/lz4.cpp 2021-02-09 09:28:51.496190085 +0000
@@ -614,6 +614,15 @@
/*-************************************
* Internal Definitions used in Tests
**************************************/
+
+/*******************************************************************
+ * Disabled in Blender. The BLOSC library also exposes these
+ * functions, and this causes 'duplicate symbol' linker errors.
+ *
+ * This problem has been reported upstream at
+ * https://github.com/PixarAnimationStudios/USD/issues/1447
+ *
+ *******************************************************************
#if defined (__cplusplus)
extern "C" {
#endif
@@ -627,6 +636,7 @@
#if defined (__cplusplus)
}
#endif
+********************************************************************/
/*-******************************
* Compression functions
From 442d087962f762deeb8b6e49a0955753fcf9aeb9 Mon Sep 17 00:00:00 2001
From: Tsahi Zidenberg <tsahee@amazon.com>
Date: Sun, 15 Nov 2020 15:18:24 +0000
Subject: [PATCH 1/2] stackTrace: support aarch64/linux
stacktrace calls syscall directly via assembler. Create compatible
aarch64 code.
---
pxr/base/arch/stackTrace.cpp | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/pxr/base/arch/stackTrace.cpp b/pxr/base/arch/stackTrace.cpp
index dcc1dfd46..c11aabeb1 100644
--- a/pxr/base/arch/stackTrace.cpp
+++ b/pxr/base/arch/stackTrace.cpp
@@ -583,7 +583,6 @@ nonLockingLinux__execve (const char *file,
char *const argv[],
char *const envp[])
{
-#if defined(ARCH_BITS_64)
/*
* We make a direct system call here, because we can't find an
* execve which corresponds with the non-locking fork we call
@@ -594,7 +593,27 @@ nonLockingLinux__execve (const char *file,
* hangs in a threaded app. (We use the non-locking fork to get
* around problems with forking when we have had memory
* corruption.) whew.
- *
+ */
+
+ unsigned long result;
+
+#if defined (__aarch64__)
+ {
+ register long __file_result asm ("x0") = (long)file;
+ register char* const* __argv asm ("x1") = argv;
+ register char* const* __envp asm ("x2") = envp;
+ register long __num_execve asm ("x8") = 221;
+ __asm__ __volatile__ (
+ "svc 0"
+ : "=r" (__file_result)
+ : "r"(__num_execve), "r" (__file_result), "r" (__argv), "r" (__envp)
+ : "memory"
+ );
+ result = __file_result;
+ }
+#elif defined(ARCH_CPU_INTEL) && defined(ARCH_BITS_64)
+
+ /*
* %rdi, %rsi, %rdx, %rcx, %r8, %r9 are args 0-5
* syscall clobbers %rcx and %r11
*
@@ -603,7 +622,6 @@ nonLockingLinux__execve (const char *file,
* constraints to gcc.
*/
diff -Naur usd_orig/cmake/defaults/msvcdefaults.cmake external_usd/cmake/defaults/msvcdefaults.cmake
--- usd_orig/cmake/defaults/msvcdefaults.cmake 2022-02-18 14:49:09 -0700
+++ external_usd/cmake/defaults/msvcdefaults.cmake 2022-03-14 11:41:50 -0600
@@ -120,9 +120,6 @@
# for all translation units.
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /bigobj")
- unsigned long result;
__asm__ __volatile__ (
"mov %0, %%rdi \n\t"
"mov %%rcx, %%rsi \n\t"
@@ -614,6 +632,9 @@ nonLockingLinux__execve (const char *file,
: "0" (file), "c" (argv), "d" (envp)
: "memory", "cc", "r11"
);
+#else
+#error Unknown architecture
+#endif
if (result >= 0xfffffffffffff000) {
errno = -result;
@@ -621,9 +642,6 @@ nonLockingLinux__execve (const char *file,
}
return result;
-#else
-#error Unknown architecture
-#endif
}
#endif
From a1dffe02519bb3c6ccbbe8c6c58304da5db98995 Mon Sep 17 00:00:00 2001
From: Tsahi Zidenberg <tsahee@amazon.com>
Date: Sun, 15 Nov 2020 15:22:52 +0000
Subject: [PATCH 2/2] timing: support aarch64/linux
The aarch64 arch-timer is directly accessible to userspace via two
registers:
CNTVCT_EL0 - holds the current counter value
CNTFRQ_EL0 - holds the counter frequency (in Hz)
---
pxr/base/arch/timing.cpp | 6 ++++++
pxr/base/arch/timing.h | 6 +++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/pxr/base/arch/timing.cpp b/pxr/base/arch/timing.cpp
index 27ad58fed..9022950c1 100644
--- a/pxr/base/arch/timing.cpp
+++ b/pxr/base/arch/timing.cpp
@@ -59,6 +59,11 @@ ARCH_HIDDEN
void
Arch_InitTickTimer()
{
+#ifdef __aarch64__
+ uint64_t counter_hz;
+ __asm __volatile("mrs %0, CNTFRQ_EL0" : "=&r" (counter_hz));
+ Arch_NanosecondsPerTick = double(1e9) / double(counter_hz);
+#else
// NOTE: Normally ifstream would be cleaner, but it causes crashes when
// used in conjunction with DSOs and the Intel Compiler.
FILE *in;
@@ -135,6 +140,7 @@ Arch_InitTickTimer()
}
Arch_NanosecondsPerTick = double(1e9) / double(cpuHz);
+#endif
}
#elif defined(ARCH_OS_WINDOWS)
diff --git a/pxr/base/arch/timing.h b/pxr/base/arch/timing.h
index 67ec0d15f..6dc3e85a0 100644
--- a/pxr/base/arch/timing.h
+++ b/pxr/base/arch/timing.h
@@ -36,7 +36,7 @@
/// \addtogroup group_arch_SystemFunctions
///@{
-#if defined(ARCH_OS_LINUX)
+#if defined(ARCH_OS_LINUX) && defined(ARCH_CPU_INTEL)
#include <x86intrin.h>
#elif defined(ARCH_OS_DARWIN)
#include <mach/mach_time.h>
@@ -69,6 +69,10 @@ ArchGetTickTime()
#elif defined(ARCH_CPU_INTEL)
// On Intel we'll use the rdtsc instruction.
return __rdtsc();
+#elif defined (__aarch64__)
+ uint64_t result;
+ __asm __volatile("mrs %0, CNTVCT_EL0" : "=&r" (result));
+ return result;
#else
#error Unknown architecture.
#endif
diff --git a/pxr/base/arch/demangle.cpp b/pxr/base/arch/demangle.cpp
index 67ec0d15f..6dc3e85a0 100644
--- a/pxr/base/arch/demangle.cpp
+++ b/pxr/base/arch/demangle.cpp
@@ -36,6 +36,7 @@
#if (ARCH_COMPILER_GCC_MAJOR == 3 && ARCH_COMPILER_GCC_MINOR >= 1) || \
ARCH_COMPILER_GCC_MAJOR > 3 || defined(ARCH_COMPILER_CLANG)
#define _AT_LEAST_GCC_THREE_ONE_OR_CLANG
+#include <cxxabi.h>
#endif
PXR_NAMESPACE_OPEN_SCOPE
@@ -138,7 +139,6 @@
#endif
#if defined(_AT_LEAST_GCC_THREE_ONE_OR_CLANG)
-#include <cxxabi.h>
/*
* This routine doesn't work when you get to gcc3.4.
-# Enable PDB generation.
-set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /Zi")
-
# Enable multiprocessor builds.
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /MP")
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /Gm-")
diff --git a/pxr/base/work/singularTask.h b/pxr/base/work/singularTask.h
index 67ec0d15f..6dc3e85a0 100644
--- a/pxr/base/work/singularTask.h
+++ b/pxr/base/work/singularTask.h
@@ -120,7 +120,7 @@
@@ -232,3 +37,66 @@ index 67ec0d15f..6dc3e85a0 100644
do { _fn(); } while (
!count.compare_exchange_strong(old, 0));
});
diff --git a/pxr/usd/sdr/shaderMetadataHelpers.h b/pxr/usd/sdr/shaderMetadataHelpers.h
--- a/pxr/usd/sdr/shaderMetadataHelpers.h
+++ b/pxr/usd/sdr/shaderMetadataHelpers.h
@@ -32,6 +32,8 @@
#include "pxr/base/tf/token.h"
#include "pxr/usd/sdr/declare.h"
+#include <limits>
+
PXR_NAMESPACE_OPEN_SCOPE
/// \namespace ShaderMetadataHelpers
diff --git a/pxr/base/arch/timing.h b/pxr/base/arch/timing.h
index 517561f..fda5a1f 100644
--- a/pxr/base/arch/timing.h
+++ b/pxr/base/arch/timing.h
@@ -91,6 +91,10 @@ ArchGetTickTime()
inline uint64_t
ArchGetStartTickTime()
{
+ // BLENDER: avoid using rdtsc instruction that is not supported on older CPUs.
+ return ArchGetTickTime();
+
+#if 0
uint64_t t;
#if defined (ARCH_OS_DARWIN)
return ArchGetTickTime();
@@ -123,6 +127,7 @@ ArchGetStartTickTime()
#error "Unsupported architecture."
#endif
return t;
+#endif
}
/// Get a "stop" tick time for measuring an interval of time. See
@@ -132,6 +137,10 @@ ArchGetStartTickTime()
inline uint64_t
ArchGetStopTickTime()
{
+ // BLENDER: avoid using rdtsc instruction that is not supported on older CPUs.
+ return ArchGetTickTime();
+
+#if 0
uint64_t t;
#if defined (ARCH_OS_DARWIN)
return ArchGetTickTime();
@@ -162,11 +171,11 @@ ArchGetStopTickTime()
#error "Unsupported architecture."
#endif
return t;
+#endif
}
-#if defined (doxygen) || \
- (!defined(ARCH_OS_DARWIN) && defined(ARCH_CPU_INTEL) && \
- (defined(ARCH_COMPILER_CLANG) || defined(ARCH_COMPILER_GCC)))
+// BLENDER: avoid using rdtsc instruction that is not supported on older CPUs.
+#if 0
/// A simple timer class for measuring an interval of time using the
/// ArchTickTimer facilities.

View File

@@ -46,6 +46,15 @@ if "%3" == "debug" set CMAKE_DEBUG_OPTIONS=-DWITH_OPTIMIZED_DEBUG=Off
set dobuild=1
if "%4" == "nobuild" set dobuild=0
REM If Python is be available certain deps may try to
REM to use this over the version we build, to prevent that
REM make sure python is NOT in the path
for %%X in (python.exe) do (set PYTHON=%%~$PATH:X)
if EXIST "%PYTHON%" (
echo PYTHON found at %PYTHON% dependencies cannot be build with python available in the path
goto exit
)
set SOURCE_DIR=%~dp0\..
set BUILD_DIR=%cd%\build
set HARVEST_DIR=%BUILD_DIR%\output
@@ -98,8 +107,8 @@ echo %DATE% %TIME% : Start > %StatusFile%
cmake -G "%CMAKE_BUILDER%" %CMAKE_BUILD_ARCH% -Thost=x64 %SOURCE_DIR% -DPACKAGE_DIR=%BUILD_DIR%/packages -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DBUILD_MODE=Release -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/
echo %DATE% %TIME% : Release Configuration done >> %StatusFile%
if "%dobuild%" == "1" (
msbuild /m "ll.vcxproj" /p:Configuration=Release /fl /flp:logfile=BlenderDeps_llvm.log;Verbosity=normal
msbuild /m "BlenderDependencies.sln" /p:Configuration=Release /fl /flp:logfile=BlenderDeps.log;Verbosity=minimal /verbosity:minimal
msbuild /m:1 "ll.vcxproj" /p:Configuration=Release /fl /flp:logfile=BlenderDeps_llvm.log;Verbosity=normal
msbuild /m:1 "BlenderDependencies.sln" /p:Configuration=Release /fl /flp:logfile=BlenderDeps.log;Verbosity=minimal /verbosity:minimal
echo %DATE% %TIME% : Release Build done >> %StatusFile%
cmake --build . --target Harvest_Release_Results > Harvest_Release.txt
)
@@ -111,8 +120,8 @@ cd %Staging%\%BuildDir%%ARCH%D
cmake -G "%CMAKE_BUILDER%" %CMAKE_BUILD_ARCH% -Thost=x64 %SOURCE_DIR% -DPACKAGE_DIR=%BUILD_DIR%/packages -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DCMAKE_BUILD_TYPE=Debug -DBUILD_MODE=Debug -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/ %CMAKE_DEBUG_OPTIONS%
echo %DATE% %TIME% : Debug Configuration done >> %StatusFile%
if "%dobuild%" == "1" (
msbuild /m "ll.vcxproj" /p:Configuration=Debug /fl /flp:logfile=BlenderDeps_llvm.log;;Verbosity=normal
msbuild /m "BlenderDependencies.sln" /p:Configuration=Debug /verbosity:n /fl /flp:logfile=BlenderDeps.log;;Verbosity=normal
msbuild /m:1 "ll.vcxproj" /p:Configuration=Debug /fl /flp:logfile=BlenderDeps_llvm.log;;Verbosity=normal
msbuild /m:1 "BlenderDependencies.sln" /p:Configuration=Debug /verbosity:n /fl /flp:logfile=BlenderDeps.log;;Verbosity=normal
echo %DATE% %TIME% : Debug Build done >> %StatusFile%
cmake --build . --target Harvest_Debug_Results> Harvest_Debug.txt
)

View File

@@ -85,9 +85,9 @@ STRING(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _openexr_libs_ver ${OPENE
IF(OPENEXR_VERSION VERSION_GREATER_EQUAL "3.0.0")
SET(_openexr_FIND_COMPONENTS
Iex
IlmThread
OpenEXR
OpenEXRCore
IlmThread
)
ELSE()
SET(_openexr_FIND_COMPONENTS

View File

@@ -175,7 +175,9 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix DEFAULT_MSG
IF(PYTHONLIBSUNIX_FOUND)
# Assign cache items
SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} ${PYTHON_INCLUDE_CONFIG_DIR})
SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
IF(NOT WITH_PYTHON_MODULE)
SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
ENDIF()
FIND_FILE(PYTHON_SITE_PACKAGES
NAMES

View File

@@ -64,6 +64,7 @@ ENDIF()
MARK_AS_ADVANCED(
USD_INCLUDE_DIR
USD_LIBRARY_DIR
USD_LIBRARY
)
UNSET(_usd_SEARCH_DIRS)

View File

@@ -74,4 +74,9 @@ ENDIF()
MARK_AS_ADVANCED(
WEBP_INCLUDE_DIR
WEBP_LIBRARY_DIR
# Generated names.
WEBP_WEBPDEMUX_LIBRARY
WEBP_WEBPMUX_LIBRARY
WEBP_WEBP_LIBRARY
)

View File

@@ -202,9 +202,9 @@ def parm_size(node_child):
# NOT PERFECT CODE, EXTRACT SIZE FROM TOKENS
if len(tokens) >= 3: # foo [ 1 ]
if ((tokens[-3].kind == TokenKind.PUNCTUATION and tokens[-3].spelling == "[") and
(tokens[-2].kind == TokenKind.LITERAL and tokens[-2].spelling.isdigit()) and
(tokens[-1].kind == TokenKind.PUNCTUATION and tokens[-1].spelling == "]")):
if ((tokens[-3].kind == TokenKind.PUNCTUATION and tokens[-3].spelling == "[") and
(tokens[-2].kind == TokenKind.LITERAL and tokens[-2].spelling.isdigit()) and
(tokens[-1].kind == TokenKind.PUNCTUATION and tokens[-1].spelling == "]")):
# ---
return int(tokens[-2].spelling)
return -1

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
"""
Example linux usage
python3 ~/blender-git/blender/build_files/cmake/cmake_netbeans_project.py ~/blender-git/cmake

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
r"""
Example Linux usage:
python ~/blender-git/blender/build_files/cmake/cmake_qtcreator_project.py --build-dir ~/blender-git/cmake

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
import project_source_info
import subprocess
import sys

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
import project_source_info
import subprocess
import sys

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",

View File

@@ -30,6 +30,7 @@ set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_WEBP ON CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)

View File

@@ -34,8 +34,12 @@ set(WITH_IMAGE_HDR OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_WEBP OFF CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
set(WITH_IO_STL OFF CACHE BOOL "" FORCE)
set(WITH_IO_WAVEFRONT_OBJ OFF CACHE BOOL "" FORCE)
set(WITH_IO_GPENCIL OFF CACHE BOOL "" FORCE)
set(WITH_JACK OFF CACHE BOOL "" FORCE)
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
set(WITH_LLVM OFF CACHE BOOL "" FORCE)

View File

@@ -31,6 +31,7 @@ set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_WEBP ON CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)

View File

@@ -71,6 +71,7 @@ set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
# Find precompiled libraries, and avoid system or user-installed ones.
if(EXISTS ${LIBDIR})
include(platform_old_libs_update)
without_system_libs_begin()
endif()
@@ -214,7 +215,12 @@ if(WITH_SDL)
find_package(SDL2)
set(SDL_INCLUDE_DIR ${SDL2_INCLUDE_DIRS})
set(SDL_LIBRARY ${SDL2_LIBRARIES})
string(APPEND PLATFORM_LINKFLAGS " -framework ForceFeedback")
string(APPEND PLATFORM_LINKFLAGS " -framework ForceFeedback -framework GameController")
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
# The minimum macOS version of the libraries makes it so this is included in SDL on arm64
# but not x86_64.
string(APPEND PLATFORM_LINKFLAGS " -framework CoreHaptics")
endif()
endif()
set(PNG_ROOT ${LIBDIR}/png)

View File

@@ -0,0 +1,46 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2022 Blender Foundation. All rights reserved.
# Auto update existing CMake caches for new libraries
function(unset_cache_variables pattern)
get_cmake_property(_cache_variables CACHE_VARIABLES)
foreach (_cache_variable ${_cache_variables})
if("${_cache_variable}" MATCHES "${pattern}")
unset(${_cache_variable} CACHE)
endif()
endforeach()
endfunction()
# Detect update from 3.1 to 3.2 libs.
if(UNIX AND
DEFINED OPENEXR_VERSION AND
OPENEXR_VERSION VERSION_LESS "3.0.0" AND
EXISTS ${LIBDIR}/imath)
message(STATUS "Auto updating CMake configuration for Blender 3.2 libraries")
unset_cache_variables("^OPENIMAGEIO")
unset_cache_variables("^OPENEXR")
unset_cache_variables("^IMATH")
unset_cache_variables("^PNG")
unset_cache_variables("^USD")
unset_cache_variables("^WEBP")
unset_cache_variables("^NANOVDB")
endif()
# Automatically set WebP on/off depending if libraries are available.
if(EXISTS ${LIBDIR}/webp)
if(WITH_OPENIMAGEIO)
set(WITH_IMAGE_WEBP ON CACHE BOOL "" FORCE)
endif()
else()
set(WITH_IMAGE_WEBP OFF)
endif()
# NanoVDB moved into openvdb.
if(UNIX AND DEFINED NANOVDB_INCLUDE_DIR)
if(NOT EXISTS ${NANOVDB_INCLUDE_DIR} AND
EXISTS ${LIBDIR}/openvdb/include/nanovdb)
unset_cache_variables("^NANOVDB")
endif()
endif()

View File

@@ -45,6 +45,9 @@ if(EXISTS ${LIBDIR})
# which is a part of OpenCollada. They have different ABI, and we
# do need to use the official one.
set(CMAKE_PREFIX_PATH ${LIBDIR}/zlib ${LIB_SUBDIRS})
include(platform_old_libs_update)
set(WITH_STATIC_LIBS ON)
# OpenMP usually can't be statically linked into shared libraries,
# due to not being compiled with position independent code.
@@ -373,6 +376,7 @@ if(WITH_IMAGE_WEBP)
find_package_wrapper(WebP)
if(NOT WEBP_FOUND)
set(WITH_IMAGE_WEBP OFF)
message(WARNING "WebP not found, disabling WITH_IMAGE_WEBP")
endif()
endif()
@@ -394,6 +398,9 @@ if(WITH_OPENIMAGEIO)
if(WITH_IMAGE_OPENEXR)
list(APPEND OPENIMAGEIO_LIBRARIES "${OPENEXR_LIBRARIES}")
endif()
if(WITH_IMAGE_WEBP)
list(APPEND OPENIMAGEIO_LIBRARIES "${WEBP_LIBRARIES}")
endif()
if(NOT OPENIMAGEIO_FOUND)
set(WITH_OPENIMAGEIO OFF)

View File

@@ -104,7 +104,7 @@ string(APPEND CMAKE_MODULE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099")
list(APPEND PLATFORM_LINKLIBS
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32 version
advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp Shlwapi
pathcch Shcore
pathcch Shcore Dwmapi
)
if(WITH_INPUT_IME)
@@ -262,6 +262,8 @@ if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "\n\nWindows requires pre-compiled libs at: '${LIBDIR}'. Please run `make update` in the blender source folder to obtain them.")
endif()
include(platform_old_libs_update)
if(CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND # Only supported in the VS IDE
MSVC_VERSION GREATER_EQUAL 1924 AND # Supported for 16.4+
WITH_CLANG_TIDY # And Clang Tidy needs to be on
@@ -343,13 +345,18 @@ if(WITH_FFTW3)
set(FFTW3_LIBPATH ${FFTW3}/lib)
endif()
windows_find_package(WebP)
if(NOT WEBP_FOUND)
if(EXISTS ${LIBDIR}/webp)
set(WEBP_INCLUDE_DIRS ${LIBDIR}/webp/include)
set(WEBP_ROOT_DIR ${LIBDIR}/webp)
set(WEBP_LIBRARIES ${LIBDIR}/webp/lib/webp.lib ${LIBDIR}/webp/lib/webpdemux.lib ${LIBDIR}/webp/lib/webpmux.lib)
set(WEBP_FOUND ON)
if(WITH_IMAGE_WEBP)
windows_find_package(WebP)
if(NOT WEBP_FOUND)
if(EXISTS ${LIBDIR}/webp)
set(WEBP_INCLUDE_DIRS ${LIBDIR}/webp/include)
set(WEBP_ROOT_DIR ${LIBDIR}/webp)
set(WEBP_LIBRARIES ${LIBDIR}/webp/lib/webp.lib ${LIBDIR}/webp/lib/webpdemux.lib ${LIBDIR}/webp/lib/webpmux.lib)
set(WEBP_FOUND ON)
else()
message(STATUS "WITH_IMAGE_WEBP is ON but WEBP libraries are not found, setting WITH_IMAGE_WEBP=OFF")
set(WITH_IMAGE_WEBP OFF)
endif()
endif()
endif()
@@ -414,27 +421,60 @@ if(WITH_CODEC_FFMPEG)
endif()
if(WITH_IMAGE_OPENEXR)
windows_find_package(OpenEXR REQUIRED)
# Imath and OpenEXR have a single combined build option and include and library variables
# used by the rest of the build system.
set(IMATH_ROOT_DIR ${LIBDIR}/imath)
set(IMATH_VERSION "3.14")
windows_find_package(IMATH REQUIRED)
if(NOT IMATH_FOUND)
set(IMATH ${LIBDIR}/imath)
set(IMATH_INCLUDE_DIR ${IMATH}/include)
set(IMATH_INCLUDE_DIRS ${IMATH_INCLUDE_DIR} ${IMATH}/include/Imath)
set(IMATH_LIBPATH ${IMATH}/lib)
set(IMATH_LIBRARIES
optimized ${IMATH_LIBPATH}/Imath_s.lib
debug ${IMATH_LIBPATH}/Imath_s_d.lib
)
endif()
set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
set(OPENEXR_VERSION "3.14")
windows_find_package(OPENEXR REQUIRED)
if(NOT OpenEXR_FOUND)
set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
set(OPENEXR_VERSION "2.1")
warn_hardcoded_paths(OpenEXR)
set(OPENEXR ${LIBDIR}/openexr)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${IMATH_INCLUDE_DIRS} ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
set(OPENEXR_LIBRARIES
optimized ${OPENEXR_LIBPATH}/Iex_s.lib
optimized ${OPENEXR_LIBPATH}/Half_s.lib
optimized ${OPENEXR_LIBPATH}/IlmImf_s.lib
optimized ${OPENEXR_LIBPATH}/Imath_s.lib
optimized ${OPENEXR_LIBPATH}/IlmThread_s.lib
debug ${OPENEXR_LIBPATH}/Iex_s_d.lib
debug ${OPENEXR_LIBPATH}/Half_s_d.lib
debug ${OPENEXR_LIBPATH}/IlmImf_s_d.lib
debug ${OPENEXR_LIBPATH}/Imath_s_d.lib
debug ${OPENEXR_LIBPATH}/IlmThread_s_d.lib
)
# Check if the 3.x library name exists
# if not assume this is a 2.x library folder
if(EXISTS "${OPENEXR_LIBPATH}/OpenEXR_s.lib")
set(OPENEXR_LIBRARIES
optimized ${OPENEXR_LIBPATH}/Iex_s.lib
optimized ${OPENEXR_LIBPATH}/IlmThread_s.lib
optimized ${OPENEXR_LIBPATH}/OpenEXR_s.lib
optimized ${OPENEXR_LIBPATH}/OpenEXRCore_s.lib
optimized ${OPENEXR_LIBPATH}/OpenEXRUtil_s.lib
debug ${OPENEXR_LIBPATH}/Iex_s_d.lib
debug ${OPENEXR_LIBPATH}/IlmThread_s_d.lib
debug ${OPENEXR_LIBPATH}/OpenEXR_s_d.lib
debug ${OPENEXR_LIBPATH}/OpenEXRCore_s_d.lib
debug ${OPENEXR_LIBPATH}/OpenEXRUtil_s_d.lib
${IMATH_LIBRARIES}
)
else()
set(OPENEXR_LIBRARIES
optimized ${OPENEXR_LIBPATH}/Iex_s.lib
optimized ${OPENEXR_LIBPATH}/Half_s.lib
optimized ${OPENEXR_LIBPATH}/IlmImf_s.lib
optimized ${OPENEXR_LIBPATH}/Imath_s.lib
optimized ${OPENEXR_LIBPATH}/IlmThread_s.lib
debug ${OPENEXR_LIBPATH}/Iex_s_d.lib
debug ${OPENEXR_LIBPATH}/Half_s_d.lib
debug ${OPENEXR_LIBPATH}/IlmImf_s_d.lib
debug ${OPENEXR_LIBPATH}/Imath_s_d.lib
debug ${OPENEXR_LIBPATH}/IlmThread_s_d.lib
)
endif()
endif()
endif()
@@ -500,8 +540,14 @@ if(WITH_BOOST)
if(NOT BOOST_VERSION)
message(FATAL_ERROR "Unable to determine Boost version")
endif()
set(BOOST_POSTFIX "vc141-mt-x64-${BOOST_VERSION}.lib")
set(BOOST_DEBUG_POSTFIX "vc141-mt-gd-x64-${BOOST_VERSION}.lib")
set(BOOST_POSTFIX "vc142-mt-x64-${BOOST_VERSION}.lib")
set(BOOST_DEBUG_POSTFIX "vc142-mt-gd-x64-${BOOST_VERSION}.lib")
if(NOT EXISTS ${BOOST_LIBPATH}/libboost_date_time-${BOOST_POSTFIX})
# If the new library names do not exist fall back to the old ones
# to ease the transition period between the libs.
set(BOOST_POSTFIX "vc141-mt-x64-${BOOST_VERSION}.lib")
set(BOOST_DEBUG_POSTFIX "vc141-mt-gd-x64-${BOOST_VERSION}.lib")
endif()
set(BOOST_LIBRARIES
optimized ${BOOST_LIBPATH}/libboost_date_time-${BOOST_POSTFIX}
optimized ${BOOST_LIBPATH}/libboost_filesystem-${BOOST_POSTFIX}
@@ -545,7 +591,6 @@ if(WITH_OPENIMAGEIO)
set(OIIO_DEBUG debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_d.lib debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util_d.lib)
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
endif()
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
add_definitions(-DOIIO_STATIC_DEFINE)
@@ -575,6 +620,7 @@ if(WITH_LLVM)
message(WARNING "LLVM debug libs not present on this system. Using release libs for debug builds.")
set(LLVM_LIBRARY ${LLVM_LIBRARY_OPTIMIZED})
endif()
endif()
if(WITH_OPENCOLORIO)
@@ -594,7 +640,6 @@ if(WITH_OPENCOLORIO)
debug ${OPENCOLORIO_LIBPATH}/pystring_d.lib
)
endif()
set(OPENCOLORIO_DEFINITIONS "-DOpenColorIO_SKIP_IMPORTS")
endif()
@@ -604,17 +649,24 @@ if(WITH_OPENVDB)
set(OPENVDB ${LIBDIR}/openVDB)
set(OPENVDB_LIBPATH ${OPENVDB}/lib)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib)
set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib )
endif()
set(OPENVDB_DEFINITIONS -DNOMINMAX -D_USE_MATH_DEFINES)
endif()
if(WITH_NANOVDB)
set(NANOVDB ${LIBDIR}/nanoVDB)
set(NANOVDB ${LIBDIR}/openvdb)
set(NANOVDB_INCLUDE_DIR ${NANOVDB}/include)
if(NOT EXISTS "${NANOVDB_INCLUDE_DIR}/nanovdb")
# When not found, could be an older lib folder with where nanovdb
# had its own lib folder, to ease the transition period, fall back
# to that copy if the copy in openvdb is not found.
set(NANOVDB ${LIBDIR}/nanoVDB)
set(NANOVDB_INCLUDE_DIR ${NANOVDB}/include)
endif()
endif()
if(WITH_OPENIMAGEDENOISE)
set(OPENIMAGEDENOISE ${LIBDIR}/OpenImageDenoise)
set(OPENIMAGEDENOISE_LIBPATH ${LIBDIR}/OpenImageDenoise/lib)
@@ -640,7 +692,12 @@ endif()
if(WITH_IMAGE_OPENJPEG)
set(OPENJPEG ${LIBDIR}/openjpeg)
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include/openjpeg-2.3)
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include/openjpeg-2.4)
if(NOT EXISTS "${OPENJPEG_INCLUDE_DIRS}")
# when not found, could be an older lib folder with openjpeg 2.3
# to ease the transition period, fall back if 2.4 is not found.
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include/openjpeg-2.3)
endif()
set(OPENJPEG_LIBRARIES ${OPENJPEG}/lib/openjp2.lib)
endif()
@@ -783,9 +840,16 @@ if(WITH_USD)
windows_find_package(USD)
if(NOT USD_FOUND)
set(USD_INCLUDE_DIRS ${LIBDIR}/usd/include)
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/libusd_m.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/libusd_m_d.lib)
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/usd_usd_m.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/usd_usd_m_d.lib)
set(USD_LIBRARY_DIR ${LIBDIR}/usd/lib)
# Older USD had different filenames, if the new ones are
# not found see if the older ones exist, to ease the
# transition period while landing libs.
if(NOT EXISTS "${USD_RELEASE_LIB}")
set(USD_RELEASE_LIB ${LIBDIR}/usd/lib/libusd_m.lib)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/libusd_m_d.lib)
endif()
set(USD_LIBRARIES
debug ${USD_DEBUG_LIB}
optimized ${USD_RELEASE_LIB}

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
"""
Module for accessing project file data for Blender.
@@ -170,7 +168,7 @@ def cmake_advanced_info() -> Union[Tuple[List[str], List[Tuple[str, str]]], Tupl
project_path = create_eclipse_project()
if not exists(project_path):
print("Generating Eclipse Prokect File Failed: %r not found" % project_path)
print("Generating Eclipse Project File Failed: %r not found" % project_path)
return None, None
from xml.dom.minidom import parse

View File

@@ -1,7 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
__all__ = (
"build_info",
"SOURCE_DIR",
@@ -114,12 +112,11 @@ def makefile_log() -> List[str]:
print("Can't execute process")
sys.exit(1)
while process.poll():
time.sleep(1)
# We know this is always true based on the input arguments to `Popen`.
stdout: IO[bytes] = process.stdout # type: ignore
stdout: IO[bytes] = process.stdout # type: ignore
out = stdout.read()
stdout.close()
@@ -210,7 +207,7 @@ def build_defines_as_source() -> str:
)
# We know this is always true based on the input arguments to `Popen`.
stdout: IO[bytes] = process.stdout # type: ignore
stdout: IO[bytes] = process.stdout # type: ignore
return cast(str, stdout.read().strip().decode('ascii'))
@@ -228,7 +225,7 @@ def build_defines_as_args() -> List[str]:
def queue_processes(
process_funcs: Sequence[Tuple[Callable[..., subprocess.Popen[Any]], Tuple[Any, ...]]],
*,
job_total: int =-1,
job_total: int = -1,
sleep: float = 0.1,
) -> None:
""" Takes a list of function arg pairs, each function must return a process

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
import os
import shutil
import subprocess

View File

@@ -143,8 +143,8 @@ def packages_path(current_directory: Path, cli_args: Any) -> Optional[Path]:
return Path(relpath)
### Manifest creation
# -----------------------------------------------------------------------------
# Manifest creation
def create_manifest(
@@ -195,7 +195,8 @@ def packages_to_manifest(outfile: TextIO, packages_dir: Path) -> None:
print(path, file=outfile)
### Higher-level functions
# -----------------------------------------------------------------------------
# Higher-level functions
def create_tarball(
@@ -249,7 +250,8 @@ def cleanup(manifest: Path) -> None:
print("OK")
## Low-level commands
# -----------------------------------------------------------------------------
# Low-level commands
def git_ls_files(directory: Path = Path(".")) -> Iterable[Path]:
@@ -265,7 +267,7 @@ def git_ls_files(directory: Path = Path(".")) -> Iterable[Path]:
yield path
def git_command(*cli_args: Union[bytes, str, Path] ) -> Iterable[str]:
def git_command(*cli_args: Union[bytes, str, Path]) -> Iterable[str]:
"""Generator, yields lines of output from a Git command."""
command = ("git", *cli_args)

View File

@@ -129,6 +129,7 @@ def svn_update(args, release_version):
call(svn_non_interactive + ["switch", svn_url + dirname, dirpath], exit_on_error=False)
call(svn_non_interactive + ["update", dirpath])
# Test if git repo can be updated.
def git_update_skip(args, check_remote_exists=True):
if make_utils.command_missing(args.git_command):

View File

@@ -47,8 +47,10 @@ def check_output(cmd, exit_on_error=True):
def git_branch_exists(git_command, branch):
return call([git_command, "rev-parse", "--verify", branch], exit_on_error=False, silent=True) == 0 or \
call([git_command, "rev-parse", "--verify", "remotes/origin/" + branch], exit_on_error=False, silent=True) == 0
return (
call([git_command, "rev-parse", "--verify", branch], exit_on_error=False, silent=True) == 0 or
call([git_command, "rev-parse", "--verify", "remotes/origin/" + branch], exit_on_error=False, silent=True) == 0
)
def git_branch(git_command):

View File

@@ -3,13 +3,10 @@ for %%X in (svn.exe) do (set SVN=%%~$PATH:X)
for %%X in (cmake.exe) do (set CMAKE=%%~$PATH:X)
for %%X in (ctest.exe) do (set CTEST=%%~$PATH:X)
for %%X in (git.exe) do (set GIT=%%~$PATH:X)
REM For python, default on 39 but if that does not exist also check
REM the 310,311 and 312 folders to see if those are there, it checks
REM this far ahead to ensure good lib folder compatibility in the future.
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
if EXIST %PYTHON% (
goto detect_python_done
)
REM For python, default on 310 but if that does not exist also check
REM the 311, 312 and finally 39 folders to see if those are there, it checks
REM this far ahead to ensure good lib folder compatibility in the future
REM it falls back to 3.9 just incase it is a very old lib folder.
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\310\bin\python.exe
if EXIST %PYTHON% (
goto detect_python_done
@@ -22,6 +19,10 @@ set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\312\bin\python.exe
if EXIST %PYTHON% (
goto detect_python_done
)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
if EXIST %PYTHON% (
goto detect_python_done
)
if NOT EXIST %PYTHON% (
echo Warning: Python not found, there is likely an issue with the library folder

View File

@@ -378,7 +378,8 @@ def usage():
def main():
import os, os.path
import os
import os.path
try:
bpy = __import__('bpy')
@@ -410,7 +411,7 @@ def main():
# read blend header from blend file
log.info("2: read file:")
if not dir in sys.path:
if dir not in sys.path:
sys.path.append(dir)
import BlendFileReader

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = V3.2
PROJECT_NUMBER = V3.3
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@@ -11,8 +11,6 @@ where <path-to-blender> is the path to the Blender executable,
and <output-filename> is where to write the generated man page.
'''
# <pep8 compliant>
import argparse
import os
import subprocess
@@ -103,10 +101,10 @@ blender \- a full-featured 3D application''')
.PP
.B blender
is a full-featured 3D application. It supports the entirety of the 3D pipeline - '''
'''modeling, rigging, animation, simulation, rendering, compositing, motion tracking, and video editing.
'''modeling, rigging, animation, simulation, rendering, compositing, motion tracking, and video editing.
Use Blender to create 3D images and animations, films and commercials, content for games, '''
r'''architectural and industrial visualizations, and scientific visualizations.
r'''architectural and industrial visualizations, and scientific visualizations.
https://www.blender.org''')

View File

@@ -11,6 +11,7 @@ import queue
execution_queue = queue.Queue()
# This function can safely be called in another thread.
# The function will be executed when the timer runs the next time.
def run_in_main_thread(function):

View File

@@ -9,7 +9,7 @@ operator in the different part of the user interface.
The context overrides are passed as a dictionary, with keys matching the context
member names in bpy.context.
For example to override ``bpy.context.active_object``,
you would pass ``{'active_object': object}``.
you would pass ``{'active_object': object}`` to :class:`bpy.types.Context.temp_override`.
.. note::
@@ -17,8 +17,10 @@ you would pass ``{'active_object': object}``.
(otherwise, you'll have to find and gather all needed data yourself).
"""
# remove all objects in scene rather than the selected ones
# Remove all objects in scene rather than the selected ones.
import bpy
override = bpy.context.copy()
override['selected_objects'] = list(bpy.context.scene.objects)
bpy.ops.object.delete(override)
from bpy import context
override = context.copy()
override["selected_objects"] = list(context.scene.objects)
with context.temp_override(**override):
bpy.ops.object.delete()

View File

@@ -1,17 +1,16 @@
"""
It is also possible to run an operator in a particular part of the user
interface. For this we need to pass the window, screen, area and sometimes
a region.
interface. For this we need to pass the window, area and sometimes a region.
"""
# maximize 3d view in all windows
# Maximize 3d view in all windows.
import bpy
from bpy import context
for window in bpy.context.window_manager.windows:
for window in context.window_manager.windows:
screen = window.screen
for area in screen.areas:
if area.type == 'VIEW_3D':
override = {'window': window, 'screen': screen, 'area': area}
bpy.ops.screen.screen_full_area(override)
with context.temp_override(window=window, area=area):
bpy.ops.screen.screen_full_area()
break

View File

@@ -33,6 +33,11 @@ There are 3 optional positional arguments (documented in detail below).
bpy.ops.test.operator(override_context, execution_context, undo)
- override_context - ``dict`` type.
.. deprecated:: 3.2
:class:`bpy.types.Context.temp_override` should be used instead of this argument.
- execution_context - ``str`` (enum).
- undo - ``bool`` type.

View File

@@ -4,6 +4,7 @@ the middle of updating the armature without having to update dependencies
after each change, by manually carrying updated matrices in a recursive walk.
"""
def set_pose_matrices(obj, matrix_map):
"Assign pose space matrices of all bones at once, ignoring constraints."
@@ -11,7 +12,7 @@ def set_pose_matrices(obj, matrix_map):
if pbone.name in matrix_map:
matrix = matrix_map[pbone.name]
## Instead of:
# # Instead of:
# pbone.matrix = matrix
# bpy.context.view_layer.update()

View File

@@ -0,0 +1,19 @@
"""
Overriding the context can be used to temporarily activate another ``window`` / ``area`` & ``region``,
as well as other members such as the ``active_object`` or ``bone``.
Notes:
- When overriding window, area and regions: the arguments must be consistent,
so any region argument that's passed in must be contained by the current area or the area passed in.
The same goes for the area needing to be contained in the current window.
- Temporary context overrides may be nested, when this is done, members will be added to the existing overrides.
- Context members are restored outside the scope of the context-manager.
The only exception to this is when the data is no longer available.
In the event windowing data was removed (for example), the state of the context is left as-is.
While this isn't likely to happen, explicit window operation such as closing windows or loading a new file
remove the windowing data that was set before the temporary context was created.
"""

View File

@@ -0,0 +1,15 @@
"""
Overriding the context can be useful to set the context after loading files
(which would otherwise by None). For example:
"""
import bpy
from bpy import context
# Reload the current file and select all.
bpy.ops.wm.open_mainfile(filepath=bpy.data.filepath)
window = context.window_manager.windows[0]
with context.temp_override(window=window):
bpy.ops.mesh.primitive_uv_sphere_add()
# The context override is needed so it's possible to set edit-mode.
bpy.ops.object.mode_set(mode='EDIT')

View File

@@ -0,0 +1,16 @@
"""
This example shows how it's possible to add an object to the scene in another window.
"""
import bpy
from bpy import context
win_active = context.window
win_other = None
for win_iter in context.window_manager.windows:
if win_iter != win_active:
win_other = win_iter
break
# Add cube in the other window.
with context.temp_override(window=win_other):
bpy.ops.mesh.primitive_cube_add()

View File

@@ -0,0 +1,46 @@
"""
Image Data
++++++++++
The Image data-block is a shallow wrapper around image or video file(s)
(on disk, as packed data, or generated).
All actual data like the pixel buffer, size, resolution etc. is
cached in an :class:`imbuf.types.ImBuf` image buffer (or several buffers
in some cases, like UDIM textures, multi-views, animations...).
Several properties and functions of the Image data-block are then actually
using/modifying its image buffer, and not the Image data-block itself.
.. warning::
One key limitation is that image buffers are not shared between different
Image data-blocks, and they are not duplicated when copying an image.
So until a modified image buffer is saved on disk, duplicating its Image
data-block will not propagate the underlying buffer changes to the new Image.
This example script generates an Image data-block with a given size,
change its first pixel, rescale it, and duplicates the image.
The duplicated image still has the same size and colors as the original image
at its creation, all editing in the original image's buffer is 'lost' in its copy.
"""
import bpy
image_src = bpy.data.images.new('src', 1024, 102)
print(image_src.size)
print(image_src.pixels[0:4])
image_src.scale(1024, 720)
image_src.pixels[0:4] = (0.5, 0.5, 0.5, 0.5)
image_src.update()
print(image_src.size)
print(image_src.pixels[0:4])
image_dest = image_src.copy()
image_dest.update()
print(image_dest.size)
print(image_dest.pixels[0:4])

View File

@@ -42,10 +42,12 @@ class SimpleMouseOperator(bpy.types.Operator):
self.y = event.mouse_y
return self.execute(context)
# Only needed if you want to add into a dynamic menu
# Only needed if you want to add into a dynamic menu.
def menu_func(self, context):
self.layout.operator(SimpleMouseOperator.bl_idname, text="Simple Mouse Operator")
# Register and add to the view menu (required to also use F3 search "Simple Mouse Operator" for quick access)
bpy.utils.register_class(SimpleMouseOperator)
bpy.types.VIEW3D_MT_view.append(menu_func)

View File

@@ -37,7 +37,7 @@ class ExportSomeData(bpy.types.Operator):
return {'RUNNING_MODAL'}
# Only needed if you want to add into a dynamic menu
# Only needed if you want to add into a dynamic menu.
def menu_func(self, context):
self.layout.operator_context = 'INVOKE_DEFAULT'
self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")

View File

@@ -27,7 +27,8 @@ class DialogOperator(bpy.types.Operator):
wm = context.window_manager
return wm.invoke_props_dialog(self)
# Only needed if you want to add into a dynamic menu
# Only needed if you want to add into a dynamic menu.
def menu_func(self, context):
self.layout.operator(DialogOperator.bl_idname, text="Dialog Operator")

View File

@@ -41,11 +41,13 @@ class CustomDrawOperator(bpy.types.Operator):
col.prop(self, "my_string")
# Only needed if you want to add into a dynamic menu
# Only needed if you want to add into a dynamic menu.
def menu_func(self, context):
self.layout.operator(CustomDrawOperator.bl_idname, text="Custom Draw Operator")
# Register and add to the object menu (required to also use F3 search "Custom Draw Operator" for quick access)
# Register and add to the object menu (required to also use F3 search "Custom Draw Operator" for quick access).
bpy.utils.register_class(CustomDrawOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)

View File

@@ -55,11 +55,13 @@ class ModalOperator(bpy.types.Operator):
context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
# Only needed if you want to add into a dynamic menu
# Only needed if you want to add into a dynamic menu.
def menu_func(self, context):
self.layout.operator(ModalOperator.bl_idname, text="Modal Operator")
# Register and add to the object menu (required to also use F3 search "Modal Operator" for quick access)
# Register and add to the object menu (required to also use F3 search "Modal Operator" for quick access).
bpy.utils.register_class(ModalOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)

View File

@@ -31,10 +31,12 @@ class SearchEnumOperator(bpy.types.Operator):
context.window_manager.invoke_search_popup(self)
return {'RUNNING_MODAL'}
# Only needed if you want to add into a dynamic menu
# Only needed if you want to add into a dynamic menu.
def menu_func(self, context):
self.layout.operator(SearchEnumOperator.bl_idname, text="Search Enum Operator")
# Register and add to the object menu (required to also use F3 search "Search Enum Operator" for quick access)
bpy.utils.register_class(SearchEnumOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)

View File

@@ -22,13 +22,15 @@ class HelloWorldOperator(bpy.types.Operator):
print("Hello World")
return {'FINISHED'}
# Only needed if you want to add into a dynamic menu
# Only needed if you want to add into a dynamic menu.
def menu_func(self, context):
self.layout.operator(HelloWorldOperator.bl_idname, text="Hello World Operator")
# Register and add to the view menu (required to also use F3 search "Hello World Operator" for quick access)
# Register and add to the view menu (required to also use F3 search "Hello World Operator" for quick access).
bpy.utils.register_class(HelloWorldOperator)
bpy.types.VIEW3D_MT_view.append(menu_func)
# test call to the newly defined operator
# Test call to the newly defined operator.
bpy.ops.wm.hello_world()

View File

@@ -29,3 +29,36 @@ def draw():
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')
"""
3D Image
--------
Similar to the 2D Image shader, but works with 3D positions for the image vertices.
To use this example you have to provide an image that should be displayed.
"""
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
IMAGE_NAME = "Untitled"
image = bpy.data.images[IMAGE_NAME]
texture = gpu.texture.from_image(image)
shader = gpu.shader.from_builtin('3D_IMAGE')
batch = batch_for_shader(
shader, 'TRIS',
{
"pos": ((0, 0, 0), (0, 1, 1), (1, 1, 1), (1, 1, 1), (1, 0, 0), (0, 0, 0)),
"texCoord": ((0, 0), (0, 1), (1, 1), (1, 1), (1, 0), (0, 0)),
},
)
def draw():
shader.bind()
shader.uniform_sampler("image", texture)
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -43,7 +43,7 @@ with offscreen.bind():
offscreen.free()
if not IMAGE_NAME in bpy.data.images:
if IMAGE_NAME not in bpy.data.images:
bpy.data.images.new(IMAGE_NAME, WIDTH, HEIGHT)
image = bpy.data.images[IMAGE_NAME]
image.scale(WIDTH, HEIGHT)

View File

@@ -1,12 +1,12 @@
sphinx==4.1.1
sphinx==5.0.1
# Sphinx dependencies that are important
Jinja2==3.0.1
Pygments==2.10.0
Jinja2==3.1.2
Pygments==2.12.0
docutils==0.17.1
snowballstemmer==2.1.0
babel==2.9.1
requests==2.26.0
snowballstemmer==2.2.0
babel==2.10.1
requests==2.27.1
# Only needed to match the theme used for the official documentation.
# Without this theme, the default theme will be used.

View File

@@ -4,6 +4,12 @@ OpenGL Wrapper (bgl)
.. module:: bgl
.. warning::
This module is deprecated and will be removed in a future release,
when OpenGL is replaced by Metal and Vulkan.
Use the graphics API independent :mod:`gpu` module instead.
This module wraps OpenGL constants and functions, making them available from
within Blender Python.

View File

@@ -40,15 +40,6 @@ As well as pep8 we have additional conventions used for Blender Python scripts:
- pep8 also defines that lines should not exceed 79 characters,
we have decided that this is too restrictive so it is optional per script.
Periodically we run checks for pep8 compliance on Blender scripts,
for scripts to be included in this check add this line as a comment at the top of the script:
``# <pep8 compliant>``
To enable line length checks use this instead:
``# <pep8-80 compliant>``
User Interface Layout
=====================

View File

@@ -93,7 +93,7 @@ Consider the calculations that might contribute to the object's final transforma
- Animation function curves.
- Drivers and their Python expressions.
- Constraints
- Parent objects and all of their F-curves, constraints, etc.
- Parent objects and all of their F-Curves, constraints, etc.
To avoid expensive recalculations every time a property is modified,
Blender defers the evaluation until the results are needed.
@@ -802,7 +802,7 @@ Removing Data
-------------
**Any** data that you remove shouldn't be modified or accessed afterwards,
this includes: F-curves, drivers, render layers, timeline markers, modifiers, constraints
this includes: F-Curves, drivers, render layers, timeline markers, modifiers, constraints
along with objects, scenes, collections, bones, etc.
The ``remove()`` API calls will invalidate the data they free to prevent common mistakes.

View File

@@ -1,7 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
# This is a quite stupid script which extracts bmesh api docs from
# 'bmesh_opdefines.c' in order to avoid having to add a lot of introspection
# data access into the api.

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