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
Campbell Barton
0a4fdcbb5f
Cleanup: unused Python variables & imports
2022-03-04 11:07:37 +11: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
Hans Goudey
46475b8e11
Cleanup: Grammar: its self vs. itself
2022-01-23 22:34:56 -06:00
Campbell Barton
a82c9e1e40
Fix T91169: bpy_extras.io_utils.create_derived_objects -> duplis error
...
This function now takes a depsgraph and a list of objects to avoid
inefficient O(n^2) iteration when extracting instances from all objects
in the scene. Returning an object -> instance map.
Note that keeping compatibility with the existing API wasn't practical
in this case since instances can no longer be generated from the scene
and it's objects.
2021-10-11 21:35:38 +11: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
0b6892f0ba
Fix T85688: ExportHelper adds multiple file name extensions
...
Replace the existing extension instead of adding it.
2021-04-28 23:00:53 +10:00
Julian Eisel
b59adcaa36
Fix T73357: Multiple importers fail
...
Very stupid mistake in ba8de85299ff, registered property for wrong
class. It should be registered for the PLY importer add-on only.
2020-01-26 16:48:05 +01:00
Julian Eisel
ba8de85299
PLY Import: Hide empty operator properties sidebar in file browser
...
The sidebar is empty for the PLY importer, so better to hide it.
2020-01-22 14:59:06 +01:00
Bastien Montagne
df29e9c070
Fix T71596: Bug in io_utils api breaking only on windows.
...
Stupid mistake, 'original' filepath is a blender-flavored one, with
potentially weird things like the '//' relative 'header'... This can
work on linux (also it could have broken in other places too), but on
windows that is fully invalid path and python `os.path` library just
generates empty result here.
Simply using proper valid path instead fixes it...
2019-12-02 18:09:47 +01:00
Campbell Barton
f97eb0e338
Cleanup: use fixed indent in Python
...
Reduce right-shift.
2019-09-16 16:17:46 +10:00
Campbell Barton
7465a5db3b
Cleanup: unused args/vars/imports in modules
2019-05-09 13:11:36 +10:00
Bastien Montagne
5ad217fe0a
Fix own mistake in recent rB74361eebe68c.
...
One cannot assign to Class.__dict__, that is not a 'real' dictionnary...
Thanks to @JacquesLucke for noting the issue.
2018-12-05 20:54:02 +01:00
Bastien Montagne
74361eebe6
Fix T58772: Stray "forward" and "up" options in 2.8 import addons?
...
Nice side-effect of using new __annotations__ thingy to store
dynamically-generated fields in a class: __annotations__ dict is not
ensured to exist for a given class, so we may end up modifying on of the
parents' one!
2018-12-05 11:08:57 +01:00
Sergey Sharybin
7c7f3776dd
Use collection and instance terminology in Python API
...
This follows naming convention agreed on in T56648.
2018-11-28 18:22:51 +01:00
Bastien Montagne
0bb9ebd058
io_utils: remove orientation_helper_factory
.
...
Now we only use orientation_helper decorator.
2018-09-30 17:30:29 +02:00
Bastien Montagne
0edb2b8de9
Py io_utils: deprecate orientation_helper_factory
and add new orientation_helper
decorator.
...
This fixes warning about not using annotations, and a decorator here is
a much cleaner solution anyway.
2018-09-21 19:31:57 +02:00
Campbell Barton
09aa799e53
PyAPI: Use annotations for RNA definitions
...
- Logical use of fields since they define type information.
- Avoids using ordered-dict metaclass.
Properties using regular assignments will print a warning and load,
however the order is undefined.
2018-07-11 22:18:09 +02:00
Campbell Barton
b66aa0b0a6
Cleanup: pep8
2018-07-03 06:48:44 +02:00
Campbell Barton
ad7fb1c028
Cleanup: Python imports
...
Split over lines to diff more easily.
2017-11-29 18:05:41 +11:00
Campbell Barton
d924998d3e
Cleanup: pep8
2016-02-01 00:47:10 +11:00
Campbell Barton
847ec075eb
Cleanup: pep8
2015-05-17 17:26:01 +10:00
Campbell Barton
8a231185aa
Doc: minor fixes
...
- check for class/static methods assumed nonzero args.
- subclass references and set-flag items are now sorted.
- use 'order' for Py operator mix-ins,
so operator settings don't show in random order.
2015-05-12 18:23:24 +10:00
Bastien Montagne
cf365275c2
Fix T44089: All addons do not use same default for orientations.
...
Transformed 'OrientationHelper' class into 'orientation_helper_factory' function,
which returns an OrientationHelper customized class with specified default axes.
2015-03-24 09:57:11 +01:00
Campbell Barton
bcd9b29a0d
PyAPI: name OrientationHelper (io prefix in module name already)
2015-01-14 23:55:16 +11:00
Bastien Montagne
edad3f93f6
Py IO utils: Add helper class to handle orientation (axes).
...
Also 'fix' T43243, since we can easily add a common better behavior now
when both axis settings are incompatible, by systematically changing
the other axis.
Will update 'main' addons in next commit, contrib ones I'll let to the authors
(old behavior is still possible anyway).
2015-01-14 13:10:18 +01:00
Campbell Barton
aea00c7a81
Code cleanup: style
2014-02-13 08:52:12 +11:00
Bastien Montagne
a567dd20c0
More "relpath" try/except protection...
2013-08-18 15:17:33 +00:00
Campbell Barton
791815c9d4
py api: path_reference_copy() use try/except when copying images, can fail for odd reasons (currently fails if the dest dir is a symlink and not using expected permissions).
2013-04-10 12:16:27 +00:00
Campbell Barton
4b8fe80e6e
code cleanup: use exist_ok keyword arg to os.makedirs() rather then checking if the dir exists first.
2013-02-07 04:02:24 +00:00
Campbell Barton
97d62f0183
style cleanup
2013-01-15 23:15:32 +00:00
Campbell Barton
a404e3f780
fix issue reported in '[ #33876 ] bpy.path.ensure_ext adds extension twice / extra period if filename empty, just a period or equal to extension'
...
For python operators that used the ExportHelper mix-in class, an empty file field would become '.ext', entering and existing the text field would become '.ext.ext',
Now only add an extension if the filename part of the path is set, so '.ext' will still become '.ext.ext' but having only the extension isn't so likely to happen in the first place now.
This is a different fix then the changes suggested in the report but I'd prefer to keep path functions stupid+predictable.
2013-01-15 04:33:08 +00:00
Bastien Montagne
37dc4006c7
First load of spell and typo fixes (mostly UI messages, but also one or two pieces of code using mis-spelled names).
2012-07-03 17:20:21 +00:00
Bastien Montagne
49adbe3ab8
Various fixes to UI messages (among other things, all messages needed it should now be capitalized).
2012-02-27 18:14:56 +00:00
Campbell Barton
24400eab28
update axis conversion for recent matrix changes
2011-12-22 11:06:41 +00:00
Campbell Barton
4b73f587ee
attempt to fix defione for qtcreator project file and cycles define.
2011-12-06 04:53:16 +00:00
Campbell Barton
fda2045150
correct spelling errors in comments
2011-10-17 06:58:07 +00:00
Campbell Barton
751aa8c7f4
py api: bpy_extras.io_utils.path_reference() - added library argument so exporters get the paths of linked images right.
2011-10-11 04:36:27 +00:00
Bastien Montagne
712e434a5f
/release/scripts: Removed final points in UI strings and messages.
2011-09-19 14:00:42 +00:00
Campbell Barton
a9dea3afe9
correct missing bpy doc references.
2011-08-26 18:48:48 +00:00
Campbell Barton
551e8bc72c
py api - optional sep argument for bpy_extra.io_utils.unique_name() since for some formats '.' is an invalid char.
2011-08-15 04:58:19 +00:00
Campbell Barton
22d2764d50
use static sets rather then tuples, python optimizes this case.
...
minor change to lightmap unpack collecting unique meshes.
2011-08-08 05:21:37 +00:00
Campbell Barton
a10245a1fa
fix [ #28151 ] export OBJ don't save the extension
...
also correct some typos
2011-08-03 05:32:07 +00:00
Campbell Barton
f4293067c1
py api: sphinx doc corrections, pep8 cleanup and style edits, also added __all__ to some modules which were missing it.
2011-07-31 03:15:37 +00:00
Campbell Barton
2658949752
pep8 cleanup, also print message when attempting to run in animation player mode.
2011-07-29 01:24:03 +00:00
Campbell Barton
b71ccf3e06
fix error in writing dupligroups for X3D export, may have effected other exporters too.
2011-07-28 07:10:39 +00:00
Campbell Barton
13e82ff8e1
fix [ #27971 ] Blender OBJ export with Z-Up setting produces an error and fails
...
changes to extensions coming up...
2011-07-18 05:07:54 +00:00
Campbell Barton
301e5b4ea0
fix for various python bugs and remove unused var.
2011-07-10 17:26:15 +00:00
Campbell Barton
dd0522242a
addons now show expanded list again (since Brecht's commit now makes it fast)
...
also add utility function for getting cleaned, unique names from python: bpy_extras.io_utils.unique_name(...)
2011-06-02 15:21:47 +00:00
Campbell Barton
a9dd90be78
move load_image into image_utils and add some docstrings to bpy_extras module.
2011-05-28 09:34:45 +00:00