Commit Graph

107968 Commits

Author SHA1 Message Date
Campbell Barton 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
Campbell Barton 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
Peter Kim 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
Germano Cavalcante 899935d5d0 Fix wrong usage of 'sizeof'
The intention was to use `ARRAY_SIZE`.

No functional changes.
2021-08-15 20:08:17 -03:00
Germano Cavalcante 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
Harley Acheson 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
Hans Goudey 8f2b60ddbf Cleanup: Variable names, formatting, reduce indentation 2021-08-13 21:46:59 -05:00
Harley Acheson 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
Germano Cavalcante 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
Germano Cavalcante 5655b3d1c5 Cleanup: fix typos in static variables
_desps --> _deps
2021-08-13 15:45:07 -03:00
Bastien Montagne 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
Bastien Montagne 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
Bastien Montagne 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
Philipp Oeser 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
Campbell Barton 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
Sergey Sharybin b9486c39bc Cleanup: Unused function parameter warning 2021-08-13 11:16:01 +02:00
Philipp Oeser 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
Philipp Oeser 00f264ea42 Cleanup: correct comment exiting NLA tweakmode
Comment was pasted from entering tweakmode.
2021-08-13 10:52:53 +02:00
Philipp Oeser 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
Jeroen Bakker 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
Jeroen Bakker 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
Campbell Barton 160d57d33c Docs: tooltip update missing from 3e775a4fc5 2021-08-13 16:01:45 +10:00
Campbell Barton 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
Campbell Barton 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
Campbell Barton 8fa05efe0a Docs: note that normalize_v# functions zero out input containing nan 2021-08-13 15:15:54 +10:00
Campbell Barton 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
Campbell Barton 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
Campbell Barton ab344775c2 Cleanup: code-comments
Use capitalization, remove unnecessary ellipsis.
2021-08-13 13:55:25 +10:00
Campbell Barton 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
Campbell Barton 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
Hans Goudey 1275ce61b1 Cleanup: Remove unused includes
I noticed this file was recompiling when adding a node.
2021-08-12 14:12:14 -05:00
Jacques Lucke 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
Campbell Barton 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
Philipp Oeser 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
Philipp Oeser 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
Philipp Oeser 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
Germano Cavalcante 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
Campbell Barton 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
Campbell Barton ad2fb92e9c Cleanup: remove redundant variable 2021-08-12 17:42:04 +10:00
Campbell Barton 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
Campbell Barton 806bf3f452 datadoc: add newlines to generated source files 2021-08-12 16:23:08 +10:00
Campbell Barton 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
Campbell Barton 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
Campbell Barton 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
Campbell Barton c741558509 Cleanup: spelling in comments 2021-08-12 14:34:43 +10:00
Campbell Barton 1ef275963d Cleanup: use C++ style comments for disabled code 2021-08-12 14:34:41 +10:00
Campbell Barton 4f61843a7e Cleanup: remove *.orig file from 6a9d7139f7 2021-08-12 14:34:39 +10:00