IDProperties can be embedded into one-another with no theoritical depth
limit, however the code currently uses recursive patterns to process
them, which means beyond a certain depth it will run out of stack memory
and crash.
While we cannot really prevent creating such insanely high data depth,
this commit adds several safe-guards (readfile, writefile, foreach_id,
and freeing processes), skipping further processing beyond a certain
recursion depth (currently set at 1024, which should be both well
within safety margins of any modern OS, and more than enough for any
practical use-case).
Issue initially reported by Ray Molenkemp (@lazydodo), thanks.
This commit also contains a small refactor for the IDProperty freeing
code (and IDP array resize internal logic), essentially removing public
API to free IDProperties' content - all of its usages was immediately
after calling MEM_delete on the same root properties, so can as well
call directly IDP_FreeProperty.
Finally, it fixes a potential bug related to arrays of groups freeing,
where the 'do_id_user' option was not properly propagated through the
array resize logic. Probably not an issue in practice though (not sure
if arrays of groups are used anywhere currently?).
Pull Request: https://projects.blender.org/blender/blender/pulls/160274
Signed-off-by: Vansh <gaurvansh133@gmail.com>
Fix a few small grammar, punctuation, and wording issues in the Python API docs.
Touches:
* `doc/python_api/rst/info_overview.rst`
* `doc/python_api/rst/info_quickstart.rst`
* `doc/python_api/rst/info_best_practice.rst`
Docs only, no functional changes.
Co-authored-by: Aaron Carlisle <blendify@noreply.localhost>
Pull Request: https://projects.blender.org/blender/blender/pulls/158437
Create submenus for common template types in the text editor as the menu
was getting too long.
Common categories such as Gizmo, UI & Operators are now in their own
directories, displayed as submenus.
Menu.menu_path now supports expanding sub-menus recursively.
Ref !154643
Examples were supported with/without number suffix,
this caused problems using mypy for type checking because it attempted
to resolve imports such as `mathutils` to the example file.
Having only some examples numbered already complicated documentation
for conventions with examples - simplify extraction and number all.
Add a contribution guide for Blender's Python API documentation,
similar to the User Manual contribution guide.
Some parts of this process weren't so clear,
especially the example auto-discovery.
Cover:
- Setting up the build environment.
- Modifying API documentation.
- Adding example code snippets.
- File naming conventions and auto-discovery.
- Best practices and style guidelines.
PR !151750
Co-authored-by: Campbell Barton <campbell@blender.org>
Add a new section to the `Context` page that includes an explanation
on how to invoke "on demand" logging for context member access.
Design task: #144746
Logging added in: !144810
Ref !146862
Fix several documentation related typos.
Found via `codespell -S "*.desktop,*.diff,./intern,./extern,./locale,./AUTHORS,./source/blender/blenlib/tests/BLI_string_utf8_test.cc,./doc/license/bf-members.txt" -L accessort,abd,aci,alo,ans,ba,bording,childrens,clen,constructin,datas,dependees,domin,eary,ege,eiter,elemt,eles,endianess,enew,espace,finded,fiter,fpt,groupd,hist,implementating,indext,ine,infront,inout,inouts,inpt,ist,lene,listenter,lod,maks,masia,mata,mis,mke,nam,nd,ned,opose,ot,outlow,parm,parms,passt,pinter,pixelx,poin,pres,ptd,re-usable,re-use,re-used,re-uses,re-using,ridiculus,schem,soler,strack,suh,te,tesselate,tham,ue,vai,varius,wew`
Pull Request: https://projects.blender.org/blender/blender/pulls/145824
Methods for `bpy_struct` such as `get()` & `items()` noted that only
some types support custom-properties.
Since these docs were written many more types support custom properties.
Replace the inline list with a link to a generated list since there are
now too many to include inline.
Resolves#141450.
e.g. stands for "exempli gratia" in Latin which means "for example".
The best way to make sure it makes sense when writing is to just expand
it to "for example". In these cases where the text was "for e.g.", that
leaves us with "for for example" which makes no sense. This commit fixes
all 110 cases, mostly just just replacing the words with "for example",
but also restructuring the text a bit more in a few cases, mostly by
moving "e.g." to the beginning of a list in parentheses.
Pull Request: https://projects.blender.org/blender/blender/pulls/139596
Update the Python API documentation about crashes with multi-threaded
code.
- Move the "threading gotcha" into a file of its own. That way it's
immediately clear from looking at the Gotcha table of contents that
threading is not supported.
- Simplify the example code, so that it doesn't access `bpy`.
Apparently the problem is much wider than just multi-threaded access
to `bpy`, and involves _all_ Python threads, regardless of what they
do / access.
- Add some more explanation and move some text from the bottom to the
top, so that the first-read part (when reading top to bottom) has
most of the information.
Pull Request: https://projects.blender.org/blender/blender/pulls/139279
`super()` is using the MRO to find the first `__init__()` function, if the blender-defined type is not the first inherited type, it may never be called that way.
See #133183
While in theory it would be good to have calls to super classes'
`__del__()` destructors in subclasses, matching the ones to
`__init__()`, several limitations of current CPython implementation do
not make it a practical requirement.
So remove `__del__` from examples, and add a note summarizing the
current problems with using it (aka `tp_finalize` in C++ code).
Also see !132476 for some discussion about that topic.
According to the Python API release notes, this is required now along
with super().__init__() which was already done.
Also fixes mistake in example in API docs.
Pull Request: https://projects.blender.org/blender/blender/pulls/132476
Essentially, any operator modifying Blender data should enable this
`UNDO` option, else bad things (corruption, crashes...) are likely to
happen.
* Added a new Operator example to explain this topic.
* Updated some existing Operator examples that were not correct anymore.
* Added a new small section in the gotchas page linking to it.
* Added also short reminder about this in the `UNDO` 'tooltip'
description itself.
Related to #77557.
This PR:
* Splits the `Gotchas` page into several sub-sections. This was getting too big and hard to navigate.
* Adds some information regarding Python instances life-time of objects wrapping Blender internal data.
* Adds some information about usage of constructors and destructors for sub-classes of Blender-defined types.
Pull Request: https://projects.blender.org/blender/blender/pulls/129814
Exceptions:
* Links to personal wiki pages
* Pages that are not in the new developer docs yet (like Human Interface Guidelines)
* tools\check_wiki\check_wiki_file_structure.py needs a refactor
This commit implements described in the #104573.
The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).
This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.
This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale
This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.
Running `make update` will initialize the local checkout to the changed
repository configuration.
Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).
Pull Request #104755