Commit Graph

16 Commits

Author SHA1 Message Date
Jacques Lucke 3eb7e453e4 Nodes: add internal node zone type
The goal is to reduce redundancy by abstracting over the different types of node
tree zones. This makes it easier to add new zone types and makes the intend of
code more clear. For example, now it is more obvious what code deals with zones
in general and what does simulation specific things.

Pull Request: https://projects.blender.org/blender/blender/pulls/112531
2023-09-20 14:40:56 +02:00
Hans Goudey cc83951951 Geometry Nodes: Update node tool menus dynamically
See #101778

Remove the requirement of restarting Blender to refresh the
extended 3D view menus for node group changes. Also avoid
rebuilding the tree of relevant assets and catalogs on every
redraw, since parsing asset libraries, etc. could become more
expensive than we want. Those two goals combined mean we
have to be more rigorous in how we invalidate the cached
catalog tree.

The first main change required is to clear the tree as asset libraries
are being read, similar to other dynamic asset menus. This is done
with a 3D view header listener rather than a menu listener in this case.

However, that isn't enough, because there is an issue with the asset
system where the "all" library isn't updated when the current file library
changes. The solution is to explicitly rebuild the "all" library's catalogs
when other asset libraries are changed.

The other necessity for dynamic updates is clearing the catalog tree
to be rebuilt when the node group "asset traits" are changed. This is
done with a new notifier type (with the goal of being a bit selective
about when we re-read assets). This _also_ requires running the
"presave" callback that builds asset metadata when updating the
property. Otherwise saving the file and sending the notifier is
necessary, which is too confusing.

Pull Request: https://projects.blender.org/blender/blender/pulls/112166
2023-09-14 17:43:33 +02:00
Lukas Tönne e071288ab2 Nodes: Panels integration with blend files and UI
Part 3/3 of #109135, #110272

Switch to new node group interfaces and deprecate old DNA and API.
This completes support for panels in node drawing and in node group
interface declarations in particular.

The new node group interface DNA and RNA code has been added in parts
1 and 2 (#110885, #110952) but has not be enabled yet. This commit
completes the integration by
* enabling the new RNA API
* using the new API in UI
* read/write new interfaces from blend files
* add versioning for backward compatibility
* add forward-compatible writing code to reconstruct old interfaces

All places accessing node group interface declarations should now be
using the new API. A runtime cache has been added that allows simple
linear access to socket inputs and outputs even when a panel hierarchy
is used.

Old DNA has been deprecated and should only be accessed for versioning
(inputs/outputs renamed to inputs_legacy/outputs_legacy to catch
errors). Versioning code ensures both backward and forward
compatibility of existing files.

The API for old interfaces is removed. The new API is very similar but
is defined on the `ntree.interface` instead of the `ntree` directly.
Breaking change notifications and detailed instructions for migrating
will be added.

A python test has been added for the node group API functions. This
includes new functionality such as creating panels and moving items
between different levels.

This patch does not yet contain panel representations in the modifier
UI. This has been tested in a separate branch and will be added with a
later PR (#108565).

Pull Request: https://projects.blender.org/blender/blender/pulls/111348
2023-08-30 12:37:21 +02:00
Bastien Montagne b53c7a804a Readfile: Replace the 'lib_link' specific code by generic usage of foreach_id.
The `lib_link` callback cannot always be fully replaced/removed, as in
some case it is also doing some validation checks, or data editing based
on the result of lib_linking internal ID pointers.

The callback has been renamed for that purpose, from `read_lib` to
`read_after_liblink`. It is now called after all ID pointers have been
fully lib-linked for the current ID, but still before the call to
`do_versions_after_linking`.

This change should not have any behavioral effect. Although in theory
the side-effect of this commit (to split lib linking itself, and the
validation/further processing code) into two completely separated steps
could have some effects, in practice none are expected, and tests did
not show any changes in behavior either..

Part of implementing #105134: Removal of readfile's lib_link & expand code.
2023-08-24 16:33:31 +02:00
Bastien Montagne 8bb5916183 Readfile: Replace the 'expand' specific code by generic usage of foreach_id.
The `expand` callback is 'trivial' to replace, since it is only iterating
over ID pointers and calling a callback.

The only change in behavior here is that some pointers that were not
processed previously will now be.

In practice this is not expected to have any real effect (usually
the IDs used by these pointers would have been expanded through other
usages anyway). But it may solve a few corner cases, undocumented issues
though.

Part of implementing #105134: Removal of readfile's lib_link & expand code.
2023-08-23 16:44:56 +02:00
Hans Goudey e7abe1fd76 Cleanup: Remove unused node function 2023-08-23 10:37:09 -04:00
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Jacques Lucke cc4d5c432c RNA: move headers to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/111022
2023-08-10 22:40:27 +02:00
Iliya Katueshenock 1571be0a47 Cleanup: Use float2 in nodeToView and nodeFromView
Use 2D float to represent node positions.

Pull Request: https://projects.blender.org/blender/blender/pulls/108956
2023-06-15 16:04:23 +02:00
Sergey Sharybin c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00
Iliya Katueshenock 43d66f6760 Cleanup: Fix copyright date in new bke header
Pull Request: https://projects.blender.org/blender/blender/pulls/108112
2023-05-21 03:43:06 +02:00
Chris Blackbourn c8b5b17d40 Cleanup: format 2023-05-17 11:35:46 +12:00
Hans Goudey 859c0d9edf Cleanup: Remove redundant node type lookup function
Using the topology map gives a constant time lookup, since it has a map
of nodes per type. The collada code used the old function, but had been
ifdef'd for four years, so it's removed here.
2023-05-16 11:09:42 -04:00
Hans Goudey d87547abd5 Cleanup: Remove unused node function for finding link
Nowadays it's much better to use the topology cache.
2023-05-16 09:44:41 -04:00
Hans Goudey 320ac28f75 Cleanup: Remove unnecessary struct keywords in node header 2023-05-16 09:43:05 -04:00
Iliya Katueshenock f7388e3be5 Cleanup: Move BKE_node.h to C++
See: https://projects.blender.org/blender/blender/issues/103343

Changes:
1. Added `BKE_node.hh` file. New file includes old one.
2. Functions moved to new file. Redundant `(void)`, `struct` are removed.
3. All cpp includes replaced from `.h` on `.hh`.
4. Everything in `BKE_node.hh` is on `blender::bke` namespace.
5. All implementation functions moved in namespace.
6. Function names (`BKE_node_*`) changed to `blender::bke::node_*`.
7. `eNodeSizePreset` now is a class, with renamed items.

Pull Request: https://projects.blender.org/blender/blender/pulls/107790
2023-05-15 15:14:22 +02:00