Commit Graph

104442 Commits

Author SHA1 Message Date
Bastien Montagne fe2ceef729 Fix first part of T86501: Crash during resync process.
Code would end up freeing some of the newly created overrides, which
were assigned to the matching linked ID's `newid` pointer, accessed
again further down the code.

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

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

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

Maniphest Tasks: T86455

Differential Revision: https://developer.blender.org/D10692
2021-03-12 09:22:47 +01:00
Campbell Barton a5c44265a3 Cleanup: remove workaround for MSVC PyTypeObject declarations
This is no longer needed for MSVC-2017.
2021-03-12 16:13:36 +11:00
Campbell Barton 2a5f22c1af Cleanup: set the window manager to the updated context on load
While this happened to be corrected by code that runs afterwards,
leaving this in an invalid state could cause problems in the future.
2021-03-12 16:13:36 +11:00
Campbell Barton 2e9fb211c6 Cleanup: make_source_archive.py minor changes & comments
- Add notes on portability.
- Use encoding argument for all file IO.
- Use integer math to calculate major/minor version, while float
  division should be fine prefer matching Blender.
2021-03-12 16:13:36 +11:00
Campbell Barton 7f4530dad2 Cleanup: incorrect doxy section title
Also correct typo.
2021-03-12 16:13:36 +11:00
Campbell Barton 8125731cae Cleanup: break out of loop early 2021-03-12 16:13:36 +11:00
Campbell Barton d3fa576aa7 Cleanup: redundant flag check 2021-03-12 16:13:36 +11:00
Campbell Barton 406d9749d8 Cleanup: redundant outliner includes 2021-03-12 16:13:36 +11:00
Kévin Dietrich 8922d177c1 Alembic procedural: specific result type for cache lookups
This type, CacheLookupResult, holds the data for the current time, or an
explanation as to why no data is available (already loaded, or simply
nothing available). This is useful to document the behavior of the code
but also, in future changes, to respond appropriately for missing data.
2021-03-12 01:57:41 +01:00
Kévin Dietrich d72fc36ec5 Alembic procedural: add support for instancing
Inside of the procedural, instances are AlembicObjects which point to
the AlembicObject that they instance.

In Alembic, an instance is an untyped Object pointing to the original
(instanced) one through its source path. During the archive traversal we
detect such instances and, only if the instanced object is asked to be
rendered, set the instance's AlembicObject to point to the original's
AlembicObject.

Cycles Object Nodes are created for each AlembicObject, but only for
non-instances are Geometries created, which are then shared between
Object Nodes. It is supposed, and expected, that all instances share the
same shaders, which will be set to be the ones found on the original
object.

As for caching, the data cache for an AlembicObject is only valid for
non-instances and should not be read to or from as it is implicitly
shared.
2021-03-12 01:30:12 +01:00
Kévin Dietrich 7017844c5e Alembic procedural: move cache building out of object update methods
This will help support instancing as cache building is now decoupled
from the logic to update the Nodes' sockets as data (and cache) will
need to be shared by different Geometries somehow, and also simplify
implementing different data caching methods by centralizing this
operation.
2021-03-12 00:15:17 +01:00
Kévin Dietrich 7a028d5b99 Alembic procedural: fix missing attribute update
We need to explicitely tag the Attribute and AttributeSet as modified if
we change or add/remove data. This is more of a bandaid until attributes
handling is refactored to be able to reuse routines from the Attribute
API.
2021-03-12 00:15:16 +01:00
Kévin Dietrich 62e2fdf40b Cleanup: unused variable 2021-03-12 00:15:16 +01:00
Kévin Dietrich 2ebf4fbbfb Alembic procedural: fix potential zero scale matrix generation
This can happen during user edits or with files missing the global scale
property.
2021-03-12 00:15:15 +01:00
Fabian Schempp 3256f0d52c Added missing file to last commit:
Nodes: Add Attribute Remove Node D10697
2021-03-11 23:42:19 +01:00
Fabian Schempp 60f7275f7f Nodes: Add Attribute Remove Node
This patch adds a node, that removes an attribute if possible,
otherwise it adds an error message.

Differential Revision: https://developer.blender.org/D10697
2021-03-11 23:06:16 +01:00
Fabian Schempp afa30f1a9d Nodes: Fix drag link from output to already linked Multi-Input Socket
This patch fixes a visual bug related to connecting an output socket to
a Multi-Input Socket, that already has a link to that same output.
In this case, the drag link got a new index and snapped to a new
position. This path makes the drag link snap to the same position as the
first link between the two sockets.

Differential Revision: https://developer.blender.org/D10689
2021-03-11 18:53:29 +01:00
Julian Eisel 8c6337e587 Fix missing UI updates, caused by own earlier commit
Caused by 46aa70cb48.

RNA would send property update notifiers with the owner ID as `reference` data.
Since above's commit we'd only send the notifiers to editors if the reference
data address matches the space's address. So editors wouldn't get the notifiers
at all.

