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
2022-09-25Cleanup: use 'u' prefixed integer types for brevity & cast styleCampbell Barton
To use function style cast '(unsigned char)x' can't be replaced by 'unsigned char(x)'.
2022-09-25Cleanup: remove redundant double parenthesisCampbell Barton
2022-09-16Cleanup: spelling in commentsCampbell Barton
2022-09-07Cleanup: remove unused Main argument to RNA_path functionsCampbell Barton
Note that lib_override functions have kept the unused argument, but this may be removed too. It impacts many lib_override functions so this can be handled separately.
2022-08-23Merge branch 'blender-v3.3-release'Richard Antalik
2022-08-23Fix T100286: Crash accessing freed depsgraph object instancesCampbell Barton
Invalidate depsgraph.object_instances when freed, this resolves a crash when accessing the object instances after iteration has finished. Unlike most other collections, object_instances is only valid while the iterator is in-memory. The Python/RNA API needs to inline int/string collection lookups so the Python instance can be created before the iterator ends. Reviewed By: mont29, sergey Ref D15755
2022-08-09Cleanup: use own username in code-comment tagsCampbell Barton
2022-08-04Cleanup: Move RNA path functions into own C++ fileJulian Eisel
NOTE: This is committed to the 3.3 branch as part of D15606, which we decided should go to this release still (by Bastien, Dalai and me). That is because these are important usability fixes/improvements to have for the LTS release. Adds `rna_path.cc` and `RNA_path.h`. `rna_access.c` is a quite big file, which makes it rather hard and inconvenient to navigate. RNA path functions form a nicely coherent unit that can stand well on it's own, so it makes sense to split them off to mitigate the problem. Moreover, I was looking into refactoring the quite convoluted/overloaded `rna_path_parse()`, and found that some C++ features may help greatly with that. So having that code compile in C++ would be helpful to attempt that. Differential Revision: https://developer.blender.org/D15540 Reviewed by: Brecht Van Lommel, Campbell Barton, Bastien Montagne
2022-07-29Cleanup: Move RNA path functions into own C++ fileJulian Eisel
Adds `rna_path.cc` and `RNA_path.h`. `rna_access.c` is a quite big file, which makes it rather hard and inconvenient to navigate. RNA path functions form a nicely coherent unit that can stand well on it's own, so it makes sense to split them off to mitigate the problem. Moreover, I was looking into refactoring the quite convoluted/overloaded `rna_path_parse()`, and found that some C++ features may help greatly with that. So having that code compile in C++ would be helpful to attempt that. Differential Revision: https://developer.blender.org/D15540 Reviewed by: Brecht Van Lommel, Campbell Barton, Bastien Montagne
2022-07-07Fix T99256: Regression: Meta balls segfaulting copy-to-selected.Bastien Montagne
Revealed by rB43167a2c251b, but actuall issue is the `rna_MetaBall_update_data` function expecting a never-NULL `scene` pointer, which is not guaranteed. This lead to refactoring the duo `rna_MetaBall_update_data`/`BKE_mball_properties_copy`, since it was doing a very sub-optimal O(n^2) process, new code is O(2n) now (n being the number of Objects). Not sure why the objects were processed through the existing bases of the existing scene in the first place, this could miss a lot of affected objects (e.g. in case said objects are in an excluded collection, etc.). Also noticed that both old and new implementation can fail to fully propagate changes to all affected meta-balls in some specific corner cases, added a comment about it in the code. Reviewed By: sergey Maniphest Tasks: T99256 Differential Revision: https://developer.blender.org/D15338
2022-06-23Fix T97691: undefined behavior sanitizer warning for alignment in RNA functionsBrecht Van Lommel
Thanks Loren Osborn for investigating this and proposing solutions. Ref D14798
2022-06-17Cleanup: remove redundant string formattingCampbell Barton
2022-06-10RNA path: add util to find the char in an RNA path where the array indexing ↵Bastien Montagne
starts. Usefull to easily trim away the 'aray index' part of an RNA path, e.g. when searching for an FCurve (which never contains that index part in its RNA path).
2022-05-30Cleanup/simplify BKE_fcurve_find_by_rna_context_ui code.Bastien Montagne
From reading the code it looks like at some point the code was expecting the `tptr` PointerRNA to change during the loop? But currently it did not make any sense to have this complex looping and multi-checking of RNA path and animdata, since the RNA pointer (and therefore its `owner_id`) is never modified... NOTE: there could be much more cleanup done in that area, goal of this commit is mainly to simplify the logic by removing all the (seamingly) dead code. Differential Revision: https://developer.blender.org/D15026
2022-05-26UI support for showing candidates for string propertiesCampbell Barton
Currently strings are used for cases where a list of identifiers would be useful to show. Add support for string properties to reference a callback to populate candidates to show when editing a string. The user isn't prevented from typing in text not found in this list, it's just useful as a reference. Support for expanding the following strings has been added: - Operator, menu & panel identifiers in the keymap editor. - WM operators that reference data-paths expand using the Python-consoles auto-complete functionality. - Names of keying sets for insert/delete keyframe operators. Details: - `bpy.props.StringProperty` takes an option `search` callback. - A new string callback has been added, set via `RNA_def_property_string_search_func` or `RNA_def_property_string_search_func_runtime`. - Addresses usability issue highlighted by T89560, where setting keying set identifiers as strings isn't practical. - Showing additional right-aligned text in the search results is supported but disabled by default as the text is too cramped in most string search popups where the feature would make sense. It could be enabled as part of other layout tweaks. Reviewed By: brecht Ref D14986
2022-05-25Cleanup: Further tweaks to RNA path API const'ness of PointerRNA parameter.Bastien Montagne
`RNA_path_struct_property_py` cannot get const `ptr` parameter for now (usage of `RNA_struct_find_property`). Also make `RNA_path_resolve_` functions take a const PointerRNA parameter.
2022-05-25Cleanup: Add more const'ness to RNA API.Bastien Montagne
This commit makes PointerRNA passed to RNA path API const. Main change was in the `path` callback for RNA structs, and indirectly the `getlength` callback of properties.
2022-05-17Cleanup: Use `switch` and `BLI_assert_unreachable()` more.Bastien Montagne
Replace some `if/else if` chains by proper `switch` statement. Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-16Fix T96503: Assert using PropertyGroup and PointerProperty prop in Panel.Bastien Montagne
Wrong assert introduced in {rBad63d2f60e24}, added comment in code explaining why NULL RNA pointer is a valid value to be skipped here.
2022-04-28Cleanup: Make RNA function comment more readableJulian Eisel
This complex comment was hard to parse visually. There was some odd line breaking going on, and together with no indentation for the continued lines, it was just a blob of text with no visual structure. You wouldn't see easily where the description of an argument started or ended.
2022-03-29LibOverride: Add initial System Override flag.Bastien Montagne
This merely adds the flag, exposes it in RMA, and uses it in some of the most common 'is editable' checks (RNA, `BASE_EDITABLE` macro...). Next step: do_version and defining systemoverrides at creation. Ref: {T95707}.
2022-03-29Fix T63795: Display custom properties with brackets in infoYuki Hashimoto
When custom properties are changed, they are displayed with brackets in info. Ref D14380
2022-03-15Cleanup: Remove confusing double negation in RNA helper functionJulian Eisel
Much more readable that way.
2022-03-14RNA: Generate property declerations header, solving msg-bus C++ incompatibilityJulian Eisel
Lets `makesrna` generate a `RNA_prototypes.h` header with declarations for all RNA properties. This can be included in regular source files when needing to reference RNA properties statically. This solves an issue on MSVC with adding such declarations in functions, like we used to do. See 800fc1736748. Removes any such declarations and the related FIXME comments. Reviewed By: campbellbarton, LazyDodo, brecht Differential Revision: https://developer.blender.org/D13837
2022-03-08Cleanup: spelling in comments, use C++ comments for disabled codeCampbell Barton
2022-02-23Cleanup: Remove repeated word in commentsCampbell Barton
2022-02-22Cleanup: Deduplicate logic in `RNA_property_editable` & co.Bastien Montagne
Fairly straight-forward, now all the logic for all those 'is editable' complex checks is gathered into a single util function.
2022-02-22Fix (unreported) `RNA_property_editable_index`.Bastien Montagne
NOTE: This function is currently unused. However, it does use a callback defined by a few RNA properties through `RNA_def_property_editable_array_func`, so don't think it should be removed without further thinking. This function had two main issues: * It was doing bitwise AND on potentially three sources of property flag, when actually used `RNA_property_editable` just use one source ever. * It was completely ignoring liboverride cases. TODO: Deduplicate code between `RNA_property_editable`, `RNA_property_editable_info` and `RNA_property_editable_index`.
2022-02-22Cleanup: Make `RNA_property_editable` logic clearer.Bastien Montagne
Split code in smaller bits with early returns, instead of a giant single set of checks. No behavioral change expected here.
2022-02-15RNA: add RNA_collection_is_empty & RNA_property_collection_is_emptyCampbell Barton
Some collections needed to be iterated over to count their length. Provide a function to check if the collection is empty to avoid this.
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-01-24Cleanup: Grammar: its self vs. itselfHans Goudey
2021-12-13Fix T93704: StructRNA.path_resolve fails silently with missing keysCampbell Barton
Resolving the path to a missing pose-bone (for example), was not raising an error as it should have. Regression introduced in f9ccd26b037d43f2490d1f0263e45e775d30473d, which didn't update collection lookup logic to fail in the case the key of a collection wasn't found.
2021-12-08Cleanup: move public doc-strings into headers for 'makesrna'Campbell Barton
Ref T92709
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.