102 Commits

Author SHA1 Message Date
Campbell Barton
3ca76ae0e8 Cleanup: remove "<pep8 compliant>" from headers
It can be assumed that all scripts comply with basic pep8 formatting
regarding white-space, indentation etc.

Also remove note in best practices page & update `tests/python/pep8.py`.

If we want to exclude some scripts from make format,
this can be done by adding them to `ignore_files` in:
source/tools/utils_maintenance/autopep8_format_paths.py

Or using `# nopep8` for to ignore for individual lines.

Ref T98554
2022-06-02 20:16:20 +10:00
Aaron Carlisle
86fc63c4ca Cleanup: Simplify manual url version handling
Recently we changed the build pipeline to always create a version
number in the url and point 'dev' to the latest version rather than creating the version number url once we release.

This makes the check to `bpy.app.version_cycle` unnecessary.
2022-02-23 15:00:16 -05:00
Campbell Barton
c434782e3a File headers: SPDX License migration
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-02-11 09:14:36 +11:00
Gaia Clary
2851602052 Add a reason for why an Addon can not be loaded. This change gives a more detailed explanation of the issue and may help the Addon Developer to identify what exactly needs to be changed.
The current message 'addon not loaded' is a bit too sparse.

Differential Revision: https://developer.blender.org/D11655
2021-06-21 12:51:46 +02:00
Campbell Barton
f29a738e23 PyAPI: use keyword only arguments
Use keyword only arguments for the following functions.

- addon_utils.module_bl_info 2nd arg `info_basis`.
- addon_utils.modules 1st `module_cache`, 2nd arg `refresh`.
- addon_utils.modules_refresh 1st arg `module_cache`.
- bl_app_template_utils.activate 1nd arg `template_id`.
- bl_app_template_utils.import_from_id 2nd arg `ignore_not_found`.
- bl_app_template_utils.import_from_path 2nd arg `ignore_not_found`.
- bl_keymap_utils.keymap_from_toolbar.generate 2nd & 3rd args `use_fallback_keys` & `use_reset`.
- bl_keymap_utils.platform_helpers.keyconfig_data_oskey_from_ctrl 2nd arg `filter_fn`.
- bl_ui_utils.bug_report_url.url_prefill_from_blender 1st arg `addon_info`.
- bmesh.types.BMFace.copy 1st & 2nd args `verts`, `edges`.
- bmesh.types.BMesh.calc_volume 1st arg `signed`.
- bmesh.types.BMesh.from_mesh 2nd..4th args `face_normals`, `use_shape_key`, `shape_key_index`.
- bmesh.types.BMesh.from_object 3rd & 4th args `cage`, `face_normals`.
- bmesh.types.BMesh.transform 2nd arg `filter`.
- bmesh.types.BMesh.update_edit_mesh 2nd & 3rd args `loop_triangles`, `destructive`.
- bmesh.types.{BMVertSeq,BMEdgeSeq,BMFaceSeq}.sort 1st & 2nd arg `key`, `reverse`.
- bmesh.utils.face_split 4th..6th args `coords`, `use_exist`, `example`.
- bpy.data.libraries.load 2nd..4th args `link`, `relative`, `assets_only`.
- bpy.data.user_map 1st..3rd args `subset`, `key_types, `value_types`.
- bpy.msgbus.subscribe_rna 5th arg `options`.
- bpy.path.abspath 2nd & 3rd args `start` & `library`.
- bpy.path.clean_name 2nd arg `replace`.
- bpy.path.ensure_ext 3rd arg `case_sensitive`.
- bpy.path.module_names 2nd arg `recursive`.
- bpy.path.relpath 2nd arg `start`.
- bpy.types.EditBone.transform 2nd & 3rd arg `scale`, `roll`.
- bpy.types.Operator.as_keywords 1st arg `ignore`.
- bpy.types.Struct.{keyframe_insert,keyframe_delete} 2nd..5th args `index`, `frame`, `group`, `options`.
- bpy.types.WindowManager.popup_menu 2nd & 3rd arg `title`, `icon`.
- bpy.types.WindowManager.popup_menu_pie 3rd & 4th arg `title`, `icon`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.blend_paths 1st..3rd args `absolute`, `packed`, `local`.
- bpy.utils.execfile 2nd arg `mod`.
- bpy.utils.keyconfig_set 2nd arg `report`.
- bpy.utils.load_scripts 1st & 2nd `reload_scripts` & `refresh_scripts`.
- bpy.utils.preset_find 3rd & 4th args `display_name`, `ext`.
- bpy.utils.resource_path 2nd & 3rd arg `major`, `minor`.
- bpy.utils.script_paths 1st..4th args `subdir`, `user_pref`, `check_all`, `use_user`.
- bpy.utils.smpte_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.smpte_from_seconds 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.system_resource 2nd arg `subdir`.
- bpy.utils.time_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.time_to_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.units.to_string 4th..6th `precision`, `split_unit`, `compatible_unit`.
- bpy.utils.units.to_value 4th arg `str_ref_unit`.
- bpy.utils.user_resource 2nd & 3rd args `subdir`, `create`
- bpy_extras.view3d_utils.location_3d_to_region_2d 4th arg `default`.
- bpy_extras.view3d_utils.region_2d_to_origin_3d 4th arg `clamp`.
- gpu.offscreen.unbind 1st arg `restore`.
- gpu_extras.batch.batch_for_shader 4th arg `indices`.
- gpu_extras.batch.presets.draw_circle_2d 4th arg `segments`.
- gpu_extras.presets.draw_circle_2d 4th arg `segments`.
- imbuf.types.ImBuf.resize 2nd arg `resize`.
- imbuf.write 2nd arg `filepath`.
- mathutils.kdtree.KDTree.find 2nd arg `filter`.
- nodeitems_utils.NodeCategory 3rd & 4th arg `descriptions`, `items`.
- nodeitems_utils.NodeItem 2nd..4th args `label`, `settings`, `poll`.
- nodeitems_utils.NodeItemCustom 1st & 2nd arg `poll`, `draw`.
- rna_prop_ui.draw 5th arg `use_edit`.
- rna_prop_ui.rna_idprop_ui_get 2nd arg `create`.
- rna_prop_ui.rna_idprop_ui_prop_clear 3rd arg `remove`.
- rna_prop_ui.rna_idprop_ui_prop_get 3rd arg `create`.
- rna_xml.xml2rna 2nd arg `root_rna`.
- rna_xml.xml_file_write 4th arg `skip_typemap`.
2021-06-09 03:05:44 +10:00
Campbell Barton
aaa07a3a8f PyAPI: remove deprecated 'wiki_url' for add-ons 'bl_info'
This was only kept for compatibility with older add-ons and has been
deprecated since 2.83.

Ref T85675
2021-05-12 22:02:12 +10:00
Sybren A. Stüvel
d982ea9a9e Fix error when an addon has no __init__.py
When an addon has been removed, but its `.pyc` files are still there,
the Python module can still be loaded. However, because `__init__.py` is
missing, it becomes a namespace instead of a module, and its `__file__`
will be set to `None`. As a result, it's impossible to get the mtime
from the file (because there is none).

This should not influence any regularly uninstalled add-on, as that
would just remove the add-on's directory; I ran into the problem when
switching Git branches caused an add-on's Python files to disappear
while keeping the `__pycache__` directory around.
2021-03-26 10:46:26 +01:00
Campbell Barton
92a1b3f750 Fix T80650: Malformed bl_info header causes empty add-on listing 2020-09-10 16:39:52 +10:00
Campbell Barton
cafe5cd9b0 Cleanup: explain why checking the enabled state twice is needed
Address concern raised with the commit that added this extra check.
2020-08-17 12:33:07 +10:00
Campbell Barton
83e204702d Cleanup: remove f-string use in favor of percentage for formatting 2020-07-17 17:39:47 +10:00
Campbell Barton
646ef49e19 Cleanup: use percentage formatting
`str.format` and `f-string` use was minimal.
Prefer using a single style of string formatting
unless an alternative is more widely adopted.
2020-06-26 12:33:19 +10:00
Aaron Carlisle
a0ea0153c2 Addons: Allow a user manual url prefix in doc_url
This was raised in T74017, the issue being that we point to `/dev` 
version of the manual for the addons when we want to point to a specific 
version instead.

Instead of manually updating the URL every release we can do this.

The `bl_info` for addons will need to be updated in the format of 
`'doc_url': 
{BLENDER_MANUAL_URL}/addons/import_export/scene_gltf2.html",`

