For node tools, I would like to give the option of invoking the operator from the
menu, but waiting for a mouse click for the future "Mouse Position" node. Not
all node tools should do that though, and they all use the same operator type,
so it needs to depend on an operator callback. That's implemented here.
Pull Request: https://projects.blender.org/blender/blender/pulls/118983
Previously only dropping file-paths was supported by the WM logic,
even though GHOST supported strings.
This is used for dropping a text selection as well as URL's
(on X11 & Wayland).
Add WM_DRAG_STRING, created from GHOST's GHOST_kDragnDropTypeString.
Currently most of the data stored in `wmWindowManager` is runtime
data not saved to files. It's confusing that it's declared in DNA then. That
also prevents us from using C++ features. This commit adds an initial
runtime struct. Moving data there can be done as a separate step.
Initially I wanted to look at moving the `ReportList` system to C++.
The runtime struct has to be defined in the blenkernel module because
the members are (will be) used there in a few places.
Pull Request: https://projects.blender.org/blender/blender/pulls/118157
Removal of "confirm" operator callback for confirmation customization,
in favor of new method that shares existing operator dialog code and
allows python configuration.
Pull Request: https://projects.blender.org/blender/blender/pulls/117564
As suggested by Campbell, this changes structure, variable, and
callback names to use "confirm" terminology rather than "warning"
for code related to custom confirmations.
Pull Request: https://projects.blender.org/blender/blender/pulls/116992
Reloading scripts lead to wmDropBox::ot pointing to freed operators.
Resolve by following the logic of key-map operator initialization
to ensure changes to registered operator triggers a refresh of the
operator pointer & properties.
Allow our current simple confirmations to be customized and extended
with callbacks, allowing different behaviors, different icons, and
showing more information. Makes no changes to any existing dialogs.
Pull Request: https://projects.blender.org/blender/blender/pulls/104670
Make it possible to nest bone collections. The data structure on the
armature is still a flat array. It is organised as follows:
- Sibling collections (i.e. ones with the same parent) are stored
sequentially in the array.
- Each bone collection keep track of the number of children, and the
index of the first child.
- Root collections (i.e. ones without parent) are stored as the first
elements in the array.
- The number of root collections is stored on the Armature.
This commit also contains the following:
- Replaced the flat UIList of bone collections with a tree view.
- Updated the M/Shift+M operators (move/assign to collection) to work
with hierarchical bone collections.
- Updated RNA interface to expose only root collections at
`armature.collections`. All collections are available on
`armature.collections.all`, and children at `bonecollection.children`.
- Library override support. Only new roots + their subtrees can be added
via overrides.
See https://projects.blender.org/blender/blender/issues/115934
Co-authored with @nathanvegdahl and @nrupsis.
Pull Request: https://projects.blender.org/blender/blender/pulls/115945
There are operators in Blender that allow the user to import multiple
files at the same time, however this functionality is only implemented
when importing with blender's file browser, drag and drop files only
takes first selected file.
The patch adds support for drag and drop multiple files.
Notes:
* The files are filtered according to the extension of the first
selected file.
* Not all operators that import files support importing multiple files,
so they will still import one.
* Changes must be made to allow importers to read all file paths.
This will be used in upcoming drag & drop import.
Pull Request: https://projects.blender.org/blender/blender/pulls/107230
`wmDragActiveDropState` contains a `bContextStore` unique pointer, so
when constructing/destructing an object of this type `BKE_context.hh`
had to be included. It wouldn't be obvious why this include is necessary
in some cases. And the pointer is otherwise managed internally in the
source file, so the need for this include shouldn't bleed into other
files.
Make sure the unique pointer construction/destruction happens in the
translation unit of the source file that otherwise also manages it.
Avoids include in #107230.
wmJob's shared data (with their worker threads), #wmJobWorkerStatus, now
also contains a #ReportList pointer.
Job worker code is now expected to use `BKE_report` APIs to populate this
new shared reportlist, instead of calling the (absolutely) not
thread-safe `WM_reports` API. This will be tackled in later commits.
Note that since commit 9859622a66, #ReportList and `BKE_report` API
is now thread-safe, so no further handling for this is required in the
wmJob code itself.
The periodic wmJob update handling (done through timers currently)
takes care of moving reports from the job data to the WM data.
Implements #112537.
Pull Request: #113548.
These callbacks were named for the purpose of drawing (and that's probably
their main use case still), but nothing limits them to be used for that only.
They can be useful for non-drawing related things, essentially they act as
drop-box entering and exiting event handlers. Reflect that in the name, so also
more clear when they will be called, as opposed to what they are typically used
for. Drop-boxes already have such event handler callbacks, this makes their API
naming more consistent.
Also better differentiates between drawing and handling callbacks, the
difference matters (attempting to draw during handling won't work).
Move the three current 'status variables' (stop, update and progress)
into a single 'WorkerStatus' struct. This is cleaner and will allow for
future workin this area without having to edit tens of 'startjob'
callbacks signatures all the time.
No functional change expected here.
Note: jobs' specific internal code has been modified as little as
possible, in many cases the job's own data still just store pointers to
these three values. Ideally in the future more refactor will be using a
single pointer to the shared `wmJobWorkerStatus` data instead.
Pull Request: https://projects.blender.org/blender/blender/pulls/113343
IME editing would cast GHOST_TEventImeData to wmIMEData then read/write
an additional member that doesn't exist in GHOST_TEventImeData.
In practice it's likely struct padding prevented this from showing up
as a bug. Nevertheless it's bad practice to rely on this.
- Make GHOST_TEventImeData read-only, move the is_ime_composing boolean
into the window.
- Add static assert to ensure both structs are the same size.
- Correct code comments.
It was already called that way in the UI, since it's referring to a
behavior, not a type. Update the code to match that. Note that this is
a BPY compatibility breaking change for 4.0.
In preparation of https://projects.blender.org/blender/blender/pulls/112535, we need to make sure all layer tree manipulations are in functions on the `GreasePencil` struct so we can keep the `CustomData` for layers in sync with the layer tree.
This PR makes sure that all the functions that change the layer tree in any way are `protected` on the `LayerGroup` class. The `GreasePencil` struct is declared `friend` with `LayerGroup`.
We also cleanup and remove a lot of code duplication between layers and layer groups and try to write functions in a generic way for `TreeNode` (both layers and layer groups are tree nodes).
Pull Request: https://projects.blender.org/blender/blender/pulls/112837
- rna_Event_unicode_length would return -1 if utf8_buf wasn't a valid
unicode sequence, while this shouldn't happen, assert and return zero
instead of returning a bad length.
- Move comment on wmEvent::utf8_buf null termination to a doc-string.
There were enough cases of callers ignoring a potential the error value,
using the column width for e.g. to calculate pixel sizes, or the size in
bytes to calculate buffer offsets.
Since text fields & labels can include characters that return an error
from BLI_str_utf8_as_unicode, add the suffix to make this explicit.
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
The operator system assumes that the `ot->ui` callback means
there will always be a redo panel. This situation where there is a
callback but sometimes no inputs hasn't been encountered before.
Resolve that by changing `WM_operator_check_ui_empty` into
a `WM_operator_ui_poll` that handles this case properly, with
a new operator type callback called `ui_poll`.
See #101778, #111346
Pull Request: https://projects.blender.org/blender/blender/pulls/112251
This callback is actually never excuted when e.g. defining operators
buttons through the layout API.
A design task has also been created to keep track of this issue: #112253
- Use `this->` to access class methods.
- Follow style guide for class definition order.
- Avoid unnecessary namespace redefinition.
- Make data struct local to node interface file.
Remove the need for `CTX_store_copy` and `CTX_store_free` by using
C++ copy constructors, unique pointers, and `std::optional`. A few types
are made non-trivial to support this.
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
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.
With the end goal of simplifying ownership and memory management,
and allowing the use of `get_name` in contexts without statically
allocated strings, use `std::string` for the return values of these two
operator type callbacks instead of `const char *` and `char *`.
In the meantime things get uglier in some places. I'd expect `std::string`
to be used more in the future elsewhere in Blender though.
Pull Request: https://projects.blender.org/blender/blender/pulls/110823