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-11-08Merge branch 'blender-v3.4-release'Sergey Sharybin
2022-11-08Fix deprecation warnings about printf() on macOSSergey Sharybin
The new Xcode 14.1 brings the new Apple Clang compiler which considers sprintf unsafe and geenrates deprecation warnings suggesting to sue snprintf instead. This only happens for C++ code by default, and C code can still use sprintf without any warning. This changes does the following: - Whenever is trivial replace sprintf() with BLI_snprintf. - For all other cases use the newly introduced BLI_sprintf which is a wrapper around sprintf() but without warning. There is a discouragement note in the BLI_sprintf comment to suggest use of BLI_snprintf when the size is known. Differential Revision: https://developer.blender.org/D16410
2022-11-08PyAPI: add invalid objects check for RNA struct keys()/values()/items()Campbell Barton
2022-11-08Merge branch 'blender-v3.4-release'Campbell Barton
2022-11-08Fix invalid function signatures for PySequenceMethods callbacksCampbell Barton
Function casts hid casting between potentially incompatible type signatures (using int instead of Py_ssize_t). As it happens this seems not to have caused any bugs on supported platforms so this change is mainly for correctness and to avoid problems in the future.
2022-11-08Cleanup: correct type of RNA struct methodsCampbell Barton
Some BPy_StructRNA methods used BPy_PropertyRNA in their function signatures, while this didn't case any bugs, it could lead to issues in the future.
2022-11-08Cleanup: PyMethodDef formattingCampbell Barton
Missed these changes in [0]. Also replace designated initializers in some C code, as it's not used often and would need to be removed when converting to C++. [0] e555ede626dade2c9b6449ec7dcdda22b2585fd4
2022-11-07Cleanup: unify struct declaration style for Python types, update namesCampbell Barton
Use struct identifiers in comments before the value. This has some advantages: - The struct identifiers didn't mix well with other code-comments, where other comments were wrapped onto the next line. - Minor changes could re-align all other comments in the struct. - PyVarObject_HEAD_INIT & tp_name are no longer placed on the same line. Remove overly verbose comments copied from PyTypeObject (Python v2.x), these aren't especially helpful and get outdated. Also corrected some outdated names: - PyTypeObject.tp_print -> tp_vectorcall_offset - PyTypeObject.tp_reserved -> tp_as_async
2022-11-01Cleanup: spelling in commentsCampbell Barton
2022-10-07Cleanup: redundant parenthesisCampbell Barton
2022-09-28Fix GC tracking error for instances of mathutils typesCampbell Barton
Mathutils types were always GC tracked even when it wasn't intended. Not having to track objects speeds up Python execution. In an isolated benchmark created to stress test the GC creating 4-million vectors (re-assigning them 100 times), this gives an overall ~2.5x speedup, see: P3221. Details: Since [0] (which added support for sub-classed mathutils types) tp_alloc was called which defaults to PyType_GenericAlloc which always GC tracked the resulting object when Py_TPFLAGS_HAVE_GC was set. Avoid using PyType_GenericAlloc unless the type is sub-classed, in that case the object is un-tracked. Add asserts that the tracked state is as expected before tracking & un-tracking, to ensure changes to object creation don't cause objects to be tracked unintentionally. Also assign the PyTypeObject.tp_is_gc callback so types optionally GC track objects only do so when an object is referenced. [0]: fbd936494495d0de54eef24a97957e000306785f
2022-09-26Cleanup: remove redundant parenthesisCampbell Barton
2022-09-19Cleanup: spellingCampbell Barton
2022-09-16Cleanup: spelling in commentsCampbell Barton
2022-09-08Cleanup: correct PyModuleDef.m_slots referenceCampbell Barton
Changed in Python 3.5, match Python's internal name.
2022-08-24Merge branch 'blender-v3.3-release'Campbell Barton
2022-08-24Fix error from 21ea4995585931ad54f51c1878c06c526c3355a5Campbell Barton
Was not using the absolute index for comparison, breaking the id_management test.
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-05-13Cleanup: spelling in comments, capitalize tagsCampbell Barton
Also add missing task-ID reference & remove colon after \note as it doesn't render properly in doxygen.
2022-05-03Fix T97731: Python traceback no longer includes line-numbersCampbell Barton
Regression caused by [0] that caused the error message to be created based on a normalized exception (which hid line numbers). PyC_ExceptionBuffer{_Simple} & BPy_errors_to_report no longer clears the exception. This could have been resolved by changing python_script_error_jump however that would involve changes to reference counting that are more risky (noted in code-comment). [0]: 2d2baeaf04d481f284bc2f098fb6d7ee9268151f
2022-05-03Cleanup: remove redundant PyErr_Clear calls after PyErr_FetchCampbell Barton
2022-04-22Cleanup: spelling in commentsCampbell Barton
2022-04-20PyAPI: utility functions for parsing typed RNA argumentsCampbell Barton
These functions can be used with PyArg_ParseTupleAndKeywords (and related functions) to take typed RNA arguments without having to extract and type-check them separately. No functional changes, extracted from D13126.
2022-04-08Cleanup: separate format-units for Python argument parsingCampbell Barton
With the increased use of multi-character format units and keyword-only arguments these are increasingly difficult to make sense of. Split the string onto multiple lines, one per argument. While verbose it's easier to understand and add new arguments.
2022-04-06Fix accessing an empty context succeeding when it shouldn'tCampbell Barton
Internally an empty string is used to access context member `__dir__`, which caused `getattr(context, "")` to succeed returning None.
2022-03-14Auto-generate RNA-structs declarations in `RNA_prototypes.h`Julian Eisel
So far it was needed to declare a new RNA struct to `RNA_access.h` manually. Since 9b298cf3dbec we generate a `RNA_prototypes.h` for RNA property declarations. Now this also includes the RNA struct declarations, so they don't have to be added manually anymore. Differential Revision: https://developer.blender.org/D13862 Reviewed by: brecht, campbellbarton
2022-03-11Correct error in 1032f111d087e7ba77c16a4af78704019714bd6aCampbell Barton
Thanks to Jacques Lucke for spotting.
2022-03-11RNA: support functions returning allocated stringsCampbell Barton
Now it's possible for a C/RNA function to return a dynamic string, The PROP_NEVER_NULL flag is also supported so a NULL string returns None in Python.
2022-03-11Cleanup: remove unused variableCampbell Barton
2022-03-10Cleanup: spelling in comments & some minor clarificationsCampbell Barton
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-15Cleanup: minor changes to Python argument parsing loopCampbell Barton
- Increment the argument index at the end of the loop. Otherwise using the index after incrementing required subtracting 1. - Move error prefix creation into a function: `pyrna_func_error_prefix` so it's possible to create an error prefix without duplicate code. This simplifies further changes for argument parsing from D14047.
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
2021-12-02Cleanup: move public doc-strings into headers for 'python'Campbell Barton
2021-11-08Cleanup: Grammar in commentsHans Goudey
2021-10-23Docs: Fixes and improvements in API documentationXavier Cho
Fixes several notable mistakes and missing information regarding the API documentation (*.rst). This will allow API stub generators like bpystubgen or fake-bpy-module to produce more accurate result. Differential Revision: https://developer.blender.org/D12639
2021-10-20Cleanup: use elem macrosCampbell Barton
2021-10-12Fix leak on exit when WITH_PYTHON_SAFETY is enabledCampbell Barton
The lead only occurred when Python references were leaking as well.
2021-10-06Cleanup: spelling in commentsCampbell 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-01Cleanup: use "pyrna_enum_*" prefix for RNA utility functionsCampbell Barton
2021-09-01Cleanup: move RNA utility functions into a generic moduleCampbell Barton
Avoid having to include bpy_rna.h for enum utility functions, recently added to idprop_py_ui_api.c.
2021-08-31Cleanup: Reduce variable scopeHans Goudey
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-24Fix reporting Python reference leaks with WITH_PYTHON_SAFETYCampbell Barton
Error in f3e26c847b6ba0924cfd02641345164c54234425
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.