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
Fynn Grotehans
d486ee2dbd
Update Camera presets
...
The (tracking) camera presets have not been updated in the last 7 or
more years, so they are very outdated. I found it pointless to have a
few specific camera models in the list and instead add the most commonly
used sensor sizes/film sizes. This way the list is shorter, easier to
maintain/becomes later outdated, and is more user friendly for most people
who don't own any of the specific cameras. I added the Crop Factor to the
Beginning of the name, so it gets sortet in the correct order and presets
are easier to find based on the size.
Reviewed By: #render_cycles, #motion_tracking, brecht, sergey
Differential Revision: https://developer.blender.org/D10739
2021-06-04 12:19:58 +02:00
Aaron Carlisle
a5d2c19a5c
PyAPI Docs: Cleanup Formatting
2021-05-12 21:10:17 -04:00
Ankur Deria
1ad1ecf1c9
Fix T79822: Custom preset casing not preserved
...
When adding a new preset the name would be converted to lower case and
then displayed in the interface in title case. This was confusing
because the name didn't reflect what was typed, and there are many cases
when the name shouldn't be forced into title case (like 8K UHDTV for
example).
This commit leaves the custom preset names in the original casing, and
removes the conversion of filenames to title case for preset lists.
Differential Revision: https://developer.blender.org/D10224
2021-02-03 17:48:39 -07:00
Campbell Barton
9267e6275c
PyAPI: change behavior of bpy.path.module_names
...
Instead of checking for names that contain ".", only skip files
that start with a "." (since they're used for ".git" & ".arcconfig").
While other path names may fail to import, it's not the purpose of this
function to validate the path, have the caller must raise an error
instead of silently skipping them.
See D6140.
2019-10-29 02:14:53 +11:00
Campbell Barton
6cc5c28d15
Fix UI extension removal
...
App-templates & keymap names had their extensions removed twice.
Confusing for filenames containing dots.
2019-01-25 13:49:59 +11: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
b66aa0b0a6
Cleanup: pep8
2018-07-03 06:48:44 +02:00
Campbell Barton
d416e56e70
Fix T54029: Wrong preset name display in win32
2018-02-26 19:05:01 +11:00
Campbell Barton
8d3efb2b90
Fix T53772: Presets don't support colons
2018-01-14 14:31:39 +11:00
Campbell Barton
096602d3a8
bpy.path.display_name: strip spaces
...
Useful for Python module paths that can't start with numbers.
2017-03-24 06:55:44 +11:00
Campbell Barton
ca983d1825
Cleanup: pep8
2016-07-30 09:00:41 +10:00
Campbell Barton
2fae1719f8
Fix T47986: OBJ Import fails w/ imagepath encoding
2016-03-29 18:30:08 +11:00
Campbell Barton
d924998d3e
Cleanup: pep8
2016-02-01 00:47:10 +11:00
Campbell Barton
aa523f8435
Fix os.path.is_subdir w/ trailing slash
2016-01-13 02:58:53 +11:00
Campbell Barton
73b34ad06b
PyAPI: tweak to ensure_ext don't lower entire path
2015-09-03 21:58:11 +10:00
Sybren A. Stüvel
8383a2d4cc
Fix: Made bpy.path.ensure_ext compatible with compound extensions.
...
Extensions such as ".tar.gz" are now also supported. Before this patch,
ensure_ext('demo.tar.gz', '.tar.gz') would return 'demo.tar.tar.gz'.
This results in issues with the `ExportHelper` mix-in class; clicking
an existing file in the file dialogue warns about overwriting it
(highlighting the input box in red), but then saves to a different
file.
Also added a unit test for the new behaviour.
Reviewers: mont29, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D1498
2015-09-03 13:09:16 +02:00
Campbell Barton
62c8f46ab6
Docs: comment functions in BLI & Py API
2015-08-05 02:09:03 +10:00
Campbell Barton
60ddaf045a
Python API: use cached translation tables
...
bpy.path.clean_name() and AddPresetBase.as_filename() were doing
inefficient search-replace of individual characters.
Use cached replacement table instead.
2015-06-13 19:47:32 +10:00
Campbell Barton
847ec075eb
Cleanup: pep8
2015-05-17 17:26:01 +10:00
Campbell Barton
b87eaef1f7
Fix T44137: bpy.path.is_subdir fails
...
`bpy.path.is_subdir("/abc/def/ghi","/abc/de")` incorrectly returned True
2015-03-26 16:32:16 +11:00
Campbell Barton
e17c6f79a5
cleanup: py imports
2015-01-28 16:50:51 +11:00
Bastien Montagne
3a58c4679a
Fix addon crash when trying listdir a directory we have no permission to.
2014-07-30 15:35:19 +02:00
Campbell Barton
1ea47c9af9
Code Cleanup: style, spelling and pep8 edits
2013-11-20 03:40:10 +11:00
Campbell Barton
b20c3f97a4
rename presets not to use '+' character, also some typo fixes.
2013-10-05 14:19:39 +00:00
Campbell Barton
b6631b8be7
fixes for python api docs.
...
also move foreach_get/set examples into their own py example files (prefer not to have example code built into blenders binary).
2013-09-18 05:20:43 +00:00
Campbell Barton
4fbe426151
bpy.path.reduce_dirs() - new utility function to de-duplicate and remove nested paths before doing a recursive search.
2013-08-12 07:44:38 +00:00
Campbell Barton
98752a1f30
py api additions needed for fixing [ #34864 ].
...
- add rna property 'as_bytes' method so you can get a string property as python bytes (bypass encoding).
- make bpy.path.abspath/relpath compatible with bytes.
- add 'relpath' option to bpy_extras.image_utils.load_image(), so you can load an image relative to a path.
2013-04-05 00:30:32 +00:00
Campbell Barton
97d62f0183
style cleanup
2013-01-15 23:15:32 +00:00
Campbell Barton
9dbe85c17e
expose common extensions for image/movie/audio types, since python scripts had to do this internally.
...
- bpy.path.extensions_image
- bpy.path.extensions_movie
- bpy.path.extensions_audio
eg:
if os.path.splitext(filename)[1].lower() in bpy.path.extensions_image:
... we have an image ...
2013-01-04 03:47:37 +00:00
Campbell Barton
9fa36b12cc
style cleanup: pep8
2012-10-08 08:28:05 +00:00
Campbell Barton
b0371f053c
style cleanup
2012-08-17 18:36:20 +00:00
Bastien Montagne
e204d67cc7
Fix [ #32135 ] FRAMERATE: Framerate display is truncated in selection box.
...
Filename extension was striped twice...
2012-07-18 08:51:19 +00:00
Campbell Barton
b56d2f9766
fix [ #30623 ] user-defined render presets bug
...
this report exposed multiple bugs in blender when using a non utf8 compatible home directory.
- bpy.utils.script_paths() would crash when homedir wasn't utf8 (reported bug)
- PyC_DefaultNameSpace() - would raise an error when running when __file__ was non utf8.
- preset filepath property was not set to accept non utf8.
- bpy.paths.display_name would raise an error on non utf8 paths, (used for preset draw)
2012-03-21 22:29:49 +00:00
Campbell Barton
c6c0601d8e
py api:
...
modify bpy.path.display_name_from_filepath() to accept bytes
2012-03-16 04:14:57 +00:00
Campbell Barton
b22405fa6f
fix for bpy.path.abspath() on windows when the library argument was set and its self a relative path too.
2011-12-11 19:48:56 +00:00
Campbell Barton
4d9766aacf
minor cleanup
...
- remove / comment unused python vars
- replace mul_v3_fl(somevec, -1.0f); with negate_v3(somevec);
2011-11-16 16:38:37 +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
Campbell Barton
fa5275cdfa
- bpy.path.abspath(), added optional library argument since any paths from linked datablocks are relative to this, not the blend files path, this saves kludgy path code wherever libraries may be used.
...
- Image "Edit Externally" operator can now edit relative library images.
also minor edits to navmesh.
2011-10-11 04:09:11 +00:00
Kent Mein
9026dc6ee4
Fixed a few small typos.
...
Kent
2011-08-02 17:00:44 +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
5132be21d1
fix [ #28075 ] After the correction of No.38528 is applied, the following phenomenon has been generated.
...
own fault in recent addition of bpy.path.basename() not supporting byte paths.
2011-07-25 04:00:11 +00:00
Campbell Barton
4ad43aaf16
added bpy.path.basename because "//" prefix breaks os.path.basename.
2011-07-20 08:10:01 +00:00
Campbell Barton
f4b6d00926
fix for bpy.path.abspath(), if a path was passed it would get the last directory cut off, broke copying images on export.
2011-07-19 05:05:54 +00:00
Campbell Barton
863b60e1b8
fix [ #27432 ] [2.57/scripts/modules/bpy/path.py:169] can't concat bytes to str
2011-05-19 06:27:39 +00:00
Campbell Barton
e26b0c68a4
patch [ #27205 ] Infinite recursion inside resolve_ncase() when passed a driver letter on Windows that does not exist
...
by Brandon Ehle (azverkan)
2011-05-06 11:27:04 +00:00
Campbell Barton
0362d19f2d
Pythons path functions - os.walk(). os.path.exists(). etc support bytes for paths as well as strings, support this with blender/rna too.
...
- bpy.data.*.load() functions were only accepting UTF-8 paths.
- rna functions/properties now accept byte values rather then strings for file paths.
- bpy.path.resolve_ncase now supports byte objects.
2011-02-01 04:24:47 +00:00
Campbell Barton
743182106f
py api: bpy.path.abspath(), option to return relative to a path other then the current blend file.
2011-01-15 20:35:31 +00:00
Campbell Barton
dacdfbe6f3
recent change to keyframe menu broke BVH import, now don't use the operator at all, instead assign the action manually.
...
Also added bpy.path.display_name_from_filepath(), since filepaths are not ensured to be utf8.
same as calling: os.path.splitext(os.path.basename(name))[0].encode("utf8", "replace").decode("utf8")
2011-01-03 08:28:22 +00:00
Campbell Barton
7f3fe8a2df
pep8 cleanup
2011-01-01 07:20:34 +00:00