1
1

Compare commits

...

2791 Commits

Author SHA1 Message Date
a0f754e774 Merge branch 'master' into refactor-idprop-ui-data 2021-08-26 23:41:41 -05:00
523bc981cf Fix loading packed fonts for sequencer strips 2021-08-27 13:11:36 +10:00
61f9274d07 Cleanup: use early return 2021-08-27 13:05:12 +10:00
efc129bc82 Fix sequencer font loading using an unexpected path
Reuse the existing font loading function which handles this case.
2021-08-27 13:01:19 +10:00
Henrik Dick
20ef771374 Modifier: smooth interpolation support
Add an option to the mask modifier to use the vertex weights to generate
smooth in between geometry, instead of just deleting non complete faces.

This can be used to make all sorts of smooth dissolve animations
directly with geometry, which are usually hacked together with shaders.
It also allows for implicit function plotting using geometry nodes and
boolean like operations on non manifold geometry with the proximity
modifier.

Reviewed By: campbellbarton

Ref D10979
2021-08-27 11:48:18 +10:00
8949eab27e Cleanup: warnings 2021-08-27 11:47:56 +10:00
2b64b4d90d Fix T90973: GPencil - Add buttons to move up and down vertex groups
These buttons were in Meshes but not for Grease Pencil. This patch add them in order to keep consistency.

Reviewed By: HooglyBoogly

Maniphest Tasks: T90973

Differential Revision: https://developer.blender.org/D12328
2021-08-26 22:00:24 +02:00
e5ed9991ea UI: Consistent Area Move Snapping Locations
Change Area Move snapping locations to even 12ths, rather than current
eights and thirds, so snap distances are consistent sizes. Also adds
snapping at minimum and maximum locations.

see D11938 for details and illustrations.

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

Reviewed by Hans Goudey
2021-08-26 10:52:18 -07:00
Germano Cavalcante
8e5b7ac6e2 Fix error in last commmit 2021-08-26 14:21:45 -03:00
583f694826 Fix T90817: Object Picker Doesn't Work on Second window
Solution similar to the one seen in {rBb94ab93dfb82}.

The idea is to find the window and region under the cursor to use in the
operator.

Reviewed By: brecht

Maniphest Tasks: T90817

Differential Revision: https://developer.blender.org/D12310
2021-08-26 14:13:19 -03:00
aadbdb8048 Cleanup: split eyedropper_color_sample_fl into more specific utilities
The window and region find utility can be used in other eyedropper
operators.
2021-08-26 14:12:21 -03:00
Germano Cavalcante
d7b0567f7c Cleanup: return window in 'WM_window_find_under_cursor'
This better matches other functions like `BKE_screen_find_area_xy`.
2021-08-26 13:49:04 -03:00
06a60fe9f7 PyAPI: GPU: expose clip distances
Now you can get a shader that uses Clip Planes and set the number of
Clip Distanes with `gpu.state.clip_distances_set(value)`.
2021-08-26 13:03:07 -03:00
edb95b3fcb Cleanup: Use ID_IS_LINKED instead of direct id.lib pointer check. 2021-08-26 15:01:14 +02:00
1bb2077250 Add locking fallback atomics implementation
Is used for platforms for which we do not have native implementation,
such as MIPS, for example.

It is possible to test locking implementation on local computer by
defining `ATOMIC_FORCE_USE_FALLBACK` in the atomic_ops_unix.h file.

Run full regression suit with the locking implementation on amd64
Linux platform and all tests passed.

Having non-optimal but working implementation for odd-ball platforms
seems to be a better choice than failing the build entirely.

Differential Revision: https://developer.blender.org/D12313
2021-08-26 14:36:59 +02:00
2419ffa183 Fix T90959: crash when hovering over empty data block socket 2021-08-26 14:35:10 +02:00
da17692a3d Cleanup: use BLI_UTF8_MAX define 2021-08-26 20:41:02 +10:00
1434ac3767 Cleanup: add ATTR_WARN_UNUSED_RESULT to BLI_string_utf8.h 2021-08-26 20:41:02 +10:00
c52db4c4cf Decouple highlighted tiles from RenderPart
Should be no visible change on user side.
Preparing for render parts removal as part of Cycles X project.

Differential Revision: https://developer.blender.org/D12317
2021-08-26 12:09:03 +02:00
ec66b3ef9b Fix issues with absolute time unit
I think there are the following issues with {rB5fa6cdb77a98}:
- if we introduce a PROP_UNIT_TIME_ABSOLUTE unit, shouldnt it be visible
to RNA as well?
- seems like a double entry sneaked into that commit?

This is in preparation to use this for render time limit in cycles-x.

ref. T90701

Maniphest Tasks: T90701

Differential Revision: https://developer.blender.org/D12315
2021-08-26 11:01:32 +02:00
1f2bf2fd73 Cleanup, quiet compile warnings 2021-08-26 10:36:04 +02:00
fe73778095 Cleanup: unused function from 082ddc9379 2021-08-26 16:10:24 +10:00
d3514cd6a7 ToolSystem: increase the inset tool size
The inset tool requires moving the cursor towards the center of the
selection, making it nearly impossible to use the inset tool
when the view was aligned with the vertical handle.

Use custom settings for VIEW3D_GGT_tool_generic_handle_free
to make it draw hollow, as large as the scale tool.

Resolves T87991.
2021-08-26 16:02:35 +10:00
082ddc9379 ToolSystem: support per-tool gizmo group properties
Also add gizmo group example to the tool-template.
2021-08-26 16:02:31 +10:00
f464cac55a Cleanup: redundant update calls adding objects
These update calls are already performed by
ED_object_add_type_with_obdata.
2021-08-26 13:53:15 +10:00
2fb57685e3 Fix "Text to Object" creating invisible object
Newly created objects would not become visible until
another action forced a depsgraph update.
2021-08-26 12:59:22 +10:00
efcac47155 Cleanup: soft CMake file lists 2021-08-26 12:41:26 +10:00
cec35060f5 Cleanup: sort struct blocks 2021-08-26 12:39:45 +10:00
4e16e8b671 Cleanup: warnings 2021-08-26 12:36:58 +10:00
84f048fda5 Cleanup: use C style comments for descriptive text 2021-08-26 12:36:58 +10:00
42032db1c2 Cleanup: remove deprecated flag use in collada 2021-08-26 12:36:58 +10:00
afcd06e1e1 Cleanup: spelling in comments 2021-08-26 12:36:58 +10:00
ff85ac3009 Cleanup: clang-format 2021-08-26 12:27:13 +10:00
e5a5a251d2 Fix T90915: outliner select behaves as if Ctrl is held
Error in 452cc01932
2021-08-26 11:37:22 +10:00
70fbdcb6bf Cleanup: Refactor proximity node to be more data type agnostic
Before, distances from each component were handled in the same loop,
making it more complicated to add support for more component types
in the future (and probably hurting performance by dealing with two
BVH trees at the same time, though I didn't test that).

Now each component is handled in a separate function, so that adding
support for another component type is much simpler.
2021-08-25 18:03:24 -05:00
5b751c95f4 BLF: Remove ASCII-only Code Paths
Remove redundant code for drawing text strings that contain only ASCII.

See D12293 for much more detail.

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

Reviewed by Campbell Barton
2021-08-25 13:30:00 -07:00
518b97e674 Windows/Ninja: Optimize linker performance
The /Zc:inline flag is by default off in the MSVC
compiler however when you build with msbuild it adds
it to the build flags on its own.

Ninja however does not decide on its own to add
flags you didn't ask for and was building without
this flag.

This change explicitly adds the compiler flag so
msbuild and ninja builds are once more building
with the same build flags leading to smaller .obj
files when building with ninja and lightening the
workload for the linker.

This flag is available starting MSVC 2013 update 2
so does not need to be guarded with version checks.
2021-08-25 10:55:45 -06:00
05564c8ca6 Fix wrong length value in the header of the Move operator
Missed in {rB0d36439f95c0}.
2021-08-25 13:01:41 -03:00
8fb9155598 Fix T90248: missing depsgraph update tag for node group
The code assumed that when a node group is is at the highest
level in the node editor, then it is embedded into another data
block and can't be referenced by other node groups. This is true
for shader and compositor nodes, but not for geometry nodes.
2021-08-25 18:00:29 +02:00
0d36439f95 Fix T90911: Move along axis does not display real distance units
Variable was wrongly set to 0.
Caused by {rB7192e57d63a5}.
2021-08-25 12:44:35 -03:00
f49d438ced Cleanup and remove SEQ_ALL_BEGIN macro
We now use a for_each function with callback to iterate through all sequences in the scene.

This has the benefit that we now only loop over the sequences in the scene once.
Before we would loop over them twice and allocate memory to store temporary data.

The allocation of temporary data lead to unintentional memory leaks if the code used returns to exit out of the iteration loop.
The new for_each callback method doesn't allocate any temporary data and only iterates though all sequences once.

Reviewed By: Richard Antalik, Bastien Montagne

Differential Revision: http://developer.blender.org/D12278
2021-08-25 17:30:39 +02:00
796035ad93 Cleanup: else-after-return 2021-08-25 16:00:48 +02:00
0fd1e6a5f4 T90908: Reduce loading times when extracting thumbnails from Blendfiles.
Previously when loading an thumbnails for an asset the whole file was
read. Reason this was done was perhaps a future idea to load
all thumbnails inside a blendfile in a single go. This was never implemented
and currently unneeded disk and cpu cycles was spend with finding out what
preview to load.

This patch adds an early break when the thumbnail that the caller is
interested in has been found. This improves the thumbnail extraction
when looking into large files.

Reviewed By: mont29

Maniphest Tasks: T90908

Differential Revision: https://developer.blender.org/D12312
2021-08-25 15:59:41 +02:00
5a0ec2302e XR: Enable controller profile extensions
Enables all currently documented OpenXR controller profile
extensions (Reverb G2, Vive Cosmos, Huawei Controller) in order to
support bindings for more VR hardware.

This is necessary because, if these extensions are not enabled, the
OpenXR runtime will return an error when creating a binding with one
of these profiles.

Does not bring about any changes for users at the moment, since
default controller actions have not yet been exposed to users (will
be addressed with D10944, D10948, and D11271).
2021-08-25 21:36:53 +09:00
940ba74024 XR: Improve "Invalid stage ref space" warning
Originally mentioned that absolute tracking was disabled, which is
wrong because absolute tracking (skipping application of eye offsets)
is always available, although it may not give the expected result of
persistent tracking origins across sessions if the stage space is
unavailable (hence the need for a warning).

Now, the warning makes no mention of absolute tracking, instead
informing the user that the local space fallback will be used and
that they should define tracking bounds via the XR runtime if they
wish to use the stage space.
2021-08-25 20:59:53 +09:00
d6ace5a7bb Fix: Crash on file read with active VR session
Add null check for runtime data since it could already have been
freed via wm_xr_exit() (called on file read) prior to the session
exit callback.

Also, fix potential memory leak by freeing session data in
wm_xr_runtime_data_free() instead of session exit callback.
2021-08-25 20:59:37 +09:00
cb9c0aa7d0 Fix: XR action map memory leaks
This fixes two memory leaks related to XR action maps.

1. Freeing of action maps needs to be moved from wm_xr_exit() to
wm_xr_runtime_data_free() since the runtime may have already been
freed when calling wm_xr_exit().

2. Action bindings for action map items were not being freed. This
was mistakenly left out of e844e9e8f3 since the patch needed to be
updated after d3d4be1db3.
2021-08-25 20:57:13 +09:00
a34652d6f8 Fix: Incorrect declaration of XrActionMaps RNA
This fixes a mistake in the XrActionMaps RNA struct declaration.

Originally, the XrActionMaps struct SDNA was set as wmXrData to get
access to wmXrRuntimeData. However, this doesn't give a valid pointer
and the XrSessionState RNA pointer needs to be passed instead.

Since XrSessionState itself does not have SDNA, it is necessary to
pass the XrSessionState pointer to the XrActionMaps struct functions
(new(), new_from_actionmap(), ...) instead of simply using
RNA_def_struct_sdna().
2021-08-25 20:56:52 +09:00
452cc01932 Cleanup: skip saving selection properties set in the keymap
Having settings such as "extend" saved between executions causes
keymaps that don't include this setting to remember the value
between execution.

No longer store this setting for selection operations & remove
redundant values from the key-maps, see: T90275.
2021-08-25 18:10:56 +10:00
8d634c1b27 Cleanup: Mentioning incorrect source file in comment.
Code mentions that ID_* were defined in DNA_ID.h but are actually defined
in DNA_ID_enums.h.
2021-08-25 10:00:55 +02:00
e91fd3b816 Cleanup: separate IMB_thumb_load_blend in multiple functions. 2021-08-25 10:00:55 +02:00
a2597f8b83 Keymap: repeat was disabled for Ctrl-Backspace in the text editor 2021-08-25 17:40:55 +10:00
b98b9354b2 Cleanup: Fixed compile error in debug code. 2021-08-25 09:37:46 +02:00
9df063df19 Fix assert caused by 38630711a0 2021-08-25 17:18:26 +10:00
820d50d3cb Correct error in 38630711a0 2021-08-25 15:36:40 +10:00
38630711a0 BLI_string_utf8: remove unnecessary utf8 decoding functions
Remove BLI_str_utf8_as_unicode_and_size and
BLI_str_utf8_as_unicode_and_size_safe.

Use BLI_str_utf8_as_unicode_step instead since it takes
a buffer bounds argument to prevent buffer over-reading.
2021-08-25 15:28:59 +10:00
be906f44c6 BLI_string_utf8: simplify utf8 stepping logic
There were multiple utf8 functions which treated
errors slightly differently.

Split BLI_str_utf8_as_unicode_step into two functions.

- BLI_str_utf8_as_unicode_step_or_error returns error value
  when decoding fails and doesn't step.

- BLI_str_utf8_as_unicode_step always steps forward at least one
  returning the byte value without decoding
  (needed to display some latin1 file-paths).

Font drawing uses BLI_str_utf8_as_unicode_step and no longer
check for error values.
2021-08-25 15:27:18 +10:00
70f890b510 VSE: Set default sound and video export format
Use video format for export instead of image sequence. Settings are same
as defined in h264_in_MP4 preset.

Sound default is AAC with 256kbit bitrate.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D7916
2021-08-25 06:58:43 +02:00
f80c39b74e Cleanup: Use shorter enum item names 2021-08-24 23:40:13 -05:00
891e3e98eb LineArt: Fix (Unreported) Crash when loading objects.
Fix mesh freeing call for obi->original_me so the address is correct.
2021-08-25 11:05:48 +08:00
a2e0f714f2 Cleanup: Remove unecessary variables
Instead of passing separate booleans for whether to store the locations
and distances, check if the spans are empty. And instead of passing a
separate boolean for whether there is valid tree data, pass a pointer
to the data.
2021-08-24 21:57:45 -05:00
137a5e162c Merge branch 'master' into refactor-idprop-ui-data 2021-08-24 17:40:18 -05:00
5ef3afd87c Fix T90900: Crash when rendering geometry nodes created curve
The comment for data_eval mentions that it should contain a mesh for
curve objects, however with geometry nodes, objects can evaluate to
curves as well (though they are only containers for the `CurveEval`.
That is a larger issue, but with the upcoming geometry instancing patch
the situation changes, so this commit does not correct that. I also hope
to remove this code in favor of the new curve to mesh code soon.

Instead, just check the evaluated data type in this case, which prevents
the crash, though it is hacky.
2021-08-24 13:38:53 -05:00
f53cf5141d Cleanup: Make function static, remove unused arguments 2021-08-24 13:27:29 -05:00
19da434e9c Nodes: Improvements to edge panning in the node editor.
- New operator property to toggle edge panning in the keymap:
  This is disabled by default to avoid edge-panning in cases where it
  gets distracting, such as adding a new node. Only the explicit
  translate operator(s) (GKEY or drag) have this enabled now.

- Restore the initial view rect on edge pan cancel:
  The initial view rect is now stored in the edge pan operator data.
  When an operator with edge panning is cancelled it can now call the
  `UI_view2d_edge_pan_cancel` function to restore the original View2D
  rect.

- Less delay in node editor scrolling:
  Delay is useful when scrolling through long lists, such as in the
  outliner, but makes node scrolling feel sluggish and unresponsive.
  The lower scroll speed here makes a faster response the better option.

- Zoom influence feature:
  Somewhat slower scrolling in UI-space when zoomed out. With the 0.5
  zoom influence factor nodes behave as if zoom factor is halved,
  otherwise it gets too fast when zoomed out. Previously scrolling would
  always be constant-speed in UI space, now it's half-way between UI
  space and node (view) space.
2021-08-24 18:00:05 +01:00
Robert Guetzkow
38bdde852f Fix T90715: Remove correct particle modifier through Python API
Before this patch attempting to remove a particle modifier programmatically
through Python would fail, because it deleted the modifier associated with
the currently active particle system instead of the one passed as an argument
to `bpy.types.ObjectModifiers.remove()`.

This fix  adds an additional argument for the particle system to
`object_remove_particle_system`. This allows to specify which particle system
and its associated modifier shall be removed. In case of
`particle_system_remove_exec` it will remain the currently active particle
system, whereas `object_remove_particle_system` passes the particle system
of the modifier. Hence, the correct modifier will be removed.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D12234
2021-08-24 18:41:22 +02:00
551521cfa4 Cleanup: ID management: Remove useless internal for BKE_lib_id_clear_library_data.
This static internal `_ex` function was not doing anything extra, just
move back whole code to public API `BKE_lib_id_clear_library_data`.
2021-08-24 17:19:41 +02:00
b55c02a206 Cleanup: Remove useless Camera make_local callback.
Not sure why this one was still there, probably just escaped a previous
cleanup somehow.
2021-08-24 17:08:23 +02:00
9327c00f70 Cleanup: Simplify logic 2021-08-24 10:01:08 -05:00
038f9b7f4a Render: Lazily allocate render passes pixels storage
The idea is to only allocate pixel storage only when there is an actual
data to be written to them.

This moves the code forward a better support of high-res rendering when
pixel storage is not allocated until render engine is ready to provide
pixel data.

Is expected to be no functional changes for neither users no external
engines. The only difference is that the motion and depth passes will
be displayed as transparent for until render engine provides any tile
result (at which point the pixels will be allocated and initialized to
infinite depth).

Differential Revision: https://developer.blender.org/D12195
2021-08-24 16:20:57 +02:00
7aff40f410 FFMPEG: Fix building with older versions that need FFMPEG_USE_DURATION_WORKAROUND 2021-08-24 15:15:21 +02:00
3c82725d74 Disable Fade Inactive Geometry overlay by default
This overlay was intended to identify the active objects in modes
like Sculpt Mode, where you don't have any extra visual indication
of what is the current and target object when switching directly
between them.

After having flash on mode transfer on the transfer mode operator,
the visual information this overlays provides is redundant. It is
still available in case some users want to use it like a way of
focusing on the active object.

Reviewed By: JulienKaspar, JacquesLucke

Differential Revision: https://developer.blender.org/D12303
2021-08-24 12:56:36 +02:00
46913bf0a0 Fix T90840: Can't duplicate or copy (Ctrl-C) object from linked file.
We need to separate the flag telling duplicate code to not handle
remapping to new IDs etc., from the one telling the code that we are
currently duplicating a 'root' ID (i.e. not a dependency of another
duplicated ID).

This whole duplicate code/logic is still fairly unsatisfying, think it
will need further refactor, or maybe even re-design, at some point...
2021-08-24 12:23:39 +02:00
4e4ac5a867 Fix invalid mask use for the UV-project modifier
Mistake in a30a817933.
2021-08-24 18:17:54 +10:00
Himanshi Kalra
30d3dd4de1 Added more Geometry Node tests
* Attributes
* Utilities
* Volume

Test folder located in `lib\tests\modeling\geometry_nodes`
It contains around 34 new tests.
* attribute clamp + other attribute nodes
* Curve Primitive nodes
* Mesh Primitive nodes
* delete geometry
* convex hull
* subdivision surface
* boolean intersect
* boolean diff
* volume to mesh

Reviewed By: zazizizou, JacquesLucke

Differential Revision: https://developer.blender.org/D12250
2021-08-24 13:27:36 +05:30
983280b014 PyAPI: remove active area test for script.python_file_run operator
There is no reason running a Python file should require an active area.
2021-08-24 14:53:23 +10:00
de60205f19 Fix buffer size mismatch in SCRIPT_OT_python_file_run
Reading paths over 512 bytes would cause a buffer overrun.
2021-08-24 14:52:02 +10:00
e0a6001a22 Fix reporting Python reference leaks with WITH_PYTHON_SAFETY
Error in f3e26c847b
2021-08-24 14:36:25 +10:00
8b55cda048 Fix BLI_str_utf8_as_unicode_step reading past intended bounds
Add a string length argument to BLI_str_utf8_as_unicode_step to prevent
reading past the buffer bounds or the intended range since some callers
of this function take a string length to operate on part of the string.

Font drawing for example didn't respect the length argument,
potentially causing a buffer over-read with multi-byte characters
that could read past the end of the string.

The following command would read 5 bytes past the end of the input.

`BLF_draw(font_id, (char[]){252}, 1);`

In practice strings are typically null terminated so this didn't crash
reading past buffer bounds.

Nevertheless, this wasn't correct and could cause bugs in the future.

Clamping by the length now has the same behavior as a null byte.

Add test to ensure this is working as intended.
2021-08-24 14:25:15 +10:00
8371df8b1c Cleanup: spelling 2021-08-24 12:49:00 +10:00
a311ab6167 Cleanup: quiet clang-format warnings, unused argument 2021-08-24 12:43:15 +10:00
bffa168157 Fix T90854: Cycles, normal map fails with applied transformations
Prior to rBb8ecdbcd964a normals were stored both in
DeviceScene.tri_vnormal and the float3 attributes buffer. However, the
normals in `DeviceScene.tri_vnormal` might have be transformed to world
space if the object's transformation was applied, while the data in the
float3 attributes buffer were not. This caused shading issues in cases
where the objects did have transformation applied, as the math expects
the normals to be in object space.

To fix this, convert the normals to object space if necessary before
applying the normal map.

Reviewed By: brecht

Maniphest Tasks: T90854

Differential Revision: https://developer.blender.org/D12294
2021-08-24 01:43:57 +02:00
Félix
eec1ea0ccf VSE: Add Sequence.parent_meta() python API function
This function can be used to find metastrip parent of nested strip.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D11985
2021-08-24 01:21:08 +02:00
929d7597b3 VSE: Cleanup speed effect math
Simplify logic of speed effect frame calculation by using discrete math
where possible. Only `SEQ_SPEED_MULTIPLY` mode with animation requires
frame map to be built. Frame map building was simplified by removing
unused branches.

Functional change: Animating strip in negative range will reverse playback.
I assume this was limitation of previous system, where each frame map item
was limited to be within correct frame range. Now frame map can contain
values that point beyond usable range and they are limited by
`seq_speed_effect_target_frame_get`. This way it is possible to control
playback rate in both directions.

Mostly fixes T89120 apart from offset handling.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11939
2021-08-24 01:10:12 +02:00
a57ba4147f Fix T88237: Prefetch crash on rendering scene strip
Prefetch needs to avoid rendering scene strips, because

 - Rendering in background needs own dependency graph, which fails to
   initialize from evaluated data.
 - This locks UI and can make it unresponsive for long time periods.

In T88237 prefetch failed to avoid scene strip, because of effect strip
was attached to scene strip.

Ensure, that no effect that is attached to scene strip either directly
or indirectly would be rendered.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11247
2021-08-24 00:58:01 +02:00
709ce44617 Fix T90407: Split fails on transition strips
When splitting strips, first they are duplicated and then offsets
adjusted. This can fail on cross transitions, because some strips don't
overlap with split frame.

All strips, that relate to each other must be duplicated to ensure
correct relations after splitting, so solution is to delete non
overlapping strips from left or right side respectively.

Since cross transition don't have to overlap with source strips,
splitting such strips would lead to effect being deleted, which
could cause crash when iterating over strips in python. Therefore
splitting of such strips is now forbidden and will generate error.

Splitting of transition will also generate error solely because such
operation is illogical.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D12121
2021-08-24 00:52:24 +02:00
24a3446787 Fix T90646: VSE hangs when strips overlap
When all strips are selected and overlap is caused, this causes VSE to
hang in infinite loop, because such situation should never happen.

To prevent infinite loop, ensure, that strip overlap is not tested
against single overlapping strip itself.

Prevent overlap that can not be handled because of issue described above
by moving overlapping strip between channels.

Reviewed By: campbellbarton

Differential Revision: D12209
2021-08-24 00:46:34 +02:00
a0c8ee057a Fix T90467: Initialize CurveMapping on demand
`CurveMapping.evaluate` function expectes `CurveMapping` to be
initialized, while this wasn't documented.

I don't see any reason for not initializing `CurveMapping` on demand.
Initialization was added in rBf16047c2df1e8be56bf76524f9eb1fa5ecde2176

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12145
2021-08-24 00:37:32 +02:00
Himanshi Kalra
875c2ea5b5 Using relative threshold for floats in mesh comparison
Changes the threshold comparison from absolute to relative.
Removes threshold for MLoopCol comparison.

Adds a compare relative threshold function.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12273
2021-08-24 00:50:03 +05:30
be1891e895 Cleanup: move the buffer list to 'MeshBufferCache'
The cache is used to fill the buffer list.
2021-08-23 13:44:31 -03:00
cbe4036406 Cleanup: Isolate the batch list struct into a struct called MeshBatchList
This allows for a simplification of macros and combines with
`MeshBufferList`.
2021-08-23 13:43:45 -03:00
eb0c50ac78 Cleanup: rename 'MeshBufferExtractionCache' to 'MeshBufferCache'
Matches the existing `MeshBatchCache`.
2021-08-23 13:43:42 -03:00
6e51ef9531 Cleanup: rename 'MeshBufferCache' to 'MeshBufferList'
`MeshBufferList` is more specific and can avoid confusion with
`MeshBufferExtractionCache`.
2021-08-23 13:41:03 -03:00
Germano Cavalcante
ebdae75736 Cleanup: Move 'tris_per_mat' member out of 'MeshBufferCache'
`MeshBufferCache` is a struct representing a list of buffers.

As such, `GPUIndexBuf **tris_per_mat` is out of place as it does not
represent one of the buffers in the list.

In fact this member should be close to `GPUBatch **surface_per_mat` as
they are related.

The code for dependencies between buffer and batch had to be reworked
as it relies on the member's position.

Differential Revision: https://developer.blender.org/D12227
2021-08-23 13:37:32 -03:00
7d17f2addf Fix T89998: Cryptomatte node output values doubled with Multi-View
When using a Cryptomatte node and selecting 2 views in Multi-View,
its output values are doubled. When selecting 3 tripled and so on.
This causes incorrect compositing results for all the views.

The node creates an input operation for each rendered cryptomatte
pass. In Multi-View, passes are rendered for each view but compositor
is executed per view and should only create operations for those
corresponding to the current view being executed. Otherwise duplicated
operations add up later in cryptomatte operation.

Reviewed By: jbakker

Maniphest Tasks: T89998

Differential Revision: https://developer.blender.org/D12216
2021-08-23 17:09:59 +02:00
4c6d207343 Compositor: Fix crash enabling buffer groups on full frame
Full frame doesn't support this option as all operations are already
buffered. UI option will be removed in the future.
2021-08-23 17:09:59 +02:00
42f89b9212 Compositor: Fix incorrect copying of uchar buffers
Row stride and the area x coordinate offset were not taken into
account.
2021-08-23 17:09:59 +02:00
153b45037f Compositor: Full frame matte nodes
Adds full frame implementation to Channel Key, Chroma Key, Color Key,
Color Spill, Cryptomatte, Difference Key, Distance Key, Keying,
Keying Screen and Luminance Key nodes. The other nodes
in "Matte" sub-menu are submitted separately.

No functional changes.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12220
2021-08-23 17:09:59 +02:00
daa7c59e38 Compositor: Full frame Bokeh Blur and Blur nodes
Adds full frame implementation to these nodes operations.

When enabling "extend bounds" node option, tiled implementation
result is slightly different because it's using `TranslateOperation`
with bilinear sampling for centering.
Full frame always uses nearest to don't lose image quality.
It has the disadvantage of causing image jiggling on backdrop
when switching size values as it's not pixel perfect.
This is fixed by rounding to even.

No functional changes.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12167
2021-08-23 17:08:45 +02:00
344aca3b1b Compositor: Full frame distort nodes
Adds full frame implementation to "Displace", "Crop", "Flip",
"Plane Track Deform", "Corner Pin", "Movie Distortion",
"Lens Distortion" and "Map UV" nodes.

The other nodes in "Distort" sub-menu are implemented
separately in other commits.

No functional changes.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12166
2021-08-23 17:07:37 +02:00
064167fce7 Compositor: Full frame transform nodes
Adds full frame implementation to "Rotate", "Transform" and
"Stabilize2D" nodes.
To avoid sampling twice when concatenating scale and rotate
operations, a `TransformOperation` is implemented with all
the functionality.
The nodes have no functional changes.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12165
2021-08-23 16:36:09 +02:00
a95e56b741 Compositor: Add sampling methods for full frame
Current sampling methods have off by one issues on full frame:
- Bilinear sampling do not fully sample bottom and left image border,
 creating edges.
- Single elem buffers are not sampled at all when they should be
 at least on the borders to smooth edges.
- EWA filtering is partially implemented on `ReadBufferOperation`, it
 needs to be moved to `MemoryBuffer` on full frame.

In order to not affect tiled implementation, this commit creates
specific sampling methods for full frame needs.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12164
2021-08-23 16:36:09 +02:00
8f4730e66f Compositor: Full frame convert nodes
Adds full frame implementation to all nodes in "Converter" sub-menu
except "ID Mask" which is implemented separately.
No functional changes.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12095
2021-08-23 16:36:08 +02:00
James Partsafas
21d4a888b8 Fix T88107: rename Convertor to Converter nodes to correct spelling
Differential Revision: https://developer.blender.org/D11198
2021-08-23 16:27:33 +02:00
Mikhail Matrosov
cd118c5581 Fix T90423: black pixels after shadow terminator geometry offset
Solves an error in the principled diffuse BSDF, where it was not correctly
rejecting directions outside the hemisphere.

Differential Revision: https://developer.blender.org/D12283
2021-08-23 15:47:34 +02:00
27f138f4c8 Cleanup: rename parameter in transform utility
`inv_unit_scale` is not descriptive.
2021-08-23 09:49:01 -03:00
2f0e350ffd Fix T90872: Dopesheet messes up keyframe handles
Y coordinate was not being constrained.

Caused by {rBb0d9e6797fb866e7a58876c7977c98a190070310}
2021-08-23 09:49:01 -03:00
b4b3f518aa GPencil: Fix memory leak in split & trim functions
Authored by Henrik Dick (weasel)

Reviewed By YimingWu (NicksBest), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12284
2021-08-23 20:46:38 +08:00
5aa3167e48 Fix T90772: Image Editor not sampling color from the the currently
selected pass

Caused by {rBebaa3fcedd23}.

Seems this above commit assumed an ImageUser's multi_index is only used
for Multiview/Stereo? This is not the case, multi_index also stores the
index for layer/pass combination.

If we call both BKE_image_multilayer_index and BKE_image_multiview_index
(even though this is not appropriate/needed for multilayer images?), we
might end up overwriting multi_index again.

note: looking at this I was also wondering why we update the ImageUser
in image-buffer-aquiring funnctions [and not from the UI, e.g.
template_image_layers, but that is a whole different story I guess, see
comment in T90772 as well]

note2: this could also use a utility function (this is not the only
place where this is done), this is fo a cleanup commit.

Maniphest Tasks: T90772

Differential Revision: https://developer.blender.org/D12267
2021-08-23 13:54:52 +02:00
8165333de9 Pipeline: Use more explicit cuda versions. 2021-08-23 13:47:40 +02:00
9564b6cf23 Fix T90651: camera reconstruction crash without scene camera
This was working differently in 2.79, tried tracking this down and it
seems this was wrong since the 2.8 beginning in {rB7907dfc40018}.

This would not only crash without an active scene camera, but would also
result in different tracks from different camera's constraints could not
be selected.

So select id depends on corresponding camera, remove the dependency on
scene camera completely.

Maniphest Tasks: T90651

Differential Revision: https://developer.blender.org/D12230
2021-08-23 12:52:23 +02:00
0682af0d63 RNA: add length augmented to RNA_string_get_alloc
This was noted as a TODO as it wraps RNA_property_string_get_alloc
which takes a length return argument.
2021-08-23 15:08:48 +10:00
62f2204d65 Cleanup: rename len to str_len for BLF functions
Make it obvious which variable this is the length of.
2021-08-23 15:08:28 +10:00
aa067bef5e Cleanup: use BLI_str_utf8 prefix
Rename:

- BLI_str_utf8_invalid_byte  (was BLI_utf8_invalid_byte)
- BLI_str_utf8_invalid_strip (was BLI_utf8_invalid_strip)
2021-08-23 15:02:13 +10:00
0de3d4e8c7 Fix T90847: snap to face of Add Primitive tool not working in edit mode
BVHTree was being created but not balanced.
Error introduced in {rBfcc844f8fbd0}.
2021-08-22 23:48:54 -03:00
b477333473 Cleanup: fix comment about compiler support.
Differential Revision: https://developer.blender.org/D12288
2021-08-22 22:15:28 +05:30
a1e91fbef3 BLF: Remove space_userpref.py font_kerning_style
Remove `font_kerning_style` from `space_userpref.py` since this is no
longer valid.

See more details in D12276

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

Reviewed by Campbell Barton
2021-08-22 09:26:06 -07:00
721fad37a1 Fix Windows builds after Zstandard commits 2021-08-21 23:31:51 +02:00
67c29bc5a2 Use Zstandard compression for the sequencer cache
Reviewed By: campbellbarton, brecht, mont29

Differential Revision: https://developer.blender.org/D5799
2021-08-21 21:39:06 +02:00
2ea66af742 Add support for Zstandard compression for .blend files
Compressing blendfiles can help save a lot of disk space, but the slowdown
while loading and saving is a major annoyance.
Currently Blender uses Zlib (aka gzip aka Deflate) for compression, but there
are now several more modern algorithms that outperform it in every way.

In this patch, I decided for Zstandard aka Zstd for several reasons:
- It is widely supported, both in other programs and libraries as well as in
  general-purpose compression utilities on Unix
- It is extremely flexible - spanning several orders of magnitude of
  compression speeds depending on the level setting.
- It is pretty much on the Pareto frontier for all of its configurations
  (meaning that no other algorithm is both faster and more efficient).

One downside of course is that older versions of Blender will not be able to
read these files, but one can always just re-save them without compression or
decompress the file manually with an external tool.

The implementation here saves additional metadata into the compressed file in
order to allow for efficient seeking when loading. This is standard-compliant
and will be ignored by other tools that support Zstd.
If the metadata is not present (e.g. because you manually compressed a .blend
file with another tool), Blender will fall back to sequential reading.

Saving is multithreaded to improve performance. Loading is currently not
multithreaded since it's not easy to predict the access patterns of the
loading code when seeking is supported.
In the future, we might want to look into making this more predictable or
disabling seeking for the main .blend file, which would then allow for
multiple background threads that decompress data ahead of time.

The compression level was chosen to get sizes comparable to previous versions
at much higher speeds. In the future, this could be exposed as an option.

Reviewed By: campbellbarton, brecht, mont29

Differential Revision: https://developer.blender.org/D5799
2021-08-21 21:39:06 +02:00
2b170f16d6 Refactor low-level blendfile reading into separate files
Instead of handling mmap, compression etc. all directly in readfile.c, refactor
the code to use a generic FileReader.
This makes it easier to add new compression methods or similar, and allows to
reuse the logic in other places (e.g. thumbnail reading).

Reviewed By: campbellbarton, brecht, mont29

Differential Revision: https://developer.blender.org/D5799
2021-08-21 21:38:57 +02:00
34a05f39be Clang: warn about C++20 designated initializers
With the ongoing transition to C++ files, Windows build
breaks often because of designated initializers.
Now we have two compilers to catch the MSVC build error on.

Reviewed By: #platform_macos, brecht, campbellbarton
Differential Revision: https://developer.blender.org/D11940
2021-08-21 14:02:50 +05:30
0b7947e855 Cleanup: minor changes to blf_font.c
- Use early return when kerning isn't used.
- Remove early return that prevented matching acquire/release calls.
2021-08-21 17:46:50 +10:00
47e68537f8 Cleanup: organize blf_font.c functions using doxy-sections
Functions in this file were scattered and not well organized.
2021-08-21 17:41:40 +10:00
c671bfe14e Cleanup: spelling in comments & minor cleanup
Also hyphenate 'mouse-move' use doxy sections in render_update.c &
move function comment from the header to the source.
2021-08-21 13:26:54 +10:00
aed5a27755 Correct build error from 0d7aab2375 2021-08-21 13:22:47 +10:00
0d7aab2375 Refactor: BLF Kerning Cache After Use
Optimization of font kerning by only caching kerning values after a
pair is encountered. Also saves unscaled values so they don't have to
be rebuilt between font size changes.

See D12274 for more details and speed comparison.

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

Reviewed by Campbell Barton
2021-08-20 17:48:42 -07:00
b6a1bf757d DocPy: Cleanup missing newline resulting in wrong html generation 2021-08-20 14:54:46 -04:00
86622467c5 DocPy: Update Dependancies
Updates sphinx and the theme to the latest version along with any of their dependencies.

Note that we will be sticking to sphinx 4.1.1 until sphinx 4.2 for the same reasons listed in:
https://developer.blender.org/rBM8334
2021-08-20 13:46:38 -04:00
Alaska
cd8d9383e7 Fix T90804: small grammatical error in noise threshold description
Differential Revision: https://developer.blender.org/D12277
2021-08-20 17:43:24 +02:00
1b5f17b867 Cleanup, use BKE_scene_uses_cycles_experimental_features 2021-08-20 15:00:58 +02:00
6a404bc633 Cleanup, remove extra code from previous commit
This got accidentally introduced while revising dependencies between
patches for this feature, did not notice until it was too late.
2021-08-20 14:48:47 +02:00
9bfc47c933 Alembic Procedural: basic cache control settings
This adds a setting to enable data caching, and another one to set the
maximum cache size in megabytes.

When caching is enabled we load the data for the entire animation in
memory, as we already do, however, if the data exceeds the memory limit,
render is aborted.

When caching is disabled, we simply load the data for the current frame
in memory.

Ref D10197

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11163
2021-08-20 14:34:43 +02:00
accf3045be Fix memory leak while processing mouse event
Assignment missed.
2021-08-20 09:06:19 -03:00
ef502127dd Fix T90795: Moving keys in Grease Pencil Dopesheet crashes Blender
`td->loc` is referenced but not initialized.
2021-08-20 08:40:37 -03:00
0081200812 Functions: remove multi-function network
The multi-function network system was able to compose multiple
multi-functions into a new one and to evaluate that efficiently.
This functionality was heavily used by the particle nodes prototype
a year ago. However, since then we only used multi-functions
without the need to compose them in geometry nodes.

The upcoming "fields" in geometry nodes will need a way to
compose multi-functions again. Unfortunately, the code removed
in this commit was not ideal for this different kind of function
composition. I've been working on an alternative that will be added
separately when it becomes needed.

I've had to update all the function nodes, because their interface
depended on the multi-function network data structure a bit.
The actual multi-function implementations are still the same though.
2021-08-20 13:14:39 +02:00
7d8c71e800 Geometry Nodes: add missing versioning for subdivision surface node
This was missing from rBfecec1644ce54ea386eaeed5ca6748d4a7b2737b.
2021-08-20 12:19:24 +02:00
c1227fd408 Cleanup: remove duplicate line 2021-08-20 12:05:03 +02:00
d217b34214 Functions: add utility methods to parameter builder 2021-08-20 11:48:31 +02:00
fd51b05a02 Functions: add clear method to vector array 2021-08-20 11:48:31 +02:00
2b6f0cc836 BLI: add utility methods to IndexMask 2021-08-20 11:48:31 +02:00
e95b197e98 Cleanup: Add CLOG to wm_files_link.c 2021-08-20 11:27:42 +02:00
cea24b4b4a Cleanup: use "free_data" suffix when the argument isn't freed
Avoid API misuse that caused leaks in T90791 &
2788b0261c.
2021-08-20 16:37:50 +10:00
e05db0c26b Cleanup: rename BKE_mesh_free_data -> BKE_mesh_free_data_for_undo
This function only makes sense for undo which doesn't
initialize the meshes ID. Otherwise BKE_id_free should be used.
2021-08-20 16:21:29 +10:00
40f0783d51 Cleanup: remove BKE_mesh_free_data use for lineart mesh copies
Even though this didn't leak memory, BKE_mesh_free_data doesn't
handle freeing data that is part of the ID making it error prone.
2021-08-20 16:08:35 +10:00
15a46a8b72 Cleanup: accidentally included printf 2021-08-20 16:02:39 +10:00
9e2cd6b077 Fix memory leak with building springs in the cloth simulator
Error in 2788b0261c.
2021-08-20 16:00:12 +10:00
a48df97ada Fix T90791: Knife project leaks memory with curve/text cutter 2021-08-20 15:19:58 +10:00
ce3a6d7989 Cleanup: rename BKE_mesh_free -> BKE_mesh_free_data
It wasn't obvious this didn't free the memory of the mesh it's self
leading to memory leaks.
2021-08-20 15:08:27 +10:00
44b25b0ea5 Cleanup: unused warnings 2021-08-20 15:03:32 +10:00
fca6b2780f Cleanup: clang-format 2021-08-19 19:27:49 -07:00
f8637cd8af Alembic Procedural: only subdivide if subsurf modifier is present
As subdivision objects are first class citizens in Alembic, to
differentiate them with non-subdivided polygon meshes, the Alembic
Procedural automatically sets up subdivision properties on the generated
Cycles Mesh.

However, for real-time playback subdivision is far too slow, so this
modifies the detection of a MeshSeqCache modifier used to activate the
procedural to allow for a Subsurf modifier right after the cache one. If
present, the procedural will tag the object for subdivision, if absent, the
object will be treated as a regular mesh.

This is a temporary measure for until subdivision surface settings are part
of the Mesh datablock (see T68891).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11162
2021-08-20 02:40:37 +02:00
5b51df0f33 Cleanup, format 2021-08-20 02:30:11 +02:00
962153dbed Cycles: missing case for ignoring subdivision vertex normals
This was missing from rBb8ecdbcd964a.
2021-08-19 20:36:34 +02:00
c0dd6f1164 Fix T90776: Cycles normal map node produces artifacts
This is caused by a typo in rBb8ecdbcd964a `sd->prim` is the primitive
index, but was used to discriminate the primitive type (stored in `sd-
>type`).
2021-08-19 20:36:34 +02:00
72f73c0b71 UI: Use theme's alpha for Summary instead of a hardcoded value 2021-08-19 20:24:46 +02:00
dbc4f6fdc9 Fix error rendering Cycles shader nodes from before 2013
After the recent changes to use socket identifiers instead of names.
2021-08-19 20:12:50 +02:00
871f7f4ad8 GPencil: Cleanup old printf debug lines
These lines were very old debug code and now it's not required because the code is very tested.
2021-08-19 19:23:13 +02:00
3febcb98ed Image blendwrite: Fix handling of packedfiles.
Packedfiles need some special attention when writing Image to disk.

Source: D12242, Jeroen Bakker (@jbakker), thanks.
2021-08-19 18:00:00 +02:00
0896457c59 Partially fix T90593: Image ID wrongly seen as changed on undos.
Several pure runtime data in this ID type were not properly cleared by
write/read processes.

Note that the initial undo step (the one leading back to initial read
file state) is still forcing re-load of image, for some reasons.

Common investigation together with Jeroen Bakker (@jbakker), thanks. See
also D12242.
2021-08-19 18:00:00 +02:00
214e4aac97 Fix Python error in ./benchmark init after recent changes 2021-08-19 17:45:37 +02:00
479cc9a83e UI: Match row color for Summary in Mask animation editor
The back color of the row was missing.
2021-08-19 17:06:49 +02:00
71655ff8df GPencil: Match row color for Summary in Grease Pencil animation editor
The background of the summary row was different in Grease Pencil mode.

Reviewed by: Pablo Vazquez, Matias Mendiola
2021-08-19 17:06:41 +02:00
7192e57d63 Fix the value in the graphical editor header when transforming
The header did not display the actual value when transforming with snapping
2021-08-19 10:34:13 -03:00
b0d9e6797f Fix T87173: wrong Auto-Snap in animation editors
This was partially broken with {rBde9ea94fc6f}.

The `Frame Step` and `Second Step` snapping options were working as if
they were `Nearest Frame` and `Nearest Second` respectively in the
`Dope Sheet` and `NLA` editors.

In the `Graph Editor` the problem was more serious:
"Second Step: ... The keyframe itself moves along as though in snapping
were active at all, while its handles 'stay behind' until it reaches
the next second boundary, at which point the teleport handles to
'catch up'".

The snapping code for these modes was spread across the transform
mode code and `recalcData` of each data type. Therefore, create a
unified snapping code for these options so that all issues are fixed in
one place.

Differetial Revision: https://developer.blender.org/D12241
2021-08-19 10:34:13 -03:00
119d53263f Transform Convert Action: conventionalize TransData creation
`td2d->loc`, `td2d->loc2d`, `td->loc` and `td->iloc` were not being
initialized as is done with the other conversion types.

This avoids problems with transform modes becoming incompatible.

This avoids problems with incompatible transform modes that could
result in a crash.
2021-08-19 10:34:13 -03:00
Germano Cavalcante
85b044b3ef Fix incremental snap in animation editors
Animation editors have their own snap types and incremental is not
supported.
2021-08-19 10:34:13 -03:00
46aafbbf66 Cleanup: move animation snap utilities to a separate compilation unit
The snap functions of animation editors were scattered in
`transform_mode` and `transform_snap`.
2021-08-19 10:34:13 -03:00
e648e38887 Undo: Clear more ID runtime data on filewrite.
This should help reducing false 'changed' status detection when reading
back a memfile undo step.

Related to T90593 & D12242.
2021-08-19 15:09:33 +02:00
0f49e4832c Cleanup: Blendwrite: Move code deciding if an ID should be written out of ID callbacks.
This was not really useful, and added estra useless steps in case and ID
should not actually be written.

Further more, it prevented clearing the usercount on write, which can be
cause a false positive 'chanhged' detection in undo/redo case.
2021-08-19 15:09:33 +02:00
d5776f4829 LibOverride: Tag all embedded IDs RNA opinters as overridablei, part II.
Not sure how I failed to include those files in rBe5f8db92b696...
2021-08-19 15:09:33 +02:00
51862c8445 Cycles: experimental integration of Alembic procedural in viewport rendering
This patch exposes the Cycles Alembic Procedural through the MeshSequenceCache
modifier in order to use and test it from Blender.

To enable it, one has to switch the render feature set to experimental and
activate the Procedural in the modifier. An Alembic Procedural is then
created for each CacheFile from Blender set to use the Procedural, and each
Blender object having a MeshSequenceCache modifier is added to list of objects
of the right procedural.

The procedural's parameters derive from the CacheFile's properties which are
already exposed in the UI through the modifier, although more Cycles specific
options might be added in the future.

As there is currently no cache controls and since we load all the data at the
beginning of the render session, the procedural is only available during
viewport renders at the moment. When an Alembic procedural is rendered, data
from the archive are not read on the Blender side.

If a Cycles render is not active and the CacheFile is set to use the Cycles Procedural,
bounding boxes are used to display the objects in the scene as a signal that the
objects are not processed by Blender anymore. This is standard in other DCCs.
However this does not reduce the memory usage from Blender as the Alembic data
was already loaded either during an import or during a .blend file read.

This is mostly a hack to test the Cycles Alembic procedural until we have a
better Blender side mechanism for letting renderers load their own geometry,
which will be based on import and export settings on Collections (T68933).

Ref T79174, D3089

Reviewed By: brecht, sybren

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D10197
2021-08-19 14:40:51 +02:00
5b97c00e9f Alembic import: option to always add a cache reader
The current behavior of the Alembic importer is to only create a
`MeshSequenceCache` modifier or a `Transform Cache` constraint to imported
objects if they have some animated properties.

Since static objects do not have a cache reader, when reloading files those
objects are not updated. Currently, the only way to properly reload a file
because of this is to reimport it.

This adds an option to the importer to always add a cache reader, even if
there is no animated data, to ensure that all objects coming from Alembic
archive are linked to them and updated properly upon reloads.

Reviewed by: brecht, sybren

Ref D10197.
2021-08-19 14:29:42 +02:00
4db4123409 Correct assert from 22ab0159a9 2021-08-19 17:56:25 +10:00
cf72194214 Fix T71137: curve minimum twist producing wrong geometry
Originally D11886 by @ghaspias with minor edits applied.
2021-08-19 17:10:34 +10:00
22ab0159a9 Refactor: BLF Without Kerning Modes
Simplification of BLF code after removal of kerning modes.

See D12262 for more details.

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

Reviewed by Campbell Barton
2021-08-18 20:31:47 -07:00
4734de1093 Cleanup: correction to unused warning removal
This broke building without opensubdiv
2021-08-19 13:18:51 +10:00
594790d8a5 UI: add function to access the buttons text without it's shortcut 2021-08-19 12:50:50 +10:00
7a4ef5256a Cleanup: reduce indentation in loops that check region visibility 2021-08-19 12:50:50 +10:00
feaa61a968 UI: Remove "Unfitted" Kerning Style Option
This patch removes the "Kerning Style" option for UI widget font
drawing and uses only the current default of "Fitted", since the other
option of "Unfitted" is just the result of truncation errors.

see D12231 for much more information.

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

Reviewed by Campbell Barton
2021-08-18 19:48:30 -07:00
ac09411368 Cleanup: unused warning 2021-08-19 12:15:15 +10:00
a217e043be Audaspace: porting PulseAudio fixes from upstream. 2021-08-18 22:22:21 +02:00
55f9014616 Alembic procedural: remove Generated attribute creation
The main reason for this is to speed up updates by avoid unnecessary
copies as the Generated coordinates are a copy of the vertices.

Creating this attribute may become optional in the future, with UI
parameters to select which attribute to use from the Alembic archive as
reference.
2021-08-18 21:27:52 +02:00
6b041ad3d0 Cycles: use object coordinates when generated coordinates are missing
This modifies the attribute lookup to use object coordinates if no
generated coordinates are found on the geometry.

This is useful to avoid creating and copying this attribute, thus saving
a bit of time and memory.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12238
2021-08-18 21:20:39 +02:00
b8ecdbcd96 Cycles: avoid copying vertex normals attribute twice to the devices
Vertex normals are needed for normals maps and therefore are packed and send
to the device alongside the other float3 attributes. However, we already pack
and send vertex normals through `DeviceScene.tri_vnormal`.

This removes the packing of vertex normals from the attributes buffer, and
reuses `tri_vnormal` in the kernel for normals lookup for normal maps, which
reduces memory usage a bit, and speeds up device updates.

This also fixes potential missing normals updates following rB12a06292af86,
since the need for vertex normals for normals maps was overlooked.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12237
2021-08-18 21:12:39 +02:00
e5f8db92b6 LibOverride: Tag all embedded IDs RNA opinters as overridable.
Followup to previous commit, rBfffe219bdb8drBfffe219bdb8d

Again this is only for sake of sane ID/overrides managment for now,
the nodetrees themselves are not overridable from user PoV yet.
2021-08-18 17:05:49 +02:00
fffe219bdb LibOverride: Make nodetree of material overrideable again.
This reverts rB6899dbef77cd and makes the pointer explicitely
processable by override & diffing code.

Previous changes & fixes have fixed the 'driver-workaround' case afaict.

Note that this only enables proper generic handling of overrides and
their ID pointers, no node property is actually overridable currently.
2021-08-18 16:49:20 +02:00
1d06d35034 LibOverride: Do not report embedded IDs as non-overridable in 'foreach_id' code.
Embedded IDs (root nodetrees, master collection, etc.) pointer itself is
not editable, but their content may be overridden.

LibOverride code is supposed to know how to handle those embedded IDs.
2021-08-18 16:49:20 +02:00
ba71eb467e LibOverride: Add several missing 'OVERRIDABLE' flags to NodeTrees RNA.
This should be a no-change commit for now, but is required to enable
initial basic support of nodetrees in library override.

NOTE: Proper full support of liboverrides in nodes is yet to be designed
(has UX unresolved issues, since we likely do not want to expose/make
overridable ALL settings of ALL nodes).
2021-08-18 16:49:20 +02:00
9bfd4ae222 LibOverride: tweak resync detection code at apply phase.
This code checks whether an ID pointer property of an override does not
match its linked reference when it is expected to do so.

This is a goiod indication that a resync is needed.

Previous code would falsy detect overrides of IDs referencing themselves
as needing a resync, when this is not effectively the case.
2021-08-18 16:49:20 +02:00
Charlie Jolly
04376c3bac Geometry Nodes: Add shader Color Mix node
Port color mix shader node to Geometry Nodes.

Differential Revision: https://developer.blender.org/D10585
2021-08-18 14:50:52 +01:00
787350dde8 Fix T90737: VSE adding nested strips could have non-unique names
Caused by {rBbbb1936411a5}.

When adding strips via the new SEQ_add_XXX_strip functions, the
`Editing->seqbasep` pointer was passed around.
Following in `seq_add_generic_update` this `seqbasep` pointer was used
to ensure a unique name.
But `seqbasep` is the pointer to the current list of seq's being edited
(**which can be limited to the ones within a meta strip**).

We need unique names across all strips though (since these are used for
RNA paths, FCurves as reported), so now use the scene's `Editing-
>seqbase` (**which is the list of the top-most sequences**) instead.

Unfortunately this might have screwed files to a borked state, not sure
if this could easily be fixed...

Maniphest Tasks: T90737

Differential Revision: https://developer.blender.org/D12256
2021-08-18 14:43:16 +02:00
7bffafab7b Fix T90718: Object selection toggle do not work inside edit mode
The object was not deselected as it was expected that it would be
activated.

But this activation does not happen in edit mode.
2021-08-18 09:39:45 -03:00
Jeroen Bakker
c0f600cad1 T73434: Improve Weight Paint Overlay Drawing.
Master multiplied the weight paint on top of the rendered image. This
reduced readability.

This patch removes the multiplication for weight painting and adds a
hint of the geometry below the overlay.

Reviewed By: Mets, pablodp606, campbellbarton

Maniphest Tasks: T73434

Differential Revision: https://developer.blender.org/D12170
2021-08-18 07:32:23 +02:00
400cb25fc7 UDIM: Support tile sets that do not start at 1001
Removes the artificial requirement that UDIM tile sets start at 1001.
Blender was already capable of handling sparse tile sets (non-contiguous
tiles) so the restriction around starting at 1001 was unnecessary in
general.

This required fixing a few UDIM-related python bugs around manually
updating the `tile_number` field on images as well. See the differential
for details. No script changes are necessary but they will now work,
correctly, in many more cases.

Differential Revision: https://developer.blender.org/D11859
2021-08-17 21:44:36 -07:00
f41beca977 Fix T90695: Lower tile splitting limit for lineart
Lowers tile splitting limit so models with extremely dense mesh
portions could still have reasonable performance while for more
common cases the performance impact should be minimal.

Reviewed By: Sebastian Parborg (zeddb), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12236
2021-08-18 12:02:53 +08:00
24c16f5457 Fix wireframe overlay not blending over paint overlay correctly
When using wireframe opacity, the paint overlay needs to be drawn
before the wireframes in order to alpha blend correctly.
Sculpt overlays were also affected by this, so this commit refactors
this part of the code in case other overlays needs to be added in
the future.

Reviewed By: Mets

Differential Revision: https://developer.blender.org/D12235
2021-08-17 23:54:45 +02:00
809dce5bde Cleanup: move 'recalcData' to 'transform_convert.h'
The `recalcData` function is defined in `transform_convert.c`, so the
header is most expected to be `transform_convert.h`.
2021-08-17 17:23:57 -03:00
Henrik Dick
e3098de2a1 GPencil: Fix unreported switch direction not flipping weights
There was an unreported bug that switch direction would not switch the order of the vertex group weights. This caused join to do it wrong as well.

Changed to use `BLI_array_reverse` function here to reverse both the normal points and the weights, therefore simplifying the code.

Differential Revision: https://developer.blender.org/D12251
2021-08-17 22:20:26 +02:00
23132fcdc1 Fix T77307: Particle Info Node Does Not Consider Time Remapping
`frame_current_final()` should be used to access the Scene time after
remapping, which also matches how the particles system handles time.

Reviewed By: brecht

Maniphest Tasks: T77307

Differential Revision: https://developer.blender.org/D12239
2021-08-17 21:41:18 +02:00
60d6333b80 Fix T82336: Cycles standard attributes missing in displacement shaders
Standard attributes are not added to the attributes requests when
shaders only have displacement. This is because nodes are only
considering the case when the surface socket is connected.

To support this, added `Shader.has_surface_link()` which checks for both
cases (`has_surface` and `has_displacement`) and replaces all checks on
`Shader.has_surface`.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12240
2021-08-17 21:38:04 +02:00
Henrik Dick
88dc274d05 GPencil: Convert from Mesh copying Vertex Groups
This patch adds the missing ability to keep the vertex groups when converting to a grease pencil object. This is increadible useful to create rigged grease pencil objects which move together with rigged meshes.

Differential Revision: https://developer.blender.org/D12249
2021-08-17 20:20:47 +02:00
96d0cd57dc Fix T90719: Boost sources dowload address needed to be updated. 2021-08-17 18:01:42 +02:00
e98824d6c4 CMake: add missing headers 2021-08-18 00:37:04 +10:00
7f38872533 RNA: de-duplicate enums in generated source
Reuse existing enums instead of expanding them since it bloats the binary.

The icons enum for example contains over 900 items and was being
expanded 17 times (once for each function that takes an icon argument).
Similar with the event type enum which contains over 200 items and was
duplicated 7 times.

makesrna.c now matches enum definitions from declarations in
RNA_enum_items.h, using their identifiers when found.

The overall space saving on my system is 776kb
(tested with a stripped release build).

Reviewed By: brecht

Ref D12245
2021-08-18 00:23:50 +10:00
0246128b7f Fix wrong Anim Auto-Snap Ctrl toggle
This was not working like elsewhere in both NLA and Graph Editor
(meaning that when snapping was already enabled, {key Ctrl} during
transform did not disable it).

Now use getAnimEdit_SnapMode() for this in NLA and GE as well.

Maniphest Tasks: T87173

Differential Revision: https://developer.blender.org/D12244
2021-08-17 15:52:28 +02:00
f8dd0080a9 Cleanup: clang tidy
The parameter name was inconsistent between declaratation
and implementation.
2021-08-17 11:12:59 +02:00
6028ac44a1 Cleanup: unused defines 2021-08-17 17:45:57 +10:00
7304541f66 Edit Mesh: skip unselected meshes for "Tris to Quads"
Also move property assignment out of the object loop.
2021-08-17 17:12:36 +10:00
32844d32c1 Edit Mesh: skip unselected meshes for "Set Normals from Faces" 2021-08-17 17:12:24 +10:00
4443831c6b Edit Mesh: skip normals to vector with unselected meshes for "Delete"
Meshes with unselected elements are skipped but still called
BM_custom_loop_normals_to_vector_layer.
2021-08-17 17:11:49 +10:00
6baa62245f Edit Mesh: skip flipping custom normals for meshes with no selection
Also split out normal calculation into functions.
2021-08-17 17:10:59 +10:00
cb40c7ca1f Fix memory leak in edit-mesh dissolve degenerate 2021-08-17 16:46:52 +10:00
4c8d68c032 Cleanup: replace degenerate check with assert
Use an assert since this should never happen.
2021-08-17 15:16:34 +10:00
736b6a70a4 Docs: improve word wrap comment 2021-08-17 15:11:54 +10:00
nutti
69fdcea978 Docs: add API docs for gpu.capabilities
Adds Python API documentations for gpu.capabilities module.

Ref D12226
2021-08-17 15:04:35 +10:00
ba055493a0 Cleanup: clang-format 2021-08-17 14:46:46 +10:00
nutti
d60e28093f Docs: add API docs for gpu.platform
Adds Python API documentations for gpu.platform module.

Ref D12222
2021-08-17 14:45:40 +10:00
869b84452a Cleanup: compiler warnings 2021-08-17 14:42:12 +10:00
eaa1527385 UDIM: Fix tile number calculation when adding a range of image tiles
When adding a range of tiles, the operator could incorrectly calculate
the end_tile. It would not account for the start_tile itself and the
IMA_UDIM_MAX value was 1 too small. This is most noticeable when
attempting to fill the entire supported range of tiles.

Differential Revision: https://developer.blender.org/D11857
2021-08-16 21:19:39 -07:00
4dba206011 PyAPI: GPUShader: make 'uniform_vector_*' less restricted
Buffers larger than required may be allowed without restriction.
2021-08-16 13:57:25 -03:00
b5117660da PyAPI: GPU Buffer: Buffer protocol support
The code was commented due to lack of testing and short release deadline.
2021-08-16 13:57:25 -03:00
035d4c28ab Add sanity NULL checks when loading sound sequences
Would cause crashes in files that had lingering invalid sound sequences around.
For example our tests/render/volume/fire.blend test file.
2021-08-16 16:52:38 +02:00
df3884d512 Fix T90689, T90705: Cycles math node with 3 inputs broken after recent changes
Thanks Charlie Jolly for finding the fix.
2021-08-16 15:54:18 +02:00
7db3746033 Cleanup: spelling 2021-08-16 23:46:28 +10:00
394a0b0da5 Fix building without audaspace 2021-08-16 23:19:54 +10:00
118946d195 Fix T87967: M2T video seeking is broken
Bug caused by integer overflow in ffmpeg_generic_seek_workaround().
Function max_ii() was used to limit int_64tvalue.

After fixing the issue there was another issue, where near-infinite loop
was caused by requested_pos being very large and stream being cut in a
way, that it was missing keyframe at beginning.
This was fixed by checking if we are reading beyond file content.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D11888
2021-08-16 15:12:19 +02:00
2946f72a2a VSE: Use lines to draw waveform
Refactor and improve waveform drawing.

Drawing now can use line strips to draw waveforms instead of only
triangle strips. This makes us able to properly visualize thin waveforms
as they would not be visible before. We now also draw the RMS value of
the waveform.

The waveform drawing is now also properly aligned to the screen pixels
to avoid flickering when transforming the strip.

Reviewed By: Richard Antalik

Differential Revision: https://developer.blender.org/D11184
2021-08-16 15:12:19 +02:00
ded68fb102 VSE: Fix audaspace not reading ffmpeg files with start offset correctly
The duration and start time for audio strips were not correctly read in
audaspace.

Some video files have a "lead in" section of audio that plays before the
video starts playing back. Before this patch, we would play this lead in
audio at the same time as the video started and thus the audio would not
be in sync anymore.

Now the lead in audio is cut off and the duration should be correctly
calculated with this in mind.

If the audio starts after the video, the audio strip is shifted to
account for this, but it will also lead to cut off audio which might not
be wanted. However we don't have a simple way to solve this at this
point.

Differential Revision: http://developer.blender.org/D11917
2021-08-16 15:10:58 +02:00
6df81ddb84 VSE: Fix seeking issues.
The seek pts was not correctly calculated.
In addition to that we were not seeking in the video pts time base.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11921
2021-08-16 14:52:57 +02:00
a01cf90fd8 VSE: Fix video strip duration calculation
The video duration was not read correctly from the video file.

It would use the global duration of the file which does in some cases
not line up with the actual duration of the video stream.
Now we take the video stream duration and start time into account when
calculating the strip duration.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11920
2021-08-16 14:52:57 +02:00
43ad345caa VSE: Fix memory leak when adding bad image/movie strips
If the add strip operator errored out, we wouldn't free custom data allocated

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11919
2021-08-16 14:52:57 +02:00
e314260fa7 VSE: Fix "off by one" error when encoding audio
Before we didn't encode the audio up until the current frame.
This lead to us not encoding the last video frame of audio.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11918
2021-08-16 14:52:57 +02:00
08af3e6e92 VSE: Flush audio encode after finishing video export
We didn't flush audio after encoding finished which lead to audio
packets being lost.

In addition to this the audio timestamps were wrong because we
incremented the current audio time before using it.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11916
2021-08-16 14:52:56 +02:00
Eitan
fecec1644c Geometry Nodes: Add UV Smooth, Boundary Smooth options to subdivision node
Replaces the boolean option with enum menus for consistency
with the subdivision modifier (rB66151b5de3ff,rB3d3b6d94e6e).
Adds all UV interpolation options.
Original patch by Eitan. Updated by Himanshi Kalra <calra>.
{F9883204}

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D10417
2021-08-16 14:31:50 +05:30
ddecd7aaca Cleanup: shadow variable warning 2021-08-16 18:06:10 +10:00
Himanshi Kalra
c48a01a88a Add cutom data color property for mesh comparison
Add color data type comparison for meshes, adding it as
part of comparing meshes with geometry nodes applied.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12192
2021-08-16 12:28:12 +05:30
c0016a8581 BLF: avoid unnecessary lookups in blf_kerning_cache_new
blf_kerning_cache_new was performing many unnecessary hash lookups,
calling blf_glyph_search 32768 times. Use a lookup table to reduce this
to the number of ASCII characters (128 calls).
2021-08-16 14:35:38 +10:00
4300050e20 Cleanup: rename kerning table to ascii_table
It wasn't obvious this was only for ASCII characters.
2021-08-16 14:35:38 +10:00
87adcbc94f BLF: use fast ASCII kerning for word-wrap calculations
While this wasn't a bottleneck, using the fast version of this function
removes some duplicate code that doesn't use the look-up table.
2021-08-16 14:35:38 +10:00
6aebbe6a0a Cleanup: replace macros with inline functions for font drawing
Also assert blf_font_ensure_ascii_kerning has been called in
blf_kerning_step_fast.
2021-08-16 14:35:38 +10:00
eb278f5e12 XR: Color Depth Adjustments
This addresses reduced visibility of scenes (as displayed in the VR
headset) that can result from the 8-bit color depth format currently
used for XR swapchain images.

By switching to a swapchain format with higher color depth (RGB10_A2,
RGBA16, RGBA16F) for supported runtimes, visibility in VR should be
noticeably improved.

However, current limitations are lack of support for these higher
color depth formats by some XR runtimes, especially for OpenGL.

Also important to note that GPU_offscreen_create() now explicitly
takes in the texture format (eGPUTextureFormat) instead of a
"high_bitdepth" boolean.

Reviewed By: Julian Eisel, Clément Foucault

Differential Revision: http://developer.blender.org/D9842
2021-08-16 11:46:09 +09:00
899935d5d0 Fix wrong usage of 'sizeof'
The intention was to use `ARRAY_SIZE`.

No functional changes.
2021-08-15 20:08:17 -03:00
3f0d785d23 Fix T90658: selection of some 3D gizmos failing
Small error due to wrong variable usage.

Introduced in rBfcd2d63b644e.
2021-08-15 17:55:09 -03:00
d5261e973b BLF: Do Not Preload Glyph Cache
This patch turns off the preloading of ascii glyphs and instead caches
each glyph the first time it is actually used.

See D12215 for much more detail.

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

Reviewed by Campbell Barton
2021-08-14 13:50:51 -07:00
8f2b60ddbf Cleanup: Variable names, formatting, reduce indentation 2021-08-13 21:46:59 -05:00
6a4533dd02 BLF Cleanup: Size Defines, Comments, etc
This patch makes some non-functional changes to BLF code. Some size
defines added, comments changed, simplification of macro
BLF_KERNING_VARS.

See D12200 for more details.

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

Reviewed by Campbell Barton
2021-08-13 14:31:10 -07:00
ae3472998a Cleanup: rearrange includes
Bring the includes from the same project together.
2021-08-13 17:36:35 -03:00
Germano Cavalcante
0ed2df81cc Fix T90637: Outliner: VSE context menu options are not working
Some of the enum options in the context menu operations are not
supported for all element types.

`TSE_SEQUENCE`, for example, only supports the `Select` option.

So, populate the enum list dynamically depending on the type.

Also add some calls that were missing for the `TSE_SEQUENCE` type.
(`WM_event_add_notifier` and `ED_undo_push`).
2021-08-13 17:28:46 -03:00
5655b3d1c5 Cleanup: fix typos in static variables
_desps --> _deps
2021-08-13 15:45:07 -03:00
5225e459da Fix T86883: Add/fix suport of liboverrides in relocate/reload library case.
There was already some code for that, but it was broken, and proper
resync was completely missing.

There might still be more resync needed in library linking operators
though.
2021-08-13 16:37:29 +02:00
bb0e29c922 Blendloader: Option to reports to skip list of recursively liboverride-resynced libs.
This extra info is not always needed/convinient to use, and requires
special attention to free the list, so allow not generating it.
2021-08-13 16:37:29 +02:00
7772880d69 ViewLayer resync: Add sanity checks for objects/bases mappings.
Add a debug-only check regarding consistency of the cache (mapping from
objects to their bases) for a given ViewLayer.

Issues can happen otherwise when some code does remapping of objects,
and forgets to call `BKE_main_collection_sync_remap()` (which clears
those caches) instead of `BKE_main_collection_sync()`.
2021-08-13 16:37:29 +02:00
77744b581d Fix T90595: some VSE strip properties do not identify strip name in anim
channel names

Working with multiple strips keyframes was unneccessarily difficult in
Animation Editors (since some anim channels could not be distinguished).

Namely `Crop` and `Transform` are nested structs (nested under
`Sequence`), so these were just displaying the raw struct name.
Also strip modifiers did not have their strip name in their channel
names. Now include the strip name for these.

before
{F10277439}

after
{F10277441}

Maniphest Tasks: T90595

Differential Revision: https://developer.blender.org/D12193
2021-08-13 15:17:00 +02:00
Matteo F. Vescovi
0b3c7544b5 Fix FTBFS on mips64el architecture
While trying to get Blender 2.93.x LTS to build fine on all release architectures in Debian, I noticed that the misleading use of "mips" as integer variable caused problems when compiling on mips64el. The patch should fix the issue.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D12194
2021-08-13 14:33:50 +02:00
4cadccebfa Revert "Mesh: replace saacos with acosf for normal calculation"
This reverts commit 41e6509818.

This broke "CubeMaskFirst" test.

Any value even slightly outside the [-1.0..1.0] range
caused the result to be nan, which can happen when calculating
the dot-product between two unit length vectors.
2021-08-13 19:45:01 +10:00
b9486c39bc Cleanup: Unused function parameter warning 2021-08-13 11:16:01 +02:00
fd29a161cc Fix Action Editor unlink button when in tweak mode
When in NLA tweak mode, the action unlink button in the Dopesheet /
Action Editor should be a mere shortcut to exiting tweak mode [nothing
else].

Instead, it was also clearing the action fully, not returning to the
previous edited action before going into tweak mode.

Now dont "flush" by clearing the action, instead exit tweakmode, clear
the scenes SCE_NLA_EDIT_ON flag (if this isnt done some NLA operators
like pushdown were not immediately available because their poll checked
this flag) and send appropriate notifier to have everything update nicely.

Part of T87681 (Bug 4/5/6).

Maniphest Tasks: T87681

Differential Revision: https://developer.blender.org/D11052
2021-08-13 11:07:27 +02:00
00f264ea42 Cleanup: correct comment exiting NLA tweakmode
Comment was pasted from entering tweakmode.
2021-08-13 10:52:53 +02:00
0ae23636e7 Fix missing animation UI update in the Properties Editor
Animation indicators as well as decorators for properties were not
updating correctly in the following cases:
- NLA pushdown (this was reported in T87681)
- NLA enter/exit tweakmode
- Outliner unlinking/setting action

These actions all send a ND_NLA_ACTCHANGE notifier which the Properties
Editor was not listening to [which is now added].

part of T87681.

Maniphest Tasks: T87681

Differential Revision: https://developer.blender.org/D11040
2021-08-13 10:09:12 +02:00
5f6033e091 Keyframe: Reduce GPU context switches.
This change reduces the GPU context switches when drawing keyframes.
In the previous situation the keyframe blocks and keyframe keys were
drawn per channel. With this patch first all the keyframe blocks are
drawn for all channels and after that the keyframe keys are collected
for all channels and send to the GPU in a single draw call.
2021-08-13 09:37:38 +02:00
7b5acc8009 Cleanup: remove unused draw_gpencil_channel.
Code is integrated with draw_scene_channel since 2.80.
2021-08-13 08:34:10 +02:00
160d57d33c Docs: tooltip update missing from 3e775a4fc5 2021-08-13 16:01:45 +10:00
3e775a4fc5 PyAPI: remove the .py extension requirement for startup registration
This was left over from when these scripts were loaded as modules,
where their names needed to be compatible with Pythons module naming.

Version patch existing files so text with register enabled
without a `.py` extension wont start executing on startup.

Resolves T89532.
2021-08-13 15:51:08 +10:00
41e6509818 Mesh: replace saacos with acosf for normal calculation
The clamped version of acos isn't needed as degenerate (nan) coordinates
result in zeroed vectors which don't need clamping.
2021-08-13 15:39:39 +10:00
8fa05efe0a Docs: note that normalize_v# functions zero out input containing nan 2021-08-13 15:15:54 +10:00
92f4abc37f Cleanup: remove unused BKE_mesh_calc_normals_mapping functions
This supported calculating normals for MPoly array which was copied to
an MFace aligned array.

Remove the functions entirely since MFace use is being phased out and
these function isn't used anywhere.
2021-08-13 14:41:42 +10:00
b51a473e29 Cleanup: remove use of BKE_mesh_calc_normals_mapping_simple
Use BKE_mesh_calc_normals instead of
BKE_mesh_calc_normals_mapping_simple for curve modifier calculation.

This only made sense for derived-mesh which is no longer used.
2021-08-13 14:37:30 +10:00
ab344775c2 Cleanup: code-comments
Use capitalization, remove unnecessary ellipsis.
2021-08-13 13:55:25 +10:00
ed38d0c25d Cleanup: split BKE_mesh_calc_normals_poly function in two
Remove the 'only_face_normals' argument.

- BKE_mesh_calc_normals_poly for polygon normals.
- BKE_mesh_calc_normals_poly_and_vertex for poly and vertex normals.

Order arguments logically:

- Pair array and length arguments.
- Position normal array arguments (to be filled) last.
2021-08-13 13:33:03 +10:00
399b6ec76c Mesh: optimize normal calculation
Optimize mesh normal calculation.

- Remove the intermediate `lnors_weighted` array, accumulate directly
  into the normal array using a spin-lock for thread safety.
- Remove single threaded iteration over loops
  (normal calculation is now fully multi-threaded).
- Remove stack array (alloca) for pre-calculating edge-directions.

Summary of Performance Characteristics:

- The largest gains are for single high poly meshes, with isolated
  normal-calculation benchmarks of meshes over ~1.5 million showing
  2x+ speedup, ~25 million polygons are ~2.85x faster.

- Single lower poly meshes (250k polys) can be ~2x slower.

  Since these meshes aren't normally a bottleneck,
  and this problem isn't noticeable on large scenes,
  we considered the performance trade-off reasonable.

- The performance difference reduces with larger scenes,
  tests with production files from "Sprite Fight" showing
  the same or slightly better overall performance.

NOTE: tested on a AMD Ryzen TR 3970X 32-Core.

For more details & benchmarking scripts, see the patch description.

Reviewed By: mont29

Ref D11993
2021-08-13 10:21:30 +10:00
1275ce61b1 Cleanup: Remove unused includes
I noticed this file was recompiling when adding a node.
2021-08-12 14:12:14 -05:00
e0fd5fef12 Geometry Nodes: tag normals dirty after join
Under some circumstances the normals were not tagged dirty
even though they are.
2021-08-12 17:36:53 +02:00
f801d40daf Fix T89241: 3D Text "Scale to Fit" wraps onto the second line
Disable wrapping when "scale to fit" is used, assert the error is
small so an invalid scale-to-fit value wont go by unnoticed.
2021-08-13 01:07:30 +10:00
3930b8c69e Fix NLA action cannot be unlinked in certain cases
The poll for unlinking calls `nla_panel_context` without providing an
adt pointer, and there is a check for this pointer in
`nla_panel_context` leading to never returning true if it is not
provided. (this is fine if there are tracks already, poll would succeed
in this case, `nla_panel_context` goes a different code path then)

Same call to `nla_panel_context` is also done in the beginning of the
corresponding unlink exec function (but this time providing the pointer
because it is used later), so it makes sense to do the same thing in the
poll function. Equal check is also done in the panel poll function, so
now these are all in sync.

Part of T87681.

Maniphest Tasks: T87681

Differential Revision: https://developer.blender.org/D11041
2021-08-12 16:46:28 +02:00
333c3c92ab Fix T89805: NLA crash without active track
Was reported for a file which does not have an active track set in
AnimData even though it was in strip twek mode (but this was accessed in
is_nlatrack_evaluatable()).

Root cause for this is not totally clear, but I assume the situation is
described as part T87681 (and is fixed in D11052).

This patch here just prevents the crash for files that are already in the
borked state.

Reviewers: sybren

Maniphest Tasks: T89805

Differential Revision: https://developer.blender.org/D12085
2021-08-12 16:41:49 +02:00
dc8844f8ef Fix T88498: 'Clear Parent' does not clear parent_bone
Clearing the parent from the UI using the X (or from python) clears the
`parsubstr` and set `partype` back to `PAROBJECT`.

Using the Clear Parent operator would leave the `parsubstr` (and thus
`parent_bone`) untouched even though this operator claims to "clear
parenting relationship completely" (it also removes parent deform
modifiers for example).

So now, also clear `parsubstr` and set back to `PAROBJECT` [which is
default].

Maniphest Tasks: T88498

Differential Revision: https://developer.blender.org/D11503
2021-08-12 16:33:20 +02:00
Henrik Dick
d6891d9bee Add Extras Dropdown Menu to Constraints
Add Apply Constraint, Duplicate Constraint, and Copy To Selected
operators, and include them in a menu similar to the menu for modifiers.
The shortcuts in the extras menu are also matched to modifiers.

All the here added operators are intended to work exactly like the
analogous ones for modifiers. That means the apply operator should apply
a constraint as if it was first in the list, just like modifiers do. I
have added the same warning message as for modifiers when that happens.

The decision to use this approach of appling the constraint as if it was
first, was made for consistency with modifiers. People are already used
to how it works there. Is also provides more intricate control over the
applied transforms, then just applying all constraints up to that one.
Apply all constraints is already kinda implemented in Bake Animation.

Reviewed By: HooglyBoogly, sybren, #user_interface

Differential Revision: https://developer.blender.org/D10914
2021-08-12 14:24:27 +02:00
215734bc52 Fix T88386: Continuous Grab occasionally jumping on Arm64 MacOS
During the processing of a continuous drag event, other mouse move
events may be in the queue waiting to be processed.

But when a mouse wrapping happens, these waiting mouse move events
become out of date as they report a mouse position prior to wrapping.

The current code ignores these events by comparing their `timestamp` to
the time recorded in the last mouse wrapping.

The bug happens because the computed value in
`mach_absolute_time() * 1e-9` for some reason is incompatible with the
value of `[event timestamp]`.

Since macOS 10.6, we have a new way to get the amount of time the
system has been awake. `[[NSProcessInfo processInfo] systemUptime]`.

Using this updated method fixed the problem.

Differential Revision: https://developer.blender.org/D12202
2021-08-12 08:52:50 -03:00
6293cf6131 Fix T90630: Crash loading certain user preferences
Clearing the window was done in wm_file_read_post which was deferred.

This was needed as it left the context in an invalid state
where the window was set but the screen wasn't.

Crashing when setting up keymaps that attempted to access the
scene from the window in the property update function.

Regression in 497bc4d199
2021-08-12 20:43:16 +10:00
ad2fb92e9c Cleanup: remove redundant variable 2021-08-12 17:42:04 +10:00
04ef718226 RNA: include base types in RNA_struct_type_find_property search
Add RNA_struct_type_find_property_no_base for use in the rare situations
when this isn't desired.

Resolves T90617, where sequence strip sub-types weren't detecting
properties that exist in the base "Sequence" types.
2021-08-12 17:14:15 +10:00
806bf3f452 datadoc: add newlines to generated source files 2021-08-12 16:23:08 +10:00
83603ba26a Cleanup: comments/disabled code
- Remove old comment for editors with weak syntax highlighting.
- Remove disabled code to initialize Blender with a file path.
- Remove file name references to function names since these
  were outdated, modern development environments can look up this info.
2021-08-12 16:15:01 +10:00
497bc4d199 Fix T89046: Startup file with Python drivers crashes on load
Resolve order of initialization error reading startup file,
support postponing running wm_file_read_post until Blender
has been initialized.

Deferring updates allows duplicate initialization
to be removed from WM_init.

Reviewed By: mont29

Ref D12184
2021-08-12 14:59:08 +10:00
216414c65a Cleanup: use parameters struct for wm_homefile_read
Also add wm_homefile_read_ex which is only needed for the first
execution at startup.
2021-08-12 14:38:58 +10:00
c741558509 Cleanup: spelling in comments 2021-08-12 14:34:43 +10:00
1ef275963d Cleanup: use C++ style comments for disabled code 2021-08-12 14:34:41 +10:00
4f61843a7e Cleanup: remove *.orig file from 6a9d7139f7 2021-08-12 14:34:39 +10:00
45d100208e Makesdna: Fix detecting 32 bit padding issues.
Makesdna fails to detect issues in 32 bit code that can
only be resolved by adding a padding pointer.

We never noticed since we ourselves no longer build for
32 bit, but debian's 32 bit builds got bitten by this

A rather extensive explanation on why this is alignment
requirement is there can be found in this comment:

https://developer.blender.org/D9389#233034

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

Reviewed by: sergey, campbellbarton
2021-08-11 19:20:51 -06:00
48c8f9fc9a Fix: DNA struct alignment on 32 bit
Some of the dna structs were not properly
aligned for 32 bit builds causing issues
for some of the 32 platforms Debian builds
for.

Reviewed By: sergey, brecht
Differential Revision: https://developer.blender.org/D9389
2021-08-11 16:57:56 -06:00
cd1bb63159 BLF: Do Not Cache Unused Rendered Glyphs
The loading of a font size or style renders bitmaps of the characters
0-255 and stores them in a cache. But glyphs 128-255 in this cache are
not accessible. What used to be ansi high-bit characters are now multi-
byte UTF-8 sequences.

Therefore this patch reduces the glyph_ascii_table size to 128 and
only caches characters 32-127, the visible portion of ASCII, which
greatly reduces the time to load a font.

See D12189 for more details.

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

Reviewed by Campbell Barton
2021-08-11 13:55:58 -07:00
Jeroen Bakker
bb487bc2bc Fix T89984: Improve Icon previews reflective and transmissive materials.
Before this commit rendering material icons the floor will is hidden.
This reduces the readability of reflective/refractive materials.

check patch for additional screenshots and notes.

This patch will switch the floor material that uses ray visibility tricks to render a floor for reflective rays.

Eevee uses screen space reflections that makes this a different problem. There is nothing else drawn in
the scene in screen space so we need a different trick. Using math we convert a reflective ray to UV space
and generate a world that projects a checker pattern to infinity.

As now the floor is in the world it is being reflected via
a cubemap. As the film is transparent the background (including the floor isn't rendered)

In the future when Eevee supports vulkan raytracing we can re-evaluate and perhaps remove this
approximation.

We tried lightprobes but that wasn't able to do the trick.
Using the compositor would lead to more memory usage (render layers and intermediate buffers) and slower performance.
Solution has been validated with Simon

Reviewed By: sybren, Severin

Differential Revision: https://developer.blender.org/D11988
2021-08-11 16:59:57 +02:00
e53afad241 Cleanup: moved keyframe drawing to a draw list.
In preparation to do threaded drawing preparation. There should not be any
functional changes.
2021-08-11 16:47:12 +02:00
c9a9d5332b PyAPI: GPU: Expose builtin shaders
Expose `3D_POLYLINE_SMOOTH_COLOR` and
`3D_POLYLINE_FLAT_COLOR` builtins.

Requested by addon developers.
2021-08-11 11:39:51 -03:00
Pedro A
e6bbbd965a Cycles: OSL metadata support for UI labels and checkboxes
To improve the presentation of nodes in the node editor. Recognize the
following metadata from the OSL specification:

* [[ string label = "UI Label" ]]
* [[ string widget = "checkBox" ]]
* [[ string widget = "boolean" ]]

Ref T89741

Differential Revision: https://developer.blender.org/D12074
2021-08-11 16:12:27 +02:00
6d24017529 Cleanup: use socket identifier instead of names in Cycles shader export
Will be required when we support setting different names and identifiers
for OSL.

Ref D12074
2021-08-11 16:12:27 +02:00
6a9d7139f7 Cleanup: ID management: remove unused old BKE_libblock_copy_for_localize function. 2021-08-11 14:49:56 +02:00
Michael Kowalski
bbcb60fb22 Fix T90519: USD Exporter Error
Fixes: `Error: metersPerUnit does not match retrieved type float`
2021-08-11 09:40:27 -03:00
62cb5c5c4a Enable Asset Browser by default for poses, rest stays experimental
Idea for 3.0 is to disable all functionality that isn't well polished
and focus on those parts first. Starting with poses.

* Adds a new experimental option "Extended Asset Browser", replacing
  "Asset Browser".
* Unlike the previous option, this isn't enabled by default anymore.
  This didn't work well in practice and caused plenty of confusion.
* "Mark as Asset" and "Clear Asset" are hidden if the option is
  disabled.
* Same for the category selection in the Asset Browser.
* Always show display the "Only Assets" option in the File Browser while
  browing inside .blend files. That way you can hide data-blocks that
  are not pose assets.
* The Asset Library setup UI in the Preferences is always visible now,
  it's needed for pose library access.

Addresses T90181, T90180 and T90300.

Differential Revision: https://developer.blender.org/D12120
2021-08-11 14:32:07 +02:00
48ba341d15 Cleanup: Keylist Drawing - Split up in multiple functions. 2021-08-11 13:34:11 +02:00
6aae140278 Cleanup: Minor comment update on LIB_TAG_NEW. 2021-08-11 11:23:31 +02:00
f3e26c847b PyAPI: report unreleased ID's with WITH_PYTHON_SAFETY enabled
This would have made T88033 more straightforward to track down.
2021-08-11 17:37:38 +10:00
cbc671947a Fix T88033: Python reference memory leaks for non main data-blocks
ID data-blocks that could be accessed from Python and weren't freed
using BKE_id_free_ex did not release the Python reference count.

Add BKE_libblock_free_data_py function to clear the Python reference
in this case.

Add asserts to ensure no Python reference is held in situations
when ID's are copied for internal use (not exposed through the RNA API),
to ensure these kinds of leaks don't go by unnoticed again.
2021-08-11 17:10:02 +10:00
18fbcaf7b9 Cleanup: rename BKE_collection_{free => free_data}
This function doesn't free the collection, only it's memory.
2021-08-11 16:09:23 +10:00
Henrik Dick
2f39f7f815 Modifier: use high quality normals for vertex offset
Using high quality normals for vertex offset when set
for higher precision offsets.

This was only used for calculating even-offset.

Reviewed By: campbellbarton

Ref D12176
2021-08-11 10:26:49 +10:00
d480f03952 Cleanup: clang-format 2021-08-11 10:11:12 +10:00
55615e2600 Cleanup: trailing space, remove BOM 2021-08-11 10:11:11 +10:00
fcd2d63b64 Fix 'GPU_matrix_unproject_3fv' not working with out-of-bounds points
To solve this, the unproject code was redone in order to simplify and optimize.
2021-08-10 18:06:52 -03:00
8652e69d8b Fix T90447: 3D view transform locks do not use driver colors
Caused by rB6942dd9f4900.
2021-08-10 12:33:47 -05:00
32c687b5ec Clean-up: Remove UTF8-BOM markers
Done at the request of Sergey.
2021-08-10 11:27:18 -06:00
946da86e02 Win32 IME: Replace Usage of Language IDs
This is a slight refactoring of the Win32 IME code to remove the use of
Language IDs, which is now strongly deprecated. Instead this uses the
new recommended Locale Names, ie ISO-639-1 2-letter abbreviated names
like "en" for English rather than ID 0x09.

See D12143 for more details.

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

Reviewed by Ray Molenkamp
2021-08-10 08:54:03 -07:00
6806459246 UI: hide Viewport Display Bounds for object types that dont have
bounding boxes

These are namely 'LIGHT', 'CAMERA', 'EMPTY', 'SPEAKER' and 'LIGHTPROBE'.

Note that Empties are included here despite the fact that they have
instancing capabilities ('Display As' can be 'Bounds' for example which
then displays all instanced geometry with boundingboxes -- this however
is not meant to work with the 'Bounds' checkbox and the display bounds
type, these are only affective for the object itself, not its instances)

Issue came up in T88443.

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11344
2021-08-10 17:30:43 +02:00
b6538e1492 Fix T90572: "Render Region" is broken due to compositing
It was using viewer instead of render border. A copy-paste error.
2021-08-10 16:16:23 +02:00
eb03529ab9 Compositor: Full frame output nodes
Adds full frame implementation to "Composite", "File Output" and
"Split Viewer" nodes.
The other nodes in "Output" submenu are implemented separately.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12091
2021-08-10 16:16:23 +02:00
d481c6651d Compositor: Full frame color nodes
Adds full frame implementation to "Alpha Over",
"Hue Saturation Value", "Invert", "Tonemap" and "ZCombine" nodes.
The other nodes in "Color" submenu are implemented separately.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12092
2021-08-10 16:16:23 +02:00
8f6cc16490 Compositor: Full frame curve nodes
Adds full frame implementation to "RGB Curves",
"Vector Curves" and "Hue Correct" nodes.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12093
2021-08-10 16:16:23 +02:00
b81d88a8e2 Compositor: Fix memory leaks when initializing tiles multi-threaded
It was only affecting tiled fallback on full frame mode. If tiles from a
constant operation were multi-thread initialized, its buffer
was inflated multiple times.
2021-08-10 16:16:23 +02:00
1a9b9dd64d Compositor: Full frame input nodes
Adds full frame implementation to "Bokeh Image" node, "Track Position"
node, `SetVectorOperation` and `MovieClipAttribute`.
The other nodes in "Input" submenu are implemented separately.

`MovieClipAttribute` needs resolution to calculate its constant value, it can't be constant folded,
which requires it to be a `ConstantOperation`. Now `ConstantOperation` contemplate this case
and any operation that is always constant without depending on inputs should implement it.
If in the future an operation needs to get an input constant element during
`determineResolution` it must first determine its input resolution.

The nodes have no functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12090
2021-08-10 16:16:22 +02:00
5deb3229a0 Compositor: Full frame Mask node
Adds full frame implementation to this node operations.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11751
2021-08-10 16:16:22 +02:00
079f35572b Compositor: Full frame Bilateral Blur node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11634
2021-08-10 16:16:22 +02:00
0116a567dd Compositor: Full frame Sun Beams node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11694
2021-08-10 16:16:22 +02:00
6c0c766bca UI: hide instancing options for empties which cannot be used
Empties can only instance a collection, instancing on "Vertices" or
"Faces" does not make sense for empties, make that clear in the UI.

ref D11348

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11349
2021-08-10 16:05:01 +02:00
4599748962 UI: hide object instancing panel for object types that dont support instancing
Basically, only meshes, empties and pointclouds support direct
instancing atm., no need to have the panel for other types.

note: prior to rB2eca054e14b1, collection instancing was possible on all
types (but that was removed in said commit)

note2: for empties, rna_Object_instance_type_itemf should also be
tweaked so we dont get "Vertices" and "Faces" options, but that can be
done in a separate commit

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11348
2021-08-10 16:04:45 +02:00
Himanshi Kalra
e38de11f05 Refactor: Custom data comparison in meshes
Added the comparison of non-generic attributes with generic
attributes in the same loop to avoid issues with different
order in layer->types of the two meshes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12149
2021-08-10 19:22:29 +05:30
9c0f11344e Fix T90564: Crash when linking 2 node inputs
Caused by {rB37570a73170e}.

Above commit wasnt taking into account that at this point the link could
still be NULL.

Maniphest Tasks: T90564

Differential Revision: https://developer.blender.org/D12180
2021-08-10 15:44:53 +02:00
05879f2c36 File/Asset Browser: Select/Activate File on Right Click for Context Menu
Right clicking would spawn the context menu under the cursor, but some
operators would actually act on the active asset/file which wasn't
the one clicked on.

When multiple files are selected and one of them is right-clicked on,
selection is not changed to allow operations on multiple files. E.g.
deletion.

This makes the File/Asset Browser match the Outliner (in behavior, not
implementation).

For the right-click selection keymap:
* The context menu still only spawns on W.
* Bonus: Right click now does something, it actually selects files!
  I could have done additional changes here to avoid this, but it seems
  like a good addition.

This is also a better alternative to rB5edfde58fe60, which didn't work
properly either. Using rename from the context menu would only work if
the clicked on file was also active...

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

Reviewed by: Campbell Barton
2021-08-10 13:04:49 +02:00
fe1740ae6a Cleanup: use give_object_under_cursor when dragging materials.
It used to invoke give_base_under_cursor, but only accessed the `object` from the base.
2021-08-10 12:07:13 +02:00
aab7540b7a Fix crash: mouse is over file space during startup.
When blender starts and the mouse is over a file/asset browser it
crashes. This is because blender wants to highlight a file, but the
layout isn't initialized yet.
2021-08-10 12:03:40 +02:00
895d3cd11e Fix T89253: template_list allows arbitrary data changes
Blender forbids property changes in .draw() methods. But they weren't
caught after a call to .template_list() with a custom list type.

Support nested calls that disallow writes.
2021-08-10 19:53:08 +10:00
182edd4c35 Fix T89284: Greasepencil top bar draw tool settings missing
Caused by {rBe3faef686d38}.

Error was getting the preview [which wasnt there yet]
These only appeared once the material tab in the Properties Editor was
used (since this ensured a valid preview icon).

Above commit changed behavior for RNA icon getter (this does not create
data anymore), so ensure the preview by hand here.

Maniphest Tasks: T89284

Differential Revision: https://developer.blender.org/D12178
2021-08-10 11:37:03 +02:00
76d52cbcb4 Cleanup: Comment COW/LOCALIZED ID tags.
This was really missing there (some COW tags behavior was also
documented in some code using them, like in `sound.c`, but not in their
definition).

Ref. T88555.
2021-08-10 10:07:10 +02:00
7c2c66cdb8 Fix T90268: Mesh.from_pydata error using numpy array for edges/faces
Technically not a bug but worth supporting.
2021-08-10 17:51:48 +10:00
61040a36aa PyDoc: fix for renamed context member
Missing change from 9cff9f9f5d.
2021-08-10 17:28:09 +10:00
128ca8c7f6 Fix T90551: Dopesheet displays keyframes differently.
Regression introduced by {rB73b047bcd431}. Missing a check when
converting the file to use LISTBASE_FOREACH.
2021-08-10 08:42:06 +02:00
692e926b18 Silensed compilation warning in gpu test case. 2021-08-10 07:57:41 +02:00
49ea8e4fea Edit Mesh: multi-object edit-mode support for knife project 2021-08-10 15:10:20 +10:00
b83ee724a4 Fix T90418: macOS codesign fails with dylib next to executable
Change the dylib folder relative to `Blender` executable to be
the same as before rB652fbc200500497a67bd11d18b786587ba34e3d9 and same
as bpy.so : `@loader_path/../Resources/${BLENDER_VERSION}/lib`
2021-08-10 10:30:55 +05:30
4ca19c7153 Fix T90493: Undo a knife-project operation crashes
The crash occurred calling because mesh_get_eval_final in edit-mode
freed all derived mesh data without tagging the object for updating.

However meshes in edit-mode weren't meant to be used as knife-project
source-data, adding support for multi object edit-mode  caused this.
2021-08-10 14:44:36 +10:00
3335f852a1 Cleanup: mixing enum/non-enum type warning in conditional expression 2021-08-10 12:04:17 +10:00
26fea4de63 Cleanup: unused function warning 2021-08-10 11:57:33 +10:00
d9930cddfd Fix invalid string comparison in cd692c6954 2021-08-10 11:47:09 +10:00
cb7b4064d6 VSE: Fix cache invalidation
Blend mode replace is done in preprocessing stage, but property update
function invalidated composite cache.
2021-08-10 01:26:49 +02:00
Wannes Malfait
cd692c6954 Geometry Nodes: Add labels for switch node texture sockets
This makes texture sockets have a label by default. This can be changed
by adding the SOCK_HIDE_LABEL flag to the socket. With this change the
switch node now shows the labels "True" and "False" like for the other
types of sockets.
2021-08-09 17:30:44 -05:00
3b87fd376a Cleanup: Remove unecessary RNA get and set functions 2021-08-09 15:25:05 -05:00
aad18a0050 End comments with period 2021-08-09 15:08:59 -05:00
8a9d764544 Remove trailing whitespace 2021-08-09 15:08:29 -05:00
414ad257ec Merge branch 'master' into refactor-idprop-ui-data 2021-08-09 15:06:35 -05:00
Rob Ranieri
8e3dea27ec Docs: Blend-File: Fix typo
Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D12162
2021-08-09 15:36:42 -04:00
2d867426b1 UI: Clip Editor: Expose 2D Cursor Location to RNA and UI
To be consistent with the image editors and 3D viewport
the cursor location can be changed from the sidebar.
This was missing from the clip editor, but support has been added in this commit.
Previously, the only way to precisely set the cursor was
to call the set cursor operator then use the redo panel to adjust the value.
2021-08-09 15:33:06 -04:00
ce95a2b148 UI: Clip Editor: Move Annotation Panel to new View tab
To be consistent with all other editors the annotation
layers pannel should be placed in a "View Tab".
In my next commit, this tab will be expanded to include other options.
2021-08-09 15:33:06 -04:00
b04997cca4 Fix T90547: Add node errors when compiled without OpenVDB or Bullet
These were added in other places but were overlooked here.
2021-08-09 13:42:19 -05:00
fddd5eb692 UI: Image Editor: Fix missing 2D cursor in mask edit mode
The 2D cursor should be visible in both mask and uv edit modes.

This was likely and oversight when splitting the image editor
into the UV and Image editors
2021-08-09 11:53:28 -04:00
ff594715b8 Build: macOS library upgrade fixes
* Revert back to OpenMP 9.0.1 due to bug causing cloth physics test to fail.
* Skip flex build on macOS to avoid link error, only reason we build this is
  due to old flex version on Linux CentOS 7.
* Fix PNG cmake argument that expects lowercase on instead of ON.

 Ref T90507, T88438
2021-08-09 16:50:31 +02:00
71e2c366f7 Cleanup: Fix compiler warning 2021-08-09 15:28:12 +02:00
6fe00939b0 PyAPI: resolve build error with Python 3.10
Resolves T89931
2021-08-09 22:55:41 +10:00
6deb37474e Cleanup: spelling in comments 2021-08-09 22:55:38 +10:00
e2a411570e Cleanup/fixes in UI messages. 2021-08-09 14:42:47 +02:00
3886ab05b4 Cleanup: Spelling and typos in comment 2021-08-09 14:32:12 +02:00
73b047bcd4 Cleanup: Changed keyframe_keylist to CPP.
Just a straight-forward change. Not utilizing CPP features.
2021-08-09 13:00:30 +02:00
22ed1c7b61 Cleanup: filelist, pass FileListReadJob to job functions
Pass `FileListReadJob` to the `read_job_fn` callback, instead of exploding
the struct into its individual fields, passing those as parameters, and
marking a bunch of those as unused again.

No functional changes.
2021-08-09 12:37:23 +02:00
0e4a250279 Fix invalid helps and description of session UUID verification
A copy-paste error.
2021-08-09 12:09:02 +02:00
7ea577eef3 Fix depsgraph check for tag during evaluation
- Only do print when asked for tags debugging.
- Add missing newline to the message.
2021-08-09 12:09:02 +02:00
d6f162dfa9 Fix T90540: NoneType object error with entering grease pencil draw mode
The preview was not ready when the panel was displayed.

Just need to check if None.
2021-08-09 12:08:08 +02:00
0986992dbd Cleanup: document FileListReadJob::tmp_filelist
Add a comment to document what `FileListReadJob::tmp_filelist` is for,
and how it's freed.

No functional changes.
2021-08-09 11:32:16 +02:00
909e0819ae Fix T90532: Crash editing meshes with auto-smooth
Caused by fix for T90256 and a misunderstanding in D11928.

Don't skip tagging edges when the auto-smooth angle is 180 degrees
since this skips topology checks which are needed for properly
calculating edge loop normals.
2021-08-09 18:32:53 +10:00
52c349cfcd Fix T90511: Cycles preview does not update once preview is done
Caused by 4f64fa4f86.

Was a bad backport from the Cycles X branch: the fact that CPU and GPU
has different reset code paths was not taken into account.
2021-08-09 10:28:54 +02:00
b417fb9251 Cleanup: return True/False from gpencil toolbar function
This was returning None/False which could cause problems in the future.
2021-08-09 15:05:04 +10:00
64d750fb73 Cleanup: indentation 2021-08-09 15:03:47 +10:00
d3a699925d Cleanup: use 'cls' for class methods first argument 2021-08-09 15:03:32 +10:00
eb165f574b Cleanup: remove redundant imports
The module was importing it's own functions.
2021-08-09 15:02:31 +10:00
Yuki Hashimoto
8830cfe541 Fix text object inserting multiple characters with a selection
`bpy.ops.font.text_insert(text="multiple characters")` wasn't working.

When the text is selected does not correctly insert multiple characters.

- When the text was selected from left to right,
  the cursor only move one position next to the selected text.
- When the text is selected from right to left,
  a part of the selected text remain.

Ref D12161
2021-08-09 14:31:57 +10:00
ff9bc901f4 Cleanup: grease pencil app-template versioning
- Remove check for screens being None as this would raise an error.
- Replace loop over `area.spaces` with `area.spaces.active`.
- Loop over grease pencil data directly instead of accessing
  through the scenes objects.
- Split versioning into functions.
- Use `update_factory_startup_*` prefix for function names
  as this isn't versioning existing files.
2021-08-09 12:45:06 +10:00
3ea6cf7d41 Cleanup: avoid using context in versioning code
Also extract versioning into a function that makes it's purpose clear.
2021-08-09 12:01:11 +10:00
4c26bb0232 UI: Show Mask Display Options Conistently
This commit makes the display options for mask only show in the header for the clip and image editors.
Prior to this change they would display in the header for the clip editor and in the sidebar for the image editors.
2021-08-08 16:09:23 -04:00
Aaron Carlisle
0be26f563e UI: Sequencer: Fix placement of display options in sequencer & preview mode
This commit does two things, first it removes the proportional editing tool settings.
This is not accessible code and is has not been used since the grease pencil/annotations changes in 2.8.

Second, this patch reorders the if statements so that the display options are always shown on the rightside.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D12163
2021-08-08 13:30:52 -04:00
76e24609fd Cleanup: Remove stale/dead code
This seems to be really old code from 2.4 or earlier.
I was unable to find when it was removed gitk and git blame both couldnt find anything.
However, it is safe to say that this code is long gone.
2021-08-08 13:29:29 -04:00
3f1873111e Cleanup: Fix comment typo 2021-08-08 15:11:50 +02:00
b541b5f875 GPencil: Fix memory leak in previous commit 2021-08-08 15:09:34 +02:00
a7aeec2655 GPencil: New Select Random operator
Select strokes or points randomly (similar to meshes).

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D12157
2021-08-08 14:56:33 +02:00
a7bb537a61 Cleanup: unnecessary double pointers in XR module
No functional changes.
2021-08-07 21:30:15 +09:00
nutti
b33b70ed07 PyDoc: Fix poll_message_set API documentation to consistent with Python style
Fix poll_message_set API documentation to consistent with Python style

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D12150
2021-08-06 20:18:31 -04:00
d245782b80 Windows: Add support to compile python api docs from make file
This adds support to compile the html python api docs from the command line by running `make doc_py` matching support between windows and unix.

This patch also makes it so the compiler is not needed if you set the `blender_bin` variable, this affects icon generation as well.

In the future, I want to move away from generating the build output in the build directory but that can come in a later change.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D12144
2021-08-06 13:55:14 -04:00
07b2aaa8c7 Don't apply any changes on failure, refactor with IDP_ui_data_free_unique_contents 2021-08-06 12:12:04 -05:00
14d333cd31 Cleanup: Rename variables 2021-08-06 11:33:20 -05:00
3fab16fe8e Fix T90477: Cursor vertex snapping not working in UV editor
`t->obedit_type` is read to indicate if we are in uv edit mode.

Also fixes a crash introduced in {rBdd14ea18190ff27082009f73a556569a43377a71}.
2021-08-06 11:44:26 -03:00
4f64fa4f86 Cycles: Fix for possible viewport dead-lock
This is a backport of recent development in the Cycles X branch.

Fixes possible dead-lock in viewport rendering when exiting at an
exact bad moment (couldn't reproduce in master branch, but in the
cycles-x branch it was happening every now and then).

Differential Revision: https://developer.blender.org/D12154
2021-08-06 16:26:51 +02:00
69c9363e39 Cleanup: Use conventional naming for private Session members
Makes it consistent with the guidelines and the Cycles X branch, and
allows to backport fix for the viewport update from the branch. Will
cause a merge conflict, which should be simple accept-ours in the
branch.
2021-08-06 15:56:00 +02:00
335379d8fc Cleanup: Add missing newline at end of file 2021-08-06 15:32:28 +02:00
3fbe6f513d Move NanoSVG lib to extern
The library has some modifications and it has been included in a diff.

Reviewed By: campbellbarton

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

(Some minor changes done in the patch)
2021-08-06 15:29:54 +02:00
9cff9f9f5d Cleanup: rename FileList::asset_libraryasset_library_ref
In the `FileList` struct, rename the `AssetLibraryReference
*asset_library` field to `asset_library_ref` -- it's a description of
which asset library is used, and not the asset library itself.

This is to make space for a future `AssetLibrary *asset_library` field,
which will point to an actual asset library struct/class.

No functional changes.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D12151
2021-08-06 15:20:39 +02:00
2796ee7da0 Fix error setting the ID name in disabled alembic nurbs importe
This corrects code that's currently disabled, see `USE_NURBS` define.

The name passed to `BKE_curve_add` was overwritten,
bypassing uniqueness and utf8 encoding checks.

Longer names would cause a buffer overrun as the length of the source
data was passed to `BLI_strncpy` instead of the destination.

Reviewed By: sybren

Ref D12125
2021-08-06 23:01:57 +10:00
2263e16a57 Merge branch 'master' into refactor-idprop-ui-data 2021-08-06 07:42:14 -05:00
01c1b1e82e Fix shortcut for Asset Details not showing in Asset Browser pulldown
The shortcut wouldn't show up in the Asset Browser's "View" pulldown for
the "Asset Details" item. It's the "N" key to toggle the right sidebar.
2021-08-06 14:39:09 +02:00
f4adb35f28 Fix T90476: intermittent wrong generated texture coordinates with modifiers
This caused Cycles texture_space_mesh_modifier and panorama_dicing tests to
randomly fail.

The issue was introduced with D11377, due to a missing dependency. Now ensure
we first copy the texture space parameters, and only then use or recompute then.

In general it seems like this dependency should have already been there, since
parameter evaluation includes animation and drivers, and geometry evaluation
may depend on that (even if you would not typically animate e.g. an autosmooth
angle).

Thanks Campbell for tracking this one down.
2021-08-06 13:59:25 +02:00
b0df8f53ba Cleanup: rna_xr.c
- Rename functions to use RNA identifiers
- Use SET_FLAG_FROM_TEST macro
- Specify max string length for relevant function params
2021-08-06 17:56:06 +09:00
4c675bc356 Fix missing function param definition in rna_xr.c
Was accidentally left out in rBe844e9e8f3bb.
2021-08-06 17:55:32 +09:00
151eed752b Fix invalid XR action map indices after alloc
Although the relevant structs (wmXrRuntime/XrActionMap/
XrActionMapItem) are zero-allocated, the selected and active action
map indices need to be initialized to -1 to prevent potential
out-of-bounds list access.
2021-08-06 17:55:00 +09:00
d98791a106 Cleanup: clang tidy
`bugprone-signed-char-misuse`
2021-08-06 10:20:24 +02:00
6188c29603 Cleanup: use const result in ED_keyframes_find_* functions. 2021-08-06 09:54:56 +02:00
1ab75c1d49 Cleanup: use range2f in ED_keylist_find_any_between. 2021-08-06 09:46:36 +02:00
bb8ce95b5e Cleanup: const pass keyframes_keylist. 2021-08-06 09:10:28 +02:00
bc97d78329 Cleanup: use MEM_SAFE_FREE macro 2021-08-06 14:24:16 +10:00
99738fbfdc Fix memory leak from rB263fa406cd2b 2021-08-05 21:10:54 -05:00
1f8485ae82 Geometry Nodes: Select by Handle Type Node
Just like the "Select by Material" node, this node outputs a
boolean attribute for control points that have a matching handle
type. By default left and right handles are considered, but it's
possible to only check one side with the toggle in the node.

Differential Revision: https://developer.blender.org/D12135
2021-08-05 18:42:20 -05:00
Mattias Fredriksson
bc0d55e724 Fix: Avoid floating point error in some mesh primitive nodes
Some mesh primitives created using geometry nodes use loops to create
vertices and accumulates positions/angles in FP variables. This allows
rounding errors to accumulate and can introduce significant errors.

To minimize changes from original implementation, variables allowing
errors to accumulate are replaced by: delta * index. Affected Mesh
Primitives nodes are Line, Grid, Cylinder, Circle, Cone, and UV-Sphere.

Differential Revision: https://developer.blender.org/D12136
2021-08-05 18:34:32 -05:00
263fa406cd Fix T90087: Assigning object data doesn't copy vertex groups
Assigning a mesh seems to do its own parameter copying, which
means we need to manual copy its vertex groups here, which was
just overlooked in rB3b6ee8cee708.

Differential Revision: https://developer.blender.org/D12110
2021-08-05 18:27:07 -05:00
1681d09919 Put "\n" on newline 2021-08-05 13:57:35 -05:00
1bbc4ccbd2 Remove more curly braces 2021-08-05 13:56:39 -05:00
6b944e8dc0 Add key arg to id_properties_ui doc 2021-08-05 13:54:29 -05:00
8473bee909 Free unused result in failure cases 2021-08-05 13:52:28 -05:00
Himanshi Kalra
92edf37997 Add custom data comparison for generic attributes
Generic attributes CD_PROP_* comparison is added in customdata_compare
Checks for built-in as well as user created attributes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12137
2021-08-06 00:07:40 +05:30
983e84322a Write to a temporary local copy of the UI data 2021-08-05 13:34:19 -05:00
Germano Cavalcante
89014b51f1 Xcode: support cmake options for grouping in folders
The Xcode IDE can also benefit from the options:
- WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS
- WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS

So add suport to these options and also renames them as they are no
longer limited to just Windows and Visual Studio.

Reviewed By: brecht, ankitm

Differential Revision: https://developer.blender.org/D12132
2021-08-05 15:31:41 -03:00
cf10eb54cc Action Constraint: add Split Channels Mix choices from Copy Transforms
Practice shows that when combining actions and direct animation
it is usually best to combine location, rotation and scale
separately, which is implemented by the Split Channels modes
recently introduced in D9469 for Copy Transforms. This completes
the same set of 6 choices for the Action Constraint.

The default for new constraints is changed to the newly
added Before Original (Split Channels) mode.

The original patch is motivated by Loic Pinsard, who created
an addon that does the equivalent of this feature by splitting
the action into two, separating location and rotation+scale.

Differential Revision: https://developer.blender.org/D7547
2021-08-05 21:21:29 +03:00
c85397ad51 Rename IDP_free_ui_data -> IDP_ui_data_free 2021-08-05 13:19:36 -05:00
ed351f2784 Split setting defaults to a separate function for int and float 2021-08-05 13:16:59 -05:00
fb4b5c7235 Add back curly braces in one place 2021-08-05 13:14:53 -05:00
d01781129f Fix T90235: Smooth Brush not working with interior vertices with two adjacent edges
The exception to automatically pin vertices of grid corners also
has to take into account that the vertex is in a boundary.

Reviewed By: JacquesLucke

Maniphest Tasks: T90235

Differential Revision: https://developer.blender.org/D12044
2021-08-05 20:10:02 +02:00
4dd6c9ad45 Fix T90236: Sculpt automasking failing when the stroke does not start over the mesh
The active geometry element are usually updated by the cursor drawing
code (as they are needed for the cursor preview) and when an sculpt
operator starts. For brushes, this was not happening. This was making
brushes rely by default on the last cursor drawing update, which can
be incorrect if the mouse moved after starting the stroke without
hovering the active geometry.

Reviewed By: JacquesLucke

Maniphest Tasks: T90236

Differential Revision: https://developer.blender.org/D12045
2021-08-05 20:08:36 +02:00
cc00567061 Remove const from int argument in header 2021-08-05 12:55:41 -05:00
95538552a8 Remove curly braces 2021-08-05 12:55:19 -05:00
442236d9ea Add function to fill default array from doubles, simplify a bit 2021-08-05 12:47:10 -05:00
6844f7bedb PyDoc: document how parameter are used for 3D and 2D textures
Improves on rB171433e841379e7efad069bbda9880fb271e2fc4
2021-08-05 13:06:13 -04:00
ecd8bdafbb Use IDP_ui_data_type instead of more specific checks 2021-08-05 12:02:17 -05:00
71164a826d Use pyrna_enum_value_from_id to parse enum items (fix bug creating custom property) 2021-08-05 11:44:41 -05:00
11d7619e22 Revert "Use pyrna_enum_value_parse_string"
This reverts commit 1cf574dc39.
2021-08-05 11:23:51 -05:00
c41c378428 Merge branch 'master' into refactor-idprop-ui-data 2021-08-05 10:46:12 -05:00
Eitan
bd44e82b25 Geometry Nodes: Add more warnings for out of bounds parameters
Add warning(info) to nodes that don't work when an input value is
out of range. For example, the grid node doesn't work with Vertices X
or Verices Y less than 2.

These are purposefully added as "Info" warnings, because they don't
show in the modifier and they aren't printed to the terminal.

Differential Revision: https://developer.blender.org/D11923
2021-08-05 10:44:59 -05:00
c15635bd8d BMesh: support laplacian smooth for n-gons
Follow the same logic already used by the modifier.
2021-08-06 01:43:13 +10:00
04c24bec07 Cleanup: replace short with boolean for zero area array
Also remove redundant fabsf on the area of a quad/tri &
reduce indentation using continue in for loop.
2021-08-06 01:42:01 +10:00
ff2265f0a9 Cleanup: comment blocks & spelling 2021-08-06 01:36:43 +10:00
8158211198 Cleanup: quiet array-parameter warning 2021-08-06 01:32:04 +10:00
ca64bd0aac Render: move Cycles visibility, holdout and shadow catcher properties to Blender
The immediate reason for this is that we want to be able to initialize them
to different defaults for light objects, which is hard with Python properties.
But in general it is useful to be able to share these with other renderers.

As a side effect, Eevee now supports a per-object holdout instead of only
per-collection.

Differential Revision: https://developer.blender.org/D12133
2021-08-05 17:22:38 +02:00
6c326ba0a2 Fix T83164: Spline IK joint_bindings parameter is broken.
Code freeing the array would not properly reset its length value to
zero.

Note that this corrupted data could also be saved in .blend files, so
had to bump fileversion and add some doversion code too.

Fix T90166: crash when creating a liboverride.
2021-08-05 17:21:25 +02:00
834523e239 Cleanup/Fix RNA array length accessors returning non-zero values in invalid cases.
This was apparently done in two places only, with a very cryptic comment
(`/* for raw_access, untested */`), and... I cannot see how returning a
non-zero length value for an array that does not exist or is not
accessible at least, would be anything but an obvious source of issues.

Note that both commits adding those lines are from stone ages (2009):
rBcbc2c1886dee and rB50e3bb7f5f34.
2021-08-05 17:21:25 +02:00
27b9cb7a1e GPencil: New Merge Layer keymap: Shift+Ctrl+M
The keymap is available in: Draw, Edit, Sculpt, Weight Paint and Vertex Paint modes.

The keymap is not available in Object mode to avoid any conflict.

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D12128
2021-08-05 17:12:34 +02:00
03d7561708 Fix build error when WITH_XR_OPENXR not defined 2021-08-06 00:08:56 +09:00
b4f950cbbe GPencil: New Caps icons
These icons are used to define the type of caps.

Designed by: Matias Mendiola
Reviewed by: Pablo Vazquez
2021-08-05 17:07:21 +02:00
Germano Cavalcante
cc4e674e41 DRW: New Select Debug Engine
This is a simple engine used only to debug the texture of select ids.

It is only used when the `WITH_DRAW_DEBUG` option is enabled and the
debug value is 31.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5490
2021-08-05 11:56:51 -03:00
e844e9e8f3 XR Controller Support Step 2: Action Maps
Addresses the remaining portions of T77137 (Python API for Controller
Interaction), which was partially completed by D10942.

Adds an XR "action maps" system for loading XR action data from a
Python script. Action maps are accessible via the Python API, and are used
to pass default actions to the VR session during the
xr_session_start_pre() callback.

Since action maps are stored only as runtime data, they will be
cleaned up with the rest of the VR runtime data on file read or exit.

Reviewed By: Julian Eisel, Hans Goudey

Differential Revision: https://developer.blender.org/D10943
2021-08-05 23:40:17 +09:00
0cff7c2a22 LibOverride: Make it reasonably impossible for users to create overrides of scenes.
This is not supported currently,doing so through RNA API remains
possible, but from regular UI operations it should not be doable
anymore.

Ref. T90459.
2021-08-05 15:26:08 +02:00
720ea8a67d Fix T89963: crash when library override is applied to an object from a linked scene.
LibOverride of scenes is not really supported currently, there are many
issues with it.

Will disable most user-accessible ways to create such overrides in a
following commit.
2021-08-05 15:26:08 +02:00
be6409a748 Fix fix invalid index use for edit-mesh laplacian smooth
Only vertex indices were ensured to be correct.
2021-08-05 22:39:24 +10:00
fb1822ddeb XR: Controller Data Improvements
Provides two key improvements to runtime controller data.

1. Separates controller poses into two components, "grip" and "aim",
which are both required to accurately represent the controllers
without manual offsets.

Following their OpenXR definitions, the grip pose represents the
user's hand when holding the controller, and the aim pose represents
the controller's aiming source.

2. Runtime controller data is now stored as a dynamic array instead
of a fixed array. This makes the API/functionality more adaptable to
different systems.

Does not bring about any changes for users since only internal
runtime functionality is currently affected.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D12073
2021-08-05 21:11:01 +09:00
f45860fba9 Cleanup: Remove unused members in FileSelectParams 2021-08-05 12:52:58 +02:00
ed9759349b Fix T89214: Smooth Vertices (Laplacian) produces NaN coordinates
Vertices with no connected faces would attempt to divide by the combined
face area causing a divide by zero.

Use the same weight for wire vertices as vertices connected
to zero area faces.
2021-08-05 20:49:20 +10:00
02e0c6f42e Fix T90430: Crash when dragging material
Was trying to get asset information even when there was none, i.e. when
the material wasn't an asset or not dragged from the Asset Browser.
2021-08-05 12:14:11 +02:00
317f09ebf9 Fix T90170: RNA_property_pointer_get creating data in non-thread-safe way.
Protect this accessor with a local static mutex when it needs to
create/write data.

Ideally accessors should never create or modify data, but there are some
cases where this bad behavior is currently unavoidable.

This is the case of the Pointer accessor when the actual IDProperty has
not yet been created.

NOTE: this fixes a memory leak in liboverride diffing process when
several different overrides use a same linked reference ID.

Differential Revision: https://developer.blender.org/D12060
2021-08-05 12:12:13 +02:00
03e2f11d48 Fix T89835: Crash after Instancing to Scene after making linked Collection local.
Even though the ID itself remain the same after being made local, from
depsgraph point of view this is a different ID. Hence we need to tag all
of its users for COW update, as well as rebuild depsgraph relationships.

Should be also backported to LTS 2.93 (and 2.83 if possible).
2021-08-05 11:31:49 +02:00
647a8bff06 Fix T90256: faces are flat shaded in edit mode with auto smooth
Regression in 39b2a7bb7e.
2021-08-05 18:21:17 +10:00
f5acfd9c04 Cleanup: remove redundant parenthesis 2021-08-05 16:54:34 +10:00
d8582d966f Fix slicing with negative indices
Negative indices that remained negative after adding the sequence length
caused incorrect slicing.

With the default scene for example:

   bpy.context.scene.objects[-4:2]

Gave a different result to:

   tuple(bpy.context.scene.objects)[-4:2]

Clamp indices above zero so loops that step forward works as intended.
2021-08-05 16:44:03 +10:00
2b51124d6a Fix T89450: Crash slicing BMEditSelSeq
Slicing with indices greater than the length of the sequence would crash.
2021-08-05 16:44:01 +10:00
450593ddf0 Cleanup: Fix Clang braced-scalar-init warning 2021-08-05 11:00:56 +05:30
d3d4be1db3 XR: Action Binding Improvements
Provides several important improvements to the runtime action
bindings operation and internal API.

Moves input-specific action data (input thresholds, input regions,
pose offsets/spaces) from actions to more granular action bindings.
This allows a single action to be mapped to a variety of inputs,
without having to share a single input threshold, region, or space.

Also removes the need for action space creation API, as spaces for
pose actions will be automatically created with the bindings.

The correct action data for the current inputs is set by calling
xrGetCurrentInteractionProfile() to get the current profile and then
retrieving the corresponding mapped data.

Does not bring about any changes for users since only internal
runtime functionality is currently affected.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D12077
2021-08-05 13:14:26 +09:00
d1c5e2e050 Cleanup: license headers
These were removed globally in 65ec7ec524.

Some files re-introduced these conventions since.
2021-08-05 12:03:41 +10:00
604ae5f7b6 Cleanup: tab indentation for CMake / GNUmakefile 2021-08-05 12:03:41 +10:00
1def985d78 Windows: Add icons and icons_geom to make.bat
This adds support for building the icons from make.bat
unlike bash there is no passing environment variables
on the command line.

The scripts go out of their way to locate both blender
and inkscape however if they are not found, the user is
given a helpful error message telling them how to set
the variables.

Although some extra help can be given there, if your
normal build is a 2019 full build running

`make 2019 full icons`

will help it find the blender executable as well.

finally if you know the name of your build folder
running

`make builddir build_windows_Lite_x64_vc16_Release icons`

will also work, if all fails you can point directly to
the blender executable by running

`set BLENDER_BIN=c:\where\blender\lives\blender.exe`

before running `make icons` or `make icons_geom`

The python scripts needed some small modifications since
without the PATHEXT, SystemRoot and SystemDrive
environment variables python will not initialize properly
on windows. (Not blender related, even mainline python
won't start without those)
2021-08-04 19:32:24 -06:00
438d645a36 PyDoc: Update GPU Example of draw_view3d
This function was changed in rBc8004ab4078c98c54a70113c12bbb186403e90cf but didnt update the example.

Part of T84227
2021-08-04 20:25:50 -04:00
171433e841 PyDoc: Improve description of texture.evaluate
Inspired by the old 2.49 docs: https://docs.blender.org/api/249PythonDoc/Texture.Texture-class.html#evaluate
2021-08-04 19:26:01 -04:00
d6ca7ab20e Cleanup: make format 2021-08-04 19:24:19 -04:00
07b702f828 Win32 IME: Rename SetInputLanguage()
GHOST_ImeWin32::SetInputLanguage() has a confusing name because it does
not set the input language. It actually retrieves the current input
locale from the OS and caches the value of the current input language
ID. Therefore this patch renames it to "UpdateInputLanguage"

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

Reviewed by Ray Molenkamp
2021-08-04 14:30:16 -07:00
1d1020b79f Win32 IME: Remove ime_status_
This removes one member of GHOST_ImeWin32 that is not used and cannot
be used in the future. It is holding the result of ImmIsIME, which is
whether an input language supports IME. It does not indicate that one
is in use, turned on, composing, in English mode, etc.

see D12131 for more information.

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

Reviewed by Ray Molenkamp
2021-08-04 13:20:45 -07:00
49acc52e02 Cycles: make object Fast GI Approximation panel a subpanel of Shading 2021-08-04 20:52:29 +02:00
8abf6efcf6 Cleanup: rename restrict to hide/visibility in Object, Collection, MaskLayer
This makes the internal naming consistent with the public API. And also gives
us a visibility_flag rather than restrictflag that can be extended with more
flags.
2021-08-04 19:18:34 +02:00
Romain Toumi
10b9621079 Fix Cycles material slots list being too short
Bring it in line with Eevee.

Differential Revision: https://developer.blender.org/D11982
2021-08-04 18:43:39 +02:00
ae920d789e VSE: Allow Wingdings and Symbol Fonts
This patch makes us less restrictive on the allowed types of FreeType
font character maps we allow, rather than primarily unicode-only. This
allows us to use some legacy, symbol, specialty, and proprietary fonts
like Wingdings. Note we were a little less restrictive with vfonts,
used for 3D Text Objects, so this patch primarily helps VSE.

See D12124 for details and examples.

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

Reviewed by Brecht Van Lommel
2021-08-04 09:31:01 -07:00
b5bfb5f34c UI: VFont Display Names
When displaying the names of fonts for 3D Text objects, use the same
format as shown in File Browser: Family name + Style name. They are
currently shown with Postscript Name, which doesn't match well.

see D12069 for more details.

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

Reviewed by Campbell Barton
2021-08-04 08:34:28 -07:00
c18d91918f Cycles: More flexible GI Approximation AO distance control
The goal: allow to easily use AO approximation in scenes which combines
both small and large scale objects.

The idea: use per-object AO distance which will allow to override world
settings. Instancer object will "propagate" its AO distance to all its
instances unless the instance defines own distance (this allows to
modify AO distance in the shot files, without requiring to modify props
used in the shots.

Available from the new Fats GI Approximation panel in object properties.

Differential Revision: https://developer.blender.org/D12112
2021-08-04 17:26:24 +02:00
58ba75f9e3 LibOverride RNA API: add removal of properties and operations.
This should complete the basics of RNA API for library overrides.

Ref. T86656.
2021-08-04 16:57:08 +02:00
a8185d2d74 LibOverride: Add RNA API to reset/delete overrides.
Ref. T86656.
2021-08-04 16:57:08 +02:00
2af789d1f3 Added some TODO remarks. 2021-08-04 16:05:49 +02:00
c1730ed165 GPencil: New Brush option to define Caps type
This is used to set the default caps type for the stroke. Before always was rounded and only could be changed later in Edit mode

Two new buttons has been added to topbar.

NOTE: New icons are been designed (T90414)

The buttons are expanded to list in Properties panel.

Reviewed By: mendio, HooglyBoogly

Differential Revision: https://developer.blender.org/D11999
2021-08-04 15:54:54 +02:00
145270d8d7 Fix T90427: Center View to Mouse broken
rBfb87d236edb7 made the values returned by `projmat_dimensions` more
standardized following the documentations. But the functions in Blender
that called `projmat_dimensions` followed a proposal that these values
corresponded to a distance of 1m of clip.

Adjust these functions to follow the new algorithm.
2021-08-04 10:46:54 -03:00
e5d4a0c559 BLI: add double version of 'scaleform'
No functional changes. New utility.
2021-08-04 10:46:54 -03:00
26c2c617b4 Fix T90421: edit-mode auto-smooth crash when angle set to 180degrees
Error in 39b2a7bb7e
which failed to set edge flags with single threaded calculation,
used for low poly models.
2021-08-04 22:40:25 +10:00
Gavin Li
76dcf70dac Fix transparent faces on certain AMD cards
This patch fixes an issue with missing faces when assigning a material slot other than the first to faces on AMD TAHITI cards. Refer to T78390 and T74024 for a description of this issue.

This patch also incorporates fix from T78390 for KAVERI.

{F9029258}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9305
2021-08-04 13:22:44 +02:00
d2130c5327 Cleanup: remove *.rej from cb67bfdba2 2021-08-04 21:09:21 +10:00
add719e31a Tweak to recent liboverride API addition: naming.
Rename new API function introduced in recent rB3b0fab6dfaa0 to match our
convention to put the action (verb) at the end of names:
`operations_update`.

Sorry for not catching that during review.
2021-08-04 12:38:13 +02:00
ac6b263906 Cleanup: inconsistent parameter name 2021-08-04 12:32:25 +02:00
557e7f135e Cleanup: initialize variable to quiet warning 2021-08-04 12:31:48 +02:00
051141acde Outliner/LibOverrides: Fix logic of checks for drag'n'drop of Collections.
Previous check was too blunt, preventing e.g. re-organization of
collection overrides inside a local parent collection, which is
perfectly valid operation.

Reported by @hjalti from the studio, thanks!
2021-08-04 11:42:13 +02:00
d9a530c55e Fix compile error without WITH_OCEANSIM enabled
Was changed in 218df99410.
2021-08-04 11:30:24 +02:00
Pratik Borhade
8c21076add Fix T87635: Rename shader node "Specular" to "Specular BSDF"
Node name edited in Specular node definition

Reviewed By: fclem

Maniphest Tasks: T87635

Differential Revision: https://developer.blender.org/D11022
2021-08-04 11:21:44 +02:00
Gottfried Hofmann
c8004ab407 Expose Color Management as argument for gpu.types.GPUOffScreen.draw_view3d()
Fix for https://developer.blender.org/T84227

The problem was that https://developer.blender.org/rBe0ffb911a22bb03755687f45fc1a996870e059a8 turned color management for offscreen rendering off by default, which makes it non-color-managed in some cases. So the idea here is that script authors get the choice wether they want color managed non-color-managed output. Thus this patch introduces a new argument do_color_management as a bool to gpu.types.GPUOffScreen.draw_view3d().

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11645
2021-08-04 11:20:22 +02:00
Anthony Edlin
b867df903f Make loopcut drawing consistent between gizmo and operator.
Loopcut drawing from gizmo had thicker lines because
it was using line smoothing without alpha blend, compared
to thin jagged lines from operator.

Make the drawing anti aliased and consistent by using
3D_POLYLINE/3D_POINT shaders, and making sure alpha
blending is on.

Reviewed By: #eevee_viewport, fclem

Differential Revision: https://developer.blender.org/D11333
2021-08-04 11:19:24 +02:00
cb67bfdba2 Viewport normal drawing with constant length
Patch for: T37878

{F10169694}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D11487
2021-08-04 10:55:05 +02:00
218df99410 Modifier: warn if the ocean simulation fails to allocate memory
While most modifies don't handle out of memory cases, ocean simulation
could attempt huge allocations: 2048 gb at the maximum resolution.

Resolves T83952.
2021-08-04 18:29:43 +10:00
3b0fab6dfa Override: API update_operations.
The update_operations function will update the override structure of the
local object. When working with overrides the override structure is only
updated when the work-file is stored. When using scripts you might want
to enforce the update of override properties and operations.

This function removes a hack on the test cases.

Reviewed By: mont29

Maniphest Tasks: T86656

Differential Revision: https://developer.blender.org/D10848
2021-08-04 09:28:18 +02:00
effc048710 T90371: Asset: Drop Material Tooltip.
This patch changes the drop named material tooltip to give feedback to
the user what is going to happen when they invoke the change.

There are 3 states:
* "": Operator will be canceled as not all data is present (dropping on
  background.)
* "Drop <named material> on <object name> (slot <slot number>, replacing
  <current material in slot>).
* "Drop <named material> on <object name> (slot <slot number).

Reviewed By: Severin

Maniphest Tasks: T90371

Differential Revision: https://developer.blender.org/D12106
2021-08-04 08:58:39 +02:00
cd92b2350f Cleanup: use C comments for descriptive text 2021-08-04 13:34:02 +10:00
10464843dd Cleanup: add comment to fix for T90417 2021-08-04 13:34:02 +10:00
Johnny Matthews
0f45576590 Geometry Nodes: Curve Set Spline Type
This node sets the selected (or all) splines in curve to a chosen target
spline type. Poly, Bezier, and NURB splines can be converted to any of
the other types. This is meant to be a building block node, useful in
many procedural situations.

In the future the node could be optimized with multi-threading, or by
avoiding copying in many cases, either by retrieving the curve for write
access or by passing the raw vectors to the new splines where possible.

With edits from Hans Goudey (@HooglyBoogly)

Differential Revision: https://developer.blender.org/D12013
2021-08-03 23:14:03 -04:00
26f1a5e2c8 Fix T90417: font loading creates duplicate ID names
Also repair any errors in existing files.

Error from e0dd3fe587.
2021-08-04 13:02:59 +10:00
5950b3ab73 Cleanup: de-duplicate ID renaming utility for versioning 2021-08-04 12:43:07 +10:00
71dc134f89 Icons: add license headers to utilities 2021-08-04 11:45:43 +10:00
7389fd9a35 Icons: resolve various issues for generating icons
- INKSCAPE_BIN environment variable was ignored by
  alert_icons_update & prvicons_update.
- `make icons` wasn't regenerating alert icons.
- Updating SVG icons failed using blender built with ASAN.
2021-08-04 11:35:05 +10:00
8a1c1279b3 Icons: update alert icon script
Missed from c549d736cf.
2021-08-04 11:03:23 +10:00
0d2589d08c Cleanup: spelling 2021-08-04 10:03:07 +10:00
fb87d236ed Fix calculation of 'projmat_dimensions'
`r_left`, `r_right`, `r_bottom` and `r_top` were ignoring `clip_near` value
when in perspective view.

Also rename `projmat` to `winmat` in these cases.
2021-08-03 17:35:35 -03:00
18d900caca macOS: Fix OpenMP dynamic loader error. 2021-08-04 01:22:27 +05:30
41357d556f Fix broken logic in Windows directory query function
Mistake in a5bbdd6998
2021-08-03 19:37:34 +02:00
39e914cee7 Fix select engine buffer having wrong vertex size
The theme used was wrong and the vertex size is twice as set in the theme.
2021-08-03 13:37:55 -03:00
57281b73c4 Install_deps: Always re-create shortcuts to installed lib paths.
For some reasons looks like those shortcuts could get out of sync, which
created weird hard to understand building errors.

So for sake of simplicity and security, just re-create them all the
time, just like we update ld paths.
2021-08-03 17:22:48 +02:00
652fbc2005 macOS: Portable builds with dynamic libraries.
For Blender.app: dropping libomp.dylib next to Blender executable is
enough for it getting picked up since `@executable_path` is an rpath.

For non-distributed binaries datatoc, makesdna, tests etc, code for
copying libomp.dylib to build folder is removed and replaced by
CMake's rpath option for *build* tree.

For bpy.so, the post build rpath change has also been replaced by CMake
rpath option for *install* tree.

Since -id has been changed in D11748, remove the
`install_name_tool -change ...` command.

Any dylib can just be dropped at `MAC_BLENDER_TARGET_DYLIBS_DIR`
hereafter. Appending dylib path to `CMAKE_BUILD_RPATH` will be needed
for datatoc etc if linked against one (instead of copying the
dylibs around).

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D11997
2021-08-03 20:49:40 +05:30
a25a1f39aa Cleanup: interface, reduce indentation of copy_to_selected_button()
Reduce cognitive complexity of `copy_to_selected_button()` by flipping
conditions, returning early, and using `continue`.

No functional changes.
2021-08-03 17:12:08 +02:00
4e1a1821e0 Fix T90313: Align to Transform Orientation Axis Property Doesn't Work
`Orientation Axis` is a property incompatible with `Align` mode and
should not be visible.
2021-08-03 11:29:36 -03:00
391af6bea2 Cleanup: Replace int with bool for pointcache function
Was using an int for boolean return value.
2021-08-03 15:51:25 +02:00
7724251af8 WM: don't store selection properties typically set in the key-map
While this was already the case for the most part
some selection operators stored common settings for reuse such as
"toggle", "extend" & "deselect".

Disabling storing these settings for later execution
as it means failure to set these options in the key-map re-uses
the value of the shortcut that was last called.

Skip saving these settings since this is a case where reusing them
isn't helpful.

Resolves T90275.
2021-08-03 23:33:40 +10:00
d3dd735fea UI: building without Python again
Also quiet some warnings.
2021-08-03 22:45:37 +10:00
cec103d5a9 Silenced clang-tidy warnings. 2021-08-03 13:56:46 +02:00
0342fb5d20 Fix T90387: division by zero when trying to invert scale
Fix division by zero when `BKE_bone_parent_transform_invert()` inverts a
scale vector with zero components.

Zero values in the to-be-inverted vector are now simply skipped, i.e.
remain zero after inversion. This at least ensures that
`invert_v3_safe(invert_v3_safe(vector))` results in the same vector.

This commit does NOT fix the conceptual problem that an inversion of a
potentially non-invertible vector is relied upon. It just avoids the
division by zero.
2021-08-03 13:43:42 +02:00
dbd34a5acb Fix T90364: buttons (partially) behind animchannel search block search
When channels are scrolled to be (partially) behind the search bar,
their widget buttons would still be interactive, preventing the seach
buttons to be usable.

We have to make sure the events are consumed from the search and dont
reach other UI blocks.
We can do so by flagging the block `UI_BLOCK_CLIP_EVENTS` -- but also
have to make sure the bounds are calculated correctly (otherwise the
check relating `UI_BLOCK_CLIP_EVENTS` in `ui_but_find_mouse_over_ex` wont
trigger properly.

Maniphest Tasks: T90364

Differential Revision: https://developer.blender.org/D12103
2021-08-03 13:20:50 +02:00
b35a96e195 Fix T90346: particle force field self effect amount off by one
When calculating the particle step in `get_effector_tot`, we have to
round up (otherwise we might get an extra round in the for-loop in
`BKE_effectors_apply` for certain cases).

Example from the report:
- 10.000 particles, Effector Amount 3
- was rounding the step down to 3333
- going into the for-loop for 0, 3333, 6666 and 9999 (4 times)
- now rounding the step up to 3334
- going into the for-loop for 0, 3334 and 6668 (3 times as desired)

Maniphest Tasks: T90346

Differential Revision: https://developer.blender.org/D12113
2021-08-03 13:07:46 +02:00
20d5d7b8ec Blender Readfile: Fix annoying useless Object reading error messages.
Extend the 'reading error' container to produce the generic short
message in the popup directly visible by the user, and move all detailed
info the `INFO` reports that only show up in the console and Info
editor.
2021-08-03 12:54:05 +02:00
c6f64d46ed Cleanup: USD importer, consistent naming of function parameter
Rename function parameter `flags` to `read_flag` in the declaration, to
be consistent with the definition.

No functional changes.
2021-08-03 12:44:16 +02:00
Michael Kowalski
ea54cbe1b4 USD: add USD importer
This is an initial implementation of a USD importer.

This work is comprised of Tangent Animation's open source USD importer,
combined with features @makowalski had implemented.

The design is very similar to the approach taken in the Alembic
importer. The core functionality resides in a collection of "reader"
classes, each of which is responsible for converting an instance of a
USD prim to the corresponding Blender Object representation.

The flow of control for the conversion can be followed in the
`import_startjob()` and `import_endjob()` functions in `usd_capi.cc`.
The `USDStageReader` class is responsible for traversing the USD stage
and instantiating the appropriate readers.

Reviewed By: sybren, HooglyBoogly

Differential Revision: https://developer.blender.org/D10700
2021-08-03 12:33:36 +02:00
28b9dd7b1f Cleanup: Remove redundant checks in File Browser UI script
Was already checking these preconditions in the poll method.
2021-08-03 12:25:38 +02:00
c0900a64ce Fix T90341: Crash opening 2.4 file with File Browser editor open
The file selection parameters (e.g. `context.space_data.params`) are
expected to be unset in certain cases. Reading 2.4 files seems to be one
of them. Hence, code using it should check it's set first. Also added an
assert to a File Browser UI template printing a message when the
parameters are unset, to help debugging the issue.
2021-08-03 12:25:38 +02:00
b1a607ce04 Cleanup: deduplicate type conversion logic 2021-08-03 10:38:37 +02:00
f8abc3fb2f Fix T85436: Separate by loose parts doesn't show new objects
Only the "changed" state from the last edit-object was used,
this meant the operator would not perform the necessary update
with multi-object edit-mode.

Use "changed" & "changed_multi" naming convention.
2021-08-03 18:13:06 +10:00
d6e97a53ab Correct task ID in 00b57136e4 2021-08-03 18:13:06 +10:00
b54e741a8b UI: Add light count to viewport statistics
Even though lights were part of `SceneStats`, they were not used when
rBfd10ac9acaa0 was committed.

This patch adds the light count back into the statistics. When a light is
the active object, it will display the total number of lights in the
scene, as well as how many lights are currently selected.

{F10141354}

Reviewed By: #user_interface, Severin, Blendify, harley

Maniphest Tasks: T88512

Differential Revision: https://developer.blender.org/D11387
2021-08-03 09:42:53 +02:00
00b57136e4 Revert "Fix spin-gizmo not allowing click events to select vertices"
This reverts commit 0b903755a9.

This caused T86030, left-mouse selection override clicking,
which is used for creating a full revolution.
2021-08-03 16:34:26 +10:00
Jeroen Bakker
6f50969406 Cleanup: Hide implementation details for ED_keyframe_keylist.
For T78995 we want to change the data structure of keylists to
improve performance. (Probably a Vector with bin-search capabilities).

This patch hides the internal structure of the keylists behind `AnimKeylist`
structure. This allows us to change the internals without 'breaking' where it is
being used.

The change adds functions to create, free, find and walk over the
keylist.

Reviewed By: sybren

Maniphest Tasks: T78995

Differential Revision: https://developer.blender.org/D11974
2021-08-03 08:10:21 +02:00
Jeroen Bakker
ebd55b4acd T90372: Assets: When dropping material use active material slot.
Currently when dropping an asset the first material slot is always updated.
This patch changes that logic to update the active material slot.

In future the behavior will be updated to use the material slot of the face under the cursor.
That requires better feedback tot he user.

Reviewed By: Severin

Maniphest Tasks: T90372

Differential Revision: https://developer.blender.org/D12056
2021-08-03 08:08:20 +02:00
Miguel G
a53feb0aff Fix T89691: Solidify modifier simple/complex inconsistency
Maintain the sign when clamping non zero offset.

Reviewed By: campbellbarton, weasel

Ref D11832
2021-08-03 16:00:32 +10:00
c1a477b497 Cleanup: use C++ comments or 'if 0' for commented code 2021-08-03 15:27:20 +10:00
1973fd89df Fix crash adding custom normals
Caused by error converting this file to C++
eccdced972.
2021-08-03 15:01:39 +10:00
04c75c5ce7 Edit Mesh: Correct normal calculation for "Set From Faces"
Setting normals from faces wasn't weighting the faces contribution
by the corner angle, giving lop-sided results in some cases.

This removes the epsilon check for CLNORS_VALID_VEC_LEN,
in favor of matching the behavior of vertex normals exactly.
2021-08-03 12:22:11 +10:00
223f048138 Fix annotations placement option in the Movie Clip editor
In rB6ee14c966d05362228511756c4906e043b87e346 the enum items were renamed/removed, this change was not propagated to this setting
2021-08-02 20:15:11 -04:00
efd7c95bb2 Cleanup: Remove duplicate special case check 2021-08-02 15:45:25 -04:00
a4813379f9 Fix T90042: Spline tangent calculation assert with coincident points 2021-08-02 15:43:37 -04:00
4f6f445120 Cleanup: Make spline settings copy function public
It will be useful in the spline type conversion node. Theoretically it
could become protected again if that conversion moves out of a node,
which might be a nice improvement after an initial version.
2021-08-02 14:21:19 -04:00
8b93265c19 Mesh: Tag normals dirty instead of calculating
Because mesh vertex and face normals are just derived data, they can
be calculated lazily instead of eagerly. Often normal calculation is
a relatively expensive task, and the calculation is often redundant
if the mesh is deformed afterwards anyway.

Instead, normals should be calculated only when they are needed. This
commit moves in that direction by adding a new function to tag a mesh's
normals dirty and replacing normal calculation with it in some places.

Differential Revision: https://developer.blender.org/D12107
2021-08-02 13:47:32 -04:00
a2203a27d9 Fix T90356: Frame selected includes active strip
Don't include active strip in this operator.

This was confusing due to name of operator and inconsistent with other
editors.
2021-08-02 18:51:00 +02:00
67d56eb71e Cleanup: Remove unused/unecessary OpenVDB C API
This commit uses OpenVDB more directly for the voxel remesher, without
the extra indirection of copying to a Blender API. This makes the code
simpler, shorter, and easier to understand (though I didn't observe any
performance improvement).

This also removes the rest of the unused and undocumented OpenVDB C API,
which was written when Blender's code didn't really use C++, and doesn't
serve a purpose anymore. Those features will be implemented as nodes in
the future anyway (see D12100).

Differential Revision: https://developer.blender.org/D12097
2021-08-02 12:26:28 -04:00
77187718e4 Fix T78469: Output Metadata: Strip Name no longer accessible
Caused by rB7fc60bff14a6.

This has actually been reported and closed, but that was clearly a
misunderstanding (above commit changed a checkbox to be an enum, but a
second checkbox was simply removed)

Maniphest Tasks: T78469

Differential Revision: https://developer.blender.org/D12084
2021-08-02 17:26:50 +02:00
eccd8af828 Revert "GHOST/X11: enable EGL"
This is causing issues for some users launching Blender, because EGL indirectly
requires GLVND, which is not installed by default on e.g. Ubuntu.

This reverts commit 0b18a618b8.

Fixes T90374

Ref D12034
2021-08-02 17:19:17 +02:00
1062649b5e Fix T87041: Driver Editor not updated in realtime
Caused by {rBbbb2e0614fc3}

Since above commit only the playhead is updated as an overlay in
animation playback (was moved out of drawing of the main region for
perfomance reasons).
The driver value "debug" visualization is very useful to have during
playback though but was left in main region drawing as part of
`draw_fcurve` (thus does not update in realtime anymore).

Moving `graph_draw_driver_debug` into the overlay is not feasible
because it requires animation filtering which has significant overhead
which needs to be avoided in the overlay which is redrawn on every UI
interaction.

Now tag the whole main region for updates in the Driver Editor during
playback instead (which will make the Drivers Editor as slow during
playback as before rBbbb2e0614fc3 -- but with realtime updates of the
debug visualization).

Maniphest Tasks: T87041

Differential Revision: https://developer.blender.org/D12003
2021-08-02 17:11:58 +02:00
3ff5d8f719 Asset Browser: Proper context menu for assets
Add a context menu dedicated to asset operations to the Asset Browser.
There are two separate context menus to keep things separated well and
avoid confusing if-else logic (similar to D12057 & D12059). Their polls
make sure they are displayed for the right contexts only.

Also (to be committed as followup cleanup): Remove now unused special
handling for assets in file delete operator.

Differential Revision: https://developer.blender.org/D12062
2021-08-02 17:00:20 +02:00
ceb049133c Asset Browser: Don't show inapplicable filter and display settings
So far the Asset Browser just showed the same popups and settings as the
File Browser. Not all of them made sense for the Asset Browser though.

* Don't show inapplicable recursion toggle.
* Don't show sorting options, which don't work with assets anyway.
* Don't show the Filter popover, there are currently no applicable items
  in there.

Just like in D12057, I decided to add separate classes for the Asset
Browser case.

Differential Revision: https://developer.blender.org/D12059
2021-08-02 17:00:20 +02:00
d8bf332f86 Asset Browser: Adjust header pulldowns to be Asset Browser specific
So far the Asset Browser just showed the same menus as the File Browser.
Not all of their entries made sense for the Asset Browser though. I
decided to just give them entirely different classes to avoid confusing
if-else checks everywhere. I think the code duplication this adds is a
minor issue, it's better to keep things seperated clearly IMO.

* View menu: Add "Asset Details" toggle for the sidebar region.
* View menu: Remove recursion sub-menu
* View menu: Remove "File Path" region toggle, which doesn't apply for
  the Asset Browser.

Differential Revision: https://developer.blender.org/D12057
2021-08-02 17:00:20 +02:00
James Monteath
0e4f7b4a4b Delete pipeline_config.json file. The yaml file is now used.
Update README.md.
2021-08-02 16:57:29 +02:00
1cf574dc39 Use pyrna_enum_value_parse_string 2021-08-02 10:19:23 -04:00
11cfa6c718 Fix T90332: Auto-smooth crashes in edit-mode
Regression in 39b2a7bb7e
that meant non-manifold edges were not being tagged
when they should have been.
2021-08-02 23:58:55 +10:00
6a5e97e379 Switch to C for the new file 2021-08-02 09:45:38 -04:00
a207c1560f Merge branch 'master' into refactor-idprop-ui-data 2021-08-02 09:41:39 -04:00
d60a7a8744 WindowManager: Support Dynamic tooltips when dragging.
Originally the operator name was drawn next to the dragging content.
After that there was an option to add custom, static text with the
dragging content. This patch allows dynamic text to be drawn.

The custom text was implemented as out parameter of the poll function
what made the code unclear. This patch introduces a tooltip function
that separates tooltip generation from the poll function.

NOTE: the text should always be returned in its own memory block. This
block will be freed after it is copied in the drag struct.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12104
2021-08-02 15:13:21 +02:00
8edb2222ae Cleanup: simplify subclassing CPPType
`CPPType` can wrap any C++ type so that code can work
with the wrapped type in a generic way. The goal of subclassing
`CPPType` is to provide additional methods for some types.
For example, the `CPPType` for `Array<int>` could have a `.element_type()`
method that returns the `CPPType` for `int`.
2021-08-02 12:44:17 +02:00
aa60416361 Revert "Asset Catalogs: loading a catalog definition file"
This reverts commit 1f0d6f7635 and the
cleanup 06cb48e1b2. Committed too early on
Monday morning, still has issues that should be resolved first.
2021-08-02 12:07:55 +02:00
06cb48e1b2 Cleanup: Asset catalogs, C++ to C-style comments
No functional changes.
2021-08-02 11:15:50 +02:00
1f0d6f7635 Asset Catalogs: loading a catalog definition file
Initial, limited implementation of loading a single asset catalog
definition file. These files are structured as follows:

  CATALOG_ID virtual/path/of/catalog
  SUBCATALOG_ID virtual/path/of/catalog/child
  SOMETHING_ELSE some/unrelated/hierarchy

These virtual paths will be used to show the catalog in a tree
structure; the tree structure itself is not part of this commit. Each
asset will have one catalog ID that determines where in that tree the
asset shows up.

Currently only a single catalog definition file can be read; merging
data from multiple such files, and writing them out again after changes
are made, is for future commits.

This commit only contains the code to load a single file, and unittests
to check that this actually works. No UI, no user-facing functionality
yet.
2021-08-02 11:08:02 +02:00
3fd5c93f9c Geometry Nodes: increase threshold to make regression tests pass
The real fix here is to use some kind of relative error in `customdata_compare`
instead of the absolute error used now. If vertex coordinates get larger in magnitude,
the allowed error should increase as well.
2021-08-02 10:38:11 +02:00
de91cdd930 Cleanup: separate base and geometry nodes specific socket cpp type
This simplifies changing how geometry nodes handles different socket types
without affecting other systems.
2021-08-02 10:34:50 +02:00
48722e8971 LineArt: Prevent depsgraph warning when camera is NULL. 2021-08-02 13:45:30 +08:00
1cf45fe10f Cleanup: spelling 2021-08-02 15:22:54 +10:00
40e3841939 Small cleanup 2021-08-02 00:15:47 -04:00
4877b0f742 Refactor new IDProperty UI data API (the changes described above) 2021-08-01 23:55:21 -04:00
3bbeb8543b Cleanup: Use BLI_assert_unreachable 2021-08-01 23:22:07 -04:00
Takahiro Shizuki
836aeebf70 IME Win32: Fix Duplicated Initial Character
When entering characters using IME on Windows, Japanese and Chinese
will both usually result in the first keystroke being duplicated. The
problem is that we are informed too late, after the first key is
pressed, that we are IME composing. This patch ensures we are entering
non-English characters using ImmGetConversionStatus() and then deals
with editing keys (like arrows and backspace) on a per-language basis.

see D11929 for more details.

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

Reviewed by Brecht Van Lommel
2021-08-01 11:52:22 -07:00
02fd6dda35 Merge branch 'master' into refactor-idprop-ui-data 2021-08-01 09:37:02 -04:00
79277986c2 Cleanup: Sort node types alphabetically 2021-07-31 23:22:36 -04:00
17243337d7 Cleanup: Remove unecessary helper function
Retrieving a mesh's looptris now take's a const mesh after
rB5f8969bb4b4, which removes the need for this function.
Since it's only two lines, avoiding the use of a separate function
in this case is simpler.
2021-07-31 14:26:01 -04:00
2f63303e25 Cleanup: Use const mesh arguments
These functions do not change their source or input mesh,  so it can
be passed with const, which means in one case that a function doesn't
have to be responsible for freeing its argument mesh, which is a clearly
better separation of concerns.
2021-07-30 23:26:35 -04:00
8063f10166 Cleanup: Remove unused includes 2021-07-30 22:28:25 -04:00
37e2fec090 Cleanup: Voxel remesh function naming
- Remove BKE prefix for static functions
- Make specific intermediate functions static
- Avoid unecessary "_to_mesh_nomain" suffix
2021-07-30 22:18:44 -04:00
7c961e716d LineArt: Fix(unreported): Child object respect collection visibility. 2021-07-31 10:02:47 +08:00
524908146c Cleanup: Reorder functions
The Quadriflow remeshing was in the middle of the voxel remesh code.
2021-07-30 21:51:47 -04:00
d91c266986 LineArt: Material flag versioning correction.
By the patch made it in master the version value already advanced (see https://developer.blender.org/D11839), so this versioning code needs to be moved down to that point.
2021-07-31 09:29:39 +08:00
e9dc6a0e09 UI: Show a notification when saving preferences
So far the only way to know if they were saved properly was
to check the terminal.

Also notify when preferences fail to save.
2021-07-31 03:15:10 +02:00
35894dc700 Cleanup: Simplify logic, follow style guide for integer types
- Use `int` instead of `unsigned int` for mesh indices
- Use C++ types (Array, float3, IndexRange)
- Use range based for loops
2021-07-30 15:08:43 -04:00
54bd5efa68 Fix build error in debug builds and uninitialized structs
This BMesh iterator hadn't been used in C++ code yet, and needed
a macro for a proper cast. The parameter structs need to be initialized
when declared without designated initializers.
2021-07-30 14:28:55 -04:00
549e2b7539 Compositor: Buffer iterators tests
See D11882 for a description of the iterators.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12001
2021-07-30 20:20:27 +02:00
d2675c3c5d Cleanup: unneeded default constructor definitions 2021-07-30 20:20:27 +02:00
5762e7a679 Compositor: Fix wrong number of threads during constant folding
The variable was uninitialized at that point of execution.
2021-07-30 20:20:27 +02:00
4dbf4eb100 Assets: Rename "Mark Asset" operator to "Mark as Asset"
This naming change was agreed on during the asset workshop. See
https://code.blender.org/2021/06/asset-browser-workshop-outcomes/#terms-definitions.
2021-07-30 20:18:22 +02:00
96fb21f3af UI: Move Mark/Clear asset out of ID Data in Outliner context menu
They are now always shown in the top-level of the Outliner context menu.
Having them in the ID Data submenu was just a hassle to work with, and
often confusing to users - even if technically correct (the asset status
is part of the ID data).

Part of T82680.
2021-07-30 19:41:19 +02:00
a9ea310d30 Cleanup: Move remesh files to C++
This will be helpful for some cleanups I'd like to do, including
removing the unecessary C API for OpenVDB and unifying some
attribute transfer code.
2021-07-30 13:15:01 -04:00
0b10a96474 Assets: Disable File Browser only operators for asset browsing
These operators shouldn't be available in the Asset Browser.

https://developer.blender.org/T83556

Added a comment to each operator poll assignment to explicitly mention
the intention. That should also remind devs to decide if the operator
should apply for both file & asset browsing when copy & pasting operator
definition code.
2021-07-30 19:07:51 +02:00
f7836019b3 Fix incorrect poll function used for file path dropping
The operator to drop file paths into the File Browser was just checking
if there's an active window. This wasn't really an issue since the
operator was only used as drop-operator for the File Browser. But the
operator would show up in the operator search. Plus, for asset browsing,
we'll also have to check the file browsing mode, so the more specific
poll function will be needed.
2021-07-30 19:07:51 +02:00
9ac782b823 Fix EGL version being printed on every startup
After the switch to enable EGL over GLX. No need to print this debugging
information always.
2021-07-30 18:44:26 +02:00
c1ec2e9d5f Cleanup: compiler warnings 2021-07-30 18:44:26 +02:00
3848507511 Cleanup: clarify license and origin of voronoi and dithering code 2021-07-30 18:44:26 +02:00
b90887da5a Cleanup: Refactor logic of file deletion poll callback
* Early exit instead of complex if-else blocks.
* Avoid iterating over entire file list.
* Use `true`/`false` for boolean values.
* Declare variables in smaller scopes.
2021-07-30 18:42:38 +02:00
3b2a6bf8e8 UI: Don't show Windows file association operator in search on other OSes
The Windows-specific "Register File Association" operator would show in
the search menu of other platforms. Decided to not disable it at
compile-time, like we do it with "Toggle System Console" (another
Windows-only operator), because that would require workarounds for the
translation tools. Instead the operator poll function always returns
false on unsupported platforms now.
2021-07-30 16:43:05 +02:00
3316e28418 Preferences: Move "Register File Association" to preferences level
The operator was register as a "file" operator, which are by convention
used for File Browser operators only. Move it to the "preferences"
operators, where it's displayed in the UI too.
2021-07-30 16:25:34 +02:00
e7e9364d23 Cleanup: remove disabled code from property lookup
This allowed custom ID-properties to share a name-space
with regular properties which won't work well as the names may collide.
2021-07-31 00:23:23 +10:00
4c3d4ebefc Cleanup: remove redundant ifdef check
The define that was tested no longer exists.
2021-07-31 00:15:23 +10:00
eb2a6f454b Fix T90318: Dragging asset while Asset Browser is still loading crashes
This partially reverts cb0b017d8f: We can't store the asset handle in
the drag data, because the file pointer it wraps may be freed as the
Asset Browser generates its file list.
2021-07-30 15:54:54 +02:00
4647ffd918 Cleanup: Remove unused file description storage
This isn't used at all in the current File and Asset Browser design.
2021-07-30 14:34:33 +02:00
c8b7745172 Cleanup: headers, use 'pragma once', remove argument to '\file' 2021-07-30 22:29:30 +10:00
5aa45c43f2 Cleanup: missing leading '*' from comment blocks 2021-07-30 22:20:31 +10:00
88e774aa34 Cleanup: workaround for unstable formatting in clang-format
Running multiple times would re-indent differently.
2021-07-30 21:56:14 +10:00
Flix
a787bcbf5c Fix: script.reload() operator reloads current app template
Ref D12040
2021-07-30 21:43:22 +10:00
James Monteath
8796a2827f Update REAME.md file 2021-07-30 13:40:48 +02:00
b98735ec29 Kernel: include header file in BKE_appdir.h defining size_t
In `BKE_appdir.h`, include `<stddef.h>` as that defines `size_t`. This
follows the "include what you use" principle, and makes it possible to
use `BKE_appdir.h` without having to bother with its dependencies.

No functional changes.
2021-07-30 13:16:14 +02:00
020431408f Cleanup: limit scope of temporary variables
Also remove early return as it duplicates cleanup calls.
2021-07-30 16:44:39 +10:00
93eb460dd0 Cleanup: clang-format (re-run after v12 version bump) 2021-07-30 16:19:19 +10:00
f81a6a2ff1 Cleanup: spelling in comments 2021-07-30 16:16:38 +10:00
63f7eceb53 PyAPI: defer freeing existing properties on registration
Registering a property could remove the existing property,
then fail to parse one of the arguments of the new property -
leaving the struct without a property.

Now freeing the existing property is deferred until immediately
before the new property is registered.
2021-07-30 16:04:08 +10:00
d06b03f80d PyAPI: include the property name & type in registration errors
This gives useful context in errors,
also remove newline endings from exceptions.
2021-07-30 16:04:00 +10:00
9764d90fda Cleanup: use pyrna_enum_value_parse_string parser for enum args 2021-07-30 16:03:56 +10:00
228edcaedd Cleanup: bpy.props variable names
- Use `default` instead of `def` abbreviation.
- Rename `BPYPropArrayLength` to `BPyPropArrayLength`
  in keeping with other local structs.
- Remove _PyArg_Parser.fname value accidentally left in
  (harmless as it's not used).
2021-07-30 16:03:52 +10:00
a2b8dad469 PyAPI: support accessing the original value for RNA enum parsing
Needed in siturations when the input argument is needed for exception messages.
2021-07-30 16:03:47 +10:00
ddcb6b1023 Cleanup: replace macros with converter callbacks for bpy.props
Macros were used for expanding shared logic for some properties.

Replace this with Python converters & a funciton that handles
deferred registration.

Add generic converter functions for RNA enums:

- pyrna_enum_value_parse_string
- pyrna_enum_bitfield_parse_set
2021-07-30 11:57:43 +10:00
5280d4bf0b GPencil: Fix unreported problems painting after import SVG
After doing an import, the bounding box of the stroke was not calculated and any operation related to brushes (Sculpt, Weight Paint and Vertex Paint) was not working as expected because the bounding box of the stroke was wrong.

This problem was solved automatically after any edit operation, but must be solved in the import process.
2021-07-29 22:30:48 +02:00
8f05520083 Fix T89213: Some modifier properties have wrong subtype
This commit resolves these RNA warnings:
```
offset: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65536' matches no enum in 'FloatProperty', 'offset', 'subtype'
project_limit: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65536' matches no enum in 'FloatProperty', 'project_limit', 'subtype'
falloff_radius: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65567' matches no enum in 'FloatProperty', 'falloff_radius', 'subtype'
```
2021-07-29 17:16:08 -03:00
0b18a618b8 GHOST/X11: enable EGL
This will replace GLX with EGL for X11. GLEW does not support GLX and EGL
at the same time. Most distributions build GLEW with GLX support, so we
have to use the externally provided GLEW and build with EGL support.
This effectively sets WITH_SYSTEM_GLEW to OFF for all Linux configurations.

Differential Revision: https://developer.blender.org/D12034
2021-07-29 17:39:55 +01:00
c7b12e31e6 Fix T89976: Mirror Keys By Value performs wrong scale conversion
In the graph editor, Mirror Keys by Value would convert the value to mirror
over, to account for different units for linear & rotational properties.
The conversion was done in the different direction, though, resulting in
values that were too large by a factor of (180/pi)^2.
2021-07-29 18:34:10 +02:00
cae18abef4 deps/win: Remove media foundation dep for ffmpeg
This caused a blender load error on windows N,
given we do not use these codecs they can safely
be disabled.

This will fix T90200 once the new libraries are
in SVN
2021-07-29 10:21:43 -06:00
8f12457c25 Fix T90295: inconsistent render pass order between Cycles and Eevee 2021-07-29 17:59:03 +02:00
0b0c2901f6 Render: remove unused Blender Internal view layer settings
These should have been removed earlier but were forgotten.
2021-07-29 17:59:03 +02:00
646f7ef73c Render: disable Z pass by default, leave only Combined
It was somewhat arbitrary to have this one pass enabled that adds a bit of
additional memory and render time overhead, even though it's not necessarily
more important than others.
2021-07-29 17:59:03 +02:00
2d3e5eda3f Assets/UI: Resolve major asset view UI template limitation
Before this, all asset view templates showing the same asset library
would show the same assets, even if they should show different ID types.
That was a major limitation since the design did forsee that this
template can be put anywhere in the UI to display various sub-sets of
assets.

Initially I did the ID type filtering close to the asset-list reading,
because I wanted to optimize reading so that we would only actually read
asset information from disk of the ID type to be shown. But this will be
quite complex and I'm not sure if I'll get to work on this anytime soon.
So this commit moves the filtering to the template display level solving
this limitation.

Note: This also adds the code to filter by tags, together with the ID
type. But it's not actually used anywhere yet.
2021-07-29 17:35:06 +02:00
8cb4e3d046 Cleanup: Remove unnecessary code for asset view UI template
From what I can tell there is no reason anymore to do this. The design
has changed since this was added.
2021-07-29 17:35:06 +02:00
49c0b9ec43 Assets/UI: Sanity check argument for UILayout.template_asset_view()
Was already doing some sanity checks, but wasn't checking if the passed
property actually is a collection property, which is important.
2021-07-29 17:35:06 +02:00
5be54cce36 Cleanup: Pass asset handle to asset iterator, rather than wrapped file
This iterator was introduced before `AssetHandle` existed, so it was
dealing with the file data directly. Now we want as little code as
possible to deal with the file data, all access should happen via the
`AssetHandle`.
2021-07-29 17:35:06 +02:00
b361b2f214 Cleanup: Consistent indent style for asset CMakeLists file
Was mixing 4 and 2 space indent in a single file.
2021-07-29 17:35:06 +02:00
33322086f6 install_deps: update OIDN to 1.4.1, and ISPC to 1.16.0.
Ref. T88438.
2021-07-29 17:00:49 +02:00
ceec7cabf5 install_deps: Update OSL to 1.11.14.1.
This has been a huge pain to get working, for several reasons (new flags
needed, patching is now mandatory, etc.).

Further more, discovered that debian OIIO package is now silently
relying on OpenCV, without even proper handling of this dependency (at
least in the `-dev` package), so had to revert to force-build own OIIO
again on that distro for the time being.

Ref. T88438.
2021-07-29 17:00:48 +02:00
b60e72100b Cleanup: OSL buildlib patch: Remove .rej part.
This patch contained changes for an `.rej` rejection file generated by
failed patch apply... Definitly nothing to do here.
2021-07-29 17:00:48 +02:00
21b4799793 install_deps: Update OIIO to 1.1.15.1.
Ref. T88438.
2021-07-29 17:00:48 +02:00
bd2bfa469f install_deps: Update llvm to 12.0 (with minimal now being 11.0).
Ref T88438.
2021-07-29 17:00:48 +02:00
12d93e44d0 Install_deps: add flex dependency.
Was already installed on Debian-like and Fedore/Suse actually, now also
explicitely required on Arch and listed in docs.

Ref. T88438.
2021-07-29 17:00:48 +02:00
4d28703277 Install_deps: Add zstd dependency.
Ref T88438.
2021-07-29 17:00:48 +02:00
Germano Cavalcante
1775c39986 Fix 'BLI_task_parallel_mempool' keeping 'user_chunk' unchanged
When `BLI_task_parallel_mempool` does not use threading, the
`userdata_chunk` is allocated locally simulating a TLS.

However `func_reduce` is not called so the original chunk is ignored.

`task_parallel_iterator_no_threads` is another function that doesn't call
`func_reduce`. It also ignores `userdata_chunk_local` in the main iterator.

The solution in these cases is not to create a `userdata_chunk_local`.

This fixes T90131

Differential Revision: https://developer.blender.org/D12067
2021-07-29 11:37:10 -03:00
0f1c84f171 deps: Reduce llvm/clang footprint for windows
We shipped the whole bin folder for llvm/clang
while we only needed clang-format, by shipping
just the bits we need we save about 700 megabytes
off our svn lib download.
2021-07-29 07:45:38 -06:00
cafb1bc47f Data-block Preview: Create preview using current frame
The preview was always using frame 1, but maybe the object has changed and it's better create preview using the current frame.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12018
2021-07-29 15:08:12 +02:00
24ba931f40 Cleanup: Remove debug-only code 2021-07-29 14:46:54 +02:00
810c88b5f1 Fix building without Cycles logging
Ideally can use assert() checks instead of suppressing the check entirely,
but for now just fix compilation error quickly.
2021-07-29 14:32:10 +02:00
3f84f0123e Cleanup: Fix build warning
Introduced in 3964785a14
2021-07-29 13:11:55 +02:00
jim man
9cc8d50a04 cleanup: editor_image : Remove unused draw functions
These functions are unused currently..

Reviewed By: deadpin, jbakker

Differential Revision: https://developer.blender.org/D11968
2021-07-29 12:46:24 +02:00
5116b7a4c2 Fix Cycles crash with fluid object motion blur disabled
Motion attributes expects mesh to have non-zero number of motion steps,
which was violated in the case when fluid mesh had motion blur disabled.

This is a bit of annoying fix, because of the order of updates. More
ideal solution would be to handle cached and fluid velocities in the
sync_mesh_motion() which ensures all the dependencies between settings.
2021-07-29 12:28:46 +02:00
0491052a96 VSE: Change grid line drawing
Add overlay option to disable grid drawing.
Reuse drawing code from other editors (timeline editor)
Add argument `display_minor_lines` to function
`UI_view2d_draw_lines_x__discrete_frames_or_seconds`
This way minor line drawing can be disabled and so it doesn't cause
too much visual noise. Also spacing seems to be too fine, so VSE uses 3x
what is defined in preferences.

Reviewed By: fsiddi, Severin

Differential Revision: https://developer.blender.org/D11790
2021-07-29 11:38:43 +02:00
5c9979ff03 VSE: don't snap by default
Snapping by default goes against convention, so this setting was
re-evaluated. Also snapping by default can conflict with new image
transform system, see T90156

There wasn't consensus, so disable snapping by default to follow
established convention.

ref T89665

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12054
2021-07-29 11:38:43 +02:00
3964785a14 UI: Fix time labels drawing
Calculate frequency of time/frame label drawing, such that labels have
at least 10px margin and don't overlap.

Change timecode format:
- Use at least `mm:ss` format
- Don't display frames if all labels would end with +00

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D11792
2021-07-29 11:38:43 +02:00
a70f37bd8a Fix T89952: GPencil channel box selection offset
The channel box selection was offset for grease pencil layers.

This is a proposed fix by @yann-lty

Before:
{F10227973}

After:
{F10227974}

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T89952

Differential Revision: https://developer.blender.org/D11962
2021-07-29 10:42:05 +02:00
d5fd09ab58 Fix memory leaks in Python gizmo get/set handlers 2021-07-29 14:32:25 +10:00
3c50687073 Fix gpu.types.GPUTexture crash when the size argument was too big
Missing length check on the size argument before copying it
into a fixed size buffer.
2021-07-29 14:11:37 +10:00
fd0b2b8dfd Cleanup: use PyC_AsArray_FAST function where possible
Oversight in 2453dc1b0e.
2021-07-29 13:41:48 +10:00
bc0a7d3fae PyAPI: support multi-dimensional arrays for bpy.props vector types
- Multi-dimensional boolean, int and float vector types are supported.
- A sequence of int's for the "size" is used to declare dimensions.
- Nested sequences are required for default arguments.

Now it's possible to define matrix properties, for e.g:

  bpy.props.FloatVectorProperty(size=(4, 4), subtype='MATRIX')
2021-07-29 11:09:21 +10:00
2453dc1b0e PyAPI: add multi-dimensional array conversion utility functions
Add array conversion functions that take dimension arguments.

- PyC_AsArray_Multi (version of PyC_AsArray).
- PyC_Tuple_PackArray_Multi_* (version of PyC_Tuple_Pack_*).
2021-07-29 11:04:33 +10:00
0358951b9e Cleanup: spelling 2021-07-29 10:52:08 +10:00
8aa1c0a326 Fix T75028: Improved Font Names in File Manager
When viewing font files in the File Manager, this patch uses the font's
family and style names to show the same type of string shown to users
in operating system lists. For example "Book Antiqua Regular" instead
of "BKANT.ttf"

see D12020 for details and examples.

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

Reviewed by Campbell Barton and Julian Eisel
2021-07-28 11:16:04 -07:00
073bf8bf52 Cycles: remove WITH_CYCLES_DEBUG, add WITH_CYCLES_DEBUG_NAN
WITH_CYCLES_DEBUG was used for rendering BVH debugging passes. But since we
mainly use Embree an OptiX now, this information is no longer important.

WITH_CYCLES_DEBUG_NAN will enable additional checks for NaNs and invalid values
in the kernel, for Cycles developers. Previously these asserts where enabled in
all debug builds, but this is too likely to crash Blender in scenes that render
fine regardless of the NaNs. So this is behind a CMake option now.

Fixes T90240
2021-07-28 19:27:57 +02:00
3bf9675849 Cleanup: Remove unnecesary undefs
Macros `SEQ_ALL_END` and `SEQ_ALL_BEGIN` no longer use `seq->tmp`.
Therefore they are safe to use regardless from where they are called.
2021-07-28 18:16:48 +02:00
40ef71f465 Assets: Improve error message when "Clear Asset" fails
When using "Clear Asset" from the Asset Browser but with an asset
selected that is not stored in the current file, we can show a more
informative error message.
2021-07-28 18:05:25 +02:00
0088b412ff VSE: Fix audio not recalculated
Changing strip offsets with RNA properties didn't tag depsgraph to
update for new strip start/end points.
2021-07-28 17:45:22 +02:00
08154d237f Cleanup: VSE cache invalidated twice
Multiple RNA update function invalidated cache twice.
2021-07-28 17:20:23 +02:00
Wannes Malfait
b304616f2a Fix T90221: geometry viewer node links to other socket types
The viewer node in geometry node trees only supports geometry nodes.
This patch ensures that when ctrl shift clicking on a node, it will only
link to geometry sockets.

Differential Revision: https://developer.blender.org/D12055
2021-07-28 15:54:17 +02:00
3db37075f6 Remove the code in BKE_collection_move to preserve LayerCollection flags.
This code was actually buggy (forcefully re-enabling excluded layers in some
cases).

Further more, it should not be needed now that layerCollection resync code
reuses as much as possible existing layers instead of deleting and
re-creating them all the time.

Differential Revision: https://developer.blender.org/D12016
2021-07-28 15:51:06 +02:00
b18d0244fc LayerCollection: Refactor of resync-with-Collection-hierarchy process.
The goal of this refactor is to improve resync of LayerCollections
hierarchy to match again Collection one.

Current code would destroy and re-create valid layers whenever a parent
collection would be removed, which leads to losing way too often
layer-related settings when editing collection hierarchies.

While this could be partially addressed from operators side, there was
no way to fix those issues from lower level, more generic ID management
code like ID remapping or library override resync processes.

The new code builds a shallow wrapper around existing (aka old) layers
hierarchy, does a set of checks to define the status of all existing
layers, and try to find the closest matching unused layer in cases where
layers and collections hierarchies do not match anymore.

The intent is to both re-use as much as possible existing layers, and
to pick the 'best' possible layer to re-use, following those heuristics:
 * Prefer layers children of current one first (in old hierarchy), and only
   use those from other higher-level hierarchies if no (grand-)child is found.
 * Prefer to use closest layers available in the old hierarchy.

NOTE: The new code is about 12%-15% slower than the previous one, which is
expected given the increased complexity. Note that this would not be an
issue in practice if this code was not called way too often (needs to
be converted to lazy update instead, which is a long known TODO).

NOTE: The LayerCollectionResync code uses its own built-in version of
FIFO queue, as performances in this code is currently a critical point
(it can get called tens of thousands of times during a single (heavy)
ID management operation currently, in a production file e.g.).

Differential Revision: https://developer.blender.org/D12016
2021-07-28 15:51:06 +02:00
Wannes Malfait
31fcb934a4 Fix T89415: update multi input indices after deleting a node
When deleting a node, links attached to that node are deleted, but if one
of those links was connected to a multi input socket, the indices of the
other links connected to it were not updated. This adds updates both in
the case of a normal delete as well as after a delete with reconnect.

Differential Revision: https://developer.blender.org/D11716
2021-07-28 15:43:24 +02:00
f9308a585e Fix particle system duplication duplicates all systems
Followup to rB3834dc2f7b38 (where getting the proper particle system was
fixed for the Adjust Last Operation panel in the Properties Editor). But
since this operator can also be called from the 3DView, get a current
particle system there as well.

Without this, _all_ particle systems would be copied when executing from
the 3DView (which was never really intended [operator description uses
singular] -- it just happens to use `copy_particle_systems_to_object`
internally as well -- same as the `Copy Active/All to Selected Objects`
operators)).

ref. T83317

Maniphest Tasks: T83317

Differential Revision: https://developer.blender.org/D12033
2021-07-28 15:06:35 +02:00
dfc597202f Fix T90154, T90213: curve issues since recent cleanup commit
Caused by {rB8cbff7093d65}.

Since above commit only one modifier would get calculated and the
displaylist boundingbox was calculated wrong.

Maniphest Tasks: T90154

Differential Revision: https://developer.blender.org/D12037
2021-07-28 14:59:50 +02:00
7d0765cbdc Fix menu poll function being ignored for UILayout.menu
Using `UILayout.menu()` [1] or `UILayout.menu_contents() [2], the menu
would just always be added, the `poll()` check not being executed. As
API user I would expect the `poll()` to deterimine visiblity of the
menu.

[1] https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.menu
[2] https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.menu_contents

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

Reviewed by: Campbell Barton
2021-07-28 14:44:45 +02:00
8e9d06f5a0 LineArt: Camera Overscan
Expand camera effective region to a portion beyond image frame so strokes won't end right at the border.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12049
2021-07-28 19:55:29 +08:00
544ddcdaac Fix (studio-reported) liboverride resync crash after recent changes.
Recent own rBabf3ce811f6e prevented any LayerCollection update during
the whole liboverride resync process, for both performances and feature
reasons.

However that means that the various runtime caches like the Base GHash
are not cleared anymore during ID remapping process, so we need to call
`BKE_main_collection_sync_remap` instead of `BKE_main_collection_sync`
when we finally are ready for this update.

Reported by @eyecandy (Andy Goralczyk) from Blender studio, thanks!
2021-07-28 12:33:16 +02:00
91dd1a1ba3 VSE: Add tooltips for add_effect_strips operator
This patch adds propper tooltips to the effect strips in the "Add" menu.
Note that not all effect strips are actually in the "Effect Strips"
submenu like color strips, text strips or transitions. For these types
of effect strips, a dediacted tooltip is especially useful.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D11714
2021-07-28 10:16:43 +02:00
ce68888d1b Cleanup: reduce indentation in bpy.props
Remove unnecessary NULL checks.
2021-07-28 13:38:35 +10:00
f5cc348610 VSE: Draw strips transparent during transform overlap
While transforming a strip, draw the background semi-transparent
if it overlaps with another strip. It's convenient to see what's
underneath, especially with the upcoming Overwrite feature.

Thanks to @iss for the help and review.
2021-07-27 20:14:22 +02:00
ae034d27d2 Deps: ensure osl/bin/oslc is using static libpng
Pass `-DLINKSTATIC=ON` to the OSL CMake, to ensure it statically links to
our libpng. Previously this was only applied on Windows, it's now on all
platforms.
2021-07-27 19:49:29 +02:00
7e91a60be6 Add StringRef::trim() functions
Add three functions that trim characters from the front & end of a
`StringRef`. All functions return a new `StringRef` that references a
sub-string of the original `StringRef`.

- `trim(chars_to_remove)`: strips all characters from the start and end
  that occur in `chars_to_remove`.
- `trim(char_to_remove)`: same, but with a single character to remove.
- `trim()`: remove leading & trailing whitespace, so same as
  `trim(" \r\n\t")`

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12031
2021-07-27 19:49:29 +02:00
c6ba7359ae Fix LLVM 12 symbol conflict with Mesa drivers, after recent Linux libs update 2021-07-27 17:45:17 +02:00
f4abd3cfc4 Fix LibOverride crashing in some cases where reference linked data gets MIA.
When the root of an override hierarchy disapears, there is no way to do
a proper resync, just abort.

Reported by studio, thx.
2021-07-27 17:41:15 +02:00
Himanshi Kalra
4a02b9ffeb Regression Testing: Running tests based on blend files
Runs tests based on blend files with minimum python interaction.
Developed as part of GSoC 2021 - Regression Testing of Geometry Nodes.
Earlier, tests were built from scratch by adding a modifier/operation
from the Python API.
Now, tests can also be created inside blender and are compared using
Python script.

Features: Automatically adding expected object if it doesn't exist.
This patch adds tests for the following Geometry Nodes category:
* Curves
* Geometry
* Mesh
* Points

The implemented UML diagram for refactoring of mesh test framework.
{F10225906}

Technical Changes:
SpecMeshTest: It adds the modifier/operation based on the Spec provided.
BlendFileTest: It applies already existing modifier/operation from the blend file.

Test folders hierarchy with tests. This folder should be extracted to `lib\tests\modeling`
{F10240651}
Note: The `geometry_nodes` folder might lie under another `geometry_nodes` folder while extracting, please double check. Use the inner-most one.
The hierarchy should be:
-`lib\tests\modeling\geometry_nodes\mesh`
-`lib\tests\modeling\geometry_nodes\points`
and so on.

* From `ctest` the tests should be run as `ctest -R geo_node -C [Configuration]` on Windows.
* Each single test can be run with its entire name e..g `ctest -R geo_node_geometry_join_geometry`.(just an example). Run `ctest -N -R geo_node` to see all tests.
* From blender, the tests can be run `blender -b path\to\blend\file --python path\to\geo_node_test.py`

Reviewed By: zazizizou, JacquesLucke

Differential Revision: https://developer.blender.org/D11611
2021-07-27 21:01:15 +05:30
d6d44faff0 Fix memory leak with Python RNA property get callback errors
Failure to return a list of the expected size & type wasn't
decrementing the value, leaking a reference.

Caused by 127b5423d6 a workaround for the
real error that was fixed f5e020a7a6.
2021-07-28 01:12:26 +10:00
Charlie Jolly
766e67e55d Geometry Nodes: Add node labels to Attribute maths nodes
This adds the operator name to the node label which is consistent with the shading nodes.
The vector node has `Vector` as a prefix.

The Attribute nodes already have a different coloured header.

The same label is used when collapsing nodes, this helps readability.

Reviewed By: pablovazquez

Differential Revision: https://developer.blender.org/D10749
2021-07-27 14:34:08 +01:00
07688ca2d2 Added YAML builtbot config file.
Builtbot is switching over from json to yaml. Both
configuration files should be kept in sync for now.

The json file will be removed when everything works as expected.
2021-07-27 15:06:43 +02:00
db4fe8e322 BlenRead: Add GHash-based search for already read linked IDs.
Ths commit adds a new `IDNameLibMap` to `Main`, used during file reading
to quickly find already read linked IDs.

Without that, search would use string-based search over list of linked
data, which becomes extremely slow and inneficient in cases where a lot
of IDs are linked from a same library. See also {T89194}.

Extrem-usecase reported in T89194 is now about 4 times faster in linked
data reading (about 2 times faster for the whole .blend file loading).

More normal cases (like Sprites studio production files) have barely
measurable speed improvements, a few percents at best.

NOTE: `main_idmap` API was extended to support insertion and removal of
IDs from the mapping, avoids having to re-create the whole thing several
time during libraries expansion in readcode.

Differential Revision: https://developer.blender.org/D11757
2021-07-27 14:53:49 +02:00
e37c876cd7 PyAPI: support different int sizes for PyC_AsArray 2021-07-27 22:38:50 +10:00
58eacb8e7c Cleanup: pass sizeof array element to PyC_AsArray
Replace the is_double argument which was only used for single/double
precision floats.

This allows supporting different sized int types more easily.
2021-07-27 22:36:01 +10:00
b1a2abd6b2 Fix missing passes update on Use Denoising change
Makes it so Render Layers node in the compositor is updated as soon
as Use Denoising is changed for the final render.

Differential Revision: https://developer.blender.org/D12010
2021-07-27 11:48:14 +02:00
c5e5ac4a17 Deps builder: OIIO/OSL/ISPC/OIDN/LLVM/Flex updates
This diff somewhat snowballed out of updating OIDN to 1.4.1 it had some
changes that allowed us to remove the arm hacks we had in place and
revert to using identical versions for a whole bunch of deps. But that
required an update to ISPC which needed a newer LLVM and if we're
updating LLVM we may as well update OSL, and when we update OSL, OIIO
may as well be dragged in soo......anyhow...

This diff updates:

LLVM 9.0.0 (11.0.1 for mac/arm) -> 12.0.0
OIIO 2.1.15.0 -> 2.2.15.1
OSL 1.11.10.0 -> 1.11.14.1
winflex_bison 2.5.5-> 2.5.24 (ispc needed newer bison, windows only dep)
OIDN 1.4.0 -> 1.4.1
ISPC v1.14.1(random hash for mac/arm) -> v1.16.0
Flex 2.6.4 (ISPC needed newer Flex than available on CentOS 7)

and removes most of the "special arm/mac" versions. I think just ssl and
embree are left with special versions.

notable changes:
@LazyDodo included some clang headers in the linux/mac harvest which are
needed to start writing custom clang based tooling like D9465 these were
already shipping on windows, but not the other platforms.

[macOS] Change the `LC_ID_DYLIB` of OpenMP  for {D11997}. This changes
where the executables look for dylibs.

Reviewed By: sebbas, LazyDodo

Differential Revision: https://developer.blender.org/D11748
2021-07-27 10:15:31 +02:00
5a07174ce3 Cleanup: add note from T85517 fix 2021-07-27 18:14:08 +10:00
b331acf477 Cleanup: comment spelling & punctuation 2021-07-27 18:06:29 +10:00
675d8a9c43 LineArt: Occlusion accuracy fix.
This patch fixes occlusion function to handle one specific case (when an edge shares a point with triangle) better,especially when there's overlapping edges in this case.
2021-07-27 14:02:34 +08:00
Aaron Carlisle
6ee14c966d Anotations: Fix a several issues with stroke placement
Previously, this option was not exposed in the UI, only for the clip editor.
There were also multiple rna properties that did the same thing for each of the 2D editors.

There was also an issue where the property enum items were the same as the 3d view which didnt make much sense.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D12027
2021-07-26 18:53:30 -04:00
05315af81d Fix compile error on macos introduced in last commit
std::optional::value() is not available on macos.
2021-07-26 22:44:56 +02:00
Christoph Lendenfeld
6a903d9088 Fix: Instantly hide bones after hitting H key in pose sliding
When using a pose slider it is possible to hide bones with the 'H' key.
Before this patch the screen didn't update, so you had to move the mouse 1 pixel to update.
This patch makes it so it updates right away

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12024
Ref: D12024
2021-07-26 21:42:04 +01:00
a4a72bffd3 Compositor: Full frame Box Mask node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11627
2021-07-26 21:43:30 +02:00
e33814ef6b Compositor: Full frame Levels node
Adds full frame implementation to this node operations.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11749
2021-07-26 20:13:55 +02:00
883fb49d4f Compositor: Fix memory leak when exporting operations on debug 2021-07-26 20:13:03 +02:00
a117794f8c Compositor: Full frame Scale node
Adds full frame implementation to this node operations.
No functional changes.

Includes a new operation method `init_data` used to initialize any data
needed after operations are linked and resolutions determined.
Once tiled implementation is removed `initExecution` may be renamed
to `init_rendering` and `init_data` to `init_execution`.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11944
2021-07-26 20:13:03 +02:00
cf74cd9367 Cycles: upgrade CUDA to 11.4
This fixes a performance regression on Ampere cards, on specific scenes like
classroom. For cycles-x there is little difference, but this is still helpful
for LTS releases, and we need to upgrade at some point anyway.
2021-07-26 19:46:51 +02:00
Nikhil Shringarpurey
6eb94d8df2 Cleanup: fix compiler warnings due to implicit cast
Differential Revision: https://developer.blender.org/D11950
2021-07-26 18:04:40 +02:00
22b03e1c68 Fix Python error in benchmark executable detection after recent changes 2021-07-26 18:04:40 +02:00
abf3ce811f LayerCollections: Add a way to prevent their resync with Collection hierarchy.
This is an easy & safe, yet not-so-nice way to address the
LayerCollections vs. Collections hierarchy resync problem.

Currently this resync is enforced everytime something changes in the
Collections hierarchy, which is extremely inneficient, and can even
produce 'loss' of LayerCollection data during complex Collection
processes.

Current example is during Library Overrides resync process. New code:
 * Makes resync significantly faster (between 10 and 15%).
 * Fixes 'disappearing' layer collections settings on sub-collections'
   layers.

NOTE: This is not a proper fix for the underlying issue. However,
implementing and testing the 'lazy update' solution as proposed by
{T73411} requires a significant amount of time (especially in testing
and tracking all places where code would need to ensure LayerCollections
are up-to-date), which is not possible currently.

Differential Revision: https://developer.blender.org/D11889
2021-07-26 17:36:46 +02:00
cee67f3be2 Cleanup: Fix compiler warning in previous commit 2021-07-26 17:25:56 +02:00
a14ee85ccd Fix T90127: Merge Down layer doesn't take the transform location into account
Now the layer transformation is applied before the merge.
2021-07-26 17:20:00 +02:00
231b313c55 Mantaflow: Remove Noise Type Option
Mantflow only supports wavelet noise, thus the parameter with only one option is no longer useful.

Differential Revision: https://developer.blender.org/D6770
2021-07-26 10:59:49 -04:00
Germano Cavalcante
3059853732 Cleanup: Rearrange mesh extraction files
In the draw module, it's not easy to identify what its header is, and
where the shared functions are.

So move `draw_cache_extract_mesh_extractors.c` and
`draw_cache_extract_mesh_private.h` to the same folder as the extractors
and rename these files to make them more identifiable.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11991
2021-07-26 10:25:39 -03:00
a9121640be macOS Cleanup: Remove old version specific code
Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D12021
2021-07-26 18:39:08 +05:30
14f94fd1ca VSE: Fix snapping bugs
Fix hold offset check causing missing snapping point when strip have
only still frames.

Fix effect strips of transformed strips causing snapping to prevoius
strip positions.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11948
2021-07-26 14:57:13 +02:00
1b53fde9fc Cleanup: missed comment in D12029
No functional change.
2021-07-26 13:25:57 +01:00
71d7505487 Geometry Nodes: Fix vector math project bug
Implementation is incorrect compared to Cycles/Eevee.

Reported by @DrDubosc in comments of T88922.

Differential Revision: https://developer.blender.org/D12029
2021-07-26 13:06:15 +01:00
a0cba9fb95 VSE: Fix truncated label
Label for snapping current frame to strips was cut off and not very readable.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11951
2021-07-26 12:57:48 +02:00
faa65f151d Revert "cmake: enable Wayland by default"
This reverts commit a2ccd0e495.

This change was part of the still-under-review patch D11489, which
hasn't been accepted yet.
2021-07-26 12:18:53 +02:00
c17a266e29 Revert "GHOST/wayland: use Wayland only when 'BLENDER_WAYLAND' is set"
This reverts commit c971c851d3.

This change was part of the still-under-review patch D11489, which
hasn't been accepted yet.
2021-07-26 12:16:42 +02:00
Stefan Werner
1a3cb90e4e Cycles: Fixed memory leak in ColorSpaceManager
Cached OCIO processors were not freed, instead the color spaces were freed twice.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D12011
2021-07-26 11:45:29 +02:00
12afb19959 Cleanup: clang tidy 2021-07-26 11:43:51 +02:00
Himanshi Kalra
6abf63f463 Fix T85517: Cannot type Space while holding Shift key in text-field like spaces.
Fix for T85517
Bug: Couldn't type space while holding down the shift key in text spaces (e.g. when saving a file, changing the name of object).

Changes: Removing the key combination of Shift + space in `WM_event_is_ime_switch` method.

Reviewed By: harley, mont29

Maniphest Tasks: T85517

Differential Revision: https://developer.blender.org/D10452
2021-07-26 09:33:03 +02:00
501bca9f5b Cleanup: clang-format 2021-07-26 12:41:49 +10:00
828c66f393 Cleanup: spelling in comments 2021-07-26 12:32:42 +10:00
471d4b105a Cleanup: use doxy comments 2021-07-26 12:32:40 +10:00
a77d203932 UI: Line Art: Rename "Baking" panel to "Bake"
Avoid using verbs for panel names, and be consistent with the
"Bake" panel in Cycles, Ocean Modifier, etc.
2021-07-26 00:03:17 +02:00
0cb25a51de UI: Line Art: Always use Material icon on picker
The Material picker shouldn't change icon based on it's state,
it should always display the Material icon.
2021-07-25 23:59:53 +02:00
6a673b6000 UI: Fix button alignment on Grease Pencil modifiers 2021-07-25 23:57:32 +02:00
8fda1f363a UI: Line Art Modifier: Tweaks to labels and tooltips
- Clearer tooltips for Source Object/Collection.
- Remove redundant Source/Target on labels.
- Always write Grease Pencil with title case.
2021-07-25 23:55:23 +02:00
4886ed2863 Fix T86768, bevel doesn't loop slide sometimes.
Six years ago, Bug T44961 about unwanted spikes had me not do a loop
slide if the angle was too extreme, to avoid unwanted spikes.
The current bug showed that that angle was much too big, and limited
desired behavior in many cases. Changing the angle from 0.25 radians
to 0.0001 radians (about 0.006 degrees) still fixes the original bug
and seems very unlikely to be limiting desired behavior now.
2021-07-25 15:14:37 -04:00
0aad8100ae Fix T89391, etc. Boolean bugs when objects have negative scale.
The old modifier code, now just used for Fast, has code in it to
flip faces of arguments when their tranform's negativity differs
from the main object's transform's negativity.
I had neglected to put that logic in when I made the change that
skipped the round trip through BMesh.
Fixing this means that the results are more what the user expects
when some or all operands have negative scales.
2021-07-25 13:29:45 -04:00
Christoph Lendenfeld
aa32121174 Fix: Remove automatic hiding of bones when using the pose slider
This patch addresses the issue raised in T88340.
When entering a pose sliding operator bones would automatically get hidden.
While technically not a bug it was decided that it is too confusing.
Hiding with 'H' is still possible though, just won't happen automatically

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D11883
Ref: D11883
2021-07-24 21:25:23 +01:00
c971c851d3 GHOST/wayland: use Wayland only when 'BLENDER_WAYLAND' is set 2021-07-24 12:30:14 +01:00
a2ccd0e495 cmake: enable Wayland by default 2021-07-24 12:30:14 +01:00
1029577a51 GHOST/wayland: explicitly delete 'GHOST_SystemWayland' when fallback to X11 2021-07-24 12:30:13 +01:00
05c7d935e7 Cleanup: fix warning -Wparentheses 2021-07-24 19:16:13 +09:00
8fe0aecfde UI: Do not abbreviate/shorten wording
Abbreviations are harder to read and understand thus it is best to be direct.
For example without understanding and context it is hard to know exactly what "Len" means.
2021-07-23 20:46:09 -04:00
ede1ce6e9a GTest: Use INC/INC_SYS for Libmv/OSD tests
This change transitions libmv/osd tests to our
blender_add_test_executable macro that explicitly
takes the include directories as a parameter.

This is in preparation for future clean-up of
global include directories.

Differential Revision: https://developer.blender.org/D12012
Reviewed By: sergey
2021-07-23 16:50:13 -06:00
8031326262 Revert "VSE UX: Make Speed Effect strips more user friendly."
This reverts commit 3123f33380 and
a092baa7f9.
2021-07-23 19:00:13 -03:00
Fredrik Hansson
2beff6197e Weld Modifier: add "loose_edges" option
This improve the cloth modeling workflow by allowing you to weld only the
edges that are used for the sewing forces.

Reviewed By: mano-wii, weasel

Differential Revision: https://developer.blender.org/D10710
2021-07-23 18:52:25 -03:00
3123f33380 Many tweaks to f-curve drawing code 2021-07-23 18:47:07 -03:00
Germano Cavalcante
a092baa7f9 VSE UX: Make Speed Effect strips more user friendly.
**Drawing Changes:**
- F-curve drawing for Stretch, Multiply, Length and Frame Number.
- Value drawing when no keyframes for Stretch, Length and Frame Numbers.

General view of the new drawing for each speed effect mode:
{F9796642, size=full}

Detail of the horizontal zero (blue) line in the new `Multiply` mode:
{F9798520, size=full}

Nice to have (but I don't know how):
- Auto adjusting of endframe when using Multiply or Boost.

Differential Revision: https://developer.blender.org/D6110
2021-07-23 18:47:07 -03:00
5e3d0840a3 PyDocs: Fix syntax errors resulting in warnings 2021-07-23 16:50:10 -04:00
c41b93bda5 XR: Fix for Viewport Denoising Artifacts
Addresses T76003. When using VR with Eevee and viewport denoising,
scene geometry could sometimes be occluded for one eye. Solution is
to use a separate GPUViewport/GPUOffscreen for each VR view instead
of reusing a single one for rendering.

Reviewed By: Julian Eisel, Clément Foucault

Differential Revision: http://developer.blender.org/D11858
2021-07-24 00:12:17 +09:00
eb43477851 Fix T89393: crash when selecting edges when geometry nodes has "on cage" turned on
The core problem is that the geometry nodes modifier sometimes support
"mapping" (i.e. it remembers which new vertices correspond to edit mode
vertices) and sometimes it does not, depending on what the nodes are doing.
Also see rB07ce9910f7cc.

The solution here is that the fallback case in `BKE_mesh_foreach_mapped_edge`
does not call the callback with "invalid" indices.

Differential Revision: https://developer.blender.org/D12007
2021-07-23 16:15:18 +02:00
239a74a130 Fix T90065: disable attribute search in places where there is too little context
Differential Revision: https://developer.blender.org/D12008
2021-07-23 16:13:04 +02:00
6ac378e685 Fix: avoid creating improper rotation matrix
This might change the rotation of some instances after a Curve to Points.
Unfortunately, there is not much we can do about that, the math before
was just wrong. The forward and up axis stayed the same though.

Differential Revision: https://developer.blender.org/D12006
2021-07-23 16:10:03 +02:00
25fc77f46c Fix T89829: wrong active context path check in spreadsheet
The problem was that the modifier was reevaluated all the time, even
between showing the attribute search and clicking on the attribute
name. This freed the data referenced by attribute search. The real bug
here was that the dependency graph was tagged for update even
though nothing changed. This was because the spreadsheet thought
its active context has changed and it wanted to compute the new
value to be shown in the spreadsheet.

The reason for the bug was that I confused how the tree-path of a
node editor works. The second element in the tree path contains
the name of the group node in the root tree that we're in (instead
of the first element).

Differential Revision: https://developer.blender.org/D12009
2021-07-23 16:06:41 +02:00
de2c4ee587 Another slight increase in speed for Delaunay CDT.
When the new "need_ids" flag is false and the output type is not
one of the valid BMesh kinds, there is no need to propagate even
a dummy id to all of the faces.
2021-07-23 08:31:40 -04:00
f23b14091f Cleanup: double spaces in strings 2021-07-23 17:04:21 +10:00
ced94bc11c Cleanup: code comments punctuation / spacing 2021-07-23 17:03:51 +10:00
7ce0d9d791 Cleanup: de-duplicate code for edge-split tagging
Share functionality for single and multi-threaded edge-split tagging.

Remove logic that ensured vert & loop indices in bm_mesh_edges_sharp_tag
(missing from fd9fc809b7).
2021-07-23 16:40:51 +10:00
36c0649d32 XR: Reference Space Improvements
Improves control over the XR reference space by using the stage ref
space (user-defined tracking bounds) instead of local ref space
(position at application launch), if available. Also adds an
"absolute tracking" session option to skip applying eye offsets that
are normally added for placing users exactly at landmarks.

By enabling absolute tracking, users can define the tracking origin
in a way that is not linked to the headset position. Instead, the
tracking values given by the XR runtime are left unadjusted and a
user can manually calibrate an "origin" landmark object to adjust to
their real world space.

Can be useful for applications that use external tracking systems
and those that primarily only need to use controllers and not the
headset (e.g. motion capture).

The absolute tracking option requires an update to the VR
Scene Inspection addon to be accessible by regular users.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D10946
2021-07-23 14:54:56 +09:00
66548007a8 Cleanup: "position tracking" typo in enum member 2021-07-23 14:54:24 +09:00
eea65cbd42 Cleanup: remove unused BM_mesh_loop_normals_update function
The only difference with BM_loops_calc_normal_vcos was passing in
custom coordinates which may be NULL.
2021-07-23 15:10:59 +10:00
66dfef10a7 Fix error setting sharp edges in recent normal calculation changes
bm_mesh_edges_sharp_tag was called with setting sharp edges enabled.
Error in 39b2a7bb7e.
2021-07-23 15:02:04 +10:00
fd9fc809b7 Cleanup: remove normal assignment from bm_mesh_edges_sharp_tag
This was added in 0b7f581397
but seems not to be needed as the assignment was never correct
since only one corner on either side of the smooth edge had the
vertex normal written to it.
2021-07-23 14:36:40 +10:00
39b2a7bb7e Edit Mesh: multi-thread auto-smooth sharp-edge calculation
Merge the sharp edge tagging into bm_mesh_loops_calc_normals,
this has the advantage that edge tagging can be performed as part of
walking over each vertices edges - instead of tagging in a separate loop.

Even though this will tag edges twice (once for each vertex),
the computation isn't heavy as it's only calculating a dot-product
between the two face users to compare the angle.

This change combined with 4ba06ad0a8
makes BM_loops_calc_normal_vcos around 5.68x faster,
with an overall speedup over 2.6x when transforming a high poly mesh.
(tested on a system with 32 cores).

Reviewed By: mont29

Ref D11970
2021-07-23 12:55:58 +10:00
4ba06ad0a8 Edit Mesh: multi-thread auto-smooth & custom normal calculations
Supported multi-threading for bm_mesh_loops_calc_normals.

This is done by operating on vertex-loops instead of face-loops.

Single threaded operation still loops over faces since iterating
over vertices adds some overhead in the case of custom-normals
as the order used for accessing loops must be the same as iterating
of a faces loops.

From isolated timing tests of bm_mesh_loops_calc_normals on high
poly models, this gives between 3.5x to 10x speedup,
with larger gains for meshes with custom-normals.

NOTE: this is part one of two patches for multi-threaded auto-smooth,
tagging edges as sharp is still single threaded.

Reviewed By: mont29

Ref D11928
2021-07-23 12:54:17 +10:00
3fb47956c0 Man Page: Fix spelling 2021-07-22 20:13:14 -04:00
Christoph Lendenfeld
fafd21b14c Animation: Generic Slider implementation
Extract the slider gui implemented for the pose slide tools.
Generalise it so it can be used by other tools as well.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9314
Ref: D9314
2021-07-22 23:44:53 +01:00
49e68f15f2 Geometry Nodes: Display Node Warnings in Modifier
With this commit, node warnings added to nodes during evaluation
(not "Info" warnings) will also draw in the modifier. In the future
there could be a "search for this node" button as well.

Differential Revision: https://developer.blender.org/D11983
2021-07-22 17:53:35 -04:00
f76dfe8fb4 Cleanup: Add function to check a curve's spline types
The need for this has come up a few times.
2021-07-22 17:20:04 -04:00
524d172742 Fix: "Bake" automatically calculated handles in set handle node
Because these handles are calculated lazily, we need to make sure they
are calculated before switching to a manually positioned mode.
I doubt it would ever be necessary, but theoretically this could happen
on a per-point level, to avoid calculating handles not in the selection.
2021-07-22 17:11:26 -04:00
Germano Cavalcante
f013e3de81 VSE: Speed Effect layout updates
**Changes:**
- New enums correspond to 4 modes: `Stretch`, `Multiply`, `Frame Number` and `Length`.
- "`Multiply Factor`" has been removed;
- Value corresponding to "`use as speed`" enabled is now the value appended to the `Multiply` enum;
- Value corresponding to "`use as speed`" disabled is now the value appended to the `Frame Number` enum;
- Value corresponding to "`Scale to Length`" enabled is now the value appended to the `Length` enum;
- Except `Stretch` each mode has now its respective control values.

Differential Revision: https://developer.blender.org/D11856
2021-07-22 17:51:07 -03:00
e77a1dc6b0 Fix name used when parsing arguments 2021-07-22 15:29:09 -03:00
1b44b47f69 PyGPU: new method 'GPUFrameBuffer.read_depth'
Method requested by users in order to port addons to new API.
2021-07-22 15:17:48 -03:00
1a91c57320 Compositor: Fix crash when using empty input sources
It's the case of Image or Movie Clip node when not selecting any
source or an empty one.
Render methods expect an output buffer with size, only render
operations with resolution.
2021-07-22 18:51:51 +02:00
b1bf4c2a05 Compositor: Full frame Texture node
Adds full frame implementation to this node operation.
No functional changes.
2021-07-22 18:51:51 +02:00
48e27ad122 Compositor: Full frame Movie Clip node
Adds full frame implementation to this node operation.
No functional changes.
2x faster than tiled fallback.
2021-07-22 18:51:51 +02:00
91e2b1dcaf Compositor: Fix buffer area iterating past the end 2021-07-22 18:51:51 +02:00
5f28a90b34 Compositor: Add coordinates to BuffersIterator
Allows to cover many use cases where iterating both buffers and
coordinates is needed.
2021-07-22 18:05:55 +02:00
97712b018d Fix T90026: attributes added in editmode are lost on modeswitch
When exiting editmode, customdata [and thus attributes] are copied from
**BMesh** to **Mesh** (in `BM_mesh_bm_to_me`).
When adding attributes, these were always added via
`CustomData_add_layer_named` only.
Instead (if we are in mesh editmode), we need to go through
`BM_data_layer_add_named` to properly update the **BMesh** (see
`update_data_blocks`) so we have stuff available to copy back to
**Mesh** when exiting editmode.
Same is done for removing (also going through BMesh).

This is now done, DomainInfo is updated to point to BMesh (instead of
Mesh) customdata when in editmode.

Maniphest Tasks: T90026

Differential Revision: https://developer.blender.org/D11998
2021-07-22 17:57:46 +02:00
Johnny Matthews
0e8d1c6bcf Geometry Nodes: Set Bezier Handle Type Node
This node takes a curve and a point selection and allows you to set the
specified (or all) points left/right or both handles to a given type.

Differential Revision: https://developer.blender.org/D11992
2021-07-22 10:55:50 -04:00
320f34af86 Tests: continue running benchmarks if some tests fail to build or run
Convenient when testing many revisions where some might be broken.
2021-07-22 16:35:00 +02:00
19b597c55d Tests: improve finding of Blender executables in benchmarking
* Allow specifying a folder and automatically setting the proper executable
  name depending on the operating system
* Use executables from configs for listing devices instead of a blender
  command being available
2021-07-22 16:34:57 +02:00
f2cce48698 Versioning: move "until next subveresion bump" code
Move "until next subveresion bump" code into the 300.13 version block.
This should have happened in rB8d5b9478a25.
2021-07-22 15:19:58 +02:00
0eccf57161 Cleanup: Silence warning - unused parameter 2021-07-22 08:59:43 -03:00
Yann Lanthony
574995478a Fix T89733: Py API: bpy.data.orphans_purge argument parsing
On Windows, using `bpy.data.orphans_purge` with some arguments (eg: `do_recursive=True`) does not produce the expected results. This is due to arguments not being parsed correctly on this platform with the current code.

The proposed fix is based on how other functions with boolean attributes are exposed to the Python API.

Reviewed By: #python_api, mont29

Maniphest Tasks: T89733

Differential Revision: https://developer.blender.org/D11963
2021-07-22 12:52:37 +02:00
Philipp Oeser
57668d84cf Make polls for removing mesh data layers consistent
This was reported in T90026 for attributes, but was also true for:
- UVMaps
- Vertex Colors
- Sculpt Vertex Colors
- Face Maps

For Vertex groups and Shapekeys this was already done (in that their
remove poll would check if there is a vertex group or shapekey to begin
with), now make this consistent across all mentioned types.

Thx @vvv for the initial patch (where this was done for attributes only)

ref T90026

Reviewed By: HooglyBoogly

Maniphest Tasks: T90026

Differential Revision: https://developer.blender.org/D11990
2021-07-22 10:11:44 +02:00
8d5b9478a2 Bump subversion to avoid infinite enabling pose_library add-on
Bump Blender's sub-version to make sure the pose_library add-on isn't
auto-enabled on every run of Blender.
2021-07-22 09:51:52 +02:00
64bb49fa4e Cleanup: Move reorganize asset files
I'm trying to move away from general files with lots of things in them,
and instead have many small & focused files. I find that easier to
work with since everything has clear responsibilities, even if there is
some minor overhead in managing all these files.
I also try to differentiate more clearly between public and internal
files. So source files and internal headers are in a `intern/`
sub-directory, public functions are in a number of headers one level
higher.
For convenience and to make this compatible with our existing general
headers in `editors/include`, I made the `ED_asset.h` there include all
these public headers.
This is of course a bit of an experiment, let's see how it works in
practice.

Also corrected the name of `ED_asset_can_make_single_from_context()`.
2021-07-21 20:41:29 +02:00
Germano Cavalcante
178086d581 Draw Cache: extract tris in parallel ranges
The `ibo.tris` extraction in multithread is currently only done if the
mesh has only 1 material.

Now we cache a map indicating the index of each polygon after sort and
thus allow the extraction of tris with materials in multithreaded.

As caching is a heavy operation and was already being performed in
multi-thread for triangle offsets, no significant improvements are
expected.

The benefit will be much greater when we can skip updating the cache
while transforming a geometry.

**Profiling:**
||master:|PATCH:
|---|---|---|
|large_mesh_editing_materials:|Average: 13.855380 FPS|Average: 15.525684 FPS
||rdata 9ms iter 36ms (frame 71ms)|rdata 9ms iter 29ms (frame 64ms)
|subdiv_mesh_final_only_materials:|Average: 28.113742 FPS|Average: 28.633599 FPS
||rdata 0ms iter 1ms (frame 36ms)|rdata 0ms iter 1ms (frame 35ms)

1.1x overall speedup

Differential Revision: https://developer.blender.org/D11445
2021-07-21 15:09:43 -03:00
785d87ee42 Fix T90017: Bone widget drawing inconsistent with editing
The `lines_loose` extractor did not trigger loose geometry caching.
2021-07-21 14:46:53 -03:00
c830c5b16b Cleanup: Move loose geometry cache creation to render data task
This centralizes caching functions.
2021-07-21 14:46:53 -03:00
e850c2b06d Cleanup: Centralize/unify asset library reference from/to enum code
This was an open TODO, I wanted to have code for translating asset
library references from and to enum values in a central place, and
access that in the same way from both the Asset Browser and the
Workspace RNA code.

* Adds own file for the related functions.
* Adds doxygen comments.
* Updates RNA callbacks to properly use these functions.
* Let these functions call each other, avoid duplicating logic.
2021-07-21 19:35:39 +02:00
10e28bd270 Assets: Replace duplicated asset library reference type from DNA
Since recently it's possible to access assets from outside the
File/Asset Browser, via the asset view template. So we are slowly
moving away from file space specific code to dedicated asset system
code. I introduced `AssetLibraryReference` as a duplicate of
`FileSelectAssetLibraryUID`, with a plan to delete the latter in a
separate cleanup commit. That's exactly what this commit is.

This will cause Asset Browsers to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
2021-07-21 19:35:39 +02:00
8de2b6a020 Assets: Rename workspace active asset library DNA variable
This new variable was introduced with 7898089de3. We don't usually use
an `active` prefix variable. Plus, this makes the name match the one of
the Asset Browser active library variable, so we can use the
`rna_def_asset_library_reference_common()` helper for both.

This will cause Asset Views to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
2021-07-21 19:35:39 +02:00
952ded57de Cleanup: Add missing doxygen file/group comment in new asset file 2021-07-21 19:35:39 +02:00
581a6da804 Fix incorrect use of BLI_assert with error strings
Some asserts were never raised because of invalid checks.
2021-07-22 00:47:29 +10:00
63da2c4082 Cleanup: replace BLI_assert(test || !"text") with BLI_assert_msg(test, text) 2021-07-22 00:46:45 +10:00
Yuki Hashimoto
22bef356ae Cleanup: correct the comment in ghost
The same comments were written in clientToScreen and screenToClient in
GHOST. I corrected them.

Ref D11986
2021-07-21 23:14:03 +10:00
3cfd6439c6 Fix bug in assert in delaunay test.
Assert was trying to say x coords of arcs lined up, and didn't do that.
2021-07-21 08:33:29 -04:00
16804297e6 Cleanup: Split set_preview_visibilty. 2021-07-21 14:12:24 +02:00
d1e1d6c491 Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text") 2021-07-21 20:59:19 +10:00
bbcc8330f7 Cleanup: spelling 2021-07-21 20:42:11 +10:00
e7082fbdb0 Cleanup: replace BLI_assert(0 && "text") with BLI_assert_msg 2021-07-21 20:39:51 +10:00
ab101d444d Fix T89881: ignore unavailable sockets when searching for link cycles 2021-07-21 11:28:26 +02:00
8b0fac4116 Fix compile issue. 2021-07-21 11:09:52 +02:00
82ff5dd911 Fix i18n utils_cli mistake.
Reported by James Monthea (@jmonteath), thanks.
2021-07-21 10:37:45 +02:00
9aa0a3f533 Cleanup Preview rendering: Separate world preparation.
Small cleanup that moves world preparation out of scene preparation.
2021-07-21 09:35:21 +02:00
75e41b1279 Cleanup: use named enum types.
Added ePreviewRenderMethod and ePreviewType.
2021-07-21 08:18:34 +02:00
265c3a4724 Cleanup: replace NB with NOTE in comments 2021-07-21 13:10:32 +10:00
Smitty van Bodegom
dc8a924efa UI: Use more descriptive wording for particle modifier conversions
Currently the wording is a bit unclear: it doesn't specify //what// the particles will be converted into. This clarifies it by stating what the particles will be converted into: they will either be converted to a mesh or the instances will be made real.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11795
2021-07-20 17:39:25 -04:00
Romain Toumi
14d5a45750 UI: Fix Cycles Materials menu Layout
Fix an incoherence between the Eevee Materials menu and the Cycles Materials menu :

Eevee :
{F10230448}

Cycles :
{F10230449}

Simply Fixed by replacing the Cycles UI code by the Eevee UI code.

Thanks to @Brainzman for helping me create this diff and translate

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11979
2021-07-20 17:23:34 -04:00
807bb450a0 Fix API doc generation after recent context additions 2021-07-20 22:07:41 +02:00
bfe6b55aa7 Fix T89827: Attribute transfer node crash on mesh with no faces
Just add a check for whether the mesh has faces when retrieving an
attribute on the corner domain. In the future there could be an info
message in the node in this case, since maybe it's not intuitive.
2021-07-20 15:56:36 -04:00
d3445496b1 Fix memory leak with asset view template operator properties 2021-07-20 21:50:09 +02:00
cb0b017d8f Cleanup: Store asset-handle in drag data
Would previously pass a few properties that are available via the
asset-handle now. This asset-handle is also required for some of the
asset API, e.g. the temporary ID loading. This will probably be needed
before too long.
2021-07-20 21:30:04 +02:00
0af08cea40 Cleanup: Use asset utility function to get the asset .blend path
For this to work, the utility function needs to be callable without
context, which is only needed for a File Browser specific hack anyway
(doesn't apply to this usage of it).
2021-07-20 21:30:04 +02:00
e99801390c Cleanup: Move asset-handle functions to own file
Keeps files minimal and focused. I much prefer that over having all
kinds of stuff in general files like `asset_edit.cc`.
2021-07-20 21:30:03 +02:00
5a1b1c0ed2 Cleanup: Getters for asset-handle data
While the asset-handle design is supposed to be temporary (see
35affaa971), I prefer keeping the fact that it's nothing but a file
entry pointer an implementation detail that is abstracted away. So this
introduces getters for the file data we typically access for
asset-handles.
2021-07-20 21:30:03 +02:00
207df439e1 Cleanup: Use const for internal file data of asset-handle
Note that the current asset-handle design is temporary, see
35affaa971. I still prefer this to be const, as code outside the
asset-list/file-list code should never mess with the file data of an
asset.
2021-07-20 21:30:03 +02:00
36fb03e2b9 Asset: Clearly describe RNA property description as temporary
The asset handle design is only temporary (see 35affaa971) and this
RNA property is only needed for internal, technical reasons of the asset
view template. So although not nice, at least make it clear in the RNA
property description that this should not be used.
2021-07-20 21:30:03 +02:00
8ffc3ee257 Cleanup: Correct asset TODO comment, move setter next to getter 2021-07-20 21:30:03 +02:00
aeee7f390d Fix T89993: Failed assert drawing single point cyclic splines
The same check used for the curve to mesh node.
2021-07-20 14:54:01 -04:00
cf28398471 Fix T89687: Curve to mesh node incorrect face orientation
The new faces should have a winding direction that points them outward,
the fix was swapping the order of each face's edge and vertex indices.
2021-07-20 14:39:24 -04:00
1e063a0242 Cleanup: Use const arguments and less sequential iteration
Using const indexes and offsets helps to make the logic less sequential,
which is hopefully easier to understand and possibly easier to parallelize
in the future. Also order return arguments last.
2021-07-20 14:28:33 -04:00
b65ec08bbb Armature test: properly initialize bone hierarchy
Fix segfault in `BKE_armature_find_selected_bones_test` by property
initializing the bone hierarchy listbases.

No functional changes to Blender.
2021-07-20 19:02:43 +02:00
Jagannadhan Ravi
26b2a35dd4 Speedup rigid body "Copy from Active" operator
If there were lots of selected objects without an existing rigid body,
we would add rigid bodies to them one by one.

This would be slow in python, now we instead do this as a batch
operation in C.

On my (Intel) MacBook it used to take 60 seconds and with this change it
takes about 0.3 seconds.

Reviewed By: Sebastian Parborg

Differential Revision: http://developer.blender.org/D11957
2021-07-20 18:57:12 +02:00
f53ca7e41c Cleanup: Fix missing braces warning on Clang 2021-07-20 21:03:47 +05:30
6754d7aef6 Pose Library: remove assumption about Action group names
Remove the assumption of the pose library that Action groups are named
after the bones in the armature. Even though this assumption is correct
when the keys are created by Blender, action groups can be renamed. Keys
created by Python scripts can also use arbitrary group names.

Since there is more code in Blender making this assumption, and looping
over selected bones is also a common occurrence, this commit contains
some generic functionality to aid in this:

- `BKE_armature_find_selected_bones`: function that iterates over all
  bones in an armature and calls a callback for each selected one. It
  returns a struct with info about the selection states (all or no bones
  selected).
- `BKE_armature_find_selected_bone_names(armature)` uses the above
  function to return a set of selected bone names.
- `BKE_pose_find_fcurves_with_bones()` calls a callback for each FCurve
  in an Action that targets a bone, also passing it the bone name.
2021-07-20 17:12:01 +02:00
c4f71f3193 Cleanup: fix clang-tidy warning readability-qualified-auto
No functional changes.
2021-07-20 17:11:29 +02:00
3e4c98429b Cleanup: fix clang-tidy readability-else-after-return
No functional changes
2021-07-20 17:11:29 +02:00
f763929486 Cleanup: fix clang-tidy warning modernize-use-nullptr
No functional changes.
2021-07-20 17:11:29 +02:00
3ea4c6b9c9 Pose backup: convert from C to C++
Convert `pose_backup.c` (in C) to `pose_backup.cc` (in C++). This will
make future improvements easier. For now, it's the same code with just
some additional explicit casts (C++ doesn't allow implicitly casting
`void *`), `NULL` changed into `nullptr`, and some other simple changes.

No functional changes.
2021-07-20 17:11:29 +02:00
f164188a6d Fix T89981: missing refresh on the compositors render layer node when adding/removing AOVs
Just refresh the node's outputs via ntreeCompositUpdateRLayers().

Maniphest Tasks: T89981

Differential Revision: https://developer.blender.org/D11973
2021-07-20 17:00:01 +02:00
3e29175af3 Fix T89982: Geometry Nodes: 'New' Button tries to create node_tree on active modifier, rather than button context
When done from the Properties Editor, the context's modifier should be
used (this is where the button is located), when done from elsewhere,
the active modifier is still the way to go (since the context modifier is
not available then)

Maniphest Tasks: T89982

Differential Revision: https://developer.blender.org/D11972
2021-07-20 16:53:34 +02:00
Johnny Matthews
83b6fcc70c Fix: Bezier segment node adds handles incorrectly
This caused the "cyclic" attribute to appear dysfunctional.
2021-07-20 09:58:24 -04:00
76a3ff70d5 Fix T89979: Assert in edit mode with curve to mesh node
The node tagged polys normals dirty,  but the function to calculate the
normals didn't clear the dirty flags for polys. Now clear the poly and
corner dirty normal flags.
2021-07-20 09:37:40 -04:00
c3a400b73f Cleanup: use single back-tick quoting in comments
While doxygen supports both, conform to our style guide.

Note that single back-tick's are already used in a majority of comments.
2021-07-20 22:58:14 +10:00
48a45c43e4 Cleanup: use doxygen style parameters in noise.c
These used their own ad-hoc syntax.
2021-07-20 22:54:48 +10:00
9e1fdd1f14 Cleanup: added const keyword to BLI_dlrbTree search functions. 2021-07-20 14:49:49 +02:00
6c5f8bf5aa Cleanup: Remove redundant forward declarations. 2021-07-20 14:49:49 +02:00
9471715720 Fix crash in delaunay C interface test.
The test forgot to set the new need_ids field, which luckily
exposed a bug in the C api for delaunay when that field is false.
Fixed the bug and the test, and added a test for the need_ids false
case.
2021-07-20 07:28:46 -04:00
75c9788c27 Compositor: Fix crash when connecting multiple constant inputs
Operation receiving inputs was being folded more than once
when it was constant foldable.
2021-07-20 12:31:40 +02:00
d218ba8009 LineArt: UI cleanups.
Wording on the UI, slider consistency and material mask switches layout.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: http://developer.blender.org/D11839
2021-07-20 13:06:45 +08:00
77e927b58f Cleanup: reserve C++ comments for disabled code
Use C comments for plain text.
2021-07-20 15:01:05 +10:00
fe2f43a15c Cleanup: use '#if 0' for disabling multiple lines 2021-07-20 15:01:03 +10:00
59eb71afa1 Cleanup: Make function static, use const object argument
Also use `const Curve *` instead of `const Object *`, since the
function works at a lower level than objects anyway.

And also remove another unused function. Since this section of code
for converting curves to meshes will likely be replaced, it's nicer to
see which parts actually remain used at this point.
2021-07-19 21:19:59 -04:00
0e9c04a3ea Cleanup: spelling 2021-07-20 11:12:24 +10:00
cf8ea741f2 Cleanup: quiet GCC maybe-uninitialized warning
Function signatures for snap callbacks used `const` incorrectly
which was hidden by casting function types.

This made it seem as if the input arguments wouldn't be change and
wouldn't be initialized.

Name return arguments with an `r_` prefix, order them last,
remove function casts and correct `const` usage.
2021-07-20 11:12:24 +10:00
0733926a34 Cleanup: Remove unused function 2021-07-19 20:51:57 -04:00
24aae7ed63 Docs: Update RNA to user manual mappings 2021-07-19 18:41:58 -04:00
3021f9b48c Cleanup: Clang format 2021-07-19 17:12:01 -04:00
468765d29e Compositor: Export operation results as debug option
When fixing issues, seeing operation results can be helpful for
detecting which operation went wrong.

This commit adds an option for exporting all operations results to
image files.
Exceptions are:
- Output operations: They are already exported or can be seen in UI.
- Constant operations: There are too many and is rarely useful.

They are exported to "<temp session folder>/COM_operations/"
with filenames "<operation class name>_<operation id>.png".
Only works on full frame execution mode.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11722
2021-07-19 22:05:39 +02:00
9aa88a6604 Compositor: Full frame Brightness node
Adds full frame implementation to this node operation.
No functional changes.
2.4x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11677
2021-07-19 22:05:39 +02:00
b35efa932e Compositor: Full frame Mix node
Adds full frame implementation to this node operations.
No functional changes.
2.3x faster than tiled fallback on average.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11686
2021-07-19 22:05:39 +02:00
300fe84bf0 Compositor: Full frame Viewer node
Adds full frame implementation to this node operation.
No functional changes.
No performance changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11698
2021-07-19 22:05:39 +02:00
b848d5cdf5 Compositor: Full frame Double Edge Mask node
Adds full frame implementation to this node operation.
No functional changes.
No performances changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11750
2021-07-19 22:05:39 +02:00
0a0c2c0217 Compositor: Full frame Ellipse Mask node
Adds full frame implementation to this node operation.
No functional changes.
3x times faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11635
2021-07-19 21:26:58 +02:00
45b46e5de9 Compositor: Buffer iterators
Currently we mostly iterate buffer areas using x/y loops or through
utility methods extending from base classes.

To simplify code in simple operations this commit adds wrappers for
specifying buffer areas and their iterators for raw buffers with any
element stride:
- BufferRange: Specifies a range of contiguous buffer elements from a
 given element index.
- BufferRangeIterator: Iterates elements in a BufferRange.
- BufferArea: Specifies a rectangle area of elements in a 2D buffer.
- BufferAreaIterator: Iterates elements in a BufferArea.
- BuffersIterator: Simultaneously iterates an area of elements in an
 output buffer and any number of input buffers.
- BuffersIteratorBuilder: Helper for building BuffersIterator adding
 buffers one by one.
For iterating areas coordinates it adds `XRange` and `YRange` methods
that return `IndexRange`.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11882
2021-07-19 20:06:21 +02:00
582c5530b6 Cleanup: Move asset library reference C++ wrapper to own files
Although currently only the asset list code uses the asset library
reference wrapper, it can stand on its own and may be used in more
places in the future. So I prefer to give it its own source & header
file.

Also removed unused includes, added proper namespaces as per our C++
style guidelines, and removed an unnecessary TODO comment.
2021-07-19 18:28:27 +02:00
ebe32e01e1 Cleanup: Remove unused function, unused declaration 2021-07-19 11:56:52 -04:00
07a77816a1 Fix some mesh edition macro operators incorrectly setting an empty description string.
No operator or macro should be missing description. But if they do, then
they should use NULL pointer, and not an empty string.

This behavior was already enforced (through an assert) for operators,
previous commit made it the same for macros.
2021-07-19 16:05:24 +02:00
bae1b64525 Fix broken 'undocumented' case in registration of Macro opertators.
Code dealing with macro operators missing description field was slightly
different than the one from Operator registration.

This lead to invalid memory accesses in some python introspection cases
like the i18n messages extraction code in `bl_i18n_utils` module.
2021-07-19 16:05:24 +02:00
132522cba8 Cleanup: Separate keyframes_draw and keyframes_keylist.
The keylist functions are used in other places for none drawing related
stuff. Fe pose_slide uses it.
2021-07-19 15:53:04 +02:00
ceb612a79c Revert "Depsgraph: Implement 'ID_RECALC_GEOMETRY_DEFORM'"
This reverts commits
 bfa3dc91b7,
 52b94049f2,
 ae379714e4,
 a770faa811,
 4ed029fc02,
 101a493ab5 and
 62a2faa7ef.

And fixes T89955.

Changing the dependency graph is a can of worms and the result is
a kind of unpredictable.

A different solution will be planned.
2021-07-19 10:17:38 -03:00
62a2faa7ef Object update: Remove fallback from batch_cache_deform_tag
Falback is not really necessary, and causes
`BKE_object_data_batch_cache_dirty_tag` to run multithreaded in an
unsafe way.

No functional changes.
2021-07-19 09:50:53 -03:00
101a493ab5 Fix T89941: No path`s bevel update, when I change bevel profile curve
Update was skipping the batch cache.
2021-07-19 09:47:56 -03:00
ff01070b5c Cleanup: minor correction to delaunay_2d_cdt doc-string
Use more conventional syntax for default arguments.
2021-07-19 11:57:28 +10:00
ee857cc266 Cleanup: remove unused pathlib import 2021-07-19 11:30:27 +10:00
ad7455cd14 Cleanup: remove unused MTex.pmapto, pmaptoneg & defines
These have not been in use since 2.57
fafbd9d71b.
2021-07-19 11:24:24 +10:00
83883ae66a Fix: memcpy overlapping region ASAN warning in curve trim node 2021-07-18 19:24:11 -04:00
75ae328d62 Cleanup: Make curve trim node code more semantically correct
The code used `Spline::LookupResult` in a way that referred to evaluated
points and control points interchangeably. That didn't affect the logic,
but the code became harder to read. Instead, introduce a local struct
to contain the data in a more obvious way.
2021-07-18 19:20:57 -04:00
76f0ef294a Update documentation string for mathutils.geometry.delaunay_2d_cdt. 2021-07-18 15:24:12 -04:00
72d1ddfc9c Make it optional to track input->output mapping in delaunay_2d_calc.
Some uses of delaunay_2d_calc don't need to know the original verts,
edges, and faces that correspond to output elements.
This change adds a "need_ids" value to the CDT input spec, default true,
which tracks the input ids only when true.
The python api mathutils.geometry.delaunay_2d_cdt gets an optional
final bool argument that is the value of need_ids. If the argument
is not supplied, it is true by default, so this won't break old uses
of the API.

On a sample text test, not tracking ids save about 30% of the runtime.
For most inputs the difference will not be so dramatic: it only really
kicks in if there are a lot of holes.
2021-07-18 15:10:34 -04:00
4ed029fc02 Fix T89929: Crash when hiding in the render a previously keyframed volume
Regression introduced in {rBbfa3dc91b754}.

`ID_RECALC_GEOMETRY` should tag all operations of the `GEOMETRY`
component and not just the operation of node `GEOMETRY_EVAL_INIT`.
2021-07-18 15:11:44 -03:00
Angus Stanton
e7a800c52f Geometry Nodes: Curve Trim Node
This node implements shortening each spline in the curve based on
either a length from the start of each spline, or a factor of the
total length of each spline, similar to the "Start & End Mapping"
panel of curve properties.

For Bezier curves, the first and last control points are adjusted
to maintain the shape of the curve, but NURB splines are currently
implicitly converted to poly splines.

The node is implemented to avoid copying where possible, so it outputs
a changed version of the input curve rather than a new one.

Differential Revision: https://developer.blender.org/D11901
2021-07-18 14:09:38 -04:00
24801e0a4a Speed up Delaunay raycast.
From Erik Abrahamsson, this uses parallel loops for raycasting.
It speeds up one example with many crossings of a bezier curve,
from 0.68s to 0.28s.
2021-07-18 12:13:41 -04:00
fc32567cda Versioning: fix vertex group name loss in linked duplicates.
After rB3b6ee8cee708 by @HooglyBoogly vertex groups were moved
to mesh data, and versioning code was provided to upgrade old
files. However, it fails to consider the case of linked duplicates
having different name lists, and dependent on the object order
can cause some of the names to be lost. This can even be all of
them, if there is a duplicate without any names, which can be
easily created by lazy Python code.

To fix this, change the code to use the longest available name list.

Differential Revision: https://developer.blender.org/D11958
2021-07-18 19:09:56 +03:00
Angus Stanton
9eafdb985d Fix: Incorrect logic in spline lookup function
This section of code deals with evaluated points,
so that is the size it should use.
2021-07-18 11:59:23 -04:00
3c8d261557 Greatly improve speed of Delaunay when have a lot of holes.
Using part of a patch from Erik Abrahamsson, this replaces the
use of linked lists for original id tracking by Sets.
I had thought that the lists were unlikely to grow to more than
a few elements, but when the mesh has a lot of holes (whose
original ids go *outside* the hole, and therefore, most of the
mesh), this assumption can be very wrong.
On a Text regression test, the time went from 11.67s to 0.16s
with this fix. I also tested to make sure that Boolean didn't
slow down with this, and found it actually had a very slight speedup.

Using Sets exposed a dependency on the ordering of the items
in the id lists, luckily caught by a mesh intersect regression test,
so fixed that.
2021-07-18 10:48:57 -04:00
Jesse Yurkovich
e82c5c6607 Fix T89868: Crash showing thumbnail of wide-aspect image
Scaling down images could create images with a width or height of zero.

Clamp at 1 to prevent a crash, also add an assert to scaling functions.

Ref D11956
2021-07-18 10:44:02 +10:00
118803893e Cleanup: Simplify realizing of pointcloud instances
Just a small change to make the function slightly shorter.
2021-07-16 15:29:42 -04:00
0793ced8ad Fix T89624: Vertex painting causes mesh to flicker
The `ibo.lines_paint_mask` extractor doesn't have a callback to iterate
bmesh faces, this made `filter_into` ignore the extractor.
2021-07-16 16:20:05 -03:00
e7b441a05c Cleanup: Simplify logic, use C++ types
Also remove an unecessary null check, and make inner loop simpler.
2021-07-16 13:32:25 -04:00
53743adc29 VSE: Fix multicam splitting all selected strips
`split_multicam` used split operator, where if more strips than
multicam were selected, all would be split, which is undesirable.

Add `Sequence.split()` RNA API function. to split individual strips.
Function accepts `frame` and `split_method arguments`. Returns right
strip after splitting.

In case when strip being split have effects, these will be split too, so
no invalid state should be created.

Selection is not handled, this is by design up to user.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11926
2021-07-16 19:16:35 +02:00
1dcf0f9cf1 Fix T89722: Duplicate macro can cause strips to overlap
Bug caused by 78693d524c accidentally removing overlap handling when
transform operator is canceled.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D11899
2021-07-16 19:16:35 +02:00
feba1fe974 Cleanup: Move gpencil_geom.c to C++
This will help enable development on optimizations to the perimeter
calculation here. Using C++ data structures like Array can make the
code easier to read as well.

Longer term, this can help improve integration with attributes
and possibly the new curve code (since strokes and curves are
quite similar in theory).

Differential Revision: https://developer.blender.org/D11941
2021-07-16 13:00:33 -04:00
c4df8ac1a4 Fix T89899: Crashes when accessing vertex groups from objects
We need to be more strict about trying to retrieve a list of vertex group
names from objects now, as only three object types support them.
This commit adds a check for vertex group support in a few places, the
data transfer operator/modifier, copying vertex groups to selected
objects, and the vertex group remove and clear functions.

Differential Revision: https://developer.blender.org/D11947
2021-07-16 12:23:55 -04:00
6025897cd6 Cleanup: Get vertex group names directly from grease pencil data 2021-07-16 12:05:21 -04:00
802a59a58a Cleanup: Remove redundant logic
The object type was checked twice unnecessarily. Also use a function
for the check to be more explicit.
2021-07-16 12:02:38 -04:00
1ab6d5c1dc Surface Deform: support sparse binding mode for improving performance.
When a vertex group is used to limit the influence of the modifier
to a subset of vertices, binding data for vertices with zero weight
is not needed. This wastes memory, disk space and CPU cycles.

If the vertex group contents is known to be final and constant,
it is reasonable to optimize by only storing data group vertices.
This has to be an option in case the group can change.

Supporting this requires adding a vertex index field and spliting
the vertex count into mesh and bind variants, but both happen to
fit in available padding. The old numverts field is renamed to the
new bound vertex count field to maintain the array length invariant.
Versioning is used to initialize the other new fields.

If a file with sparse binding is opened in an old blender version,
it is corrupted into a non-sparse bind with vertex count mismatch,
preventing the modifier from working until rebind.

Differential Revision: https://developer.blender.org/D11924
2021-07-16 16:12:00 +03:00
a770faa811 Fix T89875: False dependency cycle on particle systems
`POINT_CACHE_RESET` pointed to `GEOMETRY_EVAL_INIT` while
`GEOMETRY_EVAL_INIT` pointed to `POINT_CACHE_RESET`.

Now `POINT_CACHE_RESET` points to the same nodes pointed to by
`GEOMETRY_EVAL_INIT` thus avoiding the dependency cycle.
2021-07-16 09:53:00 -03:00
15cfb375a3 Fix T89782: Segfault populating popup menu with dimensions above the opengl limit
The crash happens because `GPU_offscreen_create` is called with `err_out` `NULL`.

This patch proposes a solution within the `GPU_offscreen_create` itself
and raises an error report in the interface if a menu is called with
dimensions beyond what is supported.

Ref T89782

Maniphest Tasks: T89782

Differential Revision: https://developer.blender.org/D11927
2021-07-16 09:53:00 -03:00
e78e235cc5 Cleanup: preview rendering, update assumptions in comment
The `action_preview_render()` function used to just render, but now it
also temporarily applies the pose. Its comment is now updated for this.

No functional changes.
2021-07-16 14:48:03 +02:00
3ec9681ac4 Rename UI error message on attributes panel for name collisions
* Name Collisions > Name collisions
* Info icon > Error icon
2021-07-16 14:36:44 +02:00
038345fa56 Fix T89861: Checking face selection breaks UV stitch operator 2021-07-16 17:47:42 +10:00
38131cc5e5 Fix T70356: Scaling up 1x1 pixel image reads past buffer bounds
Also resolve a crash when when displaying thumbnails, see T89868.
2021-07-16 16:58:06 +10:00
f61f4c89bb Cleanup: reduce variable scope in task_iterator.c
Would have prevented the error in
15cdcb4e90.
2021-07-16 14:39:57 +10:00
e26887598f Fix error using uninitialized state in BLI_task_parallel_mempool
Single threaded operation used the state before it had variables
written into it.

Error in 15cdcb4e90.
2021-07-16 12:07:03 +10:00
42017b006e Cleanup: sort struct declarations 2021-07-16 11:48:54 +10:00
bf5b1fa726 Cleanup: remove redundant parentheses 2021-07-16 11:45:52 +10:00
09b89da349 Cleanup: spelling in comments 2021-07-16 11:45:51 +10:00
d3c454d66c Cleanup: compiler warnings 2021-07-16 11:45:03 +10:00
Aidan Haile
98c4224ff0 Fix T49944: Compositor ID Mask Anti-Aliasing not working
Replaces current ID Mask node Anti-Aliasing operation by SMAA
operations with default settings as proposed by Jeroen Bakker.
SMAA produces smoother edges.

Reviewed By: manzanilla

Differential Revision: https://developer.blender.org/D11881
2021-07-15 22:23:31 +02:00
Red Mser
eccd03a826 UI: Flip driver editor debug lines
In driver editor, vertically flip the value debug lines to align
them with the timeline header values. This makes it easier to read
the values. Also set the line width explicitly, which was incorrect
in some cases.

Differential Revision: https://developer.blender.org/D8877
2021-07-15 15:20:37 -04:00
7d618b4dde Cleanup: Clang tidy 2021-07-15 13:40:30 -04:00
a566dc25aa Cleanup: Remove use of designated initializers in C++ code
Does not compile on Windows.
2021-07-15 13:36:40 -04:00
9d9c879f4b Cleanup: Move UI list template code to own file (C++)
This move was already prepared with 788d380460 and 26b098c04f. The
template is quite big already, better to give it its own file. Plus it
could use some C++ features like RAII and maybe some more object
oriented code. I plan further refactoring there.
2021-07-15 19:09:49 +02:00
0cc2a72f94 Fix failing tests from vertex group name parameter copy
It turns out `BKE_mesh_copy_parameters` can be called while other
tools are running calculations, which meant that it was called at the
same time as `armature_deform_coords_impl`. Beause of that, we
shouldn't do any freeing (of the old vertex group names) there.

Since the materials are copied in the "for_eval" version anyway,
it seems to make sense to copy the vertex group name list there also.

Fixes T89877, and also the failing `deform_modifiers` test.

Differential Revision: https://developer.blender.org/D11936
2021-07-15 12:25:36 -04:00
3af0e1f6fd Cleanup: unused variable capture 2021-07-15 18:07:03 +02:00
34771cc9f5 Animation/add-ons: Enable the poselib add-on by default
The new Asset Browser-based pose library is partially implemented in an
add-on. This commit enables the add-on by default, as the old pose
library was built-in and thus always enabled.

The ability to disable the add-on is there mostly for cases where
people/studios want to use their own custom pose library.
2021-07-15 16:19:08 +02:00
72c34068cb Fix T88281: Pose Library 'flip pose' sometimes flips wrong
Correct cases where the X-axis of the bone (in pose space) aligns with
the pose-space Y or Z-axis. In these cases the decomposition of the
matrix fails, and a negative scale of the X-axis turns into a 180°
rotation around the Y-axis. An extra -1 scale to the X and Z axes of the
resulting matrix seems to fix things.
2021-07-15 16:12:37 +02:00
f52e3aa210 Asset Browser: Python mixin utility for category-specific panels
Using this mixin for a panel definition, it's possible to set in which
categories the panel should appear. This is used by the Pose Library
add-on.
2021-07-15 16:12:36 +02:00
8925d3b7bf UI/Assets: Initial Asset View UI template
The asset view UI template is a mini-version of the Asset Browser that
can be placed in regular layouts, regions or popups. At this point it's
made specifically for placement in vertical layouts, it can be made more
flexible in the future.
Generally the way this is implemented will likely change a lot still as
the asset system evolves.

The Pose Library add-on will use the asset view to display pose
libraries in the 3D View sidebar.

References:
* https://developer.blender.org/T86139
* https://code.blender.org/2021/06/asset-browser-project-update/#what-are-we-building
* https://code.blender.org/2021/05/pose-library-v2-0/#use-from-3d-viewport

Notes:
* Important limitation: Due to the early & WIP implementation of the
  asset list, all asset views showing the same library will show the
  same assets. That is despite the ID type filter option the template
  provides. The first asset view created will determine what's visible.
  Of course this should be made to work eventually.
* The template supports passing an activate and a drag operator name.
  The former is called when an asset is clicked on (e.g. to apply the
  asset) the latter when dragging (e.g. to .blend a pose asset). If no
  drag operator is set, regular asset drag & drop will be executed.
* The template returns the properties for both operators (see example
  below).
* The argument list for using the template is quite long, but we can't
  avoid that currently. The UI list design requires that we pass a
  number of RNA or custom properties to work with, that for the Pose
  Libraries should be registered at the Pose Library add-on level, not
  in core Blender.
* Idea is that Python scripts or add-ons that want to use the asset view
  can register custom properties, to hold data like the list of assets,
  and the active asset index. Maybe that will change in future and we
  can manage these internally.

As an example, the pose library add-on uses it like this:
```
activate_op_props, drag_op_props = layout.template_asset_view(
    "pose_assets",
    workspace,
    "active_asset_library",
    wm,
    "pose_assets",
    workspace,
    "active_pose_asset_index",
    filter_id_types={"filter_action"},
    activate_operator="poselib.apply_pose_asset",
    drag_operator="poselib.blend_pose_asset",
)
drag_op_props.release_confirm = True
drag_op_props.flipped = wm.poselib_flipped
activate_op_props.flipped = wm.poselib_flipped
```
2021-07-15 16:12:36 +02:00
6bd42baaeb Cleanup: Use const for UI icon getter function 2021-07-15 16:12:36 +02:00
26b098c04f UI: Support defining UI lists in C
So far all UI lists had to be defined in Python, this makes it possible
to define them in C as well. Note that there is a whole bunch of special
handling for the Python API that isn't there for C. I think most
importantly custom properties support, which currently can't be added
for C defined UI lists.

The upcoming asset view UI template will use this, which needs to be
defined in C.

Adds a new file `interface_template_list.cc`, which at this point is
mostly a dummy to have a place for the `ED_uilisttypes_ui()` definition.
I plan a separate cleanup to move the UI-list template to that file.
2021-07-15 16:12:36 +02:00
bc4f99aa86 UI: New button/widget type for Asset Browser like preview tiles
This button type shows a preview image above centered text, similar to
the File Browser files in Thumbnail Display Mode or the default Asset
Browser display. In fact we may want to port these over to use the new
button type at some point.

Will be used by the asset view UI template that will be added in a
following commit. That is basically a mini version of the Asset Browser
that can be displayed elsewhere in the UI.
2021-07-15 16:12:36 +02:00
0c83ef567c UI: Auto-scroll to keep active text buttons in view
If a text button is activated that is not in view (i.e. scrolled away),
the scrolling will now be adjusted to have it in view (with some
small additional margin). While entering text, the view may also be
updated should the button move out of view, for whatever reason. For the
most part, this feature shouldn't be needed and won't kick in, except
when a clicked on text button is partially out of view or very close to
the region edge. It's however quite important for the previously
committed feature, that is, pressing Ctrl+F to start searching in a UI
list. The end of the list where the scroll button appears may not be in
view. Plus while filtering the number of visible items changes so the
scrolling has to be updated to keep the search button visible.

Note that I disabled the auto-scrolling for when the text button spawned
an additional popup, like for search-box buttons. That is because
current code assumes the button to have a fixed position while the popup
is open. There is no code to update the popup position together with the
button/scrolling.

I also think that the logic added here could be used in more places,
e.g. for the "ensure file in view" logic the File Browser does.
2021-07-15 16:12:36 +02:00
89fd3afd1e UI: Support pressing Ctrl+F over UI lists to search
Adds an operator invoked by default with Ctrl+F that while hovering a UI
list, opens the search field of the list and enables text input for it.
With this commit the search button may actually be out of view after
Ctrl+F still. The following commit adds auto-scroll to solve that.

A downside is that in the Properties, there also is Ctrl+F to start
the editor-wide search. That's not unusual in Blender though (e.g.
scolling with the mouse over a UI list also scrolls the list, not the
region).
2021-07-15 16:12:36 +02:00
87c1c8112f UI: Support UI list tooltips, defined via Python scripts
Makes it possible to create tooltips for UI list rows, which can be
filled in .py scripts, similar to how they can extend other menus. This
is used by the (to be committed) Pose Library add-on to display pose
operations (selecting bones of a pose, blending a pose, etc).

It's important that the Python scripts check if the UI list is the
correct one by checking the list ID.
For this to work, a new `bpy.context.ui_list` can be checked. For
example, the Pose Library add-on does the following check:
```
def is_pose_asset_view() -> bool:
  # Important: Must check context first, or the menu is added for every kind of list.
  list = getattr(context, "ui_list", None)
  if not list or list.bl_idname != "UI_UL_asset_view" or list.list_id != "pose_assets":
    return False
  if not context.asset_handle:
    return False
  return True
```
2021-07-15 16:12:36 +02:00
8edcb3af96 UI: Support left-right arrow key walk navigation in UI lists
Add improved arrow key walk navigation in grid layout UI List templates.
Pressing up or down walks the active item to the adjacent row in that
direction, while left and right walk through the items along the columns
wrapping at the rows.

Note from Julian:
In combination with the following commit, this has the important
limitation that the list's custom activate operator won't be called when
"walking over" an item that is scrolled out of the list. That is because
we don't actually create any buttons for those that could be used for
the handling logic. For our purposes of the pose libraries that should
be fine since the asset view list is always made big enough to display
all items. Solving this might be difficult, we don't properly support
nesting boxes with proper scrolling in regular layouts. It's all just
hacked a bit for UI-lists to work. Overlaps quite a bit with T86149.

Differential Revision: https://developer.blender.org/D11063
2021-07-15 16:12:36 +02:00
ae1dc8f5f9 UI: Internal support for custom UI list item drag & activate operators
For pose libraries, we need to be able to apply a pose whenever
activating (clicking) an item in the Pose Library asset view and blend
it by dragging (press & move). And since we want to allow Python scripts
to define what happens at least when activating an asset (so they can
define for example a custom "Apply" operator for preset assets), it
makes sense to just let them pass an operator name to the asset view
template. The template will be introduced in a following commit.
2021-07-15 16:12:36 +02:00
00c7ea68a8 UI: New UI list layout type for big preview tiles
This new layout type is meant for the upcoming asset view UI template.
With it it is possible to show big asset previews with their names in a
responsive grid layout.

Notes:
* The layout is only available for C defined UI lists. We could expose
  it to Python, but I think there are still some scrolling issues to be
  fixed first. (The asset view template doesn't use scrolling for the UI
  list.)
* I'd consider this a more usable version of the existing `GRID` layout
  type. We may remove that in favor of the new one in future.
2021-07-15 16:12:36 +02:00
788d380460 UI: UI list refactor & preparations for asset view template
This is more of a first-pass refactor for the UI list template. More
improvements could be done, but that's better done separately. Main
purpose of this is to make the UI list code more manageable and ready
for the asset view template.

No functional changes for users.

* Split the huge template function into more manageable functions, with
  clear names and a few structs with high coherency.
* Move runtime data management to the template code, with a free
  callback called from BKE. This is UI data and should be managed at
  that level.
* Replace boolean arguments with bit-flags (easily extendable and more
  readable from the caller).
* Allow passing custom-data to the UI list for callbacks to access.
* Make list grip button for resizing optional.
* Put logic for generating the internal UI list identifier (stored in
  .blends) into function. This is a quite important bit and a later
  commit adds a related function. Good to have a clear API for this.
* Improve naming, comments, etc.

As part of further cleanups I'd like to move this to an own file.
2021-07-15 16:12:36 +02:00
6e01b52100 Assets: temporarily apply pose when generating preview image
When generating a preview image for a pose, temporarily apply it to the
armature. Contrary to the usual pose application, this ignores the
selected bones and always applies the entire pose.
2021-07-15 16:12:36 +02:00
f3610a23d1 Animation: new pose library based on Asset Browser
Introduce new pose library, based on the Asset Browser. Contrary to the
old pose library (in `editors/armature/pose_lib.c`), which stored an
entire library of poses in an `Action`, in the new library each pose is
its own `Action` datablock. This is done for compatibility with the
asset browser, and also to make it easier to attach preview images,
share datablocks, etc. Furthermore, it opens the door to having
animation snippets in the pose library as well.

This commit contains the C code for the pose library; in order to fully
use it, an addon is required as well (which will be committed shortly).
2021-07-15 16:12:36 +02:00
28dc07a153 Animation: add function to blend Action into pose
Add function `BKE_pose_apply_action_blend()`, which blends a given
Action into current pose. The Action is evaluated at a specified frame,
and the result is applied to the armature's pose.

A blend factor can be given to blend between the current pose and the
one in the Action. Quaternions are interpolated with SLERP; it is
assumed that their FCurves are consecutively stored in the Action.

This function will be used in the upcoming new Pose Library.
2021-07-15 16:12:36 +02:00
9473c61b36 Animation: apply pose to all or selected bones of armature
New function `BKE_pose_apply_action_all_bones()`, which will be
necessary for the upcoming pose library v2.0.

This renames the function `BKE_pose_apply_action` to
`BKE_pose_apply_action_selected_bones`, to reflect that it only works on
selected bones, to contrast it to the new function.
2021-07-15 16:12:36 +02:00
b40e05fcd1 Assets: Open Blend File operator
Add operator 'Open Blend File' to the Asset Browser. This operator:
- starts a new Blender process,
- opens the blend file containing the asset,
- monitors the new Blender process, and when it stops,
- reloads the assets to show any changes made.
2021-07-15 16:12:36 +02:00
637731dc61 Assets: Abstraction for temporary loading of asset data-blocks
This is an editor-level abstraction for the `BLO_library_temp_xxx()`
API for temporary loading of data-blocks from another Blend file. It
abstracts away the asset specific code, like asset file-path handling
and local asset data-block handling.

Main use-case for this is applying assets as presets that are based on
data-blocks, like poses. Such preset assets are an important part of the
asset system design, so such an abstraction will likely find more usage
in the future.
2021-07-15 16:12:36 +02:00
55d48defc5 File/Asset Browser: Extend file-entry and asset handle Python API
Adds the following to `bpy.types.FileSelectEntry`:
* `id_type`: The data-block type the file represenets, if any.
* `local_id`: The local data-block it represents, if any (assets only).

And the following to `bpy.types.AssetHandle`:
* `local_id`: The local data-block the asset represents, if any.

This kind of information and the references are important for asset related
operators and UIs. They will be used by upcoming Pose Library features.
2021-07-15 16:12:36 +02:00
a26a059244 Assets: Initial Asset List as part of the Asset System design
Implements a basic, WIP version of the asset list. This is needed to
give the asset view UI template asset reading and displaying
functionality.

See:
* Asset System: Data Storage, Reading & UI Access - https://developer.blender.org/T88184

Especially the asset list internals should change. It uses the
File/Asset Browser's `FileList` API, which isn't really meant for access
from outside the File Browser. But as explained in T88184, it does a lot
of the stuff we currently need, so we (Sybren Stüvel and I) decided to
go this route for now. Work on a file-list rewrite which integrates well
with the asset system started in the `asset-system-filelist` branch.

Further includes:
* Operator to reload the asset list.
* New `bpy.types.AssetHandle.get_full_library_path()` function, which
  gets the full path of the asset via the asset-list.
* Changes to preview loading to prevent the preview loading job to run
  eternally for asset views. File Browsers have this issue too, but
  should be fixed separately.
2021-07-15 16:12:36 +02:00
add6fa0924 Assets: Show asset path in asset browser sidebar
It's useful to know where an asset is stored in, before this there was no way
to tell this. This could probably be displayed nicer in the UI but we're
currently unsure how. But at least the information is there now.
2021-07-15 16:12:36 +02:00
35affaa971 Assets: AssetHandle type as temporary design to reference assets
With temporary I mean that this is not intended to be part of the
eventual asset system design. For that we are planning to have an
`AssetRepresentation` instead, see T87235. Once the `AssetList` is
implemented (see T88184), that would be the owner of the asset
representations.

However for the upcoming asset system, asset browser, asset view and
pose library commits we need some kind of asset handle to pass around.
That is what this commit introduces.
Idea is a handle to wrap the `FileDirEntry` representing the asset, and
an API to access its data (currently very small, will be extended in
further commits). So the fact that an asset is currently a file
internally is abstracted away. However: We have to expose it as file in
the Python API, because we can't return the asset-handle directly there,
for reasons explained in the code. So the active asset file is exposed
as `bpy.context.asset_file_handle`.
2021-07-15 16:12:36 +02:00
3feb3ce32d Assets: Expose active asset library in context
For the Asset Browser, this returns the active asset library of the
Asset Browser, otherwise it returns the one active in the workspace.

This gives simple access to the active asset library from UI code and
Python scripts. For example the upcoming Pose Library add-on uses this,
as well as the upcoming asset view template.
2021-07-15 16:12:36 +02:00
7898089de3 Assets: Add an active asset library per workspace, for the UI to use
This per-workspace active asset library will be used by the asset views
later. Note that Asset Browsers have their own active asset library,
overriding the one from the workspace.

As part of this the `FileSelectAssetLibraryUID` type gets replaced by
`AssetLibraryReference` which is on the asset level now, not the
File/Asset Browser level. But some more work is needed to complete that,
which is better done in a separate commit.
This also moves the asset library from/to enum-value logic from RNA to
the editor asset level, which will later be used by the asset view.
2021-07-15 16:12:36 +02:00
Robert Sheldon
59f9a5e6ac Fix T88188: Allow keyframing vertex mass in cloth sim
Update vertex weights between simulation steps if they have changed.
This allows for animated vertex weights in the cloth sim.

Reviewed By: Sebastian Parborg

Differential Revision: http://developer.blender.org/D11640
2021-07-15 16:09:24 +02:00
60fee69682 Library loading: Fix access of out-of-scope memory in py context manager
The `__enter__` function of the `bpy.data.libraries.load` context manager
was storing a pointer to a stack-allocated variable, which was subsequently
used in the `__exit__` function, causing a crash. This is now fixed.

Thanks @Severin for the patch.
2021-07-15 16:04:22 +02:00
Paul Golter
3df40cc343 Fix: Subtitles: Order of channels in the .blend file will be kept in the .rst file.
If text strips have the same start frame but are stacked on top of each
other in different channels the order in which they are written in the
.rst file was random before.

Reviewed By: Richard Antalik

Differential Revision: https://developer.blender.org/D11903
2021-07-15 15:49:25 +02:00
Heinrich Schuchardt
468d59e496 Add support for RISC-V architecture
* On RISC-V GCC 10.3 does not define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n.
* Avoid a build error
  "Please add support for your platform in build_config.h"
  Cf: https://github.com/sergeyvfx/libNumaAPI/pull/3

Differential Revision: https://developer.blender.org/D11910
2021-07-15 14:22:35 +02:00
709e443152 Cleanup: LayerCollection resync: Proper r_ prefix for return function parameter. 2021-07-15 14:06:09 +02:00
ddc7e5f1b6 Cleanup: improve comments, remove debug printf 2021-07-15 21:09:39 +10:00
e509f9c3a0 Keymap: use Shift-Tab to toggle snap in the sequencer
Match the same shortcut for the 3D view & UV editor.
2021-07-15 20:58:13 +10:00
e7e5fd96c4 Cleanup: LayerCollection resync code.
Mainly naming (also droping the `layer_collection`  in favor of just
`layer` for internal code, this is clear enough and much shorter). Add
proper parent/child identifiers, `r_` prefix for parameters also used as
return values, etc.

Also made some parameters const.
2021-07-15 12:49:43 +02:00
2e8641e45e Fix: crash when creating new node links
This was a regression in rBc27ef1e9e8e663e02173e518c1e669e9845b3d1f.
2021-07-15 12:43:59 +02:00
ae30f72c80 Fix T89870: Vertex groups lost when opening 3.0 files in 2.93
The original refactor for vertex groups (3b6ee8cee7)
forgot to bump the minimum file requirement.

I'm also bumping the subversion to 12 so everyone can switch to a
working subversion number.

Differential Revision: https://developer.blender.org/D11931
2021-07-15 12:23:34 +02:00
49b798ca7e macOS/glog: Silence syscall deprecation warning
Upstream will release the fix in 0.6 which will take time.
Silence two warnings.

Differential Revision: https://developer.blender.org/D11246
2021-07-15 15:23:06 +05:30
c614eadb47 Keymap: use Alt-Q instead of D for transfer mode operator
This now works in all modes (not just sculpt) and activates on press
instead of release. See design task T89757.
2021-07-15 19:13:22 +10:00
757ec00f83 Revert "Keymap: use D-Key for view-pie menu"
This reverts commit f92f5d1ac6.

See: T89757 for rationale for reverting this change.
2021-07-15 19:13:22 +10:00
de913516dd Fix: missing null check
This was a regression in rB3b6ee8cee7080af200e25e944fe30d310240e138.
2021-07-15 11:07:41 +02:00
c27ef1e9e8 Geometry Nodes: dim links whose start and end sockets are not visible
This makes node trees with long links that cross other nodes easier to work with.
Dimmed links will be ignored by various modal operators like cut and reroute insertion.

Differential Revision: https://developer.blender.org/D11813
2021-07-15 11:00:23 +02:00
d5e626b243 Cleanup: use raw strings, quiet clang-tidy warnings 2021-07-15 18:29:20 +10:00
8e8a6b80cf Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text")
This shows the text as part of the assertion message.
2021-07-15 18:29:01 +10:00
a63a0ee24b Cleanup: clang-format 2021-07-15 18:14:51 +10:00
d35b14449e Cleanup: ensure one newline at end of file, strip trailing space 2021-07-15 17:53:26 +10:00
41e0a5b5ed CMake: update config for checking utility 2021-07-15 17:52:27 +10:00
15cdcb4e90 BLI_task: add a callback to initialize TLS
Useful when TLS requires it's own allocated structures.
2021-07-15 14:45:46 +10:00
5cd1aaf080 BLI_memarena: support merging memory arenas
Useful when thread-local storage has it's own memory arena containing
data which is kept after the multi-threaded operation has finished.
2021-07-15 14:37:26 +10:00
4be166b6b5 deps_builder: zstd 1.5.0
Having zstd available is a requirement for landing D5799

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11079
2021-07-14 18:22:23 -06:00
4e65b1ef6c GHOST/wayland: create mmap-ed file manually if memfd_create is unavailable 2021-07-14 23:15:00 +01:00
ebf7673f83 CMake: Have CMake Control the C++ version.
We were manually setting the compiler flags
for C++17 support for this previously. CMake
can do this for us in a uniform way without
having to worry about compiler specifics.

Setting these flags manually somehow brought
out some unwanted behaviour (CMake switching
back to C++14) in the nightly CMake builds.

Unsure if that's a CMake bug or planned
new behaviour for future version, but best
to play it safe.

These flags are supported since CMake 3.1
so should not break anything.

Reviewed by: Campbell Barton

Differential Revision: https://developer.blender.org/D11891
2021-07-14 15:17:02 -06:00
093074aefe Bezier Spline: Add a more generalized insertion utility
This logic is from the curve sundivide node, used to add points with
proper handles in between two existing points. However, the same logic
is used for trimming of Bezier splines, and possibly interactive point
insertion in the future, so it's helpful as a general utility.

The logic is converted to depend on a bezier spline instead of being
static. A temporary segment spline can be used for the latter use case.
2021-07-14 15:13:17 -04:00
2829caa9f8 Cleanup: Layer resync: Split object/base resync part in own function.
No behavioral change expected here.
2021-07-14 17:49:57 +02:00
638c2f0c3f Add "id_properties_clear()" calls to UI data tests 2021-07-14 11:21:46 -04:00
c492f26549 Cleanup: Reoder definition 2021-07-14 11:05:33 -04:00
34fb3a19df Merge branch 'master' into refactor-idprop-ui-data 2021-07-14 10:58:39 -04:00
c202d38659 Python API: Add functions to ensure and clear IDProperties
This adds id_properties_clear() and id_properties_ensure() functions
to RNA structs. This is meant as an initial change based on discussion
in review of D9697. However, they may be useful in other situations.

The change requires refactoring the internal idproperties callback to
return a pointer to the IDProperty pointer, which actually turns out
to be quite a nice cleanup.

An id_properties attribute could be added in the future potentially.

Differential Revision: https://developer.blender.org/D11908
2021-07-14 10:51:28 -04:00
37a5ff4a84 Tests: support graphing peak memory in Cycles performance tests
The general graphing mechanism will create one graph for each output
variable. So it's not limited to time and memory, but that is what the
Cycles tests now output.
2021-07-14 16:12:10 +02:00
2acebcae24 Cleanup: Avoid duplication in line art stroke generation
The BKE_gpencil_stroke_add_points API function worked well for
creating the primitives in the add object menu, but it expected a
specific data format that doesn't make sense in a dynamic context.
As evidence of that we can see the way source data was duplicated
in the line art file just to use this API function.

This commit solves that problem in two ways:
 - Clean up the line art function (this should make it faster too).
 - Move/rename the function so its intended use is more clear.

Differential Revision: https://developer.blender.org/D11909
2021-07-14 10:11:41 -04:00
3de3c3c23a Fix (unreported) LibOverride diffing generating operations for non-editable properties.
Non-pointer-like properties that are not editable should never generate
override operations.

While harmless (those would never be applied back anyway), better not
clutter override operations list, and also enjoy the symbolic
performances improvement here.

NOTE: Pointer-like properties (pointers and collections) remain
processed as usual here since they usually imply recursivity. We could
make an exception to the exception for ID pointers, but for now I don't
think this is worth it.
2021-07-14 14:23:19 +02:00
c9e9a42215 Fix T89771: Cloth disk cache is not read on library overrides in some cases.
Issue would happen when the original, linked data already had 'Disk Cache'
setting enabled. Override would then see no difference with linked data,
and not create any rule for it (as expected).

Root of the issue was that in Cloth modifier copy code, those disk cache
settings were not copied at all, so every time local overrides were
re-generated by copying linked data, those flags would be reset to their
default values.

NOTE: this might exist in other PointCache usages as well, but this code is
in such a bad state that I'd rather do minimal strictly needed changes
there, on a case-by-case basis. Proper recode of that whole system is
wayyyyy out of scope here.
2021-07-14 14:23:19 +02:00
f0ddbcb31d Cleanup: Turn PointCache flags defines into an anonymous enum. 2021-07-14 14:23:19 +02:00
7cd91a06eb Fix T88908: Incorrect path handling in adding strips
When image strip is added from python using `image_strip_add` operator
and directory path is not terminated with slash, last part of directory
was ignored.

Use `BLI_join_dirfile` instead of simple string concatenation.
2021-07-14 13:56:09 +02:00
efe90944ee Fix crash displaying invalid enum value with translations enabled
Found loading a cycles-x .blend file saved with different integer values for
enum items.
2021-07-14 13:54:52 +02:00
765406cb51 Fix T88088: Cycles and Eevee Vector Rotate node inconsistent with zero axis
Pass along the unmodified vector in this case.
2021-07-14 13:54:52 +02:00
2761679180 Fix T89826: VSE snapping with constrained axis
Constraining to X axis caused snapping to not work at all. Constraining
to Y axis caused snapping indicator to be drawn, when snapping doesn't
occur.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11898
2021-07-14 13:22:40 +02:00
5583d51773 Fix T89851: Geometry nodes: wrongly detected "Node group has unidentified
nodes or sockets" error

rBfe22635bf664 introduced a utility to check for this (but it was always
returning true).

This wasnt a problem in master (since it is unused there), but in the
2.93 branch, this utility is actually used and the error results in all
geometry nodetrees to appear with the "Node group has unidentified nodes
or sockets" message (and being unusable).

Now return false in has_undefined_nodes_or_sockets if all nodes and
sockets have been successfully checked.

This commit then needs to end up in the 2.93 branch.

Maniphest Tasks: T89851

Differential Revision: https://developer.blender.org/D11911
2021-07-14 11:55:07 +02:00
192f0c9e17 Fix T89734: incorrect dependency cycle with id property on modifier
Differential Revision: https://developer.blender.org/D11851
2021-07-14 11:25:15 +02:00
271f34f77e Geometry Nodes: initial socket inspection
Socket inspection helps with debugging a geometry node group.
Now, when hovering over a socket, a tooltip will appear that provides
information about the data in the socket. Note, socket inspection only
works for sockets that have been computed already. Nodes that are not
connected to an output are not computed.

Future improvements can include ui changes to make the tooltip look
more like in the original design (T85251). Furthermore, additional
information could be shown if necessary.

Differential Revision: https://developer.blender.org/D11842
2021-07-14 11:21:10 +02:00
3e125d12af Fix T89849: Time offset not working with Bake Object transform to Grease pencil
The bake animation was not using the remap of time done by grease pencil time modifier.
2021-07-14 11:09:25 +02:00
6644e96f01 Cleanup: use BMLoop.next/prev for BMesh auto-smooth logic
Use more direct access to next/previous vertices.

- `BM_edge_other_vert(l_curr->e, l_curr->v)` -> `l_curr->next->v`.
- `BM_edge_other_vert(l_curr->prev->e, l_curr->v)` -> `l_curr->prev->v`.

Add asserts to keep the intention clear.
2021-07-14 14:22:13 +10:00
ae379714e4 Transform: Identify more safely when the mesh is deform only
Depending on the modifiers, geometry can be destructive which is not safe.
2021-07-13 18:59:42 -03:00
96a4b54cfb Compositor: Full frame Render Layers node
Adds full frame implementation to this node operations.
No functional changes.
2.5x faster than tiled fallback on average.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11690
2021-07-13 22:34:28 +02:00
538f452ea9 Compositor: Full frame Translate node
Adds full frame implementation to this node operation.
No functional changes.
2021-07-13 22:34:28 +02:00
2ea47057d3 Compositor: Fix pixels being wrapped outside buffer area
Not causing issues in current master because all buffer areas are at
(0, 0) position and `Extend` is not used. But areas may be at any
position in future developments and it will crash.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11784
2021-07-13 22:34:28 +02:00
209aff0a35 Compositor: Fix convert resolutions linking different socket datatypes
Link sockets are always connected to inserted translate or scale
operation `Color` sockets even when they have different data type.
This causes crashes on full frame mode when operations read inputs 
with non expected datatypes.

Because data type conversions need to be executed before, convert
resolutions must ensure same datatypes are linked.
2021-07-13 22:32:53 +02:00
3b6ee8cee7 Refactor: Move vertex group names to object data
This commit moves the storage of `bDeformGroup` and the active index
to `Mesh`, `Lattice`, and `bGPdata` instead of `Object`. Utility
functions are added to allow easy access to the vertex groups given
an object or an ID.

As explained in T88951, the list of vertex group names is currently
stored separately per object, even though vertex group data is stored
on the geometry. This tends to complicate code and cause bugs,
especially as geometry is created procedurally and tied less closely
to an object.

The "Copy Vertex Groups to Linked" operator is removed, since they
are stored on the geometry anyway.

This patch leaves the object-level python API for vertex groups in
place. Creating a geometry-level RNA API can be a separate step;
the changes in this commit are invasive enough as it is.

Note that opening a file saved in 3.0 in an earlier version means
the vertex groups will not be available.

Differential Revision: https://developer.blender.org/D11689
2021-07-13 12:10:34 -04:00
52b94049f2 Fix 'Correct Face Attributes' option
With this option enabled, updating the geometry is no longer deform only.
2021-07-13 12:51:29 -03:00
2373a2196e Cleanup: duplicate checks, unused initialization 2021-07-13 22:41:48 +10:00
6a0fe79db5 Cleanup: replace BKE_customdata.h in BKE_editmesh.h
Only DNA_customdata_types.h is needed for BMEditMesh.
2021-07-13 22:23:17 +10:00
10428ca472 Cleanup: reduce indentation 2021-07-13 22:14:42 +10:00
d31abfef2c Fix x/y mismatch in retract region tracker
Correct X/Y mismatch in RetrackRegionTracker.

NOTE: This isn't used at the moment.

Reviewed By: sergey

Ref D11895
2021-07-13 21:58:45 +10:00
6a5e1bf9a1 Cleanup: improve BMEditMesh docstrings
Also remove white-space added last commit.
2021-07-13 21:24:46 +10:00
488690c864 Cleanup: minor changes to recent sequencer clipboard addition
- Make the variable to store the name 'static'.
- Use STRNCPY macro.
- Set the first character to nil instead of memset for the while string.
2021-07-13 21:23:35 +10:00
d374469f4c VSE: Make pasted strip active
When adding texts or various simple effects I often copy-paste strips
to reuse properties from a template such as font or position. I assume
this is common workflow. Issue with this workflow is, that active strip
is not changed after pasting, so when adjusting property, it is original
strip that is being modified.

This is not issue when duplicating strips - selection state is
transfered to duplicate strips, such that duplicate of active strip is
set to be active and duplicate of selected strip is set to selected.

Implement same selection transfering behavior in paste operator, that
exists in duplicate operator.

Since strip can be deleted after copying, it is not possible to rely
on sequencer state. This is true even when pasting strips to different
scene. Therefore active strip name must be stored in clipboard.

Reviewed By: sergey, Severin

Differential Revision: https://developer.blender.org/D11781
2021-07-13 12:53:56 +02:00
af42b35e53 Fix UV snapping broken
Caused by fba9cd019f, then fixed by 0e4245bc28, but without
subversion bump, so some files were still broken after fix.

Repeat fix again, but this time also bump subversion.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D11864
2021-07-13 12:52:57 +02:00
71b4a1687e Cleanup: clang-tidy, comments 2021-07-13 20:51:24 +10:00
25c2875e0f Edit Mesh: use partial updates editing vertices with number buttons
Use the same partial-update functions used by transform when
editing vertex locations with the number buttons.

This avoids unnecessary calculations for normals and tessellation.

This gives around 1.44x overall speedup on high poly meshes.
2021-07-13 20:17:30 +10:00
8839b4c32a UI: support persistent state during number/slider interaction
Support for begin/update/end callbacks allowing state to be cached
and reused while dragging a number button or slider.

This is done using `UI_block_interaction_set` to set callbacks.

- Dragging multiple buttons at once is supported,
  passing multiple unique events into the update function.

- Update is only called once even when multiple buttons are edited.

- The update callback can detect the difference between click & drag
  actions so situations to support skipping cache creation and
  freeing for situations where it's not beneficial.

Reviewed by: Severin, HooglyBoogly

Ref D11861
2021-07-13 20:03:40 +10:00
1b4d5c7a35 Undo System: avoid redundant decoding on undo
In most cases the undo system was loading undo steps twice.

This was needed since some undo systems (sculpt, paint, text)
require stepping out of the current undo step.

Use a flag to limit this to the undo systems that need it.

This improves performance for other undo systems.
This gives around 1.96x speedup in edit-mesh for high-poly objects.

Reviewed by: mont29

Ref D11893
2021-07-13 19:43:05 +10:00
f9c9e000ca Undo: optimize edit-mode undo
- Tag the object data instead of the object when decoding
  (this avoids duplicating mesh object-data on each undo-step).
- Calculate face normals as part of multi-threaded tessellation.

This gives ~11% speedup with 1.5x million polygons.
2021-07-13 17:10:30 +10:00
7a4fc9f59d Cleanup: quiet stringop-overflow compiler warning 2021-07-13 16:54:25 +10:00
22c4323b21 Cleanup: remove commented code
Replace with brief note in warning.
2021-07-13 15:27:38 +10:00
7a084c2eee Cleanup: minor changes to edit-mesh API calls
Rename:

- EDBM_mesh_free -> EDBM_mesh_free_data
  BKE_editmesh_free -> BKE_editmesh_free_data

  Since this doesn't free the edit-mesh pointer.

- BKE_editmesh_free_derivedmesh -> BKE_editmesh_free_derived_caches

  Since this no longer uses derived-mesh, match naming for the related
  object function BKE_object_free_derived_caches.

Also remove `do_tessellate` argument from BKE_editmesh_create,
since the caller can explicitly do this if it's needed,
with the advantage that it can be combined with normal calculation
which is faster on high-poly meshes.
2021-07-13 15:13:33 +10:00
b90b1af25c Event Simulate: and a --time-actions command line argument
When enabled, print the time taken between running actions.
2021-07-13 14:50:52 +10:00
5098678308 Cleanup: Use correct _WIN32/64 defines for MSVC
Docs: https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros

Differential Revision: https://developer.blender.org/D11460
2021-07-12 21:01:18 -07:00
dc679f6247 Cleanup: Use C99 format string for the SIZET_FORMAT macro
All platforms support the proper format string and it's already used in
various other places.

Differential Revision: https://developer.blender.org/D11460
2021-07-12 20:32:37 -07:00
2e7e7a6fb6 Fix object "Set Origin" operating on linked library data
Regression in d25747ee75
2021-07-13 13:03:39 +10:00
3b39186afa Rename id_properties_create to id_properties_ensure 2021-07-12 21:50:43 -04:00
73012ab1f7 Merge branch 'master' into refactor-idprop-ui-data 2021-07-12 21:43:40 -04:00
d6b1d35bf8 Cleanup: Use C++ float3 type, use prefix for return argument 2021-07-12 17:24:45 -04:00
Germano Cavalcante
bfa3dc91b7 Depsgraph: Implement 'ID_RECALC_GEOMETRY_DEFORM'
During a mesh transformation in edit mode (Move, Rotate...), only part of
the batch cache needs to be updated.

This commit allows only update only the drawn batches seen in
`BKE_object_data_eval_batch_cache_deform_tag` if the new
`ID_RECALC_GEOMETRY_DEFORM` flag is used.

This new flag is used in the transforms operation for edit-mesh and
results in 1.6x overall speedup in heavy subdiv cube.

Differential Revision: https://developer.blender.org/D11599
2021-07-12 18:05:13 -03:00
7b6c77aa84 Fix T88015: Round end caps on Freestyle lines not shaped as documented
This might be an artistic choice, but round end caps are supposed to be
a "half circle centered at the end point of the line" as documented
here: https://docs.blender.org/manual/en/dev/render/freestyle/
parameter_editor/line_style/strokes.html#caps

They are a shashed half circle instead.

This patch makes this pure half circles [and also fixes the case where
thickness of beginning was used for both beginning and end of the
stroke]

Maniphest Tasks: T88015

Differential Revision: https://developer.blender.org/D11340
2021-07-12 22:14:57 +02:00
7b954ba7a1 GHOST/wayland: remove unused 'input-event-codes.h' header
This was accidentally committed by rBecbf838feefc.
2021-07-12 20:20:08 +01:00
5e1702e7a5 Fix T87844: Cycles losing 1 bit of precision when loading packed byte images
This could lead to colors that are supposed to be exactly white to be slightly
darker.
2021-07-12 19:19:04 +02:00
Johnny Matthews
2a41ab5e6c Geometry Nodes: Curve Primitive Quadrilateral
This commit adds a curve primitive node for creating squares,
rectangles, trapezoids, kites, and parallelograms. It also includes
a mode where the four points are just vector inputs.

Differential Revision: https://developer.blender.org/D11665
2021-07-12 13:11:52 -04:00
a072e87e04 Fix T89040: dependency graph not handling time remapping correctly
In this bug report it resulted in rendering animations stopping too early,
but this affected more areas.

After the previous cleanup commit, it becomes clear that frame and ctime
values were mixed up.
2021-07-12 17:41:26 +02:00
2ea565b0ec Cleanup: improve naming and comments of scene frame/ctime functions
Confusingly, BKE_scene_frame_get did not match the frame number as expected by
BKE_scene_frame_set. Instead it return the value after time remapping, which
is commonly named "ctime".

* Rename BKE_scene_frame_get to BKE_scene_ctime_get
* Add a new BKE_scene_frame_get that matches BKE_scene_frame_set
* Use int/float depending if fractional frame is expected
2021-07-12 17:41:15 +02:00
f709f12d93 Fix T89736: Cycles error with persistent data, displacement and motion blur 2021-07-12 15:56:31 +02:00
45a47142fc Fix T89396: Cycles missing passes with multiple view layers and persistent data 2021-07-12 15:40:45 +02:00
5f3f5db95d Cleanup: Clang format
Sorry, missed this in 53cf8e83b3.
2021-07-12 14:40:26 +02:00
8e69409eed Fix T89775: geometry nodes logging crash during render
Under some circumstances (e.g. when rendering) the geometry
nodes logger is not used. This was missing a simple null check.
2021-07-12 14:29:28 +02:00
280dac323c Blenlib: Add BLI_assert_msg() for printing an extra string if the assert fails
It always bothered me that we'd do the `BLI_assert(... || !"message")` trick to
print a message alongside the assert, while it should be trivial to have a way
to pass an extra string as additional argument.

This adds `BLI_assert_msg()` with a second argument for a message. E.g.:
```
BLI_assert_msg(
    params->rename_id == NULL,
    "File rename handling should immediately clear rename_id when done, because otherwise it will keep taking precedence over renamefile.");
```

On failure this will print like this:
```
0   Blender                             0x00000001140647a3 BLI_system_backtrace + 291
[...]
13  Blender                             0x00000001092647a6 main + 3814
14  libdyld.dylib                       0x00007fff203d8f5d start + 1
BLI_assert failed: source/blender/editors/space_file/file_ops.c:2352, file_directory_new_exec(), at 'params->rename_id == ((void*)0)'
  File rename handling should immediately clear rename_id when done, because otherwise it will keep taking precedence over renamefile.
```

Reviewed by: Sybren Stüvel, Jacques Lucke, Sergey Sharybin, Campbell Barton

Differential Revision: https://developer.blender.org/D11827
2021-07-12 11:46:24 +02:00
c4f9bfcf5e Fix T89765: boolean modifier collection refcount issue
The 'collection' property is flagged PROP_ID_REFCOUNT, so the
modifiers foreachIDLink functions should walk with IDWALK_CB_USER
(instead of IDWALK_CB_NOP).

Otherwise the modifier wont be included as a user for the collection
(e.g. on file read); removing the collection from the modifier will
decrement usercount though (which in worst case scenario makes the
collection orphan and will result in data loss)

Maniphest Tasks: T89765

Differential Revision: https://developer.blender.org/D11877
2021-07-12 10:48:27 +02:00
2289e26fa3 Cleanup: correct spelling in comments, remove profanity 2021-07-11 15:31:36 +10:00
0f201049b4 Edit Mesh: tag the object data for updating instead of the object
When editing vertices with number buttons, tag the mesh, not the object.

This prevents the evaluated mesh being re-created for the object
and is correct as the mesh is being edited not the object.

Note that all tags for updating object geometry should be checked
to see if this change should be applied there too.

From a simple test on a high-poly mesh this gives around 1.3x
overall speedup.
2021-07-11 15:22:20 +10:00
49a363f0e0 LineArt: Fix edge type panel use_cache prop.
The name was mistakenly written as `use_cached_result`. Fixed.
2021-07-10 21:52:35 +08:00
77a28f34d5 LineArt: Fix modifier apply.
After cache implementation line art apply will not show strokes properly, now fixed.

# Conflicts:
#	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
2021-07-10 14:04:23 +08:00
62d9dabc7d UI: Clip: Fix checkbox wrongly greying out entire column
The Pattern and Search display options in the Clip Editor display settings
are independent and should not be grayed out since those options
remain relevant even with path display turned off.

Alternative solution were propoesed in D11630 and D11715
but each of those patches had downsides.
This solution is the simplest and does not break muscle memory.
2021-07-09 19:23:08 -04:00
d5e91ae883 make.bat: Update detection order of MSVC
VS2019 is the preferred version to use these
days, look for it before looking for 2017
and 2022.
2021-07-09 15:17:05 -06:00
53cf8e83b3 Fix channel packed images display in the Image/Node editor
Channel packed images should not have their RGB affected by alpha.
rendering in Cycles and Eevee was fine already, but displaying these was
not right in the Image and Node editors.

Not 100% sure what to do for the "Color and Alpha" mode, but I guess
this should stay like it was before (applying the alpha).

"Color", "R", "G", and "B" modes were changed to not have color be
affected by alpha though.

ref. T89034

Maniphest Tasks: T89034

Differential Revision: https://developer.blender.org/D11871
2021-07-09 22:00:04 +02:00
Johnny Matthews
d7f88982a8 Geometry Nodes: fix direction mode in curve primitive line node
Differential Revision: https://developer.blender.org/D11872
2021-07-09 18:34:40 +02:00
4c716ced09 Fix a compiler warning on Windows for Exact Boolean.
For some reason, the Windows compiler didn't like the
static function being used in the parallel_reduece.
2021-07-09 09:29:33 -04:00
09082f6e85 Fix: crash when using empty attribute search 2021-07-09 15:21:25 +02:00
c749c24682 Walk Navigation: Z axis correction
Fly navigation has always had this option. They is particularly useful
when users use "Trackball" as their orbit method.

For walk navigation this works as a one off option. Not as a toggle like
for fly navigation.

Differential Revision: https://developer.blender.org/D11863
2021-07-09 15:03:50 +02:00
Sybren A. Stüvel
c04cceb40e Fix T89435: Reordering FCurves can cause crash or corruption
Correctly reset `prev` and `next` pointers of action group FCurves when
separating them into distinct `ListBase`s per `bActionGroup`.

These `NULL` pointers are necessary to temporarily demarcate the start &
end of the `bActionGroup::channels` list. Having them still point to
other FCurves caused ordering issues when moving curves towards the
start/end of a group.

This commit corrects the above issue and adds versioning code to rectify
any ordering issues that may have been caused. For this purpose the
`BKE_action_groups_reconstruct()` function is rewritten to avoid relying
on the `bAction::curves` list order or `prev` link integrity.

Differential Revision: https://developer.blender.org/D11811
2021-07-09 12:21:12 +03:00
b69ab42982 Deps: upgrade OpenXR 1.0.14 → 1.0.17
Simple upgrade of OpenXR to 1.0.17. A version bump was enough, no
Blender code had to change.

Reviewed By: LazyDodo, mont29

Differential Revision: https://developer.blender.org/D11848
2021-07-09 11:06:40 +02:00
16099c00d0 Fix cycles crash when changing viewport display pass
It was possible that render buffers and scene kernel data will be out
of sync because reset and scene update happens in different locks.

This is similar issue we've fixed in the Cycles X branch, so backported
relevant changes from there.

This change removes what seems to be unused feature kernel.

Differential Revision: https://developer.blender.org/D11828
2021-07-09 10:43:47 +02:00
8dd941cac0 Tracking: Fix "Lock to Selection" option from header causing jump
This change makes the behavior consistent between shortcut and
option from space clip's header.

The only caveat is that the "Lock to Selection" is removed from the
Display popover. This is because it is rather hard to make operator
to render same as regular checkbox. However, shouldn't be a problem
because the setting in popover was redundant.

Differential Revision: https://developer.blender.org/D10423
2021-07-09 10:37:36 +02:00
249a7e2307 Cleanup: Walk Navigation define remame
WALK_MODAL_TOGGLE > WALK_MODAL_GRAVITY_TOGGLE
2021-07-09 10:27:29 +02:00
8225b610dd Fix typo in Fly mode tooltip
The bug was always around and was introduced with the original code
e2a7168e96 (2009).
2021-07-09 10:21:02 +02:00
07faa3c5ac Nodes: Moved group interface panel code to python.
The node group interface panels were still implemented in C.
Now they ported over to python for easier maintenance.

Differential Revision: https://developer.blender.org/D11834
2021-07-09 07:57:29 +01:00
d0c5c67e94 Make Single User: support object data animation
In addition to _object_ animation, now _object data_ (mesh, curve, ...)
animation can now be made single user as well.

This came up in T89369 and while it is possible to do this via the
Outliner [where all actions have to be selected individually], this
seems to be more convenient to be done from the 3DView.

note: usercount of the action is checked now, if it single-user already,
no copy takes place (same thing could/should be done for
single_object_action_users as well).

note2: obdata is made single user as well (otherwise duplicated actions
will be assigned to the same shared obdata - which does not result in
unique animadata which is what we are after here)

ref. T89369

Maniphest Tasks: T89369

Differential Revision: https://developer.blender.org/D11683
2021-07-09 08:09:43 +02:00
0416aa767f Cleanup: use 'uint' for BLI_array 2021-07-09 13:37:52 +10:00
7592a5097c BLI_array: add BLI_array_deduplicate_ordered utility & tests 2021-07-09 13:35:54 +10:00
ab70133db0 Cleanup: rename BKE_animdata_{add=>ensure}_id
Use the term `ensure` as existing data is used when present.
2021-07-09 11:53:16 +10:00
af8fb707da BLI: avoid calling deleted copy constructor in some compilers
Previously, this did not compile in VS 2017, because
`new T(initializer_())` would try to call the copy constructor of `T`.

Now, `initializer_` will construct the `T` inplace.
2021-07-08 19:54:09 +02:00
Pratik Borhade
4e5537d0ed Fix T89169: Rename Compositor Node "View Switch" to "Switch View" in search panel
Renaming compositor node in search panel "View Switch" to "Switch View"
for better consistency.

Reviewed By: dfelinto

Differential Revision: https://developer.blender.org/D11717
2021-07-08 14:59:26 +02:00
80d0b68290 GPencil: Support camera "Frame Selected" and object previews
Using the "Camera Fit Frame to Selected" operator didn't work for Grease Pencil
objects. The same issue caused grease pencil preview thumbnails to be useless
(e.g. when using "Mark Asset" on a Grease Pencil object).
Reason was that there was no logic to handle grease pencil data and its strokes
for the object display-point iterators used for the "Frame Selected" logic.

Addresses T89656.

Reviewed by: Antonio Vazquez, Campbell Barton

Differential Revision: https://developer.blender.org/D11833
2021-07-08 14:20:14 +02:00
5d54f38949 Fix: instances are made real when they shouldn't be
The original assumption that the `modifyMesh` function is only
called when the modifier is applied was wrong. There are still a
couple of other places calling it through `BKE_modifier_modify_mesh`.

Now there is an extra check that makes sure instances are only
realized when the modifier is actually applied.
2021-07-08 13:11:21 +02:00
c304807099 Fix compositor backdrop gizmo refresh problem when toggling sidebar
The backdrop image gizmo was not following the backdrop image, it
needs to be refreshed whenever the view changes. The region init
callback is executed whenever the region size changes, so that should be
a reliable place to do that.

Reported as part of T87591.
2021-07-08 13:08:10 +02:00
4c8a8950cf Cleanup: remove trailing spaces from install_deps.sh
No functional changes.
2021-07-08 11:38:48 +02:00
b6a35a8153 Outliner: use 'compacted' row for bones as well
In a collapsed hierarchy, some type of data are listed as one icon per
item (2.79 did this for all data),
others are 'compacted' as a single icon with a counter (also indicating
if the active item is down that collapsed hierarchy) from 2.80 on.

Not quite sure if {rB92dfc8f2673e} was meant to do this (if it was, this
was not working though because relevant code would only get executed for
object hierarchies it seems), so now this is done for bones as well.

Fixes T88413.

Maniphest Tasks: T88413

Differential Revision: https://developer.blender.org/D11404
2021-07-08 10:41:38 +02:00
7489427e4d Cleanup: spelling 2021-07-08 13:31:38 +10:00
c3cb565250 CMake: add missing headers, sort file lists 2021-07-08 13:21:22 +10:00
8346417d09 Fix crash displaying the sequencer without a valid 'scene->ed'
Regression in 45d54ea67f
2021-07-08 10:15:03 +10:00
nutti
695e025c82 Docs: Fix minor incorrect syntax errors
This patch fixes the incorrect syntax in documentations.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11822
2021-07-07 19:41:46 -04:00
51019fbfce Cleanup: Consolidate tablet walk mode rotate factors.
Walk rotate speed for tablets was being modified at runtime by scaling
the user preference mouse_speed by a constant factor; this consolidates
scaling into the the compile time tablet scale factor in walkApply.

No change in behavior.
2021-07-07 16:33:50 -07:00
139c3f791e Cleanup: Remove wrong File Browser comment
Accidentally included this in rB01e1944cd455, it came from a merge
conflict.
2021-07-07 19:49:28 +02:00
54fa5041e2 Cleanup: Correct comment in earlier commit (f4cb3ccd9c)
Comment was based on an older version of the patch.
2021-07-07 19:38:37 +02:00
2b41b2f05b Cleanup: Code-style correction in Ghost (Clang-format) 2021-07-07 19:26:47 +02:00
f4cb3ccd9c Assets: Keep assets active after renaming, ensure they are scrolled into view
When renaming an ID somewhere in the UI after marking it as asset, it would
often get lost in the Asset Browser (scrolled out of view). It would also get
deactivated.
This patch makes sure that if an asset is active whose ID gets renamed, it is
kept active and visible. That is important for a fast, uninterrupted asset
creation workflow, where users often rename assets while working in the asset
browser.

Old code stored the new file-name to identify a file after re-reading the
file-list after the rename. For assets that doesn't work because there may be
multiple assets with the same name. Here the simple solution of just storing
the pointer to the renamed ID is chosen, rather than relying on the file-name
in this case. (Should be fine with undo, since the ID * reference is short
lived, it's not stored over possible undo steps. If it turns out to have
issues, I rather switch to a rename_id_uuid, but keep that separate from the
file->uid).

Reviewed by: Sybren Stüvel

Differential Revision: https://developer.blender.org/D11119
2021-07-07 19:24:06 +02:00
fb98f22ddd MSVC: Fix build issue with TBB
TBB includes in windows.h which will by
default define min/max macro's by default,
which collide with stl's min/mac functions.

this change instructs windows.h not to
add the offending macros
2021-07-07 10:55:27 -06:00
6b0869039a File Browser: Select files and directories after renaming
(Note: This is an alternative version for D9994 by @Schiette. The commit
message is based on his description.)

Currently, when a new directory is created it is not selected.
Similarly, when renaming an existing file or directory, it does not
remain active/highlighted blue after renaming.

This change makes sure the file or directory is always selected after
renaming, even if the renaming failed or was cancelled.
This has some usability advantages:
 - Open the newly created directory without having to select it (ENTER).
 - If you make a naming mistake, you can immediately fix that (F2)
   without having to click it again.
 - If you create a directory and forget to name it, you can fix that
   (F2) without having to select it.
 - This is consistent with many common File Browsers.

Further, selecting the item even after renaming failed or was cancelled
helps keeping the file in focus, so the user doesn't have to look for it
(especially if the renaming just failed which the user may not notice).
In other words, it avoids disorienting the user.

Also see D11119 which requires this behavior.

We could also always select the file/directory on mouse press. This
would make some hacks unnecessary, but may have further implications. I
think eventually that's what we should do though.
2021-07-07 18:41:27 +02:00
13672f8b32 Cleanup: Move file deselection function to more appropriate file
`filesel.c` seems like the place that should contain file selection
functions. Previously it was in `file_ops.c` because that was the only
file that actually used it. But a followup commit needs it from a
different file.
2021-07-07 18:41:27 +02:00
cffbfe5568 Fix crash accessing sequencer strips
Was caused by recent clange sequences_all iterator in RNA (D11793).
2021-07-07 14:22:52 +02:00
ecbf838fee Cleanup: comment on source of button event codes 2021-07-07 13:21:57 +01:00
0153e99780 Geometry Nodes: refactor logging during geometry nodes evaluation
Many ui features for geometry nodes need access to information generated
during evaluation:
* Node warnings.
* Attribute search.
* Viewer node.
* Socket inspection (not in master yet).

The way we logged the required information before had some disadvantages:
* Viewer node used a completely separate system from node warnings and
  attribute search.
* Most of the context of logged information is lost when e.g. the same node
  group is used multiple times.
* A global lock was needed every time something is logged.

This new implementation solves these problems:
* All four mentioned ui features use the same underlying logging system.
* All context information for logged values is kept intact.
* Every thread has its own local logger. The logged informatiton is combined
  in the end.

Differential Revision: https://developer.blender.org/D11785
2021-07-07 11:20:19 +02:00
77834aff22 Fix T89397: animation in geometry nodes modifier does not update
The geometry nodes modifier uses id properties for the inputs to node groups.
That is because the set of properties changes depending on which geometry
node group is selected.

The animation was not updated correctly because the `ANIMATION_EVAL`
depsgraph node was not evaluated, because nothing depended on it in the
depsgraph. This patch makes sure that the proper link to the geometry
component is inserted.

Differential Revision: https://developer.blender.org/D11831
2021-07-07 10:56:45 +02:00
3fe0088cab Fix T89559: Outliner shows extra view layer column when it shouldn't
This issue happened because of some miscommunication during the original
patch review. Since we have the parent element in other outliner modes
(Blender File, Data API) I was on the fence here. Rolling this back now
so that when Show All View Layers is off we don't see the current View
Layer top element.

The fix is simple, but it was better to format the code around to
follow the style in this file.

Differential Revision: https://developer.blender.org/D11830
2021-07-07 10:41:12 +02:00
8f94724f22 Cleanup: Sort nodes alphabetically 2021-07-06 23:33:02 -05:00
89831fae0c Cleanup: update filename references 2021-07-07 14:08:47 +10:00
0b1050bf09 Geometry Nodes: Rename nodes for clarity between mesh and curve
Rename the mesh circle to "Mesh Circle", mesh line to "Mesh Line",
and mesh subdivide to "Mesh Subdivide". Previously they looked exactly
the same in the search menu, and the nodes themselves had the same
label. This is a "deep" rename that also renames internal defines and
function names to match the UI.
2021-07-06 23:00:27 -05:00
Jagannadhan Ravi
eccdced972 Cleanup: Moving mesh_evaluate and mesh_normals to C++
No functional changes.

Reviewed By: HooglyBoogly

Ref D11744
2021-07-07 13:58:18 +10:00
5bbbc98471 Cleanup: spelling in comments 2021-07-07 13:42:46 +10:00
Angus Stanton
63a8b3b972 Geometry Nodes: Curve Endpoints Node
This node is quite similar to the curve to points node, but creates
points for only the start and end of each spline. This is a separate
node because the sampling from the curve to points node don't apply,
and just for ease of use.

All attributes from the curves are copied, including the data for
instancing: tangents, normals, and the derived rotations. One simple
use case is to make round caps on curves by instancinghalves of a
sphere on each end of the splines.

Differential Revision: https://developer.blender.org/D11719
2021-07-06 22:24:04 -05:00
31e6f0dc7a makesdna: fix parsing 'const', 'struct', 'unsigned' as a prefix
DNA parsing assumed any identifier which starts with
(`struct`, `unsigned`, `const`) was that identifier.

So a struct called `constTest foo;` would be parsed as `est foo;`.

Add utility function to check identifiers are not
part of a larger identifier.

This also supports skipping these identifiers in any order.

Reviewed By: LazyDodo

Ref D11837
2021-07-07 12:35:03 +10:00
f85ef3d442 Cleanup: clang-tidy, unused function 2021-07-07 12:34:00 +10:00
cd38daeff4 Fix T89702: Curve to points node assert on single point spline
This function could be refactored slightly if we assumed the input was
always sorted, but a special for a single point input is also fine.
2021-07-06 21:09:01 -05:00
0521272ab3 Fix: Curve Resample Node: Copy attributes to 1 point results
The curve resample node neglected to copy attributes to single point
result splines. That could have caused errors if some of the splines
in the result had only one point but others had more.
2021-07-06 20:42:33 -05:00
4e80573a76 VSE: Use snapping settings for scrubbing
Use "Snap Playhead to Strips" option to enable playhead snapping.
Change behavior of CTRL key to invert snapping similar to transform operator.

Currently this option is disabled by default. It makes editing quite unpleasant
for me personally, but ideally I should gather feedback from more users.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D11745
2021-07-07 03:26:14 +02:00
c5b2381703 VSE: Remove seq->tmp usage from RNA code
This field was used to reference "parent" meta strips in `sequences_all`
RNA collection iterator functions.

Use `SeqIterator` wrapped in `BLI_Iterator` to iterate over elements.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11793
2021-07-07 03:14:05 +02:00
45d54ea67f VSE: Fix cache bar not visible
Cache bar was only visible when Frame overlay was enabled

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11779
2021-07-07 03:02:01 +02:00
6ac3a10619 Compositor: Fix constant folded operations not being rendered
Many operations do not expect single element buffers as output.
Use full buffers with a single pixel instead.
2021-07-07 01:09:43 +02:00
1657fa039d Compositor: Fix crash when executing works in constant folding
Work scheduler needed initialization and execution models are
not created during constant folding. This moves work execution
method to execution system.
2021-07-07 01:09:31 +02:00
f49f406f67 GPencil: Rename BKE_gpencil_visible_stroke_iter
Renamed to  BKE_gpencil_visible_stroke_advanced_iter

Also created a simple version of the iterator to be used without multiframe and onion skin.
2021-07-06 22:18:49 +02:00
Vincent Blankfield
4a24c6fe37 UI: Center the Status Bar Progress Text
This patch horizontally centers the text inside the progress bar
widget. It is currently left-aligned and offset to the middle, which
doesn't center properly.

see D11205 for details and examples.

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

Reviewed by Julian Eisel
2021-07-06 12:17:42 -07:00
46a261e108 Compositor: Fix execution system unset during constant folding 2021-07-06 20:22:43 +02:00
40de5742af Fix: Crash when geometry nodes NURB spline has no evaluated points 2021-07-06 13:12:27 -05:00
586cf8b190 Nodes: Adds button to groups to change type of sockets.
The menu lists all socket types that are valid for the node tree.
Changing a socket type updates all instances of the group and keeps
existing links to the socket.
If changing the socket type leads to incorrect node connections the
links are flagged as invalid (red) and ignored but not removed. This is
so users don't lose information and can then fix resulting issues.
For example: Changing a Color socket to a Shader socket can cause an
invalid Shader-to-Color connection.

Implementation details:
The new `NODE_OT_tree_socket_change_type` operator uses the generic
`rna_node_socket_type_itemf` function to list all eligible socket types.
It uses the tree type's `valid_socket_type` callback to test for valid
types. In addition it also checks the subtype, because multiple RNA
types are registered for the same base type. The `valid_socket_type`
callback has been modified slightly to accept full socket types instead
of just the base type enum, so that custom (python) socket types can be
used by this operator.

The `nodeModifySocketType` function is now called when group nodes
encounter a socket type mismatch, instead of replacing the socket
entirely. This ensures that links are kept to/from group nodes as well
as group input/output nodes. The `nodeModifySocketType` function now
also takes a full `bNodeSocketType` instead of just the base and subtype
enum (a shortcut `nodeModifySocketTypeStatic` exists for when only
static types are used).

Differential Revision: https://developer.blender.org/D10912
2021-07-06 18:36:11 +01:00
57317c4f83 Simplify python code with bool(keys) 2021-07-06 12:22:24 -05:00
6f258744b1 Merge branch 'master' into refactor-idprop-ui-data 2021-07-06 12:20:28 -05:00
933eddc9a1 cmake: use harvested 'wayland-protocols' if system version is insufficient 2021-07-06 18:17:27 +01:00
c26b46ddca cmake: add 'wayland-protocols' to 'make deps' 2021-07-06 18:17:27 +01:00
257bfb65b2 doc: add Wayland dependencies
The wayland support requires the following development packages:
libwayland-dev, wayland-protocols, libegl-dev, libxkbcommon-dev,
libdbus-1-dev, linux-libc-dev
2021-07-06 18:17:21 +01:00
a069fffcc4 GHOST/wayland: define BTN event codes manually 2021-07-06 18:17:21 +01:00
9182c882fe Geometry Nodes: Allow 3 points in curve star primitive 2021-07-06 12:11:09 -05:00
1364f1e35c Fix T89592: Can't remove keyframes without active keying set
Partially revert 7fc220517f, as it
introduced two issues:

- Deleting keys without active keying set was no longer possible, and
- there was no more confirmation popup.

Pressing {key Alt I} in the 3D Viewport now executes
`ANIM_OT_keyframe_delete_v3d`, adjusted to suit both T88068 and T89592:

- If there is an active keying set, delete keys according to that keying
  set.
- Otherwise, behave as `ANIM_OT_keyframe_delete_v3d` did before, that
  is, delete all keyframes of the selected object and in pose-mode also
  of selected bones.
2021-07-06 18:20:26 +02:00
563ef943c7 Cleanup: Keyframing, remove duplicate code
Remove duplicate code from the `ANIM_OT_keyframe_delete` operator. The
actions of the removed code are already performed by the preceding
`keyingset_get_from_op_with_error()` call.

No functional changes.
2021-07-06 18:20:26 +02:00
e2c4a4c510 Compositor: Graphviz improvements
Graphs are usually large, needing a lot of horizontal scrolling and
they can include more information for debugging.

This patch makes graph more compact horizontally by splitting
labels in lines and removing namespaces.
Furthermore it adds following information:
- Operation ID.
- SetValueOperation float value.
- Optionally, operation node name.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11720
2021-07-06 18:11:49 +02:00
5780de2ae0 Compositor: Enable constant folding on operations
Only on current full frame operations that can be constant.
2021-07-06 18:11:49 +02:00
fc5be0b598 Compositor: Constant folding
Currently there is no clear way to know if an operation is constant
(i.e. when all rendered pixels have same values). Operations may 
need to get constant input values before rendering to determine 
their resolution or areas of interest. This is the case of scale, rotate
and translate operations. Only "set operations" are  known as 
constant but many more are constant when all their inputs are so.
Such cases can be optimized by only rendering one pixel.

Current solution for tiled implementation is to get first pixel
from input. This works for root execution groups, others
need previous groups to be rendered.

On full frame implementation this is not possible, because buffers
are created on rendering to reduce peak memory and there is
no per pixel calls.

This patch evaluates all operations that are constant into primitive
operations (Value/Vector/Color) before determining resolutions.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11490
2021-07-06 18:11:49 +02:00
a070dd8bdd Cleanup: Set execution system as operations member in Compositor 2021-07-06 18:04:37 +02:00
1af722b819 Deps builder: macOS/ ffmpeg: Fix linker warning
ld: warning: could not create compact unwind for _ff_rl_init_vlc: stack
subq instruction is too different from dwarf stack size
Similar to rB2de5de57c58521862e0fecc95fc474ea347b7468

Differential Revision: https://developer.blender.org/D11796
2021-07-06 21:13:31 +05:30
Bastien Montagne
b05ba2ef0e Rename Scene's embeded collections from "Master Collection" to "Scene Collection"
Note that this name is essentially never used anywhere, besides as 'information'
mostly accessible from python console. Those embedded IDs are not in Main, so they
are not accessible by name ever, and mostly unusable from animation perspective
(either drivers or fcurves).

Therefore, no breakage is expected in user scripts or addons, nor when
loading in older versions of Blender.

Reviewed By: dfelinto, brecht

Differential Revision: https://developer.blender.org/D11812
2021-07-06 17:24:26 +02:00
7af40ccf5f GPU: Fix crash when using EGL with --gpu-debug flag.
During initialization of the platform a debug message is generated and
interpreted by de callback. Here the platform is checked what requires
an initialized platform.

Fixed by giving the platform check less priority in the check.
2021-07-06 14:24:42 +02:00
8f5a4a2453 Alembic export: evaluation mode option
This option will determine visibility on either render or the viewport
visibility. Same for modifer settings. So it will either evaluate the
depsgrah with DAG_EVAL_RENDER or DAG_EVAL_VIEWPORT.
This not only makes it more flexible, it is also a lot
clearer which visibility / modfier setting is taken into account (up
until now, this was always considered to be DAG_EVAL_RENDER)

This option was always present in the USD exporter, this just brings
Alembic in line with that.

ref. T89594

Maniphest Tasks: T89594

Differential Revision: https://developer.blender.org/D11820
2021-07-06 13:22:22 +02:00
834e87af7b Alembic: remove non-functional "Renderable Objects" only option
When introduced in {rB61050f75b13e} this was actually working (meaning
it checked the Outliner OB_RESTRICT_RENDER flag and skipped the object if
desired).

Behavior has since then been commented in rBae6e9401abb7 and apparently
refactored out in rB2917df21adc8.

If checked, it seemed to be working (objects marked non-renderable in
the Outliner were pruned from the export), however unchecking that
option did not include them in the export.

Now it changed - for the worse if you like - in rBa95f86359673 which
made it so if "Renderable Objects" only is checked, it will still export
objects invisible in renders. So since we now have the non-functional
option with a broken/misleading default, it is better to just remove it
entirely.

In fact it has been superseeded by the "Visible Objects" option (this
does the same thing: depsgraph is evaluated in render mode) and as a
second step (and to make this even clearer) a choice whether
Render or Viewport evaluation is used can be added (just like the USD
exporter has). When that choice is explicit, it's also clear which
visibility actually matters.

This is breaking API usage, should be in release notes.

ref. T89594

Maniphest Tasks: T89594

Differential Revision: https://developer.blender.org/D11808
2021-07-06 13:22:07 +02:00
ae8fa7062c Fix incompatible type passed to XR haptic
Likely caused by recent fixed-size types changes.
Seems to be no-functional-changes since the function is unused.
2021-07-06 12:36:42 +02:00
c577e6598d Report type "Error" to "Warning" 2021-07-05 22:47:47 -05:00
e1fa608c1b Rename IDPropertyUIDataType -> eIDPropertyUIDataType 2021-07-05 22:46:53 -05:00
3382b07ad6 Cleanup: rename 'count' to 'len'
Reserve the term count for values that require calculation
(typically linked lists).
2021-07-06 12:09:52 +10:00
432bfbf7a3 Cleanup: pep8 2021-07-06 12:05:27 +10:00
36584bbc2d Cleanup: quiet discarded-qualifiers warning 2021-07-06 12:05:25 +10:00
6903142975 Merge master 2021-07-05 17:31:13 -05:00
4eeec6e9b5 Fix macOS builds after removing Ghost integral types. 2021-07-05 15:24:39 -07:00
ceff86aafe Various Exact Boolean parallelizations and optimizations.
From patch D11780 from Erik Abrahamsson.
It parallelizes making the vertices, destruction of map entries,
finding if the result is PWN, finding triangle adjacencies,
and finding the ambient cell.
The latter needs a parallel_reduce from tbb, so added one into
BLI_task.hh so that if WITH_TBB is false, the code will still work.

On Erik's 6-core machine, the elapsed time went from 17.5s to 11.8s
(33% faster) on an intersection of two spheres with 3.1M faces.
On Howard's 24-core machine, the elapsed time went from 18.7s to 10.8s
for the same test.
2021-07-05 18:09:36 -04:00
cf17f7e0cc Fix T89671: Crash when using Denoise node on Full Frame mode
Tiled fallback doesn't support single element buffers.
Ensure tiles are initialized as full buffers.
2021-07-05 23:36:43 +02:00
3d9ecf1cf2 Compositor: Full frame Color Balance node
Adds full frame implementation to this node operations.
No functional changes.
1.3x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11764
2021-07-05 23:36:43 +02:00
0c90aa097d Compositor: Full frame Color Correction node
Adds full frame implementation to this node operation.
No functional changes.
1.4x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11765
2021-07-05 23:36:43 +02:00
bf75106ae9 Compositor: Full frame Exposure node
Adds full frame implementation to this node operation.
No functional changes.
1.7x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11766
2021-07-05 23:36:43 +02:00
c94877ae3d Compositor: Full frame Gamma node
Adds full frame implementation to this node operation.
No functional changes.
1.5x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11767
2021-07-05 23:36:43 +02:00
00c6cbb985 Compositor: Add base operation for updating buffer rows
Simplifies code for operations with correlated
coordinates between inputs and output.
2021-07-05 23:36:43 +02:00
61afbf55f1 Cleanup: Use enum for UI block emboss type 2021-07-05 14:52:21 -05:00
Nicholas Rishel
f3ec0d8e58 Replace Ghost integrals with stdint fixed width integers.
Also replace integer with bool in Ghost API when only used as boolean,
and uint8* with char* in Ghost API when variable is a string.

Reviewed By: brecht

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

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2021-07-05 11:00:45 -07:00
b66c21f8b0 Geometry Nodes: Use same shape as mesh line in curve line node
The line starts at the origin and ends at (0,0,1m), just like the mesh node.
2021-07-05 12:42:33 -05:00
Johnny Matthews
29d6750134 Geometry Nodes: Curve Primitive Line
This node creates a poly spline line in one of 2 modes:
 - Line between two points
 - Start Point, Direction, and Length

Both modes create splines with only start and endpoints.
A resample node can be used afterward to increase the point count.

Differential Revision: https://developer.blender.org/D11769
2021-07-05 12:27:12 -05:00
de70bcbb36 Cleanup: Clang tidy, unused include
Also a stupidly-included change I made when committing the patch.
2021-07-05 12:05:28 -05:00
Nikhil Shringarpurey
fd0370acc2 Geometry Nodes: Add explicit Float to Int conversion node
This patch adds a very simple node that explicitly converts a float to
an int. While this may seem redundant, it would offer 2 benefits to the
current requirement to use implicit float conversions:
 1. It makes the node tree's intent more clear and self-documenting
    (especially if changes in the future require integer inputs).
 2. It eliminates undefined behavior in current/future nodes from float
    inputs by guaranteeing that the input is an integer.

The node offers a variety of rounding techniques to make it more flexible.

Differential Revision: https://developer.blender.org/D11700
2021-07-05 11:52:10 -05:00
08241b313c Fix (studio reported) missing object's parent handling in readfile expand code.
This would prevent loading a parent that would only be referenced by
children during a linking operation.

Looks like this missing bit of code has been there since the stone ages,
it is fairly baffling to find that such critical low-levels mistakes can
survive decades in a codebase...

Note that such fully-indirectly linked parent object is not instantiated
in scene currently, this is fairly bad I think, but kind of a different
issue.
2021-07-05 18:07:02 +02:00
Yuki Hashimoto
0ef794b553 macOS: support Chinese and Korean input for text buttons
This patch extends D11695 to provide full support for Chinese and Korean
input on macOS.

Chinese input notes:

You can input symbolic characters (such as '! , '$') during Chinese input.

The difference from Japanese input is that multiple `insertText` may be
called with a single key down (`keyDown` method). This happens when you input
a symbolic character (such as '! , '$') during conversion.

The conversion is confirmed (`insertText`) and the symbolic character is
entered (`insertText`). To solve this problem, I have `result_text` to
concatenate the strings and store them in `result`.

Korean input notes:

Korean does not display a conversion suggestion window.

Like Chinese, Korean input may call multiple `insertText` methods. Also,
in Korean, the previous confirmation (`setMarkedText` and `insertText`) and
the next conversion is processed (`setMarkedText`) may be called
simultaneously with a single key down (`keyDown` method).

For example:
1. press g ㅎ (`setMarkedText`)
2. press k 하 (`setMarkedText`)
3. press t 앗 (`setMarkedText`)
4. press k 하세 (`setMarkedText`, `insertText`, `setMarkedText`)

Fixed so that the `insertText` and the last `setMarkedText` are processed.

Also, if a control character (such as Arrow, Enter) is input during Korean
input, the conversion will be confirmed (`setMarkedText`, `insertText`) and
the original control character will be processed.

In other words, if you press the left arrow key while typing in Korean, the
cursor will move to the left after the character is confirmed. Therefore, I
modified the `keyDown` method so that the `handleKeyEvent` is called again
after the `insertText` is processed in the `interpretKeyEvents` method.

Differential Revision: https://developer.blender.org/D11699
2021-07-05 17:24:34 +02:00
Yuki Hashimoto
83e2f8c993 macOS: support Japanese input for text buttons
Blender did not support to input East Asian characters (Chinese, Japanese,
Korean) on macOS. This patch adds support for Japanese input, by implementing
the appropriate processing for the NSTextInputClient protocol.

Technical notes:
* The conversion candidate window is drawn by the input method program calling
  `firstRectForCharacterRange`.
* The string before confirmation (called `composite` in blender) is handled in
  the `setMarkedText` method called by the input method program.
* The string after confirmation (called `result` in the blender) is processed
  in the `insertText` method called by the input method program.

Ref T51283

Differential Revision: https://developer.blender.org/D11695
2021-07-05 17:24:27 +02:00
Yuki Hashimoto
ac1ed19eae Fix: macOS wrong IME candidate window position on first display
IME conversion candidate window was displayed at the mouse position, instead of
below the cursor or text selection.

Blender need to tell the input method program where the conversion candidate
window is during Japanese and Chinese input.

In macOS, the `firstRectforCharacterRange` is called when input by the input
method starts, and the position of the conversion candidate window is
specified. Therefore, it is necessary to set the position of the conversion
candidate window before input starts. This patch changes it so that the position
of the conversion candidate window is always set when the cursor is drawn.

Differential Revision: https://developer.blender.org/D11697
2021-07-05 17:20:05 +02:00
673c254c7d Cleanup: Rename ambiguous "params" variable in File Browser notifier listeners
File Browser code uses the term "params" for its file selection parameters a
lot. Avoid confusion/ambiguity by calling the notifier listener parameters
"listener_params".
2021-07-05 16:45:15 +02:00
cadda7aa5c Assets: Disable file renaming operator for Asset Browsers
This operator only works with renaming files, not assets.
2021-07-05 16:06:47 +02:00
b8115f0c5b Fix performance regression in Exact boolean due to exact triangulation.
Went back to using Blender's polyfill for triangulation, which is much
faster (time for a 3.1M face boolean went from 103s to 48s).
Had to put in detection for the case that needs the exact triangulator
(bug T86805), and also a fix for non-convex quads (bug T89330).
2021-07-05 10:00:29 -04:00
dac81ad71b EditMesh: extract restore logic out of EDBM_redo_state_free
Split mesh restore logic into a new function:
`EDBM_redo_state_restore_and_free`.
2021-07-05 23:45:21 +10:00
d27db03444 LineArt: Fix occlusion effectiveness for culled triangles. 2021-07-05 20:43:03 +08:00
Yuki Hashimoto
2d0b9faaf6 Fix: IME conversion candidate window not correctly placed on macOS
Blender needs to tell the input method program where the conversion
candidate window is during Japanese and Chinese input.

In macOS, there are displays where the window size and the native pixel size
are different, so the candidate window may appear in an unnatural position.

This patch converts the cursor position x and y for matching macOS window
coordinate. On Windows, GHOST_GetNativePixelSize returns 1, so it has no effect.

Differential Revision: https://developer.blender.org/D11696
2021-07-05 14:32:35 +02:00
Yuki Hashimoto
32124b940e Fix: IME input displays text after cursor before cursor
When inserting text using IME on a button, the character after the cursor is
displayed before the cursor.

This bug seems to have occurred during the refactoring in D765.

Differential Revision: https://developer.blender.org/D11072
2021-07-05 14:32:35 +02:00
bd0de99b52 Cleanup: spelling, punctuation 2021-07-05 22:27:03 +10:00
2ecc33d84b Cleanup: move repeated assignment out of nested for loop 2021-07-05 22:02:57 +10:00
6eb8340ef4 Cleanup: use const arguments 2021-07-05 22:02:57 +10:00
416e006a2a Cleanup: use 'use_' prefix for RNA booleans 2021-07-05 22:02:57 +10:00
92b775d319 Cleanup: remove unnecessary bmesh operator comments 2021-07-05 22:02:57 +10:00
ab6a011b3b GPencil: Fix memory leak in trim and split functions.
`dvert->dw` from old strokes are not freed properly, fixed.
2021-07-05 19:56:41 +08:00
aad8b8405c Fix T89655: tweak Cycles transparent bounces UI for clarity
Transparent bounces are independent of other bounces, so don't group
them together.
2021-07-05 13:42:54 +02:00
2eca9c7ed4 Cleanup: Move common File Browser renaming code into functions
Code would manually do the same things in a couple of places, obvious case of
unnecessary code duplication.
2021-07-05 13:35:41 +02:00
Yuki Hashimoto
2c6c1b6cc0 Cleanup: replace NSTextInput with NSTextInputClient
This revision replaces the deprecated protocol NSTextInput with
NSTextInputClient in Cocoa Text View. No functional changes.

For more information of the methods, please see:
https://developer.apple.com/documentation/appkit/nstextinputclient

Differential Revision: https://developer.blender.org/D11407
2021-07-05 13:10:08 +02:00
Yuki Hashimoto
c1ba68dd04 Cleanup: use arrayWithObject to reduce the code
Similar code is found in Apple's code samples.

Differential Revision: https://developer.blender.org/D11434
2021-07-05 13:10:08 +02:00
24a77745a4 Functions: add utility to create string from value of generic type 2021-07-05 13:02:16 +02:00
fb46c047bd BLI: wrap more features off tbb::enumerable_thread_specific
* Make the wrapper enumerable.
* Support an initializer function.
2021-07-05 13:02:16 +02:00
ded4dc7761 BLI: add conversion constructor for destruct_ptr
This allows converting between different `destruct_ptr` types (which is
just a `std::unique_ptr` with a custom deleter).

The most common use case is to convert from a derived type to
the type of the base class.
2021-07-05 13:02:16 +02:00
dc3f46d96b Tests: performance testing framework
These are scripts for benchmarking Blender features on real-world .blend
files. They were originally written for benchmarking Cycles performance, and
were made generic so they can be used for more Blender features.

The benchmarks can be run locally by developers. But the plan is to also run
these as part of continuous integration to track performance over time.

Currently there are tests for Cycles rendering and .blend file loading.

Documentation:
https://wiki.blender.org/wiki/Tools/Tests/Performance

Main features:
* User created configurations to quickly run, re-run and analyze a selected
  subset of tests.
* Supports both benchmarking with existing builds, and automatic building of
  specified git commits, tags and branches.
* Generate HTML page with bar and line graphs from test results.
* Controlled using simple command line tool.
* For writing tests, convenient abstraction to run a Python function in Blender
  with arguments and return value.

Ref T74730

Differential Revision: https://developer.blender.org/D11662
2021-07-05 12:32:32 +02:00
bb971bead9 Fix T89523: Cycles OpenCL compile error after shadow terminator changes 2021-07-05 11:26:40 +02:00
e785569c95 Cleanup: clang-tidy 2021-07-05 19:09:24 +10:00
c9eaf04afb Cleanup: remove outdated comment 2021-07-05 19:08:19 +10:00
a87593e62a Fix early return in reverse-color where continue was intended 2021-07-05 18:54:53 +10:00
9009ac2c3d Geometry Nodes: new Viewer node
This adds a viewer node similar to the one in the compositor.
The icon in the headers of nodes is removed because it served
the same purpose and is not necessary anymore.

Node outputs can be connected to the active viewer using
ctrl+shift+LMB, just like in the compositor. Right now this collides
with the shortcut used in the node wrangler addon, which will
be changed separately.

As of now, the viewed geometry is only visible in the spreadsheet.
Viewport visualization will be added separately.

There are a couple of benefits of using a viewer node compared
to the old approach with the icon in the node header:
* Better support for nodes that have more than one geometry output.
* It's more consistent with the compositor.
* If attributes become decoupled from geometry in the future,
  the viewer can have a separate input for the attribute to visualize.
* The viewer node could potentially have visualization settings.
* Allows to keep "visualization points" around by having multiple
  viewer nodes.
* Less visual clutter in node headers.

Differential Revision: https://developer.blender.org/D11470
2021-07-05 10:46:36 +02:00
04313f1bb5 BMesh: remove redundant mesh-backups from EDBM_op_* API
Using BMesh operators through the edit-mesh API created a full copy
of the mesh so it was possible to restore the mesh in case
one of the operators raised an error.

Remove support for automatic backup/restore from the EDBM_op_* API's
as it adds significant overhead and was rarely used.

Operators that need this can use the BMBackup API to backup & restore
the mesh in case of failure.

Add warning levels to BMO_error_raise so operators can report problems
without it being interpreted as a request to cancel the operation.

For high-poly meshes creating and freeing a full copy is an expensive
operation, removing this gives a speedup of ~1.77x for most operators
except for "connect_verts" / "connect_vert_pair"
which still uses this functionality.
2021-07-05 18:36:33 +10:00
afe7387be8 BMesh: remove redundant copy-on-write tagging
The evaluated meshes no longer store a copy of the edit-mesh
so tagging when a BMesh operator fails can be removed.
2021-07-05 18:31:44 +10:00
b29a8a5dfe BMesh: dissolve faces no longer fails when some faces can't dissolve
Previously, any face groups that could not be merged into a face
caused the entire operation to report an error and do nothing.

Now these cases are skipped over, dissolving faces where possible.
2021-07-05 18:31:44 +10:00
9075f63e8f Cleanup: unused variable 2021-07-05 10:29:21 +02:00
76f7b22989 Cleanup: minor improvements to BMesh dissolve faces
- Only create arrays with groups of two or more faces.
- Remove raising exception for zero length arrays.
- Remove redundant exception check (assert there is no exception).
- Use a struct for face array & it's length instead of a NULL
  terminated array (removes the need to count faces in a loop).
2021-07-05 15:54:57 +10:00
dccadc9e78 Cleanup: update comment formatting
- Replace '[mce]' with "Mike Erwin".
- Remove references to turn-table author as it isn't useful information,
  the author was credited in the commit message.
2021-07-05 15:54:57 +10:00
5b2d2b2319 Cleanup: remove temporary header 2021-07-05 15:54:57 +10:00
2929cfe5de Cleanup: remove unused defines 2021-07-05 15:54:57 +10:00
f0f7282d9d Cleanup: spelling in comments 2021-07-05 15:54:57 +10:00
b73dc36859 GPencil: Add weight factor to Offset randomize
Now, The weight is used in the randomize parameters of the offset modifier. 

This is useful to generate effects like explosions.

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

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

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

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

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

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

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

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

The new option replaces the following setup:

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

(This analogy applies provided both bones use Local Location)

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

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

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

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

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

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

- More ways to combine the target and owner matrices.

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

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

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

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

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

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

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

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

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

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

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

Reviewed By: mendio, filedescriptor

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

see T88909 for an example of this affecting user experience.

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

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

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

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

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

Reviewed By: sergey

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

Reviewed By: HooglyBoogly

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

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

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

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

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

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

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

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

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

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

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

Maniphest Tasks: T88701

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

Maniphest Tasks: T89535

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

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

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

This is done using a parallel loop over transform data.

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

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

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

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

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

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

Curve primitives design task: T89220

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

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

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

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

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

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

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

Reviewed By: mano-wii

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

see D10863 for details and examples.

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

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

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

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

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

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

Reviewed By: brecht

Maniphest Tasks: T70615

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

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

Reviewed By: Sebastian Parborg (zeddb)

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

Maniphest Tasks: T89484

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

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

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

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

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

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

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

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

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

see D11721 for more details.

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

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

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

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

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

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

Reviewed By: #cycles, brecht

Maniphest Tasks: T87194

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

Reported by studio, thanks.

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

Reported by studio, thanks.

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

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

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

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

Reviewed By: Sebastian Parborg (zeddb)

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

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

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

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

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

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

- CURVE_OT_select_random
- LATTICE_OT_select_random
- OBJECT_OT_select_random

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

- BLI_bitmap_randomize
- BLI_rng_shuffle_bitmap

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

Reviewed by Dalai Felinto (dfelinto)

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

This option is off by default.

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

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

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

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

Performance:

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

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

Details:

- Rotate & non-uniform scale only skip tessellation.

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

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

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

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

Reviewer: Hans Goudey (Hoogly Boogly)

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

Reviewer: Hans Goudey (Hoogly Boogly)

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

see D11706 for details and examples.

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

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

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

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

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

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

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

Reviewed By: brecht

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

Reviewed By: Sebastian Parborg (zeddb)

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

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

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

Reviewed By: Sebastian Parborg (zeddb)

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

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

Testing shows a significant overall speedup when transforming:

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

Reviewed By: sergey

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

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

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

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

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

Reviewed By: sergey

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

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

Reviewed by: Sebastian Parborg (zeddb)

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

Reviewed By: Sebastian Parborg (zeddb)

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

Reviewed By: JulienKaspar, JacquesLucke

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

Reviewed By: JacquesLucke

Maniphest Tasks: T89221

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

Reviewed By: jbakker

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

Reviewed By: jbakker

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

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

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

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

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

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

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

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

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

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

Reviewed By: lichtwerk

Maniphest Tasks: T88808

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

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

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

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

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

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

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

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

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

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

This reverts commit f8d219dfd4.

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

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

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

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

Also add matching test.

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

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

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

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

Reviewed By: #cycles, brecht

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

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

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

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

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

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

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

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

Maniphest Tasks: T88852

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

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

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

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

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

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

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

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

Master:{F10185359}
Patch:{F10185361}

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

Reviewed By: mano-wii

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

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

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

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

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

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

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

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

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

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

Reviewed By: sergey, mano-wii

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

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

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

Differential Revision: https://developer.blender.org/D10959
2021-06-18 16:33:02 -05:00
cee6e9dcc0 Slightly refactor default value array retrieval (keep manual parsing for better error messages) 2021-06-18 13:54:19 -05:00
45c1135999 Cleanup: Refactor to pass around fewer values between functions 2021-06-18 13:39:57 -05:00
d52b7dbe26 Fix T89261: Crash when calculating bmesh tessellation
Error passing `false` instead of a `BMeshCalcTessellation_Params` struct.
2021-06-18 15:20:36 -03:00
ae74e88990 Passing tests with a new version of argument parsing 2021-06-18 13:04:28 -05:00
e93214ab23 Fix bug with writing ID type UI data 2021-06-18 13:03:14 -05:00
3e6f2c7a99 Cleanup: Remove dead code
This code was disabled in 2.8 and all other associated code/comments 
have been removed/cleared. These rna properties have been replaced with 
`seq_prev_type`
2021-06-18 13:54:00 -04:00
f7022fc73f Fix Build Warning
Removal of unused local variable. Calculation of underline thickness
no longer needed with change to text output of underscore character.

Introduced in aee04d4960

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

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

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

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

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

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

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

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

Finally, the Z channels are confusingly called Y.

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

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

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

Introduced in 0fcc063fd9

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

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

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

Reviewed By: mano-wii

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

Master: 0.043612s Threaded 0.017964s.

Master: {F10179586}
This patch: {F10179587}

Reviewed By: mano-wii

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

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

Regression introduced in rBf6c5af3d4753 I think.

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

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

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

Before: {F10179981}
After: {F10179982}

Reviewed By: mano-wii

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

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

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

Ref D11637
2021-06-18 11:13:09 +10:00
94c4a9995e Fix T89233: Incorrect attribute remove warning for curves
The curve attribute delete function didn't return whether it was
successful or not.
2021-06-17 17:22:09 -05:00
212fde45ac Cleanup: change name of function 2021-06-17 16:36:28 -05:00
232e3f83bf Fix some smaller review comments, WIP changes trying to implement different arg parsing 2021-06-17 16:29:26 -05:00
4b673ebb99 Raycast geometry node.
The //Raycast// node intersects rays from one geometry onto another.
It computes hit points on the target mesh and returns normals, distances
and any surface attribute specified by the user.

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

Docs: D11620

Reviewed By: HooglyBoogly

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

The error affected to Strokes and Point mode
2021-06-17 20:41:53 +02:00
278bead415 Merge branch 'master' into refactor-idprop-ui-data 2021-06-17 12:39:54 -05:00
ed4222258e Geometry Nodes: Add Curve Subdivision Node
This node creates splines with more control points in between the
existing control points. The point is to give the splines more
definition for further tweaking like randomization with white noise,
instead of deforming a resampled poly spline with a noise texture.

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

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

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

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

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

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

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

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

No functional changes.

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

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

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

Reviewed By: sergey, mano-wii

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

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

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

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

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

Reviewed By: HooglyBoogly, JacquesLucke

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

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

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

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

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

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

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

Reviewed By: jbakker

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

Reviewed By: jbakker

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

Reviewed By: jbakker

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

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

Reviewed By: sybren

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

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

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

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

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

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

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

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

Remove animation from propery if it was unused.

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

Reviewed By: sergey

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

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

Reviewed By: sergey, jbakker

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

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

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

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

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

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

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

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

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

Patch implemented by Sergey and me.

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

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

Reviewed By: jbakker

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

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

This patch doesn't include multithreading of this code.

Reviewed By: mano-wii

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

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

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

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

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

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

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

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

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

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

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

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

Introduced in bcff0ef9ca

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

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

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

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

Reviewed By: Richard Antalik

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

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

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

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

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

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

- BM_mesh_calc_tessellation_ex
- BM_mesh_normals_update_ex

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

- BKE_editmesh_looptri_and_normals_calc
- BKE_editmesh_looptri_and_normals_calc_with_partial

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

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

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

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

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

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

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

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

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

Differential Revision: https://developer.blender.org/D11466
2021-06-14 12:26:07 +02:00
c9dc55301c Fix T88494: add missing depsgraph relation update tags
Adding e.g. a Collection Info node creates a new depsgraph relation.
Therefore the relations should be updated.
2021-06-14 11:35:36 +02:00
a19c9e9351 Fix T88947: invalid normals when converting point cloud to mesh 2021-06-14 11:07:42 +02:00
Campbell Barton
2db09f67a4 Nodes: remove redundant increment node tree current socket index
`ntree->cur_index` was being incremented twice in make_socket_interface.

Reviewed By: JacquesLucke

Ref D11590
2021-06-14 18:46:39 +10:00
03544ed54f Fix T88807: crash when there are multiple links between the same sockets
This commit does two things:

* Disallows creating more than one link from one socket to a multi socket input.
* Properly count links if there happen to be more than one link between the same sockets.

The new link counting should also be more efficient asymptotically.

Differential Revision: https://developer.blender.org/D11570
2021-06-14 10:04:52 +02:00
54a03d4247 Cleanup: Reduce indentation from redundant check 2021-06-13 18:56:52 -05:00
84adc23941 Cleanup: Order return argument last 2021-06-13 18:22:31 -05:00
0f68e5c30a Fix libmv new[]/delete[] mismatch 2021-06-13 15:13:08 +10:00
5181bc46b3 Cleanup: allocation size mismatch warning
While harmless, use fixed size int type for pixel data.
2021-06-13 14:54:54 +10:00
452590571c Cleanup: rename 'unsigned int' -> 'uint' 2021-06-13 14:54:54 +10:00
ab38223047 Cleanup: redundant initialization
These were limited to obvious cases. Some less obvious cases
were kept as refactoring might make them necessary in future.
2021-06-13 14:54:54 +10:00
f731bce6cd Cleanup: use ATTR_RETURNS_NONNULL function attribute 2021-06-13 14:47:19 +10:00
4c3bb60d0f Cleanup: use return arg prefix for ED_object_add_generic_get_opts 2021-06-13 14:47:18 +10:00
9ff4e0068f Cleanup: avoid the possibility of 'enter_editmode' being left unset
While in practice this isn't an issue currently, always set
'enter_editmode' in ED_object_add_generic_get_opts
to avoid problems in the future.
2021-06-13 14:47:07 +10:00
84e98ba182 Cleanup: misleading return argument for hair_create_input_mesh
- The argument with named with an `r_` prefix when it was in fact
  also read from.
- The argument passed in had to be 'psys->clmd->hairdata',
  if it was not - the function would not worked.
2021-06-13 14:47:04 +10:00
8e58f93215 Cleanup: remove redundant NULL check, reduce scope 2021-06-13 14:47:03 +10:00
aab4794512 Cleanup: missing include 2021-06-13 14:47:01 +10:00
952d6663e0 Fix modifier deform by armature check ignoring virtual modifiers
Regression in f00cb93dbe (fix for T63125)
2021-06-13 14:46:59 +10:00
7b0c8097a7 Fix missing directory in CMakeLists.txt 2021-06-12 00:00:29 -03:00
b313525c1b Fix T88515: Cycles does not update light transform from linked collections
When moving a linked collection, we seem to only receive a depsgraph update
for an empty object so the Blender synchronization cannot discriminate it
and tag the object(s) (light or geometry) for an update through
id_map.set_recalc.

This missing transform update only affects lights since we do not check
manually if the transformations were modified like we do for objects.

To fix this, add a check to see if the transformation is different provided
that a light was already created.

Reviewed By: brecht

Maniphest Tasks: T88515

Differential Revision: https://developer.blender.org/D11574
2021-06-12 04:13:43 +02:00
d75e45d10c Fix T88812: Child Windows on Vertical Monitors
This patch improves the positioning of child windows when on monitors
that are arranged vertically (any above any other). When calculating a
window position in Ghost coordinates from GL coordinates we were using
monitor height, which can give incorrect values when desktop is taller
than any single monitor. So use desktop height instead.

See D10637 for more details and examples.

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

Reviewed by Brecht Van Lommel
2021-06-11 14:39:19 -07:00
bd87ba90e6 Render Window as Non-Child on Win32 platform
This patch makes the "Render" window a top-level window, not a child of
the main window, which was the case in blender versions prior to 2.93.
This means it is no longer "on top", nor is the icon grouped on the
taskbar in the same way, but you can Alt-Tab between it and the main
window. This change only affects the Windows platform as the other
platforms behave this way.

See D11576 for links to negative feedback that prompts this change.

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

Reviewed by Brecht Van Lommel
2021-06-11 13:07:30 -07:00
Pablo Dobarro
7bc5246156 Overlays: Make flash on mode transfer an operator property
This moves the flash on mode transfer effect option from the overlays to
an operator property of the mode transfer operator.

- This effect is intended to show the target object when no overlays or
a minimal set of overlays is enabled. Making it part of the whole set of
overlays invalidates this use case.

- The effect is not intended to be configurable per viewport, it should
be a global option.

The effect is still implemented using the overlay engine (instead of a
draw modal callback) due to performance and drawing artifacts. Having it
implemented as an overlay with runtime timer data in the objects makes
also possible to run multiple animations at the same time without any
visual glitches.

Reviewed By: campbellbarton, JulienKaspar

Differential Revision: https://developer.blender.org/D11519
2021-06-11 21:48:59 +02:00
f6c5af3d47 Add option to link assets on drag & drop
Note: Linking in this case as in link vs. append. Easily confused with linking
a data-block to multiple usages (e.g. single material used by multiple
objects).

Adds a drop-down to the Asset Browser header to choose between Link and Append.
This is probably gonna be a temporary place, T54642 shows where this could be
placed eventually.

Linking support is crucial for usage of the asset browser in production
environments. It just wasn't enabled yet because a) the asset project currently
focuses on single user, not production assets, and b) because there were many
unkowns still for the workflow that have big impact on production use as well.
With the recently held asset workshop I'm more confident with enabling linking,
as design ideas relevant to production use were confirmed.

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

Reviewed by: Bastien Montagne
2021-06-11 16:46:20 +02:00
c8fcea0c33 Fix object assets getting duplicated after dropping
The operator run when dropping objects would duplicate the dropped object and
place that in the scene, even though that was just appended. Addressed by
making the duplication optional for the operator. If the duplication is not
requested, the object is just added to the scene (if needed), repositioned
based on the drop location and selected (deselecting other objects).
This makes the operator work as expected when using it to drop assets.

Reviewed as part of https://developer.blender.org/D11536.

Reviewed by: Bastien Montagne
2021-06-11 16:46:20 +02:00
20ece8736f Fix T89001: node search not working anymore 2021-06-11 16:27:56 +02:00
Maxime Casas
b4adb85933 Fix T89033: segfault reordering animation channels
Fix segmentation fault that can occur when reordering animation
channels.

Under some specific conditions, the list "act->curves" is empty in the
"join_groups_action_temp" function. In particular, this happens when a
scene contains an action that has not been pushed down, and with no
keyframe in it.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11569
2021-06-11 16:27:04 +02:00
605ce623be Nodes: cache socket identifier to index mapping
While this preprocessing does take some time upfront,
it avoids longer lookup later on, especially as nodes get
more sockets.

It's probably possible to make this more efficient in some cases
but this is good enough for now.
2021-06-11 16:21:23 +02:00
Jeroen Bakker
7b30a3e98d Performance: Use parallel range for ImBuf scanline processor.
Scanline processor did its own heurestic what didn't scale well when
having a multiple cores. In stead of using our own code this patch will
leave it to TBB to determine how to split the scanlines over the
available threads.

Performance of the IMB_transform before this change was 0.002123s, with
this change 0.001601s. This change increases performance in other areas
as well including color management conversions.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D11578
2021-06-11 15:55:22 +02:00
Jeroen Bakker
7b76a160a4 Sequencer: Do not redraw during playback.
When using large sequences including audio the drawing of the audio on
top of the strip takes a lot of time. This effects the playback
performance heavily.

During the animation playback performance there was a solution for this
by only drawing the playhead overlay. This was reverted for the sequence
editor as it didn't update the color strips when they were animated.

This patch checks if there are animated color strips if so the full
screen is redrawn, otherwise only the playhead is redrawn.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D11580
2021-06-11 15:51:26 +02:00
0eb9351296 Refactor: use 'BLI_task_parallel_range' in Draw Cache
One drawback to trying to predict the number of threads that will be
used in the `task_graph` is that we are only sure of the number when the
threads are running.

Using `BLI_task_parallel_range` allows the driver to
choose the best thread distribution through `parallel_reduce`.

The benefit is most evident on hardware with fewer cores.

This is the result on an 4-core laptop:
||before:|after:
|---|---|---|
|large_mesh_editing:|Average: 5.203638 FPS|Average: 5.398925 FPS
||rdata 15ms iter 43ms (frame 193ms)|rdata 14ms iter 36ms (frame 187ms)

Differential Revision: https://developer.blender.org/D11558
2021-06-11 10:49:50 -03:00
Germano Cavalcante
2330cec2c6 Refactor: Draw Cache: use 'BLI_task_parallel_range'
This is an adaptation of {D11488}.

A disadvantage of manually setting the iter ranges per thread is that
we don't know how many threads are running in the background and so we
don't know how to best distribute the ranges.

To solve this limitation we can use `parallel_reduce` and thus let the
driver choose the best distribution of ranges among the threads.

This proved to be especially beneficial for computers with few cores.

**Benchmarking:**
Here's the result on an 4-core laptop:
||master:|PATCH:
|---|---|---|
|large_mesh_editing:|Average: 5.203638 FPS|Average: 5.398925 FPS
||rdata 15ms iter 43ms (frame 193ms)|rdata 14ms iter 36ms (frame 187ms)

Here's the result on an 8-core PC:
||master:|PATCH:
|---|---|---|
|large_mesh_editing:|Average: 15.267482 FPS|Average: 15.906881 FPS
||rdata 9ms iter 28ms (frame 65ms)|rdata 9ms iter 25ms (frame 63ms)
|large_mesh_editing_ledge: |Average: 15.145966 FPS|Average: 15.520474 FPS
||rdata 9ms iter 29ms (frame 65ms)|rdata 9ms iter 25ms (frame 64ms)
|looptris_test:|Average: 4.001917 FPS|Average: 4.061105 FPS
||rdata 12ms iter 90ms (frame 236ms)|rdata 12ms iter 87ms (frame 230ms)
|subdiv_mesh_cage_and_final:|Average: 1.917769 FPS|Average: 1.971790 FPS
||rdata 7ms iter 37ms (frame 261ms)|rdata 7ms iter 31ms (frame 258ms)
||rdata 7ms iter 38ms (frame 252ms)|rdata 7ms iter 33ms (frame 249ms)
|subdiv_mesh_final_only:|Average: 6.387240 FPS|Average: 6.591251 FPS
||rdata 3ms iter 25ms (frame 151ms)|rdata 3ms iter 16ms (frame 145ms)
|subdiv_mesh_final_only_ledge:|Average: 6.247393 FPS|Average: 6.596024 FPS
||rdata 3ms iter 26ms (frame 158ms)|rdata 3ms iter 16ms (frame 148ms)

**Notes:**
- The improvement can only be noticed if all extracts are multithreaded.
- This patch touches different areas of the code, so it can be split into another patch if the idea is accepted.

These screenshots show how threads behave in a quadcore:
Master:
{F10164664}
Patch:
{F10164666}

Differential Revision: https://developer.blender.org/D11558
2021-06-11 10:45:12 -03:00
fe22635bf6 Nodes: add utilities to check if there are undefined nodes/sockets 2021-06-11 14:55:10 +02:00
c0367b19e2 Fix: VSE search in mpegts files would fail
ffmpeg_generic_seek_workaround did work properly and our start pts
calculation was wrong.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11562
2021-06-11 14:05:07 +02:00
4adbe31e2f Fix: VSE indexer seeking not working correctly
Because of the added sanity checks in rB14508ef100c9 (D11492), seeking
in proxies would not work correctly any more. This is because it wasn't
working as intended before, but in most cases this wouldn't be
noticeable. However now when the sanity checks are tripped it is very
noticeable that something is wrong

The indexer tried to use dts values for time stamps when we used pts in
our decode functions to get the time positions. This would make it
start in the wrong GOP frames when searching. Now that we enforce no
crossing of GOP frames when decoding after seek, this would lead to
issues.

Now we correctly use pts (or dts if pts is not available) and thus we
don't have any seeking issues because of time stamp format missmatch.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11561
2021-06-11 14:04:48 +02:00
1fb2eaf1c5 Fix: VSE timecodes being used even when turned off.
Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11567
2021-06-11 14:04:35 +02:00
2f280d4b92 LineArt: Fix crash due to empty duplicollection. 2021-06-11 17:55:33 +08:00
e9c8ae767a Performance: Split ImBuf sampling.
When sampling ImBuf can be a char or a float buffer. Current sampling
functions added overhead by checking which kind of buffer was passed
every pixel that was sampled. When performing image processing this
check can be removed outside the inner loop adding 5% of performance
increase in the `IMB_transform` operator.
2021-06-11 11:37:39 +02:00
Xing Liu
7fc220517f Fix T88068: Alt+I now respects keying set
Remap {key Alt I} from `anim.delete_key_v3d` to `anim.delete_key`. This
makes it keyframe removal symmetrical with keyframe insertion ({key I}).

Both the default keymap {key Alt I} and the Industry Compatible keymap
{key Alt S} have been updated.

Reviewed By: sybren, #animation_rigging

Maniphest Tasks: T88068

Differential Revision: https://developer.blender.org/D11528
2021-06-11 11:13:20 +02:00
Jeroen Bakker
28617bb167 Sequencer: Transform ImBuf Processor.
Inside the sequencer the cropping and transform of images/buffers were
implemented locally. This reduced the optimizations that a compiler
could do and added confusing code styles. This patch adds
`IMB_transform` to reduce the confusion and increases compiler
optimizations as more code can be inlined and we can keep track of
indices inside the inner loop.

This increases end-user performance by 30% when playing back aa video
in VSE.

Reviewed By: ISS, zeddb

Differential Revision: https://developer.blender.org/D11549
2021-06-11 09:34:44 +02:00
84f025c6fd Cleanup: use sentences for pose slide comments 2021-06-11 16:27:55 +10:00
Christoph Lendenfeld
066f5a4469 Cleanup: pose slider rename region to region_header
Reviewed By: sybren, campbellbarton

Ref D11365
2021-06-11 15:53:34 +10:00
Christoph Lendenfeld
d07cc5e680 Cleanup: pose slider use enum types
use enum types in `tPoseSlideOp` instead of `short`

Reviewed By: sybren, campbellbarton

Ref D11364
2021-06-11 15:40:07 +10:00
Christoph Lendenfeld
162cf8e81d Cleanup: pose slider use strncpy
use `STRNCPY` instead of `BLI_strncpy`

Reviewed By: sybren, campbellbarton

Ref D11363
2021-06-11 15:38:27 +10:00
Christoph Lendenfeld
fd5c94c48a Cleanup: pose slider data types
- change vec2f to float[2]
- pass rctf as pointer
- change `const struct rctf` to `const rctf`
2021-06-11 15:36:41 +10:00
Christoph Lendenfeld
2724d08cf5 Cleanup: pose slider rename "percentage" to "factor"
This patch changes occurrences of percentage to factor.

There are some usages of percentage left in there on purpose.
They are distinguished as follows:

- factor is 0-1 float
- percentage is 0-100 int

Ref D11361

Reviewed by: sybren, campbellbarton
2021-06-11 15:29:52 +10:00
Charlie Jolly
461ba4438f Nodes: move mix rgb node to C++
Prepare node for conversion to Geometry Nodes.

There should be no functional changes.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11506
2021-06-11 00:01:13 +01:00
d581c1b304 UI: Correct label naming mistake for VSE text strip box background
Seems to be a copy/paste error from 
rB235c309e5f86e84fb08e1ff2c5c11eb0b775c388
2021-06-10 17:45:16 -04:00
e8a4bddef4 deps/windows: add missing tbbmalloc_debug.lib
This file is being linked by blender without
it existing causing issues for debug builds.
2021-06-10 12:03:12 -06:00
fbd889ec28 Fix T86544: better cleanup of path given as command line argument.
When using non-default system separator in filename path, code would end up
with an absolute path mixing regular and alternative separator,
confusing the rest of the path manipulations later on.

So this commit add proper replacements of alternative separators, and
path normalization.
2021-06-10 18:37:46 +02:00
509e0c5b76 Cleanup: BLI_path_slash_native: use separator defines instead of literal values.
Even though this function is alredy using system-specific code, it's
still cleaner to use `SEP` and `ALTSEP` here.
2021-06-10 18:35:35 +02:00
7b62a54230 Fix T88578: crash when loading value from group output node
It remembered the wrong origin socket and couldn't find the value
anymore later on.
2021-06-10 17:24:53 +02:00
Eitan
53c98e45cf Geometry Nodes: Add Texture and Material options to switch node
These new socket types can be supported in the switch node
along with the others.

Differential Revision: https://developer.blender.org/D11560
2021-06-10 10:16:37 -05:00
bcefce33f2 BLI_mempool: split thread-safe iteration into the private API
Splitting out thread safe iteration logic means regular iteration
isn't checking for the thread-safe pointer each step.

This gives a small but measurable overall performance gain of 2-3%
when redrawing a high-poly mesh.

Ref D11564

Reviewed By: mont29
2021-06-11 00:31:16 +10:00
9df1e0cad5 Fix: Build error with MSVC
rB4f81b4b4ce29 mistakenly left out the changes
to platform_win32.cmake causing a linker error
when WITH_GMP and WITH_TBB_MALLOC_PROXY were on.
2021-06-10 06:50:05 -06:00
aa0bd29546 Docs: remove deprecated parameter from bmesh docs
The perimeter itself was removed but the documentation wasn't updated.

Resolves T89013
2021-06-10 21:32:30 +10:00
1a72ee4cbe Cleanup: move endian values from BKE_global into BLI_endian_defines
This change was prompted by D6408 which moves thumbnail extraction into
a shared function that happens use these endian defines but only links
blenlib.

There is no need for these defines to be associated with globals
so move into their own header.
2021-06-10 21:10:28 +10:00
e4ef8cbf7e Cleanup: add comment 2021-06-10 13:05:57 +02:00
5fa6cdb77a Add unit for time stored in seconds
Allows to define properties which will have proper units displayed
in the interface. The internal storage is expected to be seconds
(which matches how other times are stored in Blender).

Is not immediately used in Blender, but is required for the upcoming
feature in Cycles X (D11526)

The naming does not sound very exciting, but can't think of anything
better either.

For test it probably easiest to define FloatProperty with subdtype
of TIME_ABSOLUTE.

Differential Revision: https://developer.blender.org/D11532
2021-06-10 12:15:59 +02:00
5304c6ed7d DataTransfer: Fix vertices being wrongly added to vgroup.
Previously, a vertex from destination mesh would always be added to all
transferred vgroup (with a 0.0 weight), even if none of its matching
sources in source mesh belonged to the matching source vgroups.

Now a destination vertex is only added to a given destination vgroup if
at least one of its source vertices belong to the matching source
vgroup.

Issue found and initial investigation by @pls in D11524, thanks!
2021-06-10 11:33:53 +02:00
b669fd376a Cleanup: spelling in comments 2021-06-10 17:04:25 +10:00
4d4608363c Cleanup: quiet array-parameter warning from GCC11 2021-06-10 16:51:09 +10:00
7141eb75ef Docs: update oxygen configuration to v1.9.1 2021-06-10 16:34:58 +10:00
b282a065f1 Docs: Add preprocessor define for doxygen
Doxygen by default leaves out any functions inside
#ifdef blocks that it thinks are disabled.

This change adds a DOXYGEN symbol, so you can
still get the functions included in the
documentation even if the #ifdef would
have normally excluded them.

before

#if defined(_WIN32)

after

#if defined(_WIN32) || defined(DOXYGEN)

Patch provided by Campbell Barton on chat.
2021-06-09 18:44:39 -06:00
Erik Abrahamsson
4f81b4b4ce Windows: Use TBBMalloc for GMP
TBBmalloc_proxy already takes care of any allocations
being done from MSVC compiled code, some of the dependencies
like GMP cannot be build with MSVC and we have to use
mingw to build them. mingw however links against the older
msvcrt.dll for its allocation needs, which TBBMallocProxy
does not hook.

GMP has an option to supply your own allocation functions
so we can still manually redirect them to TBBMalloc.

In a test-file with a boolean geometry node, this patch
uses 32s effective CPU time compared to 52s before.

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

Reviewed by Campbell Barton, Ray Molenkamp
2021-06-09 18:34:17 -06:00
a3226bdf3e Fix: Point translate and point scale don't execute on curve data 2021-06-09 16:51:07 -05:00
Christoph Lendenfeld
d96e9de9de Fix T88546: Pose slider typed input not working
Remove an unnecessary call to pose_slide_mouse_update_percentage
That call was overriding the typed value

Reviewed By: #animation_rigging, Sybren A. Stüvel

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

Ref D11395
2021-06-09 22:31:10 +01:00
93fd07e19c Geometry Nodes: Copy spline attributes in the curve resample node
Previously only point domain attributes were copied to the result curve.
2021-06-09 15:54:26 -05:00
5f19646d7e Fix T88799: 3DViewport Stats Column Measurements
To draw the overlay stats in columns the strings must be measured to
find the longest one. In some circumstances this measurement can be
incorrect. We draw the text with a specific size yet do not explicitly
set the size before calling BLF_size. This patch properly sets the size
so that the measurement will match what will be used for output.

See T88799 for examples of measurement failure.

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

Reviewed by Hans Goudey
2021-06-09 13:39:08 -07:00
675677ec67 Splines: Add API functions for interpolating data
First, expand on the interpolation to evaluated points with a templated
helper function, and a function that takes a GSPan. Next, add a set of
functions to `Spline` for interpolating at arbitrary intervals between
the evaluated points. The code for doing that isn't that complicated
anyway, but it's nice to avoid repeating, and it might make it easier
to unroll the special cases for the first and last points if we require
the index factors to be sorted.
2021-06-09 14:53:39 -05:00
Henrik Dick
df2a19eac7 Geometry Nodes: Add Convex Hull Node
This commit adds a node to output the convex hull of any input geometry
as a mesh, which is an enclosing geometry around a set of points.
All geometry types are supported, besides volumes.

The code supports operating on instances to avoid copying all input
geometry before the operation. The implementation uses the same backend
as the operation in edit mode, but uses Mesh directly instead of BMesh.

Attribute transfer is not supported currently, but would be a point of
improvement for the future if it can work in a predictable way on
different geometry input types.

Differential Revision: https://developer.blender.org/D10925
2021-06-09 11:58:08 -05:00
2856f3b583 Fix T88974: Add missing liboverrides to GP modifiers and shaderfx.
Proper RNA code was simply never added for those...
2021-06-09 18:48:55 +02:00
965bd53e02 Cleanup: use doxy sections for task_iterator.c 2021-06-10 02:22:46 +10:00
05f15645ec Cleanup: missing NULL check in assert 2021-06-10 02:22:46 +10:00
cb0cab48ef Cleanup: redundant/unused assignments 2021-06-10 02:22:46 +10:00
029fb002dd Cleanup: replace 'else if' with 'else' 2021-06-10 02:22:46 +10:00
4443c4082e Cleanup: remove redundant checks which have already been tested
Note that these changes are limited simple cases as these kinds of
changes could allow for errors when refactoring code when the known
state is not so obvious.
2021-06-10 02:22:45 +10:00
bda8887e0c Cleanup: simplify grease pencil preset set logic 2021-06-10 02:22:45 +10:00
5575aba025 Cleanup: simplify grease pencil type checks 2021-06-10 02:22:45 +10:00
25d8ce16b5 Cleanup: spelling in comments 2021-06-10 02:22:45 +10:00
59553d47c0 Cleanup: quiet array-parameter warning 2021-06-10 02:22:45 +10:00
84af1eaa92 Fix invalid return value assignment in getEdgeVertexIndices 2021-06-10 02:22:45 +10:00
059f19d821 Fix uninitialized variable in task.MempoolIterTLS test
Error in 14f3b2cdad.
2021-06-10 02:21:59 +10:00
0f156a2436 LineArt: Camera marker update fix.
The original fix was probably flushed by some newer
line art commits. Fixed.

See https://developer.blender.org/T88464
2021-06-10 00:14:34 +08:00
f42a501c61 Revert "GPencil: Add custom normal entry to bGPDspoint."
This reverts commit f546b0800b.
2021-06-10 00:11:14 +08:00
d8b8b4d7e2 BMesh: multi-thread face tessellation
Use BM_iter_parallel for face tessellation, this gives around
6.5x speedup for BM_mesh_calc_tessellation on high poly meshes in my
tests, although exact speedup depends on available cores.
2021-06-10 01:19:58 +10:00
14f3b2cdad BLI_task: add TLS support to BLI_task_parallel_mempool
Support thread local storage for BLI_task_parallel_mempool,
as well as support for the reduce and free callbacks.

mempool_iter_threadsafe_* functions have been moved into a private
header thats only shared between task_iterator.c and BLI_mempool.c
so the TLS can be made part of the iterator array without having to
rely on passing in struct offsets.

Add test task.MempoolIterTLS that ensures reduce and free
are working as expected.

Reviewed By: mont29

Ref D11548
2021-06-10 00:55:04 +10:00
f546b0800b GPencil: Add custom normal entry to bGPDspoint.
Also modified existing utility functions to take
care of the new surface normal interpolation and so on.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D11543
2021-06-09 22:46:08 +08:00
92ae3ff84c Fix assigning material to linked object being forbidden in BKE.
While this should not be allowed in general, there are some cases
(library overrides at least) where supporting this is mandatory.

Further more, comment stating that this could crash is from 2011, could
not reproduce any issue with current code. Commit comment was referring
to undo/redo, but in use cases here those should not affect things.

Note that in general, such relatively high-level checks should be
handled by high-level, close to user code (like in ED area e.g.), not in
low-level BKE code anyway.
2021-06-09 16:33:34 +02:00
5954b351f0 Cleanup: Removed unused definition. 2021-06-09 16:31:28 +02:00
33c4eefabb Cleanup: Comment formatting 2021-06-09 09:28:23 -05:00
Jeroen Bakker
6e999e08ab T88352: Use threaded ibo.tris extraction for single material meshes.
This patch adds a specific extraction method when the mesh has only
one material. This method is multi-threaded.

There is a trade-off in this patch as the ibo isn't compressed (it adds
restart indexes for hidden faces). So it depends if threading is faster
than the additional GPU buffer upload.

# Subdivided cube
I used a cube subdivided 7 times, modifiers applied. that gives around 400000 faces.

The test is selecting some vertices and move them. During this test the next buffers are updated on each frame:
* vbo.pos_nor
* vbo.lnor
* vbo.edit_data
* ibo.tris
* ibo.points

System info:
|platform| Linux-5.11.0-7614-generic-x86_64-with-glibc2.33|
| renderer|      AMD SIENNA_CICHLID (DRM 3.40.0, 5.11.0-7614-generic, LLVM 11.0.1)|
|vendor|         AMD|
|version|        4.6 (Core Profile) Mesa 21.0.1|
|cpu|              Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz|
|compiler|     gcc version 10.3.0|

Timing have been measured using DEBUG_TIME in `draw_cache_extract_mesh`.

master: `rdata 8ms iter 45ms (frame 153ms)`
this patch `rdata 6ms iter 36ms (frame 132ms)`

Reviewed By: mano-wii

Maniphest Tasks: T88352

Differential Revision: https://developer.blender.org/D11290
2021-06-09 16:20:53 +02:00
ec98bb318b UI: Add the option to not display some socket labels
This commit adds a flag to disable displaying some socket labels which
just redundant eye sores. We still want to have a label, because that
information can potentially be accessed elsewhere in the UI.

The flag is used in a few geometry nodes.

Differential Revision: https://developer.blender.org/D11540
2021-06-09 09:13:09 -05:00
3a7ab62eac Fix T88885: Circle select deselects first selections after moving cursor
`is_active_prev` is always set after the first operation.
But this was not the case with `wait_for_input` `false`.
2021-06-09 10:59:33 -03:00
1f55e12206 Tests: temporarily increase threshold for OpenImageDenoise test
Until all platforms have the same version, this helps the tests pass.
2021-06-09 15:28:19 +02:00
ea3895558d Fix T88998: GPencil not projecting to the most front surface
It was projecting from the stroke position.

The behavior has changed in {rB5400be9ffee2}.
2021-06-09 09:32:50 -03:00
Germano Cavalcante
e4c6da29b2 Draw Cache: use threading for Mesh extract lines
This is an optimization, but the difference is still not that
significant as some extractions are still done in single thread.

**Benchmarking**
||before:|after:
|---|---|---|
|large_mesh_editing:|Average: 14.246502 FPS|Average: 15.438118 FPS
||rdata 9ms iter 31ms (frame 69ms)|rdata 9ms iter 27ms (frame 65ms)
|large_mesh_editing_ledge: |Average: 14.913622 FPS|Average: 15.856538 FPS
||rdata 9ms iter 30ms (frame 67ms)|rdata 9ms iter 26ms (frame 63ms)
|looptris_test:|Average: 3.970774 FPS|Average: 4.095200 FPS
||rdata 11ms iter 90ms (frame 235ms)|rdata 12ms iter 87ms (frame 229ms)

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11467
2021-06-09 08:58:08 -03:00
4ced8900f5 Fix T88983: GPencil toggle caps error in python enum
The value for default option was wrong in the python definition.
2021-06-09 12:52:44 +02:00
f087a225dc GPencil: Hide Brush panels for some tools
Some tools don't use brush and the panel must be hidden.

Reviewed By: mendio

Differential Revision: https://developer.blender.org/D11518
2021-06-09 12:52:44 +02:00
dd98f6b55c Fix missing free calls for task iterator
A single threaded task with thread data over 8192 bytes would leak.
While this didn't happen in practice, it could cause issues in the
future.

The free call for `task_parallel_iterator_do` wasn't running
if callbacks weren't set, also not an issue in practice but avoids
potential problems in the future too.
2021-06-09 20:33:40 +10:00
b18a214ecb Fix: Compositor test desintegrate failing on arm64
Changes introduced in commit rBe9f2f17e8518
can create different render results when there is
a Math or Mix operation after TextureOperation
on tiled execution model.
This is due to WriteBufferOperation forcing a single pixel
resolution when these operations use a preferred
resolution of 0 to check if their inputs have resolution.
Fixing this behaviour creates different renders too.

This patch keeps previous tiled implementation and
adds the new implementation only for full frame execution.

Reviewed By: Jeroen Bakker (jbakker)

Differential Revision: https://developer.blender.org/D11546
2021-06-09 11:21:23 +02:00
d7c812f15b Compositor: Refactor recursive methods to iterative
In order to reduce stack size this patch converts full frame 
recursive methods into iterative.
- No functional changes.
- No performance changes.
- Memory peak may slightly vary depending on the tree because
 now breadth-first traversal is used instead of depth-first.

Tests in D11113 have same results except for test1 memory peak:
360MBs instead of 329.50MBs.

Reviewed By: Jeroen Bakker (jbakker)

Differential Revision: https://developer.blender.org/D11515
2021-06-09 11:02:40 +02:00
3ba16afa1e Fix failing test case sequence_transform. 2021-06-09 08:12:04 +02:00
8c3f4f7edf Fix: Incorrect node bezier spline tangent calculation for end points
The code was using the useless dangling handle at each end of the spline
rather than the handle pointing inwards.
2021-06-08 23:52:29 -05:00
5d58f177f7 Simplify checks for python object types, just use PyLong_AsLong and PyFloat_AsDouble 2021-06-08 23:10:14 -05:00
47fee34e9f Merge branch 'master' into refactor-idprop-ui-data 2021-06-08 22:48:56 -05:00
307f8c8e76 Fix: Prevent small memory leak in VSE indexer
We need to unref the packet to tell ffmpeg it is ok to free it after
use.
2021-06-08 23:18:31 +02:00
8bd09b1d77 Build: upgrade OpenImageDenoise to 1.4.0
CMake builder and install deps changes, precompiled libraries are still to be
committed.

Ref T88438, T88434

Differential Revision: https://developer.blender.org/D11486
2021-06-08 19:22:59 +02:00
f29a738e23 PyAPI: use keyword only arguments
Use keyword only arguments for the following functions.

- addon_utils.module_bl_info 2nd arg `info_basis`.
- addon_utils.modules 1st `module_cache`, 2nd arg `refresh`.
- addon_utils.modules_refresh 1st arg `module_cache`.
- bl_app_template_utils.activate 1nd arg `template_id`.
- bl_app_template_utils.import_from_id 2nd arg `ignore_not_found`.
- bl_app_template_utils.import_from_path 2nd arg `ignore_not_found`.
- bl_keymap_utils.keymap_from_toolbar.generate 2nd & 3rd args `use_fallback_keys` & `use_reset`.
- bl_keymap_utils.platform_helpers.keyconfig_data_oskey_from_ctrl 2nd arg `filter_fn`.
- bl_ui_utils.bug_report_url.url_prefill_from_blender 1st arg `addon_info`.
- bmesh.types.BMFace.copy 1st & 2nd args `verts`, `edges`.
- bmesh.types.BMesh.calc_volume 1st arg `signed`.
- bmesh.types.BMesh.from_mesh 2nd..4th args `face_normals`, `use_shape_key`, `shape_key_index`.
- bmesh.types.BMesh.from_object 3rd & 4th args `cage`, `face_normals`.
- bmesh.types.BMesh.transform 2nd arg `filter`.
- bmesh.types.BMesh.update_edit_mesh 2nd & 3rd args `loop_triangles`, `destructive`.
- bmesh.types.{BMVertSeq,BMEdgeSeq,BMFaceSeq}.sort 1st & 2nd arg `key`, `reverse`.
- bmesh.utils.face_split 4th..6th args `coords`, `use_exist`, `example`.
- bpy.data.libraries.load 2nd..4th args `link`, `relative`, `assets_only`.
- bpy.data.user_map 1st..3rd args `subset`, `key_types, `value_types`.
- bpy.msgbus.subscribe_rna 5th arg `options`.
- bpy.path.abspath 2nd & 3rd args `start` & `library`.
- bpy.path.clean_name 2nd arg `replace`.
- bpy.path.ensure_ext 3rd arg `case_sensitive`.
- bpy.path.module_names 2nd arg `recursive`.
- bpy.path.relpath 2nd arg `start`.
- bpy.types.EditBone.transform 2nd & 3rd arg `scale`, `roll`.
- bpy.types.Operator.as_keywords 1st arg `ignore`.
- bpy.types.Struct.{keyframe_insert,keyframe_delete} 2nd..5th args `index`, `frame`, `group`, `options`.
- bpy.types.WindowManager.popup_menu 2nd & 3rd arg `title`, `icon`.
- bpy.types.WindowManager.popup_menu_pie 3rd & 4th arg `title`, `icon`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.blend_paths 1st..3rd args `absolute`, `packed`, `local`.
- bpy.utils.execfile 2nd arg `mod`.
- bpy.utils.keyconfig_set 2nd arg `report`.
- bpy.utils.load_scripts 1st & 2nd `reload_scripts` & `refresh_scripts`.
- bpy.utils.preset_find 3rd & 4th args `display_name`, `ext`.
- bpy.utils.resource_path 2nd & 3rd arg `major`, `minor`.
- bpy.utils.script_paths 1st..4th args `subdir`, `user_pref`, `check_all`, `use_user`.
- bpy.utils.smpte_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.smpte_from_seconds 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.system_resource 2nd arg `subdir`.
- bpy.utils.time_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.time_to_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.units.to_string 4th..6th `precision`, `split_unit`, `compatible_unit`.
- bpy.utils.units.to_value 4th arg `str_ref_unit`.
- bpy.utils.user_resource 2nd & 3rd args `subdir`, `create`
- bpy_extras.view3d_utils.location_3d_to_region_2d 4th arg `default`.
- bpy_extras.view3d_utils.region_2d_to_origin_3d 4th arg `clamp`.
- gpu.offscreen.unbind 1st arg `restore`.
- gpu_extras.batch.batch_for_shader 4th arg `indices`.
- gpu_extras.batch.presets.draw_circle_2d 4th arg `segments`.
- gpu_extras.presets.draw_circle_2d 4th arg `segments`.
- imbuf.types.ImBuf.resize 2nd arg `resize`.
- imbuf.write 2nd arg `filepath`.
- mathutils.kdtree.KDTree.find 2nd arg `filter`.
- nodeitems_utils.NodeCategory 3rd & 4th arg `descriptions`, `items`.
- nodeitems_utils.NodeItem 2nd..4th args `label`, `settings`, `poll`.
- nodeitems_utils.NodeItemCustom 1st & 2nd arg `poll`, `draw`.
- rna_prop_ui.draw 5th arg `use_edit`.
- rna_prop_ui.rna_idprop_ui_get 2nd arg `create`.
- rna_prop_ui.rna_idprop_ui_prop_clear 3rd arg `remove`.
- rna_prop_ui.rna_idprop_ui_prop_get 3rd arg `create`.
- rna_xml.xml2rna 2nd arg `root_rna`.
- rna_xml.xml_file_write 4th arg `skip_typemap`.
2021-06-09 03:05:44 +10:00
c18ff180e3 Cleanup: Apply clang-format (make format) 2021-06-08 18:53:39 +02:00
22ee056c3a Geometry Nodes: Rename bounding box mesh output to "Bounding Box"
This was decided by the geometry nodes team, because the
important part of this output is not that it's a mesh.
2021-06-08 11:11:49 -05:00
f5a2d93224 Geometry Nodes: Support curve instances in the bounding box node
Currently curve instances are misleading, since `CurveEval` is created
from scratch from the original `Curve`, but this won't always be true.
2021-06-08 10:51:52 -05:00
a31bd2609f Cleanup: Remove duplicate call to function
Missed in rBa2ebbeb836ae765
2021-06-08 09:55:14 -05:00
Jeroen Bakker
2e19649bb9 Sequencer: Performance image crop transform.
During transforming an image, a matrix multiplication per pixel was done.
The matrix in itself is always linear so it could be replaced by two additions.

During testing in debug builds playing back a movie went from 20fps to
300 fps.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D11533
2021-06-08 16:46:57 +02:00
7124c66340 Fix T87703: Failed assert when dragging object data-block into 3D View
Talked with Bastien and we ended up looking into this. Issue is that the
dupliation through drag & drop should also be considered a
"sub-process", like Shift+D duplicating does. Added a comment explaining
why this is needed.
2021-06-08 16:45:34 +02:00
Jeroen Bakker
259b9c73d0 GPU: Thread safe index buffer builders.
Current index builder is designed to be used in a single thread.
This makes all index buffer extractions single threaded.
This patch adds a thread safe solution enabling multithreaded
building of index buffers.

To reduce locking the solution would provide a task/thread local
index buffer builder (called sub builder).
When a thread is finished this thread local index buffer builder
can be joined with the initial index buffer builder.

`GPU_indexbuf_subbuilder_init`: Initialized a sub builder. The
index list is shared between the parent and sub buffer, but the
counters are localized. Ensuring that updating counters would
not need any locking.

`GPU_indexbuf_subbuilder_finish`: merge the information of the
sub builder back to the parent builder. Needs to be invoked outside
the worker thread, or when sure that all worker threads have been
finished. Internal the function is not thread safe.

For testing purposes the extract_points extractor has been migrated to
the new API. Herefore changes to the mesh extractor were needed.

* When creating tasks, the task number of current task is stored in
  ExtractTaskData including the total number of tasks.
* Adding two functions  in `MeshExtract`.
** `task_init` will initialize the task specific userdata.
** `task_finish` should merge back the task specific userdata back.
* adding task_id parameter to the iteration functions so they can
  access the correct task data without any need for locking.

There is no noticeable change in end user performance.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11499
2021-06-08 16:36:06 +02:00
08b0de45f3 Geometry Nodes: new Select by Material node
This node creates a boolean face attribute that is "true" for
every face that has the given material.

Differential Revision: https://developer.blender.org/D11324
2021-06-08 16:01:54 +02:00
Maxime Casas
2246d456aa Animation: Allow selection of FCurve + its keys
Selection of an FCurve with box/circle select now selects the entire
curve and all its keys:

- Box selecting a curve selects all the keyframes of the curve.
- Ctrl + box selecting of the curve deselects all the keyframes of the
  curve.
- Shift + box selecting of the curve extends the keyframe selection,
  adding all the keyframes of the curves that were just selected to the
  selection.
- In all cases, if the selection area contains a key, nothing is
  performed on the curves themselves (the action only impacts the
  selected keys).

Reviewed By: sybren, #animation_rigging

Differential Revision: https://developer.blender.org/D11181
2021-06-08 15:45:53 +02:00
9553ba1373 Fix compile error with 'WITH_CXX_GUARDEDALLOC'
Seen with msvc
2021-06-08 10:35:04 -03:00
a2ebbeb836 Fix T88934: Crash with line node count input < 0
Some of the primitive nodes can return null in an error condition.
This is confusing mixed with adding a maderial slot in calling
functions. This is the second crash caused by that confusion. It's
simpler to add the slot right when allocating the mesh, and it will
lend itself better to copy & paste coding in the future.

Differential Revision: https://developer.blender.org/D11530
2021-06-08 08:27:13 -05:00
5b014911a5 Revert "Cleanup: use cpp new/delete."
This reverts commit 43464c94f4.
2021-06-08 15:08:09 +02:00
23fd576cf8 Cleanup: replace NULL with nullptr. 2021-06-08 13:14:18 +02:00
43464c94f4 Cleanup: use cpp new/delete. 2021-06-08 13:12:49 +02:00
322a614497 Cleanup: replace typedef structs with structs. 2021-06-08 12:03:06 +02:00
340c535dbf Cleanup: Separate compile unit edituv. 2021-06-08 12:03:06 +02:00
088ea59b7e Cleanup: Separate compile unit lines_adjacency. 2021-06-08 12:03:06 +02:00
cac9828ae3 Cleanup: Separate compile unit lines_paint_mask. 2021-06-08 12:03:06 +02:00
9e9d45ae16 Cleanup: Separate fdots extraction in own compile unit. 2021-06-08 12:03:06 +02:00
89d0cc3a0c Fix T88719: Attribute Remove node input field does nothing
An unlinked multi-input socket was not handled correctly.
2021-06-08 11:51:45 +02:00
e54a4b355e CMake: Fix FindClang not finding system clang on linux in some cases.
In Debian e.g. Clang is part of LLVM, so we need to also check its root
directory sometimes to find Clang files.
2021-06-08 11:16:45 +02:00
933c2cffd6 Geometry Nodes: enable multi-threading in evaluator again
This reverts rB223c6e1ead2940a89465ff66765d16ac14a992b7
because T88598 is resolved now.
2021-06-08 10:43:57 +02:00
ed1fc9d96b BLI: support disabling task isolation in task pool
Under some circumstances using task isolation can cause deadlocks.
Previously, our task pool implementation would run all tasks in an
isolated region. Now using task isolation is optional and can be
turned on/off for individual task pools.

Task pools that spawn new tasks recursively should never enable
task isolation. There is a new check that finds these cases at runtime.
Right now this check is disabled, so that this commit is a pure refactor.
It will be enabled in an upcoming commit.

This fixes T88598.

Differential Revision: https://developer.blender.org/D11415
2021-06-08 10:39:33 +02:00
496045fc30 BMesh: simplify normal calculation, resolve partial update error
Simplify vertex normal calculation by moving the main normal
accumulation function to operate on vertices instead of faces.

Using faces had the down side that it needed to zero, accumulate and
normalize the vertex normals in 3 separate passes, accumulating also
needed a spin-lock for thread since the face would write it's normal
to all of it's vertices which could be shared with other faces.

Now a single loop over vertices is performed without locking.
This gives 5-6% speedup calculating all normals.

This also simplifies partial updates, fixing a problem where
all connected faces were being read from when calculating normals.
While this could have been resolved separately,
it's simpler to operate on vertices directly.
2021-06-08 17:13:15 +10:00
f651cc6c4e Cleanup: Silent compile warning in interface_widgets.c. 2021-06-08 08:25:39 +02:00
0efb627bbd Cleanup: Soilent compile warning in curve_bevel.c. 2021-06-08 07:45:53 +02:00
1b07b7a068 LineArt: Threaded Object Loading.
Move BMesh conversion and all loading code into worker.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11288
2021-06-08 13:03:37 +08:00
0abce91940 Fix test failure caused by earlier cleanup commit
rB8cbff7093d65 neglected to move the "pre-tesselation" modifier to the
next before calculating the second part of the curve modifier stack.
2021-06-07 22:33:05 -05:00
2e46a8c864 Remove noop code from WM_MOUSEWHEEL processing.
ChildWindowFromPoint retrieves the child of the provided window at a
point. In this case it always returns 0 because HWND_DESKTOP is flag
defined as 0, which is never a valid window handle and is not intended
for use in place of a window handle.

Forwarding of mousewheel events was added in adb08def61, and later
modified to the current unworking state in e9645806f5. Sending mouse
wheel events to the window under the cursor is a system preference and
therefore should not be overridden by Blender, therefore the noop code
has been removed.
2021-06-07 20:15:28 -07:00
ef5a362a5b Improve multires performance.
Added a new api function to stich multires grids
on specific faces in a mesh,
subdiv_ccg_average_faces_boundaries_and_corners,
and changed multires normal calc to use it.

VTune profiling showed that this was a major
performance hit once you get above 10,000 or so
base mesh faces and/or have a high number of
subdivision levels.

Here's a video comparing the difference. Note the
bpy.app_debug switch is not in the final commit.

{F10145323}

And the .blend file:

{F10145346}

Reviewed By: Sergey Sharybin (sergey)

Differential Revision:
https://developer.blender.org/D11334
2021-06-07 15:19:19 -07:00
a6715213c3 Revert "Improve multires performance."
. . .because I accidentally committed
submodule references.

This reverts commit 482465e18a.
2021-06-07 15:16:03 -07:00
482465e18a Improve multires performance.
Added a new api function to stich multires grids
on specific faces in a mesh,
subdiv_ccg_average_faces_boundaries_and_corners,
and changed multires normal calc to use it.

VTune profiling showed that this was a major
performance hit once you get above 10,000 or so
base mesh faces and/or have a high number of
subdivision levels.

Here's a video comparing the difference. Note the
bpy.app_debug switch is not in the final commit.

{F10145323}

And the .blend file:

{F10145346}

Reviewed By: Sergey Sharybin (sergey)

Differential Revision:
https://developer.blender.org/D11334
2021-06-07 15:11:31 -07:00
b0ec1d2747 Cleanup: Order return argument last 2021-06-07 17:04:31 -05:00
1ef33be2d4 UI: Remove property descriptions exactly the same as names
These two descriptions are exactly the same as the property names,
which only wastes people's time when reading tooltips
2021-06-07 16:47:13 -05:00
d2aee304e8 Cleanup: Use const arguments, return by value
Also use Curve as an argument instead of Object, since the object was
only used to retrieve the curve, and the calling code is already working
with curve data.
2021-06-07 13:58:47 -05:00
6e56b42faa Fix T77651: Black screen on Blender startup on ChromeOS
Apparently `textureSize` doesn't work with
`sampler1DArray` on this OS.

Thanks to @dave1853 for finding the source of the
problem.
2021-06-07 15:51:08 -03:00
1c6e338d59 Cleanup: Make function static
This was not used in any other file, and it's not likely to be used
elsewhere in the future anyway.
2021-06-07 13:42:41 -05:00
7313b243f2 Cleanup: Remove outdated/useless comments
Some of the comments referenced code that was no longer there, or even
defines that were removed. Other comments were more confusing and
vague than helpful. Also adjust formatting in a few cases.
2021-06-07 13:29:37 -05:00
1182c26978 Cleanup: Remove unused function, make function private 2021-06-07 13:12:06 -05:00
8cbff7093d Cleanup: Decrease variable scope
Also use const and bool in a few places.
2021-06-07 13:08:03 -05:00
0fcc063fd9 Fix T88801: Positioning of Menu Underlines
This patch improves the positioning of the little mnemonic underlines
shown under some hotkey letters in menus, especially when using custom
fonts.

see D11521 for details and examples.

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

Reviewed by Campbell Barton
2021-06-07 10:56:20 -07:00
1949643ee5 Fix: Wrong logic for checking if we can reuse decoded frame
We should only check if the new pts value lies inside the duration of
the current frame.
2021-06-07 18:16:33 +02:00
7bf9d2c580 Cleanup: use doxy groups for bmesh_mesh_normals.c 2021-06-08 01:19:18 +10:00
4a9c5c60b7 Cleanup: Move extract lines to compile unit. 2021-06-07 16:57:21 +02:00
0e285fa23c Cleanup: Move extract tris in own compile unit. 2021-06-07 16:55:09 +02:00
214a78a46f Revert most of rB93a865dde775e.
This revert went too far, only one line (the minimal version of FFMPEG
for `install_deps.sh` script`) actually needed to be reverted...

Sorry for the noise.
2021-06-07 16:54:02 +02:00
f87f8532c3 Cleanup: split bmesh normal calculation into separate files 2021-06-08 00:50:25 +10:00
3da0b52c97 Cleanup: compiler warnings signed/unsigned mismatch 2021-06-08 00:50:25 +10:00
785a518ebe Cleanup: silence warnings 2021-06-07 11:30:25 -03:00
2bf56f7fbb Fix: do not use threading for 'extract_points'
`extract_points` doesn't support multithreading yet.
2021-06-07 11:30:17 -03:00
93a865dde7 Revert "Bump FFmpeg version from 4.2.3 to 4.4"
This reverts commit 95690dd362.

Such high version restriction is no more needed after rB9225fe933ae990.

Missing bit in https://developer.blender.org/D11417.
2021-06-07 16:25:34 +02:00
72d2355af5 Cleanup: remove redundant cast, use const casts 2021-06-08 00:23:09 +10:00
dfac5a63bd Cleanup: remove unused value 2021-06-08 00:09:07 +10:00
c87327ddeb Cleanup: use keyword only argument in bpy.props argument parsing
No functional changes as logic elsewhere already ensured this.

This just makes it obvious to anyone reading over the code that
these arguments are keyword only.
2021-06-08 00:07:19 +10:00
7ca5ba14b5 Cleanup: use keywords for unit tests
Prepare for function calls to be keyword only.
2021-06-08 00:07:19 +10:00
51bf1680bd Cleanup: quiet warning accessing deprecated attribute in bl_test 2021-06-08 00:07:19 +10:00
91d3a54869 Fix build error, remove duplicate include. 2021-06-07 19:11:36 +05:30
ee0000b8bb LineArt: Shifting fix for different camera fitting.
FOV was expanded to cover the shifting range,
rather than to precisely cut at the image border. Now fixed.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11523
2021-06-07 21:07:17 +08:00
29a9eaaee3 Merge branch 'master' into refactor-idprop-ui-data 2021-06-07 07:55:58 -05:00
7f1d1b03ad Cleanup: Fix uninitialized variable warning 2021-06-07 07:54:49 -05:00
9520290dbb Merge branch 'master' into refactor-idprop-ui-data 2021-06-07 07:49:48 -05:00
abee9a85d4 Cleanup: renamed function to extract_run_single_threaded. 2021-06-07 13:51:47 +02:00
Germano Cavalcante
223016a408 GPUIndexBuf: Find the minimum and maximum index through the builder
Moving the bounds code to the builder can be useful
for future optimizations like building multithreaded.

Reviewed By: fclem, jbakker

Differential Revision: https://developer.blender.org/D11455
2021-06-07 08:41:38 -03:00
6e6a1838ea Cleanup: Added Guarderalloc deallocators to CPP structs. 2021-06-07 13:34:30 +02:00
1d3ffc93ec Added TODO comment for putting parameters into struct. 2021-06-07 13:31:09 +02:00
e517aaa136 Cleanup: move extract points into own compile unit. 2021-06-07 13:27:38 +02:00
8b8c3c34dd Fix T88900: Crash when setting Edge Weight/Crease
The `recalcData` of "convert_mesh_edge" did more
than it was supposed to.
2021-06-07 07:52:34 -03:00
4f6cab176a Cleanup: remove trailing space from pipeline_config.json
Remove trailing spaces from `pipeline_config.json`

No functional changes.
2021-06-07 11:36:26 +02:00
98876d46ef Fix T88899: __file__ not set for text.as_module() 2021-06-07 14:04:26 +10:00
7ef2b760dc Event Simulate: and a --keep-open command line argument
It can be useful to investigate the state of the file
after event simulation runs.
2021-06-06 23:05:46 +10:00
c27b7df563 Cleanup: unused argument 2021-06-06 23:03:34 +10:00
a496af8680 LineArt: Fix edge clipping index error.
Small bug that's causing edge count to be incorrect in
final culled list, just being offset exactly 1 entry.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11513
2021-06-06 11:18:18 +08:00
54ce344bc7 VSE: Remove seq->tmp usage from transform code
This field was used for extend feature to get handle position of
metastrip children. Since D9972 extend feature works only on meta
strip itself, not it's children.
So `SEQ_transform_get_left_handle_frame()` second argument is always
false and can be removed.

Another instance of `seq->tmp usage` is hack to distinguish strips to be
shuffled, which is not covered by this patch.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10321
2021-06-06 03:05:45 +02:00
dbfde0fe70 Exact Boolean: fix last commit: pass an arg by reference instead of value. 2021-06-05 14:17:15 -07:00
8e43ef5f31 Exact Boolean: speed up when there are many separate components.
Use bounding box tests quickly tell that two components cannot
have a containment relation between each other. This change
cut about 0.6s off a test with 25 big icospheres.
2021-06-05 11:31:08 -07:00
edaaa2afdd Limit Rotation: explicitly orthogonalize the matrix before processing.
Add a call to orthogonalize the matrix before processing for the
same reasons as D8915, and an early exit in case no limits are
enabled for a bit of extra efficiency.

Since the constraint goes through Euler decomposition, it would
in fact remove shear even before this change, but the resulting
rotation won't make much sense.

This change allows using the constraint without any enabled limits
purely for the purpose of efficiently removing shear.

Differential Revision: https://developer.blender.org/D9626
2021-06-05 16:29:46 +03:00
d2dc452333 Limit Rotation: add an Euler Order option.
Since Limit Rotation is based on Euler decomposition, it should allow
specifying the order to use for the same reasons as Copy Rotation does,
namely, if the bone uses Quaternion rotation for its animation channels,
there is no way to choose the order for the constraint.

Ref D9626
2021-06-05 16:29:46 +03:00
2cd1bc3aa7 Fix T88859: Assert when changing view modes
The `loose_lines`' ibo was not being initialized.
2021-06-05 09:49:48 -03:00
1a912462f4 BMesh: avoid extra faces-of-edges loop building partial update data 2021-06-05 21:33:15 +10:00
bcf9c73cbc Fix assert check in BLI_polyfill_beautify 2021-06-05 17:16:37 +10:00
3c9c557580 Fix assert in gpencil_batches_ensure 2021-06-05 17:13:12 +10:00
c7fee64dea Cleanup: use ternary operator for icon argument 2021-06-05 17:05:11 +10:00
ca3891e83b Fix T88828: View/Navigation(Walk/Fly) disappeared from keymap
This was unintentionally removed in
f92f5d1ac6.
2021-06-05 15:06:48 +10:00
a5114bfb85 Cleanup: indentation 2021-06-05 15:06:47 +10:00
022f8b552d Cleanup: spelling in comments
Also remove reference to function that never existed for adding `bNode`.
2021-06-05 15:03:59 +10:00
14508ef100 FFmpeg: Fix seeking not returning the correct frame when not using TC index
Fixed the logic for seeking in ffmpeg video files.
The main fix is that we now apply a small offset in ffmpeg_get_seek_pos
to make sure we don't get the frame in front of the seek position when
seeking backward.

The rest of the changes is general cleanup and untangling code.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11492
2021-06-05 02:48:09 +02:00
bfaf09b5bc Fix T88813: Scalable allocator not used on win10
Due to the way we ship the CRT on windows TBB's
malloc proxy was unable to attach it self to
the memory management functions on windows 10.

This change moves ucrtbase.dll out of the blender.crt
folder and back into the main blender folder to side
step some undesirable behaviour on win10 making TBB
once more able to attach it self.

Having this work again, should give a speed
boost in memory allocation heavy workloads
such as mantaflow.

For details on how this only failed on Win10
see T88813
2021-06-04 17:22:31 -06:00
c2fa36999f Edit Mesh: partial updates for normal and face tessellation
This patch exposes functionality for performing partial mesh updates
for normal calculation and face tessellation while transforming a mesh.

The partial update data only needs to be generated once,
afterwards the cached connectivity information can be reused
(with the exception of changing proportional editing radius).

Currently this is only used for transform, in the future it could be
used for other operators as well as the transform panel.

The best-case overall speedup while transforming geometry is about
1.45x since the time to update a small number of normals and faces is
negligible.

For an additional speedup partial face tessellation is multi-threaded,
this gives ~15x speedup on my system (timing tessellation alone).
Exact results depend on the number of CPU cores available.

Ref D11494

Reviewed By: mano-wii
2021-06-05 08:35:31 +10:00
Charlie Jolly
00073651d4 Nodes: Add Multiply Add to Vector Math nodes
Cycles, Eevee, OSL, Geo, Attribute

This operator provides consistency with the standard math node. Allows users to use a single node instead of two nodes for this common operation.

Reviewed By: HooglyBoogly, brecht

Differential Revision: https://developer.blender.org/D10808
2021-06-04 16:59:28 +01:00
eb030204f1 windows/deps: Fix TBB build issues.
rB847579b42250 updated the TBB build script
which had some unintended consequences for
windows as the directory layout slightly
changed.

This change adjusts the builder to the new
structure, there are no version/functional
changes.
2021-06-04 09:16:03 -06:00
Philipp Oeser
56005ef499 Texture Paint: changing paint slots and viewport could go out of sync
When changing to another texture paint slot, the texture displayed in
the viewport should change accordingly (as well as the image displayed
in the Image Editor).

The procedure to find the texture to display in the viewport
(BKE_texpaint_slot_material_find_node) could fail
though because it assumed iterating nodes would always happen in the
same order (it was index based). This is not the case though, nodes can
get sorted differently based on selection (see ED_node_sort).

Now check the actual image being referenced in the paint slot for
comparison.

ref T88788 (probably enough to call this a fix, the other issue(s)
mentioned in the report are more likely a feature request)

Reviewed By: mano-wii

Maniphest Tasks: T88788

Differential Revision: https://developer.blender.org/D11496
2021-06-04 16:02:02 +02:00
b6d6d8a1aa LibOverride: Fix early break in some of the resync code.
This `break` moved out of its braces at some point in the previous
fixes/refctors... :(
2021-06-04 15:54:07 +02:00
0037e08b06 GPencil: Change Fill Boundary icon
The icon has been changed to `eye` because is more consistent with other areas.
2021-06-04 12:44:34 +02:00
b6b20c4d92 GPencil: Change Fill extend lines icon
The icon has been changed to `eye` because is more consistent with other areas.
2021-06-04 12:44:34 +02:00
Fynn Grotehans
d486ee2dbd Update Camera presets
The (tracking) camera presets have not been updated in the last 7 or
more years, so they are very outdated. I found it pointless to have a
few specific camera models in the list and instead add the most commonly
used sensor sizes/film sizes. This way the list is shorter, easier to
maintain/becomes later outdated, and is more user friendly for most people
who don't own any of the specific cameras. I added the Crop Factor to the
Beginning of the name, so it gets sortet in the correct order and presets
are easier to find based on the size.

Reviewed By: #render_cycles, #motion_tracking, brecht, sergey

Differential Revision: https://developer.blender.org/D10739
2021-06-04 12:19:58 +02:00
9ba6b64efa Greasepencil: show pressure curve widgets in the sidebar
These were only showing in the Properties Editor, but there is no reason
to have the panels be different in the sidebar (they should not show in
the top bar though).

agreed upon by both @anoniov and @mendio

ref T88787
2021-06-04 12:17:33 +02:00
e4ca6b93ad BlenLoad: Ensure linked IDs are properly sorted.
So far, linked IDs were not properly sorted at all, only the ones
explicitely linked from WM code would be, but any indirectly linked
data-blocks would end up in some random order in their lists.

While not ideal, this is not a huge issue in itself, but it had bad
side-effects, e.g. causing (recursive) resync of overrides to happen in
random order, leading to mismatches between name indices of newly-generated
override IDs and the one existings e.g.

And in general, it is much better to be consistent here.

Note that the file sub-version is bumped for this commit, since some
sorting (the directly linked IDs which we keep a reference to) should
never need to be re-done after relevant doversion process.
2021-06-04 12:09:05 +02:00
77d7cae266 GPencil: Cleanup unneeded variable assign
The variable is assigned below again and the initial value is not used.
2021-06-04 10:44:01 +02:00
f4e0a19d4f Fix T88803: GPencil Thickness modifier produces thicker lines
There was a double apply of the thickness due a bug in the fading new parameter.

Differential Revision: https://developer.blender.org/D11483
2021-06-04 10:34:05 +02:00
053082e9d8 Math: Added max_uu/min_uu variations. 2021-06-04 09:14:15 +02:00
Johnny Matthews
ddd4b2b785 Geometry Nodes: Curve Length Node
This commit adds a node that outputs the total length of all
evalauted curve splines in a geometry set as a float value.

Differential Revision: https://developer.blender.org/D11459
2021-06-03 19:12:38 -04:00
e5a1cadb2f Geometry Nodes: Support curve data in the geometry delete node
This commit implements support for deleting curve data in the geometry
delete node. Spline domain and point domain attributes are supported.

Differential Revision: https://developer.blender.org/D11464
2021-06-03 18:33:37 -04:00
c18675b12c Cleanup: Add comment explaining assert
This triggers fairly often during development, so it might save some
frustration at some point to have a comment here.
2021-06-03 18:06:31 -04:00
dba3fb9e09 Overlay: Flash on Mode Transfer overlay
This implements T87633

This overlay renders a flash animation on the target object when
transfering the mode to it using the mode transfer operator.
This provides visual feedback when switching between objects without
extra overlays that affect the general color and lighting in the scene.

Differences with the design task:

- This uses just a fade out animation instead of a fade in/out animation.
The code is ready for fade in/out, but as the rest of the overlays
(face sets, masks...) change instantly without animation, having a fade
in/out effect gives the impression that the object flashes twice (once
for the face sets, twice for the peak alpha of the flash animation).

- The rendering uses a flat color without fresnel for now, but this can
be improved in the future to make it look more like the shader in the
prototype.

- Not enabled by default (can be enabled in the overlays panel), maybe
the defaults can change for 3.0 to disable fade inactive and enable this
instead.

Reviewed By: jbakker, JulienKaspar

Differential Revision: https://developer.blender.org/D11055
2021-06-03 20:17:17 +02:00
3e695a27cd VSE: Add refresh_all operator to all sequencer regions
This operator is needed in some cases to update image preview.
In workspaces with smaller timelines this is limiting, because users
need to first check that mouse cursor is in correct place, then press
CTRL+R shortcut.
2021-06-03 19:58:36 +02:00
a1063fc6c2 VSE: Remove JPEG reference from proxy panel
Proxies doesn't use MJPEG codec anymore, but text still referenced it.
2021-06-03 19:44:00 +02:00
b414322f26 GHOST/wayland: fix restoring hidden cursor 2021-06-03 18:18:27 +01:00
899eefd1bb GHOST/wayland: fix non-moving normal cursor 2021-06-03 18:18:27 +01:00
72607feb91 GHOST/wayland: add 'xdg-decoration' support 2021-06-03 18:18:27 +01:00
870bcf6e1a GHOST/wayland: adapt window and cursor surface scale to support HiDPI screens 2021-06-03 18:18:27 +01:00
8b78510fc4 GHOST/wayland: handle return values for data sources 2021-06-03 18:18:27 +01:00
e0bc5c4087 GHOST/wayland: set parent relation only for dialogs to mimic X11 behaviour 2021-06-03 18:18:27 +01:00
1fd653dd82 GHOST/wayland: handle missing relative-pointer and pointer-constraints support 2021-06-03 18:18:27 +01:00
d9aae38bc8 GHOST/wayland: get cursor settings via D-Bus 2021-06-03 18:18:27 +01:00
efad9bcdda GHOST/wayland: inhibit warning 2021-06-03 18:18:27 +01:00
b5d7fb813f cmake: use absolute path for Wayland libraries 2021-06-03 18:18:27 +01:00
bb16f96973 GHOST/wayland: set swap interval to 0
The Wayland server will not update hidden surfaces. This will block the
main event loop and thus also block updates to visible windows in a multi-
window setup.
2021-06-03 18:18:27 +01:00
7197017ea9 WM: only use the tablet drag threshold for mouse button events
Keyboard click-drag events now use the "Drag Threshold".
This resolves a problem where keyboard click drag events
used a much smaller threshold when using a tablet.
2021-06-04 01:18:23 +10:00
ed6fd01ba9 LibOverride: fix previous commit (rB826bed4349fa). 2021-06-03 16:44:20 +02:00
826bed4349 LibOverride: Fix some fail cases with auto-resync.
In some cases e.g. only objects would actually need resync, so
collections on the override character would not be resynced, and if some
objects were sharing relationships with others those could be
lost/destroyed.
2021-06-03 16:12:26 +02:00
797f6e1483 Fix missing updates in RNA override create functions. 2021-06-03 15:44:23 +02:00
e011e4ce76 LibOverride: Add override_hierarchy_createto ID's RNA API. 2021-06-03 15:00:50 +02:00
92f8a6ac21 Fix T88762: UI using tab to enter next button could clamp the hard min/
max unneccessarily

Since rB298d5eb66916 [which was needed to update buttons with custom
property range functions correctly], using tab would always clamp
(hardmin/hardmax) properties which were using FLT_MAX / INT_MAX as range
in their property definitions.

The clamping of rB298d5eb66916 was copied over from rB9b7f44ceb56c
[where it was used for the softmin/softmax], and while the re-evaluation
of hardmin/hardmax is needed for custom property range functions, the
clamping should actually not take place.

There are many properties using FLT_MAX / INT_MAX etc. and while it
probably would be good to update these with ranges that make more sense
-- not using FLT_MAX / INT_MAX would not have done the clamping here --
there should not be an arbitrary limit to these and they should stay as
they are.

Maniphest Tasks: T88762

Differential Revision: https://developer.blender.org/D11473
2021-06-03 14:16:53 +02:00
7b8d812277 Cleanup: make format 2021-06-03 13:33:09 +02:00
2ae4e860f6 LibOverride: ensure proper indirect tag for 'virtual' linked IDs.
Ensure 'virtual' linked override IDs generated by the recursive resync
process are tagged as indirectly linked data.

This is needed to avoid the 'missing data' messages on those virtual
data-blocks after saving and reloading.
2021-06-03 10:27:05 +02:00
2ef192a55b IDManagement: Collection: Fix several issues in relationships building code.
`BKE_main_collections_parent_relations_rebuild`,
`BKE_collection_parent_relations_rebuild` anf their internal
dependencies had two issues fixed by this commit:

* Main one was that a same collection could be processed several times,
  sometimes even in an infinite loop (in some rare corner cases), by
  `collection_parents_rebuild_recursive`.
* More exotic, code here would not ensure that the collections it was
  processing were actually in Main (or a master one from a scene in
  Main), which became an issue with some advanced ID management
  processes involving partially out-of-main remapping, like liboverride
  resync.
2021-06-03 10:27:05 +02:00
a51f8f94d5 Cleanup: use ascii characters instead of unicode where possible
Follow own code style docs.
2021-06-03 11:32:53 +10:00
17f72be3cb Cleanup: spelling in comments, correct outdated comments 2021-06-03 10:47:02 +10:00
2a868d277e Cleanup: use doxy sections for node_relationships.cc 2021-06-03 10:35:46 +10:00
b60a72eaab Fix invalid return values from file_execute
Error in 6c8c30d865
2021-06-03 10:23:40 +10:00
2dcb6782e0 Draw Mesh Extractor: Fix used thread count
Some threads were always idle because of this.
2021-06-02 18:05:58 -03:00
4d64de2853 Cleanup: Remove unused 'ExtractTaskData's members 2021-06-02 17:55:25 -03:00
5af7225816 Cleanup: Fix build warnings 2021-06-02 21:52:36 +02:00
925df8ef26 VSE: Add strip-time intersection test function
Use SEQ_time_strip_intersects_frame function to test if strip intersects with frame.

Note: There are cases where this function should not be used. For example splitting
strips require at least 1 frame "inside" strip. Another example is drawing, where
playhead technically doesn't intersect strip, but it is rendered, because current
frame has "duration" or "thickness" of 1 frame.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11320
2021-06-02 21:41:38 +02:00
2ee575fc1f Cleanup: Strip duplication code
Remove unused flag `SEQ_DUPE_ANIM` and code used by this flag.
Remove flag `SEQ_DUPE_CONTEXT` and refactor code, to split operator
logic from duplication code.
Reduce indentation level in for loop.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11318
2021-06-02 21:41:17 +02:00
1f55786791 Fix T57397: Movies are blurred after sws_scale
Images with 4:2:2 and 4:4:4 chroma subsampling were blurred when
`SWS_FAST_BILINEAR` interpolation is set for `anim->img_convert_ctx`.

Use `SWS_BILINEAR` interpolation for all movies, as performance is
not impacted by this change.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11457
2021-06-02 21:29:38 +02:00
a9dfde7b49 FFmpeg: Update proxy settings
Changes in rBce649c73446e, affected established proxy codec preset.
Presets were not working and all presets were similar to `veryfast`.
Tunes are now working too, so `fastdecode` tune can be used. I have
measured little improvement, but I tested this only on 2 machines and
I have been informed that `fastdecode` tune does influence decoding
performance for some users.

Change preset from `slow` to `veryfast` and add tune `fastdecode`

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11454
2021-06-02 21:25:37 +02:00
0ea0ccc4ff FFmpeg: Fix H264 lossless render not lossless
While encoder parameters for lossless encoding are set correctly,
output is not lossless due to pixel format being set to
`AV_PIX_FMT_YUV420P` which is inherently lossy due to chroma subsampling.

This was reported in T61569 and was merged to T57397, but there were
2 bugs - one for encoding and one for decoding.

Set pixel format to `AV_PIX_FMT_YUV444P` when rendering lossless H264
files. This format isn't available in `codec->pix_fmts[0]` and it looks,
that it has to be hard-coded.

Reviewed By: sergey

Differential Revision: D11458
2021-06-02 21:24:09 +02:00
81366b7d2c Boolean exact: speedup by parallelizing a plane calculation.
This patch is from erik85, who says:
This patch makes populate_plane inside polymesh_from_trimesh_with_dissolve run in parallel.
On a test file with a boolean between two subdivided cubes (~6 million verts) this gives a 10% speed increase (49.5s to 45s) on my 6 core CPU.

Also there is an optimization of other_tri_if_manifold to skip the contains-call and get the pointer directly.
This reduces CPU time for find_patches from 5s to 2.2s on the same test file.
2021-06-02 12:08:46 -07:00
dc960a81d1 Boolean exact: speedup when there are many components.
When there are many components (separate pieces of connected mesh),
a part of the algorithm to determine component containment was slow.
Using a float version of finding the nearest point on a triangle
as a prefilter sped this up enormously. A case of 25 icospheres
subdivided twice goes 11 seconds faster on my Macbook pro with this
change.
2021-06-02 11:18:00 -07:00
4b67d8302e Merge branch 'master' into refactor-idprop-ui-data 2021-06-02 12:54:49 -04:00
4f8edc8e7f Nodes: move some files to C++
This just moves a couple of files in `space_node` to C++ and fixes
related errors.

The goal is to be able to use C++ data structures to simplify the code.

Differential Revision: https://developer.blender.org/D11451
2021-06-02 17:20:46 +02:00
b8ae30e9e3 Cleanup: unused variable 2021-06-03 01:12:00 +10:00
ae28ceb9d8 Fix swapped x/y in event simulation script
Incorrect area center calculation, also correct comments.
2021-06-03 01:11:47 +10:00
05b685989b Fix T88732: Curve to mesh node crash with empty input curve
The mesh to curve node generated an empty curve because no edges were
selected. This commit changes that node to not add a curve in that case.

This also changes the curve to mesh node to not add a material when
no mesh was created. Even though we don't expect null curves or meshes
in this case, the change is harmless.
2021-06-02 11:11:34 -04:00
7654203cc8 EEVEE: AOVs not same as cycles.
EEVEE uses hashing to sync aov names and types with the gpu.
For the type a hashed value was overridden making `decalA`
and `decalB` choose the same hash. This patches fixes this
by removing the most significant bit.
2021-06-02 16:58:36 +02:00
2489f72d79 Revert "EEVEE: AOVs not same as cycles."
This reverts commit 730a46e87d.
2021-06-02 16:56:10 +02:00
730a46e87d EEVEE: AOVs not same as cycles.
EEVEE uses hashing to sync aov names and types with the gpu. For the type a hashed value was overridden making `decalA` and `decalB` choose the same hash. This patches fixes this by removing the most significant bit.
2021-06-02 16:54:01 +02:00
f944121700 GPencil: New operator to Normalize strokes
Sometimes is required to reset the thickness or the opacity of the strokes. Actually this was done using a modifier, but this operators solves this.

Reviewed By: mendio, filedescriptor

Maniphest Tasks: T87427

Differential Revision: https://developer.blender.org/D11453
2021-06-02 16:43:37 +02:00
21de669141 Splines: Function to copy spline settings without data
Often you need to copy a spline to do an operation, but don't want
to manually copy over all of the settings. I've already forgotten to
do it once anyway. These functions copy a spline's "settings" into a
new spline, but not the data. I tried to avoid duplicating any copying
so this is easier to extend in the future.

Differential Revision: https://developer.blender.org/D11463
2021-06-02 09:11:35 -04:00
5b176b66da LineArt: Tolerance for faces perpendicular to view
This is due to cam->obmat precision issue,
where it affects view vector precision.

Reviewed by Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11461
2021-06-02 20:55:54 +08:00
a55b73417f Cleanup: Correct comments
This corrects an outdated comment in the vector header and a typo
in the index mask header.
2021-06-02 08:28:46 -04:00
ea6d099082 Cleanup: Clang format 2021-06-02 08:27:53 -04:00
34f99bc6be Geometry Nodes: Allow reading converted attribute directly from spline
Often it would be beneficial to avoid the virtual array implementation
in `geometry_component_curve.cc` that flattens an attribute for every
spline and instead read an attribute separately for every input spline.
This commit implements functions to do that.

The downside is some code duplication-- we now have two places handling
this conversion. However, we can head in this general direction for the
attribute API anyway and support accessing attributes in smaller
contiguous chunks where necessary.

No functional changes in this commit.

Differential Revision: https://developer.blender.org/D11456
2021-06-02 08:24:42 -04:00
6cd64f8caa Add workaround for gcc 11 compiler bug
Differential Revision: https://developer.blender.org/D11462
2021-06-02 14:13:55 +02:00
f92f5d1ac6 Keymap: use D-Key for view-pie menu
Use the D-key to access the view menu instead of the Tilda key,
which isn't accessible on some international layouts.

To resolve the conflicts the following changes have been made.

- `D` (motion) opens the view menu.
- `D` (mouse-button) uses grease-pencil (as it does currently).
- `Tilda` is used to for "Object Mode Transfer" instead of the View menu.

See T88092 for details.

Reviewed By: Severin

Ref D11189
2021-06-02 21:34:30 +10:00
69e15eb1e4 Object: support running transfer mode in any object mode
There is no need to limit this to sculpt mode,
prepare for key short cut changes, see: T88092.
2021-06-02 21:29:15 +10:00
facc62d0d5 Docs: 2.93 release description for Linux appdata 2021-06-02 13:22:16 +02:00
46447594de Fix T88567: Cryptomatte only works for the first View Layer.
The view layer was always set to 0. This patch increments it.
2021-06-02 10:05:39 +02:00
507c19c0f7 Docs: formalize naming for generic callbacks in BKE_callbacks.h
Add a doc-string explaining the purpose of each call back and
how they should be used.

Also add a currently unused callback 'POST_FAIL' that is to be used in
cases the action fails - giving script authors, a guarantee that a
call to `pre` will always have a matching `post/post_fail` call.

- D11422: adds a callback that can use 'post_fail'.
- T88696: proposed these conventions.
2021-06-02 17:35:24 +10:00
3b3742c75f Cleanup: trailing commas to avoid right shift
This matches most declarations already in this file.
2021-06-02 17:06:12 +10:00
b5a883fef9 Cleanup: spelling in comments 2021-06-02 17:04:57 +10:00
711ddea60e Fix assert with geometry node output
The previous commit (my own) returned early without providing a value
for the node's output geometry set, which is required.
2021-06-01 23:50:23 -04:00
6b5bbd22d9 Cleanup: Avoid duplicating node input retrieval
Pass the selection name and the invert argument to each component
instead of retrieving them every time.
2021-06-01 17:51:21 -04:00
Wannes Malfait
464797078d Geometry Nodes: Add Delete Geometry Node
This node is similar to the mask modifier, but it deletes the elements
of the geometry corresponding to the selection, which is retrieved as
a boolean attribute. The node currently supports both mesh and point
cloud data. For meshes, which elements are deleted depends on the
domain of the input selection attribute, just like how behavior depends
on the selection mode in mesh edit mode.

In the future this node will support curve data, and ideally volume
data in some way.

Differential Revision: https://developer.blender.org/D10748
2021-06-01 17:32:03 -04:00
3400ba329e VSE: Use own category for metadata panel
Metadata panel was visible in each category. In other editors, this
panel is usually placed in category with other source media properties.
In sequencer, metadata is transfered over while compositing and relation
to particular strip is lost, therefore separate category for metadata
seems to be best option. Since Metadata panel is alone in this category,
it will be open by default.
2021-06-01 23:06:31 +02:00
17b09b509c Geometry Nodes: Skip calculating normals in transform node
This commit skips the eager recalculation of mesh normals in the
transform node. Often another deformation or topology-altering
operation will happen after the transform node, which means the
recalculation was redundant anyway.

In one of my test cases this made the node more than 14x faster.
Though depending on the situation the cost of updating the normals
may just be shifted elsewhere.
2021-06-01 12:03:59 -04:00
5b6e0bad1b Fix T88715: particle size influence texture not working for 'keyed' or 'none' physics types
This was reported for the special case of mapping with "Strand /
Particle" coords, but was not working with other coordinates either.

Dont see a reason for not supporting Size influence textures for these
kinds of particles (and since these types of particles have an "age"
like all others as well, even the "Strand / Particle" coords are
supported here as well)

Maniphest Tasks: T88715

Differential Revision: https://developer.blender.org/D11449
2021-06-01 17:54:20 +02:00
404b946ac0 LibOverride: Fix again infinite loop in resync in some complex/degenerated cases.
Broken in recent refactor of (recursive)resync, reported by studio,
thanks.
2021-06-01 17:37:22 +02:00
6583fb67c6 Geometry Nodes: add empty material slot to new meshes
This fixes T88455 by adding an empty material slot to newly
generated meshes. This allows the object to overwrite the
"default" material without any extra nodes. Technically,
all polygons reference the material index 0 already, so it
makes sense to add a material slot for this material index.

Differential Revision: https://developer.blender.org/D11439
2021-06-01 15:25:01 +02:00
James Monteath
8a63466ca3 BuildBot: Cleanup
Removing scripts that were placed in the source tree that would drive
the old buildbot. With the new buildbot in place these scripts aren't
being used anymore.

The buildbit is currently driven by
`build_files/config/pipeline_config.json`. In the near future make
update would also use this config.

Overview of the new buildbot: https://wiki.blender.org/wiki/Infrastructure/BuildBot

Work done by James Monteath.
2021-06-01 15:18:11 +02:00
6899dcab53 Fix T88658: Force Fields of curve shape can crash if curve has only one point
`bvhtree_from_mesh_edges_create_tree` can actually leave the BVHTree
NULL (e.g. if no edges are present).

Now dont allocate `BVHTreeFromMesh` on the `SurfaceModifierData` at all
in case the tree would be NULL anyways.
Places like `get_effector_data` check for `SurfaceModifierData`-
>`BVHTreeFromMesh` and dont try to stuff like getting a closest point on
surface, which would crash as soon as BVHNodes would need to be accessed
(from the NULL BVHTree).

Maniphest Tasks: T88658

Differential Revision: https://developer.blender.org/D11443
2021-06-01 13:38:29 +02:00
c078540512 Cleanup: remove unused parameter. 2021-06-01 13:18:41 +02:00
6f1af44695 Cleanup: remove unused parameter. 2021-06-01 13:18:41 +02:00
633b70905a Cleanup: NULL->nullptr. 2021-06-01 13:18:41 +02:00
f0d93a71df Cleanup: API for MeshExtractRunTimeData. 2021-06-01 13:18:41 +02:00
98c6626729 DrawManager: Use CPP for Mesh Extraction Scheduling.
More cleanups will come to make this more CPP-like.
2021-06-01 13:18:41 +02:00
4b57bbac22 Cleanup: LibOverride: rename 'local' group tagging functions to 'overrides'.
Since we use them on linked data now as well, 'local' does not fit them
anymore.
2021-06-01 12:29:56 +02:00
bf8659930f Fix libOverride resync issues in some corner-cases.
This commit fixes two different issues:
* In some cases, when an object was added to a sub-collection and used
  into a different subcollection, and the root common collection would
  not need to be resynced, it would end up creating multiple overrides
  of the new object. This was affecting both normal and recursive
  resync.
* In recurisve resync case, the barrier code to define what is part or
  not of a override group/hierarchy was wrong.

Note that the current solution for the first issue is sub-optimal (it
goes back to the root of the override hierarchy and resync the whole
thing), a better solution is TODO for now.
2021-06-01 12:01:06 +02:00
f25316e97a IDManagement: BKE_libblock_rename: assert we get local ID.
For now at least, linked data should never be renamed that way.
2021-06-01 12:01:06 +02:00
84e16c4992 Fix BLI_libblock_ensure_unique_name not ignoring linked IDs.
This function would considere that there was a name conflict even in
case existing ID would be a linked one.

This is only a (symbolic) perforance improvement and logical fix, since
`BKE_id_new_name_validate` would not do that mistake anyway.
2021-06-01 12:01:06 +02:00
db15c9d1bd ID Management: Allow unique name check for linked IDs too.
This is mandatory for liboverride resync, since this feature may imply
we have to create linked overrides in libraries, and there may be
several copies of those.

This is also a first step to a more general support of IDmanagement-editing
library data.

Note that this commit should have absolutely no effect on current code,
as the only function allowed to check unique names for linked IDs
currently is `BKE_libblock_management_main_add`, which is unused.

This commit also adds some basic testing for `BKE_id_new_name_validate`.
2021-06-01 12:01:06 +02:00
27910ccce6 Cleanup: clang-tidy
* `readability-redundant-member-init`
* `readability-inconsistent-declaration-parameter-name`
* Remove constructor that can be defaulted.
2021-06-01 12:00:16 +02:00
9adfd278f7 Compositor: Full-frame base system
This patch adds the base code needed to make the full-frame system work for both current tiled/per-pixel implementation of operations and full-frame.

Two execution models:
- Tiled: Current implementation. Renders execution groups in tiles from outputs to input. Not all operations are buffered. Runs the tiled/per-pixel implementation.
- FullFrame: All operations are buffered. Fully renders operations from inputs to outputs. Runs full-frame implementation of operations if available otherwise the current tiled/per-pixel. Creates output buffers on first read and free them as soon as all its readers have finished, reducing peak memory usage of complex/long trees. Operations are multi-threaded but do not run in parallel as Tiled (will be done in another patch).

This should allow us to convert operations to full-frame in small steps with the system already working and solve the problem of high memory usage.

FullFrame breaking changes respect Tiled system, mainly:
- Translate, Rotate, Scale, and Transform take effect immediately instead of next buffered operation.
- Any sampling is always done over inputs instead of last buffered operation.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11113
2021-06-01 10:51:53 +02:00
930ad9257d Cleanup: Split draw_cache_extract_mesh into multiple files.
draw_cache_extract_mesh for task scheduling. Will be refactored to draw_cache_extract_mesh_scheduling later on after migrating to CPP.

draw_cache_extract_mesh_render_data extraction of mesh render data from edit mesh/mesh into a more generic structure.

draw_cache_extract_mesh_extractors containing all the extractors. This will be split up further into a single file per extractor.
2021-06-01 09:23:37 +02:00
13deb5088a Cleanup: split face tessellation into inline functions
Prepare for multiple code-paths that recalculate tessellation.
2021-06-01 15:30:53 +10:00
b8d0f28f70 Cleanup: split bmesh tessellation into it's own file
Prepare for further refactoring for these functions.
2021-06-01 14:04:00 +10:00
3a18e304be Cleanup: remove disabled face tessellation logic
This was kept since these blocks are easier to follow.
Remove as the overall result wasn't so readable
(especially with nested ifdef's).

Replace disabled code with comment on the indices used for quads/tris.
2021-06-01 13:26:26 +10:00
5e7fb77dc4 BMesh: remove checks for tessellating 2 sided faces
2 sided faces aren't supported and will cause problems in many areas
of Blender's code.

Removing (implied) support for faces with fewer than 3 sides
means the total number of triangles is known ahead of time.

This simplifies adding support for multi-threading and partial updates
to an existing tessellation - as the face and loop indices can be used
to access the range of triangles associated with a face.

Also correct outdated comments.
2021-06-01 13:25:00 +10:00
f8ce744c83 Cleanup: correct sculpt quat argument size 2021-06-01 12:50:01 +10:00
f71cf99616 GPU: add 2D projection function
When projecting into screen space Z value isn't always needed.
Add 2D projection functions, renaming them to avoid accidents
happening again.

- Add GPU_matrix_project_2fv
- Add ED_view3d_project_v2
- Rename ED_view3d_project to ED_view3d_project_v3
- Use the 2D versions of these functions when the Z value isn't used.
2021-06-01 12:49:53 +10:00
c145cb7998 Fix buffer overrun in paint_line_strokes_spacing
Error in 87cafe92ce
2021-06-01 12:49:20 +10:00
e7b8a3cb0a Cleanup: spelling in comments 2021-06-01 12:49:18 +10:00
c59d2c739d Cleanup: spelling in comments 2021-06-01 01:45:17 +02:00
f253e59221 Docs: Limit the OCIO env vars that we document
Brecht mentioned that these are a bit obscure and don't make much sense 
to override these.
2021-05-31 19:19:00 -04:00
8180d478e1 Speedup exact boolean by avoiding some mallocs and frees.
This is from patch D11432 from Erik Abrahamsson. He found that
in some mpq3 functions called frequently from loops, passing in
buffers for termporary mpq3 values can save substantial time.
On my machine, his example in that patch went from 9.48s to 7.50s
for the boolean part of the calculation. On his machine, a running
time went from 17s to 10.3s.
2021-05-31 17:03:48 -04:00
73967e2047 Fix undeclared identifiers with 'DEBUG_TIME'
These identifiers were accidentally removed in rB44d2479dc36f.
2021-05-31 16:28:14 -03:00
09fb81f66d Merge branch 'blender-v2.93-release' 2021-05-31 19:23:49 +02:00
25316ef9d7 Cycles: optimize 3D viewport rendering with camera passepartout
If the area outside the camera is fully opaque, don't render it.

Contributed by Kdaf.

Differential Revision: https://developer.blender.org/D11182
2021-05-31 19:23:44 +02:00
875a8a6c79 Cleanup: Replace fseek() calls with BLI_fseek()
The fseek() function on Windows only accepts a 32-bit long offset
argument. Because of this we have our own version, BLI_fseek(), which
will use 64-bit _fseeki64() on Windows. This patch just replaces some
fseek() calls with BLI_fseek().

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

Reviewed by Brecht Van Lommel
2021-05-31 10:08:58 -07:00
James Monteath
ee54a8ace7 Update all README to clearify intention or usage
Add snap configuration file used by Buildbot snap store steps1
2021-05-31 18:58:42 +02:00
261a10edb0 Display source video fps in the VSE
Now FPS is displayed in the video source for videos to provide easy
access.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11441
2021-05-31 18:22:24 +02:00
d647e730fb Win: Fix warnings as errors being off for bmesh
bf_bmesh historically always build with the /WX flag
on windows making all warnings errors, somewhere along
the way this has broken for msbuild, ninja still exhibits
the expected behaviour.

The flags are still passed to the target, and I've validated
they are there when the add_library call fires, but they
somehow never make it to the generated msbuild project files.

I suspect this is a cmake bug but I'm seemingly unable
to extract a repro case to file a bug upstream.

Setting the same options target_compile_options seems to work,
I'm not happy about the unexplained nature of the breakage
but this will have to do for now.
2021-05-31 09:59:29 -06:00
b862916eaf VSE: Fix missing cache invalidation
Fixes T88606
2021-05-31 17:28:49 +02:00
Jeroen Bakker
44d2479dc3 Refactor: DRW Mesh Extractor: Join the extractors in a same loop
This patch replaces / redoes the entire MeshExtractors system.
Although they were useful and facilitated the addition of new buffers, they made it difficult to control the threads and added a lot of threading overhead.

Part of the problem was in traversing the same loop type in different threads. The concurrent access of the BMesh Elements slowed the reading.

This patch simplifies the use of threads by merging all the old callbacks from the extracts into a single series of iteration functions.

The type of extraction can be chosen using flags.

This optimized the process by around 34%.

Initial idea and implementation By @mano-wii.
Fine-tuning, cleanup by @atmind.

MASTER:
large_mesh_editing:
- rdata 9ms iter 50ms (frame 155ms)
- Average: 6.462874 FPS

PATCH:
large_mesh_editing:
- rdata 9ms iter 34ms (frame 136ms)
- Average: 7.379491 FPS

Differential Revision: https://developer.blender.org/D11425
2021-05-31 17:11:25 +02:00
aebeb85fe0 Windows: Clean-up win 8/8.1 API use
For 2.93 we bumped the minimum windows requirement
to windows 8.1, but did not do any clean-up of any
win 8/8.1 API usage we dynamically accessed though
LoadLibrary/GetProcAddress.

This patch bumps _WIN32_WINNT to 0x0603 (win 8.1)
and cleans up any API use that was accessed in a
more convoluted way than necessary

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

Reviewed by: harley, nicholas_rishel
2021-05-31 08:56:57 -06:00
d67c13ca76 Cleanup: else-after-return 2021-05-31 15:48:06 +02:00
d94ba979d8 Fix T88569: UI VSE: Menu-based range change, doesn't update the Timeline scrollbar width
Use the appropriate notifier, listeners were already doing the rest
properly.

Maniphest Tasks: T88569

Differential Revision: https://developer.blender.org/D11436
2021-05-31 15:32:33 +02:00
e0a1c3da46 Fix T88666: Cryptomatte: EXR sequence does not update when scrubbing the timeline.
Cause is that initializing the cryptomatte session would reset the
current frame of an image sequence. The solution is to always use the
scene current frame so it resets to the correct frame.

This was a todo that wasn't solved after it landed in master.
Needs to be backported to 2.93.
2021-05-31 14:32:39 +02:00
e9f2f17e85 Fix (unreported): TextureOperation inputs have no resolution
When compositor node tree has a texture node, TextureOperation vector inputs  has always {0, 0} resolution instead of having same resolution as TextureOperation which is the expected behaviour for resolutions propagation.

Current TextureOperation determineResolution implementation doesn't determine inputs resolution, breaking propagation of preferred resolution and that's the reason why they are always 0. Setting scene resolution always would mean it is its own resolution and could make sense, but setting it only when preferred resolution is 0, breaks preferred resolution logic affecting other operations as explained in D10972. In any case scene resolution is already the default preferred resolution on viewer and compositor nodes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11381
2021-05-31 12:26:46 +02:00
83fe479c7f Merge branch 'blender-v2.93-release' 2021-05-31 11:56:17 +02:00
ce649c7344 Fix T88623, T87044: Make encoded videos play correctly in VLC
The issue was two fold. We didn't properly:

1. Initialize the codec default values which would lead to VLC
   complaining because of garbage/wrong codec settings.

2.Calculate the time base for the video. FFmpeg would happily accept
  this but VLC seems to assume the time base value is at least somewhat
  correct and couldn't properly display the frames as the internal time
  base was huge. We are talking about 90k ticks (tbn) for one second of
  video!

This patch initializes all codecs to use their default values and fixes
the time base calculation so it follows the guidelines from ffmpeg.

Reviewed By: Sergey, Richard Antalik

Differential Revision: http://developer.blender.org/D11426
2021-05-31 11:29:08 +02:00
2534609262 Revert "Added v2.93 pipeline config for new buildbot."
This reverts commit 632bfee0a5.
This config is only intended for 2.93. Master will get its own config
file after testing that 2.93 is correct.
2021-05-31 11:16:13 +02:00
86eaddb3ca Merge branch 'blender-v2.93-release' 2021-05-31 11:15:50 +02:00
26fb7b9474 Geometry Nodes: do not create unnecessary geometry components
Previously, making instances real would always create an (empty)
volume and curve component, even when not necessary.

This also fixes T88653.
2021-05-31 11:12:39 +02:00
421c0b45e5 Fix (studio-reported) crash in collection management code.
Code checking for potential collection loop dependencies can be called
in cases where we cannot guarantee that there is no NULL pointers, so we
need to check those. Was already done for objects.
2021-05-31 10:20:23 +02:00
Jeroen Bakker
5f749a03ca Fix T88456: DrawManager: Keep subset RenderMeshData around when geometry does not change.
Reuse loose geometry during selection (and other operations) from
previous calculation. Loose geometry stays the same, but was
recalculated to determine the size of GPU buffers. This patch would
reuse the previous loose geometry when geometry wasn't changed.

Although not the main bottleneck during selection it is measurable.

Master.
`rdata 46ms iter 55ms (frame 410ms)`

This patch.
`rdata 5ms iter 52ms (frame 342ms)`

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11339
2021-05-31 09:33:31 +02:00
a1556fa05c Boolean: applying patch D11431 to speed up hole-tolerant raycast.
This patch from Erik Abrahamsson uses a parallel_for to speed up
the case where the input is not manifold and the "hole_tolerant"
option is set.
In a test case on a 24 core (48 thread) machine, this sped up a
the boolean part on an object with 221k triangles from 12.06s to 0.46s.
2021-05-30 16:37:49 -04:00
e6a69f7653 Docs: Capitalize first word of sentence 2021-05-30 11:09:01 -04:00
7b5796dcaa Docs: clarify description and usage of 'bpy.app.version_file'
Fixes T88669
2021-05-30 11:07:38 -04:00
f5d14e36e8 PyDoc: Use em dash instead of comma for enum items 2021-05-29 12:16:13 -04:00
870aaf3fb6 Docs: Add documentation for 'material_index'
Fixes T88485
2021-05-29 11:22:58 -04:00
6f86d50b92 UI: Match tooltip with interface name 2021-05-29 11:22:58 -04:00
30f7acfffa Docs: Add relevant OCIO envvars to Blender's help message 2021-05-29 11:22:58 -04:00
115547991a Merge branch 'blender-v2.93-release' 2021-05-29 15:29:42 +02:00
James Monteath
ffe7a41540 Fix typos 2021-05-28 20:50:52 +02:00
James Monteath
74c7e21f6c Add and update README.md files for CI script removal 2021-05-28 19:46:53 +02:00
9225fe933a Make encoded video fps correct with ffmpeg < 4.4
Before the FFmpeg commit: github.com/FFmpeg/FFmpeg/commit/1c0885334dda9ee8652e60c586fa2e3674056586
FFmpeg would use deprecated variables to calculate the video fps.

We don't use these deprecated variables anymore, so ensure that the
duration is correct in ffmpeg versions without this fix.

Reviewed By: Sergey, Richard Antalik

Differential Revision: http://developer.blender.org/D11417
2021-05-28 18:37:36 +02:00
3311350670 Fix T87932: Failure to build movie strip proxy
We didn't initialize the scaled proxy frame properly.
This would lead to issues in ffmpeg 4.4 as they are more strict that the API is properly used.

Now we initialize the size and format of the frame.
2021-05-28 18:35:26 +02:00
5b8a41d387 Merge branch 'blender-v2.93-release' 2021-05-28 18:19:07 +02:00
653bbaa246 Geometry Nodes: Polish switch node UI
Based on the task T88006, there are a few simple changes
to make to improve the switch node:
- Change the label to "False" / "True" for clarity
- Change default to geometry, as it's the basic data container in
  geometry nodes.
- Change node class to `NODE_CLASS_CONVERTOR`, which was an oversight
  in the original patch.

I will add the new socket types (material and texture) in a separate commit.
Thanks to @EitanSomething for the original patch.

Differential Revision: https://developer.blender.org/D11165
2021-05-28 12:17:04 -04:00
c0ce7fce89 Merge branch 'blender-v2.93-release' 2021-05-28 12:09:08 -04:00
James Monteath
fc2b56e68c Add branch based pipeline config file used by buildbot and make_update.py script. 2021-05-28 17:53:02 +02:00
a4700549e0 GPencil: Fix unreported random rotation for single point with texture
When using ``Path`` alignment, if the stroke has one point the texture rotates randomly when move the viewport. This was because with one point is impossible to calculate a path.

Now, if the stroke has only one point, the texture for this stroke is aligned to Object.
2021-05-28 17:15:44 +02:00
c65f4b3d76 DrawManager: Early return for buffer cache creation
No real functional changes.

This is useful for benchmark cases when `cache->uv_cage` is passed but
has no buffers are requested.
2021-05-28 11:51:13 -03:00
11e32332dd Geometry Nodes: Add Mesh to Curve Node
This node creates poly curve splines from mesh edges. A selection
attribute input allows only using some of the edges from the mesh.
The node builds cyclic splines from branchless groups of edges where
possible, but when there is a three-way intersection, the spline stops.

The node also transfers all attributes from the mesh to the resulting
control points. In the future we could add a way to limit that to a
subset of the attributes to improve performance.

The algorithm is from Animation Nodes, written by @OmarSquircleArt.
I added the ability to use a selection, attribute transferring, and
used different variable names, etc, but other than that the algorithm
is the same.

Differential Revision: https://developer.blender.org/D11265
2021-05-28 10:42:22 -04:00
418888f1c9 MSVC: Fix build error with 16.10/11
Not entirely sure why this was not an issue for 16.9
but TBB includes the Windows.h header which by default
will define min and max macro's

These collide with the stl versions in <algorithm>

This patch requests Windows.h not to define the
problematic macro's, resolving the conflict.
2021-05-28 07:57:21 -06:00
bdac47f8d4 Merge branch 'blender-v2.93-release' 2021-05-28 15:47:38 +02:00
97ccd592ce Fix crash in liboverride resync.
Reported by studio (@andy), thanks.
2021-05-28 15:33:04 +02:00
James Monteath
51bbdfbef3 Moved to new git repo 2021-05-28 12:16:45 +02:00
63e50cf265 Fix T88499: Copy data path operator does not consider library affiliation
When using the operator `ui.copy_data_path_button(full_path=True)` ({key
ctrl shift Alt C} on hover) the copied path does not consider the
library origin. That means that when there is a name clash the data path
is not accurate and refers to the local item instead.

This patch adds the library (if the ID is linked) of the returned string
from RNA_path_full_ID_py.

bpy.data.objects["Cube", "//library.blend"] instead of
bpy.data.objects["Cube"]

note: parsing this happens in
pyrna_prop_collection_subscript_str_lib_pair_ptr

Maniphest Tasks: T88499

Differential Revision: https://developer.blender.org/D11412
2021-05-28 11:06:55 +02:00
James Monteath
5baf1dddd5 Buildbot related files have been moved to own repository 2021-05-28 10:16:39 +02:00
3ec57ce6c7 Tests: add utility to generate interactive user actions
A utility that supports passing in actions as command line arguments for
writing reproducible interactions, benchmarking, profiling and testing.

Unlike regular scripts this is able to control model operators usefully.

Typical ways of controlling Blender using this utility are via
operator id's, menu search and explicit events.
Others methods can be added as needed.

See the doc-string for example usage.
2021-05-28 16:59:38 +10:00
3bee77bb7c Cleanup: use static set syntax 2021-05-28 16:58:50 +10:00
6b03621c01 DrawManager: Use Compute Shader to Update Hair.
This patch will use compute shaders to create the VBO for hair.
The previous implementation uses transform feedback.

Timings before: between 0.000069s and 0.000362s.
Timings after:  between 0.000032s and 0.000092s.

Speedup isn't noticeable by end-users. The patch is used to test
the new compute shader pipeline and integrate it with the draw
manager. Allowing EEVEE, Workbench and other draw engines to
use compute shaders with the introduction of `DRW_shgroup_call_compute`
and `DRW_shgroup_vertex_buffer`.

Future improvements are possible by generating the index buffer
of hair directly on the GPU.

NOTE: that compute shaders aren't supported by Apple and still use
the transform feedback workaround.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D11057
2021-05-28 08:16:26 +02:00
4a1ba155d5 Merge branch 'blender-v2.93-release' 2021-05-27 21:27:48 -04:00
0a83f32d79 Fix T86465: Annotation Tool is missing in VSE Preview toolbar
Added missing topbar in VSE.

Also added the Stabilizer options to Topbar for all modes.

Reviewed By: mendio, pepeland

Maniphest Tasks: T86465

Differential Revision: https://developer.blender.org/D11347
2021-05-27 19:53:23 +02:00
758c115103 Fix own crash in today's rBf68288a8746f. 2021-05-27 19:32:35 +02:00
311ffd967b LibOverride: refactor recursive resync.
We need to re-evaluate what needs to be resynced after each step of
processing overrides from a given 'indirect level' of libraries.
Otherwise, recusrive overrides (overrides of linked overrides) won't
work.

Note that this should not change too much in practice currently, since
there are other issues with recursive overrides yet.

Also, checks (CLOG errors) added show that some ID (node trees) seem to
be detected as needing resynced even after beig just resynced, this
needs further investigation still. Could be though that it is due to
limit currently set on nodetrees, those are always complicated
snowflakes to deal with...
2021-05-27 19:32:35 +02:00
530f2994e9 Fix T88614: Mixdown crashes Blender 2.92.0 and 3.0.0 Alpha
The problem is caused by the most recent ffmpeg version (4.4) which
needs channels to be set when submitting a frame for encoding.
2021-05-27 19:05:17 +02:00
dfa3dcbab9 Fix T88625: Multiobject UV hiding/unhiding does not work with UV_SYNC_SELECTION
Oversight in {rB470f17f21c06}.

Hiding was only done for the first mesh, then the operator finished (in
case of UV_SYNC_SELECTION).
Now just continue to the next.

Maniphest Tasks: T88625

Differential Revision: https://developer.blender.org/D11413
2021-05-27 17:27:38 +02:00
8590cb26a9 Merge branch 'blender-v2.93-release' 2021-05-27 17:15:39 +02:00
3025c34825 Geometry Nodes: Expose texture and material inputs to modifier
This allows choosing material and texture sockets for the group input
node in the modifier. Note that currently grease pencil materials are
displayed in the list, even though grease pencil data is not supported
yet by geometry nodes. That is more complicated to fix in this case,
since we use IDProperties to store the dynamic exposed inputs.

Differential Revision: https://developer.blender.org/D11393
2021-05-27 11:06:08 -04:00
24b2482ad9 Cleanup: Fix forward declaring class with "struct" 2021-05-27 11:00:00 -04:00
a3edf4a381 Fix build error: Make CurveEval a struct
We need a pointer to this in DNA, which means it cannot be a class.
2021-05-27 10:50:43 -04:00
e8ca635e43 Cleanup: rename blender-launcher source file.
blender-laucher.c was not an ideal name for this file
since it's not directly clear it is windows only.

This change renames it to blender_launcher_win32.c
to be more in line with other win32 specific files
we have.
2021-05-27 08:10:31 -06:00
ac833108db Geometry Nodes: Draw curve data in the viewport
This patch adds relatively small changes to the curve draw
cache implementation in order to draw the curve data in the
viewport. The dependency graph iterator is also modified
so that it iterates over the curve geometry component, which
is presented to users as `Curve` data with a pointer to the
`CurveEval`

The idea with the spline data type in geometry nodes is that
curve data itself is only the control points, and any evaluated
data with faces is a mesh. That is mostly expected elsewhere in
Blender anyway. This means it's only necessary to implement
wire edge drawing of `CurveEval` data.

Adding a `CurveEval` pointer to `Curve` is in line with changes
I'd like to make in the future like using `CurveEval` in more places
such as edit mode.

An alternate solution involves converting the curve wire data
to a mesh, however, that requires copying all of the data, and
since avoiding it is rather simple and is in-line with future plans
anyway, I think doing it this way is better.

Differential Revision: https://developer.blender.org/D11351
2021-05-27 10:08:40 -04:00
5621a8ed7f Fix T88452: Point Separate crash on curve component
The point separate node should create a point cloud from control points
in this case, but for now disable the node on curves to avoid the crash.
2021-05-27 09:37:19 -04:00
a12fd5c3ad Cleanup: Use consistent variable names 2021-05-27 09:27:08 -04:00
5721c89ba8 Cleanup: rename BKE_main_id_{clear_newpoins => newptr_and_tag_clear}
It wasn't obvious this function cleared the tag as well.
2021-05-27 22:44:02 +10:00
Erik Abrahamsson
9200e73136 Cleanup: remove duplicate LIB_TAG_NEW untag code
This patch removes unnecessary calls to `BKE_main_id_tag_all` where the
same job is done by `BKE_main_id_clear_newpoins` on the following line.

Reviewed By: campbellbarton, mont29

Ref D11379
2021-05-27 22:42:41 +10:00
6ad4b8b764 LineArt: List Optimization for tile linked data.
Use array instead of ListBase for line art
bounding area linked triangles and edges.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11302
2021-05-27 20:33:02 +08:00
f45270b4fb Cleanup: Line art variable naming.
Change `reln` to `eln`.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11411
2021-05-27 18:47:13 +08:00
42fba7f0d2 LibOverride: Add heuristic protection against infinite loop due to libraries inter-dependencies.
This is not supposed to happen, but better be safe than sorry, and
assume it is beyond unlikely that someone would use chains of over 10k
linked libraries.
2021-05-27 11:55:31 +02:00
ac2266fe57 Cleanup: Unused include in Cycles 2021-05-27 11:36:30 +02:00
2414a5787d Refactor: Move display pass to Cycles viewport parameters
Allows to centralize storage and modification checks in a single place,
avoiding duplication in the synchronization code.

Ideally we would somehow be able to more granularly modify Cycles side
objects. Leaving this for a future decision, because it might be better
to implement it as a graph on the sync side.
2021-05-27 11:36:30 +02:00
7b5f4c8837 Cleanup: Redundnat member init in Cycles viewport parameters 2021-05-27 11:36:30 +02:00
616b071c4f Refactor: Naming in Cycles viewport methods
Makes it more explicit they operate on shading/light.

Gives room to move more viewport related settings into this class and
cover with specific or generic modification checks.
2021-05-27 11:36:30 +02:00
15df83e9c9 Cleanup: Use logical OR in Cycles background shader 2021-05-27 11:36:30 +02:00
8f43e31a71 Cleanup: const qualifier of return type 2021-05-27 11:36:30 +02:00
4ea7742973 Refactor: Remove friend class from Cycles viewport parameters
Such pattern should only be used when it is really needed. Otherwise
just stick to a more regular design, without worrying who is the user
of the class. Otherwise it will be annoying to subclass or unit test.
2021-05-27 11:36:30 +02:00
bf7a67c5c6 Refactor: Rename pass accessor in viewport parameters
No need to state that it is a viewport display pass, since the method
is within viewport parameters it is implied that parameters do belong
to the viewport.

Brings this code closer to the Cycles-X branch.
2021-05-27 11:36:30 +02:00
06d48367fa Fix (studio-reported) infinite loop in resync code.
Very stupid mistake in libraries indirect-level building code, was not
skipping 'loop-back' ID pointers.

Note that we also need some level of checks for the case where there
would be an actual dependency loop between libraries, this is not
supposed to be possible, but better be safe than sorry. Will add in next
commit.
2021-05-27 10:49:31 +02:00
46e1ad711c Cleanup: inconsistent parameter name 2021-05-27 10:46:43 +02:00
ffa2a1771e Cleanup: inconsistent parameter name 2021-05-27 10:41:40 +02:00
fd0bb24e4a Cleanup: simplify logic for copying vector button as text
An arbitrary size offsets was used in float_array_to_string,
simplify the loop, use exact size limits.

Also rename variables so it's clear which array the length apply to.
2021-05-27 17:59:21 +10:00
41f2ea4045 Fix incorrect BLI_snprintf usage
Event though in practice this wasn't causing problems as the fixed size
buffers are generally large enough not to truncate text.

Using the result from `snprint` or `BLI_snprintf` to step over a fixed
size buffer allows for buffer overruns as the returned value is the size
needed to copy the entire string, not the number of bytes copied.

Building strings using this convention with multiple calls:

    ofs += BLI_snprintf(str + ofs, str_len_max - ofs);

.. caused the size argument to become negative,
wrapping it to a large value when cast to the unsigned argument.
2021-05-27 17:59:21 +10:00
1276d0024f Cleanup: specify array sizes, remove warnings in comments 2021-05-27 17:59:21 +10:00
f0342065b1 Cleanup: spelling 2021-05-27 17:59:21 +10:00
2ad3a1c318 Nodes: fix material node copied over when socket is copied
This was missing from rB207472930834a2916cf18bbdff51bcd77c6dd0c0.
2021-05-27 09:58:45 +02:00
223c6e1ead Geometry Nodes: disable multi-threading in evaluator for now
A deadlock could happen under certain circumstances when
geometry nodes is used on multiple objects.
Once T88598 is resolved, multi-threading can be enabled again.

Differential Revision: https://developer.blender.org/D11405
2021-05-27 09:43:11 +02:00
7d20cf92dd Cleanup: use UndoMesh as links instead of allocating LinkData
While the advantage isn't large,
it's simpler to skip the intermediate link.

Also remove unused next and previous struct members
from MeshUndoStep_Elem.
2021-05-27 16:44:21 +10:00
deb71cef38 Undo: resolve inefficient edit-mesh memory use with multiple objects
When editing more than 1 object at a time, complete copies of each mesh
were being stored. Now the most recent undo-data for each mesh is used
(when available).
2021-05-27 16:44:21 +10:00
a10e41b02e Cleanup: Remove completed "TODO" comment
Since rBb67fe05d4bea, the dependency graph supports relations
on collection geometry, and the nodes modifier uses that.
2021-05-26 22:32:53 -04:00
b132dd042e Cleanup: Simplify spline point attribute materialize functions
- Iterate over the mask directly instead of using an index.
- Use Span slice and copy_from instead of a lower level function.
2021-05-26 22:22:09 -04:00
c97b6215a3 Geometry Nodes: Support interpolation between curve domains
This commit adds interpolation from the point domain to the spline
domain and the other way around. Before this, spline domain attributes
were basically useless, but now they are quite helpful as a way to use
a shared value in a contiguous group of points.

I implementented a special virtual array for the spline to points
conversion, so that conversion should be close to the ideal performance
level, but there are a few ways we could optimize the point to spline
conversion in the future:
 - Use a function virtual array to mix the point values for each spline
   on demand.
 - Implement a special case for when the input virtual array is one of
   the virtual arrays from the spline point attributes. In other words,
   decrease curve attribute access overhead.

Differential Revision: https://developer.blender.org/D11376
2021-05-26 22:14:59 -04:00
f3944cf503 Win: Add launcher to hide the console window flash
This patch fixes a long-standing complaint from users:
the console window shortly flashing when they start
blender.

This is done by adding a new executable called
blender-launcher.exe which starts blender.exe while
hiding the console.

Any command line parameters given to blender-launcher
will be passed on to blender.exe so it'll be a drop
in replacement.

Starting blender.exe on its own will still function as
a proper console app so no changes required here for
users that use blender for batch processing.

Notable changes:

Registering blender (-R switch) will now register
blender-launcher as the preferred executable.

This patch updates the installer and updates the
shortcuts to start blender-launcher.exe rather
than blender.exe

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

Reviewed by: brecht, harley
2021-05-26 20:02:35 -06:00
Germano Cavalcante
6fc9ec9257 Cleanup: Specify amount of buffers through preprocessor directives 2021-05-26 22:52:59 -03:00
e5b51cb511 Fix T88603: Crash with spline attributes after curve resample
The output curve's spline attribute domain custom data needs to be
reallocated with the correct length after adding the splines.
2021-05-26 21:12:38 -04:00
2c607ec2f6 Revert "DrawManager: Use Compute Shader to Update Hair."
This reverts commit 8f9599d17e.

Mac seems to have an error with this change.
```
                 ERROR: /Users/blender/git/blender-vdev/blender.git/source/blender/draw/intern/draw_hair.c:115:44: error: use of undeclared identifier 'shader_src'
                 ERROR: /Users/blender/git/blender-vdev/blender.git/source/blender/draw/intern/draw_hair.c:123:13: error: use of undeclared identifier 'shader_src'
                 ERROR: make[2]: *** [source/blender/draw/CMakeFiles/bf_draw.dir/intern/draw_hair.c.o] Error 1
                 ERROR: make[1]: *** [source/blender/draw/CMakeFiles/bf_draw.dir/all] Error 2
                 ERROR: make: *** [all] Error 2

```
2021-05-26 20:32:05 +02:00
7438f0c6c0 Cleanup: array-parameter warning with GCC 11
Pass the string size as this is less error prone in general.
2021-05-27 02:32:44 +10:00
de3d54eb9a GPencil: Cleanup - Conform with RNA naming scheme
The newly added `disable_masks_viewlayer` RNA property did not conform
with the RNA naming scheme. This renames it to `use_viewlayer_masks`.
2021-05-26 18:23:31 +02:00
df32b50344 Fix T88111: Skin modifier assets within invalid face normals
The skin modifier was moving vertices without updating normals for the
connected faces, this happened when smoothing and welding vertices.

Reviewed By: mont29

Ref D11397
2021-05-27 01:52:45 +10:00
6b00df1105 Cleanup: shadow warning
Move reproject_type into an extern, to avoid declaring multiple times.
2021-05-27 01:52:45 +10:00
72d660443b LibOverride: add recursive resync.
Recursive resync means also resyncing overrides that are linked from
other library files into current working file.

Note that this allows to get 'working' files even when their
dependencies are out of sync. However, since linked data is never
written/saved, this has to be re-done every time the working file is
loaded, until said dependencies are updated properly.

NOTE: This is still missing the 'report' side of things, which is part
of a larger task to enhance reports regarding both linking, and
liboverrides (see T88393).

----------

Technical notes:

Implementing this proved to be slightly more challenging than expected,
mainly because one of the key aspects of the feature was never done in
Blender before: manipulating, re-creating linked data.

This ended up moving the whole resync code to use temp IDs out of bmain,
which is better in the long run anyway (and more aligned with what we
generally want to do when manipulating temp ID data). It should also
give a marginal improvement in performances for regular resync.

This commit also had to carefully 'sort' libraries by level of indirect
usage, as we want to resync first the libraries that are the least directly
used, i.e. libraries that are most used by other libraries.
2021-05-26 17:05:01 +02:00
51ca9833d9 LibOverride: add helper to retrieve override data from an ID.
Embedded IDs do not own their own override data, but rather use the one
from their owner.
2021-05-26 17:05:01 +02:00
daf39af70a IDManagement: Shapekey: add a owner_get callback.
Even though shepkeys are not strictly speaking an embedded data, they
share quiet a few points with those, and from liboverride perspective
they are embedded, so...
2021-05-26 17:05:01 +02:00
653d39cec3 LibOverride: Do not try to generate override data of linked data.
This is obviously not saved, and should never be editable, so was only a
waste of time.
2021-05-26 17:05:01 +02:00
6cbe5dd1c3 ID management: remapping: add flag to enforce refcounting handling.
While indeally we should only skip refcounting when relevant tag is set,
doing this in remapping code is too risky for now.

Related to previous commit and T88555.
2021-05-26 17:05:01 +02:00
ee849ca0f8 ID management: Do not assume that NO_MAIN means NO_USER_REFCOUNT
While this is still very fuzzy in current code, this old behavior makes
it close to impossible to efficiently use out-of-main temp data, as it
implies that we'd need to update refcounts everytime we add something
back into BMain (an 'un-refcount' ID usages when removing from BMain).

Now that we have two separate flags/tags for those two different things,
let's not merge them anymore.

Note that this is somewhat on-going process, still needs more checks and
cleanup. Related to T88555.
2021-05-26 17:05:00 +02:00
Jeroen Bakker
8f9599d17e DrawManager: Use Compute Shader to Update Hair.
This patch will use compute shaders to create the VBO for hair.
The previous implementation uses tranform feedback.

Timings master (transform feedback with GPU_USAGE_STATIC between 0.000069s and 0.000362s
Timings transform feedback with GPU_USAGE_DEVICE_ONLY. between 0.000057s and 0.000122s
Timings compute shader between 0.000032 and 0.000092s

Future improvements:
* Generate hair Index buffer using compute shaders: currently done single threaded on CPU, easy to add as compute shader.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D11057
2021-05-26 17:03:37 +02:00
Jeroen Bakker
87055dc71b GPU: Compute Pipeline.
With the compute pipeline calculation can be offloaded to the GPU.
This patch only adds the framework for compute. So no changes for users at
this moment.

NOTE: As this is an OpenGL4.3 feature it must always have a fallback.

Use `GPU_compute_shader_support` to check if compute pipeline can be used.
Check `gpu_shader_compute*` test cases for usage.

This patch also adds support for shader storage buffer objects and device only
vertex/index buffers.

An alternative that had been discussed was adding this to the `GPUBatch`, this
was eventually not chosen as it would lead to more code when used as part of a
shading group. The idea is that we add an `eDRWCommandType` in the near
future.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D10913
2021-05-26 16:49:30 +02:00
e459a25e6c GPencil: Add option to disable masks in view layer
This patch adds an option in the Layers > Relations panel called "Disable Masks in Render".
When checked, no masks on this layer are included in the render.

Example:
| {F10087680} | {F10087681} |

See T88202 for why this is needed.

Reviewed By: antoniov

Maniphest Tasks: T88202

Differential Revision: https://developer.blender.org/D11234
2021-05-26 16:46:20 +02:00
a6f3bb36df Merge branch 'blender-v2.93-release' 2021-05-26 16:34:03 +02:00
3f27efd31e Merge branch 'blender-v2.93-release' 2021-05-26 16:20:24 +02:00
06f86dd4d9 GPencil: Bake GPencil object transforms into a new GPencil object
This operator is a common request of animators to convert the transformation (inluding modifiers) of one grease pencil object, into a new object, generating strokes.

Reviewed By: pepeland

Maniphest Tasks: T87424

Differential Revision: https://developer.blender.org/D11014
2021-05-26 15:43:40 +02:00
b67423f806 Nodes: fix threading issues with node ui storage
Calling BKE_nodetree_attribute_hint_add from multiple threads still
was not safe before..
One issue was that context_map embedded its values directly. So
when context_map grows, all NodeUIStorage would move as well.
I could patch around that by using std::unique_ptr in a few places,
but that just becomes too complex for now.
Instead I simplified the locking a bit by adding just locking a mutex
in NodeTreeUIStorage all the time while an attribute hint is added.

Differential Revision: https://developer.blender.org/D11399
2021-05-26 14:19:01 +02:00
afec66c024 Fix T88588: crash when muting node with multi input socket
The bug existed before the new evaluator already, but the new evaluator
is more sensitive to this kind of error.
2021-05-26 12:25:48 +02:00
12a06292af Cycles: optimize attributes device updates
When an `AttributeSet` is tagged as modified, which happens after the addition or
removal of an `Attribute` from the set, during the following GeometryManager device
update, we update and repack the kernel data for all attribute types. However, if we
only add or remove a `float` attribute, `float2` or `float3` attributes should not
be repacked for efficiency.

This patch adds some mechanisms to detect which attribute types are modified from
the AttributeSet.

Firstly, this adds an `AttrKernelDataType` to map the data type of the Attribute to
the one used in the kernel as there is no one to one match between the two since e.g.
`Transform` or `float4` data are stored as `float3s` in the kernel.

Then, this replaces the `AttributeSet.modified` boolean with a set of flags to detect
which types have been modified. There is no specific flag type (e.g.
`enum ModifiedType`), rather the flags used derive simply from the
`AttrKernelDataType` enumeration, to keep things synchronized.

The logic to remove an `Attribute` from the `AttributeSet` and tag the latter as modified
is centralized in a new `AttributeSet.remove` method taking an iterator as input.

Lastly, as some attributes like standard normals are not stored in the various
kernel attribute arrays (`DeviceScene::attribute_*`), the modified flags are only
set if the associated standard corresponds to an attribute which will be stored
in the kernel's attribute arrays. This makes it so adding or removing such attributes
does not trigger an unnecessary update of other type-related attributes.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11373
2021-05-26 12:18:28 +02:00
2a09634d41 Fix particlesystem not duplicating their pointcache in NO_MAIN case.
Sharing data between duplicated IDs should be restricted to depsgraph
(CoW) cases, not all NO_MAIN ones...

While this was probably not an issue currently, we aim at using more and
more out-of-main IDs for temp data processing.

NOTE: Somewhat related to T88555, and similar issue as the one fixed in
rBdfb963c70df5.
2021-05-26 11:25:51 +02:00
534fcab994 Fix T88552: Cycles changing Render Passes in viewport does not work 2021-05-26 11:16:47 +02:00
a72a580948 Cleanup: Simplify Cycles viewport parameters
Use early output and access shading RNA object only once.
2021-05-26 11:10:56 +02:00
e6c0e6c2a9 Compositor: Use BLI_color in convert alpha node.
Recently the CPP colors module landed in master. This patch will use the
new module in the convert alpha node.
2021-05-26 10:46:46 +02:00
1e6b028580 Cleanup: Remove unused argument in Cycles sync
Makes it easier to see where exactly the viewport is used.
2021-05-26 10:45:27 +02:00
09e77f904d Fix T88534: Unable to add a Geometry Node Tree on Volume object
Volumes are supported, poll corrected.

Maniphest Tasks: T88534

Differential Revision: https://developer.blender.org/D11378
2021-05-26 10:28:16 +02:00
03c0fa1cdb Fix T88531: Mantaflow problem with geometry nodes
Objects modified by geometry nodes modifiers were not caught as being
"dynamic".

Now add this modifier type to the list of modifiers making them "dynamic"
in the eyes of mantaflow.

(noticed by @sebbas in chat)

Maniphest Tasks: T88531

Differential Revision: https://developer.blender.org/D11389
2021-05-26 10:21:39 +02:00
b813007a0f Fix T88566: Mantaflow inflow with shapekeys is not working anymore
(regression)

Code was actually checking for shapekeys, but these were not detected
properly (some effects like shape keys are added as virtual modifiers
before the user created modifiers)

Now go over virtual modifiers as well.

Maniphest Tasks: T88566

Differential Revision: https://developer.blender.org/D11388
2021-05-26 10:17:55 +02:00
ff35332610 Merge branch 'blender-v2.93-release' 2021-05-26 09:55:47 +02:00
c0bb7d9cb7 Cleanup: Fix short comparison with bool warning
For some reason the hide status is stored in a short and a char
(we cannot have bools in DNA).
2021-05-25 14:37:58 -04:00
95690dd362 Bump FFmpeg version from 4.2.3 to 4.4
Bump FFmpeg version to 4.4 to fix a problem where it would write the
wrong frame rate. Their old API was deprecated and Blender moved to the
new one in rB8d6264ea12bfac0912c7249f00af2ac8e3409ed1. The new one
produced files with the wrong frame rate, which was fixed in FFmpeg 4.4.

Manifest Task: T88568

Reviewed By: LazyDodo, zeddb

Differential Revision: https://developer.blender.org/D11392
2021-05-25 18:58:28 +02:00
490dd279cc deps: Fix broken boost link 2021-05-25 10:27:48 -06:00
45b28c0f88 GPencil: Add a use_light option when creating object.
This option is default off when creating line art objects
because line art seldom use lighting and the normal data
would be all over the place anyway.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D11372
2021-05-25 23:45:47 +08:00
9f60188cd8 Cleanup: Use ListBase in various places in line art.
This clarifies the data structures for storing edges
for different calculation stages.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11386
2021-05-25 23:32:04 +08:00
Jeroen Bakker
cb8a6814fd Blenlib: Explicit Colors.
Colors are often thought of as being 4 values that make up that can make any color.
But that is of course too limited. In C we didn’t spend time to annotate what we meant
when using colors.

Recently `BLI_color.hh` was made to facilitate color structures in CPP. CPP has possibilities to
enforce annotating structures during compilation and can adds conversions between them using
function overloading and explicit constructors.

The storage structs can hold 4 channels (r, g, b and a).

Usage:

Convert a theme byte color to a linearrgb premultiplied.
```
ColorTheme4b theme_color;
ColorSceneLinear4f<eAlpha::Premultiplied> linearrgb_color =
    BLI_color_convert_to_scene_linear(theme_color).premultiply_alpha();
```

The API is structured to make most use of inlining. Most notable are space
conversions done via `BLI_color_convert_to*` functions.

- Conversions between spaces (theme <=> scene linear) should always be done by
  invoking the `BLI_color_convert_to*` methods.
- Encoding colors (compressing to store colors inside a less precision storage)
  should be done by invoking the `encode` and `decode` methods.
- Changing alpha association should be done by invoking `premultiply_alpha` or
  `unpremultiply_alpha` methods.

# Encoding.

Color encoding is used to store colors with less precision as in using `uint8_t` in
stead of `float`. This encoding is supported for `eSpace::SceneLinear`.
To make this clear to the developer the `eSpace::SceneLinearByteEncoded`
space is added.

# Precision

Colors can be stored using `uint8_t` or `float` colors. The conversion
between the two precisions are available as methods. (`to_4b` and
`to_4f`).

# Alpha conversion

Alpha conversion is only supported in SceneLinear space.

Extending:
- This file can be extended with `ColorHex/Hsl/Hsv` for different representations
  of rgb based colors. `ColorHsl4f<eSpace::SceneLinear, eAlpha::Premultiplied>`
- Add non RGB spaces/storages ColorXyz.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D10978
2021-05-25 17:16:54 +02:00
00955cd31e Revert "Blenlib: Explicit Colors."
This reverts commit fd94e03344.
does not compile against latest master.
2021-05-25 17:03:54 +02:00
Jeroen Bakker
fd94e03344 Blenlib: Explicit Colors.
Colors are often thought of as being 4 values that make up that can make any color.
But that is of course too limited. In C we didn’t spend time to annotate what we meant
when using colors.

Recently `BLI_color.hh` was made to facilitate color structures in CPP. CPP has possibilities to
enforce annotating structures during compilation and can adds conversions between them using
function overloading and explicit constructors.

The storage structs can hold 4 channels (r, g, b and a).

Usage:

Convert a theme byte color to a linearrgb premultiplied.
```
ColorTheme4b theme_color;
ColorSceneLinear4f<eAlpha::Premultiplied> linearrgb_color =
    BLI_color_convert_to_scene_linear(theme_color).premultiply_alpha();
```

The API is structured to make most use of inlining. Most notable are space
conversions done via `BLI_color_convert_to*` functions.

- Conversions between spaces (theme <=> scene linear) should always be done by
  invoking the `BLI_color_convert_to*` methods.
- Encoding colors (compressing to store colors inside a less precision storage)
  should be done by invoking the `encode` and `decode` methods.
- Changing alpha association should be done by invoking `premultiply_alpha` or
  `unpremultiply_alpha` methods.

# Encoding.

Color encoding is used to store colors with less precision as in using `uint8_t` in
stead of `float`. This encoding is supported for `eSpace::SceneLinear`.
To make this clear to the developer the `eSpace::SceneLinearByteEncoded`
space is added.

# Precision

Colors can be stored using `uint8_t` or `float` colors. The conversion
between the two precisions are available as methods. (`to_4b` and
`to_4f`).

# Alpha conversion

Alpha conversion is only supported in SceneLinear space.

Extending:
- This file can be extended with `ColorHex/Hsl/Hsv` for different representations
  of rgb based colors. `ColorHsl4f<eSpace::SceneLinear, eAlpha::Premultiplied>`
- Add non RGB spaces/storages ColorXyz.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D10978
2021-05-25 17:01:26 +02:00
b046bc536b Fix T88096: Baking with OptiX and displacement fails
Using displacement runs the shader eval kernel, but since OptiX modules are not loaded when
baking is active, those were not available and therefore failed to launch. This fixes that by falling
back to the CUDA kernels.
2021-05-25 16:56:16 +02:00
8cd506639a Geometry Nodes: Add Shader Curve Nodes
Convert curve vec and curve rgb shader nodes to geometry nodes, based on node_shader_valToRgb.cc implementation.
2021-05-25 15:43:51 +01:00
54ae7baa4c Cleanup: Line art naming changes.
Make variable naming consistent with struct names.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11382
2021-05-25 22:11:06 +08:00
c3c576c8c4 Cleanup: Convert to static type directly from CPPType 2021-05-25 09:52:08 -04:00
a20ef4207d Fix T86956: VSE shading mode ignores Grease Pencil Vertex colors.
Issue is that due to the strange definition of render in grease pencil
(meaning should be rendered similar to rendering). This included normal
viewport rendering in OB_RENDER and OpenGL render in OB_RENDER.

For other rendering modes the overlay vertex opacity would be used. This
patch sets this value to 1 when rendering via a scene strip override.

NOTE: that this isn't a good solution as I expect that users want to use
the opacity of the Grease pencil object. Perhaps the GPencil team has a
better solution for it.
2021-05-25 15:18:06 +02:00
1bdd5becc7 Unreported fix: vertex colors overlay not set for new 3d views.
Found during researching {T86956}.
2021-05-25 15:18:06 +02:00
5fddb5ab62 Merge branch 'blender-v2.93-release' 2021-05-25 15:09:54 +02:00
cccfcca33d Cleanup: use nullptr 2021-05-25 13:37:50 +02:00
067587e329 Cleanup: remove unused function 2021-05-25 13:12:54 +02:00
405534c756 Cleanup: remove unnecessary lambda capture 2021-05-25 13:10:44 +02:00
768d4c6cfe Fix T88549: ID sorting tests.
Forgot to initialize the ID types array...

Weird though that this only failed on Windows!

Thanks a lot to @deadpin for helping investigating this.
2021-05-25 12:16:24 +02:00
0a7bd3b6d2 Fix T88464: Incorrect baking with camera markers.
This will update active camera based on the maker for each frame.

Reviewed By: Sebastian Parborg (zeddb), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D11358
2021-05-25 16:51:26 +08:00
e3faef686d Fix/Refactor RNA ID preview getter creating preview data.
Same as with forcefields, accessors should never generate data.
2021-05-25 10:38:56 +02:00
ad447705c0 Cleanup: spelling 2021-05-25 18:25:55 +10:00
8c7766dc03 Cleanup: clang-format 2021-05-25 18:25:44 +10:00
Pratik Borhade
0606a37e1a Fix T88500: Constrain window top position (Win32)
Do not allow a window to be created that has a top position that
can obscure all or part of title bar. Right and Left edges can
still be specified slightly outside of monitor bounds, but top
edge must be clamped to monitor top.

see D11371 for more details.

https://developer.blender.org/D11371

Reviewed by Ray Molenkamp
2021-05-24 11:46:35 -07:00
9c53690b30 Merge branch 'blender-v2.93-release' 2021-05-24 12:30:24 -03:00
1318cb26fe Cleanup: Refactor PlaneTrack and PlaneDistort operations
Deduplicates code by introducing a PlaneDirtortBaseOperation for common logic.

Reviewed By: #compositing, jbakker

Differential Revision: https://developer.blender.org/D11273
2021-05-24 14:31:55 +02:00
Charlie Jolly
6c2c16b5f8 Nodes: move shader curves node to C++
Prepare node for conversion to Geometry Nodes.

There should be no functional changes.

Reviewed By: JacquesLucke, LazyDodo

Differential Revision: https://developer.blender.org/D11226
2021-05-24 12:02:49 +01:00
24004e74fa Fix T88524: GPencil PDF does not take into account the marker camera
The camera was not checked before doing the export.
2021-05-24 12:36:13 +02:00
43153e2324 Fix T88466: Sound strips prevent strip rendering
When sound strip is above another strip such as movie strip, it prevents
from rendering movie strip.

This bug was introduced in 0b7744f4da. Function `must_render_strip()`
checks if there is any strip with `SEQ_BLEND_REPLACE` blending and
considers this strip as lowest strip in stack. Sound strips do have this
blend mode set, which caused the bug.

Remove all sound strips and muted strips from stack collection before
checking with `must_render_strip()` function
2021-05-24 05:57:53 +02:00
7e841c797f UI: Use title case for labels 2021-05-23 15:31:54 -04:00
9dcbc195ad Docs: Add readme for mikktspace 2021-05-23 13:57:22 -04:00
f7b22fc3d2 Cleanup: remove redundant property for transfer_mode key-map item
As the property isn't saved and defaults to disabled,
there is no need to set it.
2021-05-22 14:53:41 +10:00
7adbe62a09 Cleanup: tweaks for Object Non-modal keymap
Simplify adding non-legacy keymap items.
2021-05-22 13:14:28 +10:00
2175cbe2ce Cleanup: Move curve draw cache implementation to C++
I'd like to use this file to draw curves from geometry nodes, which
would otherwise require implementing a C API. The changes in this
commit are minimal, mostly just casts and changing to nullptr.

Differential Revision: https://developer.blender.org/D11350
2021-05-21 17:28:29 -04:00
2521e17a58 Merge branch 'blender-v2.93-release' 2021-05-21 14:44:17 -04:00
Wayde Moss
9c4ecef62f Fix T88375: Bone Size Small After V3D.View_All
The wrong matrix function was used and overwrote the custom bone shape
scale instead of reading from it.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11330
2021-05-21 13:24:55 -04:00
4fb052f08d Fix T88384: Improved Win32 Window Sizing and Positioning
When creating Win32 windows, the sizes and placements can be out by a
small amount, mostly noticeable near monitor edges. This is because
Windows 10 includes a thin invisible border (typically 7 pixels) when
determining position. Therefore the correct values can sometimes be
just outside the monitor bounds, but we clamp them at those bounds.

This patch fixes this by first clamping the requested values to monitor
bounds, adjusting for window chrome with AdjustWindowRectEx(), and then
using those adjusted values in CreateWindowExW().

see D11314 for more details.

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

Reviewed by Ray Molenkamp
2021-05-21 09:34:58 -07:00
24deeee09e Fix some RNA physics accessors creating data.
Accessing data through RNA should never implicitely create it. Objects'
and particles' forcefields and collision settings were doing this.

Note that UI code also had to be tweaked to properly handle `None`
(NULL) cases.

Differential Revision: https://developer.blender.org/D11341
2021-05-21 17:22:43 +02:00
adf2f146d8 Fix particle ID init not creating particle deflect data.
This data (the force fields) are expected to always be there, but they
are currently created on the fly by RNA accessors (typically from UI
draw code), which is extremely wrong way to do it.

Differential Revision: https://developer.blender.org/D11341
2021-05-21 17:22:43 +02:00
305b08b521 GPencil: Speed up Occlude Eraser
This is an initial change to speed up the calculation of the Occlude eraser. In the future, we can add more optimizations, but at least this increase speed.

Intead to check always the 3 points, the check is skipped if it's not required.

Base in a solution by Philipp Oeser.

This is related to T88412
2021-05-21 17:00:33 +02:00
5158d1b42d Cleanup: use nullptr 2021-05-21 15:09:22 +02:00
Leon Zandman
865d1889da Cleanup: spelling
Includes fixes to misspelled function names.

Ref D11280
2021-05-21 22:23:07 +10:00
cf42586737 Fix T85752: Collection Instance Crash when instancing collections with disabled subcollections
Root of the issue was actually hidden deep in depsgraph itself: it would
not properly update all of its COW IDs using a datablock when depsgraph
decides to evaluate or un-evaluate it.

This would lead to evaluated IDs pointing to either:
 - orig IDs when there was an evaluated version of those (annoying bug,
   but not a crashing one).
 - old address of previously evaluated IDs that no longer exists in the
   depsgraph (causing the crash from the report e.g.).

This commit adds an extra step at the end of nodes building, that goes
over all of already existing IDs in the depsgraph to check whether they
do one of the two things above, and tag them for COW update if so.

NOTE: This only affects depsgraph (re-)building, not its evaluation.
This remains consistent with the fact that operations that may change
the depsgraph content (like Collection exclusion etc.) need to trigger a
rebuild.

NOTE: Performances: Worst case scenarii, like (un-)excluding a whole
character collection in a production file, lead to 5% to 10% extra
processing time in depsgraph building. Most of it comming from extra COW
processing (in depsgraph's update in `build_step_finalize`), the detection
loop itself only accounts for 1% to 2% of the whole building time.

Maniphest Tasks: T85752

Differential Revision: https://developer.blender.org/D10907
2021-05-21 12:43:32 +02:00
ff51c2e89a Cleanup: Use named unused arguments in Cycles Device 2021-05-21 11:19:33 +02:00
c154b078b5 Geometry Nodes: new Material Replace node
This node can change all faces that use a specific material to use a
different material. Using this node is significantly more efficient
than creating a selection from all faces with a specific material
index and then using the Material Assign node.

Ref T88055.

Differential Revision: https://developer.blender.org/D11325
2021-05-21 09:43:55 +02:00
aa6f0f3d1f Depsgraph: remove mesh edit-mode pointer duplication
Share the pointer with the original mesh instead, this matches behavior
of all other objects edit-mode data.

Duplicating the edit-mesh pointer makes updates to edit-mesh require
a COPY_ON_WRITE update, which is currently an expensive operation
(copying the entire mesh).

Notes:

- This change is from 802027f3f8
  so the edit-meshes object pointer `BMEditMesh.ob` referenced the COW
  version of the object. This pointer has since been removed, so the
  copy is no longer needed.

- Having a separate edit-mesh pointer could be used so linked duplicates
  could have their own generated meshes. For this to be supported,
  many other changes would be needed: see D10920.
2021-05-21 16:23:42 +10:00
12a91f7f5d Fix T88227: Eevee not working on AMD 535 cards.
Enabled HQ normals workaround for this specific configuration.
2021-05-21 07:46:20 +02:00
2b640622ff Transform: use ID_RECALC_GEOMETRY flag when updating object data
While this doesn't provide any noticeable benefits at the moment,
it allows for geometry updates skipping copy-on-write in edit-mode
in the future.
2021-05-21 15:45:25 +10:00
b13953b1f2 Cleanup: quiet -Warray-parameter warnings from GCC11
Some warnings remain that require larger changes.
2021-05-21 15:45:25 +10:00
6c6551c398 Cleanup: conversion warning 2021-05-21 15:45:23 +10:00
Iyad Ahmed
a43c7538b8 Eevee Wavelength Node Support
This patch adds wavelength node support to Eevee, similar to how
Eevee Blackbody node works, thus it is a little off from Cycles.

Reviewed By: #eevee_viewport, fclem, brecht
Differential Revision: https://developer.blender.org/D11326
2021-05-21 10:25:47 +05:30
b18d5dac53 Transform: remove ID_RECALC_SELECT for edit-mode armatures
This was added in 9516921c05
so overlays would redraw, as far as I can see it's no longer needed.

Reviewed By: fclem

Ref D11322
2021-05-21 10:58:07 +10:00
ba9cf91736 Cleanup: spelling 2021-05-21 01:06:20 +02:00
695fa3a4a1 Merge branch 'blender-v2.93-release' 2021-05-20 20:48:44 +02:00
1400fdf558 Fix petty comment.
I'm embarrassed this was in our codebase for 18 years
2021-05-20 12:38:01 -06:00
ef04fd9571 GPencil: Fix missing annotations in VSE strip
Since version 2.80, the annotations of the Scene strip were not displayed in VSE. Also, the UI panel was`Grease Pencil` and must be `Annotation`

The problem was the offscreen render hasn't evil_CTX and the section of the annotation was never called.

Differential Revision: https://developer.blender.org/D11329
2021-05-20 20:16:59 +02:00
677909cdc3 Merge branch 'blender-v2.93-release' into master 2021-05-20 21:58:34 +05:30
9fef934530 Merge branch 'blender-v2.93-release' 2021-05-20 12:20:05 -04:00
cd16123761 GPencil: Adding length modifier.
Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D8264
2021-05-20 23:35:53 +08:00
933999db75 Cleanup: rename incorrectly named experimental feature flag
The `WITH_GEOMETRY_NODES` flag does not make sense anymore,
it is just protecting the `Simulation` data block that is not used
currently.
2021-05-20 14:39:30 +02:00
0745afeddb Merge remote-tracking branch 'origin/blender-v2.93-release' 2021-05-20 13:00:07 +02:00
3e3ecc329c Geometry Nodes: new Material input node
This node is similar to the Value and Vector node.
It just provides a way to use the same material in multiple nodes
without exposing it outside of a node group.

Differential Revision: https://developer.blender.org/D11305
2021-05-20 12:29:06 +02:00
f41a753e75 Geometry Nodes: new Material Assign node
This adds a new Material Assign node. It can be used to change the
material used by an existing mesh or to assign a material to a mesh
that has been generated from scratch.

Differential Revision: https://developer.blender.org/D11155
2021-05-20 12:22:13 +02:00
f3a0267016 Materials: support materials when applying modifier
This fixes the `Apply Modifier` and `Visual Geometry to Mesh` operator
when a modifier changed materials on the evaluated geometry.

This is necessary since rB1a81d268a19f2f1402f408ad1dadf92c7a399607.

Differential Revision: https://developer.blender.org/D11303
2021-05-20 12:15:57 +02:00
b51bd859fd Fix: wrong rna pointer for material slot
This was missing from rB1a81d268a19f2f1402f408ad1dadf92c7a399607.
2021-05-20 12:14:31 +02:00
b084b57fbf Geometry Nodes: new geometry nodes evaluator
The old geometry nodes evaluator was quite basic and missed many features.
It was useful to get the geometry nodes project started. However, nowadays
we run into its limitations from time to time.

The new evaluator is more complex, but comes with new capabilities.
The two most important capabilities are that it can now execute nodes in
parallel and it supports lazy evaluation.

The performance improvement by multi-threading depends a lot on the specific
node tree. In our demo files, the speedup is measurable but not huge. This
is mainly because they are bottlenecked by one or two nodes that have to be
executed one after the other (often the Boolean or Attribute Proximity nodes)
or because the bottleneck is multi-threaded already (often openvdb nodes).

Lazy evaluation of inputs is only supported by the Switch node for now.
Previously, geometry nodes would always compute both inputs and then just
discard the one that is not used. Now, only the input that is required
is computed.

For some more details read D11191, T87620 and the in-code documentation.

Differential Revision: https://developer.blender.org/D11191
2021-05-20 11:35:13 +02:00
44e7192745 Cleanup: spelling 2021-05-20 17:55:35 +10:00
a5ac062c51 Cleanup: inconsistent parameter names 2021-05-20 09:00:42 +02:00
7655cc45eb VSE: Fix select strips at current frame feature
This feature of `select_side_of_frame` was disabled by removing option
from operator property enum but functional code was never removed.

Add back option to use this feature.

Feature was disabled due to keymap issue. Currently this feature doesn't
have keymap assigned.
2021-05-20 05:06:32 +02:00
acba8f617b Cleanup: Remove unused define
References to `SEQ_CACHE_COST_MAX` were removed in 38b77ef8b2.
2021-05-20 04:25:56 +02:00
47e88345a1 VSE: Fix animation duplication in split operator
Due to misunderstanding of how strip duplication works, animation data
was duplicated on all strips when any strip was split.

`SEQ_sequence_base_dupli_recursive()` duplicated data on strip that was
being split, and `SEQ_ensure_unique_name()` duplicated animation on all
strips.

Only duplication should be done with `SEQ_ensure_unique_name()` and only
on right side split strips, because only these strips are duplicated.
2021-05-20 01:27:12 +02:00
d1c9a99c07 Splines: Optimize interpolation in special case virtual array
When the input data is a virtual array for a single value, we don't need
to run any of the interpolation, instead just copy the input data.
2021-05-19 17:17:16 -04:00
0b7744f4da VSE: Fix rendering inconsistency
Fix issue described in T87678, which was partially a bug and partially
change in intended(at least as far as I can tell) behaior.

Function `evaluate_seq_frame_gen` that was partially responsible for
filtering strips in stack for rendering wasn't working correctly.
Intended functionality seems to be removing all effect inputs from stack
as it is unlikely that user would want these to be blended in. However
there was logic to exclude effects placed into same input, which because
of weak implementation caused, that any effect input, that is effect as
well will be considered to be part of stack to be blended in.
This bug was apparently used to produce effects like glow over original
image.

Even though this is originally unintended, I have kept this logic, but
I have made it explicit.

Another change is request made in T87678 to make it possible to keep
effect inputs as part of stack when they are placed above the effect,
which would imply that blending is intended. This change is again
explicitly defined.

Whole implementation has been refactored, so logic is consolidated
and code should be as explicit as possible and more readable.
`must_render_strip function` may be still quite hard to read, not sure
if I can make it nicer.

Last change is for remove gaps feature code - it used same rendering
code, which may be reason why its logic was split in first place.
Now it uses sequencer iterator, which will definitely be faster than
original code, but I could have used `LISTBASE_FOREACH` in this case.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11301
2021-05-19 22:59:33 +02:00
97cf2a9fb1 VSE: Refactor sorting functions
Recently `SEQ_sort()` function was split so functionality is provided
on per-seqbase basis. After discussion about this split, it turned out,
that per-seqbase operation is only that should be provided, because
RNA API functions need to be able to access arbitrary seqbase

Remove recently introduced function `seq_sort_seqbase` and change
`SEQ_sort` function to operate on seqbase.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11297
2021-05-19 22:52:57 +02:00
58893eaef8 Cleanup: Use consistent order for functions in node files
After this commit, all geometry node "init" and "update" functions are
at the top of each file, right below the "layout" function. This means
you can always scroll to the bottom of the file to see the entry point,
and the boring boilerplate code is grouped in one section.
2021-05-19 16:13:05 -04:00
3d604ba867 Geometry Nodes: Execute point rotate node on curve component
When adding attributes on the curve component, I missed calling this
node's execute function on the curve component, like the other nodes.
2021-05-19 15:58:34 -04:00
627f357127 Geometry Nodes: Support for dynamic attributes on curve splines
With this patch you will be able to add and remove attributes from curve
data inside of geometry nodes. The following is currently implemented:
* Adding attributes with any data type to splines or spline points.
* Support for working with multiple splines at the same time.
* Interaction with the three builtin point attributes.
* Resampling attributes in the resample node.

The following is not implemented in this patch:
* Joining attributes when joining splines with the join geometry node.
* Domain interpolation between spline and point domains.
* More efficient ways to call attribute operations once per spline.

Differential Revision: https://developer.blender.org/D11251
2021-05-19 13:22:09 -04:00
192a3f1a05 Cleanup: Use copy constructor for CurveEval
There is no need for a special "copy" method with a copy constructor,
which will be necessary to explicitly copy attributes anyway.
2021-05-19 13:02:53 -04:00
Severin
330fecc9b7 Assets: Use textures (and shadows) for automatic object previews
Textures may be important to be able to identify an object. They are also a way
to make many objects look more like when rendered with an advanced render
engine, without being that expensive.
So this seems like a simple way to increase usefulness of the automatic
previews.
2021-05-19 17:57:51 +02:00
857f39a3d7 GPencil: Apply NanoSVG fix
This fix is ported from official NanoSVG git
2021-05-19 17:56:26 +02:00
23b642cbb4 IDManagement: Enable ID sorting test for linked IDs. 2021-05-19 17:50:22 +02:00
ca74ebc96e IDManagement: Do not prevent sorting of linked IDs in BKE_id_new_name_validate.
While this function should (currently) not be called on linked ID, there
is no reason to treat those differently than local IDs, for the part
that they have in common: needs to be properly sorted.
2021-05-19 17:50:22 +02:00
3620dbbe97 IDManagement: Fix ID sorting in case of linked IDs.
`id_sort_by_name` would simply not deal properly with linked IDs, could
lead to mixing IDs from different libraries, and unsorted IDs within the
same library.
2021-05-19 17:50:22 +02:00
c810672ea7 IDManagement: Add basic test regarding id sorting in their listbase.
Note that while sorting of local IDs is fine, currently sorting of
linked IDs is a total unpredictable failure.

Next commit will fix this, ensuring that linked IDs are grouped by their
library, and properly name-sorted within this library group.
2021-05-19 17:50:22 +02:00
ee5ad46a0e Fix T87621: Win32 Do Not Create Preview Thumbnails for Offline Files
This patch turns off the creation of file thumbnails for files that are
offline and therefore not fully-present on the file system. These types
of files - typically cloud-based or stored on slower backup media -
only have their contents available when actually accessed, at which
point there will be a short delay. If we allow thumbnail creation in
this state then all offline files in a folder will be downloaded just
to view a listing, which can take a long time.

Files in this state will instead get a more generic thumbnail that
still indicates file type (icon in center) and that shows offline state
will a special icon at the bottom-left.

Although this currently only affects Windows users, most of this patch
is platform-agnostic. So other platforms inherit this behavior if they
only add FILE_ATTR_OFFLINE attribute to files in this state.

See D11101 for more information.

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

Reviewed by Julian Eisel
2021-05-19 08:40:00 -07:00
0fa4286ade Blender LTS: match download urls with latest changes in buildbot. 2021-05-19 16:39:22 +02:00
38450fc916 Merge branch 'blender-v2.93-release' 2021-05-19 13:58:16 +02:00
afb66b3c3a Cleanup: use nullptr 2021-05-19 13:04:12 +02:00
c5a898bcac Merge branch 'blender-v2.93-release' 2021-05-19 12:32:06 +02:00
81e3d904db Merge branch 'blender-v2.93-release' 2021-05-19 12:17:23 +02:00
7adb415070 Geometry Nodes: don't show grease pencil materials for now
Those materials cannot be on geometry handled by geometry nodes yet.
So it makes sense not to show those materials in the material socket.
2021-05-19 11:44:10 +02:00
5e6f3b8564 Geometry Nodes: take materials into account when joining geometries
Materials are now kept intact when using the Join Geometry node
or when realizing instaces.
2021-05-19 11:02:25 +02:00
02b80276b3 Fix issue in previous commit
When `PointerRNA->data` was null, it was interpreted as being
`None` in Python. This caused the materials slots to not show
correctly in the ui.
2021-05-19 10:51:36 +02:00
1a81d268a1 Materials: support changing materials during evaluation
This commit allows that the evaluated geometry of an object has
different materials from the original geometry. This is needed
for geometry nodes.

The main thing that changes for render engines and exporters
is that the number of material slots on an object and its geometry
might not match anymore. For original data, the slot counts are
still equal, but not for evaluated data.

Accessing material slots though rna stays the same. The behavior
adapts automatically depending on whether the object is evaluated.

When accessing materials of an object through `BKE_object_material_*`
one has to use a new api for evaluated objects:
`BKE_object_material_get_eval` and `BKE_object_material_count_eval`.
In the future, the different behavior might be hidden behind a more
general C api, but that would require quite a few more changes.

The ground truth for the number of materials is the number of materials
on the geometry now. This is important in the current design, because
Eevee needs to know the number of materials just based on the mesh in
`mesh_render_mat_len_get` and similar places.

In a few places I had to add a special case for mesh edit mode to get it
to work properly. This is unfortunate, but I don't see a way around that
for now.

Differential Revision: https://developer.blender.org/D11236
2021-05-19 10:23:09 +02:00
d373b43f07 VSE: Better handling of effect strip splitting
Splitting of effect strip alone wasn't handled properly. Previously
this resulted in duplicating effect strip, and it was broken at least
from 2.79.

Change in rB8ec6b34b8eb2 was intended to allow splitting strips
individually, so it can be used as RNA API function but also so it
requires as little glue logic as possible.

This is fixed by splitting all dependent strips at once in 2 separate
ListBases for left and right strips. Strips can be finally moved into
original `ListBase`.

With this fix it is still possible to split strips individually with
little glue logic. RNA API function could return list of split strips
as well, currently at least one strip in chain will be provided so
chain can be reconstructed on python side.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10209
2021-05-18 23:41:47 +02:00
f7a14c116c VSE: Move whole strip chain to meta
Python API function Sequence.move_to_meta() did delete effect chain
when strip with effects was moved.

Use iterator API to query effect strips and move whole chain to meta.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11206
2021-05-18 23:41:47 +02:00
748b5f025d Merge branch 'blender-v2.93-release' 2021-05-18 22:37:38 +02:00
5400be9ffe Fix T88313: GPencil reproject operator projecting on the wrong surface
`ray_start` must start at the position of the gpencil point.
2021-05-18 17:31:10 -03:00
f9567f6c63 Alembic: read/write generated coordinates of meshes
Read and write generated coordinates (also known as "original
coordinates", "reference coordinates", or "orcos") from and to Alembic.
A custom geometry property named "Pref" is used for (hopefully)
interoperability with Maya and Houdini. For now it's only guaranteed for
Blender-to-Blender.

Export: writing generated coordinates is optional (on by default).

Import: generated coordinates are always read whenever the reading of
vertex data is enabled.

Manifest Task: T88081
2021-05-18 19:01:57 +02:00
a881b5272b Fix ID copying outside of Main affecting 'directly linked' status of other IDs.
Copying an ID outside of BMain should not assume that the datablocks it
uses are now directly linked. This would be wrong e.g. in case that new
no-main ID is copied from a linked data-block and is supposed to remain
a linked data.
2021-05-18 18:44:39 +02:00
3826c161ad Cleanup: typo in comment. 2021-05-18 18:44:39 +02:00
019ab774d4 Merge branch 'blender-v2.93-release' 2021-05-18 16:17:29 +02:00
7aa7cc4ca1 Merge branch 'blender-v2.93-release' 2021-05-18 15:43:06 +02:00
2b660e825b Fix T88365: GPUTexture.read returning a buffer with wrong size
The pixel components were not being considered.
2021-05-18 10:01:29 -03:00
ea7b00c64f Fix T88345: Blender crash on GPUFrameBuffer creation
Misuse of indexes.

`color_attachements` has only color ones while `config` has color and depth.
2021-05-18 09:39:31 -03:00
4402c3006b WM: check missing space-data & constraints in poll functions
Without this, menu search prints many errors in some contexts.
2021-05-18 20:57:40 +10:00
eaf3160f13 Merge branch 'blender-v2.93-release' 2021-05-18 12:52:29 +02:00
f4eae747f9 Tests: Remove threshold param from physics ocean mesh test
This was not the reason for the test failure on macOS arm64.
2021-05-18 12:44:53 +02:00
1f9eb7e2c6 Merge branch 'blender-v2.93-release' 2021-05-18 19:59:20 +10:00
97f1e4782a Cycles: Avoid unnecessary data updates in viewport
The BlenderSync will do quite a bit of work on every sync_data() call
even if there is nothing changed in the scene. There will be early
outputs done deeper in the call graph, but this is not really enough to
ensure best performance during viewport navigation.

This change makes it so sync_data() is only used when dependency graph
has any update tags: if something changed in the scene the dependency
graph will know it. If nothing changed there will be no IDs tagged for an
update in the dependency graph.

There are two weak parts in the current change:

- With the persistent data there is a special call to ignore the check
  of the dependency graph tags. This is more of a safety, because it is
  not immediately clear what the correct state of recalc flags is.

- Deletion of objects is detected indirectly, via tags of scene and
  collections.

It might not be bad for the first version of the change.

The test file used: {F10117322}

Simply open the file, start viewport render, and navigate the viewport.
On my computer this avoids 0.2sec spend on data_sync() on every
up[date of viewport navigation.

We can do way more granular updates in the future: for example, avoid
heavy objects sync when it is only camera object which changed. This
will need an extended support from the dependency graph API. Doing
nothing if nothing is changed is something we would want to do anyway.

Differential Revision: https://developer.blender.org/D11279
2021-05-18 10:13:09 +02:00
1c1fa15ce1 Merge branch 'blender-v2.93-release' 2021-05-18 17:48:14 +10:00
8a26fec6ea Cleanup: use const casts in mathutils API 2021-05-18 14:16:34 +10:00
4dfbaa34c9 PyAPI: allow any vector sequence for poly_3d_calc(..)
Previously only vectors were accepted for the second point argument:
mathutils.interpolate.poly_3d_calc()
2021-05-18 14:16:34 +10:00
5e67dcf3d2 Cleanup: format 2021-05-18 06:09:46 +02:00
52e53d61f5 Merge branch 'blender-v2.93-release' 2021-05-18 13:39:39 +10:00
8057b98572 Alembic procedural: fix wrong property used as base for attribute
lookups

We use the schema so that we can access top level attributes as well.
This is already done for polygon meshes and curves, so this only
modifies the behavior for subdivision objects.
2021-05-18 00:59:29 +02:00
38fe8d8b38 Alembic procedural: fix crash accessing invalid ICompoundProperties
Although it is not a pointer, accessing an ICompoundProperty
dereferences a pointer under the hood, so check for validity.
2021-05-18 00:56:45 +02:00
73080ddf38 Add comment regarding Fade Inactive Geometry property in overlays popover
Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D11249
2021-05-18 00:51:35 +02:00
f96a0f384d Merge branch 'blender-v2.93-release' 2021-05-18 00:32:48 +02:00
c17433bb55 Tests: Increased threshold param for physics_ocean test
Adjusting threshold to see what the buildbot will make of this.
2021-05-17 23:21:16 +02:00
c9afea5bbf Tests: Added threshold to physics ocean mesh test
The physics_ocean test is currently failing on macOS arm.
This is one attempt to fix this issue.
2021-05-17 21:13:35 +02:00
43046d82b7 Collada import: use black for Base Color when missing <diffuse>
Treat a missing <diffuse> the same as a black diffuse color.

The easiest way to see this bug is with a Collada shader like

```
          <constant>
            <emission>
              <color sid="emission">1 0 0 1</color>
            </emission>
          </constant>
```

The Collada spec says this should be just

```
color = <emission>
```

ie. red everywhere. The importer slots the red into the Principled Emission socket, but since it leaves the Base Color as the default off-white, this is added to red, and the material looks white-pink in the light and red only in the shadows.

Putting black in the Base Color makes it look red everywhere.

D10939 will also eliminate the much-less-noticeable specular term for this case.

Reviewed By: gaiaclary

Differential Revision: https://developer.blender.org/D10941
2021-05-17 21:10:05 +02:00
542b8da831 Merge branch 'blender-v2.93-release' 2021-05-17 20:18:39 +02:00
1b0ecb2f89 refactor: minor changes to previous commit
- rename boolean is_zero by more descriptive has_specularity
- add some clarifying comments (and TODO)
2021-05-17 20:04:56 +02:00
Scurest
1a4e7b16b2 Collada import: respect zero-specularity
Collada shaders with black <specular> should import with Specular=0.
(A missing <specular> is the same as black.)

The general specular conversion is hard, but this case is common and easy.
Fixes the specular for all <constant>/<lambert> shaders, and <blinn>/<phong>
shaders with black/omitted <specular>. Before this they all looked too "shiny".

Reviewed By: gaiaclary

Differential Revision: https://developer.blender.org/D10939
2021-05-17 19:56:01 +02:00
a86e815dd8 Mathutils: add a Matrix.LocRotScale constructor for combining channels.
Combining location, rotation and scale channels into a matrix is
a standard task, so while it is easily accomplished by constructing
and multiplying 3 matrices, having a standard utility allows for
more clear code.

The new constructor builds a 4x4 matrix from separate location,
rotation and scale values. Rotation can be represented as a 3x3
Matrix, Quaternion or Euler value, while the other two inputs
are vectors. Unneeded inputs can be replaced with None.

Differential Revision: https://developer.blender.org/D11264
2021-05-17 19:12:40 +03:00
f09606cc68 File List: micro optimization in the icon preview
No real functional changes.

When `i` is zero, `filelist_cache_previews_push` was called twice with
the same icon.

This caused the preview to be computed twice when only once is needed.
2021-05-17 09:09:12 -03:00
6cfa8531cc Cleanup: reduce indentation in filelist_cache_previews_push 2021-05-17 08:54:53 -03:00
50eceb2a37 Merge branch 'blender-v2.93-release' 2021-05-17 13:06:59 +02:00
Wannes Malfait
ba698f0812 Geometry Nodes: update callbacks with 2 new socket types 2021-05-17 11:11:25 +02:00
7e552b356d Merge branch 'blender-v2.93-release' 2021-05-17 18:04:22 +10:00
Henrik Dick
e95f71bf15 UI: use non-linear sliders
* Boolean Modifier > Fast > Overlap Threshold (Logarithmic).
* Remesh Modifier > Voxel > Voxel Size (Logarithmic).
* Sculpt > Dyntopo > Detail Size (Cubic).

Ref D9074
2021-05-17 17:33:59 +10:00
Henrik Dick
0447aedb96 UI: add non-linear slider support
This patch introduces non linear sliders. That means, that the movement
of the mouse doesn't map linearly to the value of the slider.

The following changes have been made.

- Free logarithmic sliders with maximum range of (`0 <= x < inf`)
- Logarithmic sliders with correct value indication bar.
- Free cubic sliders with maximum range of (`-inf < x < inf`)
- Cubic sliders with correct value indication bar.

Cubic mapping has been added as well, because it's used for brush sizes
in other applications (Krita for e.g.).

To make a slider have a different scale type use following line in RNA:
 `RNA_def_property_ui_scale_type(prop, PROP_SCALE_LOGARITHMIC);`
or:
 `RNA_def_property_ui_scale_type(prop, PROP_SCALE_CUBIC);`

Test the precision, step size and soft-min if you change the scale type
of a property as it will feel very different and may need tweaking.

Ref D9074
2021-05-17 17:33:55 +10:00
45863059f7 Cleanup: remove commented code, use function to access header region 2021-05-17 15:55:00 +10:00
67c40cc51c Cleanup: missing declaration warning 2021-05-17 15:22:19 +10:00
27c0d29138 Cleanup: clang-format 2021-05-17 15:12:41 +10:00
6a771175b6 Cleanup: Fix missing-braces warning on Linux / GCC 2021-05-17 15:05:14 +10:00
0e581f6196 Cleanup: Fix missing-braces warning on macOS Clang 2021-05-16 11:19:21 +05:30
49cb30bb0c Cleanup: Fix inconsistent-missing-override warning
macOS Clang
2021-05-16 11:19:04 +05:30
9dabb342ba Cleanup: Improve comments 2021-05-15 18:00:20 -05:00
4da16a0707 Cleanup: Use helper function
Use the `CurveEval` function introduced in the last commit.
2021-05-15 17:50:29 -05:00
038c6e229c Splines: Convenience methods for point offsets of multiple splines
Since spline data is stored separately for each spline, the data often
needs to be flattened into a separate array. It's helpful to have the
necessarily-sequential part of that split off into a separate method.
I've found myself using functions like these in quite a few places.
2021-05-15 17:44:33 -05:00
cb12fb78ca XR Controller Support Step 1: Internal Abstractions for OpenXR Actions
Adds internal API for creating and managing OpenXR actions at the
GHOST and WM layers. Does not bring about any changes for users since
XR action functionality is not yet exposed in the Python API (will be
added in a subsequent patch).

OpenXR actions are a means to communicate with XR input devices and
can be used to retrieve button/pose states or apply haptic feedback.
Actions are bound to device inputs via a semantic path binding
(https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-interaction-profiles),
which serves as an XR version of keymaps.

Main features:

- Abstraction of OpenXR action management functions to GHOST-XR,
  WM-XR APIs.
- New "xr_session_start_pre" callback for creating actions at
  appropriate point in the XR session.
- Creation of name-identifiable action sets/actions.
- Binding of actions to controller inputs.
- Acquisition of controller button states.
- Acquisition of controller poses.
- Application of controller haptic feedback.
- Carefully designed error handling and useful error reporting
  (e.g. action set/action name included in error message).

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D10942
2021-05-16 03:36:31 +09:00
3e6609a0dc Cleanup: silence unused parameter warnings
Introduced in rB48fa029dd11b.
2021-05-15 14:13:22 -03:00
a56cc26b48 Merge branch 'blender-v2.93-release' 2021-05-15 18:34:28 +02:00
c2ee7ab2e3 Merge branch 'blender-v2.93-release' 2021-05-15 17:52:26 +02:00
6e8685e1fd GPencil: Add parameter removed by error in previous commit
This fix the compiler warning too.
2021-05-15 15:53:58 +02:00
65997a058f Merge branch 'blender-v2.93-release' 2021-05-15 02:55:25 +02:00
ccb22740c1 Merge branch 'blender-v2.93-release' 2021-05-15 02:34:47 +02:00
3458d09a74 Merge branch 'blender-v2.93-release' 2021-05-15 02:06:02 +02:00
158e353ece Remove rna_ prefix from function names 2021-05-14 17:41:45 -05:00
b4b8be0d2e Simplify arg parsing of rna_subtype and description 2021-05-14 17:39:48 -05:00
30c424481c Fix missing comma in doc string 2021-05-14 17:29:20 -05:00
a9484fa797 Cleanup: Use BLI_assert_unreachable() 2021-05-14 17:28:46 -05:00
7576dcfaa4 Correct return type in doc string 2021-05-14 16:41:09 -05:00
3480934ff4 Merge branch 'master' into refactor-idprop-ui-data 2021-05-14 16:39:42 -05:00
e7e183aa2b Cleanup: Update / improve comments 2021-05-14 16:37:05 -05:00
3c978a73d1 Docs: PyAPI: Replace use of the bgl module in the RenderEngine example
The bgl module will be discontinued.

This example is seen at:
https://docs.blender.org/api/current/bpy.types.RenderEngine.html uses it.

Differential Revision: https://developer.blender.org/D11262
2021-05-14 18:29:23 -03:00
782ccbde70 Cleanup: Move attribute code to attribute header
This code in the geometry set header was not directly related to
geometry sets, it makes more sense in the attribute access header.
This makes it clearer that code for geometry components uses attribute
code, rather than the other way around. It also allows adding more
functionality to `BKE_attribute_access.hh` that depends on these things
without including `BKE_geometry_set.hh` there.
2021-05-14 15:53:43 -05:00
db59f0b943 Fix T88262: Curve to mesh crash with vector last segment
The code incorrectly used the size of the second to last segment rather
than the last segment's size. That was a problem when the last segment
is a vector segment but the second to last isn't.

I also used the opportunity to slightly refactor the control point
offsets cache, making it one longer so it also contains information
about the size of the last segment, simplifying other code.
2021-05-14 11:26:42 -05:00
7178e54122 Merge branch 'blender-v2.93-release' 2021-05-14 18:18:24 +02:00
7efe92f63b Merge branch 'blender-v2.93-release'
Conflicts:
	source/blender/editors/object/object_add.c
2021-05-14 18:10:12 +02:00
f6cb9433d4 GPencil: Refactor Append operators
Now the operators work like other areas of Blender using the list of selected objects.

Also, the name has been changed to:

```Layers:
- Copy Layer to Selected
- Copy All Layers to Selected

Materials:
- Copy Material to Selected
- Copy All Materials to Selected```

Reviewed By: mendio, pablovazquez, pepeland

Differential Revision: https://developer.blender.org/D11216
2021-05-14 18:02:04 +02:00
8c80267352 CLOG: Fix memleak in own recent improvement to CLOG filter.
Mistake in rBef5782e29744.
2021-05-14 17:50:55 +02:00
Germano Cavalcante
b11499939c Python GPU: Replace part of the code that uses 'bgl' with 'gpu'
This is part of the process described in T80730.

The aim is to deprecate the bgl module.

Reviewed By: fclem, brecht, campbellbarton

Revision: D11147
2021-05-14 12:26:40 -03:00
Germano Cavalcante
48fa029dd1 Python GPU: New 'platform' module
This module exposes the platform utils defined in the GPU module in C.

This will be useful for porting existing code with `bgl` to `gpu`.

Reviewed By: fclem, brecht, campbellbarton

Maniphest Tasks: T80730

Part of D11147
2021-05-14 12:26:40 -03:00
Germano Cavalcante
3f4f109646 Python GPU: New 'capabilities' module
This module exposes the capabilities defined in the GPU module in C.

This will be useful for porting existing code in `bgl` to `gpu`.

Reviewed By: fclem, brecht, campbellbarton

Maniphest Tasks: T80730

Part of D11147
2021-05-14 12:26:40 -03:00
079f415deb Cleanup: use enum types for screen direction variables
The term direction was used in 3 different ways in screen editing code,
making it hard to follow:

- 0-3 for as magic numbers mapped to [west,north,east,south].
- `h`, `v` characters for [horizontal,vertical] axes.
- Cycle direction SPACE_CONTEXT_CYCLE_PREV, SPACE_CONTEXT_CYCLE_NEXT

The following changes have been made:

- Add `eScreenDir` for [west,north,east,south], use variable name `dir`.
- Add `eScreenAxis` for [horizontal,vertical] values, use variable name
  `dir_axis`.
- Add `eScreenCycle` for existing enum `SPACE_CONTEXT_CYCLE_{PREV/NEXT}`.
- Add macros `SCREEN_DIR_IS_VERTICAL(dir)`,
  `SCREEN_DIR_IS_HORIZONTAL(dir)`.
  Replacing `ELEM(dir, 1, 3)`, `ELEM(dir, 0, 2)`.
- Move `ED_screen_draw_join_highlight`, `ED_screen_draw_split_preview`
  to `screen_intern.h`.

Reviewed By: Severin

Ref D11245
2021-05-15 00:49:49 +10:00
265d97556a PyAPI: use iterators for ID property methods (keys, values & items)
- Matches changes in Python 3.x dictionary methods.

- Iterating now raises a run-time error if the property-group changes
  size during iteration.

- IDPropertyGroup.iteritems() has been removed.

- IDPropertyGroup View & Iterator types have been added.

- Some set functionality from dict_keys/values/items aren't yet
  supported (isdisjoint method and boolean set style operations).

Proposed as part of T85675.
2021-05-15 00:36:49 +10:00
65f9550813 Nodes: fix connecting wrong sockets when inserting node
Differential Revision: https://developer.blender.org/D11231
2021-05-14 16:01:55 +02:00
a4f0780acf Merge branch 'blender-v2.93-release' 2021-05-14 13:45:48 +02:00
bd5bab961e Merge branch 'blender-v2.93-release' 2021-05-14 19:27:30 +10:00
2871fadcad Geometry Nodes: use texture socket in Attribute Sample Texture node
There is a new Texture data-block socket that we can use in Geometry
Nodes now. This commit replaces the texture property of a node and
gives it a texture input socket instead. That increases flexibility.

The texture socket still has some limitations that will be lifted in the
next couple of days (e.g. it's not supported by the switch node and
cannot be exposed the a modifier yet).

Differential Revision: https://developer.blender.org/D11222
2021-05-14 11:23:25 +02:00
a939317862 Cleanup: sort include dirs in CMakeLists.txt
Sort include dirs in just one file, not a big change
(`source/blender/editors/armature/CMakeLists.txt`).

No functional changes.
2021-05-14 11:12:35 +02:00
26b4ef6823 Geometry Nodes: remove some unnecessary updates
This fixes a few "obvious" places where we do unnecessary updates.
Those special cases were added in the early days of geometry nodes
when many updates were missing and we tried to get it to work at all.
There is a fairly high risk that with this change some required updates
will be missing again. Those can be fixed when we find thme.
Some of the update issues might have been fixed by rB58818cba40794905f9323080e60884e090f2d388
and similar changes we added over time.

Differential Revision: https://developer.blender.org/D11238
2021-05-14 11:06:00 +02:00
Christoph Lendenfeld
9797b95f61 Animation: Pose sliding tools improvements
Improve the "In Betweens" tools:
- Push Pose from Rest Pose
- Relax Pose to Rest Pose
- Push Pose from Breakdown
- Relax Pose to Breakdown
- Pose Breakdowner

These all now use the same new sliding tool:
- Actual visual indication of the blending/pushing percentage applied.
- Mouse wrapping to allow for extrapolation without having to worry
  about the initial placement of the mouse. This also means these tools
  are actually usable when chosen from the menu.
- Precision mode by holding {key Shift}.
- Snapping to 10% increments by holding {key Ctrl}.
- Overshoot protection; by default the tool doesn't allow overshoot
  (lower than 0% or higher than 100%), and it can be enabled by pressing
  {key E}.
- Bones are hidden while sliding, so the pose itself can be seen more
  clearly. This can be toggled by pressing {key H} while using the tool.

Reviewed By: #animation_rigging, zeddb, sybren, #user_interface, brecht, Severin, looch

Maniphest Tasks: T81836

Differential Revision: https://developer.blender.org/D9054
2021-05-14 11:00:17 +02:00
a156843112 Cleanup: spelling, rename metas to meta-strips / meta-balls 2021-05-14 17:38:16 +10:00
c1c0b661c0 Cleanup: clang-format 2021-05-14 17:35:08 +10:00
20c3db6604 DrawTest: Make setup method public.
This allows other tests to override it.
2021-05-14 08:34:13 +02:00
55b9b1ff50 Draw: Put DrawTest in its own compile unit.
DrawTest will be used by other tests as well.
2021-05-14 07:55:01 +02:00
bd76184966 Fix sculpt neighbor iterator not taking visibility into account
Sculpting tools are designed to ignore hidden geometry and behave like
hidden geometry does not exist.
When getting the neighbors of a vertex, now this takes into account
hidden geometry to avoid returing neighbors which connected edge is not
visible. This should make corner cases of a lot of tools work properly,
especially when working in low poly meshes when is common to have a
single face loop hidden.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D11007
2021-05-14 03:08:01 +02:00
01718ad952 Merge branch 'blender-v2.93-release' 2021-05-14 02:42:19 +02:00
Pablo Dobarro
d70cfb90e0 Fix Sculpt tools showing the cursor of the previous active brush
When using a tool that is not a brush, the previously used brush
preset will still be active in the tool settings, so the cursor will
draw its custom reviews.
This checks if the current active tool is a brush before drawing its
previews. If it is not a brush tools, it draws a default white cursor.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9418
2021-05-14 00:56:13 +02:00
01a614c699 Fix build after last commit
Part of a rename change in rBc5d38a2be8 was lost when committing.
2021-05-13 17:52:30 -05:00
c5d38a2be8 Functions: Expose set_all method for generic virtual arrays
This is very similar to rB5613c61275fe6 and rB0061150e4c90d, basically
just exposing a `VMutableArray` method to its generic counterpart. This
is quite important for curve point attributes to avoid a lookup for
every point when there are multiple splines.
2021-05-13 17:47:46 -05:00
88aee2986f Cleanup: Clang format 2021-05-13 17:37:51 -05:00
Scurest
2953732fc5 Collada import: connect Emission texture to Emission socket
An emission texture is currently connected to the Base Color socket. It should connect to the Emission socket, like a constant does.

Reviewed By: gaiaclary

Differential Revision: https://developer.blender.org/D10990
2021-05-13 23:43:37 +02:00
d889e9684a Merge branch 'blender-v2.93-release' 2021-05-13 23:07:05 +02:00
b90fec5d46 BLI: simplify supporting heterogeneous lookup for new types
Heterogeneous lookup is useful when constructing a key in a
map/set is relatively expensive (e.g. `std::string`). When doing
lookups in the map/set, one usually does not want to construct
the type to avoid overhead. Instead, heterogeneous lookup
allows for using a different type (such as `StringRef`) as key.

This change makes it easier to implement heterogeneous
lookup for custom types. Before, one had to specialize
`blender::DefaultHash`. Now, one just has to implement
a `static uint64_t hash_as(value)` on the type itself.
One still has to provide the equality operator in addition
to the hash function of course.
2021-05-13 14:14:14 +02:00
23a788b8bd Modifiers: allow usage of tbb
Before, any usage of tbb wrappers used in modifier code would
just fall back to the non-threaded non-tbb version.

We ran into this issue a couple of times in patches.
2021-05-13 13:45:05 +02:00
64f1d5e7c1 Nodes: add utility method to get input/output of a DNode
This is a fairly common operation, so there should be a method
that does it to avoid unnecessary complexity at the caller site.
2021-05-13 13:42:38 +02:00
d288eeb79a BLI: support looking up a key stored in Map or VectorSet
Sometimes it is useful to find the key that compares equal
to a known key. Typically that happens when the key itself
has additional data attached that is not part of its hash.

Note that the returned key reference/pointer is const, because
the caller must not change the key in a way that changes its
hash or how it compares to other keys.
2021-05-13 13:39:23 +02:00
522868001c Functions: simplify adding a single input to a multi-function
This is used by the upcoming new geometry nodes evaluator.
2021-05-13 13:23:53 +02:00
8b87fc1c77 BLI: add initial wrapper for tbb::enumerable_thread_specific
The wrapper is necessary to support building without TBB.
This class is used by the upcoming new evaluator for
geometry nodes.
2021-05-13 13:20:16 +02:00
2fb0eeb707 Nodes: ignore unavailable sockets in logically linked sockets iterator
Unavailable sockets should generally be ignored during evaluation.
They mainly exist because we don't have a better mechanism to turn
some sockets on/off depending on node parameters.

Currently, it is still possible that a link connects an available with an
unavailable socket. This link is not displayed in the ui and should
generally be ignored.
2021-05-13 13:11:28 +02:00
777ba780a6 Cleanup: inconsistent parameter name 2021-05-13 13:06:42 +02:00
d4bca00a47 Cleanup: missing override 2021-05-13 13:06:28 +02:00
6b33dafb64 Geometry Nodes: add mutex for node ui storage
Previously, multiple threads adding information to node ui storage
at the same time resulted in memory corruption. The lock prevents
that, but might potentially become a bottleneck in the future.
For now favour correctness over a potential performance bottleneck.
2021-05-13 13:06:09 +02:00
250a5442cf BLI: add LinearAllocator.construct_array method
Previously, one could allocate an array, but not construct its
elements directly. This method just adds some convenience.
2021-05-13 12:58:02 +02:00
df07188750 Cleanup: use boolean argument 2021-05-13 12:44:58 +10:00
bddc987ba3 Cleanup: clang format 2021-05-13 12:44:28 +10:00
f1ecbf26b7 UI: Use term 'Preferences' instead of 'User Prefs'
'Preferences' is the term used elsewhere in Blender so this commit makes 
the option more consistent.

In the future, the "default" target could be changed to something more 
descriptive.
2021-05-12 21:10:17 -04:00
a5d2c19a5c PyAPI Docs: Cleanup Formatting 2021-05-12 21:10:17 -04:00
06e62adfb8 UI: Improved "Area Close" Neighbor Selection
The new "Close Area" operator can let any neighbor replace the area to
be closed. This patch improves the selection of the best, and most-
aligned, neighbor.  It maximizes the ratio of the shared edge lengths,
rather than minimize the absolute amount of misalignment. This follows
our expectations closer because it takes into account the relative
sizes of the areas and their edges.

see D11143 for details and examples.

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

Reviewed by Campbell Barton
2021-05-12 16:52:43 -07:00
fa472d46fc Merge branch 'blender-v2.93-release' 2021-05-12 20:25:16 +02:00
1a94ae9e47 Cleanup: Simplify public/private specifiers
By rearranging a few variables we can remove redundant specifiers
2021-05-12 11:50:35 -05:00
50bf033d3f Cleanup: Splines: Add accessors to spline vector
Not allowing external direct access to the vector of splines in the
curve will help for things like reallocating custom data when a spline
is added or removed.
2021-05-12 11:46:13 -05:00
3ef01692c8 UI: Colors for Texture/Material node sockets and small tweaks
* Set colors for the new texture and material sockets
  * Material uses the same color used for shading icons
  * Texture uses a plum color desaturated enough to not be confused with Vector's violet
* Image socket adjusted to be closer to Texture sockets but darker
* Integer socket toned down in saturation to not stand out so much
  (and be closer to float sockets which are gray)

Making this change now during bcon1 to gather feedback from the community,
and because Geometry Nodes needs to use the new texture/material sockets.
2021-05-12 18:00:03 +02:00
1892b131ed Geometry Nodes Curves: Expose first builtin point attributes
This commit exposes the first spline control point attributes. The
implementation incorporates the attributes into the virtual array
system, providing efficient methods to flatten the data into a
contiguous array and to apply changes from a flattened array. This
is only part of the eventual goal, which includes changes to run
attribute nodes separately for each spline to completely avoid copying.

So far `tilt` and `radius`, the two generic attributes common to
all spline types, are implemented. The more complex `position`
attribute is also added. It requires some special handling for Bezier
splines, where the control point handles need to be moved along with
the control points. To make that work I also added automatic handle
recalculation to the Bezier spline.

Differential Revision: https://developer.blender.org/D11187
2021-05-12 10:21:32 -05:00
8dc95f61f3 Merge branch 'blender-v2.93-release' 2021-05-12 22:20:51 +10:00
ead084b6e1 PyAPI: remove deprecated & unused BMesh.from_object deform argument
Ref T85675
2021-05-12 22:04:06 +10:00
44db4e50b2 PyAPI: remove context.active_base
All other access to the Base structure from Python was removed,
it seems this was left in by accident.

Ref T85675
2021-05-12 22:02:18 +10:00
aaa07a3a8f PyAPI: remove deprecated 'wiki_url' for add-ons 'bl_info'
This was only kept for compatibility with older add-ons and has been
deprecated since 2.83.

Ref T85675
2021-05-12 22:02:12 +10:00
bf23083852 Cleanup: use our own code style for doxy-gen comment blocks 2021-05-12 21:58:25 +10:00
3836d10faf Builder: updated download urls with upcoming naming scheme. 2021-05-12 13:17:06 +02:00
21bed44001 Fix custom bone shape scale affecting normal bone display
Also some clang-format changes.
2021-05-12 12:56:43 +02:00
2074729308 Nodes: add boilerplate for texture and material sockets
The sockets are not exposed in any nodes yet.
They work similar to the Object/Collection sockets, which also
just reference a data block.

This is part of D11222.
2021-05-12 12:41:30 +02:00
a43a455fdd Merge branch 'blender-v2.93-release' 2021-05-12 11:18:43 +01:00
2e750a42a1 Merge branch 'blender-v2.93-release' 2021-05-12 10:16:01 +02:00
93b7c9595b Merge branch 'blender-v2.93-release' 2021-05-12 10:01:14 +02:00
0d21228dce Cleanup: rename 'rt' to '_pad#' in DNA structs 2021-05-12 16:44:59 +10:00
193425ce1d Cycles: fix inconsistent-missing-override warnings
LLVM Clang 13, macOS.

Reviewed By: brecht
Differential Revision: https://developer.blender.org/D11207
2021-05-12 10:27:37 +05:30
9a6fd69993 Fix T87947: Trasnform: Keyboard input uses view orientation
When activated in modal, `translate`, `resize`, `rotate`, `shear` and
`edge_rotate_normal` use a different orientation than the set in scene.

This orientation needed to match since some of these modes can be switched
during operation.

The default orientation for these modes was `V3D_ORIENT_VIEW`.

And this changed when finishing the `translate` and `resize` to
`V3D_ORIENT_GLOBAL`.

But this could cause inconsistencies when inputting values from the
keyboard.

The solution now is to change the orientation when you change the mode.

---
Note: Although the user can expect the value entered to reflect the
orientation set in the scene, it would require a lot of changes and would
not be really useful.
2021-05-11 23:45:55 -03:00
cb385a117b Cleanup: Use enum to indicate the current orientation
Improves readability.
2021-05-11 23:44:50 -03:00
Wayde Moss
cbeeca8167 NLA: Extract ..get_inverted_upper_snapshot()
Extracts `nlasnapshot_blend_get_inverted_upper_snapshot()` from
`BKE_animsys_nla_remap_keyframe_values()`

This introduces a new struct member:
`NlaEvalChannelSnapshot->remap_domain` and marks which values of
`blended_snapshot` are processed for remapping/used-for-inverting.
Effectively, it marks which values have successfully been remapped and
can be further used for remapping.

`nlasnapshot_blend_get_inverted_upper_snapshot()`:
output snapshot `r_upper_snapshot` has each channel's `remap_domain`
written to which effectively marks the successfully remapped values.
The only reason a value is not in the remap domain is if inversion
failed or it wasn't marked to be remapped.

`..get_inverted_upper_snapshot()` has a variant `nlasnapshot_blend()`
from {D10220}, but this patch doesn't depend on it at all. A third
variant will later be added `..get_inverted_lower_snapshot()`.
Altogether, these three functions allow solving for any of
(lower_snapshot, upper_snapshot, blended_snapshot) given the other two.
The function `..get_inverted_lower_snapshot()` will also similarly
process the remap domain of the blended and lower snapshot.

added assertions within `nlasnapshot_blend()` and
`..get_inverted_upper_snapshot()` to future proof branches dealing with
blendmode and mixmodes. (suggested by sybren)

No user functional changes

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D10222
2021-05-11 22:00:07 -04:00
Wannes Malfait
65244ac1c3 Geometry Nodes: Link error when implicit conversion isn't possible
This turns links red if no implicit conversion can be made between the
from socket and the to socket. For geometry nodes this happens with
object, geometry, collection, and string sockets that are connected to
a different type. The change is simply implementing a callback that is
already implemented for other node tree types.

Differential Revision: https://developer.blender.org/D11229
2021-05-11 16:46:02 -05:00
2770d43da6 Merge branch 'blender-v2.93-release' 2021-05-11 23:35:49 +02:00
96bcd80c5a Merge branch 'blender-v2.93-release' 2021-05-11 23:05:57 +02:00
dca2303328 Prevent UI data min from becoming greater than max and vice versa 2021-05-11 15:55:53 -05:00
7849e80632 Add error checking when converting to int and double for UI data 2021-05-11 15:40:08 -05:00
5810fa80d4 Cleanup: Rename functions (rna_ui_data prefix, id_properties_create) 2021-05-11 15:09:49 -05:00
e1bcb248ef Use return NULL; when parsing arguments fails 2021-05-11 14:52:31 -05:00
72974a60b4 Add error message for RNA subtype not found 2021-05-11 14:50:36 -05:00
4d330d97ed Use keyword-only arguments 2021-05-11 14:47:30 -05:00
a24dc46d0a Cleanup: Rename functions (IDP_ui_data prefix) 2021-05-11 14:42:42 -05:00
60c156c9c8 Cleanup: Rename functions (IDP_coerce_to_*_or_zero) 2021-05-11 14:41:06 -05:00
e513178bc4 Cleanup: Formatting of long python argument lists 2021-05-11 14:39:48 -05:00
013bb7e9fd Merge branch 'master' into refactor-idprop-ui-data 2021-05-11 14:34:51 -05:00
6796ff5880 Cleanup: unused variable warning 2021-05-11 14:03:40 +01:00
Charlie Jolly
93933ee8bb Geometry Nodes: Add Attribute Vector Rotate node
Port vector rotate node to geo attributes.

Request by @simonthommes

Reviewed By: simonthommes, HooglyBoogly
2021-05-11 11:15:06 +01:00
Yuki Shirakawa
fc5bf09fd8 Rigging: Add transform for custom bone shapes
Add translation/rotation/scale parameters for custom bones shapes. The
new scale is a 3D vector `custom_shape_scale_xyz`, and replaces the
`custom_shape_scale` float.

Reviewed By: #animation_rigging, sybren, zeddb

Differential Revision: https://developer.blender.org/D10974
2021-05-11 11:31:58 +02:00
a02be602f9 Merge branch 'blender-v2.93-release' 2021-05-11 10:25:12 +02:00
1151adf62d Cleanup: unnecessary extra lines for doxy sections 2021-05-11 16:04:03 +10:00
091d7336e6 Cleanup: remove unused baking struct members from soft-body 2021-05-11 16:00:38 +10:00
4226f19a03 Cleanup: Sort node type definitions alphabetically
Previously we had a lot merge conflicts since we always put the most
recently added node at the bottom. By sorting the list we will have
one fewer merge conflict when a node is added in most cases.
2021-05-10 23:10:56 -05:00
5bae9d4e38 Merge branch 'blender-v2.93-release' 2021-05-11 12:30:51 +10:00
5950208f04 Merge branch 'blender-v2.93-release' 2021-05-11 12:26:34 +10:00
7d187e91bb Merge branch 'blender-v2.93-release' 2021-05-11 11:28:46 +10:00
4333991b7b Cleanup: Reorder class variable declarations
The order was arbitrary, and rearranging the declarations
makes the class look less messy, and makes room for future comments.
2021-05-10 19:33:12 -05:00
a5761bbde2 Cleanup: Whitespace, add doxygen sections
The sections aren't helpful at the moment, but I will add more code
here soon that will benefit more from the visual separation.
2021-05-10 19:30:23 -05:00
6b1034d520 Cleanup: Use a helper function for repetitive code
Retrieving data from the component can be done in a separate function
to save some repetition.
2021-05-10 19:17:15 -05:00
5613c61275 Functions: Add materialize methods for generic mutable virtual array
Similar to how `GVArray_For_VArray` implements `materialize_impl` to
forward the work to its non-generic virtual array, we can do the same
thing for the mutable version, `GVMutableArray_For_VMutableArray`.

This commit should have no visible changes, since as far as I can tell
the only user of this class does not implement special materialize
methods anyway.
2021-05-10 19:12:04 -05:00
e19ee2e212 Merge branch 'blender-v2.93-release' 2021-05-11 00:19:39 +02:00
3a5f3fb7e4 Merge branch 'blender-v2.93-release' 2021-05-10 19:21:39 +02:00
0467979425 GPencil: Remove B key to create Blank Keyframe in Drawing mode
We have the `I` menu for that. This is part of the old code.
2021-05-10 16:34:27 +02:00
c3de3c2749 GPencil: Rename prop dilate_pixels to dilate
Better avoid units in name.
2021-05-10 16:26:50 +02:00
1ef5604e8c Merge remote-tracking branch 'origin/blender-v2.93-release' 2021-05-10 16:00:43 +02:00
cacfa75e67 Merge branch 'blender-v2.93-release' 2021-05-10 13:34:05 +02:00
bc868f7b52 Merge branch 'blender-v2.93-release' 2021-05-10 14:16:38 +03:00
Severin
273db9294a Fix warning on Apple Clang, missing override specifier
Was giving a warning:
```
BKE_spline.hh:293:35: warning: 'interpolate_to_evaluated_points' overrides a
member function but is not marked 'override' [-Winconsistent-missing-override]
```
2021-05-10 12:06:54 +02:00
0aa05c7fbb Merge branch 'blender-v2.93-release' 2021-05-10 12:00:34 +02:00
f966f6ed55 Compositor: Add vars and methods for easier image looping
These variables and methods should make it easier to loop through buffers elements/pixels. They take into account single element buffers.
Single element buffers can be used for set operations to reduce memory usage.

Usage example: P2078

Reviewed By: #compositing, jbakker

Differential Revision: https://developer.blender.org/D11015
2021-05-10 11:16:06 +02:00
eba9404cc7 Cleanup: too small loop variable type
Clang-Tidy: bugprone-too-small-loop-variable
2021-05-10 10:52:33 +02:00
0061150e4c Functions: support materialize virtual array to initialized span 2021-05-10 10:28:24 +02:00
f2370bb22d Cleanup: spelling 2021-05-10 16:19:40 +10:00
3b7df2e157 Cleanup: unused variable warning 2021-05-10 16:16:29 +10:00
1d6425cb64 Cleanup: Remove double import in previous commit. 2021-05-10 08:01:20 +02:00
c63d40c165 Enable CLog for GPU test cases. 2021-05-10 07:59:10 +02:00
2f61602497 Cleanup: correct/clarify PlayAnim comments 2021-05-10 15:32:18 +10:00
d800470ac2 LineArt: Custom UI for adding GP object.
This allows extra options (in-front and stroke order) to be shown when adding line art kind of grease pencil object.

Reviewed by: Antonio Vazquez (antoniov)

Diff: https://developer.blender.org/D11130
2021-05-10 09:15:33 +08:00
f694321db0 Fix: Curve resample duplicates last point for cyclic splines
The last point of the output was at the same location as the
first point of a cyclic spline. The fix is simple, just account for
the cyclic when choosing the sample edge length, and don't
hard code the last sample.
2021-05-09 01:33:34 -05:00
7029cc2f8a Fix T88126: Curve resample crash for single point input
The spline `length` function assumed that the curve always had evaluated
edges. That is clearly false. This commit adds a check to `length` and a
special case for a single point in the curve resample node.
2021-05-09 01:13:06 -05:00
518c5ce4cd Geometry Nodes: Improve point instance node performance
This commit uses two changes to improve the performance of the point
instance node.

**Prevent Reallocations**
At 64 bytes, the transform matrix for every instance is rather large,
so reallocating the vector as it grows can become a performance bottle-
neck. This commit reserves memory for the instances that will be added
to prevent unecessary reallocations as the instance vector grows.

In a test with 4 million instances of 3 objects in a collection, the
node was about 40% faster, from 370ms to 270ms for the node.

**Parallelization**
Currently the instances are added by appending to a vector. By changing
this slightly to fill indices instead, we can parallelize the operation
so that multiple threads can fill data at the same time. Tested on a
Ryzen 3700x, this reduced the runtime from the above 270ms to 44ms
average, bringing the total speedup to ~8x.

Note that displaying the instances in the viewport is still much slower
than the calculations in node, this change doesn't affect that.
2021-05-08 23:57:36 -05:00
b7afb8ea70 Merge branch 'blender-v2.93-release' 2021-05-09 01:52:33 +02:00
9569a522f2 Geometry Nodes: Refactor point instance node
This patch refactors the instance component to make use of the earlier
refactoring in rB4599cea15dcf. Now we don't have to build an array of
instance references the size of the point domain, and we can gather the
possible instances only once and use the same vector for all component
types. Generally the node should be a bit faster and use less memory.

The logic is moved around a bit, especially the hashing of the ID
attribute to pick from the instance list, but the result is unchanged.

Differential Revision: https://developer.blender.org/D11203
2021-05-08 14:53:32 -05:00
35a2b13709 Also version nodes modifier settings 2021-05-08 13:29:44 -05:00
433585f906 Whitespace 2021-05-08 13:24:31 -05:00
ad3cdcc437 Merge branch 'master' into refactor-idprop-ui-data 2021-05-08 13:09:38 -05:00
34439f05ab Cleanup: remove use of persistent data handles in geometry nodes
Those were mostly just left over from previous work on particle nodes.
They solved the problem of keeping a reference to an object over
multiple frames and in a cache. Currently, we do not have this problem
in geometry nodes, so we can also remove this layer of complexity
for now.
2021-05-08 14:54:48 +02:00
39044e68c2 Cleanup: correct PlayState.stopped state which was inverted 2021-05-08 16:13:17 +10:00
e1e23595f0 Cleanup: remove unused turbo struct member from PlayAnim
This was never used (since 2.25 at least).
2021-05-08 16:13:17 +10:00
9708215611 Cleanup: comment PlayAnim struct members 2021-05-08 16:13:17 +10:00
124572a6e5 Merge branch 'blender-v2.93-release' 2021-05-08 16:12:48 +10:00
57b473a10a Merge branch 'blender-v2.93-release' 2021-05-08 14:59:30 +10:00
e46b9de6ab Fix: Curve to mesh node assert when last profile segment is vector
We need to always add a single point to the last cyclic segment that
completes the loop, because that includes the starting point of the
evaluated edge. The existing code forgot about that point.
2021-05-07 18:16:15 -05:00
3185084efb Geometry Noes: Curve Resample Node
This node generates a naturally parametarized (even length edge) poly
spline version of every spline in the input. There are two modes,
"Count", and "Length". These are similar to the same options for the
line primitive node in end points mode.

I implemented this instead of a "Sample Points" node, because for this
operation it's trivial to keep the result as a curve, which is nice
since it increases flexibility, and because it can make instancing
simpler, i.e. using the transforms of each evaluated point rather than
requiring the construction of a "rotation" attribute.

Differential Revision: https://developer.blender.org/D11173
2021-05-07 15:37:06 -05:00
960535ddf3 GPencil: New Append operators
Now it's possible to append materials of one grease pencil object into another one. The operator allows active material or all materials.

Also, the Layer Copy To Object has been renamed to Layer Append to Object to keep consistency and now allows to append all layers at once.
2021-05-07 18:27:58 +02:00
c2b6dc7e53 Cleanup: Fix deinterlace code block style 2021-05-07 17:22:12 +02:00
9c509a7219 UI: Display indicator in the 3D Viewport when Clipping Region is on
Small addition inspired by [this tweet](https://twitter.com/Vorundor/status/1390645286624763909) of a user in a situation I also saw myself in the past.

Showing "(Clipped)" next to the view name in the `Text Info` overlay fits well since it's a per-viewport setting.

{F10059921, size=full}

While on Local view:
{F10059925, size=full}

Multiple viewports:
{F10059946, size=full}

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D11193
2021-05-07 17:17:29 +02:00
8f04ddbbc6 Node Editor: Show frame label only when a label is set
Avoids having frames with the word "Frame" on top, resulting in less visual noise.
(users were working this around by adding a space as label name).

Differential Revision: D11193
2021-05-07 17:12:39 +02:00
8d6264ea12 Cleanup: Remove deprecated variables and functions calls from our ffmpeg code
There need to be more cleanup for ffmpeg 4.5 (ffmpeg master branch).

However this now compiles on ffmpeg 4.4 without and deprication
warnings.

Reviewed By: Sergey, Richard Antalik

Differential Revision: http://developer.blender.org/D10338
2021-05-07 17:12:25 +02:00
5bfd5e77b7 Fix: Curve to mesh node fails with one point and no profile
Just because the spline is cyclic does not necessarily mean that it has
an edge.
2021-05-07 09:55:32 -05:00
36ffa5b915 Merge branch 'blender-v2.93-release' 2021-05-07 16:53:24 +02:00
Charlie Jolly
7d90b0ab11 Geometry Nodes: Parallelize Attribute Curve Map node
This adds `parallel_for` to the Attribute Curve Map node to improve performance.
Grain size set to 512.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11194
2021-05-07 15:27:15 +01:00
8e3a73bf81 Merge branch 'blender-v2.93-release' 2021-05-07 16:14:39 +02:00
bcfdbbf4b4 Cleanup: clang tidy
readability-inconsistent-declaration-parameter-name
2021-05-07 15:57:35 +02:00
94838ba661 Silence warnings 2021-05-07 15:45:52 +02:00
a932b9eab7 Cleanup: make format (clang-format) 2021-05-07 15:45:52 +02:00
b78a1c05a3 Merge remote-tracking branch 'origin/blender-v2.93-release' 2021-05-07 15:45:25 +02:00
c58bf31aed GPencil: Add Bracket keymaps to increase/decrease brush size
This add the missing keymaps.

Requested by Jukien Kaspar.

Differential Revision: https://developer.blender.org/D11183
2021-05-07 15:30:57 +02:00
e7312effb1 Merge branch 'blender-v2.93-release' 2021-05-07 12:54:30 +02:00
a54253f335 LibOverride: Add proper reports when deleting user-edited overrides as part of resync.
Logs are not enough here, we need proper warning visible for the user.
2021-05-07 12:54:13 +02:00
aa8e058a59 LibOverride: Do not preserve local overrides when their linked data disappear.
This is the opposite of previous code, which would keep those
'deprecated' overrides arround (often in a dedicated collection), when
they were detected as user-edited.

While this is a safe-ish way to (try to) preserve user-edited data, this
tends to add too much 'trash' data to production scenes, which cleaning
becomes a burden.

Note that user will get warnings in thos cases, and can always choose
not to save the current blend file and go fix the library issue instead.
2021-05-07 12:54:13 +02:00
23acca0c32 Fix T88100: Crash going to shading tab 2021-05-07 12:43:43 +02:00
6b46e9e524 Fix strict compiler warning in sequencer code 2021-05-07 12:39:11 +02:00
700fe73560 VSE: New iterator design
This iterator design provides means to create simple and flexible API
to query and work with collection of strips. It should be used in cases
when conditions require multiple stages of recursive iteration of all
strips or similar complex scenarios.

Quick API overview:
Basic queries are standalone functions that return SeqCollection
Use SEQ_collection_create() and SEQ_collection_free() to construct
such query functions.
Use these functions to get strips of known conditions, like selected
strips, movie strips, muted strips and so on.

Use SEQ_reference_query() when querying strips with relation to
some reference strip. For example to get its effects, strips that have
same type or use same input file and so on.
These aren't standalone functions because often you need to query strips
relative to each strip in collection.

Use SEQ_collection_expand() to query strips relative to each strip
in collection. These will be merged to original collection.

Use SEQ_collection_merge() to merge 2 collections

To iterate collection elements use macro SEQ_ITERATOR_FOREACH()

This API is quite specific, but I think it is best suited for tasks
that are usualy solved in sequencer codebase.

Old sequencer iterator has been completely removed.
SEQ_ALL_BEGIN and SEQ_ALL_END macros re-use new iterator design.

As initial use for this iterator select_grouped_effect_link()
function has been rewritten. It was not only broken, but also it used
DNA fields to aid iterating strips.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10337
2021-05-07 10:26:39 +02:00
232b10f663 Merge branch 'blender-v2.93-release' 2021-05-07 18:18:21 +10:00
cfc644186a Merge branch 'blender-v2.93-release' 2021-05-07 18:18:18 +10:00
5d7de5745b Merge branch 'blender-v2.93-release' 2021-05-07 18:18:15 +10:00
eaffa83fec Merge branch 'blender-v2.93-release' 2021-05-07 18:18:11 +10:00
f81dca971d Merge branch 'blender-v2.93-release' 2021-05-07 18:18:08 +10:00
c8cbaeb329 Merge branch 'blender-v2.93-release' 2021-05-07 10:05:19 +02:00
Charlie Jolly
ba06bc16ae Geometry Nodes: Add Attribute Curve Map Node
This node has the same functionality as the color and vector curve
mapping nodes in the shader editor. Here is works on every value for
the selected attribute, and it can also output a float value. Other
than that, the implementation is quite straightforward-- almost
completely boilerplate code.

Differential Revision: https://developer.blender.org/D10921
2021-05-06 23:47:51 -05:00
026a9cdc21 Cleanup: move UV element keymap items into a loop
Also add explanation for non-obvious dummy key-map item.
2021-05-07 13:36:29 +10:00
5a3307230e Cleanup: de-duplicate checks in object-mode item callback 2021-05-07 11:23:09 +10:00
ff1b35af39 Cleanup: remove OB_MODE_EDIT from GPencil compatibility check
All callers replace this with OB_MODE_EDIT_GPENCIL.
2021-05-07 11:23:09 +10:00
eb9762a159 Cleanup: remove redundant NULL check in ED_object_mode_compat_test 2021-05-07 11:23:09 +10:00
4243ee7d19 Object Mode: avoid error message with particle-edit mode switch
Mode switching passed through when the mode wasn't supported for all
modes except particle edit-mode.

Add a check to ED_object_mode_compat_test to prevent the error message.
2021-05-07 11:23:09 +10:00
78b2b5fc0e Merge branch 'blender-v2.93-release' 2021-05-07 10:54:52 +10:00
72cefdfd59 Update RNA to User Manual mapping 2021-05-06 17:23:39 -04:00
51b8032c70 Merge branch 'blender-v2.93-release' 2021-05-06 19:23:34 +02:00
20a878158f Merge branch 'blender-v2.93-release' 2021-05-06 19:02:38 +02:00
529de3d6f8 Merge branch 'blender-v2.93-release' 2021-05-06 18:21:43 +02:00
568d55d4bc Merge branch 'blender-v2.93-release' 2021-05-06 17:11:58 +02:00
ec30cf0b74 Fix T88058: Hover+return doesn't accept 0 as input
When the user hovered over a number input field, pressed Enter and then
typed in '0', confirming the input would always cancel the action. This
is because in this particular case `ui_textedit_begin` is called
instead of `ui_numedit_begin`. This function will not set
`data->startvalue` (leaving it at `0`) which will then trigger the
cancel in `ui_apply_but_NUM` which checks if the input changed (by
comparing the entered value with `data->startvalue`).

The fix makes sure that when `ui_textedit_begin` is called on a number
button, the `data->startvalue` is set correctly like in
`ui_numedit_begin`.

Breaking commit: rBSeb06ccc32462beaacbb114d6d0e450b6fc911047

Note: This also affects pressing tab to move to a new number field and
entering '0'. The fix will also cover this case.

Reviewed By: Severin, #user_interface

Maniphest Tasks: T88058

Differential Revision: https://developer.blender.org/D11168
2021-05-06 13:10:05 +02:00
3e77f747c0 Alembic export: export UV maps on every frame
Export UV maps to Alembic on every frame. This makes the export of UV
maps consistent with mesh normals. In the case of static UV maps it may
cause a slight slowdown (since they're exported on every frame now), but
due to the deduplication performed by the Alembic library, the resulting
files will be the same size anyway.

Thanks to @CodyWinch for providing the solution to the problem, and
writing the original patch D8397.

Differential Revision: https://developer.blender.org/D8397
2021-05-06 12:19:24 +02:00
47d76e0903 Merge branch 'blender-v2.93-release' 2021-05-06 11:01:21 +02:00
42e350b9a5 Merge branch 'blender-v2.93-release' 2021-05-06 08:44:23 +02:00
59df16e2e4 Merge branch 'blender-v2.93-release' 2021-05-06 15:34:16 +10:00
11b50b2b77 Cleanup: VSE: move functions from incorrect file
`SEQ_recursive_apply` and `SEQ_seqbase_recursive_apply` were incorrectly
refactored into `iterator.c` file, but they aren't part and don't use
sequencer iterator.

Functions are moved to `utils.c` file.
2021-05-06 05:57:39 +02:00
f74b7e6ce9 Cleanup: Move PlayAnim frame-cache variables into a struct
Naming was inconsistent and hard to follow.
2021-05-06 12:02:23 +10:00
c17792a709 Merge branch 'blender-v2.93-release' 2021-05-06 11:35:10 +10:00
0433bc7e4e Merge branch 'blender-v2.93-release' 2021-05-06 03:23:16 +02:00
efc6f4675d Cleanup: spelling 2021-05-06 08:09:05 +10:00
832f7170dc Cleanup: link directly to stackexchange URL 2021-05-06 08:08:12 +10:00
Severin
6c8c30d865 Fix T82002: ENTER does nothing when mouse cursor is over save dialog text field
The `file.execute` operator would early-exit because the mouse wasn't hovering
the file list. Caused by 4ba9d7d71e.

Although simpler solutions would have been possible, I decided it's better to
split add a new operator for executing based on the mouse (for double-clicking
files), to separate that from the window level execute operator
(`file.execute`). This allows more control and we can get rid of the implicit
assumption that the keymap would call `file.select` on mouse-press, and
`file.execute` on double-click, for the double-click behavior to work. The cost
is that we execute the file selection & activation logic twice on the
double-click, but that shouldn't be an issue at all.
Also removes the `need_active` property from the `file.execute` operator.
That's ancient and wasn't implemented well anyway.

To be clear, reason this fixes the bug is that `file.execute` works entirely
with the `execute()` callback now and doesn't early-exit based on the mouse
position anymore.

Might trigger warnings about the `need_active` property not being found for
custom keymaps. These can be ignored and the property can safely be removed
from the keymap. I don't expect other keymap breakages.
2021-05-05 20:53:06 +02:00
ebd912ca8f Merge branch 'blender-v2.93-release' 2021-05-05 18:40:58 +02:00
ccb5caef08 Remove printfs 2021-05-05 18:40:50 +02:00
c8293d6258 Fix T86037 EEVEE: SSR option changes render passes result
This was caused by the SSR option resetting the accumulation. But the
render passes were only cleared in the init phase. This means that
when SSR was resetting the `taa_render_sample` the actual renderpasses
would still contains 1 sample. This means the renderpasses were always
divided by the wrong number of samples.

The fix is to clear just before accumulation if the sample is 1.

The fact that it works for motion blur is kind of a blessing. This is because
we check `stl->effects->ssr_was_valid_double_buffer` before resetting the
sampling. So this only happens on the first motion step and does not affect
the rest of the rendering.

Differential Revision: https://developer.blender.org/D11033
2021-05-05 18:40:50 +02:00
5f7f90d5a2 Merge branch 'blender-v2.93-release' 2021-05-05 16:42:37 +02:00
632c3304bc Merge branch 'blender-v2.93-release' 2021-05-05 15:09:41 +02:00
1f184066ba Merge branch 'blender-v2.93-release' 2021-05-05 14:21:49 +02:00
8e0995d006 Merge branch 'blender-v2.93-release' 2021-05-05 12:29:24 +02:00
515afeb11b Merge branch 'blender-v2.93-release' 2021-05-05 18:09:37 +10:00
89bc6b5508 Merge branch 'blender-v2.93-release' 2021-05-05 07:22:10 +02:00
08f4bab658 System info: add OS version to sys_info.py
Match the output to the prefilled bug report script's output.
Make the output file self-contained.

Reviewed By: lichtwerk
Differential Revision: https://developer.blender.org/D11144
2021-05-05 10:08:04 +05:30
20aed341ee Cleanup: use doxy sections for info_ops.c 2021-05-05 12:12:20 +10:00
909506200a Cleanup: quiet warning about description ending with '.' 2021-05-05 12:11:39 +10:00
d08cc63e2f Nodes Splines: Apply tilt to normal evaluation
This patch makes the spline tilts (interpolated to the evaluated points)
affect the evaluated normals, allowing manual control of the rotation of
each profile in the curve to mesh node.

The method is based on Animation Nodes code, which keeps the data in
direction vector form, and rotates around the tangent vector.

Differential Revision: https://developer.blender.org/D11152
2021-05-04 17:35:48 -05:00
1f5710326f Fix: Splines: Use consistent bezier linear interpolation method
While the method of interpolating based on the curve length at each
evaluated point may be useful in some situations, for now it's best to
be consistent with the existing methods in Blender, so this commit adds
a simple linear-based-on-resolution sampling method to bezier splines.
2021-05-04 17:27:20 -05:00
d18be66a54 Fix T86871: Mesh.mesh_from_object creates empty mesh from curve
Regression in 2b723abea0
2021-05-05 08:08:33 +10:00
7ab7ae80c5 Fix: Incorrect cyclic interpolation for nodes bezier spline
The special case for the interpolation to the last point was being used
for every point in the last segment, because of the rounding. Instead,
make the function slightly more complicated to properly handle the
correct interolation in the cyclic and non-cyclic cases.
2021-05-04 16:28:22 -05:00
441160930b Fix: Incorrect type used for geometry nodes poly splines 2021-05-04 14:34:16 -05:00
5ea113a555 Fix missing header & footer toggle chevrons in Spreadsheet
The little chevron tab to open a hidden region wouldn't show up in the
Spreadsheet editor. Cause was an incorrect GPU-scissor usage:
While drawing regions, the scissors should be kept enabled, just the
scissor rectangle should be updated - and afterwards reset to what it
was before.
2021-05-04 20:20:15 +02:00
87ee8ddfe3 Fix compile error without Alembic
Thanks to @Severin for noticing and providing a little patch.
2021-05-04 17:30:49 +02:00
f8f6e0b256 GPencil: New Dilate parameter for Fill brush
Internally, when using Fill brush a dilate of the filled area was done, but this was hardcoded to 1 pixel.

In some situations, this was not enough, so now the value is accesible in the UI and can be set with different values.

Also, as this value is more used than `Leak Size`, the new Dilate is on Topbar, and Leak Size has been moved to Advanced panel.
2021-05-04 16:46:33 +02:00
Cody Winchester
7904899d02 Gpencil - Fix stroke normal from D10171
In my previous patch https://developer.blender.org/D10171 some code changing the direction the strokes normal was accidentally included. This patch reverts that back to the original normal calculation.

Reviewed By: #grease_pencil, antoniov

Differential Revision: https://developer.blender.org/D11148
2021-05-04 16:31:15 +02:00
d2311de218 Fix T87935: allow library overrides on NLA/FCurve modifiers
Mark NLA/FCurve modifier properties as library-overridable.

It was already allowed to add such modifiers to a library-overridden
object, but then the properties of those modifiers were read-only,
limiting their use.
2021-05-04 16:25:50 +02:00
46d56bd956 Animation: correct active track/strip pointers after copying NLA tracks
After copying NLA tracks from one `AnimData` to another, also ensure
that the `AnimData::act_track` and `AnimData::actstrip` pointers are
pointing to the copy rather than the original.

This is a necessary step to allow library overrides on NLA modifiers
without crashing Blender.

The remapping of the pointers is done by looping over the tracks/strips
and comparing pointers. Alternatively, I could update the copy functions
themselves to keep track of those pointers and return them, but IMO that
would produce more spaghetti (they're also used in cases where this
pointer-remapping is not desired).
2021-05-04 16:23:57 +02:00
191664acd2 Docs: "File > External Data pack operator" lookup for the manual 2021-05-04 16:20:56 +02:00
ee51e73355 "File > External Data" menu improvements and cleanup
All changes:
* Include `file.pack_libraries` and `file.unpack_libraries` to the menu
[1].
* Rename "Pack Blender Libraries" → "Pack Linked Libraries" [2].
* Rename "Unpack Blender Libraries" → "Unpack Linked Libraries" [2].
* Rename "Pack All Into .blend" → "Pack Resources" [3]
* Rename "Unpack All Into Files" → "Unpack Resources" [3]
* Rename "☑ Automatically Pack Into .blend" → "☑  Automatically Pack
Resources" [3]
* Rename "Make All Paths Relative" → "Make Paths Relative" [4]
* Rename "Make All Paths Absolute" → "Make Paths Absolute" [4]
* Add separators accordingly

---

[1] - This was never exposed since its original commit rB16411da41e40.
Now that operator not listed in menus don't
show up in the search, this became even more hidden.

[2] - The original name (Pack Blender Library) was not clear enough.
Pose Libraries and Asset Libraries are also technically Blender
libraries.

[3] - The term All was misleading since it didn't include the Linked
Libraries.

[4] - No need to use "All". It is not used in the Report/Find Missing
Files either.

This commit put this in the File > External Data menu.

Differential Revision: https://developer.blender.org/D11109
2021-05-04 16:20:56 +02:00
57b94cf34b Merge branch 'blender-v2.93-release' 2021-05-04 15:20:33 +02:00
d0b3f9c81b Fix T87489: Text Data-Blocks get deleted on Recursive Purge
Text data block were not considered special in the recursive purge
function.  So they would get deleted if they had no actual users.

To fix this we instead make text data block use "fake user" so that
addon authors can specify script files that should be removed if nothing
is using it anymore.

Per default, new text object have "fake user" set. So functionality
wise, the user has to explicitly specify that they want the text object
to be purge-able.

Reviewed By: Bastien

Differential Revision: http://developer.blender.org/D10983
2021-05-04 15:11:20 +02:00
4599cea15d Geometry Nodes: refactor instances component
The main goal of this refactor is to not store Object/Collection
pointers for every individual instance. Instead instances now
store a handle for the referenced data. The actual Object/Collection
pointers are stored in a new `InstanceReference` class.

This refactor also allows for some better optimizations further down
the line, because one does not have to search through all instances
anymore to find what data is instanced.

Furthermore, this refactor makes it easier to support instancing
`GeometrySet` or any other data that has to be owned by the
`InstancesComponent`.

Differential Revision: https://developer.blender.org/D11125
2021-05-04 10:16:24 +02:00
e6bf272abd Merge branch 'blender-v2.93-release' 2021-05-03 20:07:03 -03:00
Stefan Werner
042df5fd6a Cycles standalone: Fixed macOS dependencies.
Added IOKit and Accerelate as linked frameworks where necessary.
2021-05-03 22:07:09 +02:00
8216b759e9 Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.

However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.

Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.

**Limitations**
 - For now, you must bring curves into the node tree with an "Object
   Info" node. Changes to the curve modifier stack will come later.
 - Converting to a mesh is necessary to visualize the curve data.

Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes

Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
c9d81678d7 Merge branch 'blender-v2.93-release' 2021-05-03 17:10:54 +02:00
73a76608c8 Merge branch 'blender-v2.93-release' 2021-05-03 16:57:34 +02:00
888a697e24 Cleanup: spelling 2021-05-04 00:44:53 +10:00
12d8720b9b WM: disable idle event handling timer when simulating events 2021-05-04 00:39:49 +10:00
0ac6852a42 Movieclip: Use first clip frame for size detection
Using scene frame 1 is not reliable in cases when there is a
frame offset is involved. Using frame 1 seems more reliable,
although might still fail under certain circumstances.

More reliable fix would require a deeper change in the data
structure and the logic about frame loading and size detection.
2021-05-03 16:30:19 +02:00
2f615ad3a9 Fix wrong tracking curves after changing clip offset
The issue was caused by frame start/offset change triggering clip
reload, which was happening with a hardcoded scene frame index of 1,
which could be outside of the actual clip frames.

Solved by removing source change tag from the frame start/offset
update. The source doesn't really change: the resolution will stay
the same, as well as media type, its duration. So the tag was not
needed.
2021-05-03 16:30:19 +02:00
9f1e20e74f Alembic Procedural: precompute vertex normals
This precomputes vertex normals in the procedural and caches them in case none
are found in the archive. This only applies to polygon meshes, as subdivision
meshes are yet to be subdivided, so it is useless to do this computation.

The goal here is to speed up data updates between frames, as computing normals
shows up in profiles even for large objects. This saves around 16% of update time
for a production file.
2021-05-03 16:20:06 +02:00
e2c671e34c Alembic Procedural: refactor data reading
This splits the data reading logic from the AlembicObject class and moves it to
separate files to better enforce a separation of concern. The goal was to simplify
and improve the logic to read data from an Alembic archive.

Since the procedural loads data for the entire animation, this requires looping
over the frame range and looking up data for each frame. Previously those loops
would be duplicated over the entire code causing divergences in how we might
skip or deduplicate data across frames (if only some data change over time and
not other on the same object, e.g. vertices and triangles might not have the
same animation times), and therefore, bugs.

Now, we only use a single function with callback to loop over the geometry data
for each requested frame, and another one to loop over attributes. Given how
attributes are accessed it is a bit tricky to simplify further and only use a
ingle function, however, this is left as a further improvement as it is not
impossible.

To read the data, we now use a set of structures to hold which data to read.
Those structures might seem redundant with the Alembic schemas as they are
somewhat a copy of the schemas' structures, however they will allow us in the
long run to treat the data of one object type as the data of another object
type (e.g. to ignore subdivision, or only loading the vertices as point clouds).

For attributes, this new system allows us to read arbitrary attributes, although
with some limitations still:
* only subdivision and polygon meshes are supported due to lack of examples for
  curve data;
* some data types might be missing: we support float, float2, float3, booleans,
  normals, uvs, rgb, and rbga at the moment, other types can be trivially added
* some attribute scopes (or domains) are not handled, again, due to lack of example
  files
* color types are always interpreted as vertex colors
2021-05-03 16:19:50 +02:00
3e4863376e Cleanup: use boolean for has_event variable & return value 2021-05-04 00:17:45 +10:00
efe9928545 Merge branch 'blender-v2.93-release' 2021-05-03 15:56:28 +02:00
2e9dc2b999 Merge branch 'blender-v2.93-release' 2021-05-03 15:40:58 +02:00
2b78d3d7f3 Merge branch 'blender-v2.93-release' 2021-05-03 15:11:23 +02:00
1d7ee50fef Geometry Nodes: Parallelize attribute nodes
This commit significantly speeds up many of the attribute nodes when
multiple threads are available in linear situations when parallelism
cannot be achieved elsewhere.

See the differential for a table of timing comparisons tested on a
Ryzen 3700x. For an attribute with 4 million elements, the nodes were
about 3 to 9 times faster.

The changes are not exhaustive, other nodes could still be parallelized
in the future. Also, it would be possible to further optimize the grain
size in `parallel_for`, but I'd rather make sure it isn't too small.
I tested some different values, but also relied on intuition--
increasing grain size for less complex operations and vice versa.

Differential Revision: https://developer.blender.org/D11139
2021-05-03 08:00:09 -05:00
2b46606af1 Merge branch 'blender-v2.93-release' 2021-05-03 14:03:00 +03:00
ee8593fe76 Cleanup: clang-tidy 2021-05-03 10:23:15 +02:00
da9b1b9636 Cleanup: clang-tidy 2021-05-03 10:22:12 +02:00
8884385afb Cleanup: format 2021-05-03 04:42:39 +02:00
3bc44233c0 Cycles: use reference count to detect used shaders
Shaders are only compiled if they are used by some other Node (Geometry, Light, etc.).
This usage detection is done before updating the Scene, however it fails at detecting
Shaders used by Procedurals not known to Cycles (e.g. ones defined by third party
applications), as Procedurals are only updated after the shaders are compiled.

To remedy this, we now use the Node reference counting mechanism to detect whether a
Shader is used and therefore should be compiled.

This removes `ShaderManager::update_shaders_used` as it is not needed anymore, however,
since it would also update the Shader ids, this is now performed in
`ShaderManager::device_update`, and a new virtual `device_update_specific` method was
added to handle device updates for SVM and OSL.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D10965
2021-05-03 01:21:12 +02:00
5a964664d6 Cycles: add reference counting to Nodes
This adds a reference count to Nodes which is incremented or decremented
whenever they are added to or removed from a socket, which will help us
track used Nodes throughout the scene graph generically without having to
add an explicit count or flag on specific Node types. This is especially
useful to track Nodes defined through Procedurals out of Cycles' control.

This also modifies the order in which nodes are deleted to ensure that
upon deletion, a Node does not attempt to decrement the reference
count of another Node which was already freed or deleted.

This is not currently used, but will be in the next commit.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D10965
2021-05-03 01:20:33 +02:00
5ffab01930 Merge branch 'blender-v2.93-release' 2021-05-02 16:40:40 -04:00
d8fdb06a81 Merge branch 'blender-v2.93-release' 2021-05-02 15:56:38 +02:00
6b6ae92436 Merge branch 'blender-v2.93-release' 2021-05-02 11:20:27 +02:00
ecc7a83798 UI: Object Thumbnails Orientation Change
Object orientation for thumbnail creation changed to be slightly
oblique (tilted to one side and from above) to better show shape,
especially when axis-aligned. Camera lens changed to 85 to avoid
distortion of close objects like human heads.

see D9940 for details and examples.

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

Reviewed by Julian Eisel
2021-05-01 09:15:03 -07:00
06af6a9efa Merge branch 'blender-v2.93-release' 2021-05-01 17:23:39 +02:00
Germano Cavalcante
6fff2427d6 Python GPU: Replace a few calls of the bgl module with gpu
Concludes these files:
[x]bpy_types.py
[x]operator_modal_draw.py

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D11129
2021-05-01 12:12:58 -03:00
Tomasz Kaye
6111ec8bd3 GPencil: Auto lock layers, tooltip grammar fix
Reviewed By: #grease_pencil, antoniov

Differential Revision: https://developer.blender.org/D11136
2021-05-01 16:41:14 +02:00
503dc97708 Merge branch 'blender-v2.93-release' 2021-05-02 00:13:02 +10:00
d540a858d8 Merge branch 'blender-v2.93-release' 2021-05-01 01:53:34 -04:00
f11a3c36e3 Docs: PyAPI: Fix css selector failing on some pages 2021-05-01 01:28:31 -04:00
5e53504b3b Merge branch 'blender-v2.93-release' 2021-04-30 18:49:44 +02:00
436529d4f6 Merge branch 'blender-v2.93-release' 2021-04-30 18:04:56 +02:00
75536b5a61 Cleanup: compiler warnings 2021-05-01 00:49:55 +10:00
405c3b59e4 Merge branch 'blender-v2.93-release' 2021-05-01 00:46:03 +10:00
313a1c072d BLI: support removing Map elements during iteration
While it was technically safe to call Map.remove while iterating over
a map, it wasn't really designed to work. Also it wasn't very efficient,
because to remove the element, the map would have to search it
again. Now it is possible to remove an element given an iterator
into the map. It is safe to remove the element while iterating over
the map. Obviously, the removed element must not be accessed
anymore after it has been removed.
2021-04-30 16:23:02 +02:00
e7274f9f2d BLI: add a common base class for Map iterators
This is useful for an upcoming commit that allows removing
an element based on an iterator.
2021-04-30 16:23:02 +02:00
2bd9a28ff8 Cleanup: Rename #if GPU_USE_PY_REFERENCES to #ifndef GPU_NO_USE_PY_REFERENCES
This is safer for incremental build.

And there was already a macro `GPU_USE_PY_REFERENCES` used elsewhere.
2021-04-30 11:20:39 -03:00
a711aa5b3c Fix accidental lines removed in the last commit 2021-04-30 11:03:39 -03:00
a35d33d520 Fix gross errors in previous commit 2021-04-30 11:00:57 -03:00
c3a980436d Documentation: Replace the bgl API in the gpu module exemples 2021-04-30 10:50:50 -03:00
2510bd3a5f Python GPU: Add new methods to port the code templates in the manual
This commit adds a new API tha allow to replace the bgl API in the exemples on:
https://docs.blender.org/api/current/gpu.html

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

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11031
2021-04-30 10:49:54 -03:00
Germano Cavalcante
04b6296e81 Python GPU: Add reference of PyObject GPU object to the GPU object itself
Instead of creating different python wrappers for the same GPU object,
return the same `PyObject` created earlier.

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

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11044
2021-04-30 10:42:13 -03:00
c96506d54a Merge branch 'blender-v2.93-release' 2021-04-30 23:41:05 +10:00
8f27ea40d6 Merge branch 'blender-v2.93-release' 2021-04-30 23:13:34 +10:00
Charlie Jolly
95d2d0d35a Geometry Nodes: Add an "Auto" option for Attribute Convert data type
Currently there is an "Auto" option for the domain, this commit adds a
similar option for "Auto" data type, that uses the data type from the
target attribute or the source attribute (in that order).

Ref T87347

Differential Revision: https://developer.blender.org/D10932
2021-04-30 08:11:45 -05:00
6cf28e98fb Object: rename BKE_object_runtime_free, leave data cleared
Rename BKE_object_runtime_free -> BKE_object_runtime_free_data,
since the runtime pointer is part of the object, only the data is freed.

Leave the data cleared to avoid accidental use,
this is in keeping with other `*_free_data()` functions.
2021-04-30 22:38:40 +10:00
3182844914 Fix: missing return 2021-04-30 13:11:49 +02:00
a79b09e762 Merge branch 'blender-v2.93-release' 2021-04-30 20:50:08 +10:00
7f208be929 Fix all objects getting selected sometimes when droppping object
If no other object was selected while dragging one in (e.g. from the Outliner
or an object asset from the Asset Browser), all visible objects in the active
view layer would get selected.
Issue was caused by a wrong enum type use.

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

Ref D11026

Reviewed By: sergey
2021-04-30 16:29:03 +10:00
ea17a92cd7 Cleanup: interface_intern.h doc-strings
Also clarify some vague comments & add doxygen section for menu-memory.
2021-04-30 16:17:12 +10:00
67cd6beea0 Cleanup: correct comment 2021-04-30 15:58:04 +10:00
4d7d1b5dae Cleanup: comments in BMesh bisect, use doxygen sections 2021-04-30 15:49:33 +10:00
c51720a6ad Cleanup: rename BKE_pose_channel_{verify => ensure}
The term `verify` doesn't fit with what this function does
and is sometimes used to check data is valid or to control validity
checking as with `RNA_define_verify_sdna`.
use more common term `ensure`.
2021-04-30 15:30:41 +10:00
af3eda8185 Cleanup: rename BKE_pose_channels_hash_{make => ensure}
Use the term `ensure` since it makes it clear the data is
not manipulated if it already exists.
2021-04-30 15:28:13 +10:00
0dde73b4fc Cleanup: use early return in edittranslation_exec 2021-04-30 15:26:17 +10:00
b316aaa0d2 Cleanup: use const variables 2021-04-30 15:24:46 +10:00
5806d7ef54 Cleanup: avoid ambiguous parenthesis 2021-04-30 15:24:24 +10:00
d5ae0290e8 Cleanup: duplicate break 2021-04-30 15:22:59 +10:00
4a82df366f Cleanup: use 'else if' 2021-04-30 15:22:44 +10:00
d286adc26e Cleanup: remove redundant assignments & NULL pointer check 2021-04-30 15:20:44 +10:00
8a1d3bf2b1 Merge branch 'blender-v2.93-release' 2021-04-30 15:16:08 +10:00
a636909aa7 Merge branch 'blender-v2.93-release' 2021-04-30 15:16:06 +10:00
452f32dcb3 Merge branch 'blender-v2.93-release' 2021-04-30 15:16:05 +10:00
5a40c79520 Merge branch 'blender-v2.93-release' 2021-04-30 15:16:04 +10:00
a9a048c726 Merge branch 'blender-v2.93-release' 2021-04-30 15:16:02 +10:00
0959618c2e Merge branch 'blender-v2.93-release' 2021-04-30 15:15:14 +10:00
1597eb82d6 Merge branch 'blender-v2.93-release' 2021-04-30 15:14:47 +10:00
093ab05bcd Merge branch 'blender-v2.93-release' 2021-04-30 15:14:36 +10:00
d1cdbbc5fd Merge branch 'blender-v2.93-release' 2021-04-30 15:14:34 +10:00
3be50c849a Merge branch 'blender-v2.93-release' 2021-04-30 15:14:32 +10:00
Wannes Malfait
47aca2b4c4 Nodes: Add a callback to check for valid socket type
This adds a callback to bNodeTreeType to check which socket types are
valid for the tree type. Function has been implemented for the normal
tree types, and can be implemented for custom node trees with python,
by adding a `classmethod` to the tree. However, only builtin socket
types are supported.

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

Differential Revision: https://developer.blender.org/D10938
2021-04-29 23:36:46 -05:00
ddaeaa4b98 Geometry Nodes: Add a template utility to mix two attribute values
This is just linear interpolation, but it's nice to have an equivalent
to `mix3` for only two values. It will be used for interpolation of
values between bezier spline control points.
2021-04-29 21:52:34 -05:00
45a14a20de Cleanup: Mismatched array bounds in function declaration 2021-04-29 21:25:34 -05:00
8dd5fdca3b Cleanup: Remove unecessary variable
The value of this variable was incremented, but never used.
2021-04-29 15:11:35 -05:00
596aebcc28 Fix memory leak introduced by last commit 2021-04-29 13:45:36 -05:00
2ebdf5b7a7 Add IDP_ID UI data for tooltips from node sockets 2021-04-29 13:36:22 -05:00
4e96d8da88 Refactor IDProperty usage in MOD_nodes.cc 2021-04-29 13:35:48 -05:00
Antonio Vazquez
41820e8a8e GPencil: Add "Convert Text to Gpencil"
Currently when you try to convert a Text-object to Grease pencil from the Object-menu or via the operator in some other way, the Text-object is only converted to a Curve.

This commit converts that curve to a Grease pencil object.

Differential Revision: https://developer.blender.org/D11117
2021-04-29 17:58:18 +02:00
0d1f6b518b Merge branch 'master' into refactor-idprop-ui-data 2021-04-29 10:47:48 -05:00
c9d1143b33 Cleanup: Reduce indentation by returning early 2021-04-29 10:46:55 -05:00
48b8b17da0 Merge branch 'blender-v2.93-release' 2021-04-30 01:43:04 +10:00
49a8b6bc4e Merge branch 'master' into refactor-idprop-ui-data 2021-04-29 10:09:20 -05:00
Pratik Borhade
9291128bff Clean-up: Edit and comments
- Corrected spellings
- Comments added and edited

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10991
2021-04-29 12:02:11 -03:00
bcf524328f Fix T87297: Gpencil - Disable Frames and Start delay when use Factor
After talking with the GP team, we agree in disable these options when the factor is used in Build modifier.
2021-04-29 17:01:39 +02:00
3e3363a6ed Merge branch 'blender-v2.93-release' 2021-04-30 00:59:52 +10:00
97923d9b98 GPencil: glow fx, add threshold value color mode
This patch adds a threshold value to the glow effect in color mode.
Currently, the threshold is hardcoded to 5%.
You can select a color and specify a higher threshold to include
similar colors in the effect.

Note: depends on D10670

Reviewed By: #grease_pencil, pepeland

Differential Revision: https://developer.blender.org/D10672
2021-04-29 16:50:21 +02:00
Himanshi Kalra
7134b9daca Added Operator tests: unsubdivide, shading, vertex connect and mark seam
Added tests for:
* Mark Seam
* Shade flat
* Shade smooth
* Unsubdivide
* Vertex Connect Path
* select nth (Checkered Deselect)

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

Updated blend file: tests/modeling/operators.blend

Reviewed By: zazizizou, mont29

Differential Revision: https://developer.blender.org/D10893
2021-04-29 20:15:11 +05:30
738a890025 Merge branch 'blender-v2.93-release' 2021-04-30 00:25:35 +10:00
9bdb2f5e0b Cleanup: Use BLI_findindex instead of loop 2021-04-29 16:04:50 +02:00
734c8f9a77 Merge branch 'blender-v2.93-release' 2021-04-29 16:00:05 +02:00
7627e0980d Merge branch 'blender-v2.93-release' 2021-04-29 23:57:42 +10:00
933de8201e Cleanup: Add float format 2021-04-29 15:45:03 +02:00
Cody Winchester
6a2bc40e01 Gpencil Offset Modifier - Add randomize offset options
This patch adds the Randomize options that exist in the Array modifier to the offset modifier.

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

{F9591325}

Differential Revision: https://developer.blender.org/D10171
2021-04-29 15:45:03 +02:00
4225a18b35 Function: add method to create shallow copy of virtual array
Creating a shallow copy is sometimes useful to get a unique ptr
for a virtual array when one only has a reference. It shouldn't
be used usually, but sometimes its the fastest way to do correct
ownership handling.
2021-04-29 15:42:32 +02:00
41945454f7 Correction to own previous commit: Add missing break
Small mistake in 88400f0c03.
Not having this break would be harmless, but we can avoid some unnecessary work
with it.
2021-04-29 13:37:06 +02:00
88400f0c03 Fix incorrect sorting in Asset Browser after renaming local asset
When renaming a data-block that is an asset, while the asset is visible in the
Asset Browser ("Current File" asset library), the list wouldn't re-sort items,
breaking the alphabetical sorting.
This was easily possible while changing the data-block name throught the Asset
Browser's sidebar, while in the "Current File" asset library.
2021-04-29 13:15:42 +02:00
4e10b196ac Functions: make copying virtual arrays to span more efficient
Sometimes functions expect a span instead of a virtual array.
If the virtual array is a span internally already, great. But if it is
not (e.g. the position attribute on a mesh), the elements have
to be copied over to a span.

This patch makes the copying process more efficient by giving
the compiler more opportunity for optimization.
2021-04-29 12:59:44 +02:00
Wannes Malfait
f903e3a3fd Fix build error: use of unintialized variable
Differential Revision: https://developer.blender.org/D11115
2021-04-29 14:49:19 +05:30
868c8e8617 Merge branch 'blender-v2.93-release' 2021-04-29 17:54:58 +10:00
b10649f27b Cleanup: unused variable, spelling 2021-04-29 17:22:26 +10:00
816fc5a308 Merge branch 'blender-v2.93-release' 2021-04-29 17:21:28 +10:00
737a1a85b4 Merge branch 'blender-v2.93-release' 2021-04-29 17:21:25 +10:00
4338595a97 Add break statement missing from 5cb1e18f72 2021-04-29 16:57:33 +10:00
4a2c92ea9c Merge branch 'blender-v2.93-release' 2021-04-29 16:24:10 +10:00
27370aef8f Cleanup: unused warning 2021-04-29 16:22:44 +10:00
d1e4f05734 Cleanup 2021-04-28 23:59:10 -05:00
eea8793205 Move versioning to versioning 300 2021-04-28 23:57:42 -05:00
a1cf09a202 Fix unecessary parantheses 2021-04-28 23:50:36 -05:00
dafd70d8a2 Merge branch 'master' into refactor-idprop-ui-data 2021-04-28 23:46:45 -05:00
14f59a0349 Merge branch 'blender-v2.93-release' 2021-04-28 18:27:47 -04:00
38ebac86cc Cleanup: Use const argument for context 2021-04-28 16:58:43 -05:00
5cb1e18f72 GPencil: Add Layer and Material to Blank objects
Instead to create only the Blank object, now a new Layer and a simple material is added.

This is a common request of artists.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D11110
2021-04-28 23:42:13 +02:00
baa51666ed Merge branch 'blender-v2.93-release' 2021-04-28 20:31:01 +02:00
1012e9bbfa Cleanup: Fix inconcistent array lengths in function declarations
In some cases functions were defined with arguments of different array
lengths in headers vs. implementations. This commit fixes some of the
cases I ran into, but probably not all of them.
2021-04-28 13:13:43 -05:00
cb09d34fde Merge branch 'blender-v2.93-release' 2021-04-28 17:22:55 +02:00
4273ec04be Cleanup: Add float format 2021-04-28 17:10:51 +02:00
YimingWu
f8f7c0ca6d GPencil: Fading based on distance to reference object in Opacity and Thickness modifiers
This patch allows you to dynamically control stroke's opacity and thickness using an object for distance reference in the modifier. Fading range is adjustable, and it is compatible with current curve/vertex group selection.

Reviewed By: #grease_pencil, antoniov, mendio

Maniphest Tasks: T82177, T80194

Differential Revision: https://developer.blender.org/D9091
2021-04-28 16:53:19 +02:00
67a52c8a40 Merge branch 'blender-v2.93-release' 2021-04-28 16:30:20 +02:00
Erik Abrahamsson
11dc674c78 Gpencil: Fix for SVG import arc and float errors
Fix for the Arc commands (A/a) to successfully parse the 4th and 5th arguments.
Fix for floats without a specified integer part, like `.123`

File for testing:
{F10042021}

Reviewed By: filedescriptor

Differential Revision: https://developer.blender.org/D11099
2021-04-28 15:53:12 +02:00
1b5b4b067e Spreadsheet: Add instance IDs from geometry set
Mostly the interesting information about the instances IDs whether they
are -1 or not, but it's still worth displaying them in the editor.
In the future when we can hide or show colums, we could decide to hide
this one by default.

Differential Revision: https://developer.blender.org/D11104
2021-04-28 08:22:10 -05:00
54c5835293 Merge branch 'blender-v2.93-release' 2021-04-28 15:08:19 +02:00
0b7bda808e Merge branch 'blender-v2.93-release' 2021-04-28 23:03:47 +10:00
85d4a733cf WM: quiet event warning when unknown keys are pressed 2021-04-28 22:31:23 +10:00
d71f96073f BLI: improve Vector.remove_and_reorder
The old version was correct as well but did a move even when not necessary.
2021-04-28 10:27:49 +02:00
8a41a12c71 Merge branch 'blender-v2.93-release' 2021-04-28 08:37:10 +02:00
Manuel Castilla
3d902b4b04 Fix Compositor: WorkScheduler task model deletes works
WorkScheduler task model deletes work packages after executing them. The other models don't do so. All models should handle packages the same way.

Reviewed By: #compositing, jbakker

Differential Revision: https://developer.blender.org/D11102
2021-04-28 08:35:31 +02:00
1128258c03 Merge branch 'blender-v2.93-release' 2021-04-28 16:09:19 +10:00
Tyler
a5bb028e78 Replace COM_DEBUG #define with constexpr. Fixes T87035
Reviewed By: jbakker

Maniphest Tasks: T87035

Differential Revision: https://developer.blender.org/D11068
2021-04-28 08:03:30 +02:00
1b6f655abe Merge branch 'blender-v2.93-release' 2021-04-27 23:38:49 -05:00
581f79e734 Merge branch 'blender-v2.93-release' 2021-04-28 13:37:17 +10:00
6a664cc945 UI: Change "Int" to "Integer" in enum item names
We shouldn't abbreviate words like this in the UI. "Int" is just a
programming term.
2021-04-27 19:49:22 -05:00
ac6f6d218c Merge branch 'blender-v2.93-release' 2021-04-27 21:42:31 +02:00
9cd9b35779 Fix T87816: Sculpt curve & line stroke hides dash settings
These settings are used though for these strokes (see
'paint_stroke_use_dash'), should be visible in the UI as well.

This was correctly added when dashing was introduced in rB15f82278d5d4
btw., but then messed up in rBfb74dcc5d69d.

Maniphest Tasks: T87816

Differential Revision: https://developer.blender.org/D11096
2021-04-27 21:20:01 +02:00
8a786fad01 Merge branch 'blender-v2.93-release' 2021-04-27 21:02:31 +02:00
eecaa59513 Fix: Self object missing from geometry nodes evaluator params
This was an oversight in the previous refactoring commit in this file.
2021-04-27 11:42:40 -05:00
4ddff574d7 Fix T87832: Incorrect FOV in line art when sensor fit is not Auto.
Reviewed by Sebastian Parborg

https://developer.blender.org/D11095
2021-04-27 22:34:20 +08:00
Stefan Werner
e714b3a1c3 Cycles: Removed unused macros.
These were leftovers from an earlier way of indexing textures.
2021-04-27 14:30:13 +02:00
3c269f01c3 Cleanup: clang format 2021-04-27 13:11:08 +02:00
908bb03630 Geometry Nodes: improve geometry nodes evaluator internal api
This is a first step towards T87620.
It should not have any functional changes.

Goals of this refactor:
* Move the evaluator out of `MOD_nodes.cc`. That makes it easier to
  improve it in isolation.
* Extract core input/out parameter management out of `GeoNodeExecParams`.
  Managing this is the responsibility of the evaluator. This separation of
  concerns will be useful once we have lazy evaluation of certain inputs/outputs.

Differential Revision: https://developer.blender.org/D11085
2021-04-27 13:03:40 +02:00
a022cffb72 Geometry Nodes: initial Attribute Transfer node
This is a first version of an Attribute Transfer node. It only supports two
modes for mapping attributes from one geometry to another for now.
More options are planned for the future.

Ref T87421.

Differential Revision: https://developer.blender.org/D11037
2021-04-27 12:56:13 +02:00
e240d94191 Merge branch 'blender-v2.93-release' 2021-04-27 12:35:48 +02:00
542f022afd Merge branch 'blender-v2.93-release' 2021-04-26 22:23:55 -05:00
77aac42fbc Cleanup: Make function static 2021-04-26 22:19:39 -05:00
2841d225a9 Merge branch 'blender-v2.93-release' 2021-04-26 22:17:00 -05:00
f5123b1fc9 Merge branch 'blender-v2.93-release' 2021-04-26 20:55:01 -04:00
676ef58a89 Cleanup: Fix unused variable warning in lite build 2021-04-26 17:03:06 -05:00
cb3ea6636e Merge branch 'blender-v2.93-release' 2021-04-26 17:02:15 -05:00
7e17dbfcf3 Cleanup: Move displist.cc to C++
This is a change split from the geometry nodes curves branch. Since
curve object modifier evaluation happens in this file, moving it to C++
will be quite helpful to support the `GeometrySet` type. Other than
that, the code in the branch intends to replace a fair amount of this
file anyway, so I don't plan to do any further cleanup here.

Differential Revision: https://developer.blender.org/D11078
2021-04-26 15:11:53 -05:00
e032ca2e25 Cleanup: Replace modifyVolume with modifyGeometrySet
This allows us to remove a callback from the modifier type info struct.
In the future the these modifiers might just be replaced by nodes
internally anyway, but in the meantime it's nice to unify the handling
of evaluated geometry a bit.

Differential Revision: https://developer.blender.org/D11080
2021-04-26 14:42:03 -05:00
a7bda03516 Fix T87842: Outliner in Blender File mode has large performance impact
The Outliner was doing a full rebuild of its tree in response to transform
notifiers. I don't see any reason for this, a simple redraw without rebuilding
should be just fine.
The same optimization could be done for other object notifiers, but I'll check
on them separately.
2021-04-26 19:30:31 +02:00
607cd463b3 Merge branch 'blender-v2.93-release' 2021-04-26 19:21:24 +02:00
eb0d680851 Merge branch 'blender-v2.93-release' 2021-04-26 18:05:10 +02:00
c266632ff6 LineArt: UI fixes to match the content for 2.93 manual.
Reviewed by: Sebastian Parborg

Differential Revision: https://developer.blender.org/D11089
2021-04-26 23:40:46 +08:00
d89d53b453 Merge branch 'blender-v2.93-release' 2021-04-26 16:44:06 +02:00
bac9562f15 Cleanup: spelling 2021-04-26 22:58:35 +10:00
8f03c9b19a Cleanup: compiler warning 2021-04-26 22:58:35 +10:00
e12a8aedce Cleanup: remove use of deprecated uint32, utin16 types 2021-04-26 22:58:35 +10:00
94960250b5 Cycles: Fix build with OptiX 7.3 SDK 2021-04-26 14:55:39 +02:00
d7c762d2f7 Cleanup: Rearrange the functions in 'transform_convert_mesh.c'
The creation of `TransCustomData` is best located at the beginning of the
file as it is a specific struct of the file and can be used a lot locally.
2021-04-26 09:35:03 -03:00
9b64927a8a Merge branch 'blender-v2.93-release' 2021-04-26 09:16:53 +02:00
c63142ca8f Remove print during compilation. 2021-04-26 07:52:46 +02:00
a200a8cf59 Cleanup: inconsistent naming for screen editing variables & args 2021-04-26 13:47:04 +10:00
36c4b79c30 Merge branch 'blender-v2.93-release' 2021-04-25 21:45:02 -05:00
Pratik Borhade
5341482064 Fix T87777: Fix typo in Prefs Scripts Dir tooltip
Correction to Prefs tooltip mention of 'add-ons' folder in Scripts Dir.

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

Reviewed by Harley Acheson
2021-04-25 18:39:32 -07:00
c76141e425 UI: Adding Constraint to the Area Join Operations
Removing mid-operation area re-targeting for safety and predictability.

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

Reviewed by Campbell Barton
2021-04-25 17:55:00 -07:00
c204e0c385 Fix T87170 Multi-Input socket activation zone error with lots of inputs
Calculation of bounding rect for multi-input socket was wrong.

 Reviewer: Hans Goudey (HooglyBoogly)

 Differential Revision: https://developer.blender.org/D11077
2021-04-25 23:32:41 +02:00
16b2b33d01 BLI: Add "first" method to MutableSpan and Vector
This is convenient because having a uniform interface is nice, and
because of the similarity to "last".

Differential Revision: https://developer.blender.org/D11076
2021-04-25 15:06:38 -05:00
20142b0823 Merge branch 'blender-v2.93-release' 2021-04-25 18:40:04 +02:00
ae58db91a2 Fix T87799: Crash when switching to Info Editor
Use of uninitialized variable.

Problem introduced in 87a70801c6.
2021-04-25 10:41:28 -03:00
87a70801c6 Fix build issue due to previous commit
Revert in rB05dddb71b098 did a poor job and left some
rubbish.
2021-04-24 18:18:43 -06:00
05dddb71b0 Revert "Info Editor: move to c++"
This reverts commit 9cce18a585.

rB9cce18a5858c broke the build in unforeseen ways, not easily fixable.
revert for now, so master will at least build again.
2021-04-24 18:14:15 -06:00
3a6f481d5a Fix windows build: Don't use designated initializers in C++
Removes a cast in an argument followed by an initializer list, and
designated initializers, which are only part of the C++20 standard.
2021-04-24 14:15:57 -05:00
c96f9bd340 Fix T87682 Boolean Exact crash.
The triangulator I made (using CDT) doesn't work if the face
self-intersects. Fall back to the polyfill triangulator when
that happens.
2021-04-24 14:48:44 -04:00
9cce18a585 Info Editor: move to c++
I'm currently doing some experiments in the info editor and
for that it is easier if the info editor is in c++ already.
2021-04-24 17:00:37 +02:00
82328797cf Cleanup: Remove unused flag 2021-04-24 11:46:41 -03:00
b6542f71e1 Cleanup/Refactor: Unify similar flags 2021-04-24 11:46:41 -03:00
f8d5d03ebc Cleanup/Refactor: Move FOREACH_TRANS_DATA_CONTAINER to outside of some functions
So we can reuse the same loop for different corrections.
2021-04-24 11:46:07 -03:00
b06d9069ad Cleanup: Add a common prefix for some transform functions 2021-04-24 11:46:06 -03:00
c2a0ca622b Cleanup: Move transform recaldata functions to their respective files 2021-04-24 11:35:05 -03:00
536a2fe7cc Cleanup: Add a common prefix for some transform functions 2021-04-24 11:35:05 -03:00
86ff35c7fc Merge branch 'blender-v2.93-release' 2021-04-24 23:52:15 +10:00
17fca62fff Merge branch 'blender-v2.93-release' into master 2021-04-24 01:55:49 +05:30
2e513afe80 GPencil: Fix unreported reproject error
This bug was introduced in e1acefd45e
2021-04-23 17:42:56 +02:00
e4cebec647 GPencil: Add Multiframe support to Move to Layer
Reviewed By: mendio

Maniphest Tasks: T87426

Differential Revision: https://developer.blender.org/D11013
2021-04-23 17:27:27 +02:00
be68d00c36 GPencil: Change maximum value for Fill precission
The old value of 5 was not enough for some situations.
2021-04-23 16:58:40 +02:00
17afa86336 Merge branch 'blender-v2.93-release' 2021-04-23 09:56:50 -05:00
8aa8537632 VSE: reset strip transform with "Set Render Size" operator
Reset the active strip offset and scale, in the "Set Render Size"
operator (`SEQUENCER_OT_rendersize`). This ensures that the active strip
will actually fit the new render size, which is what the operator is
intended to achieve.
2021-04-23 16:39:21 +02:00
5e509f966f Cleanup: VSE, reduce cognitive complexity of sequencer_rendersize_exec()
Reduce the cognitive complexity of the `sequencer_rendersize_exec()`
function by flipping some conditions and returning early.

No functional changes.
2021-04-23 16:28:37 +02:00
23185262ab Cleanup: clang-format 2021-04-24 00:03:14 +10:00
877711e9e4 Cleanup: use const arguments, reduce right shift 2021-04-24 00:02:44 +10:00
8adeac7c27 Merge branch 'blender-v2.93-release' 2021-04-23 14:35:40 +02:00
361579c86a Merge branch 'blender-v2.93-release' 2021-04-23 13:09:41 +02:00
4cb8438e08 Geometry Nodes: warn when output attribute has not been saved 2021-04-23 12:44:59 +02:00
f8e1526fa6 Fix T87661: Attribute Combine XYZ node can't overwrite existing attribute 2021-04-23 12:44:21 +02:00
ffa8563429 Merge branch 'blender-v2.93-release' 2021-04-23 10:17:25 +02:00
Jagannadhan Ravi
425e19bc1f Modifiers: Performance Simple Deformation
Use multiprocessing with simple deform modifiers.

Master 2.92 fps this patch 3.13 fps on Ryzen 1700X With Vega 64 GPU.

3970X: 2.85 fps -> 2.95 fps
3990X: 3.15 fps -> 3.41 fps
3995WX: 3.21 fps -> 3.38 fps

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D10609
2021-04-23 10:07:06 +02:00
cfa20ff03b Fix T86566: Do Not Close if File Cannot Be Saved
If saving a file using CloseSave dialog, do not close if there is an error doing so, like if read-only.

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

Reviewed by Julian Eisel
2021-04-22 20:08:17 -07:00
8b049e4c2a UI: Join or Close Any Screen Area
Corner action zones allow joining any neighbors. New 'Area Close' operator. Improved Header Context Menu.

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

Reviewed by Campbell Barton
2021-04-22 19:57:49 -07:00
5a33965627 Merge branch 'blender-v2.93-release' 2021-04-23 11:33:22 +10:00
76fcf58cdd Merge branch 'blender-v2.93-release' 2021-04-23 10:02:46 +10:00
47892d6695 Fix too big grid plane for Add Object tool on Retina displays
The grid plane was drawn too big on retina displays compared to other screens,
because the factor was multiplied by the native pixel-size, which is 2 for
Retina displays.
2021-04-22 19:45:44 +02:00
6ebe0b8cf0 Assets: Correct name of own recently added BPY functions
Makes the functions (introduced in 557b3d2762) follow existing naming
conventions for the API.

Changes:
`bpy.types.ID.mark_asset` to `bpy.types.ID.asset_mark`
`bpy.types.ID.clear_asset` to `bpy.types.ID.asset_clear`
2021-04-22 19:26:09 +02:00
bbb52a462e Fix T87688: Crash entering valid text into number field
When the user entered a driver expression like `#frame` into a number
field, Blender would crash sometime after. This is because
e1a9ba94c5 did not handle this case properly and ignored the fact
that the user can enter text into the field.

The fix makes sure that we only cancel if the value is a *number* equal
to the previous value in the field.

Note that this could also be handled by `ui_but_string_set` which would
be a bit nicer potentially. However, I was unable to find a clean way of
passing `data->startvalue` into that function. `uiHandleButtonData` is
only known locally inside `interface_handlers.c`.

Reviewed By: Severin

Maniphest Tasks: T87688

Differential Revision: https://developer.blender.org/D11049
2021-04-22 19:02:48 +02:00
d1ccc5b969 Geometry Nodes: Add initializer for attribute creation
Previously we always had to set attribute values after creating
the attribute. This patch adds an initializer argument to
`attribute_try_create` which can fill it in a few ways, which
are explained in code comments.

This fixes T87597.

Differential Revision: https://developer.blender.org/D11045
2021-04-22 09:20:03 -05:00
9fccbe2d13 Fix missing include 2021-04-22 10:09:15 -03:00
b9a7b40924 Geometry Nodes: Get attribute domain and type without allocation
Because we use virtual classes (and for other reasons), we had to do a
small allocation when simply retrieving the data type and domain of an
existing attribute. This happened quite a lot actually-- to determine
these values for result attributes.

This patch adds a simple function to retrieve this meta data without
building the virtual array. This should lower the overhead of every
attribute node, though the difference probably won't be noticible
unless a tree has very many nodes.

Differential Revision: https://developer.blender.org/D11047
2021-04-22 08:05:02 -05:00
f6efacfec7 Merge branch 'blender-v2.93-release' 2021-04-22 09:58:52 -03:00
c3701e2303 Merge branch 'blender-v2.93-release' 2021-04-22 14:26:29 +02:00
8c146d5efc Merge branch 'blender-v2.93-release' 2021-04-22 12:49:34 +02:00
1095d5964d Cleanup: doversion for 3.0 is using FileData 2021-04-22 12:19:01 +02:00
7192ab614b Animation: add "LocRotScaleCProp" keying set
Add a keying set that includes location, rotation, scale, and custom
properties.

The keying set is intentionally not based on the "Whole Character"
keying set. Instead, it is generic enough to be used in both object and
pose animation, making it possible to quickly switch between animating
characters and props without switching keying sets.

This is, according to @rikkert, what the Blender Studio animators need
99.9% of the time.
2021-04-22 10:33:07 +02:00
91c652e39a Fix: Deactivate audio settings when output is None 2021-04-22 10:23:02 +02:00
33d9a0c951 Merge branch 'blender-v2.93-release' 2021-04-22 16:33:37 +10:00
a4bd0fcabf Merge branch 'blender-v2.93-release' 2021-04-22 08:25:40 +02:00
48c5129d1f Fix errors in Buffer.dimensions setter
- Error accessing the length from a sequence.
- Error comparing a boolean to -1.

Issues introduced in 19360c2c1c
2021-04-22 12:34:26 +10:00
932b23782a Merge branch 'blender-v2.93-release' 2021-04-21 17:15:46 -03:00
19360c2c1c Python GPU Buffer: Add a 'setter' to Buffer.dimensions
The attribute `Buffer.dimensions` does not need to be readonly.
2021-04-21 17:07:11 -03:00
ef9551afd1 Merge branch 'blender-v2.93-release' 2021-04-21 18:00:26 +02:00
3da74c1c18 Geometry Nodes: add method to get attribute by name and type
This is needed by the upcoming Attribute Transfer node. It changes
its behavior based on what domain the attribute is on.
2021-04-21 17:07:00 +02:00
1dd17726f2 Geometry Nodes: extract mesh surface sampling functions to separate file 2021-04-21 17:02:19 +02:00
d5309bf4cf Functions: add slice method for generic spans 2021-04-21 16:59:22 +02:00
b9cbf7fc80 Geometry Nodes: add utility to convert CPPType to static type 2021-04-21 16:57:43 +02:00
9fa9854e2a Merge branch 'blender-v2.93-release' 2021-04-21 16:22:40 +02:00
7aa6444a65 UI: Use proper close file dialog for "Restore Last Session"
Was showing a simple confirm dialog, even if the file didn't contain
unsaved changes. The confirm dialog would also show up when choosing
"Restore Last Session" from the splash screen right after startup, which
is weird.

Instead show the proper file closing dialog that allows saving, but only
if there are actually unsaved changes.
2021-04-21 15:18:05 +02:00
e9e2805573 Cleanup: Deduplicate file closing dialog logic
Was doing almost the same thing in two places, plus I need the same for
a third case. So better have a helper function for it.
2021-04-21 15:18:05 +02:00
0b458e8322 Cleanup: Create/use types for generic WM callbacks
Makes it less of a hassle to pass these callbacks around as function
arguments, and deduplicates their signature when doing so.
2021-04-21 15:18:05 +02:00
2e3f072d5d Merge branch 'blender-v2.93-release' 2021-04-21 13:14:26 +02:00
183e3f6bb9 Fix T86968: Last UV factor in cyclic strokes
The UV factor of the last point of a cyclic stroke was using the factor of
the first point leading to unwanted scaling artifacts.

The fix sets the uv factor of the last point to the currect value (last UV
factor + length between last and first point).

Reviewed By: antoniov, fclem

Maniphest Tasks: T86968

Differential Revision: https://developer.blender.org/D10850
2021-04-21 12:16:32 +02:00
d17bff849d Merge branch 'blender-v2.93-release' 2021-04-21 11:19:57 +02:00
5fe3d2dc7d Merge branch 'blender-v2.93-release' 2021-04-21 11:05:40 +02:00
79d2f2c2f9 Merge branch 'blender-v2.93-release' 2021-04-21 17:43:55 +10:00
f9867c1f11 Merge branch 'blender-v2.93-release' 2021-04-21 17:43:51 +10:00
3003fbbecf Merge branch 'blender-v2.93-release' 2021-04-21 13:48:10 +10:00
c5cabb6eb7 Correction to previous commit: Avoid unnecessary notifier
Not a big deal, but nice to avoid notifiers when no change was done.
2021-04-20 22:43:43 +02:00
557b3d2762 Assets: Add BPY function to mark and clear assets
Adds `mark_asset()` and `clear_asset()` to ID data-blocks, e.g.
`bpy.context.active_object.mark_asset()`. They essentially do the same as the
mark and clear asset operators.

Scripts are generally discouraged from using operators where possible, but we
need to provide API functions to use instead. In this case it means scripts
don't have to override context to pass an ID to the operator.
2021-04-20 22:36:48 +02:00
847579b422 Add support for building on Linux aarch64
Differential Revision: https://developer.blender.org/D10958
2021-04-20 18:45:46 +02:00
f2626f1420 Merge branch 'blender-v2.93-release' 2021-04-20 17:45:36 +02:00
f1b61f5e7d Core: Add do_versions file for 3.0
Differential Revision: https://developer.blender.org/D11030
2021-04-20 17:13:20 +02:00
e2af5030b9 Cleanup: comments
- Restore comment removed by accident in
  8c5c55b8c9
- Use doxygen syntax.
2021-04-21 00:51:27 +10:00
2c1a2c9a99 Merge branch 'blender-v2.93-release' 2021-04-21 00:21:29 +10:00
eca5cf1460 Cleanup: keying sets, move common code to mix-in class
Move code common to the Whole Character keying sets ("Whole Character" and
"Whole Character (Selected Bones Only)" into a mix-in class. This avoids
the need to use direct assignments like
`poll = BUILTIN_KSI_WholeCharacter.poll`.

No functional changes.
2021-04-20 15:52:43 +02:00
26d778cd8a Cleanup: keying sets, use self as self-parameter
Use `self` as self-parameter of methods, instead of the non-standard and
cryptic `ksi`.

No functional changes.
2021-04-20 15:52:43 +02:00
e1a9ba94c5 Fix T87637: Dragging button value cancel not working
Dragging a number button, then holding the value and pressing escape
would not reset the value correctly.
This was because eb06ccc324 assumed that `data->value` and
`data->startvalue` were set during dragging which they are not.

The fix moves the if statement into the section where we check if a
number was entered (number edit) making sure that we only cancel
if the button was in "string enter" mode and that the value entered
was the same as before.

Reviewed By: HooglyBoogly, Severin

Maniphest Tasks: T87637

Differential Revision: https://developer.blender.org/D11021
2021-04-20 15:46:52 +02:00
7834fcc67d Merge branch 'blender-v2.93-release' 2021-04-20 11:19:43 +02:00
b2c6eb8640 Merge branch 'blender-v2.93-release' 2021-04-20 11:02:29 +02:00
2efd3509ee Merge branch 'blender-v2.93-release' 2021-04-20 10:06:30 +02:00
8c0f7d1772 Geometry Nodes: support geometry nodes modifier on volume objects
Differential Revision: https://developer.blender.org/D11011
2021-04-20 09:30:53 +02:00
5d2ec2bc08 Cleanup: clang tidy readability-inconsistent-declaration-parameter-name 2021-04-20 09:25:15 +02:00
8c5c55b8c9 Cleanup: uiBut.flag had an internal flag out of the documented range
Increase range of internal flags & order UI_SEARCH_FILTER_NO_MATCH
within this range, so public button flags aren't accidentally added
that overlap with internal flags.
2021-04-20 15:44:21 +10:00
5e82e77112 Cleanup: remove redundant code/comments from BKE_mesh_nomain_to_mesh 2021-04-20 15:28:27 +10:00
b760481f8d Merge branch 'blender-v2.93-release' 2021-04-20 15:21:25 +10:00
7ccd19fc12 PyAPI: update docs to include poll_message_set reference
Part of D9738
2021-04-20 12:29:04 +10:00
ebe04bd3ca PyAPI: support Operator.poll functions 'disabled' hint
Python scripts can now define the reason it's poll function fails using:

`Operator.poll_message_set(message, ...)`

This supports both regular text as well as delaying message creation
using a callback which should be used in situations where constructing
detailed messages is too much overhead for a poll function.

Ref D11001
2021-04-20 12:07:01 +10:00
985ccba77c Cleanup: add CTX_wm_operator_poll_msg_clear
Call this function instead of `CTX_wm_operator_poll_msg_set(C, NULL)`
2021-04-20 11:42:00 +10:00
795f024558 Merge branch 'blender-v2.93-release' 2021-04-19 22:49:14 +02:00
2d1d6fbb23 Merge branch 'blender-v2.93-release' 2021-04-19 21:07:42 +02:00
d1fbf1599f Cycles: include more transparency and emission in fast GI approximation
For indirect light rays, don't assume any hit is opaque, rather if it has
transparency or emission do the shading but don't do any further bounces.

Naturally this is slower when there are transparent surfaces, however
without this cutout opacity doesn't give sensible results.

Differential Revision: https://developer.blender.org/D10985
2021-04-19 21:07:40 +02:00
b42454be8b Cleanup: move BVH utility functions into own file 2021-04-19 21:07:34 +02:00
68cbf0a2be Cleanup: Clang tidy, clang format 2021-04-19 13:48:25 -05:00
c13b3dd168 Merge branch 'blender-v2.93-release' 2021-04-19 12:32:14 -05:00
2dc5961874 Merge branch 'blender-v2.93-release' 2021-04-19 12:25:45 -05:00
458cbcbfea Merge branch 'blender-v2.93-release' 2021-04-19 11:12:42 -05:00
8032bd98d8 GPencil: Add Layer Mask ordering buttons
Now the list of masks can be ordered as is done in Layers.

This can be used to organize list and in the future refquired for new masking options.
2021-04-19 17:44:40 +02:00
f99f884444 GPencil: Rename Draw" mode to Draw Mode` 2021-04-19 17:12:39 +02:00
feedf28549 Changes missed from 4402c2324b 2021-04-20 00:25:54 +10:00
4402c2324b Cleanup: use 'wmOperator.ptr' in draw functions
Draw functions used RNA_pointer_create to create the pointer,
however this already exists in the operator.
2021-04-20 00:14:37 +10:00
e1acefd45e GPencil: Add multiframe support to Reproject operator
Before only active frame was supported

Related to T87425
2021-04-19 15:58:41 +02:00
46a13482cb Cleanup: spelling 2021-04-19 23:56:12 +10:00
33440760a6 Merge branch 'blender-v2.93-release' 2021-04-19 23:54:06 +10:00
eb06ccc324 Fix T87448: Avoid uiBut update if value was same
Previously, clicking into a number field, changing nothing and then
clicking outside the field again would trigger an update (RNA prop
would be set to the same value again). This could potentially cause
an expensive operation (like a modifer) to run again, even if all the
parameters were identical.

The fix prevents this by treating unchanging values in the field as a
cancel operation.

Reviewed By: Severin

Maniphest Tasks: T87448

Differential Revision: https://developer.blender.org/D10976
2021-04-19 12:20:05 +02:00
Eitan
799f532f46 Geometry Nodes: new Switch node
This is a first iteration of a switch node. It can only switch between
two inputs values based on a boolean. A more sophisticated switch
node that has an integer selector will probably come later.

Currently, the geometry nodes evaluator does not support lazy evaluation
of individual inputs. Therefore, all inputs will be computed currently.
An improvement to the evaluator will be worked on separately.

Ref: T85374

Differential Revision: https://developer.blender.org/D10460
2021-04-19 10:38:50 +02:00
112fb77157 Merge branch 'blender-v2.93-release' 2021-04-19 17:36:59 +10:00
1d96493c2f Merge branch 'blender-v2.93-release' 2021-04-19 17:36:56 +10:00
969cc22a89 Merge branch 'blender-v2.93-release' 2021-04-19 17:36:54 +10:00
eae39a4973 Merge branch 'blender-v2.93-release' 2021-04-19 17:36:51 +10:00
0af28f007f Cleanup: Rename variables to indicate what is evaluated
`ob` --> `ob_eval`
`me` --> `me_eval`
`em` --> `em_eval`
2021-04-19 00:24:43 -03:00
950d8360f8 Fix typo in previous commit
`has_loose_edge` -> `has_loose_vert`
2021-04-18 20:45:06 -03:00
1825e67dea Transform Snap Object: Improve code that detects updates
The previous code had unclear hacks to avoid updating while transforming,
it was also duplicated in two functions causing an inconsistent
initialization of the looptris bvhtree (which could even generate
unpredictable snapping results).

Now, detection update and inicializatiom of common members are contained in
`snap_object_data_mesh_get` and `snap_object_data_editmesh_get`.

Also, the "Hack to avoid updating while transforming" is more evident.
2021-04-18 20:07:05 -03:00
c8dd684b65 Cleanup: Use utility to init userdata in 'transfrom_snap_object.c'
This deduplicates the code making it easier to edit.
2021-04-18 20:07:05 -03:00
6879868814 Merge branch 'blender-v2.93-release' 2021-04-18 20:06:32 -03:00
9a69653b42 Merge branch 'blender-v2.93-release' 2021-04-18 11:59:36 -05:00
76eae59648 Cleanup: make format 2021-04-18 09:51:03 +02:00
01448ee7ce Cleanup: clang tidy readability-else-after-return 2021-04-18 09:49:14 +02:00
8d30a7a1cf Merge branch 'blender-v2.93-release' 2021-04-17 17:13:12 -03:00
1544bcfc37 Measure Tool: Snap to Cage Geometry
For Measure tool, it is more useful to snap to what is really visible.

So use the cage instead of the geometry that may be hidden with Bmesh.
2021-04-17 16:51:19 -03:00
4e1507bd3b Snap Gizmo Refactor: Implement options for the gizmo behavior
The Snap Gizmo now has options for occlusion, selection filter and edit
geometry.

It will be useful to implement in current tools.
2021-04-17 16:51:19 -03:00
1fc446a908 Fix recent snap refactor
It is important to check if editmesh eval cage is also bmesh.
2021-04-17 16:50:49 -03:00
aca9a1bac3 Transform Snap Refactor: Use enum for cage snap options
This allows the addition of the `SNAP_GEOM_CAGE` option.
Currently unused.
2021-04-17 15:45:08 -03:00
ebcf49fe1a Merge branch 'blender-v2.93-release' 2021-04-17 14:22:57 -04:00
3516ee5a14 Merge branch 'blender-v2.93-release' 2021-04-17 19:23:12 +02:00
1a010450bc BLI: add unit tests for recently added methods 2021-04-17 19:06:48 +02:00
eff2b89446 BLI: support multiple parameters in Stack.push_as 2021-04-17 19:06:48 +02:00
686452fb1b BLI: add Vector.append_as method
This method is similar to `std::vector::emblace_back` in that it constructs
the new object inplace in the vector, removing the need for a move.

The `_as` suffix is consistent with similar behavior in Map and Set data structures.
2021-04-17 19:06:48 +02:00
e4990a5658 Fix wrong logic used in 'ED_view3d_depth_read_cached'
It is important to limit the pixels read on `BLI_array_iter_spiral_square`.

Fortunately `ED_view3d_depth_read_cached` was not being called with a
`margin` parameter.

Wrong logic introduced in rB44c76e4ce310.
2021-04-17 13:52:31 -03:00
d0d85742fc BLI: support multiple arguments for value in *_as methods of Map
This allows us to build more complex values in-place in the map.
Before those values had to be build separately and then moved into the map.

Existing calls to the Map API remain unchanged.
2021-04-17 18:39:35 +02:00
5cf6f570c6 Geometry Nodes: use virtual arrays in internal attribute api
A virtual array is a data structure that is similar to a normal array
in that its elements can be accessed by an index. However, a virtual
array does not have to be a contiguous array internally. Instead, its
elements can be layed out arbitrarily while element access happens
through a virtual function call. However, the virtual array data
structures are designed so that the virtual function call can be avoided
in cases where it could become a bottleneck.

Most commonly, a virtual array is backed by an actual array/span or
is a single value internally, that is the same for every index.
Besides those, there are many more specialized virtual arrays like the
ones that provides vertex positions based on the `MVert` struct or
vertex group weights.

Not all attributes used by geometry nodes are stored in simple contiguous
arrays. To provide uniform access to all kinds of attributes, the attribute
API has to provide virtual array functionality that hides the implementation
details of attributes.

Before this refactor, the attribute API provided its own virtual array
implementation as part of the `ReadAttribute` and `WriteAttribute` types.
That resulted in unnecessary code duplication with the virtual array system.
Even worse, it bound many algorithms used by geometry nodes to the specifics
of the attribute API, even though they could also use different data sources
(such as data from sockets, default values, later results of expressions, ...).

This refactor removes the `ReadAttribute` and `WriteAttribute` types and
replaces them with `GVArray` and `GVMutableArray` respectively. The `GV`
stands for "generic virtual". The "generic" means that the data type contained
in those virtual arrays is only known at run-time. There are the corresponding
statically typed types `VArray<T>` and `VMutableArray<T>` as well.

No regressions are expected from this refactor. It does come with one
improvement for users. The attribute API can convert the data type
on write now. This is especially useful when writing to builtin attributes
like `material_index` with e.g. the Attribute Math node (which usually
just writes to float attributes, while `material_index` is an integer attribute).

Differential Revision: https://developer.blender.org/D10994
2021-04-17 16:41:39 +02:00
4dca44086f Merge branch 'blender-v2.93-release' 2021-04-17 15:40:22 +02:00
3608891282 Functions: extend virtual array functionality
This adds support for mutable virtual arrays and provides many utilities
for creating virtual arrays for various kinds of data. This commit is
preparation for D10994.
2021-04-17 15:13:20 +02:00
e524a6ecf7 Snap Gizmo: Improve event comparison code
Better distinction between modifier key events and mouse position events.

No functional changes.
2021-04-16 14:44:10 -03:00
fc37b265c8 Merge branch 'blender-v2.93-release' 2021-04-16 11:42:36 -05:00
7eda4cde71 Merge branch 'blender-v2.93-release' 2021-04-16 18:00:38 +02:00
cf6d10ef46 Merge branch 'blender-v2.93-release' 2021-04-16 17:44:36 +02:00
537460b86d Merge branch 'blender-v2.93-release' 2021-04-17 01:32:28 +10:00
c7a8bcfa37 Merge branch 'blender-v2.93-release' 2021-04-17 00:21:30 +10:00
bfc0f483c6 Merge branch 'blender-v2.93-release' 2021-04-16 23:53:04 +10:00
7aa38de085 Merge branch 'blender-v2.93-release' 2021-04-16 22:14:56 +10:00
0edfa5350e Merge branch 'blender-v2.93-release' 2021-04-16 22:14:53 +10:00
be34d14575 Merge branch 'blender-v2.93-release' 2021-04-16 13:46:21 +02:00
45eafd6562 Merge branch 'blender-v2.93-release' 2021-04-16 15:10:57 +10:00
073ef4d265 Merge branch 'blender-v2.93-release' 2021-04-16 15:10:52 +10:00
cb4646a6df Merge branch 'blender-v2.93-release' 2021-04-16 12:20:38 +10:00
0567f2b0bb Merge branch 'blender-v2.93-release' 2021-04-15 23:15:24 -03:00
62bff15377 Fix various Blender 3.0 versioning issues
This changes the following items:

- package name is now `blender-3.0.0-git.09eb04c0a865-windows64`
  rather than `blender-3.00.0-git.09eb04c0a865-windows64`
- Fix version resource for blender.exe not building
- Data directories are now `3.0\...` rather than `3.00\....`
- User prefs are now in:
  `c:\Users\users\AppData\Roaming\Blender Foundation\Blender\3.0\`
  rather than:
  `c:\Users\users\AppData\Roaming\Blender Foundation\Blender\3.00\`
- Updating startup & preferences from previous release
  has a special exception for 3.0 to check for 3.93 and older.

See T87532

Ref D10986
2021-04-16 11:23:34 +10:00
ec241eb0d0 Merge branch 'blender-v2.93-release' 2021-04-15 19:14:23 +02:00
09eb04c0a8 Merge branch 'blender-v2.93-release' 2021-04-15 17:26:18 +02:00
ced26bacb7 Merge branch 'blender-v2.93-release' 2021-04-15 09:17:12 -05:00
27005f58c5 Blender Python version string to use the new version number system 2021-04-15 16:01:50 +02:00
bd8fd78b40 Merge branch 'blender-v2.93-release' 2021-04-15 15:52:44 +02:00
6e39da7948 Blender 3.0 version bump
Blender 3.0 is now in bcon1 (alpha).

There are likely a few places in Blender and the automated building pipeline
that may fail since we are switching our versioning number system.

For example, at the moment the splash and the status bar are showing
3.00.0, and it should show 3.1.0.

I suspect the Python API, version used to report a bug, buildname, are
all wrong too. These will be handled later.
2021-04-15 15:42:41 +02:00
61c3d7aa2c Bump subversion before starting the next release cycle 2021-04-15 15:32:17 +02:00
bba8ec2367 Fix "has properties" check 2021-03-13 09:05:48 -05:00
d785ee3a98 Merge branch 'master' into refactor-idprop-ui-data 2021-03-13 09:04:54 -05:00
927bec3fba Fix incorrect PyArg_ParseTuple argument 2021-03-10 12:34:39 -05:00
6d51bb8efe Use default consistently instead of default_value 2021-03-10 11:59:39 -05:00
6c596cde06 Merge branch 'master' into refactor-idprop-ui-data 2021-03-10 11:53:39 -05:00
5849aba1e3 Rename functions as Sybren suggests 2021-03-08 22:41:03 -05:00
b608a0195f Merge branch 'master' into refactor-idprop-ui-data 2021-03-08 22:30:32 -05:00
66350caeec Add more tests 2021-01-13 23:14:29 -06:00
80a8cdbab0 Fix keyword argument 2021-01-13 22:58:04 -06:00
39e3bd87a0 Update for changes in MOD_nodes.cc 2021-01-13 22:39:10 -06:00
a4f5e84c33 Merge branch 'master' into refactor-idprop-ui-data 2021-01-13 21:55:46 -06:00
1047713bbe Add some basic tests for float UI data and copying UI data 2021-01-11 23:56:19 -06:00
4c406f7c45 Fix inverted source and destination groups in api function 2021-01-11 23:55:59 -06:00
9a52428ebe Fix limits 2021-01-11 23:16:47 -06:00
704c9b25dd Merge branch 'master' into refactor-idprop-ui-data 2021-01-11 22:55:38 -06:00
2e199fc2c5 More testing stuff, it fails 2021-01-11 08:01:10 -06:00
378b19233e Move some functions to idprop.c 2021-01-10 14:28:51 -06:00
74c77c887b Improve function naming 2021-01-10 13:58:03 -06:00
334a31fe19 Fix off by one error 2021-01-10 13:49:07 -06:00
6c981f2d73 Merge branch 'master' into refactor-idprop-ui-data 2021-01-10 13:47:37 -06:00
a8c8400342 Starting the unit tests 2021-01-05 09:56:37 -06:00
113ac52701 Remove asserts in versioning and use non type specific reading 2021-01-04 22:14:23 -06:00
4f4fdc11cd Fix errors in docstrings and make indentation consistent 2021-01-04 19:30:04 -06:00
d5a51c1376 Fix typo in error message 2021-01-04 19:23:52 -06:00
40f0b2d5ef Use int_from_py_int_or_double function 2021-01-04 19:22:55 -06:00
7af42f70f9 Rename check_ui_data_value to pyobject_can_convert_to_number 2021-01-04 19:21:16 -06:00
f7cec43e7d Support booleans as inputs for UI data 2021-01-04 19:19:44 -06:00
61bda1952c Add NULL check in string default access 2021-01-04 19:01:40 -06:00
08ea54f42e Add a max_len argument to RNA_property_string_get_default 2021-01-04 18:58:39 -06:00
7832003229 Fix incorrect type check in assert 2021-01-04 18:43:53 -06:00
e841acfa79 Remove extraneous line breaks 2021-01-04 18:43:20 -06:00
81a293b984 Add check for property type that doesn't support UI data 2021-01-04 18:41:51 -06:00
54eef5a9b0 Use int to store precision 2021-01-04 18:41:05 -06:00
8b9fd2a417 Fix spacing in comment 2021-01-04 18:40:30 -06:00
1a489fce83 Create UI data in rna_data() if it doesn't exist 2021-01-04 17:54:31 -06:00
872f5a0b2a Merge branch 'master' into refactor-idprop-ui-data 2021-01-04 17:49:56 -06:00
257fd605e2 Remove versioning for IDProperty groups not exposed to the UI 2020-12-28 15:16:23 -06:00
799422bb1c Merge branch 'master' into refactor-idprop-ui-data 2020-12-28 15:02:13 -06:00
fb324f6370 Fix for "use_soft_limits" 2020-12-22 12:23:49 -06:00
897fdb9b58 Fix build error 2020-12-22 11:20:50 -06:00
ea2387e7cb Merge branch 'master' into refactor-idprop-ui-data 2020-12-22 11:13:22 -06:00
e860c129a8 Merge branch 'master' into refactor-idprop-ui-data 2020-12-16 20:35:31 -06:00
351fd68e20 Fix crash, remove debug prints 2020-12-16 07:49:39 -06:00
63a0d6ab3d Add function to copy RNA UI data from one group's properties to another's 2020-12-15 21:19:26 -06:00
b30a0ce808 Remove use of "_RNA_UI" 2020-12-15 21:18:42 -06:00
90d2fe54b8 Add IDP_ui_data_type helper function, use switch statements 2020-12-15 16:34:47 -06:00
9aa7d11146 Small bug fix 2020-12-15 14:41:38 -06:00
21c240c1e7 Adjust comment 2020-12-15 12:51:02 -06:00
10888eb8ad Merge branch 'master' into refactor-idprop-ui-data 2020-12-15 12:44:45 -06:00
36b04e04ad Remove unecessary import 2020-12-15 12:09:45 -06:00
aacc976522 Add clear_rna method to completely remove UI data 2020-12-15 12:09:34 -06:00
6ec08c5f3a Fix building 2020-12-15 10:46:23 -06:00
3fcb015454 Merge branch 'master' into refactor-idprop-ui-data 2020-12-15 10:29:11 -06:00
f57d8e7239 Add debug prints, move NULL check to parent function 2020-12-15 10:10:24 -06:00
336593f340 Merge branch 'master' into refactor-idprop-ui-data 2020-12-14 20:19:52 -06:00
4c323d6e9d Use new UI data system for nodes modifier 2020-12-10 23:20:46 -06:00
06abe408e7 Mainly finish versioning code 2020-12-10 22:41:51 -06:00
53ca2fa43b Merge branch 'master' into refactor-idprop-ui-data 2020-12-10 18:56:01 -06:00
d92bc84e3a Update versioning for properties from more data-blocks, fix bugs 2020-12-08 19:19:31 -06:00
2ce0cf0c57 Copy UI data when copying a property's contents 2020-12-08 19:18:49 -06:00
20b7ba360d Small simplification: Use a better function 2020-12-08 16:11:26 -06:00
e8b1e5776a Initial versioning code 2020-12-08 15:34:34 -06:00
e5598b75d4 Fix incorrect assert 2020-12-08 12:08:25 -06:00
db662b2565 Merge branch 'master' into refactor-idprop-ui-data 2020-12-08 11:47:24 -06:00
d96ec8ff1c Lots of bug fixes, working propery in almost all cases for editing 2020-12-05 13:43:33 -06:00
786e12da25 Property edit function works 2020-12-04 17:08:33 -06:00
b67fd20dcb Merge branch 'master' into refactor-idprop-ui-data 2020-12-04 15:42:20 -06:00
467f737b7a Bugfixes, adding a new custom property now works 2020-12-03 10:52:30 -06:00
6c90c8bded Fix incorrect signature for update_rna function 2020-12-03 09:57:11 -06:00
f75921b9c9 Merge branch 'master' into refactor-idprop-ui-data 2020-12-03 08:47:31 -06:00
a97e3beac3 WIP: Refactor IDProperty UI data storage
The way IDProperty UI data (min, max, default value, etc) is quite
complicated. For every property, retrieving a single one of these values
involves three string lookups. First for the "_RNA_UI" group property,
then for another group with the property's name, then for the "min" or
other value name. Not only is this inefficient, but it's very hard to
figure out, unintuitive, and just generally not helpful.

This commit replaces that system with a UI data struct directly in the
IDProperty. If it's not used, the only cost is of a pointer. Beyond storing
the description, name, and RNA subtype, derived structs are used to store
type specific UI data.

This patch currently makes more changes than I would make in the first
step of landing this refactoring to master, and it doesn't consider
versioning yet.

Differential Revision: https://developer.blender.org/D9697
2020-12-01 08:53:58 -05:00
72329b7018 Add reading and writing for ui data structs 2020-11-28 11:48:57 -05:00
9ac87b653c Fixes for adding and removing custom properties 2020-11-27 14:27:38 -05:00
4a34ed3aff Fixes for custom properties API function 2020-11-27 14:17:52 -05:00
f12810906e Merge branch 'master' into refactor-idprop-ui-data 2020-11-27 12:22:40 -05:00
87dfb93f4b Add an API function to get a property's UI data
Now it gets a bit further, but it still crashes because somehow the
description is being changed from NULL in between calls to new code.
2020-11-22 14:58:55 -05:00
9e5fbaef47 Cleanup: Remove unecessary code 2020-11-22 14:43:07 -05:00
26c5ad06d3 Merge branch 'master' into refactor-idprop-ui-data 2020-11-22 12:49:58 -05:00
054417e378 Still doesn't work, no bl_rna for IDProperties 2020-11-17 08:20:11 -05:00
b7db5c4692 Merge branch 'master' into refactor-idprop-ui-data 2020-11-16 15:18:18 -05:00
6f1653a6de Adding a custom property works 2020-11-16 09:53:40 -05:00
d3d1d9bd5e In progress 2020-11-15 19:58:50 -05:00
3b614abec9 Set up defaults when allocating UI data structs 2020-11-15 16:26:50 -05:00
ad2fc4c569 Merge branch 'master' into refactor-idprop-ui-data 2020-11-14 20:12:24 -05:00
210250a91a Progress in using the new IDProperty UI data API 2020-11-06 14:25:53 -06:00
3fe37136ff Merge branch 'master' into refactor-idprop-ui-data 2020-11-06 12:50:33 -06:00
498685b295 Initial untested RNA UI data python API 2020-11-06 12:43:10 -06:00
e2e57307e9 Merge branch 'master' into refactor-idprop-ui-data 2020-11-05 22:48:02 -06:00
da9b541261 Starting progress on python interface 2020-11-02 08:08:55 -06:00
4ab2b3c205 Merge branch 'master' into refactor-idprop-ui-data 2020-10-31 23:58:12 -05:00
ad72114ad9 Most changes to rna_access.c finished, python API is up next 2020-10-31 22:49:23 -05:00
3444 changed files with 154079 additions and 77277 deletions

View File

@@ -255,6 +255,7 @@ ForEachMacros:
- SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN
- SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN
- SEQ_ALL_BEGIN
- SEQ_ITERATOR_FOREACH
- SURFACE_QUAD_ITER_BEGIN
- foreach
- ED_screen_areas_iter
@@ -264,4 +265,5 @@ ForEachMacros:
- VECTOR_SET_SLOT_PROBING_BEGIN
StatementMacros:
- PyObject_HEAD
- PyObject_VAR_HEAD

View File

@@ -110,6 +110,10 @@ if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# Install CODE|SCRIPT allow the use of generator expressions.
if(POLICY CMP0087)
cmake_policy(SET CMP0087 NEW)
endif()
#-----------------------------------------------------------------------------
# Load some macros.
include(build_files/cmake/macros.cmake)
@@ -349,7 +353,7 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
# Misc
if(WIN32)
if(WIN32 OR APPLE)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
endif()
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
@@ -403,14 +407,14 @@ set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build Cycles with extra debug capabilities" OFF)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG_NAN "Build Cycles with additional asserts for detecting NaNs and invalid values" OFF)
option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF)
option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF)
mark_as_advanced(WITH_CYCLES_KERNEL_ASAN)
mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG)
mark_as_advanced(WITH_CYCLES_DEBUG_NAN)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON)
@@ -424,6 +428,10 @@ mark_as_advanced(WITH_CYCLES_NETWORK)
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
mark_as_advanced(WITH_CUDA_DYNLOAD)
# Draw Manager
option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF)
mark_as_advanced(WITH_DRAW_DEBUG)
# LLVM
option(WITH_LLVM "Use LLVM" OFF)
if(APPLE)
@@ -604,12 +612,6 @@ if(WIN32)
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
mark_as_advanced(WITH_WINDOWS_FIND_MODULES)
option(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS "Organize the visual studio projects according to source folder structure." ON)
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
option(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS "Organize the source files in filters matching the source folders." ON)
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
option(WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF)
mark_as_advanced(WINDOWS_PYTHON_DEBUG)
@@ -627,6 +629,18 @@ if(WIN32)
endif()
if(WIN32 OR XCODE)
option(IDE_GROUP_SOURCES_IN_FOLDERS "Organize the source files in filters matching the source folders." ON)
mark_as_advanced(IDE_GROUP_SOURCES_IN_FOLDERS)
option(IDE_GROUP_PROJECTS_IN_FOLDERS "Organize the projects according to source folder structure." ON)
mark_as_advanced(IDE_GROUP_PROJECTS_IN_FOLDERS)
if (IDE_GROUP_PROJECTS_IN_FOLDERS)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
endif()
if(UNIX)
# See WITH_WINDOWS_SCCACHE for Windows.
option(WITH_COMPILER_CCACHE "Use ccache to improve rebuild times (Works with Ninja, Makefiles and Xcode)" OFF)
@@ -836,7 +850,7 @@ if(WITH_PYTHON)
# because UNIX will search for the old Python paths which may not exist.
# giving errors about missing paths before this case is met.
if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.9")
message(FATAL_ERROR "At least Python 3.9 is required to build")
message(FATAL_ERROR "At least Python 3.9 is required to build, but found Python ${PYTHON_VERSION}")
endif()
file(GLOB RESULT "${CMAKE_SOURCE_DIR}/release/scripts/addons")
@@ -1584,6 +1598,9 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
# Using C++20 features while having C++17 as the project language isn't allowed by MSVC.
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_CXX20_DESIGNATOR -Wc++20-designator)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
@@ -1705,22 +1722,18 @@ if(WITH_PYTHON)
endif()
endif()
if(MSVC)
string(APPEND CMAKE_CXX_FLAGS " /std:c++17")
# Make MSVC properly report the value of the __cplusplus preprocessor macro
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
# of the C++ standard chosen above
if(MSVC_VERSION GREATER 1913)
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
endif()
elseif(
CMAKE_COMPILER_IS_GNUCC OR
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
CMAKE_C_COMPILER_ID MATCHES "Intel"
)
string(APPEND CMAKE_CXX_FLAGS " -std=c++17")
else()
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++17 build")
# Select C++17 as the standard for C++ projects.
set(CMAKE_CXX_STANDARD 17)
# If C++17 is not available, downgrading to an earlier standard is NOT OK.
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Do not enable compiler specific language extentions.
set(CMAKE_CXX_EXTENSIONS OFF)
# Make MSVC properly report the value of the __cplusplus preprocessor macro
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
# of the C++ standard chosen above.
if(MSVC AND MSVC_VERSION GREATER 1913)
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
endif()
# Visual Studio has all standards it supports available by default
@@ -1915,6 +1928,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_INPUT_NDOF)
info_cfg_option(WITH_INPUT_IME)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_OPENCOLORIO)

View File

@@ -63,7 +63,7 @@ Package Targets
* package_debian: Build a debian package.
* package_pacman: Build an arch linux pacman package.
* package_archive: Build an archive package.
* package_archive: Build an archive package.
Testing Targets
Not associated with building Blender.
@@ -167,7 +167,7 @@ endef
# This makefile is not meant for Windows
ifeq ($(OS),Windows_NT)
$(error On Windows, use "cmd //c make.bat" instead of "make")
$(error On Windows, use "cmd //c make.bat" instead of "make")
endif
# System Vars
@@ -379,7 +379,7 @@ deps: .FORCE
@cmake -H"$(DEPS_SOURCE_DIR)" \
-B"$(DEPS_BUILD_DIR)" \
-DHARVEST_TARGET=$(DEPS_INSTALL_DIR)
-DHARVEST_TARGET=$(DEPS_INSTALL_DIR)
@echo
@echo Building dependencies ...
@@ -456,7 +456,8 @@ project_eclipse: .FORCE
check_cppcheck: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
$(PYTHON) \
"$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
"$(BLENDER_DIR)/check_cppcheck.txt"
@echo "written: check_cppcheck.txt"
@@ -518,8 +519,9 @@ source_archive: .FORCE
python3 ./build_files/utils/make_source_archive.py
source_archive_complete: .FORCE
cmake -S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
cmake \
-S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
# This assumes CMake is still using a default `PACKAGE_DIR` variable:
python3 ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages"
@@ -527,9 +529,11 @@ source_archive_complete: .FORCE
INKSCAPE_BIN?="inkscape"
icons: .FORCE
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/alert_icons_update.py"
icons_geom: .FORCE
BLENDER_BIN=$(BLENDER_BIN) \
@@ -543,7 +547,7 @@ update_code: .FORCE
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)
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
# -----------------------------------------------------------------------------
@@ -553,8 +557,9 @@ format: .FORCE
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
doc_py: .FORCE
ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \
$(BLENDER_BIN) --background -noaudio --factory-startup \
--python doc/python_api/sphinx_doc_gen.py
$(BLENDER_BIN) \
--background -noaudio --factory-startup \
--python doc/python_api/sphinx_doc_gen.py
sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'"
@@ -563,8 +568,9 @@ doc_doxy: .FORCE
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
doc_dna: .FORCE
$(BLENDER_BIN) --background -noaudio --factory-startup \
--python doc/blender_file_format/BlendFileDnaExporter_25.py
$(BLENDER_BIN) \
--background -noaudio --factory-startup \
--python doc/blender_file_format/BlendFileDnaExporter_25.py
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man: .FORCE

View File

@@ -56,6 +56,7 @@ else()
endif()
include(cmake/zlib.cmake)
include(cmake/zstd.cmake)
include(cmake/openal.cmake)
include(cmake/png.cmake)
include(cmake/jpeg.cmake)
@@ -81,7 +82,11 @@ if(UNIX)
endif()
include(cmake/openimageio.cmake)
include(cmake/tiff.cmake)
include(cmake/flexbison.cmake)
if(WIN32)
include(cmake/flexbison.cmake)
elseif(UNIX AND NOT APPLE)
include(cmake/flex.cmake)
endif()
include(cmake/osl.cmake)
include(cmake/tbb.cmake)
include(cmake/openvdb.cmake)
@@ -113,7 +118,7 @@ include(cmake/expat.cmake)
include(cmake/yamlcpp.cmake)
include(cmake/opencolorio.cmake)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
if(BLENDER_PLATFORM_ARM)
include(cmake/sse2neon.cmake)
endif()
@@ -164,6 +169,7 @@ endif()
if(UNIX AND NOT APPLE)
include(cmake/libglu.cmake)
include(cmake/mesa.cmake)
include(cmake/wayland_protocols.cmake)
endif()
include(cmake/harvest.cmake)

View File

@@ -29,7 +29,7 @@ set(BLOSC_EXTRA_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
)
# Prevent blosc from including it's own local copy of zlib in the object file
# Prevent blosc from including its own local copy of zlib in the object file
# and cause linker errors with everybody else.
set(BLOSC_EXTRA_ARGS ${BLOSC_EXTRA_ARGS}
-DPREFER_EXTERNAL_ZLIB=ON

View File

@@ -18,6 +18,12 @@
set(BOOST_ADDRESS_MODEL 64)
if(BLENDER_PLATFORM_ARM)
set(BOOST_ARCHITECTURE arm)
else()
set(BOOST_ARCHITECTURE x86)
endif()
if(WIN32)
set(BOOST_TOOLSET toolset=msvc-14.1)
set(BOOST_COMPILER_STRING -vc141)
@@ -29,7 +35,6 @@ if(WIN32)
if(BUILD_MODE STREQUAL Release)
set(BOOST_HARVEST_CMD ${BOOST_HARVEST_CMD} && ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/include/boost-${BOOST_VERSION_NODOTS_SHORT}/ ${HARVEST_TARGET}/boost/include/)
endif()
elseif(APPLE)
set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
set(BOOST_BUILD_COMMAND ./b2)
@@ -93,7 +98,7 @@ ExternalProject_Add(external_boost
UPDATE_COMMAND ""
PATCH_COMMAND ${BOOST_PATCH_COMMAND}
CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND}
BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=x86 address-model=${BOOST_ADDRESS_MODEL} link=static threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install
BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=${BOOST_ARCHITECTURE} address-model=${BOOST_ADDRESS_MODEL} link=static threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install
BUILD_IN_SOURCE 1
INSTALL_COMMAND "${BOOST_HARVEST_CMD}"
)

View File

@@ -87,7 +87,10 @@ download_source(LIBGLU)
download_source(MESA)
download_source(NASM)
download_source(XR_OPENXR_SDK)
download_source(WL_PROTOCOLS)
download_source(ISPC)
download_source(GMP)
download_source(POTRACE)
download_source(HARU)
download_source(ZSTD)
download_source(FLEX)

View File

@@ -43,11 +43,17 @@ endif()
if(WIN32)
set(EMBREE_BUILD_DIR ${BUILD_MODE}/)
if(BUILD_MODE STREQUAL Debug)
list(APPEND EMBREE_EXTRA_ARGS
-DEMBREE_TBBMALLOC_LIBRARY_NAME=tbbmalloc_debug
-DEMBREE_TBB_LIBRARY_NAME=tbb_debug
)
endif()
else()
set(EMBREE_BUILD_DIR)
endif()
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
if(BLENDER_PLATFORM_ARM)
ExternalProject_Add(external_embree
GIT_REPOSITORY ${EMBREE_ARM_GIT}
GIT_TAG "blender-arm"

View File

@@ -30,6 +30,7 @@ if(WIN32)
--enable-w32threads
--disable-pthreads
--enable-libopenjpeg
--disable-mediafoundation
)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
set(FFMPEG_EXTRA_FLAGS

View File

@@ -0,0 +1,28 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
ExternalProject_Add(external_flex
URL file://${PACKAGE_DIR}/${FLEX_FILE}
URL_HASH ${FLEX_HASH_TYPE}=${FLEX_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/flex
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/flex
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && make install
INSTALL_DIR ${LIBDIR}/flex
)

View File

@@ -25,19 +25,12 @@ else()
set(GMP_OPTIONS --enable-static --disable-shared )
endif()
if(APPLE)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
set(GMP_OPTIONS
${GMP_OPTIONS}
--disable-assembly
)
else()
set(GMP_OPTIONS
${GMP_OPTIONS}
--with-pic
)
endif()
elseif(UNIX)
if(APPLE AND NOT BLENDER_PLATFORM_ARM)
set(GMP_OPTIONS
${GMP_OPTIONS}
--with-pic
)
elseif(UNIX AND NOT APPLE)
set(GMP_OPTIONS
${GMP_OPTIONS}
--with-pic
@@ -45,6 +38,13 @@ elseif(UNIX)
)
endif()
if(BLENDER_PLATFORM_ARM)
set(GMP_OPTIONS
${GMP_OPTIONS}
--disable-assembly
)
endif()
ExternalProject_Add(external_gmp
URL file://${PACKAGE_DIR}/${GMP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}

View File

@@ -106,12 +106,13 @@ harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config")
harvest(llvm/lib llvm/lib "libLLVM*.a")
harvest(llvm/lib llvm/lib "libclang*.a")
harvest(llvm/lib/clang llvm/lib/clang "*.h")
if(APPLE)
harvest(openmp/lib openmp/lib "*")
harvest(openmp/include openmp/include "*.h")
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
harvest(sse2neon sse2neon "*.h")
endif()
endif()
if(BLENDER_PLATFORM_ARM)
harvest(sse2neon sse2neon "*.h")
endif()
harvest(ogg/lib ffmpeg/lib "*.a")
harvest(openal/include openal/include "*.h")
@@ -126,6 +127,8 @@ if(UNIX AND NOT APPLE)
harvest(xml2/include xml2/include "*.h")
harvest(xml2/lib xml2/lib "*.a")
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
else()
harvest(blosc/lib openvdb/lib "*.a")
harvest(xml2/lib opencollada/lib "*.a")
@@ -190,6 +193,8 @@ harvest(potrace/include potrace/include "*.h")
harvest(potrace/lib potrace/lib "*.a")
harvest(haru/include haru/include "*.h")
harvest(haru/lib haru/lib "*.a")
harvest(zstd/include zstd/include "*.h")
harvest(zstd/lib zstd/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*.so*")

View File

@@ -35,6 +35,7 @@ elseif(APPLE)
else()
set(ISPC_EXTRA_ARGS_APPLE
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
-DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex
-DARM_ENABLED=Off
)
endif()
@@ -43,6 +44,7 @@ elseif(UNIX)
-DCMAKE_C_COMPILER=${LIBDIR}/llvm/bin/clang
-DCMAKE_CXX_COMPILER=${LIBDIR}/llvm/bin/clang++
-DARM_ENABLED=Off
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
)
endif()
@@ -82,4 +84,9 @@ if(WIN32)
external_ispc
external_flexbison
)
elseif(UNIX AND NOT APPLE)
add_dependencies(
external_ispc
external_flex
)
endif()

View File

@@ -16,7 +16,7 @@
#
# ***** END GPL LICENSE BLOCK *****
if(APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
if(BLENDER_PLATFORM_ARM)
set(LLVM_TARGETS AArch64$<SEMICOLON>ARM)
else()
set(LLVM_TARGETS X86)
@@ -66,7 +66,11 @@ ExternalProject_Add(ll
if(MSVC)
if(BUILD_MODE STREQUAL Release)
set(LLVM_HARVEST_COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/ ${HARVEST_TARGET}/llvm/ )
set(LLVM_HARVEST_COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib ${HARVEST_TARGET}/llvm/lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/include ${HARVEST_TARGET}/llvm/include &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/llvm/bin/clang-format.exe ${HARVEST_TARGET}/llvm/bin/clang-format.exe
)
else()
set(LLVM_HARVEST_COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib/ ${HARVEST_TARGET}/llvm/debug/lib/ &&

View File

@@ -36,7 +36,7 @@ set(OPENCOLORIO_EXTRA_ARGS
-Dyaml-cpp_ROOT=${LIBDIR}/yamlcpp
)
if(APPLE AND NOT("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
if(BLENDER_PLATFORM_ARM)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
-DOCIO_USE_SSE=OFF

View File

@@ -45,7 +45,6 @@ ExternalProject_Add(external_openimagedenoise
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OIDN_HASH_TYPE}=${OIDN_HASH}
PREFIX ${BUILD_DIR}/openimagedenoise
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimagedenoise/src/external_openimagedenoise < ${PATCH_DIR}/oidn.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimagedenoise ${DEFAULT_CMAKE_FLAGS} ${OIDN_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openimagedenoise
)

View File

@@ -16,15 +16,20 @@
#
# ***** END GPL LICENSE BLOCK *****
if(APPLE)
set(OPENMP_PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff)
else()
set(OPENMP_PATCH_COMMAND)
endif()
ExternalProject_Add(external_openmp
URL file://${PACKAGE_DIR}/${OPENMP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH}
PREFIX ${BUILD_DIR}/openmp
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff
PATCH_COMMAND ${OPENMP_PATCH_COMMAND}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @executable_path/../Resources/lib/libomp.dylib runtime/src/libomp.dylib && make install
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @rpath/libomp.dylib runtime/src/libomp.dylib && make install
INSTALL_DIR ${LIBDIR}/openmp
)

View File

@@ -137,6 +137,10 @@ else()
endif()
set(OSX_SYSROOT ${XCODE_DEV_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
set(BLENDER_PLATFORM_ARM ON)
endif()
set(PLATFORM_CFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_CXXFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_LDFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
@@ -151,6 +155,10 @@ else()
-DCMAKE_OSX_SYSROOT:PATH=${OSX_SYSROOT}
)
else()
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
set(BLENDER_PLATFORM_ARM ON)
endif()
set(PLATFORM_CFLAGS "-fPIC")
set(PLATFORM_CXXFLAGS "-std=c++11 -fPIC")
set(PLATFORM_LDFLAGS)

View File

@@ -20,12 +20,10 @@ 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)
SET(OSL_PLATFORM_FLAGS -DLINKSTATIC=ON)
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_PLATFORM_FLAGS)
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")
@@ -51,12 +49,13 @@ set(OSL_EXTRA_ARGS
-DOpenImageIO_ROOT=${LIBDIR}/openimageio/
-DOSL_BUILD_TESTS=OFF
-DOSL_BUILD_MATERIALX=OFF
-DPNG_ROOT=${LIBDIR}/png
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
${OSL_FLEX_BISON}
-DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES}
-DBUILD_SHARED_LIBS=OFF
${OSL_PLATFORM_FLAGS}
-DLINKSTATIC=ON
-DOSL_BUILD_PLUGINS=OFF
-DSTOP_ON_WARNING=OFF
-DUSE_LLVM_BITCODE=OFF
@@ -69,13 +68,9 @@ set(OSL_EXTRA_ARGS
${OSL_SIMD_FLAGS}
-Dpugixml_ROOT=${LIBDIR}/pugixml
-DUSE_PYTHON=OFF
-DCMAKE_CXX_STANDARD=14
)
# Apple arm64 uses LLVM 11, LLVM 10+ requires C++14
if (APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
list(APPEND OSL_EXTRA_ARGS -DCMAKE_CXX_STANDARD=14)
endif()
ExternalProject_Add(external_osl
URL file://${PACKAGE_DIR}/${OSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -93,10 +88,20 @@ add_dependencies(
ll
external_openexr
external_zlib
external_flexbison
external_openimageio
external_pugixml
)
if(WIN32)
add_dependencies(
external_osl
external_flexbison
)
elseif(UNIX AND NOT APPLE)
add_dependencies(
external_osl
external_flex
)
endif()
if(WIN32)
if(BUILD_MODE STREQUAL Release)

View File

@@ -22,7 +22,7 @@ set(PNG_EXTRA_ARGS
-DPNG_STATIC=ON
)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
if(BLENDER_PLATFORM_ARM)
set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=on -DCMAKE_SYSTEM_PROCESSOR="aarch64")
endif()

View File

@@ -16,15 +16,13 @@
#
# ***** END GPL LICENSE BLOCK *****
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
ExternalProject_Add(external_sse2neon
GIT_REPOSITORY ${SSE2NEON_GIT}
GIT_TAG ${SSE2NEON_GIT_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/sse2neon
CONFIGURE_COMMAND echo sse2neon - Nothing to configure
BUILD_COMMAND echo sse2neon - nothing to build
INSTALL_COMMAND mkdir -p ${LIBDIR}/sse2neon && cp ${BUILD_DIR}/sse2neon/src/external_sse2neon/sse2neon.h ${LIBDIR}/sse2neon
INSTALL_DIR ${LIBDIR}/sse2neon
)
endif()
ExternalProject_Add(external_sse2neon
GIT_REPOSITORY ${SSE2NEON_GIT}
GIT_TAG ${SSE2NEON_GIT_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/sse2neon
CONFIGURE_COMMAND echo sse2neon - Nothing to configure
BUILD_COMMAND echo sse2neon - nothing to build
INSTALL_COMMAND mkdir -p ${LIBDIR}/sse2neon && cp ${BUILD_DIR}/sse2neon/src/external_sse2neon/sse2neon.h ${LIBDIR}/sse2neon
INSTALL_DIR ${LIBDIR}/sse2neon
)

View File

@@ -22,7 +22,9 @@ set(SSL_PATCH_CMD echo .)
if(APPLE)
set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}")
else()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
if(BLENDER_PLATFORM_ARM)
set(SSL_OS_COMPILER "blender-linux-aarch64")
elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(SSL_EXTRA_ARGS enable-ec_nistp_64_gcc_128)
set(SSL_OS_COMPILER "blender-linux-x86_64")
else()

View File

@@ -8,6 +8,11 @@ my %targets = (
inherit_from => [ "linux-x86_64" ],
cflags => add("-fPIC"),
},
"blender-linux-aarch64" => {
inherit_from => [ "linux-aarch64" ],
cxxflags => add("-fPIC"),
cflags => add("-fPIC"),
},
"blender-darwin-x86_64" => {
inherit_from => [ "darwin64-x86_64-cc" ],
cflags => add("-fPIC"),

View File

@@ -21,6 +21,8 @@ if(WIN32)
-DTBB_BUILD_TBBMALLOC=On
-DTBB_BUILD_TBBMALLOC_PROXY=On
-DTBB_BUILD_STATIC=Off
-DTBB_BUILD_TESTS=Off
-DCMAKE_DEBUG_POSTFIX=_debug
)
set(TBB_LIBRARY tbb)
set(TBB_STATIC_LIBRARY Off)
@@ -30,6 +32,7 @@ else()
-DTBB_BUILD_TBBMALLOC=On
-DTBB_BUILD_TBBMALLOC_PROXY=Off
-DTBB_BUILD_STATIC=On
-DTBB_BUILD_TESTS=Off
)
set(TBB_LIBRARY tbb_static)
set(TBB_STATIC_LIBRARY On)
@@ -42,7 +45,7 @@ ExternalProject_Add(external_tbb
URL_HASH ${TBB_HASH_TYPE}=${TBB_HASH}
PREFIX ${BUILD_DIR}/tbb
PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_tbb.txt ${BUILD_DIR}/tbb/src/external_tbb/CMakeLists.txt &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/tbb/src/external_tbb/build/vs2013/version_string.ver ${BUILD_DIR}/tbb/src/external_tbb/src/tbb/version_string.ver &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/tbb/src/external_tbb/build/vs2013/version_string.ver ${BUILD_DIR}/tbb/src/external_tbb/build/version_string.ver.in &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/tbb/src/external_tbb < ${PATCH_DIR}/tbb.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/tbb ${DEFAULT_CMAKE_FLAGS} ${TBB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/tbb
@@ -53,17 +56,17 @@ if(WIN32)
ExternalProject_Add_Step(external_tbb after_install
# findtbb.cmake in some deps *NEEDS* to find tbb_debug.lib even if they are not going to use it
# to make that test pass, we place a copy with the right name in the lib folder.
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.dll ${HARVEST_TARGET}/tbb/lib/tbb_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${LIBDIR}/tbb/lib/tbb_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${LIBDIR}/tbb/lib/tbbmalloc_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbb.dll ${LIBDIR}/tbb/bin/tbb_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc.dll ${LIBDIR}/tbb/bin/tbbmalloc_debug.dll
# Normal collection of build artifacts
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${HARVEST_TARGET}/tbb/lib/tbb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.dll ${HARVEST_TARGET}/tbb/lib/tbb.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbb.dll ${HARVEST_TARGET}/tbb/bin/tbb.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc_proxy.dll
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tbb/include/ ${HARVEST_TARGET}/tbb/include/
DEPENDEES install
)
@@ -74,11 +77,12 @@ if(WIN32)
# to make that test pass, we place a copy with the right name in the lib folder.
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${LIBDIR}/tbb/lib/tbb.lib
# Normal collection of build artifacts
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${HARVEST_TARGET}/tbb/lib/debug/tbb_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.dll ${HARVEST_TARGET}/tbb/lib/debug/tbb_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/debug/tbbmalloc.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/lib/debug/tbbmalloc_proxy.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbb_debug.dll ${HARVEST_TARGET}/tbb/bin/tbb_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_debug.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy_debug.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc_debug.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc_proxy_debug.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc_proxy_debug.dll
DEPENDEES install
)
endif()

View File

@@ -43,7 +43,7 @@ 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_URI https://dl.bintray.com/boostorg/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz)
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_TYPE MD5)
set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz)
@@ -152,35 +152,28 @@ set(OPENCOLORIO_HASH 1a2e3478b6cd9a1549f24e1b2205e3f0)
set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
# Newer version required by ISPC with arm support.
set(LLVM_VERSION 11.0.1)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_HASH e700af40ab83463e4e9ab0ba3708312e)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_VERSION 12.0.0)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
if(APPLE)
# Cloth physics test is crashing due to this bug:
# https://bugs.llvm.org/show_bug.cgi?id=50579
set(OPENMP_VERSION 9.0.1)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
else()
set(LLVM_VERSION 9.0.1)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.tar.xz)
set(LLVM_HASH b4268e733dfe352960140dc07ef2efcb)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.tar.xz)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_VERSION ${LLVM_VERSION})
set(OPENMP_HASH ac48ce3e4582ccb82f81ab59eb3fc9dc)
endif()
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENIMAGEIO_VERSION 2.1.15.0)
set(OPENIMAGEIO_VERSION 2.2.15.1)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH f03aa5e3ac4795af04771ee4146e9832)
set(OPENIMAGEIO_HASH 3db5c5f0b3dc91597c75e5df09eb9072)
set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
@@ -190,9 +183,9 @@ set(TIFF_HASH 2165e7aba557463acc0664e71a3ed424)
set(TIFF_HASH_TYPE MD5)
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
set(OSL_VERSION 1.11.10.0)
set(OSL_VERSION 1.11.14.1)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH dfdc23597aeef083832cbada62211756)
set(OSL_HASH 1abd7ce40481771a9fa937f19595d2f2)
set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
@@ -216,9 +209,9 @@ set(OPENVDB_HASH 01b490be16cc0e15c690f9a153c21461)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
set(NANOVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(NANOVDB_GIT_UID dc37d8a631922e7bef46712947dc19b755f3e841)
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
set(NANOVDB_HASH 90919510bc6ccd630fedc56f748cb199)
set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
set(NANOVDB_HASH_TYPE MD5)
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)
@@ -297,10 +290,10 @@ set(OPENJPEG_HASH 63f5a4713ecafc86de51bfad89cc07bb788e9bba24ebbf0c4ca637621aadb6
set(OPENJPEG_HASH_TYPE SHA256)
set(OPENJPEG_FILE openjpeg-v${OPENJPEG_VERSION}.tar.gz)
set(FFMPEG_VERSION 4.2.3)
set(FFMPEG_VERSION 4.4)
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFMPEG_HASH 695fad11f3baf27784e24cb0e977b65a)
set(FFMPEG_HASH_TYPE MD5)
set(FFMPEG_HASH 42093549751b582cf0f338a21a3664f52e0a9fbe0d238d3c992005e493607d0e)
set(FFMPEG_HASH_TYPE SHA256)
set(FFMPEG_FILE ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFTW_VERSION 3.3.8)
@@ -370,12 +363,18 @@ set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
set(PUGIXML_HASH_TYPE MD5)
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
set(FLEXBISON_VERSION 2.5.5)
set(FLEXBISON_VERSION 2.5.24)
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
set(FLEXBISON_HASH d87a3938194520d904013abef3df10ce)
set(FLEXBISON_HASH 6b549d43e34ece0e8ed05af92daa31c4)
set(FLEXBISON_HASH_TYPE MD5)
set(FLEXBISON_FILE win_flex_bison-${FLEXBISON_VERSION}.zip)
set(FLEX_VERSION 2.6.4)
set(FLEX_URI https://github.com/westes/flex/releases/download/v${FLEX_VERSION}/flex-${FLEX_VERSION}.tar.gz)
set(FLEX_HASH 2882e3179748cc9f9c23ec593d6adc8d)
set(FLEX_HASH_TYPE MD5)
set(FLEX_FILE flex-${FLEX_VERSION}.tar.gz)
# Libraries to keep Python modules static on Linux.
# NOTE: bzip.org domain does no longer belong to BZip 2 project, so we download
@@ -398,11 +397,20 @@ set(LZMA_HASH 5117f930900b341493827d63aa910ff5e011e0b994197c3b71c08a20228a42df)
set(LZMA_HASH_TYPE SHA256)
set(LZMA_FILE xz-${LZMA_VERSION}.tar.bz2)
set(SSL_VERSION 1.1.1g)
set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz)
set(SSL_HASH ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46)
set(SSL_HASH_TYPE SHA256)
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
if(BLENDER_PLATFORM_ARM)
# Need at least 1.1.1i for aarch64 support (https://github.com/openssl/openssl/pull/13218)
set(SSL_VERSION 1.1.1i)
set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz)
set(SSL_HASH e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242)
set(SSL_HASH_TYPE SHA256)
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
else()
set(SSL_VERSION 1.1.1g)
set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz)
set(SSL_HASH ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46)
set(SSL_HASH_TYPE SHA256)
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
endif()
set(SQLITE_VERSION 3.31.1)
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
@@ -423,9 +431,9 @@ set(USD_HASH 1dd1e2092d085ed393c1f7c450a4155a)
set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
set(OIDN_VERSION 1.3.0)
set(OIDN_VERSION 1.4.1)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
set(OIDN_HASH 301a5a0958d375a942014df0679b9270)
set(OIDN_HASH df4007b0ab93b1c41cdf223b075d01c0)
set(OIDN_HASH_TYPE MD5)
set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz)
@@ -435,10 +443,10 @@ set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3)
set(LIBGLU_HASH_TYPE MD5)
set(LIBGLU_FILE glu-${LIBGLU_VERSION}.tar.xz)
set(MESA_VERSION 20.3.4)
set(MESA_VERSION 21.1.5)
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH 556338446aef8ae947a789b3e0b5e056)
set(MESA_HASH_TYPE MD5)
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
set(MESA_HASH_TYPE SHA256)
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
set(NASM_VERSION 2.15.02)
@@ -447,25 +455,23 @@ set(NASM_HASH aded8b796c996a486a56e0515c83e414116decc3b184d88043480b32eb0a8589)
set(NASM_HASH_TYPE SHA256)
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
set(XR_OPENXR_SDK_VERSION 1.0.14)
set(XR_OPENXR_SDK_VERSION 1.0.17)
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(XR_OPENXR_SDK_HASH 0df6b2fd6045423451a77ff6bc3e1a75)
set(XR_OPENXR_SDK_HASH bf0fd8828837edff01047474e90013e1)
set(XR_OPENXR_SDK_HASH_TYPE MD5)
set(XR_OPENXR_SDK_FILE OpenXR-SDK-${XR_OPENXR_SDK_VERSION}.tar.gz)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
# Unreleased version with macOS arm support.
set(ISPC_URI https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
set(ISPC_HASH d382fea18d01dbd0cd05d9e1ede36d7d)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
else()
set(ISPC_VERSION v1.14.1)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 968fbc8dfd16a60ba4e32d2e0e03ea7a)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
endif()
set(WL_PROTOCOLS_VERSION 1.21)
set(WL_PROTOCOLS_FILE wayland-protocols-${WL_PROTOCOLS_VERSION}.tar.gz)
set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/${WL_PROTOCOLS_VERSION}/${WL_PROTOCOLS_FILE})
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
set(WL_PROTOCOLS_HASH_TYPE MD5)
set(ISPC_VERSION v1.16.0)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 2e3abedbc0ea9aaec17d6562c632454d)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
set(GMP_VERSION 6.2.0)
set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)
@@ -485,5 +491,11 @@ set(HARU_HASH 4f916aa49c3069b3a10850013c507460)
set(HARU_HASH_TYPE MD5)
set(HARU_FILE libharu-${HARU_VERSION}.tar.gz)
set(ZSTD_VERSION 1.5.0)
set(ZSTD_URI https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz)
set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
set(ZSTD_HASH_TYPE SHA256)
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git)
set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)

View File

@@ -0,0 +1,27 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
ExternalProject_Add(external_wayland_protocols
URL file://${PACKAGE_DIR}/${WL_PROTOCOLS_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${WL_PROTOCOLS_HASH_TYPE}=${WL_PROTOCOLS_HASH}
PREFIX ${BUILD_DIR}/wayland-protocols
CONFIGURE_COMMAND meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)

View File

@@ -20,24 +20,16 @@ if(WIN32)
set(X264_EXTRA_ARGS --enable-win32thread --cross-prefix=${MINGW_HOST}- --host=${MINGW_HOST})
endif()
if(APPLE)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
set(X264_EXTRA_ARGS ${X264_EXTRA_ARGS} "--disable-asm")
set(X264_CONFIGURE_ENV echo .)
else()
set(X264_CONFIGURE_ENV
export AS=${LIBDIR}/nasm/bin/nasm
)
endif()
else()
set(X264_CONFIGURE_ENV echo .)
if(BLENDER_PLATFORM_ARM)
set(X264_EXTRA_ARGS ${X264_EXTRA_ARGS} "--disable-asm")
endif()
if(UNIX AND NOT APPLE)
if((APPLE AND NOT BLENDER_PLATFORM_ARM) OR (UNIX AND NOT APPLE))
set(X264_CONFIGURE_ENV
export AS=${LIBDIR}/nasm/bin/nasm
)
else()
set(X264_CONFIGURE_ENV echo .)
endif()
ExternalProject_Add(external_x264

View File

@@ -0,0 +1,51 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(ZSTD_EXTRA_ARGS
-DZSTD_BUILD_PROGRAMS=OFF
-DZSTD_BUILD_SHARED=OFF
-DZSTD_BUILD_STATIC=ON
-DZSTD_BUILD_TESTS=OFF
-DZSTD_LEGACY_SUPPORT=OFF
-DZSTD_LZ4_SUPPORT=OFF
-DZSTD_LZMA_SUPPORT=OFF
-DZSTD_MULTITHREAD_SUPPORT=ON
-DZSTD_PROGRAMS_LINK_SHARED=OFF
-DZSTD_USE_STATIC_RUNTIME=OFF
-DZSTD_ZLIB_SUPPORT=OFF
)
ExternalProject_Add(external_zstd
URL file://${PACKAGE_DIR}/${ZSTD_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${ZSTD_HASH_TYPE}=${ZSTD_HASH}
PREFIX ${BUILD_DIR}/zstd
SOURCE_SUBDIR build/cmake
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zstd ${DEFAULT_CMAKE_FLAGS} ${ZSTD_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/zstd
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_zstd after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/zstd/lib/zstd_static${LIBEXT} ${HARVEST_TARGET}/zstd/lib/zstd_static${LIBEXT}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/zstd/include/ ${HARVEST_TARGET}/zstd/include/
DEPENDEES install
)
endif()
endif()

View File

@@ -37,7 +37,7 @@ if [ $USE_DEBUG_TRAP -ne 0 ]; then
trap 'err_report $LINENO' ERR
fi
# Noisy, show every line that runs with it's line number.
# Noisy, show every line that runs with its line number.
if [ $USE_DEBUG_LOG -ne 0 ]; then
PS4='\e[0;33m$(printf %4d ${LINENO}):\e\033[0m '
set -x
@@ -474,25 +474,25 @@ OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false
_with_built_openexr=false
OIIO_VERSION="2.1.15.0"
OIIO_VERSION_SHORT="2.1"
OIIO_VERSION="2.2.15.1"
OIIO_VERSION_SHORT="2.2"
OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MAX="2.2.10"
OIIO_VERSION_MAX="2.3.0"
OIIO_FORCE_BUILD=false
OIIO_FORCE_REBUILD=false
OIIO_SKIP=false
LLVM_VERSION="9.0.1"
LLVM_VERSION_SHORT="9.0"
LLVM_VERSION_MIN="6.0"
LLVM_VERSION_MAX="12.0"
LLVM_VERSION="12.0.0"
LLVM_VERSION_SHORT="12.0"
LLVM_VERSION_MIN="11.0"
LLVM_VERSION_MAX="13.0"
LLVM_VERSION_FOUND=""
LLVM_FORCE_BUILD=false
LLVM_FORCE_REBUILD=false
LLVM_SKIP=false
# OSL needs to be compiled for now!
OSL_VERSION="1.11.10.0"
OSL_VERSION="1.11.14.1"
OSL_VERSION_SHORT="1.11"
OSL_VERSION_MIN="1.11"
OSL_VERSION_MAX="2.0"
@@ -553,18 +553,18 @@ EMBREE_FORCE_BUILD=false
EMBREE_FORCE_REBUILD=false
EMBREE_SKIP=false
OIDN_VERSION="1.3.0"
OIDN_VERSION_SHORT="1.3"
OIDN_VERSION_MIN="1.3.0"
OIDN_VERSION_MAX="1.4"
OIDN_VERSION="1.4.1"
OIDN_VERSION_SHORT="1.4"
OIDN_VERSION_MIN="1.4.0"
OIDN_VERSION_MAX="1.5"
OIDN_FORCE_BUILD=false
OIDN_FORCE_REBUILD=false
OIDN_SKIP=false
ISPC_VERSION="1.14.1"
ISPC_VERSION="1.16.0"
FFMPEG_VERSION="4.2.3"
FFMPEG_VERSION_SHORT="4.2"
FFMPEG_VERSION="4.4"
FFMPEG_VERSION_SHORT="4.4"
FFMPEG_VERSION_MIN="3.0"
FFMPEG_VERSION_MAX="5.0"
FFMPEG_FORCE_BUILD=false
@@ -572,7 +572,7 @@ FFMPEG_FORCE_REBUILD=false
FFMPEG_SKIP=false
_ffmpeg_list_sep=";"
XR_OPENXR_VERSION="1.0.14"
XR_OPENXR_VERSION="1.0.17"
XR_OPENXR_VERSION_SHORT="1.0"
XR_OPENXR_VERSION_MIN="1.0.8"
XR_OPENXR_VERSION_MAX="2.0"
@@ -1019,7 +1019,7 @@ PRINT ""
PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" )
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
BOOST_SOURCE=( "https://dl.bintray.com/boostorg/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" )
BOOST_SOURCE=( "https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" )
BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options --with-serialization --with-atomic"
TBB_SOURCE=( "https://github.com/oneapi-src/oneTBB/archive/$TBB_VERSION$TBB_VERSION_UPDATE.tar.gz" )
@@ -1073,7 +1073,7 @@ OPENVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/v
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
NANOVDB_USE_REPO=false
NANOVDB_SOURCE_REPO_UID="e62f7a0bf1e27397223c61ddeaaf57edf111b77f"
NANOVDB_SOURCE_REPO_UID="dc37d8a631922e7bef46712947dc19b755f3e841"
NANOVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_SOURCE_REPO_UID}.tar.gz" )
ALEMBIC_USE_REPO=false
@@ -1108,9 +1108,9 @@ 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="5900c51562769b03bea699dc0352cae56acb6419d"
#~ XR_OPENXR_REPO_BRANCH="master"
XR_OPENXR_SOURCE_REPO=("https://github.com/KhronosGroup/OpenXR-SDK.git")
XR_OPENXR_REPO_UID="bf21ccb1007bb531b45d9978919a56ea5059c245"
XR_OPENXR_REPO_BRANCH="master"
# C++11 is required now
CXXFLAGS_BACK=$CXXFLAGS
@@ -1128,7 +1128,8 @@ Those libraries should be available as packages in all recent distributions (opt
* Basics of dev environment (cmake, gcc, svn , git, ...).
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
* libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
* libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex.
* libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig, [libharu/libhpdf].\""
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -1446,9 +1447,7 @@ compile_Python() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
exit 1
fi
@@ -1464,6 +1463,9 @@ compile_Python() {
INFO "If you want to force rebuild of this lib, use the --force-python option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "python-$PYTHON_VERSION_SHORT"
# Extra step: install required modules with pip.
@@ -1557,9 +1559,7 @@ compile_Boost() {
--prefix=$_inst --disable-icu boost.locale.icu=off install
./b2 --clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
exit 1
fi
@@ -1573,7 +1573,9 @@ compile_Boost() {
INFO "If you want to force rebuild of this lib, use the --force-boost option."
fi
# Just always run it, much simpler this way!
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "boost"
}
@@ -1686,9 +1688,7 @@ compile_TBB() {
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "TBB-$TBB_VERSION$TBB_VERSION_UPDATE failed to compile, exiting"
exit 1
fi
@@ -1702,6 +1702,9 @@ compile_TBB() {
INFO "If you want to force rebuild of this lib, use the --force-tbb option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "tbb"
}
@@ -1797,6 +1800,10 @@ compile_OCIO() {
cmake_d="$cmake_d -D OCIO_BUILD_PYTHON=OFF"
cmake_d="$cmake_d -D OCIO_BUILD_GPU_TESTS=OFF"
if [ $(uname -m) == "aarch64" ]; then
cmake_d="$cmake_d -D OCIO_USE_SSE=OFF"
fi
if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686"
else
@@ -1817,9 +1824,7 @@ compile_OCIO() {
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
exit 1
fi
@@ -1833,6 +1838,9 @@ compile_OCIO() {
INFO "If you want to force rebuild of this lib, use the --force-ocio option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "ocio"
}
@@ -1948,9 +1956,7 @@ compile_OPENEXR() {
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
exit 1
fi
@@ -1966,7 +1972,9 @@ compile_OPENEXR() {
_with_built_openexr=true
# Just always run it, much simpler this way!
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "openexr"
}
@@ -2059,7 +2067,10 @@ compile_OIIO() {
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
cmake_d="$cmake_d -D LINKSTATIC=OFF"
cmake_d="$cmake_d -D USE_SIMD=sse2"
if [ $(uname -m) != "aarch64" ]; then
cmake_d="$cmake_d -D USE_SIMD=sse2"
fi
cmake_d="$cmake_d -D OPENEXR_VERSION=$OPENEXR_VERSION"
@@ -2079,7 +2090,7 @@ compile_OIIO() {
cmake_d="$cmake_d -D USE_OPENCV=OFF"
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=ON"
cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF"
cmake_d="$cmake_d -D TXT2MAN="
#cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
#cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
@@ -2104,9 +2115,7 @@ compile_OIIO() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
exit 1
fi
@@ -2120,7 +2129,9 @@ compile_OIIO() {
INFO "If you want to force rebuild of this lib, use the --force-oiio option."
fi
# Just always run it, much simpler this way!
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "oiio"
}
@@ -2209,10 +2220,15 @@ compile_LLVM() {
mkdir build
cd build
LLVM_TARGETS="X86"
if [ $(uname -m) == "aarch64" ]; then
LLVM_TARGETS="AArch64"
fi
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=X86"
cmake_d="$cmake_d -D LLVM_TARGETS_TO_BUILD=$LLVM_TARGETS"
cmake_d="$cmake_d -D LLVM_ENABLE_TERMINFO=OFF"
if [ -d $_FFI_INCLUDE_DIR ]; then
@@ -2224,9 +2240,7 @@ compile_LLVM() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
exit 1
fi
@@ -2239,6 +2253,10 @@ compile_LLVM() {
INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-llvm option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
}
# ----------------------------------------------------------------------------
@@ -2303,6 +2321,7 @@ compile_OSL() {
tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
-xf $_src.tar.gz
fi
patch -d $_src -p1 < $SCRIPT_DIR/patches/osl.diff
fi
cd $_src
@@ -2325,16 +2344,21 @@ compile_OSL() {
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
cmake_d="$cmake_d -D USE_SIMD=sse2"
cmake_d="$cmake_d -D USE_LLVM_BITCODE=OFF"
cmake_d="$cmake_d -D USE_PARTIO=OFF"
cmake_d="$cmake_d -D OSL_BUILD_MATERIALX=OFF"
cmake_d="$cmake_d -D USE_QT=OFF"
cmake_d="$cmake_d -D USE_Qt5=OFF"
cmake_d="$cmake_d -D USE_PYTHON=OFF"
cmake_d="$cmake_d -D USE_PARTIO=OFF"
cmake_d="$cmake_d -D INSTALL_DOCS=OFF"
if [ $(uname -m) != "aarch64" ]; then
cmake_d="$cmake_d -D USE_SIMD=sse2"
fi
cmake_d="$cmake_d -D CMAKE_CXX_STANDARD=14"
@@ -2352,10 +2376,7 @@ compile_OSL() {
fi
if [ -d $INST/oiio ]; then
cmake_d="$cmake_d -D OPENIMAGEIO_ROOT_DIR=$INST/oiio"
# HACK! SIC!!!!
# Quiet incredible, but if root dir is given, path to lib is found, but not path to include...
cmake_d="$cmake_d -D OPENIMAGEIO_INCLUDE_DIR=$INST/oiio/include"
cmake_d="$cmake_d -D OpenImageIO_ROOT=$INST/oiio"
fi
if [ ! -z $LLVM_VERSION_FOUND ]; then
@@ -2374,9 +2395,7 @@ compile_OSL() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
exit 1
fi
@@ -2390,6 +2409,9 @@ compile_OSL() {
INFO "If you want to force rebuild of this lib, use the --force-osl option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "osl"
}
@@ -2490,9 +2512,7 @@ compile_OSD() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
exit 1
fi
@@ -2506,6 +2526,9 @@ compile_OSD() {
INFO "If you want to force rebuild of this lib, use the --force-osd option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "osd"
}
@@ -2595,9 +2618,7 @@ compile_BLOSC() {
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting"
exit 1
fi
@@ -2610,6 +2631,9 @@ compile_BLOSC() {
magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "blosc"
}
@@ -2700,9 +2724,7 @@ install_NanoVDB() {
#~ mkdir -p $_inst
#~ cp -r $_src/include $_inst/include
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "NanoVDB-v$OPENVDB_VERSION failed to install, exiting"
exit 1
fi
@@ -2714,6 +2736,10 @@ install_NanoVDB() {
else
INFO "Own NanoVDB-v$OPENVDB_VERSION is up to date, nothing to do!"
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
}
@@ -2722,7 +2748,7 @@ _init_openvdb() {
_git=false
_inst=$INST/openvdb-$OPENVDB_VERSION_SHORT
_inst_shortcut=$INST/openvdb
_openvdb_source=$OPENVDB_SOURCE
if [ "$WITH_NANOVDB" = true ]; then
_openvdb_source=$NANOVDB_SOURCE
@@ -2827,15 +2853,13 @@ compile_OPENVDB() {
if [ -d $INST/blosc ]; then
cmake_d="$cmake_d -D Blosc_ROOT=$INST/blosc"
fi
cmake $cmake_d ..
make -j$THREADS install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting"
exit 1
fi
@@ -2849,6 +2873,9 @@ compile_OPENVDB() {
INFO "If you want to force rebuild of this lib, use the --force-openvdb option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "openvdb"
if [ "$WITH_NANOVDB" = true ]; then
@@ -2946,9 +2973,7 @@ compile_ALEMBIC() {
make -j$THREADS install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
exit 1
fi
@@ -2962,6 +2987,9 @@ compile_ALEMBIC() {
INFO "If you want to force rebuild of this lib, use the --force-alembic option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "alembic"
}
@@ -3046,9 +3074,7 @@ compile_USD() {
make -j$THREADS install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "USD-$USD_VERSION failed to compile, exiting"
exit 1
fi
@@ -3062,6 +3088,9 @@ compile_USD() {
INFO "If you want to force rebuild of this lib, use the --force-usd option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "usd"
}
@@ -3155,9 +3184,7 @@ compile_OpenCOLLADA() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
exit 1
fi
@@ -3170,6 +3197,10 @@ compile_OpenCOLLADA() {
INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
}
# ----------------------------------------------------------------------------
@@ -3270,9 +3301,7 @@ compile_Embree() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "Embree-$EMBREE_VERSION failed to compile, exiting"
exit 1
fi
@@ -3285,6 +3314,10 @@ compile_Embree() {
INFO "Own Embree-$EMBREE_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-embree option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
}
# ----------------------------------------------------------------------------
@@ -3347,9 +3380,7 @@ install_ISPC() {
mkdir -p $_inst
cp -r $_src/bin $_inst/bin
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "ISPC-v$ISPC_VERSION failed to install, exiting"
exit 1
fi
@@ -3362,6 +3393,10 @@ install_ISPC() {
INFO "Own ISPC-v$ISPC_VERSION is up to date, nothing to do!"
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
_ispc_path_bin=$_inst/bin
run_ldconfig "ispc"
}
@@ -3461,9 +3496,7 @@ compile_OIDN() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenImageDenoise-$OIDN_VERSION failed to compile, exiting"
exit 1
fi
@@ -3477,6 +3510,9 @@ compile_OIDN() {
INFO "If you want to force rebuild of this lib, use the --force-oidn option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "oidn"
}
@@ -3593,9 +3629,7 @@ compile_FFmpeg() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
exit 1
fi
@@ -3608,6 +3642,10 @@ compile_FFmpeg() {
INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
}
# ----------------------------------------------------------------------------
@@ -3706,9 +3744,7 @@ compile_XR_OpenXR_SDK() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "XR-OpenXR-SDK-$XR_OPENXR_VERSION failed to compile, exiting"
exit 1
fi
@@ -3722,6 +3758,9 @@ compile_XR_OpenXR_SDK() {
INFO "If you want to force rebuild of this lib, use the --force-xr-openxr option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "xr-openxr-sdk"
}
@@ -3824,10 +3863,11 @@ install_DEB() {
_packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
git libfreetype6-dev libfontconfig-dev libx11-dev flex bison libxxf86vm-dev \
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libwayland-dev wayland-protocols libegl-dev libxkbcommon-dev libdbus-1-dev linux-libc-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev"
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev"
# libglewmx-dev (broken in deb testing currently...)
VORBIS_USE=true
@@ -4095,6 +4135,8 @@ install_DEB() {
PRINT ""
# Debian OIIO includes again libopencv, without even properly dealing with this dependency...
OIIO_FORCE_BUILD=true
if [ "$OIIO_SKIP" = true ]; then
WARNING "Skipping OpenImageIO installation, as requested..."
elif [ "$OIIO_FORCE_BUILD" = true ]; then
@@ -4493,10 +4535,11 @@ install_RPM() {
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison fontconfig-devel \
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
wayland-devel wayland-protocols-devel mesa-libEGL-devel libxkbcommon-devel dbus-devel kernel-headers \
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
gmp-devel pugixml-devel potrace-devel libharu-devel"
gmp-devel pugixml-devel potrace-devel libharu-devel libzstd-devel"
OPENJPEG_USE=true
VORBIS_USE=true
@@ -5074,10 +5117,11 @@ install_ARCH() {
BASE_DEVEL=`pacman -Sgq base-devel | sed -e 's/^gcc$/gcc-multilib/g' | paste -s -d' '`
fi
_packages="$BASE_DEVEL git cmake fontconfig \
_packages="$BASE_DEVEL git cmake fontconfig flex \
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu"
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu \
zstd"
OPENJPEG_USE=true
VORBIS_USE=true

View File

@@ -20,7 +20,7 @@
# ILMBASE_LIBRARIES - list of libraries to link against when using IlmBase.
# ILMBASE_FOUND - True if IlmBase was found.
# Other standarnd issue macros
# Other standard issue macros
include(FindPackageHandleStandardArgs)
include(FindPackageMessage)
include(SelectLibraryConfigurations)

View File

@@ -22,7 +22,7 @@
# These are defined by the FindIlmBase module.
# OPENEXR_FOUND - True if OpenEXR was found.
# Other standarnd issue macros
# Other standard issue macros
include(SelectLibraryConfigurations)
include(FindPackageHandleStandardArgs)
include(FindPackageMessage)

View File

@@ -1,5 +1,32 @@
cmake_minimum_required (VERSION 2.8)
project(tbb CXX)
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
if (POLICY CMP0048)
# cmake warns if loaded from a min-3.0-required parent dir, so silence the warning:
cmake_policy(SET CMP0048 NEW)
endif()
project (tbb CXX)
include(CheckCXXCompilerFlag)
include(CheckCXXSourceRuns)
if(POLICY CMP0058)
cmake_policy(SET CMP0058 NEW)
endif()
if(POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
endif()
if (POLICY CMP0078)
# swig standard target names
cmake_policy(SET CMP0078 NEW)
endif ()
if (POLICY CMP0086)
# UseSWIG honors SWIG_MODULE_NAME via -module flag
cmake_policy(SET CMP0086 NEW)
endif ()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
@@ -8,12 +35,36 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"MinSizeRel" "RelWithDebInfo")
endif()
include_directories(include src src/rml/include )
if(NOT TBB_INSTALL_RUNTIME_DIR)
set(TBB_INSTALL_RUNTIME_DIR bin)
endif()
if(NOT TBB_INSTALL_LIBRARY_DIR)
set(TBB_INSTALL_LIBRARY_DIR lib)
endif()
if(NOT TBB_INSTALL_ARCHIVE_DIR)
set(TBB_INSTALL_ARCHIVE_DIR lib)
endif()
if(NOT TBB_INSTALL_INCLUDE_DIR)
set(TBB_INSTALL_INCLUDE_DIR include)
endif()
if(NOT TBB_CMAKE_PACKAGE_INSTALL_DIR)
set(TBB_CMAKE_PACKAGE_INSTALL_DIR lib/cmake/tbb)
endif()
include_directories(include src src/rml/include ${CMAKE_CURRENT_BINARY_DIR})
option(TBB_BUILD_SHARED "Build TBB shared library" ON)
option(TBB_BUILD_STATIC "Build TBB static library" ON)
option(TBB_BUILD_TBBMALLOC "Build TBB malloc library" ON)
option(TBB_BUILD_TBBMALLOC_PROXY "Build TBB malloc proxy library" ON)
option(TBB_BUILD_TESTS "Build TBB tests and enable testing infrastructure" ON)
option(TBB_NO_DATE "Do not save the configure date in the version string" OFF)
option(TBB_BUILD_PYTHON "Build TBB Python bindings" OFF)
option(TBB_SET_SOVERSION "Set the SOVERSION (shared library build version suffix)?" OFF)
# When this repository is part of a larger build system of a parent project
# we may not want TBB to set up default installation targets
option(TBB_INSTALL_TARGETS "Include build targets for 'make install'" ON)
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
@@ -39,66 +90,143 @@ set(tbbmalloc_proxy_src
src/tbbmalloc/proxy.cpp
src/tbbmalloc/tbb_function_replacement.cpp)
if (NOT APPLE)
add_definitions(-DDO_ITT_NOTIFY)
else()
# Disable annoying "has no symbols" warnings
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
add_library (tbb_interface INTERFACE)
add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(i386|x86_64)")
if (NOT APPLE AND NOT MINGW)
target_compile_definitions(tbb_interface INTERFACE DO_ITT_NOTIFY)
endif()
endif()
if (APPLE)
# Disable annoying "has no symbols" warnings
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
endif()
macro(CHECK_CXX_COMPILER_AND_LINKER_FLAGS _RESULT _CXX_FLAGS _LINKER_FLAGS)
set(CMAKE_REQUIRED_FLAGS ${_CXX_FLAGS})
set(CMAKE_REQUIRED_LIBRARIES ${_LINKER_FLAGS})
set(CMAKE_REQUIRED_QUIET TRUE)
check_cxx_source_runs("#include <iostream>\nint main(int argc, char **argv) { std::cout << \"test\"; return 0; }" ${_RESULT})
set(CMAKE_REQUIRED_FLAGS "")
set(CMAKE_REQUIRED_LIBRARIES "")
endmacro()
# Prefer libc++ in conjunction with Clang
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_CXX_FLAGS MATCHES "-stdlib=libc\\+\\+")
message(STATUS "TBB: using libc++.")
else()
CHECK_CXX_COMPILER_AND_LINKER_FLAGS(HAS_LIBCPP "-stdlib=libc++" "-stdlib=libc++")
if (HAS_LIBCPP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -D_LIBCPP_VERSION")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++")
message(STATUS "TBB: using libc++.")
else()
message(STATUS "TBB: NOT using libc++.")
endif()
endif()
endif()
set (CMAKE_CXX_STANDARD 11)
if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DUSE_PTHREAD")
if(NOT CMAKE_CXX_FLAGS MATCHES "-mno-rtm")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mrtm")
endif()
if (APPLE)
set(ARCH_PREFIX "mac")
else()
set(ARCH_PREFIX "lin")
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_PREFIX "${ARCH_PREFIX}64")
else()
set(ARCH_PREFIX "${ARCH_PREFIX}32")
endif()
set(ENABLE_RTTI "-frtti -fexceptions ")
set(DISABLE_RTTI "-fno-rtti -fno-exceptions ")
elseif(WIN32)
cmake_minimum_required (VERSION 3.1)
enable_language(ASM_MASM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS- /Zc:wchar_t /Zc:forScope /DUSE_WINTHREAD")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0600 /volatile:iso")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4800 /wd4146 /wd4244 /wd4018")
target_compile_definitions(tbb_interface INTERFACE USE_PTHREAD)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND tbb_src src/tbb/intel64-masm/atomic_support.asm
src/tbb/intel64-masm/itsx.asm src/tbb/intel64-masm/intel64_misc.asm)
list(APPEND tbbmalloc_src src/tbb/intel64-masm/atomic_support.asm)
set(CMAKE_ASM_MASM_FLAGS "/DEM64T=1")
set(ARCH_PREFIX "win64")
else()
list(APPEND tbb_src src/tbb/ia32-masm/atomic_support.asm
src/tbb/ia32-masm/itsx.asm src/tbb/ia32-masm/lock_byte.asm)
list(APPEND tbbmalloc_src src/tbb/ia32-masm/atomic_support.asm)
set(ARCH_PREFIX "win32")
endif()
set(ENABLE_RTTI "/EHsc /GR ")
set(DISABLE_RTTI "/EHs- /GR- ")
check_cxx_compiler_flag ("-mrtm -Werror" SUPPORTS_MRTM)
if (SUPPORTS_MRTM)
target_compile_options(tbb_interface INTERFACE "-mrtm")
endif ()
elseif(WIN32)
target_compile_definitions(tbb_interface INTERFACE USE_WINTHREAD _WIN32_WINNT=0x0600)
if (MSVC)
enable_language(ASM_MASM)
target_compile_options(tbb_interface INTERFACE /GS- /Zc:wchar_t /Zc:forScope)
check_cxx_compiler_flag ("/volatile:iso" SUPPORTS_VOLATILE_FLAG)
if (SUPPORTS_VOLATILE_FLAG)
target_compile_options(tbb_interface INTERFACE /volatile:iso)
endif ()
target_compile_options(tbb_interface INTERFACE $<$<COMPILE_LANGUAGE:CXX>:/wd4267 /wd4800 /wd4146 /wd4244 /wd4577 /wd4018>)
if (NOT CMAKE_SIZEOF_VOID_P)
message(FATAL_ERROR "'CMAKE_SIZEOF_VOID_P' is undefined. Please delete your build directory and rerun CMake again!")
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND tbb_src src/tbb/intel64-masm/atomic_support.asm
src/tbb/intel64-masm/itsx.asm src/tbb/intel64-masm/intel64_misc.asm)
list(APPEND tbbmalloc_src src/tbb/intel64-masm/atomic_support.asm)
set(CMAKE_ASM_MASM_FLAGS "/DEM64T=1 ${CMAKE_ASM_MASM_FLAGS}")
else()
list(APPEND tbb_src src/tbb/ia32-masm/atomic_support.asm
src/tbb/ia32-masm/itsx.asm src/tbb/ia32-masm/lock_byte.asm)
# Enable SAFESEH feature for assembly (x86 builds only).
set(CMAKE_ASM_MASM_FLAGS "/safeseh ${CMAKE_ASM_MASM_FLAGS}")
endif()
elseif (MINGW)
target_compile_options(tbb_interface INTERFACE "-mthreads")
endif ()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-flifetime-dse=1" SUPPORTS_FLIFETIME)
if (SUPPORTS_FLIFETIME)
add_definitions(-flifetime-dse=1)
if (MSVC)
set(ENABLE_RTTI "/EHsc /GR ")
set(DISABLE_RTTI "/EHs- /GR- ")
elseif (UNIX)
set(ENABLE_RTTI "-frtti -fexceptions ")
set(DISABLE_RTTI "-fno-rtti -fno-exceptions ")
endif ()
##--------
# - Added TBB_USE_GLIBCXX_VERSION macro to specify the version of GNU
# libstdc++ when it cannot be properly recognized, e.g. when used
# with Clang on Linux* OS. Inspired by a contribution from David A.
if (NOT TBB_USE_GLIBCXX_VERSION AND UNIX AND NOT APPLE)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# using Clang
string(REPLACE "." "0" TBB_USE_GLIBCXX_VERSION ${CMAKE_CXX_COMPILER_VERSION})
endif()
endif()
if (TBB_USE_GLIBCXX_VERSION)
target_compile_definitions(tbb_interface INTERFACE TBB_USE_GLIBCXX_VERSION=${TBB_USE_GLIBCXX_VERSION})
endif()
##-------
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
check_cxx_compiler_flag ("-flifetime-dse=1" SUPPORTS_FLIFETIME)
if (SUPPORTS_FLIFETIME)
target_compile_options(tbb_interface INTERFACE -flifetime-dse=1)
endif()
endif()
# Linker export definitions
if (WIN32)
if (APPLE)
set (ARCH_PREFIX "mac")
elseif(WIN32)
set (ARCH_PREFIX "win")
else()
set (ARCH_PREFIX "lin")
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_PREFIX "${ARCH_PREFIX}64")
else()
set(ARCH_PREFIX "${ARCH_PREFIX}32")
endif()
if (MINGW)
set (ARCH_PREFIX "${ARCH_PREFIX}-gcc")
# there's no win32-gcc-tbb-export.def, use lin32-tbb-export.def
execute_process (COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/lin32-tbb-export.def ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/win32-gcc-tbb-export.def)
endif()
if (MSVC)
add_custom_command(OUTPUT tbb.def
COMMAND ${CMAKE_CXX_COMPILER} /TC /EP ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include > tbb.def
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def
@@ -110,18 +238,15 @@ if (WIN32)
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def
COMMENT "Preprocessing tbbmalloc.def"
)
list(APPEND tbb_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/tbb_resource.rc)
list(APPEND tbbmalloc_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/tbbmalloc.rc)
list(APPEND tbbmalloc_proxy_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/tbbmalloc.rc)
else()
add_custom_command(OUTPUT tbb.def
COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbb.def
COMMAND ${CMAKE_CXX_COMPILER} -xc++ -std=c++11 -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbb.def
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def
COMMENT "Preprocessing tbb.def"
)
add_custom_command(OUTPUT tbbmalloc.def
COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbbmalloc.def
COMMAND ${CMAKE_CXX_COMPILER} -xc++ -std=c++11 -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbbmalloc.def
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def
COMMENT "Preprocessing tbbmalloc.def"
)
@@ -132,34 +257,80 @@ add_custom_target(tbb_def_files DEPENDS tbb.def tbbmalloc.def)
# TBB library
if (TBB_BUILD_STATIC)
add_library(tbb_static STATIC ${tbb_src})
set_property(TARGET tbb_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_BUILD=1")
set_property(TARGET tbb_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_SOURCE_DIRECTLY_INCLUDED=1")
target_link_libraries(tbb_static PRIVATE tbb_interface)
target_include_directories(tbb_static INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" "$<INSTALL_INTERFACE:${TBB_INSTALL_INCLUDE_DIR}>")
set_property(TARGET tbb_static APPEND_STRING PROPERTY COMPILE_FLAGS ${ENABLE_RTTI})
install(TARGETS tbb_static ARCHIVE DESTINATION lib)
if (TBB_INSTALL_TARGETS)
install(TARGETS tbb_static ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR})
endif()
target_compile_definitions(tbb_static
PRIVATE
-D__TBB_BUILD=1
-D__TBB_DYNAMIC_LOAD_ENABLED=0
-D__TBB_SOURCE_DIRECTLY_INCLUDED=1)
if (MSVC)
target_compile_definitions(tbb_static
PUBLIC -D__TBB_NO_IMPLICIT_LINKAGE=1
PRIVATE -D_CRT_SECURE_NO_WARNINGS)
endif()
if (UNIX AND NOT APPLE)
target_link_libraries(tbb_static PUBLIC pthread dl)
endif()
endif()
if (TBB_BUILD_SHARED)
add_library(tbb SHARED ${tbb_src})
set_property(TARGET tbb APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_BUILD=1")
target_link_libraries(tbb PRIVATE tbb_interface)
target_include_directories(tbb INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" "$<INSTALL_INTERFACE:${TBB_INSTALL_INCLUDE_DIR}>")
set_property(TARGET tbb APPEND_STRING PROPERTY COMPILE_FLAGS ${ENABLE_RTTI})
add_dependencies(tbb tbb_def_files)
if (APPLE)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/tbb.def")
elseif(UNIX)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,${CMAKE_CURRENT_BINARY_DIR}/tbb.def")
elseif(WIN32)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/tbb.def")
if (TBB_SET_SOVERSION)
set_property(TARGET tbb PROPERTY SOVERSION 2)
endif ()
target_compile_definitions(tbb
PRIVATE -D__TBB_BUILD=1)
if (MSVC)
target_compile_definitions(tbb
PUBLIC -D__TBB_NO_IMPLICIT_LINKAGE=1
PRIVATE -D_CRT_SECURE_NO_WARNINGS)
endif()
install(TARGETS tbb DESTINATION lib)
if(WIN32)
set_target_properties(tbb PROPERTIES OUTPUT_NAME "tbb$<$<CONFIG:Debug>:_debug>")
add_dependencies(tbb tbb_def_files)
if (APPLE)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,\"${CMAKE_CURRENT_BINARY_DIR}/tbb.def\"")
elseif (MSVC)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "/DEF:\"${CMAKE_CURRENT_BINARY_DIR}/tbb.def\"")
else ()
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,\"${CMAKE_CURRENT_BINARY_DIR}/tbb.def\"")
endif()
if (TBB_INSTALL_TARGETS)
install(TARGETS tbb EXPORT TBB
LIBRARY DESTINATION ${TBB_INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR}
RUNTIME DESTINATION ${TBB_INSTALL_RUNTIME_DIR})
if (MSVC)
install(FILES $<TARGET_PDB_FILE:tbb> DESTINATION ${TBB_INSTALL_RUNTIME_DIR} OPTIONAL)
endif()
endif()
if (UNIX AND NOT APPLE)
target_link_libraries(tbb PUBLIC pthread dl)
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCC)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# Quench a warning on GCC
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/governor.cpp COMPILE_FLAGS "-Wno-missing-field-initializers ")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Quench a warning on Clang
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/itt_notify.cpp COMPILE_FLAGS "-Wno-varargs ")
elseif(MSVC)
# Quench a warning on MSVC
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/scheduler.cpp COMPILE_FLAGS "/wd4458 ")
@@ -169,24 +340,50 @@ if(TBB_BUILD_TBBMALLOC)
# TBB malloc library
if (TBB_BUILD_STATIC)
add_library(tbbmalloc_static STATIC ${tbbmalloc_static_src})
target_link_libraries(tbbmalloc_static PRIVATE tbb_interface)
set_property(TARGET tbbmalloc_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1")
set_property(TARGET tbbmalloc_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_DYNAMIC_LOAD_ENABLED=0")
set_property(TARGET tbbmalloc_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_SOURCE_DIRECTLY_INCLUDED=1")
set_property(TARGET tbbmalloc_static APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI})
install(TARGETS tbbmalloc_static ARCHIVE DESTINATION lib)
if (MSVC)
target_compile_definitions(tbbmalloc_static PUBLIC __TBB_NO_IMPLICIT_LINKAGE=1 __TBBMALLOC_NO_IMPLICIT_LINKAGE=1)
endif()
if (TBB_INSTALL_TARGETS)
install(TARGETS tbbmalloc_static ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR})
endif()
endif()
if (TBB_BUILD_SHARED)
add_library(tbbmalloc SHARED ${tbbmalloc_src})
target_link_libraries(tbbmalloc PRIVATE tbb_interface)
set_property(TARGET tbbmalloc APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1")
set_property(TARGET tbbmalloc APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI})
if (TBB_SET_SOVERSION)
set_property(TARGET tbbmalloc PROPERTY SOVERSION 2)
endif ()
add_dependencies(tbbmalloc tbb_def_files)
if (APPLE)
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def")
elseif(UNIX)
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def")
elseif(WIN32)
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def")
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,\"${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def\"")
elseif (MSVC)
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "/DEF:\"${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def\"")
else ()
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,\"${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def\"")
endif()
if (MSVC)
target_compile_definitions(tbbmalloc PUBLIC __TBB_NO_IMPLICIT_LINKAGE=1 __TBBMALLOC_NO_IMPLICIT_LINKAGE=1)
endif()
if (TBB_INSTALL_TARGETS)
install(TARGETS tbbmalloc EXPORT TBB
LIBRARY DESTINATION ${TBB_INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR}
RUNTIME DESTINATION ${TBB_INSTALL_RUNTIME_DIR})
if (MSVC)
install(FILES $<TARGET_PDB_FILE:tbbmalloc> DESTINATION ${TBB_INSTALL_RUNTIME_DIR} OPTIONAL)
endif()
endif()
if (UNIX AND NOT APPLE)
target_link_libraries(tbbmalloc PUBLIC pthread dl)
endif()
install(TARGETS tbbmalloc DESTINATION lib)
endif()
endif()
@@ -194,19 +391,298 @@ if(TBB_BUILD_TBBMALLOC_PROXY)
# TBB malloc proxy library
if (TBB_BUILD_STATIC)
add_library(tbbmalloc_proxy_static STATIC ${tbbmalloc_proxy_src})
target_link_libraries(tbbmalloc_proxy_static PRIVATE tbb_interface)
set_property(TARGET tbbmalloc_proxy_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1")
set_property(TARGET tbbmalloc_proxy_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_DYNAMIC_LOAD_ENABLED=0")
set_property(TARGET tbbmalloc_proxy_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_SOURCE_DIRECTLY_INCLUDED=1")
set_property(TARGET tbbmalloc_proxy_static APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI})
link_libraries(tbbmalloc_proxy_static tbbmalloc)
install(TARGETS tbbmalloc_proxy_static ARCHIVE DESTINATION lib)
if (TBB_INSTALL_TARGETS)
install(TARGETS tbbmalloc_proxy_static ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR})
endif()
endif()
if (TBB_BUILD_SHARED)
add_library(tbbmalloc_proxy SHARED ${tbbmalloc_proxy_src})
target_link_libraries(tbbmalloc_proxy PRIVATE tbb_interface)
set_property(TARGET tbbmalloc_proxy APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1")
set_property(TARGET tbbmalloc_proxy APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI})
target_link_libraries(tbbmalloc_proxy tbbmalloc)
install(TARGETS tbbmalloc_proxy DESTINATION lib)
if (TBB_SET_SOVERSION)
set_property(TARGET tbbmalloc_proxy PROPERTY SOVERSION 2)
endif ()
target_link_libraries(tbbmalloc_proxy PUBLIC tbbmalloc)
if (TBB_INSTALL_TARGETS)
install(TARGETS tbbmalloc_proxy EXPORT TBB
LIBRARY DESTINATION ${TBB_INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR}
RUNTIME DESTINATION ${TBB_INSTALL_RUNTIME_DIR})
if (MSVC)
install(FILES $<TARGET_PDB_FILE:tbbmalloc_proxy> DESTINATION ${TBB_INSTALL_RUNTIME_DIR} OPTIONAL)
endif()
endif()
if (UNIX AND NOT APPLE)
target_link_libraries(tbbmalloc_proxy PUBLIC pthread dl)
endif()
endif()
endif()
install(DIRECTORY include/tbb DESTINATION include)
if (TBB_INSTALL_TARGETS)
install(DIRECTORY include/tbb DESTINATION ${TBB_INSTALL_INCLUDE_DIR})
if (TBB_BUILD_SHARED)
install(EXPORT TBB DESTINATION ${TBB_CMAKE_PACKAGE_INSTALL_DIR} NAMESPACE TBB:: FILE TBBConfig.cmake)
endif()
endif()
# version file
if (TBB_INSTALL_TARGETS)
set (_VERSION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/include/tbb/tbb_stddef.h)
file (STRINGS ${_VERSION_FILE} _VERSION_MAJOR_STRING REGEX ".*define[ ]+TBB_VERSION_MAJOR[ ]+[0-9]+.*")
file (STRINGS ${_VERSION_FILE} _VERSION_MINOR_STRING REGEX ".*define[ ]+TBB_VERSION_MINOR[ ]+[0-9]+.*")
string (REGEX REPLACE ".*TBB_VERSION_MAJOR[ ]+([0-9]+)" "\\1" TBB_MAJOR_VERSION ${_VERSION_MAJOR_STRING})
string (REGEX REPLACE ".*TBB_VERSION_MINOR[ ]+([0-9]+)" "\\1" TBB_MINOR_VERSION ${_VERSION_MINOR_STRING})
set (TBB_VERSION_STRING "${TBB_MAJOR_VERSION}.${TBB_MINOR_VERSION}")
include (CMakePackageConfigHelpers)
write_basic_package_version_file (TBBConfigVersion.cmake VERSION "${TBB_VERSION_STRING}" COMPATIBILITY AnyNewerVersion)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/TBBConfigVersion.cmake DESTINATION "${TBB_CMAKE_PACKAGE_INSTALL_DIR}")
endif()
# version_string.ver
if (UNIX AND NOT TBB_NO_DATE)
execute_process (COMMAND date "+%a, %d %b %Y %H:%M:%S %z"
OUTPUT_VARIABLE _configure_date
OUTPUT_STRIP_TRAILING_WHITESPACE)
elseif (WIN32 AND NOT TBB_NO_DATE)
execute_process (COMMAND cmd " /C date /T"
OUTPUT_VARIABLE _configure_date
OUTPUT_STRIP_TRAILING_WHITESPACE)
else ()
set (_configure_date "Unknown")
endif()
set (TBB_CONFIG_DATE "${_configure_date}" CACHE STRING "First time that TBB was configured")
set (_configure_date "${TBB_CONFIG_DATE}")
include_directories (${CMAKE_BINARY_DIR})
configure_file (build/version_string.ver.in version_string.ver @ONLY)
if (TBB_BUILD_TESTS)
enable_language (C)
enable_testing ()
find_library (LIBRT_LIBRARIES rt)
find_library (LIDL_LIBRARIES dl)
find_package (Threads)
if (NOT APPLE)
find_package (OpenMP)
endif()
macro (tbb_add_test testname)
set (full_testname tbb_test_${testname})
add_executable (${full_testname} src/test/test_${testname}.cpp)
target_link_libraries(${full_testname} PRIVATE tbb_interface)
if (TBB_BUILD_SHARED)
target_link_libraries (${full_testname} PRIVATE tbb tbbmalloc)
target_compile_definitions (${full_testname} PRIVATE __TBB_LIB_NAME=tbb)
else ()
target_link_libraries (${full_testname} PRIVATE tbb_static tbbmalloc_static)
target_compile_definitions (${full_testname} PRIVATE __TBB_LIB_NAME=tbb_static)
endif ()
if (LIBRT_LIBRARIES)
target_link_libraries (${full_testname} PRIVATE ${LIBRT_LIBRARIES})
endif ()
if (LIDL_LIBRARIES)
target_link_libraries (${full_testname} PRIVATE ${LIDL_LIBRARIES})
endif ()
if (Threads_FOUND)
target_link_libraries (${full_testname} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
endif ()
if (OPENMP_FOUND AND "${testname}" MATCHES "openmp")
set_target_properties (${full_testname} PROPERTIES COMPILE_FLAGS "${OpenMP_CXX_FLAGS}")
set_target_properties (${full_testname} PROPERTIES LINK_FLAGS "${OpenMP_CXX_FLAGS}")
endif()
if (MINGW)
target_link_libraries (${full_testname} PRIVATE psapi)
endif ()
add_test (NAME ${full_testname} COMMAND ${full_testname})
endmacro ()
tbb_add_test (aggregator)
tbb_add_test (aligned_space)
tbb_add_test (assembly)
if (NOT WIN32)
tbb_add_test (async_msg) # msvc64/debug timeouts
endif()
tbb_add_test (async_node)
# tbb_add_test (atomic) # msvc64/debug timeouts: Compile-time initialization fails for static tbb::atomic variables
tbb_add_test (blocked_range2d)
tbb_add_test (blocked_range3d)
tbb_add_test (blocked_range)
tbb_add_test (broadcast_node)
tbb_add_test (buffer_node)
tbb_add_test (cache_aligned_allocator)
if (NOT WIN32)
tbb_add_test (cache_aligned_allocator_STL)
endif()
tbb_add_test (cilk_dynamic_load)
tbb_add_test (cilk_interop)
tbb_add_test (combinable)
tbb_add_test (composite_node)
tbb_add_test (concurrent_hash_map)
tbb_add_test (concurrent_lru_cache)
# tbb_add_test (concurrent_monitor) # too long
# tbb_add_test (concurrent_priority_queue)
if (NOT WIN32)
tbb_add_test (concurrent_queue) # msvc64/debug timeouts
endif()
# tbb_add_test (concurrent_queue_whitebox)
tbb_add_test (concurrent_unordered_map)
# tbb_add_test (concurrent_unordered_set)
tbb_add_test (concurrent_vector)
tbb_add_test (continue_node)
tbb_add_test (critical_section)
tbb_add_test (dynamic_link)
# tbb_add_test (eh_algorithms)
tbb_add_test (eh_flow_graph)
# tbb_add_test (eh_tasks)
tbb_add_test (enumerable_thread_specific)
tbb_add_test (examples_common_utility)
# tbb_add_test (fast_random)
tbb_add_test (flow_graph)
tbb_add_test (flow_graph_whitebox)
# tbb_add_test (fp) # mingw: harness_fp.h:66, assertion !checkConsistency || (ctl.mxcsr & SSE_RND_MODE_MASK) >> 3 == (ctl.x87cw & FE_RND_MODE_MASK): failed
# tbb_add_test (function_node) # mingw:random timeout
# tbb_add_test (global_control)
# tbb_add_test (global_control_whitebox)
tbb_add_test (halt)
tbb_add_test (handle_perror)
# tbb_add_test (hw_concurrency)
tbb_add_test (indexer_node)
tbb_add_test (inits_loop)
tbb_add_test (intrusive_list)
tbb_add_test (ittnotify)
# tbb_add_test (join_node) #msvc/64: fatal error C1128: number of sections exceeded object file format limit: compile with /bigob
tbb_add_test (lambda)
tbb_add_test (limiter_node)
# tbb_add_test (malloc_atexit)
# tbb_add_test (malloc_compliance) #mingw: Limits should be decreased for the test to work
tbb_add_test (malloc_init_shutdown)
# tbb_add_test (malloc_lib_unload)
# tbb_add_test (malloc_overload)
tbb_add_test (malloc_pools)
tbb_add_test (malloc_regression)
# tbb_add_test (malloc_used_by_lib)
# tbb_add_test (malloc_whitebox)
tbb_add_test (model_plugin)
# tbb_add_test (multifunction_node) # too long
tbb_add_test (mutex)
tbb_add_test (mutex_native_threads)
# tbb_add_test (opencl_node)
if (OPENMP_FOUND)
tbb_add_test (openmp)
endif ()
tbb_add_test (overwrite_node)
# tbb_add_test (parallel_do)
# This seems to fail on CI platforms (AppVeyor/Travis), perhaps because the VM exposes just 1 core?
tbb_add_test (parallel_for)
tbb_add_test (parallel_for_each)
tbb_add_test (parallel_for_vectorization)
tbb_add_test (parallel_invoke)
tbb_add_test (parallel_pipeline)
tbb_add_test (parallel_reduce)
tbb_add_test (parallel_scan)
tbb_add_test (parallel_sort)
tbb_add_test (parallel_while)
# tbb_add_test (partitioner_whitebox) # too long
tbb_add_test (pipeline)
# tbb_add_test (pipeline_with_tbf) # takes forever on appveyor
tbb_add_test (priority_queue_node)
tbb_add_test (queue_node)
tbb_add_test (reader_writer_lock)
# tbb_add_test (runtime_loader) # LINK : fatal error LNK1104: cannot open file 'tbbproxy.lib' [C:\projects\tbb\test_runtime_loader.vcxproj]
tbb_add_test (rwm_upgrade_downgrade)
# tbb_add_test (ScalableAllocator)
if (NOT WIN32)
tbb_add_test (ScalableAllocator_STL)
endif()
tbb_add_test (semaphore)
# tbb_add_test (sequencer_node) # msvc: timeout
tbb_add_test (source_node)
tbb_add_test (split_node)
tbb_add_test (static_assert)
tbb_add_test (std_thread)
tbb_add_test (tagged_msg)
# tbb_add_test (task_arena) # LINK : fatal error LNK1104: cannot open file '__TBB_LIB_NAME.lib' [C:\projects\tbb\test_task_arena.vcxproj]
# tbb_add_test (task_assertions)
tbb_add_test (task_auto_init)
tbb_add_test (task)
# tbb_add_test (task_enqueue) # too long
tbb_add_test (task_group)
# tbb_add_test (task_leaks)
# tbb_add_test (task_priority)
# tbb_add_test (task_scheduler_init) # msvc: test_task_scheduler_init.cpp:68, assertion !test_mandatory_parallelism || Harness::CanReachConcurrencyLevel(threads): failed
tbb_add_test (task_scheduler_observer)
tbb_add_test (task_steal_limit)
tbb_add_test (tbb_condition_variable)
tbb_add_test (tbb_fork)
# tbb_add_test (tbb_header)
tbb_add_test (tbb_thread)
# tbb_add_test (tbb_version)
tbb_add_test (tick_count)
tbb_add_test (tuple)
tbb_add_test (write_once_node)
tbb_add_test (yield)
endif ()
if (TBB_BUILD_PYTHON)
find_package(PythonInterp)
find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT)
find_package(SWIG 3)
if (PythonLibs_FOUND AND SWIG_FOUND AND TBB_BUILD_SHARED)
include (${SWIG_USE_FILE})
set_source_files_properties (python/tbb/api.i PROPERTIES CPLUSPLUS ON)
set (CMAKE_SWIG_FLAGS "-threads")
# swig_add_module is deprecated
if (CMAKE_VERSION VERSION_LESS 3.8)
swig_add_module (api python python/tbb/api.i)
else ()
swig_add_library (api LANGUAGE python SOURCES python/tbb/api.i)
endif ()
# UseSWIG generates now standard target names
if (CMAKE_VERSION VERSION_LESS 3.13)
set (module_target ${SWIG_MODULE_api_REAL_NAME})
else ()
set (module_target api)
endif ()
target_include_directories(${module_target} PRIVATE ${PYTHON_INCLUDE_DIRS})
target_link_libraries(${module_target} PRIVATE tbb)
if(WIN32)
target_link_libraries(${module_target} ${PYTHON_LIBRARIES})
elseif(APPLE)
set_target_properties(${module_target} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
endif()
if (WIN32)
set (PYTHON_SITE_PACKAGES Lib/site-packages)
else ()
set (PYTHON_SITE_PACKAGES lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
endif ()
if (TBB_INSTALL_TARGETS)
install(FILES python/TBB.py
DESTINATION ${PYTHON_SITE_PACKAGES})
install(FILES python/tbb/__init__.py python/tbb/pool.py python/tbb/test.py python/tbb/__main__.py ${CMAKE_CURRENT_BINARY_DIR}/api.py
DESTINATION ${PYTHON_SITE_PACKAGES}/tbb)
install(TARGETS ${module_target}
DESTINATION ${PYTHON_SITE_PACKAGES}/tbb)
endif()
if(UNIX AND NOT APPLE)
add_library(irml SHARED python/rml/ipc_server.cpp python/rml/ipc_utils.cpp src/tbb/cache_aligned_allocator.cpp src/tbb/dynamic_link.cpp src/tbb/tbb_misc_ex.cpp src/tbb/tbb_misc.cpp)
target_compile_definitions(irml PRIVATE DO_ITT_NOTIFY=0 USE_PTHREAD=1)
target_link_libraries(irml PRIVATE tbb)
set_target_properties(irml PROPERTIES VERSION 1)
if (TBB_INSTALL_TARGETS)
install(TARGETS irml DESTINATION ${TBB_INSTALL_LIBRARY_DIR})
endif()
endif ()
endif ()
endif ()

View File

@@ -68,3 +68,32 @@
+
return ret;
}
--- a/libavcodec/rl.c
+++ b/libavcodec/rl.c
@@ -71,7 +71,7 @@ av_cold void ff_rl_init(RLTable *rl,
av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
{
int i, q;
- VLC_TYPE table[1500][2] = {{0}};
+ VLC_TYPE (*table)[2] = av_calloc(sizeof(VLC_TYPE), 1500 * 2);
VLC vlc = { .table = table, .table_allocated = static_size };
av_assert0(static_size <= FF_ARRAY_ELEMS(table));
init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
@@ -80,8 +80,10 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
int qmul = q * 2;
int qadd = (q - 1) | 1;
- if (!rl->rl_vlc[q])
+ if (!rl->rl_vlc[q]){
+ av_free(table);
return;
+ }
if (q == 0) {
qmul = 1;
@@ -113,4 +115,5 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
rl->rl_vlc[q][i].run = run;
}
}
+ av_free(table);
}

View File

@@ -1,40 +0,0 @@
diff -Naur oidn-1.3.0/cmake/FindTBB.cmake external_openimagedenoise/cmake/FindTBB.cmake
--- oidn-1.3.0/cmake/FindTBB.cmake 2021-02-04 16:20:26 -0700
+++ external_openimagedenoise/cmake/FindTBB.cmake 2021-02-12 09:35:53 -0700
@@ -332,20 +332,22 @@
${TBB_ROOT}/lib/${TBB_ARCH}/${TBB_VCVER}
${TBB_ROOT}/lib
)
-
# On Windows, also search the DLL so that the client may install it.
file(GLOB DLL_NAMES
${TBB_ROOT}/bin/${TBB_ARCH}/${TBB_VCVER}/${LIB_NAME}.dll
${TBB_ROOT}/bin/${LIB_NAME}.dll
+ ${TBB_ROOT}/lib/${LIB_NAME}.dll
${TBB_ROOT}/redist/${TBB_ARCH}/${TBB_VCVER}/${LIB_NAME}.dll
${TBB_ROOT}/redist/${TBB_ARCH}/${TBB_VCVER}/${LIB_NAME_GLOB1}.dll
${TBB_ROOT}/redist/${TBB_ARCH}/${TBB_VCVER}/${LIB_NAME_GLOB2}.dll
${TBB_ROOT}/../redist/${TBB_ARCH}/tbb/${TBB_VCVER}/${LIB_NAME}.dll
${TBB_ROOT}/../redist/${TBB_ARCH}_win/tbb/${TBB_VCVER}/${LIB_NAME}.dll
)
- list(GET DLL_NAMES 0 DLL_NAME)
- get_filename_component(${BIN_DIR_VAR} "${DLL_NAME}" DIRECTORY)
- set(${DLL_VAR} "${DLL_NAME}" CACHE PATH "${COMPONENT_NAME} ${BUILD_CONFIG} dll path")
+ if (DLL_NAMES)
+ list(GET DLL_NAMES 0 DLL_NAME)
+ get_filename_component(${BIN_DIR_VAR} "${DLL_NAME}" DIRECTORY)
+ set(${DLL_VAR} "${DLL_NAME}" CACHE PATH "${COMPONENT_NAME} ${BUILD_CONFIG} dll path")
+ endif()
elseif(APPLE)
set(LIB_PATHS ${TBB_ROOT}/lib)
else()
--- external_openimagedenoise/cmake/oidn_ispc.cmake 2021-02-15 17:29:34.000000000 +0100
+++ external_openimagedenoise/cmake/oidn_ispc.cmake2 2021-02-15 17:29:28.000000000 +0100
@@ -98,7 +98,7 @@
elseif(OIDN_ARCH STREQUAL "ARM64")
set(ISPC_ARCHITECTURE "aarch64")
if(APPLE)
- set(ISPC_TARGET_OS "--target-os=ios")
+ set(ISPC_TARGET_OS "--target-os=macos")
endif()
endif()

View File

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

View File

@@ -1,18 +1,3 @@
diff -Naur OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej external_osl/src/cmake/flexbison.cmake.rej
--- OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej 1969-12-31 17:00:00 -0700
+++ external_osl/src/cmake/flexbison.cmake.rej 2018-08-24 17:42:11 -0600
@@ -0,0 +1,11 @@
+--- src/cmake/flexbison.cmake 2018-05-01 16:39:02 -0600
++++ src/cmake/flexbison.cmake 2018-08-24 10:24:03 -0600
+@@ -77,7 +77,7 @@
+ DEPENDS ${${compiler_headers}}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
+ ADD_CUSTOM_COMMAND ( OUTPUT ${flexoutputcxx}
+- COMMAND ${FLEX_EXECUTABLE} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
++ COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXTRA_OPTIONS} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
+ MAIN_DEPENDENCY ${flexsrc}
+ DEPENDS ${${compiler_headers}}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
diff -Naur OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h external_osl/src/include/OSL/llvm_util.h
--- OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h 2018-05-01 16:39:02 -0600
+++ external_osl/src/include/OSL/llvm_util.h 2018-08-25 14:05:00 -0600
@@ -63,19 +48,50 @@ 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/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp
index 445f6400..3d468de2 100644
--- a/src/liboslexec/llvm_util.cpp
+++ b/src/liboslexec/llvm_util.cpp
@@ -3430,8 +3430,9 @@ LLVM_Util::call_function (llvm::Value *func, cspan<llvm::Value *> args)
#endif
//llvm_gen_debug_printf (std::string("start ") + std::string(name));
#if OSL_LLVM_VERSION >= 110
- OSL_DASSERT(llvm::isa<llvm::Function>(func));
- llvm::Value *r = builder().CreateCall(llvm::cast<llvm::Function>(func), llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
+ llvm::Value* r = builder().CreateCall(
+ llvm::cast<llvm::FunctionType>(func->getType()->getPointerElementType()), func,
+ llvm::ArrayRef<llvm::Value*>(args.data(), args.size()));
#else
llvm::Value *r = builder().CreateCall (func, llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
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
@@ -80,6 +80,7 @@
checked_find_package (ZLIB REQUIRED) # Needed by several packages
+checked_find_package (PNG REQUIRED) # Needed since OIIO needs it
# IlmBase & OpenEXR
checked_find_package (OpenEXR REQUIRED
diff -Naur external_osl_orig/src/liboslcomp/oslcomp.cpp external_osl/src/liboslcomp/oslcomp.cpp
--- external_osl_orig/src/liboslcomp/oslcomp.cpp 2021-06-01 13:44:18 -0600
+++ external_osl/src/liboslcomp/oslcomp.cpp 2021-06-28 09:11:06 -0600
@@ -21,6 +21,13 @@
#if !defined(__STDC_CONSTANT_MACROS)
# define __STDC_CONSTANT_MACROS 1
#endif
+
+// clang uses CALLBACK in its templates which causes issues if it is already defined
+#ifdef _WIN32 && defined(CALLBACK)
+# undef CALLBACK
+#endif
+
+//
#include <clang/Basic/TargetInfo.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>

View File

@@ -10,4 +10,15 @@ index 7a8d06a0..886699d8 100644
+ #if (__cplusplus >= 201402L && (!defined(_MSC_VER) || _MSC_VER >= 1920))
#define __TBB_DEPRECATED [[deprecated]]
#define __TBB_DEPRECATED_MSG(msg) [[deprecated(msg)]]
#elif _MSC_VER
#elif _MSC_VER
--- a/src/tbb/tools_api/ittnotify_config.h
+++ b/src/tbb/tools_api/ittnotify_config.h
@@ -162,7 +162,7 @@
# define ITT_ARCH ITT_ARCH_IA32E
# elif defined _M_IA64 || defined __ia64__
# define ITT_ARCH ITT_ARCH_IA64
-# elif defined _M_ARM || defined __arm__
+# elif defined _M_ARM || defined __arm__ || defined __aarch64__
# define ITT_ARCH ITT_ARCH_ARM
# elif defined __powerpc64__
# define ITT_ARCH ITT_ARCH_PPC64

View File

@@ -4,7 +4,7 @@
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
+ | aarch64 \
+ | aarch64 \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
@@ -12,7 +12,7 @@
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
+ | aarch64-* \
+ | aarch64-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \

View File

@@ -53,3 +53,147 @@ diff -ru USD-20.11/pxr/base/tf/pxrLZ4/lz4.cpp external_usd/pxr/base/tf/pxrLZ4/lz
/*-******************************
* 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.
*/
- 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

View File

@@ -1,70 +1,4 @@
Blender Buildbot
================
Buildbot Configuration
=====================
Code signing
------------
Code signing is done as part of INSTALL target, which makes it possible to sign
files which are aimed into a bundle and coming from a non-signed source (such as
libraries SVN).
This is achieved by specifying `worker_codesign.cmake` as a post-install script
run by CMake. This CMake script simply involves an utility script written in
Python which takes care of an actual signing.
### Configuration
Client configuration doesn't need anything special, other than variable
`SHARED_STORAGE_DIR` pointing to a location which is watched by a server.
This is done in `config_builder.py` file and is stored in Git (which makes it
possible to have almost zero-configuration buildbot machines).
Server configuration requires copying `config_server_template.py` under the
name of `config_server.py` and tweaking values, which are platform-specific.
#### Windows configuration
There are two things which are needed on Windows in order to have code signing
to work:
- `TIMESTAMP_AUTHORITY_URL` which is most likely set http://timestamp.digicert.com
- `CERTIFICATE_FILEPATH` which is a full file path to a PKCS #12 key (.pfx).
## Tips
### Self-signed certificate on Windows
It is easiest to test configuration using self-signed certificate.
The certificate manipulation utilities are coming with Windows SDK.
Unfortunately, they are not added to PATH. Here is an example of how to make
sure they are easily available:
```
set PATH=C:\Program Files (x86)\Windows Kits\10\App Certification Kit;%PATH%
set PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64;%PATH%
```
Generate CA:
```
makecert -r -pe -n "CN=Blender Test CA" -ss CA -sr CurrentUser -a sha256 ^
-cy authority -sky signature -sv BlenderTestCA.pvk BlenderTestCA.cer
```
Import the generated CA:
```
certutil -user -addstore Root BlenderTestCA.cer
```
Create self-signed certificate and pack it into PKCS #12:
```
makecert -pe -n "CN=Blender Test SPC" -a sha256 -cy end ^
-sky signature ^
-ic BlenderTestCA.cer -iv BlenderTestCA.pvk ^
-sv BlenderTestSPC.pvk BlenderTestSPC.cer
pvk2pfx -pvk BlenderTestSPC.pvk -spc BlenderTestSPC.cer -pfx BlenderTestSPC.pfx
```
Files used by Buildbot's `compile-code` step.

View File

@@ -1,127 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import argparse
import os
import re
import subprocess
import sys
def is_tool(name):
"""Check whether `name` is on PATH and marked as executable."""
# from whichcraft import which
from shutil import which
return which(name) is not None
class Builder:
def __init__(self, name, branch, codesign):
self.name = name
self.branch = branch
self.is_release_branch = re.match("^blender-v(.*)-release$", branch) is not None
self.codesign = codesign
# Buildbot runs from build/ directory
self.blender_dir = os.path.abspath(os.path.join('..', 'blender.git'))
self.build_dir = os.path.abspath(os.path.join('..', 'build'))
self.install_dir = os.path.abspath(os.path.join('..', 'install'))
self.upload_dir = os.path.abspath(os.path.join('..', 'install'))
# Detect platform
if name.startswith('mac'):
self.platform = 'mac'
self.command_prefix = []
elif name.startswith('linux'):
self.platform = 'linux'
if is_tool('scl'):
self.command_prefix = ['scl', 'enable', 'devtoolset-9', '--']
else:
self.command_prefix = []
elif name.startswith('win'):
self.platform = 'win'
self.command_prefix = []
else:
raise ValueError('Unkonw platform for builder ' + self.platform)
# Always 64 bit now
self.bits = 64
def create_builder_from_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('builder_name')
parser.add_argument('branch', default='master', nargs='?')
parser.add_argument("--codesign", action="store_true")
args = parser.parse_args()
return Builder(args.builder_name, args.branch, args.codesign)
class VersionInfo:
def __init__(self, builder):
# Get version information
buildinfo_h = os.path.join(builder.build_dir, "source", "creator", "buildinfo.h")
blender_h = os.path.join(builder.blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h")
version_number = int(self._parse_header_file(blender_h, 'BLENDER_VERSION'))
version_number_patch = int(self._parse_header_file(blender_h, 'BLENDER_VERSION_PATCH'))
version_numbers = (version_number // 100, version_number % 100, version_number_patch)
self.short_version = "%d.%02d" % (version_numbers[0], version_numbers[1])
self.version = "%d.%02d.%d" % version_numbers
self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE')
self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]
if self.version_cycle == "release":
# Final release
self.full_version = self.version
self.is_development_build = False
elif self.version_cycle == "rc":
# Release candidate
self.full_version = self.version + self.version_cycle
self.is_development_build = False
else:
# Development build
self.full_version = self.version + '-' + self.hash
self.is_development_build = True
def _parse_header_file(self, filename, define):
import re
regex = re.compile(r"^#\s*define\s+%s\s+(.*)" % define)
with open(filename, "r") as file:
for l in file:
match = regex.match(l)
if match:
return match.group(1)
return None
def call(cmd, env=None, exit_on_error=True):
print(' '.join(cmd))
# Flush to ensure correct order output on Windows.
sys.stdout.flush()
sys.stderr.flush()
retcode = subprocess.call(cmd, env=env)
if exit_on_error and retcode != 0:
sys.exit(retcode)
return retcode

View File

@@ -1,81 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
from dataclasses import dataclass
from pathlib import Path
from typing import List
@dataclass
class AbsoluteAndRelativeFileName:
"""
Helper class which keeps track of absolute file path for a direct access and
corresponding relative path against given base.
The relative part is used to construct a file name within an archive which
contains files which are to be signed or which has been signed already
(depending on whether the archive is addressed to signing server or back
to the buildbot worker).
"""
# Base directory which is where relative_filepath is relative to.
base_dir: Path
# Full absolute path of the corresponding file.
absolute_filepath: Path
# Derived from full file path, contains part of the path which is relative
# to a desired base path.
relative_filepath: Path
def __init__(self, base_dir: Path, filepath: Path):
self.base_dir = base_dir
self.absolute_filepath = filepath.resolve()
self.relative_filepath = self.absolute_filepath.relative_to(
self.base_dir)
@classmethod
def from_path(cls, path: Path) -> 'AbsoluteAndRelativeFileName':
assert path.is_absolute()
assert path.is_file()
base_dir = path.parent
return AbsoluteAndRelativeFileName(base_dir, path)
@classmethod
def recursively_from_directory(cls, base_dir: Path) \
-> List['AbsoluteAndRelativeFileName']:
"""
Create list of AbsoluteAndRelativeFileName for all the files in the
given directory.
NOTE: Result will be pointing to a resolved paths.
"""
assert base_dir.is_absolute()
assert base_dir.is_dir()
base_dir = base_dir.resolve()
result = []
for filename in base_dir.glob('**/*'):
if not filename.is_file():
continue
result.append(AbsoluteAndRelativeFileName(base_dir, filename))
return result

View File

@@ -1,245 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import dataclasses
import json
import os
from pathlib import Path
from typing import Optional
import codesign.util as util
class ArchiveStateError(Exception):
message: str
def __init__(self, message):
self.message = message
super().__init__(self.message)
@dataclasses.dataclass
class ArchiveState:
"""
Additional information (state) of the archive
Includes information like expected file size of the archive file in the case
the archive file is expected to be successfully created.
If the archive can not be created, this state will contain error message
indicating details of error.
"""
# Size in bytes of the corresponding archive.
file_size: Optional[int] = None
# Non-empty value indicates that error has happenned.
error_message: str = ''
def has_error(self) -> bool:
"""
Check whether the archive is at error state
"""
return self.error_message
def serialize_to_string(self) -> str:
payload = dataclasses.asdict(self)
return json.dumps(payload, sort_keys=True, indent=4)
def serialize_to_file(self, filepath: Path) -> None:
string = self.serialize_to_string()
filepath.write_text(string)
@classmethod
def deserialize_from_string(cls, string: str) -> 'ArchiveState':
try:
object_as_dict = json.loads(string)
except json.decoder.JSONDecodeError:
raise ArchiveStateError('Error parsing JSON')
return cls(**object_as_dict)
@classmethod
def deserialize_from_file(cls, filepath: Path):
string = filepath.read_text()
return cls.deserialize_from_string(string)
class ArchiveWithIndicator:
"""
The idea of this class is to wrap around logic which takes care of keeping
track of a name of an archive and synchronization routines between buildbot
worker and signing server.
The synchronization is done based on creating a special file after the
archive file is knowingly ready for access.
"""
# Base directory where the archive is stored (basically, a basename() of
# the absolute archive file name).
#
# For example, 'X:\\TEMP\\'.
base_dir: Path
# Absolute file name of the archive.
#
# For example, 'X:\\TEMP\\FOO.ZIP'.
archive_filepath: Path
# Absolute name of a file which acts as an indication of the fact that the
# archive is ready and is available for access.
#
# This is how synchronization between buildbot worker and signing server is
# done:
# - First, the archive is created under archive_filepath name.
# - Second, the indication file is created under ready_indicator_filepath
# name.
# - Third, the colleague of whoever created the indicator name watches for
# the indication file to appear, and once it's there it access the
# archive.
ready_indicator_filepath: Path
def __init__(
self, base_dir: Path, archive_name: str, ready_indicator_name: str):
"""
Construct the object from given base directory and name of the archive
file:
ArchiveWithIndicator(Path('X:\\TEMP'), 'FOO.ZIP', 'INPUT_READY')
"""
self.base_dir = base_dir
self.archive_filepath = self.base_dir / archive_name
self.ready_indicator_filepath = self.base_dir / ready_indicator_name
def is_ready_unsafe(self) -> bool:
"""
Check whether the archive is ready for access.
No guarding about possible network failres is done here.
"""
if not self.ready_indicator_filepath.exists():
return False
try:
archive_state = ArchiveState.deserialize_from_file(
self.ready_indicator_filepath)
except ArchiveStateError as error:
print(f'Error deserializing archive state: {error.message}')
return False
if archive_state.has_error():
# If the error did happen during codesign procedure there will be no
# corresponding archive file.
# The caller code will deal with the error check further.
return True
# Sometimes on macOS indicator file appears prior to the actual archive
# despite the order of creation and os.sync() used in tag_ready().
# So consider archive not ready if there is an indicator without an
# actual archive.
if not self.archive_filepath.exists():
print('Found indicator without actual archive, waiting for archive '
f'({self.archive_filepath}) to appear.')
return False
# Wait for until archive is fully stored.
actual_archive_size = self.archive_filepath.stat().st_size
if actual_archive_size != archive_state.file_size:
print('Partial/invalid archive size (expected '
f'{archive_state.file_size} got {actual_archive_size})')
return False
return True
def is_ready(self) -> bool:
"""
Check whether the archive is ready for access.
Will tolerate possible network failures: if there is a network failure
or if there is still no proper permission on a file False is returned.
"""
# There are some intermitten problem happening at a random which is
# translates to "OSError : [WinError 59] An unexpected network error occurred".
# Some reports suggests it might be due to lack of permissions to the file,
# which might be applicable in our case since it's possible that file is
# initially created with non-accessible permissions and gets chmod-ed
# after initial creation.
try:
return self.is_ready_unsafe()
except OSError as e:
print(f'Exception checking archive: {e}')
return False
def tag_ready(self, error_message='') -> None:
"""
Tag the archive as ready by creating the corresponding indication file.
NOTE: It is expected that the archive was never tagged as ready before
and that there are no subsequent tags of the same archive.
If it is violated, an assert will fail.
"""
assert not self.is_ready()
# Try the best to make sure everything is synced to the file system,
# to avoid any possibility of stamp appearing on a network share prior to
# an actual file.
if util.get_current_platform() != util.Platform.WINDOWS:
os.sync()
archive_size = -1
if self.archive_filepath.exists():
archive_size = self.archive_filepath.stat().st_size
archive_info = ArchiveState(
file_size=archive_size, error_message=error_message)
self.ready_indicator_filepath.write_text(
archive_info.serialize_to_string())
def get_state(self) -> ArchiveState:
"""
Get state object for this archive
The state is read from the corresponding state file.
"""
try:
return ArchiveState.deserialize_from_file(self.ready_indicator_filepath)
except ArchiveStateError as error:
return ArchiveState(error_message=f'Error in information format: {error}')
def clean(self) -> None:
"""
Remove both archive and the ready indication file.
"""
util.ensure_file_does_not_exist_or_die(self.ready_indicator_filepath)
util.ensure_file_does_not_exist_or_die(self.archive_filepath)
def is_fully_absent(self) -> bool:
"""
Check whether both archive and its ready indicator are absent.
Is used for a sanity check during code signing process by both
buildbot worker and signing server.
"""
return (not self.archive_filepath.exists() and
not self.ready_indicator_filepath.exists())

View File

@@ -1,501 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Signing process overview.
#
# From buildbot worker side:
# - Files which needs to be signed are collected from either a directory to
# sign all signable files in there, or by filename of a single file to sign.
# - Those files gets packed into an archive and stored in a location location
# which is watched by the signing server.
# - A marker READY file is created which indicates the archive is ready for
# access.
# - Wait for the server to provide an archive with signed files.
# This is done by watching for the READY file which corresponds to an archive
# coming from the signing server.
# - Unpack the signed signed files from the archives and replace original ones.
#
# From code sign server:
# - Watch special location for a READY file which indicates the there is an
# archive with files which are to be signed.
# - Unpack the archive to a temporary location.
# - Run codesign tool and make sure all the files are signed.
# - Pack the signed files and store them in a location which is watched by
# the buildbot worker.
# - Create a READY file which indicates that the archive with signed files is
# ready.
import abc
import logging
import shutil
import subprocess
import time
import tarfile
import uuid
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Iterable, List
import codesign.util as util
from codesign.absolute_and_relative_filename import AbsoluteAndRelativeFileName
from codesign.archive_with_indicator import ArchiveWithIndicator
from codesign.exception import CodeSignException
logger = logging.getLogger(__name__)
logger_builder = logger.getChild('builder')
logger_server = logger.getChild('server')
def pack_files(files: Iterable[AbsoluteAndRelativeFileName],
archive_filepath: Path) -> None:
"""
Create tar archive from given files for the signing pipeline.
Is used by buildbot worker to create an archive of files which are to be
signed, and by signing server to send signed files back to the worker.
"""
with tarfile.TarFile.open(archive_filepath, 'w') as tar_file_handle:
for file_info in files:
tar_file_handle.add(file_info.absolute_filepath,
arcname=file_info.relative_filepath)
def extract_files(archive_filepath: Path,
extraction_dir: Path) -> None:
"""
Extract all files form the given archive into the given direcotry.
"""
# TODO(sergey): Verify files in the archive have relative path.
with tarfile.TarFile.open(archive_filepath, mode='r') as tar_file_handle:
tar_file_handle.extractall(path=extraction_dir)
class BaseCodeSigner(metaclass=abc.ABCMeta):
"""
Base class for a platform-specific signer of binaries.
Contains all the logic shared across platform-specific implementations, such
as synchronization and notification logic.
Platform specific bits (such as actual command for signing the binary) are
to be implemented as a subclass.
Provides utilities code signing as a whole, including functionality needed
by a signing server and a buildbot worker.
The signer and builder may run on separate machines, the only requirement is
that they have access to a directory which is shared between them. For the
security concerns this is to be done as a separate machine (or as a Shared
Folder configuration in VirtualBox configuration). This directory might be
mounted under different base paths, but its underlying storage is to be
the same.
The code signer is short-lived on a buildbot worker side, and is living
forever on a code signing server side.
"""
# TODO(sergey): Find a neat way to have config annotated.
# config: Config
# Storage directory where builder puts files which are requested to be
# signed.
# Consider this an input of the code signing server.
unsigned_storage_dir: Path
# Storage where signed files are stored.
# Consider this an output of the code signer server.
signed_storage_dir: Path
# Platform the code is currently executing on.
platform: util.Platform
def __init__(self, config):
self.config = config
absolute_shared_storage_dir = config.SHARED_STORAGE_DIR.resolve()
# Unsigned (signing server input) configuration.
self.unsigned_storage_dir = absolute_shared_storage_dir / 'unsigned'
# Signed (signing server output) configuration.
self.signed_storage_dir = absolute_shared_storage_dir / 'signed'
self.platform = util.get_current_platform()
def cleanup_environment_for_builder(self) -> None:
# TODO(sergey): Revisit need of cleaning up the existing files.
# In practice it wasn't so helpful, and with multiple clients
# talking to the same server it becomes even more tricky.
pass
def cleanup_environment_for_signing_server(self) -> None:
# TODO(sergey): Revisit need of cleaning up the existing files.
# In practice it wasn't so helpful, and with multiple clients
# talking to the same server it becomes even more tricky.
pass
def generate_request_id(self) -> str:
"""
Generate an unique identifier for code signing request.
"""
return str(uuid.uuid4())
def archive_info_for_request_id(
self, path: Path, request_id: str) -> ArchiveWithIndicator:
return ArchiveWithIndicator(
path, f'{request_id}.tar', f'{request_id}.ready')
def signed_archive_info_for_request_id(
self, request_id: str) -> ArchiveWithIndicator:
return self.archive_info_for_request_id(
self.signed_storage_dir, request_id)
def unsigned_archive_info_for_request_id(
self, request_id: str) -> ArchiveWithIndicator:
return self.archive_info_for_request_id(
self.unsigned_storage_dir, request_id)
############################################################################
# Buildbot worker side helpers.
@abc.abstractmethod
def check_file_is_to_be_signed(
self, file: AbsoluteAndRelativeFileName) -> bool:
"""
Check whether file is to be signed.
Is used by both single file signing pipeline and recursive directory
signing pipeline.
This is where code signer is to check whether file is to be signed or
not. This check might be based on a simple extension test or on actual
test whether file have a digital signature already or not.
"""
def collect_files_to_sign(self, path: Path) \
-> List[AbsoluteAndRelativeFileName]:
"""
Get all files which need to be signed from the given path.
NOTE: The path might either be a file or directory.
This function is run from the buildbot worker side.
"""
# If there is a single file provided trust the buildbot worker that it
# is eligible for signing.
if path.is_file():
file = AbsoluteAndRelativeFileName.from_path(path)
if not self.check_file_is_to_be_signed(file):
return []
return [file]
all_files = AbsoluteAndRelativeFileName.recursively_from_directory(
path)
files_to_be_signed = [file for file in all_files
if self.check_file_is_to_be_signed(file)]
return files_to_be_signed
def wait_for_signed_archive_or_die(self, request_id) -> None:
"""
Wait until archive with signed files is available.
Will only return if the archive with signed files is available. If there
was an error during code sign procedure the SystemExit exception is
raised, with the message set to the error reported by the codesign
server.
Will only wait for the configured time. If that time exceeds and there
is still no responce from the signing server the application will exit
with a non-zero exit code.
"""
signed_archive_info = self.signed_archive_info_for_request_id(
request_id)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
timeout_in_seconds = self.config.TIMEOUT_IN_SECONDS
time_start = time.monotonic()
while not signed_archive_info.is_ready():
time.sleep(1)
time_slept_in_seconds = time.monotonic() - time_start
if time_slept_in_seconds > timeout_in_seconds:
signed_archive_info.clean()
unsigned_archive_info.clean()
raise SystemExit("Signing server didn't finish signing in "
f'{timeout_in_seconds} seconds, dying :(')
archive_state = signed_archive_info.get_state()
if archive_state.has_error():
signed_archive_info.clean()
unsigned_archive_info.clean()
raise SystemExit(
f'Error happenned during codesign procedure: {archive_state.error_message}')
def copy_signed_files_to_directory(
self, signed_dir: Path, destination_dir: Path) -> None:
"""
Copy all files from signed_dir to destination_dir.
This function will overwrite any existing file. Permissions are copied
from the source files, but other metadata, such as timestamps, are not.
"""
for signed_filepath in signed_dir.glob('**/*'):
if not signed_filepath.is_file():
continue
relative_filepath = signed_filepath.relative_to(signed_dir)
destination_filepath = destination_dir / relative_filepath
destination_filepath.parent.mkdir(parents=True, exist_ok=True)
shutil.copy(signed_filepath, destination_filepath)
def run_buildbot_path_sign_pipeline(self, path: Path) -> None:
"""
Run all steps needed to make given path signed.
Path points to an unsigned file or a directory which contains unsigned
files.
If the path points to a single file then this file will be signed.
This is used to sign a final bundle such as .msi on Windows or .dmg on
macOS.
NOTE: The code signed implementation might actually reject signing the
file, in which case the file will be left unsigned. This isn't anything
to be considered a failure situation, just might happen when buildbot
worker can not detect whether signing is really required in a specific
case or not.
If the path points to a directory then code signer will sign all
signable files from it (finding them recursively).
"""
self.cleanup_environment_for_builder()
# Make sure storage directory exists.
self.unsigned_storage_dir.mkdir(parents=True, exist_ok=True)
# Collect all files which needs to be signed and pack them into a single
# archive which will be sent to the signing server.
logger_builder.info('Collecting files which are to be signed...')
files = self.collect_files_to_sign(path)
if not files:
logger_builder.info('No files to be signed, ignoring.')
return
logger_builder.info('Found %d files to sign.', len(files))
request_id = self.generate_request_id()
signed_archive_info = self.signed_archive_info_for_request_id(
request_id)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
pack_files(files=files,
archive_filepath=unsigned_archive_info.archive_filepath)
unsigned_archive_info.tag_ready()
# Wait for the signing server to finish signing.
logger_builder.info('Waiting signing server to sign the files...')
self.wait_for_signed_archive_or_die(request_id)
# Extract signed files from archive and move files to final location.
with TemporaryDirectory(prefix='blender-buildbot-') as temp_dir_str:
unpacked_signed_files_dir = Path(temp_dir_str)
logger_builder.info('Extracting signed files from archive...')
extract_files(
archive_filepath=signed_archive_info.archive_filepath,
extraction_dir=unpacked_signed_files_dir)
destination_dir = path
if destination_dir.is_file():
destination_dir = destination_dir.parent
self.copy_signed_files_to_directory(
unpacked_signed_files_dir, destination_dir)
logger_builder.info('Removing archive with signed files...')
signed_archive_info.clean()
############################################################################
# Signing server side helpers.
def wait_for_sign_request(self) -> str:
"""
Wait for the buildbot to request signing of an archive.
Returns an identifier of signing request.
"""
# TOOD(sergey): Support graceful shutdown on Ctrl-C.
logger_server.info(
f'Waiting for a request directory {self.unsigned_storage_dir} to appear.')
while not self.unsigned_storage_dir.exists():
time.sleep(1)
logger_server.info(
'Waiting for a READY indicator of any signing request.')
request_id = None
while request_id is None:
for file in self.unsigned_storage_dir.iterdir():
if file.suffix != '.ready':
continue
request_id = file.stem
logger_server.info(f'Found READY for request ID {request_id}.')
if request_id is None:
time.sleep(1)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
while not unsigned_archive_info.is_ready():
time.sleep(1)
return request_id
@abc.abstractmethod
def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
"""
Sign all files in the given directory.
NOTE: Signing should happen in-place.
"""
def run_signing_pipeline(self, request_id: str):
"""
Run the full signing pipeline starting from the point when buildbot
worker have requested signing.
"""
# Make sure storage directory exists.
self.signed_storage_dir.mkdir(parents=True, exist_ok=True)
with TemporaryDirectory(prefix='blender-codesign-') as temp_dir_str:
temp_dir = Path(temp_dir_str)
signed_archive_info = self.signed_archive_info_for_request_id(
request_id)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
logger_server.info('Extracting unsigned files from archive...')
extract_files(
archive_filepath=unsigned_archive_info.archive_filepath,
extraction_dir=temp_dir)
logger_server.info('Collecting all files which needs signing...')
files = AbsoluteAndRelativeFileName.recursively_from_directory(
temp_dir)
logger_server.info('Signing all requested files...')
try:
self.sign_all_files(files)
except CodeSignException as error:
signed_archive_info.tag_ready(error_message=error.message)
unsigned_archive_info.clean()
logger_server.info('Signing is complete with errors.')
return
logger_server.info('Packing signed files...')
pack_files(files=files,
archive_filepath=signed_archive_info.archive_filepath)
signed_archive_info.tag_ready()
logger_server.info('Removing signing request...')
unsigned_archive_info.clean()
logger_server.info('Signing is complete.')
def run_signing_server(self):
logger_server.info('Starting new code signing server...')
self.cleanup_environment_for_signing_server()
logger_server.info('Code signing server is ready')
while True:
logger_server.info('Waiting for the signing request in %s...',
self.unsigned_storage_dir)
request_id = self.wait_for_sign_request()
logger_server.info(
f'Beging signign procedure for request ID {request_id}.')
self.run_signing_pipeline(request_id)
############################################################################
# Command executing.
#
# Abstracted to a degree that allows to run commands from a foreign
# platform.
# The goal with this is to allow performing dry-run tests of code signer
# server from other platforms (for example, to test that macOS code signer
# does what it is supposed to after doing a refactor on Linux).
# TODO(sergey): What is the type annotation for the command?
def run_command_or_mock(self, command, platform: util.Platform) -> None:
"""
Run given command if current platform matches given one
If the platform is different then it will only be printed allowing
to verify logic of the code signing process.
"""
if platform != self.platform:
logger_server.info(
f'Will run command for {platform}: {command}')
return
logger_server.info(f'Running command: {command}')
subprocess.run(command)
# TODO(sergey): What is the type annotation for the command?
def check_output_or_mock(self, command,
platform: util.Platform,
allow_nonzero_exit_code=False) -> str:
"""
Run given command if current platform matches given one
If the platform is different then it will only be printed allowing
to verify logic of the code signing process.
If allow_nonzero_exit_code is truth then the output will be returned
even if application quit with non-zero exit code.
Otherwise an subprocess.CalledProcessError exception will be raised
in such case.
"""
if platform != self.platform:
logger_server.info(
f'Will run command for {platform}: {command}')
return
if allow_nonzero_exit_code:
process = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
output = process.communicate()[0]
return output.decode()
logger_server.info(f'Running command: {command}')
return subprocess.check_output(
command, stderr=subprocess.STDOUT).decode()

View File

@@ -1,62 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Configuration of a code signer which is specific to the code running from
# buildbot's worker.
import sys
from pathlib import Path
import codesign.util as util
from codesign.config_common import *
platform = util.get_current_platform()
if platform == util.Platform.LINUX:
SHARED_STORAGE_DIR = Path('/data/codesign')
elif platform == util.Platform.WINDOWS:
SHARED_STORAGE_DIR = Path('Z:\\codesign')
elif platform == util.Platform.MACOS:
SHARED_STORAGE_DIR = Path('/Volumes/codesign_macos/codesign')
# https://docs.python.org/3/library/logging.config.html#configuration-dictionary-schema
LOGGING = {
'version': 1,
'formatters': {
'default': {'format': '%(asctime)-15s %(levelname)8s %(name)s %(message)s'}
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
'stream': 'ext://sys.stderr',
}
},
'loggers': {
'codesign': {'level': 'INFO'},
},
'root': {
'level': 'WARNING',
'handlers': [
'console',
],
}
}

View File

@@ -1,36 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
from pathlib import Path
# Timeout in seconds for the signing process.
#
# This is how long buildbot packing step will wait signing server to
# perform signing.
#
# NOTE: Notarization could take a long time, hence the rather high value
# here. Might consider using different timeout for different platforms.
TIMEOUT_IN_SECONDS = 45 * 60 * 60
# Directory which is shared across buildbot worker and signing server.
#
# This is where worker puts files requested for signing as well as where
# server puts signed files.
SHARED_STORAGE_DIR: Path

View File

@@ -1,101 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Configuration of a code signer which is specific to the code signing server.
#
# NOTE: DO NOT put any sensitive information here, put it in an actual
# configuration on the signing machine.
from pathlib import Path
from codesign.config_common import *
CODESIGN_DIRECTORY = Path(__file__).absolute().parent
BLENDER_GIT_ROOT_DIRECTORY = CODESIGN_DIRECTORY.parent.parent.parent
################################################################################
# Common configuration.
# Directory where folders for codesign requests and signed result are stored.
# For example, /data/codesign
SHARED_STORAGE_DIR: Path
################################################################################
# macOS-specific configuration.
MACOS_ENTITLEMENTS_FILE = \
BLENDER_GIT_ROOT_DIRECTORY / 'release' / 'darwin' / 'entitlements.plist'
# Identity of the Developer ID Application certificate which is to be used for
# codesign tool.
# Use `security find-identity -v -p codesigning` to find the identity.
#
# NOTE: This identity is just an example from release/darwin/README.txt.
MACOS_CODESIGN_IDENTITY = 'AE825E26F12D08B692F360133210AF46F4CF7B97'
# User name (Apple ID) which will be used to request notarization.
MACOS_XCRUN_USERNAME = 'me@example.com'
# One-time application password which will be used to request notarization.
MACOS_XCRUN_PASSWORD = '@keychain:altool-password'
# Timeout in seconds within which the notarial office is supposed to reply.
MACOS_NOTARIZE_TIMEOUT_IN_SECONDS = 60 * 60
################################################################################
# Windows-specific configuration.
# URL to the timestamping authority.
WIN_TIMESTAMP_AUTHORITY_URL = 'http://timestamp.digicert.com'
# Full path to the certificate used for signing.
#
# The path and expected file format might vary depending on a platform.
#
# On Windows it is usually is a PKCS #12 key (.pfx), so the path will look
# like Path('C:\\Secret\\Blender.pfx').
WIN_CERTIFICATE_FILEPATH: Path
################################################################################
# Logging configuration, common for all platforms.
# https://docs.python.org/3/library/logging.config.html#configuration-dictionary-schema
LOGGING = {
'version': 1,
'formatters': {
'default': {'format': '%(asctime)-15s %(levelname)8s %(name)s %(message)s'}
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
'stream': 'ext://sys.stderr',
}
},
'loggers': {
'codesign': {'level': 'INFO'},
},
'root': {
'level': 'WARNING',
'handlers': [
'console',
],
}
}

View File

@@ -1,72 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# NOTE: This is a no-op signer (since there isn't really a procedure to sign
# Linux binaries yet). Used to debug and verify the code signing routines on
# a Linux environment.
import logging
from pathlib import Path
from typing import List
from codesign.absolute_and_relative_filename import AbsoluteAndRelativeFileName
from codesign.base_code_signer import BaseCodeSigner
logger = logging.getLogger(__name__)
logger_server = logger.getChild('server')
class LinuxCodeSigner(BaseCodeSigner):
def is_active(self) -> bool:
"""
Check whether this signer is active.
if it is inactive, no files will be signed.
Is used to be able to debug code signing pipeline on Linux, where there
is no code signing happening in the actual buildbot and release
environment.
"""
return False
def check_file_is_to_be_signed(
self, file: AbsoluteAndRelativeFileName) -> bool:
if file.relative_filepath == Path('blender'):
return True
if (file.relative_filepath.parts[-3:-1] == ('python', 'bin') and
file.relative_filepath.name.startwith('python')):
return True
if file.relative_filepath.suffix == '.so':
return True
return False
def collect_files_to_sign(self, path: Path) \
-> List[AbsoluteAndRelativeFileName]:
if not self.is_active():
return []
return super().collect_files_to_sign(path)
def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
num_files = len(files)
for file_index, file in enumerate(files):
logger.info('Server: Signed file [%d/%d] %s',
file_index + 1, num_files, file.relative_filepath)

View File

@@ -1,456 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import logging
import re
import stat
import subprocess
import time
from pathlib import Path
from typing import List
import codesign.util as util
from buildbot_utils import Builder
from codesign.absolute_and_relative_filename import AbsoluteAndRelativeFileName
from codesign.base_code_signer import BaseCodeSigner
from codesign.exception import CodeSignException
logger = logging.getLogger(__name__)
logger_server = logger.getChild('server')
# NOTE: Check is done as filename.endswith(), so keep the dot
EXTENSIONS_TO_BE_SIGNED = {'.dylib', '.so', '.dmg'}
# Prefixes of a file (not directory) name which are to be signed.
# Used to sign extra executable files in Contents/Resources.
NAME_PREFIXES_TO_BE_SIGNED = {'python'}
class NotarizationException(CodeSignException):
pass
def is_file_from_bundle(file: AbsoluteAndRelativeFileName) -> bool:
"""
Check whether file is coming from an .app bundle
"""
parts = file.relative_filepath.parts
if not parts:
return False
if not parts[0].endswith('.app'):
return False
return True
def get_bundle_from_file(
file: AbsoluteAndRelativeFileName) -> AbsoluteAndRelativeFileName:
"""
Get AbsoluteAndRelativeFileName descriptor of bundle
"""
assert(is_file_from_bundle(file))
parts = file.relative_filepath.parts
bundle_name = parts[0]
base_dir = file.base_dir
bundle_filepath = file.base_dir / bundle_name
return AbsoluteAndRelativeFileName(base_dir, bundle_filepath)
def is_bundle_executable_file(file: AbsoluteAndRelativeFileName) -> bool:
"""
Check whether given file is an executable within an app bundle
"""
if not is_file_from_bundle(file):
return False
parts = file.relative_filepath.parts
num_parts = len(parts)
if num_parts < 3:
return False
if parts[1:3] != ('Contents', 'MacOS'):
return False
return True
def xcrun_field_value_from_output(field: str, output: str) -> str:
"""
Get value of a given field from xcrun output.
If field is not found empty string is returned.
"""
field_prefix = field + ': '
for line in output.splitlines():
line = line.strip()
if line.startswith(field_prefix):
return line[len(field_prefix):]
return ''
class MacOSCodeSigner(BaseCodeSigner):
def check_file_is_to_be_signed(
self, file: AbsoluteAndRelativeFileName) -> bool:
if file.relative_filepath.name.startswith('.'):
return False
if is_bundle_executable_file(file):
return True
base_name = file.relative_filepath.name
if any(base_name.startswith(prefix)
for prefix in NAME_PREFIXES_TO_BE_SIGNED):
return True
mode = file.absolute_filepath.lstat().st_mode
if mode & stat.S_IXUSR != 0:
file_output = subprocess.check_output(
("file", file.absolute_filepath)).decode()
if "64-bit executable" in file_output:
return True
return file.relative_filepath.suffix in EXTENSIONS_TO_BE_SIGNED
def collect_files_to_sign(self, path: Path) \
-> List[AbsoluteAndRelativeFileName]:
# Include all files when signing app or dmg bundle: all the files are
# needed to do valid signature of bundle.
if path.name.endswith('.app'):
return AbsoluteAndRelativeFileName.recursively_from_directory(path)
if path.is_dir():
files = []
for child in path.iterdir():
if child.name.endswith('.app'):
current_files = AbsoluteAndRelativeFileName.recursively_from_directory(
child)
else:
current_files = super().collect_files_to_sign(child)
for current_file in current_files:
files.append(AbsoluteAndRelativeFileName(
path, current_file.absolute_filepath))
return files
return super().collect_files_to_sign(path)
############################################################################
# Codesign.
def codesign_remove_signature(
self, file: AbsoluteAndRelativeFileName) -> None:
"""
Make sure given file does not have codesign signature
This is needed because codesigning is not possible for file which has
signature already.
"""
logger_server.info(
'Removing codesign signature from %s...', file.relative_filepath)
command = ['codesign', '--remove-signature', file.absolute_filepath]
self.run_command_or_mock(command, util.Platform.MACOS)
def codesign_file(
self, file: AbsoluteAndRelativeFileName) -> None:
"""
Sign given file
NOTE: File must not have any signatures.
"""
logger_server.info(
'Codesigning %s...', file.relative_filepath)
entitlements_file = self.config.MACOS_ENTITLEMENTS_FILE
command = ['codesign',
'--timestamp',
'--options', 'runtime',
f'--entitlements={entitlements_file}',
'--sign', self.config.MACOS_CODESIGN_IDENTITY,
file.absolute_filepath]
self.run_command_or_mock(command, util.Platform.MACOS)
def codesign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
"""
Run codesign tool on all eligible files in the given list.
Will ignore all files which are not to be signed. For the rest will
remove possible existing signature and add a new signature.
"""
num_files = len(files)
have_ignored_files = False
signed_files = []
for file_index, file in enumerate(files):
# Ignore file if it is not to be signed.
# Allows to manually construct ZIP of a bundle and get it signed.
if not self.check_file_is_to_be_signed(file):
logger_server.info(
'Ignoring file [%d/%d] %s',
file_index + 1, num_files, file.relative_filepath)
have_ignored_files = True
continue
logger_server.info(
'Running codesigning routines for file [%d/%d] %s...',
file_index + 1, num_files, file.relative_filepath)
self.codesign_remove_signature(file)
self.codesign_file(file)
signed_files.append(file)
if have_ignored_files:
logger_server.info('Signed %d files:', len(signed_files))
num_signed_files = len(signed_files)
for file_index, signed_file in enumerate(signed_files):
logger_server.info(
'- [%d/%d] %s',
file_index + 1, num_signed_files,
signed_file.relative_filepath)
def codesign_bundles(
self, files: List[AbsoluteAndRelativeFileName]) -> None:
"""
Codesign all .app bundles in the given list of files.
Bundle is deducted from paths of the files, and every bundle is only
signed once.
"""
signed_bundles = set()
extra_files = []
for file in files:
if not is_file_from_bundle(file):
continue
bundle = get_bundle_from_file(file)
bundle_name = bundle.relative_filepath
if bundle_name in signed_bundles:
continue
logger_server.info('Running codesign routines on bundle %s',
bundle_name)
# It is not possible to remove signature from DMG.
if bundle.relative_filepath.name.endswith('.app'):
self.codesign_remove_signature(bundle)
self.codesign_file(bundle)
signed_bundles.add(bundle_name)
# Codesign on a bundle adds an extra folder with information.
# It needs to be compied to the source.
code_signature_directory = \
bundle.absolute_filepath / 'Contents' / '_CodeSignature'
code_signature_files = \
AbsoluteAndRelativeFileName.recursively_from_directory(
code_signature_directory)
for code_signature_file in code_signature_files:
bundle_relative_file = AbsoluteAndRelativeFileName(
bundle.base_dir,
code_signature_directory /
code_signature_file.relative_filepath)
extra_files.append(bundle_relative_file)
files.extend(extra_files)
############################################################################
# Notarization.
def notarize_get_bundle_id(self, file: AbsoluteAndRelativeFileName) -> str:
"""
Get bundle ID which will be used to notarize DMG
"""
name = file.relative_filepath.name
app_name = name.split('-', 2)[0].lower()
app_name_words = app_name.split()
if len(app_name_words) > 1:
app_name_id = ''.join(word.capitalize() for word in app_name_words)
else:
app_name_id = app_name_words[0]
# TODO(sergey): Consider using "alpha" for buildbot builds.
return f'org.blenderfoundation.{app_name_id}.release'
def notarize_request(self, file) -> str:
"""
Request notarization of the given file.
Returns UUID of the notarization request. If error occurred None is
returned instead of UUID.
"""
bundle_id = self.notarize_get_bundle_id(file)
logger_server.info('Bundle ID: %s', bundle_id)
logger_server.info('Submitting file to the notarial office.')
command = [
'xcrun', 'altool', '--notarize-app', '--verbose',
'-f', file.absolute_filepath,
'--primary-bundle-id', bundle_id,
'--username', self.config.MACOS_XCRUN_USERNAME,
'--password', self.config.MACOS_XCRUN_PASSWORD]
output = self.check_output_or_mock(
command, util.Platform.MACOS, allow_nonzero_exit_code=True)
for line in output.splitlines():
line = line.strip()
if line.startswith('RequestUUID = '):
request_uuid = line[14:]
return request_uuid
# Check whether the package has been already submitted.
if 'The software asset has already been uploaded.' in line:
request_uuid = re.sub(
'.*The upload ID is ([A-Fa-f0-9\-]+).*', '\\1', line)
logger_server.warning(
f'The package has been already submitted under UUID {request_uuid}')
return request_uuid
logger_server.error(output)
logger_server.error('xcrun command did not report RequestUUID')
return None
def notarize_review_status(self, xcrun_output: str) -> bool:
"""
Review status returned by xcrun's notarization info
Returns truth if the notarization process has finished.
If there are errors during notarization, a NotarizationException()
exception is thrown with status message from the notarial office.
"""
# Parse status and message
status = xcrun_field_value_from_output('Status', xcrun_output)
status_message = xcrun_field_value_from_output(
'Status Message', xcrun_output)
if status == 'success':
logger_server.info(
'Package successfully notarized: %s', status_message)
return True
if status == 'invalid':
logger_server.error(xcrun_output)
logger_server.error(
'Package notarization has failed: %s', status_message)
raise NotarizationException(status_message)
if status == 'in progress':
return False
logger_server.info(
'Unknown notarization status %s (%s)', status, status_message)
return False
def notarize_wait_result(self, request_uuid: str) -> None:
"""
Wait for until notarial office have a reply
"""
logger_server.info(
'Waiting for a result from the notarization office.')
command = ['xcrun', 'altool',
'--notarization-info', request_uuid,
'--username', self.config.MACOS_XCRUN_USERNAME,
'--password', self.config.MACOS_XCRUN_PASSWORD]
time_start = time.monotonic()
timeout_in_seconds = self.config.MACOS_NOTARIZE_TIMEOUT_IN_SECONDS
while True:
xcrun_output = self.check_output_or_mock(
command, util.Platform.MACOS, allow_nonzero_exit_code=True)
if self.notarize_review_status(xcrun_output):
break
logger_server.info('Keep waiting for notarization office.')
time.sleep(30)
time_slept_in_seconds = time.monotonic() - time_start
if time_slept_in_seconds > timeout_in_seconds:
logger_server.error(
"Notarial office didn't reply in %f seconds.",
timeout_in_seconds)
def notarize_staple(self, file: AbsoluteAndRelativeFileName) -> bool:
"""
Staple notarial label on the file
"""
logger_server.info('Stapling notarial stamp.')
command = ['xcrun', 'stapler', 'staple', '-v', file.absolute_filepath]
self.check_output_or_mock(command, util.Platform.MACOS)
def notarize_dmg(self, file: AbsoluteAndRelativeFileName) -> bool:
"""
Run entire pipeline to get DMG notarized.
"""
logger_server.info('Begin notarization routines on %s',
file.relative_filepath)
# Submit file for notarization.
request_uuid = self.notarize_request(file)
if not request_uuid:
return False
logger_server.info('Received Request UUID: %s', request_uuid)
# Wait for the status from the notarization office.
if not self.notarize_wait_result(request_uuid):
return False
# Staple.
self.notarize_staple(file)
def notarize_all_dmg(
self, files: List[AbsoluteAndRelativeFileName]) -> bool:
"""
Notarize all DMG images from the input.
Images are supposed to be codesigned already.
"""
for file in files:
if not file.relative_filepath.name.endswith('.dmg'):
continue
if not self.check_file_is_to_be_signed(file):
continue
self.notarize_dmg(file)
############################################################################
# Entry point.
def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
# TODO(sergey): Handle errors somehow.
self.codesign_all_files(files)
self.codesign_bundles(files)
self.notarize_all_dmg(files)

View File

@@ -1,52 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import logging.config
import sys
from pathlib import Path
from typing import Optional
import codesign.config_builder
import codesign.util as util
from codesign.base_code_signer import BaseCodeSigner
class SimpleCodeSigner:
code_signer: Optional[BaseCodeSigner]
def __init__(self):
platform = util.get_current_platform()
if platform == util.Platform.LINUX:
from codesign.linux_code_signer import LinuxCodeSigner
self.code_signer = LinuxCodeSigner(codesign.config_builder)
elif platform == util.Platform.MACOS:
from codesign.macos_code_signer import MacOSCodeSigner
self.code_signer = MacOSCodeSigner(codesign.config_builder)
elif platform == util.Platform.WINDOWS:
from codesign.windows_code_signer import WindowsCodeSigner
self.code_signer = WindowsCodeSigner(codesign.config_builder)
else:
self.code_signer = None
def sign_file_or_directory(self, path: Path) -> None:
logging.config.dictConfig(codesign.config_builder.LOGGING)
self.code_signer.run_buildbot_path_sign_pipeline(path)

View File

@@ -1,54 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import sys
from enum import Enum
from pathlib import Path
class Platform(Enum):
LINUX = 1
MACOS = 2
WINDOWS = 3
def get_current_platform() -> Platform:
if sys.platform == 'linux':
return Platform.LINUX
elif sys.platform == 'darwin':
return Platform.MACOS
elif sys.platform == 'win32':
return Platform.WINDOWS
raise Exception(f'Unknown platform {sys.platform}')
def ensure_file_does_not_exist_or_die(filepath: Path) -> None:
"""
If the file exists, unlink it.
If the file path exists and is not a file an assert will trigger.
If the file path does not exists nothing happens.
"""
if not filepath.exists():
return
if not filepath.is_file():
# TODO(sergey): Provide information about what the filepath actually is.
raise SystemExit(f'{filepath} is expected to be a file, but is not')
filepath.unlink()

View File

@@ -1,117 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import logging
from pathlib import Path
from typing import List
import codesign.util as util
from buildbot_utils import Builder
from codesign.absolute_and_relative_filename import AbsoluteAndRelativeFileName
from codesign.base_code_signer import BaseCodeSigner
from codesign.exception import CodeSignException
logger = logging.getLogger(__name__)
logger_server = logger.getChild('server')
# NOTE: Check is done as filename.endswith(), so keep the dot
EXTENSIONS_TO_BE_SIGNED = {'.exe', '.dll', '.pyd', '.msi'}
BLACKLIST_FILE_PREFIXES = (
'api-ms-', 'concrt', 'msvcp', 'ucrtbase', 'vcomp', 'vcruntime')
class SigntoolException(CodeSignException):
pass
class WindowsCodeSigner(BaseCodeSigner):
def check_file_is_to_be_signed(
self, file: AbsoluteAndRelativeFileName) -> bool:
base_name = file.relative_filepath.name
if any(base_name.startswith(prefix)
for prefix in BLACKLIST_FILE_PREFIXES):
return False
return file.relative_filepath.suffix in EXTENSIONS_TO_BE_SIGNED
def get_sign_command_prefix(self) -> List[str]:
return [
'signtool', 'sign', '/v',
'/f', self.config.WIN_CERTIFICATE_FILEPATH,
'/tr', self.config.WIN_TIMESTAMP_AUTHORITY_URL]
def run_codesign_tool(self, filepath: Path) -> None:
command = self.get_sign_command_prefix() + [filepath]
try:
codesign_output = self.check_output_or_mock(command, util.Platform.WINDOWS)
except subprocess.CalledProcessError as e:
raise SigntoolException(f'Error running signtool {e}')
logger_server.info(f'signtool output:\n{codesign_output}')
got_number_of_success = False
for line in codesign_output.split('\n'):
line_clean = line.strip()
line_clean_lower = line_clean.lower()
if line_clean_lower.startswith('number of warnings') or \
line_clean_lower.startswith('number of errors'):
number = int(line_clean_lower.split(':')[1])
if number != 0:
raise SigntoolException('Non-clean success of signtool')
if line_clean_lower.startswith('number of files successfully signed'):
got_number_of_success = True
number = int(line_clean_lower.split(':')[1])
if number != 1:
raise SigntoolException('Signtool did not consider codesign a success')
if not got_number_of_success:
raise SigntoolException('Signtool did not report number of files signed')
def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
# NOTE: Sign files one by one to avoid possible command line length
# overflow (which could happen if we ever decide to sign every binary
# in the install folder, for example).
#
# TODO(sergey): Consider doing batched signing of handful of files in
# one go (but only if this actually known to be much faster).
num_files = len(files)
for file_index, file in enumerate(files):
# Ignore file if it is not to be signed.
# Allows to manually construct ZIP of package and get it signed.
if not self.check_file_is_to_be_signed(file):
logger_server.info(
'Ignoring file [%d/%d] %s',
file_index + 1, num_files, file.relative_filepath)
continue
logger_server.info(
'Running signtool command for file [%d/%d] %s...',
file_index + 1, num_files, file.relative_filepath)
self.run_codesign_tool(file.absolute_filepath)

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env python3
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# NOTE: This is a no-op signer (since there isn't really a procedure to sign
# Linux binaries yet). Used to debug and verify the code signing routines on
# a Linux environment.
import logging.config
from pathlib import Path
from typing import List
from codesign.linux_code_signer import LinuxCodeSigner
import codesign.config_server
if __name__ == "__main__":
logging.config.dictConfig(codesign.config_server.LOGGING)
code_signer = LinuxCodeSigner(codesign.config_server)
code_signer.run_signing_server()

View File

@@ -1,41 +0,0 @@
#!/usr/bin/env python3
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import logging.config
from pathlib import Path
from typing import List
from codesign.macos_code_signer import MacOSCodeSigner
import codesign.config_server
if __name__ == "__main__":
entitlements_file = codesign.config_server.MACOS_ENTITLEMENTS_FILE
if not entitlements_file.exists():
raise SystemExit(
'Entitlements file {entitlements_file} does not exist.')
if not entitlements_file.is_file():
raise SystemExit(
'Entitlements file {entitlements_file} is not a file.')
logging.config.dictConfig(codesign.config_server.LOGGING)
code_signer = MacOSCodeSigner(codesign.config_server)
code_signer.run_signing_server()

View File

@@ -1,11 +0,0 @@
@echo off
rem This is an entry point of the codesign server for Windows.
rem It makes sure that signtool.exe is within the current PATH and can be
rem used by the Python script.
SETLOCAL
set PATH=C:\Program Files (x86)\Windows Kits\10\App Certification Kit;%PATH%
codesign_server_windows.py

View File

@@ -1,54 +0,0 @@
#!/usr/bin/env python3
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Implementation of codesign server for Windows.
#
# NOTE: If signtool.exe is not in the PATH use codesign_server_windows.bat
import logging.config
import shutil
from pathlib import Path
from typing import List
import codesign.util as util
from codesign.windows_code_signer import WindowsCodeSigner
import codesign.config_server
if __name__ == "__main__":
logging.config.dictConfig(codesign.config_server.LOGGING)
logger = logging.getLogger(__name__)
logger_server = logger.getChild('server')
# TODO(sergey): Consider moving such sanity checks into
# CodeSigner.check_environment_or_die().
if not shutil.which('signtool.exe'):
if util.get_current_platform() == util.Platform.WINDOWS:
raise SystemExit("signtool.exe is not found in %PATH%")
logger_server.info(
'signtool.exe not found, '
'but will not be used on this foreign platform')
code_signer = WindowsCodeSigner(codesign.config_server)
code_signer.run_signing_server()

View File

@@ -1,551 +0,0 @@
#!/usr/bin/env python3
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
import argparse
import re
import shutil
import subprocess
import sys
import time
from pathlib import Path
from tempfile import TemporaryDirectory, NamedTemporaryFile
from typing import List
BUILDBOT_DIRECTORY = Path(__file__).absolute().parent
CODESIGN_SCRIPT = BUILDBOT_DIRECTORY / 'worker_codesign.py'
BLENDER_GIT_ROOT_DIRECTORY = BUILDBOT_DIRECTORY.parent.parent
DARWIN_DIRECTORY = BLENDER_GIT_ROOT_DIRECTORY / 'release' / 'darwin'
# Extra size which is added on top of actual files size when estimating size
# of destination DNG.
EXTRA_DMG_SIZE_IN_BYTES = 800 * 1024 * 1024
################################################################################
# Common utilities
def get_directory_size(root_directory: Path) -> int:
"""
Get size of directory on disk
"""
total_size = 0
for file in root_directory.glob('**/*'):
total_size += file.lstat().st_size
return total_size
################################################################################
# DMG bundling specific logic
def create_argument_parser():
parser = argparse.ArgumentParser()
parser.add_argument(
'source_dir',
type=Path,
help='Source directory which points to either existing .app bundle'
'or to a directory with .app bundles.')
parser.add_argument(
'--background-image',
type=Path,
help="Optional background picture which will be set on the DMG."
"If not provided default Blender's one is used.")
parser.add_argument(
'--volume-name',
type=str,
help='Optional name of a volume which will be used for DMG.')
parser.add_argument(
'--dmg',
type=Path,
help='Optional argument which points to a final DMG file name.')
parser.add_argument(
'--applescript',
type=Path,
help="Optional path to applescript to set up folder looks of DMG."
"If not provided default Blender's one is used.")
parser.add_argument(
'--codesign',
action="store_true",
help="Code sign and notarize DMG contents.")
return parser
def collect_app_bundles(source_dir: Path) -> List[Path]:
"""
Collect all app bundles which are to be put into DMG
If the source directory points to FOO.app it will be the only app bundle
packed.
Otherwise all .app bundles from given directory are placed to a single
DMG.
"""
if source_dir.name.endswith('.app'):
return [source_dir]
app_bundles = []
for filename in source_dir.glob('*'):
if not filename.is_dir():
continue
if not filename.name.endswith('.app'):
continue
app_bundles.append(filename)
return app_bundles
def collect_and_log_app_bundles(source_dir: Path) -> List[Path]:
app_bundles = collect_app_bundles(source_dir)
if not app_bundles:
print('No app bundles found for packing')
return
print(f'Found {len(app_bundles)} to pack:')
for app_bundle in app_bundles:
print(f'- {app_bundle}')
return app_bundles
def estimate_dmg_size(app_bundles: List[Path]) -> int:
"""
Estimate size of DMG to hold requested app bundles
The size is based on actual size of all files in all bundles plus some
space to compensate for different size-on-disk plus some space to hold
codesign signatures.
Is better to be on a high side since the empty space is compressed, but
lack of space might cause silent failures later on.
"""
app_bundles_size = 0
for app_bundle in app_bundles:
app_bundles_size += get_directory_size(app_bundle)
return app_bundles_size + EXTRA_DMG_SIZE_IN_BYTES
def copy_app_bundles_to_directory(app_bundles: List[Path],
directory: Path) -> None:
"""
Copy all bundles to a given directory
This directory is what the DMG will be created from.
"""
for app_bundle in app_bundles:
print(f'Copying {app_bundle.name}...')
shutil.copytree(app_bundle, directory / app_bundle.name)
def get_main_app_bundle(app_bundles: List[Path]) -> Path:
"""
Get application bundle main for the installation
"""
return app_bundles[0]
def create_dmg_image(app_bundles: List[Path],
dmg_filepath: Path,
volume_name: str) -> None:
"""
Create DMG disk image and put app bundles in it
No DMG configuration or codesigning is happening here.
"""
if dmg_filepath.exists():
print(f'Removing existing writable DMG {dmg_filepath}...')
dmg_filepath.unlink()
print('Preparing directory with app bundles for the DMG...')
with TemporaryDirectory(prefix='blender-dmg-content-') as content_dir_str:
# Copy all bundles to a clean directory.
content_dir = Path(content_dir_str)
copy_app_bundles_to_directory(app_bundles, content_dir)
# Estimate size of the DMG.
dmg_size = estimate_dmg_size(app_bundles)
print(f'Estimated DMG size: {dmg_size:,} bytes.')
# Create the DMG.
print(f'Creating writable DMG {dmg_filepath}')
command = ('hdiutil',
'create',
'-size', str(dmg_size),
'-fs', 'HFS+',
'-srcfolder', content_dir,
'-volname', volume_name,
'-format', 'UDRW',
dmg_filepath)
subprocess.run(command)
def get_writable_dmg_filepath(dmg_filepath: Path):
"""
Get file path for writable DMG image
"""
parent = dmg_filepath.parent
return parent / (dmg_filepath.stem + '-temp.dmg')
def mount_readwrite_dmg(dmg_filepath: Path) -> None:
"""
Mount writable DMG
Mounting point would be /Volumes/<volume name>
"""
print(f'Mounting read-write DMG ${dmg_filepath}')
command = ('hdiutil',
'attach', '-readwrite',
'-noverify',
'-noautoopen',
dmg_filepath)
subprocess.run(command)
def get_mount_directory_for_volume_name(volume_name: str) -> Path:
"""
Get directory under which the volume will be mounted
"""
return Path('/Volumes') / volume_name
def eject_volume(volume_name: str) -> None:
"""
Eject given volume, if mounted
"""
mount_directory = get_mount_directory_for_volume_name(volume_name)
if not mount_directory.exists():
return
mount_directory_str = str(mount_directory)
print(f'Ejecting volume {volume_name}')
# Figure out which device to eject.
mount_output = subprocess.check_output(['mount']).decode()
device = ''
for line in mount_output.splitlines():
if f'on {mount_directory_str} (' not in line:
continue
tokens = line.split(' ', 3)
if len(tokens) < 3:
continue
if tokens[1] != 'on':
continue
if device:
raise Exception(
f'Multiple devices found for mounting point {mount_directory}')
device = tokens[0]
if not device:
raise Exception(
f'No device found for mounting point {mount_directory}')
print(f'{mount_directory} is mounted as device {device}, ejecting...')
subprocess.run(['diskutil', 'eject', device])
def copy_background_if_needed(background_image_filepath: Path,
mount_directory: Path) -> None:
"""
Copy background to the DMG
If the background image is not specified it will not be copied.
"""
if not background_image_filepath:
print('No background image provided.')
return
print(f'Copying background image {background_image_filepath}')
destination_dir = mount_directory / '.background'
destination_dir.mkdir(exist_ok=True)
destination_filepath = destination_dir / background_image_filepath.name
shutil.copy(background_image_filepath, destination_filepath)
def create_applications_link(mount_directory: Path) -> None:
"""
Create link to /Applications in the given location
"""
print('Creating link to /Applications')
command = ('ln', '-s', '/Applications', mount_directory / ' ')
subprocess.run(command)
def run_applescript(applescript: Path,
volume_name: str,
app_bundles: List[Path],
background_image_filepath: Path) -> None:
"""
Run given applescript to adjust look and feel of the DMG
"""
main_app_bundle = get_main_app_bundle(app_bundles)
with NamedTemporaryFile(
mode='w', suffix='.applescript') as temp_applescript:
print('Adjusting applescript for volume name...')
# Adjust script to the specific volume name.
with open(applescript, mode='r') as input:
for line in input.readlines():
stripped_line = line.strip()
if stripped_line.startswith('tell disk'):
line = re.sub('tell disk ".*"',
f'tell disk "{volume_name}"',
line)
elif stripped_line.startswith('set background picture'):
if not background_image_filepath:
continue
else:
background_image_short = \
'.background:' + background_image_filepath.name
line = re.sub('to file ".*"',
f'to file "{background_image_short}"',
line)
line = line.replace('blender.app', main_app_bundle.name)
temp_applescript.write(line)
temp_applescript.flush()
print('Running applescript...')
command = ('osascript', temp_applescript.name)
subprocess.run(command)
print('Waiting for applescript...')
# NOTE: This is copied from bundle.sh. The exact reason for sleep is
# still remained a mystery.
time.sleep(5)
def codesign(subject: Path):
"""
Codesign file or directory
NOTE: For DMG it will also notarize.
"""
command = (CODESIGN_SCRIPT, subject)
subprocess.run(command)
def codesign_app_bundles_in_dmg(mount_directory: str) -> None:
"""
Code sign all binaries and bundles in the mounted directory
"""
print(f'Codesigning all app bundles in {mount_directory}')
codesign(mount_directory)
def codesign_and_notarize_dmg(dmg_filepath: Path) -> None:
"""
Run codesign and notarization pipeline on the DMG
"""
print(f'Codesigning and notarizing DMG {dmg_filepath}')
codesign(dmg_filepath)
def compress_dmg(writable_dmg_filepath: Path,
final_dmg_filepath: Path) -> None:
"""
Compress temporary read-write DMG
"""
command = ('hdiutil', 'convert',
writable_dmg_filepath,
'-format', 'UDZO',
'-o', final_dmg_filepath)
if final_dmg_filepath.exists():
print(f'Removing old compressed DMG {final_dmg_filepath}')
final_dmg_filepath.unlink()
print('Compressing disk image...')
subprocess.run(command)
def create_final_dmg(app_bundles: List[Path],
dmg_filepath: Path,
background_image_filepath: Path,
volume_name: str,
applescript: Path,
codesign: bool) -> None:
"""
Create DMG with all app bundles
Will take care configuring background, signing all binaries and app bundles
and notarizing the DMG.
"""
print('Running all routines to create final DMG')
writable_dmg_filepath = get_writable_dmg_filepath(dmg_filepath)
mount_directory = get_mount_directory_for_volume_name(volume_name)
# Make sure volume is not mounted.
# If it is mounted it will prevent removing old DMG files and could make
# it so app bundles are copied to the wrong place.
eject_volume(volume_name)
create_dmg_image(app_bundles, writable_dmg_filepath, volume_name)
mount_readwrite_dmg(writable_dmg_filepath)
# Run codesign first, prior to copying amything else.
#
# This allows to recurs into the content of bundles without worrying about
# possible interfereice of Application symlink.
if codesign:
codesign_app_bundles_in_dmg(mount_directory)
copy_background_if_needed(background_image_filepath, mount_directory)
create_applications_link(mount_directory)
run_applescript(applescript, volume_name, app_bundles,
background_image_filepath)
print('Ejecting read-write DMG image...')
eject_volume(volume_name)
compress_dmg(writable_dmg_filepath, dmg_filepath)
writable_dmg_filepath.unlink()
if codesign:
codesign_and_notarize_dmg(dmg_filepath)
def ensure_dmg_extension(filepath: Path) -> Path:
"""
Make sure given file have .dmg extension
"""
if filepath.suffix != '.dmg':
return filepath.with_suffix(f'{filepath.suffix}.dmg')
return filepath
def get_dmg_filepath(requested_name: Path, app_bundles: List[Path]) -> Path:
"""
Get full file path for the final DMG image
Will use the provided one when possible, otherwise will deduct it from
app bundles.
If the name is deducted, the DMG is stored in the current directory.
"""
if requested_name:
return ensure_dmg_extension(requested_name.absolute())
# TODO(sergey): This is not necessarily the main one.
main_bundle = app_bundles[0]
# Strip .app from the name
return Path(main_bundle.name[:-4] + '.dmg').absolute()
def get_background_image(requested_background_image: Path) -> Path:
"""
Get effective filepath for the background image
"""
if requested_background_image:
return requested_background_image.absolute()
return DARWIN_DIRECTORY / 'background.tif'
def get_applescript(requested_applescript: Path) -> Path:
"""
Get effective filepath for the applescript
"""
if requested_applescript:
return requested_applescript.absolute()
return DARWIN_DIRECTORY / 'blender.applescript'
def get_volume_name_from_dmg_filepath(dmg_filepath: Path) -> str:
"""
Deduct volume name from the DMG path
Will use first part of the DMG file name prior to dash.
"""
tokens = dmg_filepath.stem.split('-')
words = tokens[0].split()
return ' '.join(word.capitalize() for word in words)
def get_volume_name(requested_volume_name: str,
dmg_filepath: Path) -> str:
"""
Get effective name for DMG volume
"""
if requested_volume_name:
return requested_volume_name
return get_volume_name_from_dmg_filepath(dmg_filepath)
def main():
parser = create_argument_parser()
args = parser.parse_args()
# Get normalized input parameters.
source_dir = args.source_dir.absolute()
background_image_filepath = get_background_image(args.background_image)
applescript = get_applescript(args.applescript)
codesign = args.codesign
app_bundles = collect_and_log_app_bundles(source_dir)
if not app_bundles:
return
dmg_filepath = get_dmg_filepath(args.dmg, app_bundles)
volume_name = get_volume_name(args.volume_name, dmg_filepath)
print(f'Will produce DMG "{dmg_filepath.name}" (without quotes)')
create_final_dmg(app_bundles,
dmg_filepath,
background_image_filepath,
volume_name,
applescript,
codesign)
if __name__ == "__main__":
main()

View File

@@ -1,44 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# This is a script which is used as POST-INSTALL one for regular CMake's
# INSTALL target.
# It is used by buildbot workers to sign every binary which is going into
# the final buundle.
# On Windows Python 3 there only is python.exe, no python3.exe.
#
# On other platforms it is possible to have python2 and python3, and a
# symbolic link to python to either of them. So on those platforms use
# an explicit Python version.
if(WIN32)
set(PYTHON_EXECUTABLE python)
else()
set(PYTHON_EXECUTABLE python3)
endif()
execute_process(
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/worker_codesign.py"
"${CMAKE_INSTALL_PREFIX}"
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
RESULT_VARIABLE exit_code
)
if(NOT exit_code EQUAL "0")
message(FATAL_ERROR "Non-zero exit code of codesign tool")
endif()

View File

@@ -1,74 +0,0 @@
#!/usr/bin/env python3
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# Helper script which takes care of signing provided location.
#
# The location can either be a directory (in which case all eligible binaries
# will be signed) or a single file (in which case a single file will be signed).
#
# This script takes care of all the complexity of communicating between process
# which requests file to be signed and the code signing server.
#
# NOTE: Signing happens in-place.
import argparse
import sys
from pathlib import Path
from codesign.simple_code_signer import SimpleCodeSigner
def create_argument_parser():
parser = argparse.ArgumentParser()
parser.add_argument('path_to_sign', type=Path)
return parser
def main():
parser = create_argument_parser()
args = parser.parse_args()
path_to_sign = args.path_to_sign.absolute()
if sys.platform == 'win32':
# When WIX packed is used to generate .msi on Windows the CPack will
# install two different projects and install them to different
# installation prefix:
#
# - C:\b\build\_CPack_Packages\WIX\Blender
# - C:\b\build\_CPack_Packages\WIX\Unspecified
#
# Annoying part is: CMake's post-install script will only be run
# once, with the install prefix which corresponds to a project which
# was installed last. But we want to sign binaries from all projects.
# So in order to do so we detect that we are running for a CPack's
# project used for WIX and force parent directory (which includes both
# projects) to be signed.
#
# Here we force both projects to be signed.
if path_to_sign.name == 'Unspecified' and 'WIX' in str(path_to_sign):
path_to_sign = path_to_sign.parent
code_signer = SimpleCodeSigner()
code_signer.sign_file_or_directory(path_to_sign)
if __name__ == "__main__":
main()

View File

@@ -1,135 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import os
import shutil
import buildbot_utils
def get_cmake_options(builder):
codesign_script = os.path.join(
builder.blender_dir, 'build_files', 'buildbot', 'worker_codesign.cmake')
config_file = "build_files/cmake/config/blender_release.cmake"
options = ['-DCMAKE_BUILD_TYPE:STRING=Release',
'-DWITH_GTESTS=ON']
if builder.platform == 'mac':
options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64')
options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9')
elif builder.platform == 'win':
options.extend(['-G', 'Visual Studio 16 2019', '-A', 'x64'])
if builder.codesign:
options.extend(['-DPOSTINSTALL_SCRIPT:PATH=' + codesign_script])
elif builder.platform == 'linux':
config_file = "build_files/buildbot/config/blender_linux.cmake"
optix_sdk_dir = os.path.join(builder.blender_dir, '..', '..', 'NVIDIA-Optix-SDK-7.1')
options.append('-DOPTIX_ROOT_DIR:PATH=' + optix_sdk_dir)
# Workaround to build sm_30 kernels with CUDA 10, since CUDA 11 no longer supports that architecture
if builder.platform == 'win':
options.append('-DCUDA10_TOOLKIT_ROOT_DIR:PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1')
options.append('-DCUDA10_NVCC_EXECUTABLE:FILEPATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe')
options.append('-DCUDA11_TOOLKIT_ROOT_DIR:PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1')
options.append('-DCUDA11_NVCC_EXECUTABLE:FILEPATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/bin/nvcc.exe')
elif builder.platform == 'linux':
options.append('-DCUDA10_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda-10.1')
options.append('-DCUDA10_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda-10.1/bin/nvcc')
options.append('-DCUDA11_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda-11.1')
options.append('-DCUDA11_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda-11.1/bin/nvcc')
options.append("-C" + os.path.join(builder.blender_dir, config_file))
options.append("-DCMAKE_INSTALL_PREFIX=%s" % (builder.install_dir))
return options
def update_git(builder):
# Do extra git fetch because not all platform/git/buildbot combinations
# update the origin remote, causing buildinfo to detect local changes.
os.chdir(builder.blender_dir)
print("Fetching remotes")
command = ['git', 'fetch', '--all']
buildbot_utils.call(builder.command_prefix + command)
def clean_directories(builder):
# Make sure no garbage remained from the previous run
if os.path.isdir(builder.install_dir):
shutil.rmtree(builder.install_dir)
# Make sure build directory exists and enter it
os.makedirs(builder.build_dir, exist_ok=True)
# Remove buildinfo files to force buildbot to re-generate them.
for buildinfo in ('buildinfo.h', 'buildinfo.h.txt', ):
full_path = os.path.join(builder.build_dir, 'source', 'creator', buildinfo)
if os.path.exists(full_path):
print("Removing {}" . format(buildinfo))
os.remove(full_path)
def cmake_configure(builder):
# CMake configuration
os.chdir(builder.build_dir)
cmake_cache = os.path.join(builder.build_dir, 'CMakeCache.txt')
if os.path.exists(cmake_cache):
print("Removing CMake cache")
os.remove(cmake_cache)
print("CMake configure:")
cmake_options = get_cmake_options(builder)
command = ['cmake', builder.blender_dir] + cmake_options
buildbot_utils.call(builder.command_prefix + command)
def cmake_build(builder):
# CMake build
os.chdir(builder.build_dir)
# NOTE: CPack will build an INSTALL target, which would mean that code
# signing will happen twice when using `make install` and CPack.
# The tricky bit here is that it is not possible to know whether INSTALL
# target is used by CPack or by a buildbot itaself. Extra level on top of
# this is that on Windows it is required to build INSTALL target in order
# to have unit test binaries to run.
# So on the one hand we do an extra unneeded code sign on Windows, but on
# a positive side we don't add complexity and don't make build process more
# fragile trying to avoid this. The signing process is way faster than just
# a clean build of buildbot, especially with regression tests enabled.
if builder.platform == 'win':
command = ['cmake', '--build', '.', '--target', 'install', '--config', 'Release']
else:
command = ['make', '-s', '-j16', 'install']
print("CMake build:")
buildbot_utils.call(builder.command_prefix + command)
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
update_git(builder)
clean_directories(builder)
cmake_configure(builder)
cmake_build(builder)

View File

@@ -1,208 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Runs on buildbot worker, creating a release package using the build
# system and zipping it into buildbot_upload.zip. This is then uploaded
# to the master in the next buildbot step.
import os
import sys
from pathlib import Path
import buildbot_utils
def get_package_name(builder, platform=None):
info = buildbot_utils.VersionInfo(builder)
package_name = 'blender-' + info.full_version
if platform:
package_name += '-' + platform
if not (builder.branch == 'master' or builder.is_release_branch):
if info.is_development_build:
package_name = builder.branch + "-" + package_name
return package_name
def sign_file_or_directory(path):
from codesign.simple_code_signer import SimpleCodeSigner
code_signer = SimpleCodeSigner()
code_signer.sign_file_or_directory(Path(path))
def create_buildbot_upload_zip(builder, package_files):
import zipfile
buildbot_upload_zip = os.path.join(builder.upload_dir, "buildbot_upload.zip")
if os.path.exists(buildbot_upload_zip):
os.remove(buildbot_upload_zip)
try:
z = zipfile.ZipFile(buildbot_upload_zip, "w", compression=zipfile.ZIP_STORED)
for filepath, filename in package_files:
print("Packaged", filename)
z.write(filepath, arcname=filename)
z.close()
except Exception as ex:
sys.stderr.write('Create buildbot_upload.zip failed: ' + str(ex) + '\n')
sys.exit(1)
def create_tar_xz(src, dest, package_name):
# One extra to remove leading os.sep when cleaning root for package_root
ln = len(src) + 1
flist = list()
# Create list of tuples containing file and archive name
for root, dirs, files in os.walk(src):
package_root = os.path.join(package_name, root[ln:])
flist.extend([(os.path.join(root, file), os.path.join(package_root, file)) for file in files])
import tarfile
# Set UID/GID of archived files to 0, otherwise they'd be owned by whatever
# user compiled the package. If root then unpacks it to /usr/local/ you get
# a security issue.
def _fakeroot(tarinfo):
tarinfo.gid = 0
tarinfo.gname = "root"
tarinfo.uid = 0
tarinfo.uname = "root"
return tarinfo
package = tarfile.open(dest, 'w:xz', preset=9)
for entry in flist:
package.add(entry[0], entry[1], recursive=False, filter=_fakeroot)
package.close()
def cleanup_files(dirpath, extension):
for f in os.listdir(dirpath):
filepath = os.path.join(dirpath, f)
if os.path.isfile(filepath) and f.endswith(extension):
os.remove(filepath)
def pack_mac(builder):
info = buildbot_utils.VersionInfo(builder)
os.chdir(builder.build_dir)
cleanup_files(builder.build_dir, '.dmg')
package_name = get_package_name(builder, 'macOS')
package_filename = package_name + '.dmg'
package_filepath = os.path.join(builder.build_dir, package_filename)
release_dir = os.path.join(builder.blender_dir, 'release', 'darwin')
buildbot_dir = os.path.join(builder.blender_dir, 'build_files', 'buildbot')
bundle_script = os.path.join(buildbot_dir, 'worker_bundle_dmg.py')
command = [bundle_script]
command += ['--dmg', package_filepath]
if info.is_development_build:
background_image = os.path.join(release_dir, 'buildbot', 'background.tif')
command += ['--background-image', background_image]
if builder.codesign:
command += ['--codesign']
command += [builder.install_dir]
buildbot_utils.call(command)
create_buildbot_upload_zip(builder, [(package_filepath, package_filename)])
def pack_win(builder):
info = buildbot_utils.VersionInfo(builder)
os.chdir(builder.build_dir)
cleanup_files(builder.build_dir, '.zip')
# CPack will add the platform name
cpack_name = get_package_name(builder, None)
package_name = get_package_name(builder, 'windows' + str(builder.bits))
command = ['cmake', '-DCPACK_OVERRIDE_PACKAGENAME:STRING=' + cpack_name, '.']
buildbot_utils.call(builder.command_prefix + command)
command = ['cpack', '-G', 'ZIP']
buildbot_utils.call(builder.command_prefix + command)
package_filename = package_name + '.zip'
package_filepath = os.path.join(builder.build_dir, package_filename)
package_files = [(package_filepath, package_filename)]
if info.version_cycle == 'release':
# Installer only for final release builds, otherwise will get
# 'this product is already installed' messages.
command = ['cpack', '-G', 'WIX']
buildbot_utils.call(builder.command_prefix + command)
package_filename = package_name + '.msi'
package_filepath = os.path.join(builder.build_dir, package_filename)
if builder.codesign:
sign_file_or_directory(package_filepath)
package_files += [(package_filepath, package_filename)]
create_buildbot_upload_zip(builder, package_files)
def pack_linux(builder):
blender_executable = os.path.join(builder.install_dir, 'blender')
info = buildbot_utils.VersionInfo(builder)
# Strip all unused symbols from the binaries
print("Stripping binaries...")
buildbot_utils.call(builder.command_prefix + ['strip', '--strip-all', blender_executable])
print("Stripping python...")
py_target = os.path.join(builder.install_dir, info.short_version)
buildbot_utils.call(
builder.command_prefix + [
'find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';',
],
)
# Construct package name
platform_name = 'linux64'
package_name = get_package_name(builder, platform_name)
package_filename = package_name + ".tar.xz"
print("Creating .tar.xz archive")
package_filepath = builder.install_dir + '.tar.xz'
create_tar_xz(builder.install_dir, package_filepath, package_name)
# Create buildbot_upload.zip
create_buildbot_upload_zip(builder, [(package_filepath, package_filename)])
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
# Make sure install directory always exists
os.makedirs(builder.install_dir, exist_ok=True)
if builder.platform == 'mac':
pack_mac(builder)
elif builder.platform == 'win':
pack_win(builder)
elif builder.platform == 'linux':
pack_linux(builder)

View File

@@ -1,42 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import buildbot_utils
import os
import sys
def get_ctest_arguments(builder):
args = ['--output-on-failure']
if builder.platform == 'win':
args += ['-C', 'Release']
return args
def test(builder):
os.chdir(builder.build_dir)
command = builder.command_prefix + ['ctest'] + get_ctest_arguments(builder)
buildbot_utils.call(command)
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
test(builder)

View File

@@ -1,31 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import buildbot_utils
import os
import sys
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
os.chdir(builder.blender_dir)
# Run make update which handles all libraries and submodules.
make_update = os.path.join(builder.blender_dir, "build_files", "utils", "make_update.py")
buildbot_utils.call([sys.executable, make_update, '--no-blender', "--use-tests", "--use-centos-libraries"])

View File

@@ -20,8 +20,24 @@ if(NOT CLANG_ROOT_DIR AND NOT $ENV{CLANG_ROOT_DIR} STREQUAL "")
set(CLANG_ROOT_DIR $ENV{CLANG_ROOT_DIR})
endif()
if(NOT LLVM_ROOT_DIR)
if(DEFINED LLVM_VERSION)
message(running llvm-config-${LLVM_VERSION})
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION})
endif()
if(NOT LLVM_CONFIG)
find_program(LLVM_CONFIG llvm-config)
endif()
execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LLVM_ROOT_DIR ${LLVM_ROOT_DIR} CACHE PATH "Path to the LLVM installation")
endif()
set(_CLANG_SEARCH_DIRS
${CLANG_ROOT_DIR}
${LLVM_ROOT_DIR}
/opt/lib/clang
)

View File

@@ -34,7 +34,7 @@ FIND_PATH(EMBREE_INCLUDE_DIR
include
)
IF(NOT (APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")))
IF(NOT (("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64") OR (APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))))
SET(_embree_SIMD_COMPONENTS
embree_sse42
embree_avx

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,66 @@
# - Find Zstd library
# Find the native Zstd includes and library
# This module defines
# ZSTD_INCLUDE_DIRS, where to find zstd.h, Set when
# ZSTD_INCLUDE_DIR is found.
# ZSTD_LIBRARIES, libraries to link against to use Zstd.
# ZSTD_ROOT_DIR, The base directory to search for Zstd.
# This can also be an environment variable.
# ZSTD_FOUND, If false, do not try to use Zstd.
#
# also defined, but not for general use are
# ZSTD_LIBRARY, where to find the Zstd library.
#=============================================================================
# Copyright 2019 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If ZSTD_ROOT_DIR was defined in the environment, use it.
IF(NOT ZSTD_ROOT_DIR AND NOT $ENV{ZSTD_ROOT_DIR} STREQUAL "")
SET(ZSTD_ROOT_DIR $ENV{ZSTD_ROOT_DIR})
ENDIF()
SET(_zstd_SEARCH_DIRS
${ZSTD_ROOT_DIR}
)
FIND_PATH(ZSTD_INCLUDE_DIR
NAMES
zstd.h
HINTS
${_zstd_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(ZSTD_LIBRARY
NAMES
zstd
HINTS
${_zstd_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set ZSTD_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Zstd DEFAULT_MSG
ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
IF(ZSTD_FOUND)
SET(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
SET(ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR})
ENDIF()
MARK_AS_ADVANCED(
ZSTD_INCLUDE_DIR
ZSTD_LIBRARY
)

View File

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

View File

@@ -79,7 +79,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
ERROR_QUIET)
if(NOT _git_below_check STREQUAL "")
# If there're commits between HEAD and upstream this means
# that we're reset-ed to older revision. Use it's hash then.
# that we're reset-ed to older revision. Use its hash then.
execute_process(COMMAND git rev-parse --short=12 HEAD
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE MY_WC_HASH

View File

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

View File

@@ -8,6 +8,9 @@ IGNORE_SOURCE = (
# specific source files
"extern/audaspace/",
# Use for `WIN32` only.
"source/creator/blender_launcher_win32.c",
# specific source files
"extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp",
"extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp",

View File

@@ -82,7 +82,7 @@ def create_nb_project_main():
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
make_exe_basename = os.path.basename(make_exe)
# --------------- NB specific
# --------------- NetBeans specific.
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]

View File

@@ -7,7 +7,6 @@
set(WITH_ASSERT_ABORT ON CACHE BOOL "" FORCE)
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
set(WITH_COMPILER_ASAN ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_DEBUG ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_NATIVE_ONLY ON CACHE BOOL "" FORCE)
set(WITH_DOC_MANPAGE OFF CACHE BOOL "" FORCE)
set(WITH_GTESTS ON CACHE BOOL "" FORCE)

View File

@@ -29,6 +29,7 @@ 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_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)

View File

@@ -30,6 +30,7 @@ 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_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)

View File

@@ -208,7 +208,7 @@ function(blender_source_group
)
# if enabled, use the sources directories as filters.
if(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
if(IDE_GROUP_SOURCES_IN_FOLDERS)
foreach(_SRC ${sources})
# remove ../'s
get_filename_component(_SRC_DIR ${_SRC} REALPATH)
@@ -240,8 +240,8 @@ function(blender_source_group
endforeach()
endif()
# if enabled, set the FOLDER property for visual studio projects
if(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
# if enabled, set the FOLDER property for the projects
if(IDE_GROUP_PROJECTS_IN_FOLDERS)
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
set_target_properties(${name} PROPERTIES FOLDER ${FolderDir})
@@ -596,14 +596,6 @@ function(SETUP_LIBDIRS)
link_directories(${GMP_LIBPATH})
endif()
if(WITH_GHOST_WAYLAND)
link_directories(
${wayland-client_LIBRARY_DIRS}
${wayland-egl_LIBRARY_DIRS}
${xkbcommon_LIBRARY_DIRS}
${wayland-cursor_LIBRARY_DIRS})
endif()
if(WIN32 AND NOT UNIX)
link_directories(${PTHREADS_LIBPATH})
endif()
@@ -702,7 +694,7 @@ macro(message_first_run)
endmacro()
# when we have warnings as errors applied globally this
# needs to be removed for some external libs which we dont maintain.
# needs to be removed for some external libs which we don't maintain.
# utility macro
macro(remove_cc_flag
@@ -802,7 +794,7 @@ macro(remove_extra_strict_flags)
endmacro()
# note, we can only append flags on a single file so we need to negate the options.
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
# at the moment we can't shut up ffmpeg deprecations, so use this, but will
# probably add more removals here.
macro(remove_strict_c_flags_file
filenames)
@@ -923,10 +915,6 @@ function(get_blender_version)
math(EXPR _out_version_major "${_out_version} / 100")
math(EXPR _out_version_minor "${_out_version} % 100")
# Zero pad the minor version so `_out_version_minor` is always two characters.
# This is needed if the minor version is a single digit.
string(REGEX REPLACE "^([0-9])$" "0\\1" _out_version_minor "${_out_version_minor}")
# output vars
set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE)
@@ -975,14 +963,6 @@ macro(blender_project_hack_post)
unset(_reset_standard_cflags_rel)
unset(_reset_standard_cxxflags_rel)
# ------------------------------------------------------------------
# workaround for omission in cmake 2.8.4's GNU.cmake, fixed in 2.8.5
if(CMAKE_COMPILER_IS_GNUCC)
if(NOT DARWIN)
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
endif()
endif()
endmacro()
# pair of macros to allow libraries to be specify files to install, but to

View File

@@ -104,8 +104,8 @@ if(WIN32)
set(CPACK_WIX_LIGHT_EXTRA_FLAGS -dcl:medium)
endif()
set(CPACK_PACKAGE_EXECUTABLES "blender" "blender")
set(CPACK_CREATE_DESKTOP_LINKS "blender" "blender")
set(CPACK_PACKAGE_EXECUTABLES "blender-launcher" "blender")
set(CPACK_CREATE_DESKTOP_LINKS "blender-launcher" "blender")
include(CPack)

View File

@@ -388,6 +388,10 @@ endif()
if(WITH_TBB)
find_package(TBB)
if(NOT TBB_FOUND)
message(WARNING "TBB not found, disabling WITH_TBB")
set(WITH_TBB OFF)
endif()
endif()
if(WITH_POTRACE)
@@ -400,32 +404,16 @@ endif()
# CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
if(WITH_OPENMP)
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0")
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
# Use OpenMP from our precompiled libraries.
message(STATUS "Using ${LIBDIR}/openmp for OpenMP")
set(OPENMP_CUSTOM ON)
set(OPENMP_FOUND ON)
set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
set(OpenMP_LINKER_FLAGS "-L'${LIBDIR}/openmp/lib' -lomp")
# Copy libomp.dylib to allow executables like datatoc and tests to work.
# `@executable_path/../Resources/lib/` `LC_ID_DYLIB` is added by the deps builder.
# For single config generator datatoc, tests etc.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib
)
# For multi-config generator datatoc, etc.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib
)
# For multi-config generator tests.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib/libomp.dylib
)
set(OpenMP_LIBRARY_DIR "${LIBDIR}/openmp/lib/")
set(OpenMP_LINKER_FLAGS "-L'${OpenMP_LIBRARY_DIR}' -lomp")
set(OpenMP_LIBRARY "${OpenMP_LIBRARY_DIR}/libomp.dylib")
endif()
endif()
@@ -453,6 +441,9 @@ if(WITH_HARU)
endif()
endif()
set(ZSTD_ROOT_DIR ${LIBDIR}/zstd)
find_package(Zstd REQUIRED)
if(EXISTS ${LIBDIR})
without_system_libs_end()
endif()
@@ -476,10 +467,8 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic")
endif()
if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
# Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024")
endif()
# Clang has too low template depth of 128 for libmv.
string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024")
# Avoid conflicts with Luxrender, and other plug-ins that may use the same
# libraries as Blender with a different version or build options.
@@ -509,3 +498,15 @@ if(WITH_COMPILER_CCACHE)
endif()
endif()
endif()
# For binaries that are built but not installed (also not distributed) (datatoc,
# makesdna, tests, etc.), we add an rpath to the OpenMP library dir through
# CMAKE_BUILD_RPATH. This avoids having to make many copies of the dylib next to each binary.
#
# For the installed Python module and installed Blender executable, CMAKE_INSTALL_RPATH
# is modified to find the dylib in an adjacent folder. Install step puts the libraries there.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}")
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../Resources/${BLENDER_VERSION}/lib")

View File

@@ -99,6 +99,7 @@ endif()
find_package_wrapper(JPEG REQUIRED)
find_package_wrapper(PNG REQUIRED)
find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Zstd REQUIRED)
find_package_wrapper(Freetype REQUIRED)
if(WITH_PYTHON)
@@ -457,6 +458,10 @@ endif()
if(WITH_TBB)
find_package_wrapper(TBB)
if(NOT TBB_FOUND)
message(WARNING "TBB not found, disabling WITH_TBB")
set(WITH_TBB OFF)
endif()
endif()
if(WITH_XR_OPENXR)
@@ -575,17 +580,17 @@ if(WITH_GHOST_WAYLAND)
pkg_check_modules(wayland-scanner REQUIRED wayland-scanner)
pkg_check_modules(xkbcommon REQUIRED xkbcommon)
pkg_check_modules(wayland-cursor REQUIRED wayland-cursor)
pkg_check_modules(dbus REQUIRED dbus-1)
set(WITH_GL_EGL ON)
if(WITH_GHOST_WAYLAND)
list(APPEND PLATFORM_LINKLIBS
${wayland-client_LIBRARIES}
${wayland-egl_LIBRARIES}
${xkbcommon_LIBRARIES}
${wayland-cursor_LIBRARIES}
)
endif()
list(APPEND PLATFORM_LINKLIBS
${wayland-client_LINK_LIBRARIES}
${wayland-egl_LINK_LIBRARIES}
${xkbcommon_LINK_LIBRARIES}
${wayland-cursor_LINK_LIBRARIES}
${dbus_LINK_LIBRARIES}
)
endif()
if(WITH_GHOST_X11)

View File

@@ -57,8 +57,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS})
if(NOT WITH_PYTHON_MODULE)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT blender)
endif()
@@ -119,7 +117,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
pathcch Shcore
)
if(WITH_INPUT_IME)
@@ -144,8 +142,8 @@ add_definitions(-D_ALLOW_KEYWORD_MACROS)
# that both /GR and /GR- are specified.
remove_cc_flag("/GR")
# We want to support Windows 7 level ABI
add_definitions(-D_WIN32_WINNT=0x601)
# Make the Windows 8.1 API available for use.
add_definitions(-D_WIN32_WINNT=0x603)
include(build_files/cmake/platform/platform_win32_bundle_crt.cmake)
remove_cc_flag("/MDd" "/MD" "/Zi")
@@ -153,8 +151,8 @@ if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
string(APPEND CMAKE_CXX_FLAGS " ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference")
else()
string(APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj")
string(APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj /Zc:inline")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj /Zc:inline")
endif()
# X64 ASAN is available and usable on MSVC 16.9 preview 4 and up)
@@ -217,8 +215,8 @@ else()
endif()
if(WITH_WINDOWS_PDB)
set(PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}")
set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
set(PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}")
set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
endif()
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}")
@@ -261,8 +259,10 @@ if(NOT DEFINED LIBDIR)
else()
message(FATAL_ERROR "32 bit compiler detected, blender no longer provides pre-build libraries for 32 bit windows, please set the LIBDIR cmake variable to your own library folder")
endif()
# Can be 1910..1912
if(MSVC_VERSION GREATER 1919)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30130)
message(STATUS "Visual Studio 2022 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
elseif(MSVC_VERSION GREATER 1919)
message(STATUS "Visual Studio 2019 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
elseif(MSVC_VERSION GREATER 1909)
@@ -548,7 +548,6 @@ if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
set(OPENCOLORIO_DEFINITIONS "-DDOpenColorIO_SKIP_IMPORTS")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
add_definitions(-DOIIO_STATIC_DEFINE)
add_definitions(-DOIIO_NO_SSE=1)
@@ -594,7 +593,7 @@ if(WITH_OPENCOLORIO)
debug ${OPENCOLORIO_LIBPATH}/libexpatdMD.lib
debug ${OPENCOLORIO_LIBPATH}/pystring_d.lib
)
set(OPENCOLORIO_DEFINITIONS)
set(OPENCOLORIO_DEFINITIONS "-DOpenColorIO_SKIP_IMPORTS")
endif()
if(WITH_OPENVDB)
@@ -675,10 +674,11 @@ if(WITH_SYSTEM_AUDASPACE)
endif()
if(WITH_TBB)
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/debug/tbb_debug.lib)
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
if(WITH_TBB_MALLOC_PROXY)
set(TBB_MALLOC_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbbmalloc.lib debug ${LIBDIR}/tbb/lib/tbbmalloc_debug.lib)
add_definitions(-DWITH_TBB_MALLOC)
endif()
endif()
@@ -873,3 +873,6 @@ if(WITH_HARU)
set(WITH_HARU OFF)
endif()
endif()
set(ZSTD_INCLUDE_DIRS ${LIBDIR}/zstd/include)
set(ZSTD_LIBRARIES ${LIBDIR}/zstd/lib/zstd_static.lib)

View File

@@ -15,6 +15,15 @@ if(WITH_WINDOWS_BUNDLE_CRT)
include(InstallRequiredSystemLibraries)
# ucrtbase(d).dll cannot be in the manifest, due to the way windows 10 handles
# redirects for this dll, for details see T88813.
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
string(FIND ${lib} "ucrtbase" pos)
if(NOT pos EQUAL -1)
list(REMOVE_ITEM CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${lib})
install(FILES ${lib} DESTINATION . COMPONENT Libraries)
endif()
endforeach()
# Install the CRT to the blender.crt Sub folder.
install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ./blender.crt COMPONENT Libraries)

View File

@@ -0,0 +1,10 @@
Pipeline Config
===============
The `yaml` configuration file is used by buildbot build pipeline `update-code` step.
The file allows to set branches or specific commits for both git submodules and svn artifacts. Can also define various build package versions for use by build workers. Especially useful in experimental and release branches.
NOTE:
* The configuration file is ```NOT``` used by the `../utils/make_update.py` script.
* That will implemented in the future.

View File

@@ -1,91 +0,0 @@
{
"update-code": {
"git": {
"submodules": [
{
"path": "release/scripts/addons",
"branch": "blender-v2.93-release",
"commit_id": "HEAD"
},
{
"path": "release/scripts/addons_contrib",
"branch": "blender-v2.93-release",
"commit_id": "HEAD"
},
{
"path": "release/datafiles/locale",
"branch": "blender-v2.93-release",
"commit_id": "HEAD"
},
{
"path": "source/tools",
"branch": "blender-v2.93-release",
"commit_id": "HEAD"
}
]
},
"svn": {
"tests": {
"path": "lib/tests",
"branch": "tags/blender-2.93-release",
"commit_id": "HEAD"
},
"libraries": {
"darwin-x86_64": {
"path": "lib/darwin",
"branch": "tags/blender-2.93-release",
"commit_id": "HEAD"
},
"darwin-arm64": {
"path": "lib/darwin_arm64",
"branch": "tags/blender-2.93-release",
"commit_id": "HEAD"
},
"linux-x86_64": {
"path": "lib/linux_centos7_x86_64",
"branch": "tags/blender-2.93-release",
"commit_id": "HEAD"
},
"windows-amd64": {
"path": "lib/win64_vc15",
"branch": "tags/blender-2.93-release",
"commit_id": "HEAD"
}
}
}
},
"buildbot": {
"gcc": {
"version": "9.0"
},
"sdks": {
"optix": {
"version": "7.1.0"
},
"cuda10": {
"version": "10.1"
},
"cuda11": {
"version": "11.3"
}
},
"cmake": {
"default": {
"version": "any",
"overrides": {}
},
"darwin-x86_64": {
"overrides": {}
},
"darwin-arm64": {
"overrides": {}
},
"linux-x86_64": {
"overrides": {}
},
"windows-amd64": {
"overrides": {}
}
}
}
}

View File

@@ -0,0 +1,70 @@
#
# Used by Buildbot build pipeline make_update.py script only for now
# We intended to update the make_update.py in the branches to use this file eventually
#
update-code:
git:
submodules:
- branch: master
commit_id: HEAD
path: release/scripts/addons
- branch: master
commit_id: HEAD
path: release/scripts/addons_contrib
- branch: master
commit_id: HEAD
path: release/datafiles/locale
- branch: master
commit_id: HEAD
path: source/tools
svn:
libraries:
darwin-arm64:
branch: trunk
commit_id: HEAD
path: lib/darwin_arm64
darwin-x86_64:
branch: trunk
commit_id: HEAD
path: lib/darwin
linux-x86_64:
branch: trunk
commit_id: HEAD
path: lib/linux_centos7_x86_64
windows-amd64:
branch: trunk
commit_id: HEAD
path: lib/win64_vc15
tests:
branch: trunk
commit_id: HEAD
path: lib/tests
benchmarks:
branch: trunk
commit_id: HEAD
path: lib/benchmarks
#
# Buildbot only configs
#
buildbot:
gcc:
version: '9.0.0'
cuda10:
version: '10.1.243'
cuda11:
version: '11.4.1'
optix:
version: '7.1.0'
cmake:
default:
version: any
overrides: {}
darwin-arm64:
overrides: {}
darwin-x86_64:
overrides: {}
linux-x86_64:
overrides: {}
windows-amd64:
overrides: {}

View File

@@ -0,0 +1,5 @@
Make Utility Scripts
====================
Scripts used only by developers for now

View File

@@ -1,9 +1,12 @@
echo No explicit msvc version requested, autodetecting version.
call "%~dp0\detect_msvc2019.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2017.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2019.cmd"
call "%~dp0\detect_msvc2022.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
echo Compiler Detection failed. Use verbose switch for more information.

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,34 @@
set SOURCEDIR=%BLENDER_DIR%/doc/python_api/sphinx-in
set BUILDDIR=%BLENDER_DIR%/doc/python_api/sphinx-out
if "%BF_LANG%" == "" set BF_LANG=en
set SPHINXOPTS=-j auto -D language=%BF_LANG%
call "%~dp0\find_sphinx.cmd"
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
echo unable to locate sphinx-build, run "set sphinx_BIN=full_path_to_sphinx-build.exe"
exit /b 1
:detect_sphinx_done
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%BLENDER_BIN% ^
--background -noaudio --factory-startup ^
--python %BLENDER_DIR%/doc/python_api/sphinx_doc_gen.py
"%SPHINX_BIN%" -b html %SPHINXOPTS% %O% %SOURCEDIR% %BUILDDIR%
:EOF

View File

@@ -0,0 +1,28 @@
REM First see if there is an environment variable set
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the build folder next, if ninja was used there will be no
REM debug/release folder
set BLENDER_BIN=%BUILD_DIR%\bin\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the release folder next
set BLENDER_BIN=%BUILD_DIR%\bin\release\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the debug folder next
set BLENDER_BIN=%BUILD_DIR%\bin\debug\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM at this point, we don't know where blender is, clear the variable
set BLENDER_BIN=
:detect_blender_done

View File

@@ -0,0 +1,21 @@
REM First see if there is an environment variable set
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM Then see if inkscape is available in the path
for %%X in (inkscape.exe) do (set INKSCAPE_BIN=%%~$PATH:X)
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM Finally see if it is perhaps installed at the default location
set INKSCAPE_BIN=%ProgramFiles%\Inkscape\bin\inkscape.exe
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM If still not found clear the variable
set INKSCAPE_BIN=
:detect_inkscape_done

View File

@@ -0,0 +1,23 @@
REM First see if there is an environment variable set
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
REM Then see if inkscape is available in the path
for %%X in (sphinx-build.exe) do (set SPHINX_BIN=%%~$PATH:X)
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINX_BIN environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
REM If still not found clear the variable
set SPHINX_BIN=
:detect_sphinx_done

View File

@@ -0,0 +1,42 @@
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
)
echo python not found at %PYTHON%
exit /b 1
:detect_python_done
echo found python (%PYTHON%)
call "%~dp0\find_inkscape.cmd"
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
echo unable to locate inkscape, run "set inkscape_BIN=full_path_to_inkscape.exe"
exit /b 1
:detect_inkscape_done
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_update.py
%PYTHON% -B %BLENDER_DIR%\release\datafiles\prvicons_update.py
%PYTHON% -B %BLENDER_DIR%\release\datafiles\alert_icons_update.py
:EOF

View File

@@ -0,0 +1,29 @@
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
)
echo python not found at %PYTHON%
exit /b 1
:detect_python_done
echo found python (%PYTHON%)
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_geom_update.py
:EOF

View File

@@ -66,6 +66,14 @@ if NOT "%1" == "" (
) else if "%1" == "2019b" (
set BUILD_VS_YEAR=2019
set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
) else if "%1" == "2022" (
set BUILD_VS_YEAR=2022
) else if "%1" == "2022pre" (
set BUILD_VS_YEAR=2022
set VSWHERE_ARGS=-prerelease
) else if "%1" == "2022b" (
set BUILD_VS_YEAR=2022
set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
) else if "%1" == "packagename" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DCPACK_OVERRIDE_PACKAGENAME="%2"
shift /1
@@ -99,6 +107,15 @@ if NOT "%1" == "" (
set FORMAT=1
set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9
goto EOF
) else if "%1" == "icons" (
set ICONS=1
goto EOF
) else if "%1" == "icons_geom" (
set ICONS_GEOM=1
goto EOF
) else if "%1" == "doc_py" (
set DOC_PY=1
goto EOF
) else (
echo Command "%1" unknown, aborting!
goto ERR

View File

@@ -31,3 +31,6 @@ set PYDEBUG_CMAKE_ARGS=
set FORMAT=
set TEST=
set BUILD_WITH_SCCACHE=
set ICONS=
set ICONS_GEOM=
set DOC_PY=

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