The owner ID for space properties is always the screen AFAIK. So allow
notifiers with the screen as reference to be passed to editors as well, think
this is reasonable to do either way.

For example, steps to reproduce were:
* Open Asset Browser
* Mark some data-blocks of different types as assets (e.g. object & its
  material)
* Switch between the categories in the Asset Browser. The asset list wouldn't
  be updated.
2021-03-11 18:47:14 +01:00
Sybren A. Stüvel 1b1f8da5dd Cleanup: remove unnecessary `const` from function declaration
No functional changes.
2021-03-11 18:20:34 +01:00
Antonio Vazquez 670c1fdf64 GPencil: Remove limitation to use only one Lattice modifier
This limitation was necessary in older versions, but now can be removed.
2021-03-11 18:17:30 +01:00
Julian Eisel 7092d6a7a3 Fix warning from own previous commit 2021-03-11 17:57:05 +01:00
Julian Eisel 46aa70cb48 UI: Avoid unnecessary redraws of unrelated editors on space changes
When adding a notifier, `reference` data can be passed. The notifier system
uses this to filter out listeners, for example if data of a scene changes,
windows showing a different scene won't get the notifiers sent to their
listeners.

For the `NC_SPACE` notifiers, a number of places also passed the space as
`reference`, but that wasn't used at all. The notifier would still be sent to
all listeners in all windows (and the listeners didn't use it either). Causing
some unnecessary updates (e.g. see ed2c4825d3).
With this commit, passing a space will make sure the notifier is only sent to
that exact space. Some code seems to already have expected that to be the case.

However there were some cases that passed the space as `reference` without
reason, which would break with this commit (meaning they wouldn't redraw or
update correctly).
Corrected these so they don't pass the space anymore.
2021-03-11 17:43:45 +01:00
Julian Eisel ed2c4825d3 Fix Asset Browser showing oudated list for changes done while browser is hidden
Steps to reproduce were:
* Open an Asset Browser
* "Mark Asset" on some data-block
* Change the Asset Browser into a different editor (not File Browser!)
* "Clear Asset" on the data-block again, or mark another asset
* Change back to the Asset Browser, it will show an outdated list

Now the file-browser reloads local file data after spaces were changed. Note
that the current notifier code doesn't limit the space-change notifiers to the
affected spaces, so changing any visible space will trigger this. That's an
issue to be fixed separately.
2021-03-11 17:43:33 +01:00
Antonio Vazquez a1b01edf45 GPencil: Fix unreported Fill fails if the stroke was tagged
In some situations the strokes could be tagged before filling, so it's necessary to reset before.
2021-03-11 17:23:04 +01:00
Campbell Barton 9dfc81ccf1 Fix regression in 2cc5af9c55
The check for undo-depth increment/decrement assumed a newly loaded
window manager would have a different pointer.

This broke bl_animation_fcurves test indirectly,
the change to undo-depth caused the redo panel to attempt to popup
in background mode - which isn't supported.

Now the pointer is unchanged, the undo-depth is assumed to match
the value used when calling the operator.

The undo-depth is now properly maintained between file loads,
which is an improvement on the original behavior which reset it.
2021-03-12 03:21:39 +11:00
Siddhartha Jejurkar 350ad4bcb1 Fix T86199: error when adding custom fluid diffusion preset
Differential Revision: https://developer.blender.org/D10694
2021-03-11 16:51:01 +01:00
Sebastián Barschkis d518b0fda5 Fluid: Updated hidden symbol visibility comment
It turns out that on official arm64 devices (not DevKit) the linker
warnings still show up. So just leaving this as is.

Ref D9002
2021-03-11 16:15:45 +01:00
Campbell Barton 5b91a52944 Cleanup: spelling 2021-03-12 00:51:29 +11:00
Campbell Barton 2cc5af9c55 Fix T86431: Keep memory location of the window manager on file load
Keep the pointer location from the initial window-manager
between file load operations.

This is needed as the Python API may hold references to keymaps for e.g.
which are transferred to the newly loaded window manager,
without their `PointerRNA.owner_id` fields being updated.

Since there is only ever one window manager, keep the memory at the same location so the Python ID pointers stay valid.

Reviewed By: mont29

Ref D10690
2021-03-12 00:40:52 +11:00
Campbell Barton 2cdebf293d WM: keep the current state when a blend fails to load
Previously many operations would run on file load, even if the file
did not load. Pre/post load handlers were called, timers canceled,
all undo data freed, editors exited ... etc.

Now keep the blend file in it's current state.

This simplifies updating this area of code as there is one less
possible situation to account for.
2021-03-12 00:40:52 +11:00
Campbell Barton 5812bc7d89 Cleanup: split file read and setup into separate steps
Currently file loading performs almost all reloading logic
even in the case loading the file fails, causing the file to be in
a state that isn't well defined: undo is cleared, timers are canceled &
scripts are re-registered.
2021-03-12 00:40:52 +11:00
Campbell Barton f7616c6eaf Cleanup: file loading/recover checks
- Don't set G.relbase_valid until the file is loaded.
- Remove unnecessary string pointer comparison.
- Remove unused filename being passed to 'setup_app_data'.
2021-03-12 00:40:25 +11:00
Bastien Montagne 93f8c9b823 LibOverride: auto-run resync process on file reading.
Part of T83811 & D10649.
2021-03-11 14:26:19 +01:00
Bastien Montagne a023c1a34c LibOverride: Add second part of auto-resync code.
`BKE_lib_override_library_main_resync` uses
`LIB_TAG_LIB_OVERRIDE_NEED_RESYNC` tags set by RNA override apply code,
and perform detection for the remaining cases (those were new overrides
need to be created for data that was not present before in the library).

And then it actually resync all needed local overrides.

Part of T83811 & D10649.
2021-03-11 14:26:19 +01:00
Bastien Montagne 534f4e90fd LibOverride: First stage of detection of 'need resync'.
We can fairly easily detect some resync-needed cases when applying the
overrides operations on a Pointer RNA property.

This should cover all cases where an existing override's ID pointer is
changed in its linked data.

We still have to add code to detect when a not-yet-overridden linked ID
needs to become overridden (because its relations to other data-blocks
changed in a way that requires it).

Part of T83811 & D10649.
2021-03-11 14:26:19 +01:00
Bastien Montagne 96064c3bb7 LibOverride: Do not delete no-more-used overrides during resync if they are user-edited.
Ultimately those will be listed with a special icon in the upcomming
Outliner overrides view.

Part of T83811 & D10649.
2021-03-11 14:26:19 +01:00
Bastien Montagne 0a6ed7f035 LibOverride: Add a utils to check if override has been user-edited.
Part of T83811 & D10649.
2021-03-11 14:26:19 +01:00
Patrick Mours f4f8b6dde3 Cycles: Change device-only memory to actually only allocate on the device
This patch changes the `MEM_DEVICE_ONLY` type to only allocate on the device and fail if
that is not possible anymore because out-of-memory (since OptiX acceleration structures may
not be allocated in host memory). It also fixes high peak memory usage during OptiX
acceleration structure building.

Reviewed By: brecht

Maniphest Tasks: T85985

Differential Revision: https://developer.blender.org/D10535
2021-03-11 14:12:35 +01:00
Julian Eisel ba996ddb3a Cleanup: Add comment explaining plan for new Outliner tree-element code design
Explains how we can get rid of implicit assumptions and `void *`
arguments/storage in the future.
2021-03-11 13:49:16 +01:00
Julian Eisel 0f60dbe4bf Cleanup: Pass anim-data directly to Outliner anim-data tree element constructor
Rather than letting the `TreeElementAnimData` constructor take an ID from which
we get the animation-data based on an assumption on how it's stored, let the
constructor take the animation-data directly. That way we further centralize
the assumptions on the data passed to the element creation to
`tree_element_create()`.
The following commit will add a comment explaining the plan to entirely get rid
of those assumptions in the future.
2021-03-11 13:49:16 +01:00
Jacques Lucke d4d03f736b Fix (unreported): crash on undo when using pinned id in spreadsheet
Now the behavior is the same as in the properties editor, as far as I can tell.
2021-03-11 13:28:28 +01:00
Julian Eisel fade765bf3 Outliner: Add assert to make assumption for new code design explicit
There was an implicit assumption that tree element types using the new code
design set their name on creation. Use an assert to make this explicit. See
f59ff9e03a, which was an error because of this broken assumption.
2021-03-11 13:20:27 +01:00
Julian Eisel f59ff9e03a Fix crash when showing NLA actions in the Outliner
Caused by 2e221de4ce in combination with 4292bb060d.
In the former I forgot to set the name for NLA actions in the new code design,
in the latter I made it an assumtion that tree element types using the new
design set the name.
The following commit will make this assumption explicit with an assert.
2021-03-11 13:18:17 +01:00
Julian Eisel 018fffbe77 Fix failing assert when loading file with untraceable custom asset library
When loading a file with an asset browser open, and it showed a custom asset
library that can't be found currently (e.g. because the file is from somebody
else), the `BLI_assert(0)` in `rna_FileAssetSelectParams_asset_library_get()`
would fail.

There was code to handle this case already, but unlike I thought it didn't run
right after file read. Now it does.
2021-03-11 13:06:31 +01:00
Julian Eisel 42c5303409 Cleanup: Typos in comments (window-manager files)
Typos from a509e79a4c. Looks like issues with an automated cleanup tool.
2021-03-11 13:06:31 +01:00
Jacques Lucke 5f1f233dc9 Spreadsheet: expore more domains and point cloud data
Ref T86135.

Differential Revision: https://developer.blender.org/D10681
2021-03-11 12:23:01 +01:00
Rahul Chaudhary 74f3edc343 Fix T86458: Simple Subdivision node does not preserve vertex groups
Differential Revision: https://developer.blender.org/D10683
2021-03-11 11:56:40 +01:00