Age | Commit message (Collapse) | Author |
|
Blender UI"
This reverts commit 1b6752e599b5ed70823d09f90c418e448516d4b4. It is causing
constant redraws due to some ID properties seemingly being edited on every
redraw.
|
|
Checking RNA_MAGIC is not enough to identify the ID property case which always
needs updates. If the property is already resolved to an RNA property we need
to check the flag too.
|
|
|
|
There are cases where there is no way to ensure we do have/know about an
active scene. Further more, this should not be required to perform
'real' updates on data, only to perform additional special handling in
current scene (mostly related to editing tools, UI, etc.).
This pointer is actually almost never used in practice, and half of its current
usages are fairly close to abuse of the system (like calls to
`ED_gpencil_tag_scene_gpencil` or `BKE_rigidbody_cache_reset`).
This commit ensures that the few places using this 'active scene' pointer are
safely handling the `NULL` case, and clearly document the fact that a
NULL scene pointer is valid.
|
|
Unfortunately the UNUSED_FUNCTION macro doesn't work for pointer types.
Add UNUSED_FUNCTION_WITH_RETURN_TYPE to workaround this limitation.
|
|
|
|
Add a version of RNA_path_resolve_full that returns true
when the path resolves to a NULL RNA pointer.
|
|
- Split rna_path_token in two,
extracting bracket handling into it's own function.
- Only handle escape characters for quoted tokens.
Numbers were copied using BLI_str_unescape which is unnecessary.
- Extract text without without quotes,
use a return argument so the caller can tell if the token was quoted.
This avoids having to strip the tokens quotes afterwards.
|
|
|
|
Only append RNA_path_from_ID_to_struct to context attributes if those
paths resolve to ID types.
Also simplify creating RNA paths by adding utility functions:
- WM_context_path_resolve_property_full
- WM_context_path_resolve_full
Part of fix for T90723.
|
|
The default float IDProperty min value rB8b9a3b94fc148d19 for when there
is no UI data was FLT_MIN instead of -FLT_MAX, which meant that animated
custom property values couldn't be less than zero unless they had their
UI data values edited previously.
That's a mistake I won't make again! Also change the int minimums from
-INT_MAX to INT_MIN to sanitize the whole situation.
|
|
The storage of 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 another for a group with the property's name, then for
the data value name. Not only is this inefficient, it's hard to reason
about, unintuitive, and not at all self-explanatory.
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 NULL pointer. Beyond
storing the description, name, and RNA subtype, derived structs are used
to store type specific UI data like min and max.
Note that this means that addons using (abusing) the `_RNA_UI` custom
property will have to be changed. A few places in the addons repository
will be changed after this commit with D9919.
**Before**
Before, first the _RNA_UI subgroup is retrieved the _RNA_UI group,
then the subgroup for the original property, then specific UI data
is accessed like any other IDProperty.
```
prop = rna_idprop_ui_prop_get(idproperties_owner, "prop_name", create=True)
prop["min"] = 1.0
```
**After**
After, the `id_properties_ui` function for RNA structs returns a python
object specifically for managing an IDProperty's UI data.
```
ui_data = idproperties_owner.id_properties_ui("prop_name")
ui_data.update(min=1.0)
```
In addition to `update`, there are now other functions:
- `as_dict`: Returns a dictionary of the property's UI data.
- `clear`: Removes the property's UI data.
- `update_from`: Copy UI data between properties,
even if they have different owners.
Differential Revision: https://developer.blender.org/D9697
|
|
|
|
This was noted as a TODO as it wraps RNA_property_string_get_alloc
which takes a length return argument.
|
|
|
|
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.
|
|
- 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.
|
|
|
|
|
|
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
|
|
|
|
|
|
While doxygen supports both, conform to our style guide.
Note that single back-tick's are already used in a majority of comments.
|
|
This shows the text as part of the assertion message.
|
|
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
|
|
Found loading a cycles-x .blend file saved with different integer values for
enum items.
|
|
Also use doxy style function reference `#` prefix chars when
referencing identifiers.
|
|
|
|
|
|
|
|
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
|
|
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
|
|
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
|
|
This flag is needed so PointerRNA structs that aren't
part of the current context can access enum values
without inspecting the context.
This is needed for keymap access, so the keymap UI and keymap
export doesn't depend on the current context.
|
|
Callbacks used in `bpy.props` didn't hold a references to the functions
they used.
While this has been the case since early 2.5x it didn't cause any
problems as long as the class held a reference.
With Python 3.10 or when using `from __future__ import annotations`,
the annotations are no longer owned by the class once evaluated.
Resolve this by holding a reference in the module, which now supports
traverse & clear callbacks so the objects are visible to Python's
garbage collector.
Also refactor storage of Python data, moving from an array into a struct.
|
|
Use _fn as a suffix for callbacks.
|
|
This concerns currently only collections (`master_collection` of scenes)
and root node trees. It removes the matching type-specific helpers
(`BKE_collection_master_scene_search` and `BKE_node_tree_find_owner_ID`).
No functional change expected here.
NOTE: Current implementation of `owner_get` is far from optimal, we
could probably do it better, see {T69169}.
NOTE: While it could also have it, shapekeys IDTypeInfo was left out of
this change for now. Mainly because it sould not be used currently, and
we ultimately want to demote shape keys from ID status anyway.
|
|
|
|
Currently it is not possible to edit bare IDProperty pointer
values which are not explicitly defined through python via
UI fields. This is likely mostly because, unlike numeric values,
pointers aren't marked PROP_EDITABLE by default. However there
are also some bugs in the RNA code that need fixing.
The Geometry Nodes modifier uses bare properties to store
input settings for the node group it wraps, so supporting
Object and Collection sockets requires editable pointers.
This patch marks bare IDProperties editable, and ensures
that changing ID pointers rebuilds the dependency graph.
A type check is needed because an IDPROPERTY PointerPropertyRNA
can actually wrap a group value rather than an ID pointer.
Making pointers editable is not likely to accidentally
affect UI fields that were not intended to be editable,
because a simple `layout.prop` cannot determine which
datablocks to display in the menu and remains read-only.
The PROP_NEVER_UNLINK flag is also removed: it seems it
was added because the edit field that couldn't produce
a menu to set the pointer used to still display the unlink
button, but that seems not to be the case anymore.
Actual support for Object & Collection inputs in the modifier
is added in D10056, which can be used to test this code.
Differential Revision: https://developer.blender.org/D10098
|
|
The rna_idproperty_check call should be done before accessing
the prop pointer so that it can detect IDProperty values and
replace them with the actual PointerPropertyRNA object.
Ref D10098
|
|
Followup to rB7f3601e70dd and rBad63d2f60e2.
|
|
Factorize common processes and checks, early `continue` in invalid
cases, etc.
|
|
data and static RNA property.
We have to check that the RNAProperty found in `rna_idp_path` from the
currently checked IDProperty name is actually a real runtime RNA-defined
one, and not a static C-defined RNAProperty...
|
|
Remove DNA headers, using forward declarations where possible.
Also removed duplicate header, header including it's self
and unnecessary inclusion of libc system headers from BKE header.
|
|
Forgot to run Make Format on recent spelling changes
|
|
Use 'and' instead of ampersand in descriptions and comments.
Differential Revision: https://developer.blender.org/D9797
Reviewed by Aaron Carlisle
|
|
This was escaping the '[' character, which isn't needed for quoted text.
|
|
Duplicate logic for this exists in BLI_str_quoted_substrN,
which doesn't properly support escaping.
|
|
|
|
|