Differential Revision: https://developer.blender.org/D6995
2020-03-04 23:24:13 -05:00
Aaron Carlisle
ae223ff52b Addons: deprecate 'wiki_url'
When running with debug enabled ('-d' argument),
warnings are printed for add-ons which are not yet updated.

Reminder to name things based on what they do,
not the technologies they use :)
2020-03-05 11:45:22 +11:00
Philipp Oeser
0bedf9cf07 Fix T58842: Add-ons Import/Export entries disapear when enabling Filter
Addons option

This removes the 'use_owner' option feature from rB61c8ed40f5df.
(this wasnt working well when addons are enabled and when switching
workspaces)

Now Addon filtering is just bypassed for Import/Export menus.
(by introducing/setting bl_owner_use_filter = False)

Maniphest Tasks: T58842

Differential Revision: https://developer.blender.org/D6740
2020-02-04 21:06:37 +01:00
Campbell Barton
fdb0f3bc0b Fix T68760: "Reload Scripts" '_sys_path_ensure' missing
Missed this in recent update.
2019-08-18 02:32:43 +10:00
Campbell Barton
bb2394a298 Fix T68014: Add-on's override Python built-in modules
Append addon paths to the sys.path to avoid name
collisions with system modules.
2019-08-15 16:09:15 +10:00
Campbell Barton
0c538fc923 Cleanup: spelling, grammar, and other corrections
D5084 by @nBurn with edits
2019-06-21 10:18:53 +10:00
Campbell Barton
7465a5db3b Cleanup: unused args/vars/imports in modules 2019-05-09 13:11:36 +10:00
Jacques Lucke
56b06ee83a Fix T62901: Bad handling of missing addon category 2019-03-27 15:13:14 +01:00
Bastien Montagne
8ecc4d4f16 Fix noisy console messages about unported add-ons by default.
* Make those single-line warning, there is really no reason to raise
exception (i.e. error) for that.
* Only show them when `--debug` option is set.
2019-03-18 10:38:12 +01:00
Campbell Barton
69bf4e5e36 Cleanup: unused variables 2019-03-17 21:14:43 +11:00
Bastien Montagne
e5e6c3b52c Fix T62576: The remaining two unported official add-ons: X3D and 3DS.
X3D has been (basically) ported in rBAe8da70ab73d2dd5ff46, and 3DS has
been downgraded to 'community' support, so we can get rid of that ugly
'slience warning' hack.
2019-03-16 13:02:34 +01:00
Campbell Barton
63fcbfc3a7 RNA: naming, user-preferences -> preferences 2018-12-21 12:55:02 +11:00
Campbell Barton
3f542312cf Merge branch 'master' into blender2.8 2018-10-19 17:51:40 +11:00
Campbell Barton
0bbc6a903a Fix error disabling all addons 2018-10-19 17:49:48 +11:00
Jacques Lucke
9d104f57b6 Addons: reactivate BVH and PLY format addons
Reviewers: brecht

Differential Revision: https://developer.blender.org/D3758
2018-10-02 17:51:39 +02:00
Jacques Lucke
a27d97d1b7 Addons: reactivate 'STL format' addon
Reviewers: brecht

Differential Revision: https://developer.blender.org/D3735
2018-09-26 17:32:46 +02:00
Bastien Montagne
444711e615 Re-enable OBJ add-on. 2018-09-21 20:06:51 +02:00
Bastien Montagne
6a7914b73e Re-enable FBX add-on. 2018-09-21 15:15:08 +02:00
Dalai Felinto
828627a796 Addon Utils: Green light the uv layout addon 2018-09-19 13:58:01 +00:00
Bastien Montagne
a43ebc63fa Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/collision.c
2018-09-03 17:44:36 +02:00
Brecht Van Lommel
4da2acae3a Spelling fixes in comments and descriptions, patch by luzpaz.
Differential Revision: https://developer.blender.org/D3668
2018-09-03 16:55:01 +02:00
Campbell Barton
c1185f3d0d Cleanup: pep8, windows line endings 2018-07-31 21:31:04 +10:00
Campbell Barton
9d1ad27fdc Merge branch 'master' into blender2.8 2018-07-14 09:31:52 +02:00
Campbell Barton
43973410f3 Cleanup: use f-string for addon_utils 2018-07-14 09:30:59 +02:00
Campbell Barton
dd5c25fab2 Remove print left in by accident 2018-07-06 12:10:30 +02:00
Campbell Barton
6379c7bd47 Addons: silence warnings instead of disabling 2018-07-06 11:03:24 +02:00
Campbell Barton
1ff5cc8c1a addons: disable addons with versions below 2.8 2018-07-03 07:59:08 +02:00
Campbell Barton
00fc1d70a7 Merge branch 'master' into blender2.8 2018-07-03 06:58:34 +02:00
Campbell Barton
b66aa0b0a6 Cleanup: pep8 2018-07-03 06:48:44 +02:00
Campbell Barton
61c8ed40f5 WorkSpace: show/hode opt-out support for addons
In some cases it doesn't make sense for add-ons to be listed for hiding.
Especially for import/export which use minimal UI space.

This adds `bl_info["use_owner"]` to add-ons,
currently defaulting to True for all non Import-Export add-ons.
2018-03-01 11:22:46 +11:00
Campbell Barton
d937d06c02 WorkSpace: UI filtering for add-ons
Allows for each workspace to have it's own add-ons on display.

Filtering for: Panels, Menus, Keymaps & Manipulators.
Automatically applies to add-ons at the moment.

Access from workspace, toggled off by default
once enabled, add-ons can be white-listed.

See D3076
2018-03-01 01:31:07 +11:00
Campbell Barton
10fec1f153 Cleanup: Python code-style (addons, wm) 2018-02-01 13:58:44 +11:00
Campbell Barton
9af6f40e4d addon_utils: add disable_all function 2017-03-24 05:20:26 +11:00
Campbell Barton
112e4de885 Improve add-on UI error message
Show the paths of the duplicate addons

D791 by @gregzaal
2017-02-27 03:57:11 +11:00
Campbell Barton
ca983d1825 Cleanup: pep8 2016-07-30 09:00:41 +10:00
Campbell Barton
3ad1e4fab9 addon_utils: improve docstrings
Also make error handler take the exception as its argument.
2016-01-07 23:33:51 +11:00
Campbell Barton
f7b8bc45b2 Python: use keyword only args for addon_utils 2015-11-16 09:41:42 +11:00
Campbell Barton
74f7ef1240 Missed changing default arg in addon_utils.disable 2015-06-23 07:25:10 +10:00
Campbell Barton
eb0310950c Fix error enabling an already enabled addon
Would run register() twice causing warning with `register_module()`
which expects new classes to be defined.

Now run unregister() before re-registering.
2015-06-14 22:26:42 +10:00