Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-10-16Revert "Fix T62325, T91990: changing Cycles presets does not update the ↵Brecht Van Lommel
Blender UI" This reverts commit 1b6752e599b5ed70823d09f90c418e448516d4b4. It is causing constant redraws due to some ID properties seemingly being edited on every redraw.
2021-10-15Fix T62325, T91990: changing Cycles presets does not update the Blender UIBrecht Van Lommel
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.
2021-10-12Cleanup: Fix comment formatting and grammarHans Goudey
2021-09-27RNA: Make is clear that `Scene` parameter of `update` callback may be NULL.Bastien Montagne
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.
2021-09-06BLI_utildefines: add UNUSED_FUNCTION_WITH_RETURN_TYPECampbell Barton
Unfortunately the UNUSED_FUNCTION macro doesn't work for pointer types. Add UNUSED_FUNCTION_WITH_RETURN_TYPE to workaround this limitation.
2021-09-06Cleanup: comment unused functionsCampbell Barton
2021-09-03Fix T87768: `.path_resolve` fails when requested property is None.Campbell Barton
Add a version of RNA_path_resolve_full that returns true when the path resolves to a NULL RNA pointer.
2021-09-03RNA: minor optimize for token extraction of RNA pathsCampbell Barton
- 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.
2021-09-03Cleanup: use bool for RNA path token extractionCampbell Barton
2021-08-31Fix logical error resolving RNA pathsCampbell Barton
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.
2021-08-27Fix failing alembic test after IDProperty UI data refactorHans Goudey
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.
2021-08-27Refactor IDProperty UI data storageHans Goudey
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
2021-08-26Cleanup: Use `ID_IS_LINKED` instead of direct `id.lib` pointer check.Bastien Montagne
2021-08-23RNA: add length augmented to RNA_string_get_allocCampbell Barton
This was noted as a TODO as it wraps RNA_property_string_get_alloc which takes a length return argument.
2021-08-12Cleanup: remove redundant variableCampbell Barton
2021-08-12RNA: include base types in RNA_struct_type_find_property searchCampbell Barton
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-12Cleanup: comments/disabled codeCampbell Barton
- 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-12Cleanup: use C++ style comments for disabled codeCampbell Barton
2021-08-06Cleanup: use MEM_SAFE_FREE macroCampbell Barton
2021-08-05Fix T90170: `RNA_property_pointer_get` creating data in non-thread-safe way.Bastien Montagne
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
2021-08-03Cleanup: use C++ comments or 'if 0' for commented codeCampbell Barton
2021-07-23Cleanup: code comments punctuation / spacingCampbell Barton
2021-07-20Cleanup: use single back-tick quoting in commentsCampbell Barton
While doxygen supports both, conform to our style guide. Note that single back-tick's are already used in a majority of comments.
2021-07-15Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text")Campbell Barton
This shows the text as part of the assertion message.
2021-07-14Python API: Add functions to ensure and clear IDPropertiesHans Goudey
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
2021-07-14Fix crash displaying invalid enum value with translations enabledBrecht Van Lommel
Found loading a cycles-x .blend file saved with different integer values for enum items.
2021-07-03Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXXCampbell Barton
Also use doxy style function reference `#` prefix chars when referencing identifiers.
2021-06-30Cleanup: use const arguments for accessor functionsCampbell Barton
2021-06-26Cleanup: full sentences in comments, improve comment formattingCampbell Barton
2021-06-24Cleanup: comment blocks, trailing space in commentsCampbell Barton
2021-06-22Cleanup: Spelling MistakesLeon Zandman
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
2021-05-28Fix T88499: Copy data path operator does not consider library affiliationPhilipp Oeser
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
2021-05-17UI: add non-linear slider supportHenrik Dick
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
2021-04-16RNA: add STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID flagCampbell Barton
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.
2021-03-16Fix T86332: Error using lambda in annotations in Python 3.10Campbell Barton
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.
2021-03-05Cleanup: Rename func occurences to _fnSebastián Barschkis
Use _fn as a suffix for callbacks.
2021-02-25Refactor: IDTypeInfo: Add `owner_get` to get owner of embedded IDs.Bastien Montagne
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.
2021-02-05Cleanup: correct spelling in commentsCampbell Barton
2021-01-13RNA: allow editing pointer IDProperty values from the UI.Alexander Gavrilov
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
2021-01-13RNA: fix a crash when setting bare IDProperty pointers.Alexander Gavrilov
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
2020-12-29Cleanup: Use proper `RNA_pointer_is_null` helper.Bastien Montagne
Followup to rB7f3601e70dd and rBad63d2f60e2.
2020-12-28Cleanup/refactor `rna_idp_path` code.Bastien Montagne
Factorize common processes and checks, early `continue` in invalid cases, etc.
2020-12-28Fix T84091: IDProperties/RNA: Crash due to colliding name between custom ↵Bastien Montagne
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...
2020-12-15Cleanup: reduce indirect DNA header inclusionCampbell Barton
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.
2020-12-11Cleanup: clang-formatHarley Acheson
Forgot to run Make Format on recent spelling changes
2020-12-11UI: Use 'and' Instead of '&' in DescriptionsYevgeny Makarov
Use 'and' instead of ampersand in descriptions and comments. Differential Revision: https://developer.blender.org/D9797 Reviewed by Aaron Carlisle
2020-12-10Fix missing string escaping in RNA_path_appendCampbell Barton
This was escaping the '[' character, which isn't needed for quoted text.
2020-12-10BLI_string: extract quote utility into BLI_str_escape_find_quoteCampbell Barton
Duplicate logic for this exists in BLI_str_quoted_substrN, which doesn't properly support escaping.
2020-12-10Cleanup: remove unnecessary vars in RNA token readingCampbell Barton
2020-12-10Cleanup: declare variables when used (RNA)Campbell Barton