diff --git a/doc/blender_file_format/BlendFileDnaExporter_25.py b/doc/blender_file_format/BlendFileDnaExporter_25.py index b8b8d0918ed..207dac24b4b 100755 --- a/doc/blender_file_format/BlendFileDnaExporter_25.py +++ b/doc/blender_file_format/BlendFileDnaExporter_25.py @@ -15,7 +15,7 @@ # Jeroen Bakker # # Version: -# v0.1 (12-05-2009) - migration of original source code to python. +# v0.1 (12-05-2009) - migration of original source code to Python. # Added code to support blender 2.5 branch # v0.2 (25-05-2009) - integrated with BlendFileReader.py # diff --git a/doc/manpage/blender.1.py b/doc/manpage/blender.1.py index cf3879efdf4..3ae5b8786e9 100755 --- a/doc/manpage/blender.1.py +++ b/doc/manpage/blender.1.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later """ -This script generates the blender.1 man page, embedding the help text +This script generates the ``blender.1`` man page, embedding the help text from the Blender executable itself. Invoke it as follows: blender.1.py --blender --output @@ -199,7 +199,7 @@ def create_argparse() -> argparse.ArgumentParser: parser.add_argument( "--blender", required=True, - help="Path to the blender binary." + help="Path to the Blender binary." ) parser.add_argument( "--verbose", diff --git a/doc/python_api/examples/bpy.app.translations.py b/doc/python_api/examples/bpy.app.translations.py index b8d94f41528..62b4217e1ba 100644 --- a/doc/python_api/examples/bpy.app.translations.py +++ b/doc/python_api/examples/bpy.app.translations.py @@ -9,7 +9,7 @@ Introduction and the :func:`register`/:func:`unregister` functions! The :func:`pgettext` family of functions should only be used in rare, specific cases (like e.g. complex "composited" UI strings...). -To add translations to your python script, you must define a dictionary formatted like that: +To add translations to your Python script, you must define a dictionary formatted like that: ``{locale: {msg_key: msg_translation, ...}, ...}`` where: - locale is either a lang iso code (e.g. ``fr``), a lang+country code (e.g. ``pt_BR``), @@ -21,7 +21,7 @@ Then, call ``bpy.app.translations.register(__name__, your_dict)`` in your ``regi ``bpy.app.translations.unregister(__name__)`` in your ``unregister()`` one. The ``Manage UI translations`` add-on has several functions to help you collect strings to translate, and -generate the needed python code (the translation dictionary), as well as optional intermediary po files +generate the needed Python code (the translation dictionary), as well as optional intermediary po files if you want some... See `How to Translate Blender `_ and `Using i18n in Blender Code `_ diff --git a/doc/python_api/examples/bpy.ops.py b/doc/python_api/examples/bpy.ops.py index 77fac36aa0c..563bcbc0312 100644 --- a/doc/python_api/examples/bpy.ops.py +++ b/doc/python_api/examples/bpy.ops.py @@ -2,8 +2,8 @@ Calling Operators ----------------- -Provides python access to calling operators, this includes operators written in -C, Python or macros. +Provides Python access to calling operators, this includes operators written in +C++, Python or macros. Only keyword arguments can be used to pass operator properties. @@ -22,7 +22,7 @@ Calling an operator in the wrong context will raise a ``RuntimeError``, there is a poll() method to avoid this problem. Note that the operator ID (bl_idname) in this example is ``mesh.subdivide``, -``bpy.ops`` is just the access path for python. +``bpy.ops`` is just the access path for Python. Keywords and Positional Arguments diff --git a/doc/python_api/examples/bpy.props.1.py b/doc/python_api/examples/bpy.props.1.py index a8e0c9365c3..d774fdb8507 100644 --- a/doc/python_api/examples/bpy.props.1.py +++ b/doc/python_api/examples/bpy.props.1.py @@ -2,7 +2,7 @@ Operator Example ++++++++++++++++ -A common use of custom properties is for python based :class:`Operator` +A common use of custom properties is for Python based :class:`Operator` classes. Test this code by running it in the text editor, or by clicking the button in the 3D View-port's Tools panel. The latter will show the properties in the Redo panel and allow you to change them. diff --git a/doc/python_api/examples/bpy.props.py b/doc/python_api/examples/bpy.props.py index a2a51addc65..f70eb6f1713 100644 --- a/doc/python_api/examples/bpy.props.py +++ b/doc/python_api/examples/bpy.props.py @@ -5,7 +5,7 @@ Assigning to Existing Classes Custom properties can be added to any subclass of an :class:`ID`, :class:`Bone` and :class:`PoseBone`. -These properties can be animated, accessed by the user interface and python +These properties can be animated, accessed by the user interface and Python like Blender's existing properties. .. warning:: diff --git a/doc/python_api/examples/bpy.types.AddonPreferences.1.py b/doc/python_api/examples/bpy.types.AddonPreferences.1.py index faac07bea4b..3760a904c63 100644 --- a/doc/python_api/examples/bpy.types.AddonPreferences.1.py +++ b/doc/python_api/examples/bpy.types.AddonPreferences.1.py @@ -19,7 +19,7 @@ from bpy.props import StringProperty, IntProperty, BoolProperty class ExampleAddonPreferences(AddonPreferences): # This must match the add-on name, use `__package__` - # when defining this for add-on extensions or a sub-module of a python package. + # when defining this for add-on extensions or a sub-module of a Python package. bl_idname = __name__ filepath: StringProperty( diff --git a/doc/python_api/examples/bpy.types.ID.user_clear.1.py b/doc/python_api/examples/bpy.types.ID.user_clear.1.py index 239ed41c66c..6c24b5c6a60 100644 --- a/doc/python_api/examples/bpy.types.ID.user_clear.1.py +++ b/doc/python_api/examples/bpy.types.ID.user_clear.1.py @@ -1,9 +1,9 @@ """ -This function is for advanced use only, misuse can crash blender since the user +This function is for advanced use only, misuse can crash Blender since the user count is used to prevent data being removed when it is used. """ -# This example shows what _not_ to do, and will crash blender. +# This example shows what _not_ to do, and will crash Blender. import bpy # object which is in the scene. diff --git a/doc/python_api/examples/bpy.types.Menu.py b/doc/python_api/examples/bpy.types.Menu.py index c1a5b3581e4..f4a5cc18c2f 100644 --- a/doc/python_api/examples/bpy.types.Menu.py +++ b/doc/python_api/examples/bpy.types.Menu.py @@ -10,7 +10,7 @@ convention for menus. .. note:: - Menu subclasses must be registered before referencing them from blender. + Menu subclasses must be registered before referencing them from Blender. .. note:: diff --git a/doc/python_api/examples/bpy.types.Mesh.py b/doc/python_api/examples/bpy.types.Mesh.py index b86a85a6a6a..e40e864789b 100644 --- a/doc/python_api/examples/bpy.types.Mesh.py +++ b/doc/python_api/examples/bpy.types.Mesh.py @@ -3,7 +3,7 @@ Mesh Data +++++++++ The mesh data is accessed in object mode and intended for compact storage, -for more flexible mesh editing from python see :mod:`bmesh`. +for more flexible mesh editing from Python see :mod:`bmesh`. Blender stores 4 main arrays to define mesh geometry. @@ -13,7 +13,8 @@ Blender stores 4 main arrays to define mesh geometry. - :class:`Mesh.polygons`: (reference a range of loops) -Each polygon references a slice in the loop array, this way, polygons do not store vertices or corner data such as UVs directly, +Each polygon references a slice in the loop array, this way, +polygons do not store vertices or corner data such as UVs directly, only a reference to loops that the polygon uses. :class:`Mesh.loops`, :class:`Mesh.uv_layers` :class:`Mesh.vertex_colors` are all aligned so the same polygon loop diff --git a/doc/python_api/examples/bpy.types.Operator.2.py b/doc/python_api/examples/bpy.types.Operator.2.py index f1a5fe27777..dbeab86baa4 100644 --- a/doc/python_api/examples/bpy.types.Operator.2.py +++ b/doc/python_api/examples/bpy.types.Operator.2.py @@ -18,10 +18,10 @@ and this behavior cannot be changed. This example shows how to define an operator which gets mouse input to execute a function and that this operator can be invoked or executed from -the python api. +the Python API. Also notice this operator defines its own properties, these are different -to typical class properties because blender registers them with the +to typical class properties because Blender registers them with the operator, to use as arguments when called, saved for operator undo/redo and automatically added into the user interface. """ diff --git a/doc/python_api/examples/bpy.types.Operator.6.py b/doc/python_api/examples/bpy.types.Operator.6.py index 40a40a19516..0de2ab9c879 100644 --- a/doc/python_api/examples/bpy.types.Operator.6.py +++ b/doc/python_api/examples/bpy.types.Operator.6.py @@ -20,7 +20,7 @@ Notice ``__init__()`` and ``__del__()`` are declared. For other operator types they are not useful but for modal operators they will be called before the :class:`Operator.invoke` and after the operator finishes. Also see the -:ref:`class construction and destruction section ` +:ref:`class construction and destruction section `. """ import bpy diff --git a/doc/python_api/examples/bpy.types.Operator.py b/doc/python_api/examples/bpy.types.Operator.py index a0dd149dcb3..f7124c0f125 100644 --- a/doc/python_api/examples/bpy.types.Operator.py +++ b/doc/python_api/examples/bpy.types.Operator.py @@ -13,7 +13,7 @@ that no undo step will created (see next example for more info about undo). .. note:: - Operator subclasses must be registered before accessing them from blender. + Operator subclasses must be registered before accessing them from Blender. """ import bpy diff --git a/doc/python_api/examples/bpy.types.Panel.py b/doc/python_api/examples/bpy.types.Panel.py index 98187832b56..879d47ee5aa 100644 --- a/doc/python_api/examples/bpy.types.Panel.py +++ b/doc/python_api/examples/bpy.types.Panel.py @@ -10,7 +10,7 @@ convention for panels. .. note:: - Panel subclasses must be registered for blender to use them. + Panel subclasses must be registered for Blender to use them. """ import bpy diff --git a/doc/python_api/examples/bpy.types.PropertyGroup.py b/doc/python_api/examples/bpy.types.PropertyGroup.py index 57cbde2e8d6..3b4740d138e 100644 --- a/doc/python_api/examples/bpy.types.PropertyGroup.py +++ b/doc/python_api/examples/bpy.types.PropertyGroup.py @@ -4,13 +4,13 @@ Custom Properties PropertyGroups are the base class for dynamically defined sets of properties. -They can be used to extend existing blender data with your own types which can -be animated, accessed from the user interface and from python. +They can be used to extend existing Blender data with your own types which can +be animated, accessed from the user interface and from Python. .. note:: - The values assigned to blender data are saved to disk but the class - definitions are not, this means whenever you load blender the class needs + The values assigned to Blender data are saved to disk but the class + definitions are not, this means whenever you load Blender the class needs to be registered too. This is best done by creating an add-on which loads on startup and registers @@ -18,7 +18,7 @@ be animated, accessed from the user interface and from python. .. note:: - PropertyGroups must be registered before assigning them to blender data. + PropertyGroups must be registered before assigning them to Blender data. .. seealso:: diff --git a/doc/python_api/examples/bpy.types.RenderEngine.1.py b/doc/python_api/examples/bpy.types.RenderEngine.1.py index 232d15ea869..83b4522c9bb 100644 --- a/doc/python_api/examples/bpy.types.RenderEngine.1.py +++ b/doc/python_api/examples/bpy.types.RenderEngine.1.py @@ -8,7 +8,7 @@ import array class CustomRenderEngine(bpy.types.RenderEngine): - # These three members are used by blender to set up the + # These three members are used by Blender to set up the # RenderEngine; define its internal name, visible name and capabilities. bl_idname = "CUSTOM" bl_label = "Custom" diff --git a/doc/python_api/examples/bpy.types.UIList.1.py b/doc/python_api/examples/bpy.types.UIList.1.py index 2b2a0d90c3b..7dd6a82dfc9 100644 --- a/doc/python_api/examples/bpy.types.UIList.1.py +++ b/doc/python_api/examples/bpy.types.UIList.1.py @@ -8,7 +8,7 @@ Notice the name of the class, this naming convention is similar as the one for p .. note:: - UIList subclasses must be registered for blender to use them. + UIList subclasses must be registered for Blender to use them. """ import bpy diff --git a/doc/python_api/examples/bpy.types.UIList.2.py b/doc/python_api/examples/bpy.types.UIList.2.py index 5a36036803e..764fdb9ae5a 100644 --- a/doc/python_api/examples/bpy.types.UIList.2.py +++ b/doc/python_api/examples/bpy.types.UIList.2.py @@ -103,7 +103,7 @@ class MESH_UL_vgroups_slow(bpy.types.UIList): def filter_items_empty_vgroups(self, context, vgroups): # This helper function checks vgroups to find out whether they are empty, and what's their average weights. # TODO: This should be RNA helper actually (a vgroup prop like "raw_data: ((vidx, vweight), etc.)"). - # Too slow for python! + # Too slow for Python! obj_data = context.active_object.data ret = {vg.index: [True, 0.0] for vg in vgroups} if hasattr(obj_data, "vertices"): # Mesh data diff --git a/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.py b/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.py index 13fe848bdad..ae7a0e1b6d8 100644 --- a/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.py +++ b/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.py @@ -1,5 +1,5 @@ """ -This is the most simple example of inserting a keyframe from python. +This is the most simple example of inserting a keyframe from Python. """ import bpy diff --git a/doc/python_api/rst_from_bmesh_opdefines.py b/doc/python_api/rst_from_bmesh_opdefines.py index ca12410854a..12fbaf439e8 100644 --- a/doc/python_api/rst_from_bmesh_opdefines.py +++ b/doc/python_api/rst_from_bmesh_opdefines.py @@ -2,16 +2,16 @@ # # SPDX-License-Identifier: GPL-2.0-or-later -# This is a quite stupid script which extracts bmesh api docs from -# 'bmesh_opdefines.cc' in order to avoid having to add a lot of introspection -# data access into the api. +# This is a quite stupid script which extracts BMesh API docs from +# `bmesh_opdefines.cc` in order to avoid having to add a lot of introspection +# data access into the API. # # The script is stupid because it makes assumptions about formatting... -# that each arg has its own line, that comments above or directly after will be __doc__ etc... +# that each argument has its own line, that comments above or directly after will be __doc__ etc... # # We may want to replace this script with something else one day but for now its good enough. # if it needs large updates it may be better to rewrite using a real parser or -# add introspection into bmesh.ops. +# add introspection into `bmesh.ops`. # - campbell import os @@ -149,7 +149,7 @@ def main(): blocks_py = [] for comment, b in blocks: - # magic, translate into python + # Magic, translate into Python. b[0] = b[0].replace("static BMOpDefine ", "") is_enum = False @@ -358,7 +358,7 @@ def main(): elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_ELEM: tp_str += ":class:`bmesh.types.BMVert`/:class:`bmesh.types.BMEdge`/:class:`bmesh.types.BMFace`" elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL: - tp_str += "unknown internal data, not compatible with python" + tp_str += "unknown internal data, not compatible with Python" else: assert False, "unreachable, unknown type {!r}".format(vars_dict_reverse[tp_sub]) else: diff --git a/doc/python_api/sphinx_changelog_gen.py b/doc/python_api/sphinx_changelog_gen.py index 8e0f8dc56ca..fd7419476bf 100644 --- a/doc/python_api/sphinx_changelog_gen.py +++ b/doc/python_api/sphinx_changelog_gen.py @@ -5,7 +5,7 @@ """ --------------- -Dump the python API into a JSON file, or generate changelogs from those JSON API dumps. +Dump the Python API into a JSON file, or generate changelogs from those JSON API dumps. Typically, changelog output from this tool should be added into "doc/python_api/rst/change_log.rst" @@ -14,7 +14,7 @@ This way the changelog generation simply needs to re-download the previous versi --------------- -# Dump api blender_version.json in CWD: +# Dump API blender_version.json in CWD: blender --background --factory-startup --python doc/python_api/sphinx_changelog_gen.py -- \ --indexpath="path/to/api/docs/api_dump_index.json" \ dump --filepath-out="path/to/api/docs//api_dump.json" @@ -24,7 +24,7 @@ blender --background --factory-startup --python doc/python_api/sphinx_changelog_ --indexpath="path/to/api/docs/api_dump_index.json" \ changelog --filepath-out doc/python_api/rst/change_log.rst -# Api comparison can also run without blender, +# Api comparison can also run without Blender, # will by default generate changeloig between the last two available versions listed in the index, # unless input files are provided explicitly: python doc/python_api/sphinx_changelog_gen.py -- \ @@ -152,7 +152,7 @@ def api_dump(args): ) del props - # python props, tricky since we don't know much about them. + # Python properties, tricky since we don't know much about them. for prop_id, attr in struct_info.get_py_properties(): dump_class[prop_id] = ( @@ -415,7 +415,7 @@ def main(argv=None): argv = argv[argv.index("--") + 1:] # get all args after "--" # When --help or no args are given, print this help - usage_text = "Run blender in background mode with this script: " + usage_text = "Run Blender in background mode with this script: " "blender --background --factory-startup --python %s -- [options]" % os.path.basename(__file__) parser = argparse.ArgumentParser(description=usage_text, diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 4f12e09bb68..1e650f9302e 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -9,8 +9,8 @@ API dump in RST files blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py - This will generate python files in doc/python_api/sphinx-in/ - providing ./blender is or links to the blender executable + This will generate Python files in doc/python_api/sphinx-in/ + providing ./blender is or links to the Blender executable To choose sphinx-in directory: blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --output=../python_api @@ -450,7 +450,7 @@ RNA_BLACKLIST = { RST_NOINDEX_ATTR = { # Render is both a method and an attribute, from looking into this # having both doesn't cause problems in practice since the `render` method - # is registered and called from C code where the attribute is accessed from the instance. + # is registered and called from C++ code where the attribute is accessed from the instance. ("bpy.types", "RenderEngine", "render"), } @@ -585,7 +585,8 @@ def generate_changelog(): # --------------------------------API DUMP-------------------------------------- -# Lame, python won't give some access. +# Unfortunately Python doesn't expose direct access to these types. +# Access them indirectly. ClassMethodDescriptorType = type(dict.__dict__["fromkeys"]) MethodDescriptorType = type(dict.get) GetSetDescriptorType = type(int.real) @@ -865,7 +866,7 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier): def py_c_func2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_class=True): """ - C defined function to sphinx. + C/C++ defined function to Sphinx. """ # Dump the doc-string, assume its formatted correctly. @@ -1990,7 +1991,7 @@ def write_rst_index(basepath): "bpy.path", "bpy.app", - # C modules. + # Python C-API modules. "bpy.props", ) @@ -2028,7 +2029,7 @@ def write_rst_index(basepath): fw("* :ref:`genindex`\n") fw("* :ref:`modindex`\n\n") - # Special case, this `bmesh.ops.rst` is extracted from C source. + # Special case, this `bmesh.ops.rst` is extracted from C++ source. if "bmesh.ops" not in EXCLUDE_MODULES: execfile(os.path.join(SCRIPT_DIR, "rst_from_bmesh_opdefines.py")) diff --git a/scripts/modules/bpy/__init__.py b/scripts/modules/bpy/__init__.py index d124771e0d8..877174c9c6b 100644 --- a/scripts/modules/bpy/__init__.py +++ b/scripts/modules/bpy/__init__.py @@ -19,7 +19,7 @@ __all__ = ( ) -# internal blender C module +# Internal Blender C-API modules. from _bpy import ( app, context, diff --git a/scripts/modules/bpy_extras/object_utils.py b/scripts/modules/bpy_extras/object_utils.py index e83d016d6ca..226ce9e350c 100644 --- a/scripts/modules/bpy_extras/object_utils.py +++ b/scripts/modules/bpy_extras/object_utils.py @@ -208,7 +208,7 @@ def object_add_grid_scale_apply_operator(operator, context): """ Scale an operators distance values by the grid size. """ - # This is a Python version of the C function `WM_operator_view3d_unit_defaults`. + # This is a Python version of the C++ function `WM_operator_view3d_unit_defaults`. grid_scale = object_add_grid_scale(context) properties = operator.properties diff --git a/scripts/modules/bpy_types.py b/scripts/modules/bpy_types.py index 476523b01c9..1e769004cb9 100644 --- a/scripts/modules/bpy_types.py +++ b/scripts/modules/bpy_types.py @@ -14,7 +14,7 @@ _StructMetaPropGroup = _types.bpy_struct_meta_idprop # Private dummy object use for comparison only. _sentinel = object() -# Note that methods extended in C are defined in: `bpy_rna_types_capi.cc`. +# Note that methods extended in the C-API are defined in: `bpy_rna_types_capi.cc`. class Context(_StructRNA): diff --git a/scripts/modules/rna_info.py b/scripts/modules/rna_info.py index 5a8077cd7b2..5e70e410ba4 100644 --- a/scripts/modules/rna_info.py +++ b/scripts/modules/rna_info.py @@ -196,7 +196,7 @@ class InfoStructRNA: import types functions = [] for identifier, attr in self._get_py_visible_attrs(): - # Methods may be python wrappers to C functions. + # Methods may be Python wrappers to C-API functions. ok = False if (attr_func := getattr(attr, "__func__", None)) is not None: if type(attr_func) == types.FunctionType: @@ -212,7 +212,7 @@ class InfoStructRNA: import types functions = [] for identifier, attr in self._get_py_visible_attrs(): - # Methods may be python wrappers to C functions. + # Methods may be Python wrappers to C-API functions. ok = False if (attr_func := getattr(attr, "__func__", None)) is not None: if type(attr_func) == types.BuiltinFunctionType: