forked from bartvdbraak/blender
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`.
This commit is contained in:
parent
c18ff180e3
commit
f29a738e23
@ -29,7 +29,7 @@ with offscreen.bind():
|
|||||||
amount = 10
|
amount = 10
|
||||||
for i in range(-amount, amount + 1):
|
for i in range(-amount, amount + 1):
|
||||||
x_pos = i / amount
|
x_pos = i / amount
|
||||||
draw_circle_2d((x_pos, 0.0), (1, 1, 1, 1), 0.5, 200)
|
draw_circle_2d((x_pos, 0.0), (1, 1, 1, 1), 0.5, segments=200)
|
||||||
|
|
||||||
|
|
||||||
# Drawing the generated texture in 3D space
|
# Drawing the generated texture in 3D space
|
||||||
|
@ -34,7 +34,9 @@ with offscreen.bind():
|
|||||||
for i in range(RING_AMOUNT):
|
for i in range(RING_AMOUNT):
|
||||||
draw_circle_2d(
|
draw_circle_2d(
|
||||||
(random.uniform(-1, 1), random.uniform(-1, 1)),
|
(random.uniform(-1, 1), random.uniform(-1, 1)),
|
||||||
(1, 1, 1, 1), random.uniform(0.1, 1), 20)
|
(1, 1, 1, 1), random.uniform(0.1, 1),
|
||||||
|
segments=20,
|
||||||
|
)
|
||||||
|
|
||||||
buffer = fb.read_color(0, 0, WIDTH, HEIGHT, 4, 0, 'UBYTE')
|
buffer = fb.read_color(0, 0, WIDTH, HEIGHT, 4, 0, 'UBYTE')
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ def init():
|
|||||||
_workaround_buggy_drivers()
|
_workaround_buggy_drivers()
|
||||||
|
|
||||||
path = os.path.dirname(__file__)
|
path = os.path.dirname(__file__)
|
||||||
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', '')))
|
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', path='')))
|
||||||
|
|
||||||
_cycles.init(path, user_path, bpy.app.background)
|
_cycles.init(path, user_path, bpy.app.background)
|
||||||
_parse_command_line()
|
_parse_command_line()
|
||||||
|
@ -49,16 +49,16 @@ def _initialize():
|
|||||||
|
|
||||||
def paths():
|
def paths():
|
||||||
# RELEASE SCRIPTS: official scripts distributed in Blender releases
|
# RELEASE SCRIPTS: official scripts distributed in Blender releases
|
||||||
addon_paths = _bpy.utils.script_paths("addons")
|
addon_paths = _bpy.utils.script_paths(subdir="addons")
|
||||||
|
|
||||||
# CONTRIB SCRIPTS: good for testing but not official scripts yet
|
# CONTRIB SCRIPTS: good for testing but not official scripts yet
|
||||||
# if folder addons_contrib/ exists, scripts in there will be loaded too
|
# if folder addons_contrib/ exists, scripts in there will be loaded too
|
||||||
addon_paths += _bpy.utils.script_paths("addons_contrib")
|
addon_paths += _bpy.utils.script_paths(subdir="addons_contrib")
|
||||||
|
|
||||||
return addon_paths
|
return addon_paths
|
||||||
|
|
||||||
|
|
||||||
def modules_refresh(module_cache=addons_fake_modules):
|
def modules_refresh(*, module_cache=addons_fake_modules):
|
||||||
global error_encoding
|
global error_encoding
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -203,9 +203,9 @@ def modules_refresh(module_cache=addons_fake_modules):
|
|||||||
del modules_stale
|
del modules_stale
|
||||||
|
|
||||||
|
|
||||||
def modules(module_cache=addons_fake_modules, *, refresh=True):
|
def modules(*, module_cache=addons_fake_modules, refresh=True):
|
||||||
if refresh or ((module_cache is addons_fake_modules) and modules._is_first):
|
if refresh or ((module_cache is addons_fake_modules) and modules._is_first):
|
||||||
modules_refresh(module_cache)
|
modules_refresh(module_cache=module_cache)
|
||||||
modules._is_first = False
|
modules._is_first = False
|
||||||
|
|
||||||
mod_list = list(module_cache.values())
|
mod_list = list(module_cache.values())
|
||||||
@ -512,7 +512,7 @@ def _blender_manual_url_prefix():
|
|||||||
return "https://docs.blender.org/manual/en/" + manual_version
|
return "https://docs.blender.org/manual/en/" + manual_version
|
||||||
|
|
||||||
|
|
||||||
def module_bl_info(mod, info_basis=None):
|
def module_bl_info(mod, *, info_basis=None):
|
||||||
if info_basis is None:
|
if info_basis is None:
|
||||||
info_basis = {
|
info_basis = {
|
||||||
"name": "",
|
"name": "",
|
||||||
|
@ -134,7 +134,7 @@ def _disable(template_id, *, handle_error=None):
|
|||||||
print("\tapp_template_utils.disable", template_id)
|
print("\tapp_template_utils.disable", template_id)
|
||||||
|
|
||||||
|
|
||||||
def import_from_path(path, ignore_not_found=False):
|
def import_from_path(path, *, ignore_not_found=False):
|
||||||
import os
|
import os
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
base_module, template_id = path.rsplit(os.sep, 2)[-2:]
|
base_module, template_id = path.rsplit(os.sep, 2)[-2:]
|
||||||
@ -148,9 +148,9 @@ def import_from_path(path, ignore_not_found=False):
|
|||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
|
|
||||||
def import_from_id(template_id, ignore_not_found=False):
|
def import_from_id(template_id, *, ignore_not_found=False):
|
||||||
import os
|
import os
|
||||||
path = next(iter(_bpy.utils.app_template_paths(template_id)), None)
|
path = next(iter(_bpy.utils.app_template_paths(path=template_id)), None)
|
||||||
if path is None:
|
if path is None:
|
||||||
if ignore_not_found:
|
if ignore_not_found:
|
||||||
return None
|
return None
|
||||||
@ -163,7 +163,7 @@ def import_from_id(template_id, ignore_not_found=False):
|
|||||||
return import_from_path(path, ignore_not_found=ignore_not_found)
|
return import_from_path(path, ignore_not_found=ignore_not_found)
|
||||||
|
|
||||||
|
|
||||||
def activate(template_id=None):
|
def activate(*, template_id=None):
|
||||||
template_id_prev = _app_template["id"]
|
template_id_prev = _app_template["id"]
|
||||||
|
|
||||||
# not needed but may as well avoids redundant
|
# not needed but may as well avoids redundant
|
||||||
@ -190,4 +190,4 @@ def reset(*, reload_scripts=False):
|
|||||||
|
|
||||||
# TODO reload_scripts
|
# TODO reload_scripts
|
||||||
|
|
||||||
activate(template_id)
|
activate(template_id=template_id)
|
||||||
|
@ -26,7 +26,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def generate(context, space_type, use_fallback_keys=True, use_reset=True):
|
def generate(context, space_type, *, use_fallback_keys=True, use_reset=True):
|
||||||
"""
|
"""
|
||||||
Keymap for popup toolbar, currently generated each time.
|
Keymap for popup toolbar, currently generated each time.
|
||||||
"""
|
"""
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
# ##### END GPL LICENSE BLOCK #####
|
# ##### END GPL LICENSE BLOCK #####
|
||||||
|
|
||||||
|
|
||||||
def keyconfig_data_oskey_from_ctrl(keyconfig_data_src, filter_fn=None):
|
def keyconfig_data_oskey_from_ctrl(keyconfig_data_src, *, filter_fn=None):
|
||||||
keyconfig_data_dst = []
|
keyconfig_data_dst = []
|
||||||
for km_name, km_parms, km_items_data_src in keyconfig_data_src:
|
for km_name, km_parms, km_items_data_src in keyconfig_data_src:
|
||||||
km_items_data_dst = km_items_data_src.copy()
|
km_items_data_dst = km_items_data_src.copy()
|
||||||
@ -61,4 +61,4 @@ def keyconfig_data_oskey_from_ctrl_for_macos(keyconfig_data_src):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return keyconfig_data_oskey_from_ctrl(keyconfig_data_src, filter_fn)
|
return keyconfig_data_oskey_from_ctrl(keyconfig_data_src, filter_fn=filter_fn)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
# <pep8-80 compliant>
|
# <pep8-80 compliant>
|
||||||
|
|
||||||
|
|
||||||
def url_prefill_from_blender(addon_info=None):
|
def url_prefill_from_blender(*, addon_info=None):
|
||||||
import bpy
|
import bpy
|
||||||
import gpu
|
import gpu
|
||||||
import struct
|
import struct
|
||||||
|
@ -56,7 +56,7 @@ def _getattr_bytes(var, attr):
|
|||||||
return var.path_resolve(attr, False).as_bytes()
|
return var.path_resolve(attr, False).as_bytes()
|
||||||
|
|
||||||
|
|
||||||
def abspath(path, start=None, library=None):
|
def abspath(path, *, start=None, library=None):
|
||||||
"""
|
"""
|
||||||
Returns the absolute path relative to the current blend file
|
Returns the absolute path relative to the current blend file
|
||||||
using the "//" prefix.
|
using the "//" prefix.
|
||||||
@ -92,7 +92,7 @@ def abspath(path, start=None, library=None):
|
|||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
def relpath(path, start=None):
|
def relpath(path, *, start=None):
|
||||||
"""
|
"""
|
||||||
Returns the path relative to the current blend file using the "//" prefix.
|
Returns the path relative to the current blend file using the "//" prefix.
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ def is_subdir(path, directory):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def clean_name(name, replace="_"):
|
def clean_name(name, *, replace="_"):
|
||||||
"""
|
"""
|
||||||
Returns a name with characters replaced that
|
Returns a name with characters replaced that
|
||||||
may cause problems under various circumstances,
|
may cause problems under various circumstances,
|
||||||
@ -311,7 +311,7 @@ def resolve_ncase(path):
|
|||||||
return ncase_path if found else path
|
return ncase_path if found else path
|
||||||
|
|
||||||
|
|
||||||
def ensure_ext(filepath, ext, case_sensitive=False):
|
def ensure_ext(filepath, ext, *, case_sensitive=False):
|
||||||
"""
|
"""
|
||||||
Return the path with the extension added if it is not already set.
|
Return the path with the extension added if it is not already set.
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ def ensure_ext(filepath, ext, case_sensitive=False):
|
|||||||
return filepath + ext
|
return filepath + ext
|
||||||
|
|
||||||
|
|
||||||
def module_names(path, recursive=False):
|
def module_names(path, *, recursive=False):
|
||||||
"""
|
"""
|
||||||
Return a list of modules which can be imported from *path*.
|
Return a list of modules which can be imported from *path*.
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ def module_names(path, recursive=False):
|
|||||||
if isfile(fullpath):
|
if isfile(fullpath):
|
||||||
modules.append((filename, fullpath))
|
modules.append((filename, fullpath))
|
||||||
if recursive:
|
if recursive:
|
||||||
for mod_name, mod_path in module_names(directory, True):
|
for mod_name, mod_path in module_names(directory, recursive=True):
|
||||||
modules.append(("%s.%s" % (filename, mod_name),
|
modules.append(("%s.%s" % (filename, mod_name),
|
||||||
mod_path,
|
mod_path,
|
||||||
))
|
))
|
||||||
|
@ -81,7 +81,7 @@ _script_module_dirs = "startup", "modules"
|
|||||||
_is_factory_startup = _bpy.app.factory_startup
|
_is_factory_startup = _bpy.app.factory_startup
|
||||||
|
|
||||||
|
|
||||||
def execfile(filepath, mod=None):
|
def execfile(filepath, *, mod=None):
|
||||||
"""
|
"""
|
||||||
Execute a file path as a Python script.
|
Execute a file path as a Python script.
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ _global_loaded_modules = [] # store loaded module names for reloading.
|
|||||||
import bpy_types as _bpy_types # keep for comparisons, never ever reload this.
|
import bpy_types as _bpy_types # keep for comparisons, never ever reload this.
|
||||||
|
|
||||||
|
|
||||||
def load_scripts(reload_scripts=False, refresh_scripts=False):
|
def load_scripts(*, reload_scripts=False, refresh_scripts=False):
|
||||||
"""
|
"""
|
||||||
Load scripts and run each modules register function.
|
Load scripts and run each modules register function.
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ def script_path_pref():
|
|||||||
return _os.path.normpath(path) if path else None
|
return _os.path.normpath(path) if path else None
|
||||||
|
|
||||||
|
|
||||||
def script_paths(subdir=None, user_pref=True, check_all=False, use_user=True):
|
def script_paths(*, subdir=None, user_pref=True, check_all=False, use_user=True):
|
||||||
"""
|
"""
|
||||||
Returns a list of valid script paths.
|
Returns a list of valid script paths.
|
||||||
|
|
||||||
@ -446,16 +446,16 @@ def refresh_script_paths():
|
|||||||
_sys_path_ensure_append(path)
|
_sys_path_ensure_append(path)
|
||||||
|
|
||||||
|
|
||||||
def app_template_paths(subdir=None):
|
def app_template_paths(*, path=None):
|
||||||
"""
|
"""
|
||||||
Returns valid application template paths.
|
Returns valid application template paths.
|
||||||
|
|
||||||
:arg subdir: Optional subdir.
|
:arg path: Optional subdir.
|
||||||
:type subdir: string
|
:type path: string
|
||||||
:return: app template paths.
|
:return: app template paths.
|
||||||
:rtype: generator
|
:rtype: generator
|
||||||
"""
|
"""
|
||||||
subdir_args = (subdir,) if subdir is not None else ()
|
subdir_args = (path,) if path is not None else ()
|
||||||
# Note: keep in sync with: Blender's 'BKE_appdir_app_template_any'.
|
# Note: keep in sync with: Blender's 'BKE_appdir_app_template_any'.
|
||||||
# Uses 'BLENDER_USER_SCRIPTS', 'BLENDER_SYSTEM_SCRIPTS'
|
# Uses 'BLENDER_USER_SCRIPTS', 'BLENDER_SYSTEM_SCRIPTS'
|
||||||
# ... in this case 'system' accounts for 'local' too.
|
# ... in this case 'system' accounts for 'local' too.
|
||||||
@ -463,9 +463,9 @@ def app_template_paths(subdir=None):
|
|||||||
(_user_resource, "bl_app_templates_user"),
|
(_user_resource, "bl_app_templates_user"),
|
||||||
(system_resource, "bl_app_templates_system"),
|
(system_resource, "bl_app_templates_system"),
|
||||||
):
|
):
|
||||||
path = resource_fn('SCRIPTS', _os.path.join("startup", module_name, *subdir_args))
|
path_test = resource_fn('SCRIPTS', path=_os.path.join("startup", module_name, *subdir_args))
|
||||||
if path and _os.path.isdir(path):
|
if path_test and _os.path.isdir(path_test):
|
||||||
yield path
|
yield path_test
|
||||||
|
|
||||||
|
|
||||||
def preset_paths(subdir):
|
def preset_paths(subdir):
|
||||||
@ -478,7 +478,7 @@ def preset_paths(subdir):
|
|||||||
:rtype: list
|
:rtype: list
|
||||||
"""
|
"""
|
||||||
dirs = []
|
dirs = []
|
||||||
for path in script_paths("presets", check_all=True):
|
for path in script_paths(subdir="presets", check_all=True):
|
||||||
directory = _os.path.join(path, subdir)
|
directory = _os.path.join(path, subdir)
|
||||||
if not directory.startswith(path):
|
if not directory.startswith(path):
|
||||||
raise Exception("invalid subdir given %r" % subdir)
|
raise Exception("invalid subdir given %r" % subdir)
|
||||||
@ -532,7 +532,7 @@ def is_path_builtin(path):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def smpte_from_seconds(time, fps=None, fps_base=None):
|
def smpte_from_seconds(time, *, fps=None, fps_base=None):
|
||||||
"""
|
"""
|
||||||
Returns an SMPTE formatted string from the *time*:
|
Returns an SMPTE formatted string from the *time*:
|
||||||
``HH:MM:SS:FF``.
|
``HH:MM:SS:FF``.
|
||||||
@ -552,7 +552,7 @@ def smpte_from_seconds(time, fps=None, fps_base=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def smpte_from_frame(frame, fps=None, fps_base=None):
|
def smpte_from_frame(frame, *, fps=None, fps_base=None):
|
||||||
"""
|
"""
|
||||||
Returns an SMPTE formatted string from the *frame*:
|
Returns an SMPTE formatted string from the *frame*:
|
||||||
``HH:MM:SS:FF``.
|
``HH:MM:SS:FF``.
|
||||||
@ -585,7 +585,7 @@ def smpte_from_frame(frame, fps=None, fps_base=None):
|
|||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
def time_from_frame(frame, fps=None, fps_base=None):
|
def time_from_frame(frame, *, fps=None, fps_base=None):
|
||||||
"""
|
"""
|
||||||
Returns the time from a frame number .
|
Returns the time from a frame number .
|
||||||
|
|
||||||
@ -610,7 +610,7 @@ def time_from_frame(frame, fps=None, fps_base=None):
|
|||||||
return timedelta(0, frame / fps)
|
return timedelta(0, frame / fps)
|
||||||
|
|
||||||
|
|
||||||
def time_to_frame(time, fps=None, fps_base=None):
|
def time_to_frame(time, *, fps=None, fps_base=None):
|
||||||
"""
|
"""
|
||||||
Returns a float frame number from a time given in seconds or
|
Returns a float frame number from a time given in seconds or
|
||||||
as a datetime.timedelta object.
|
as a datetime.timedelta object.
|
||||||
@ -639,7 +639,7 @@ def time_to_frame(time, fps=None, fps_base=None):
|
|||||||
return time * fps
|
return time * fps
|
||||||
|
|
||||||
|
|
||||||
def preset_find(name, preset_path, display_name=False, ext=".py"):
|
def preset_find(name, preset_path, *, display_name=False, ext=".py"):
|
||||||
if not name:
|
if not name:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -676,7 +676,7 @@ def keyconfig_init():
|
|||||||
keyconfig_set(filepath)
|
keyconfig_set(filepath)
|
||||||
|
|
||||||
|
|
||||||
def keyconfig_set(filepath, report=None):
|
def keyconfig_set(filepath, *, report=None):
|
||||||
from os.path import basename, splitext
|
from os.path import basename, splitext
|
||||||
|
|
||||||
if _bpy.app.debug_python:
|
if _bpy.app.debug_python:
|
||||||
@ -712,14 +712,14 @@ def keyconfig_set(filepath, report=None):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def user_resource(resource_type, path="", create=False):
|
def user_resource(resource_type, *, path="", create=False):
|
||||||
"""
|
"""
|
||||||
Return a user resource path (normally from the users home directory).
|
Return a user resource path (normally from the users home directory).
|
||||||
|
|
||||||
:arg type: Resource type in ['DATAFILES', 'CONFIG', 'SCRIPTS', 'AUTOSAVE'].
|
:arg type: Resource type in ['DATAFILES', 'CONFIG', 'SCRIPTS', 'AUTOSAVE'].
|
||||||
:type type: string
|
:type type: string
|
||||||
:arg subdir: Optional subdirectory.
|
:arg path: Optional subdirectory.
|
||||||
:type subdir: string
|
:type path: string
|
||||||
:arg create: Treat the path as a directory and create
|
:arg create: Treat the path as a directory and create
|
||||||
it if its not existing.
|
it if its not existing.
|
||||||
:type create: boolean
|
:type create: boolean
|
||||||
@ -727,7 +727,7 @@ def user_resource(resource_type, path="", create=False):
|
|||||||
:rtype: string
|
:rtype: string
|
||||||
"""
|
"""
|
||||||
|
|
||||||
target_path = _user_resource(resource_type, path)
|
target_path = _user_resource(resource_type, path=path)
|
||||||
|
|
||||||
if create:
|
if create:
|
||||||
# should always be true.
|
# should always be true.
|
||||||
|
@ -447,7 +447,7 @@ def path_reference(
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
is_relative = filepath.startswith("//")
|
is_relative = filepath.startswith("//")
|
||||||
filepath_abs = bpy.path.abspath(filepath, base_src, library)
|
filepath_abs = bpy.path.abspath(filepath, start=base_src, library=library)
|
||||||
filepath_abs = os.path.normpath(filepath_abs)
|
filepath_abs = os.path.normpath(filepath_abs)
|
||||||
|
|
||||||
if mode in {'ABSOLUTE', 'RELATIVE', 'STRIP'}:
|
if mode in {'ABSOLUTE', 'RELATIVE', 'STRIP'}:
|
||||||
|
@ -64,7 +64,7 @@ def region_2d_to_vector_3d(region, rv3d, coord):
|
|||||||
return view_vector
|
return view_vector
|
||||||
|
|
||||||
|
|
||||||
def region_2d_to_origin_3d(region, rv3d, coord, clamp=None):
|
def region_2d_to_origin_3d(region, rv3d, coord, *, clamp=None):
|
||||||
"""
|
"""
|
||||||
Return the 3d view origin from the region relative 2d coords.
|
Return the 3d view origin from the region relative 2d coords.
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ def region_2d_to_location_3d(region, rv3d, coord, depth_location):
|
|||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
|
|
||||||
def location_3d_to_region_2d(region, rv3d, coord, default=None):
|
def location_3d_to_region_2d(region, rv3d, coord, *, default=None):
|
||||||
"""
|
"""
|
||||||
Return the *region* relative 2d location of a 3d position.
|
Return the *region* relative 2d location of a 3d position.
|
||||||
|
|
||||||
|
@ -150,7 +150,11 @@ class Object(bpy_types.ID):
|
|||||||
class WindowManager(bpy_types.ID):
|
class WindowManager(bpy_types.ID):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
def popup_menu(self, draw_func, title="", icon='NONE'):
|
def popup_menu(
|
||||||
|
self, draw_func, *,
|
||||||
|
title="",
|
||||||
|
icon='NONE',
|
||||||
|
):
|
||||||
import bpy
|
import bpy
|
||||||
popup = self.popmenu_begin__internal(title, icon=icon)
|
popup = self.popmenu_begin__internal(title, icon=icon)
|
||||||
|
|
||||||
@ -176,7 +180,11 @@ class WindowManager(bpy_types.ID):
|
|||||||
finally:
|
finally:
|
||||||
self.popover_end__internal(popup, keymap=keymap)
|
self.popover_end__internal(popup, keymap=keymap)
|
||||||
|
|
||||||
def popup_menu_pie(self, event, draw_func, title="", icon='NONE'):
|
def popup_menu_pie(
|
||||||
|
self, event, draw_func, *,
|
||||||
|
title="",
|
||||||
|
icon='NONE',
|
||||||
|
):
|
||||||
import bpy
|
import bpy
|
||||||
pie = self.piemenu_begin__internal(title, icon=icon, event=event)
|
pie = self.piemenu_begin__internal(title, icon=icon, event=event)
|
||||||
|
|
||||||
@ -392,7 +400,7 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):
|
|||||||
self.tail = self.head + vec
|
self.tail = self.head + vec
|
||||||
self.roll = other.roll
|
self.roll = other.roll
|
||||||
|
|
||||||
def transform(self, matrix, scale=True, roll=True):
|
def transform(self, matrix, *, scale=True, roll=True):
|
||||||
"""
|
"""
|
||||||
Transform the the bones head, tail, roll and envelope
|
Transform the the bones head, tail, roll and envelope
|
||||||
(when the matrix has a scale component).
|
(when the matrix has a scale component).
|
||||||
@ -739,7 +747,7 @@ class Operator(StructRNA, metaclass=RNAMeta):
|
|||||||
return delattr(properties, attr)
|
return delattr(properties, attr)
|
||||||
return super().__delattr__(attr)
|
return super().__delattr__(attr)
|
||||||
|
|
||||||
def as_keywords(self, ignore=()):
|
def as_keywords(self, *, ignore=()):
|
||||||
"""Return a copy of the properties as a dictionary"""
|
"""Return a copy of the properties as a dictionary"""
|
||||||
ignore = ignore + ("rna_type",)
|
ignore = ignore + ("rna_type",)
|
||||||
return {attr: getattr(self, attr)
|
return {attr: getattr(self, attr)
|
||||||
|
@ -86,7 +86,7 @@ def get_doc(obj):
|
|||||||
return result and RE_EMPTY_LINE.sub('', result.rstrip()) or ''
|
return result and RE_EMPTY_LINE.sub('', result.rstrip()) or ''
|
||||||
|
|
||||||
|
|
||||||
def get_argspec(func, strip_self=True, doc=None, source=None):
|
def get_argspec(func, *, strip_self=True, doc=None, source=None):
|
||||||
"""Get argument specifications.
|
"""Get argument specifications.
|
||||||
|
|
||||||
:param strip_self: strip `self` from argspec
|
:param strip_self: strip `self` from argspec
|
||||||
|
@ -143,7 +143,7 @@ def complete(line):
|
|||||||
"""
|
"""
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
def try_import(mod, only_modules=False):
|
def try_import(mod, *, only_modules=False):
|
||||||
|
|
||||||
def is_importable(module, attr):
|
def is_importable(module, attr):
|
||||||
if only_modules:
|
if only_modules:
|
||||||
@ -184,7 +184,7 @@ def complete(line):
|
|||||||
mod = words[1].split('.')
|
mod = words[1].split('.')
|
||||||
if len(mod) < 2:
|
if len(mod) < 2:
|
||||||
return filter_prefix(get_root_modules(), words[-1])
|
return filter_prefix(get_root_modules(), words[-1])
|
||||||
completion_list = try_import('.'.join(mod[:-1]), True)
|
completion_list = try_import('.'.join(mod[:-1]), only_modules=True)
|
||||||
completion_list = ['.'.join(mod[:-1] + [el]) for el in completion_list]
|
completion_list = ['.'.join(mod[:-1] + [el]) for el in completion_list]
|
||||||
return filter_prefix(completion_list, words[-1])
|
return filter_prefix(completion_list, words[-1])
|
||||||
if len(words) >= 3 and words[0] == 'from':
|
if len(words) >= 3 and words[0] == 'from':
|
||||||
|
@ -62,7 +62,7 @@ def complete_names(word, namespace):
|
|||||||
return sorted(set(completer.matches))
|
return sorted(set(completer.matches))
|
||||||
|
|
||||||
|
|
||||||
def complete_indices(word, namespace, obj=None, base=None):
|
def complete_indices(word, namespace, *, obj=None, base=None):
|
||||||
"""Complete a list or dictionary with its indices:
|
"""Complete a list or dictionary with its indices:
|
||||||
|
|
||||||
* integer numbers for list
|
* integer numbers for list
|
||||||
@ -117,7 +117,7 @@ def complete_indices(word, namespace, obj=None, base=None):
|
|||||||
return matches
|
return matches
|
||||||
|
|
||||||
|
|
||||||
def complete(word, namespace, private=True):
|
def complete(word, namespace, *, private=True):
|
||||||
"""Complete word within a namespace with the standard rlcompleter
|
"""Complete word within a namespace with the standard rlcompleter
|
||||||
module. Also supports index or key access [].
|
module. Also supports index or key access [].
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ def complete(word, namespace, private=True):
|
|||||||
# an extra char '[', '(' or '.' will be added
|
# an extra char '[', '(' or '.' will be added
|
||||||
if hasattr(obj, '__getitem__') and not is_struct_seq(obj):
|
if hasattr(obj, '__getitem__') and not is_struct_seq(obj):
|
||||||
# list or dictionary
|
# list or dictionary
|
||||||
matches = complete_indices(word, namespace, obj)
|
matches = complete_indices(word, namespace, obj=obj)
|
||||||
elif hasattr(obj, '__call__'):
|
elif hasattr(obj, '__call__'):
|
||||||
# callables
|
# callables
|
||||||
matches = [word + '(']
|
matches = [word + '(']
|
||||||
|
@ -87,7 +87,7 @@ def complete(line, cursor, namespace, private):
|
|||||||
matches.sort()
|
matches.sort()
|
||||||
else:
|
else:
|
||||||
from . import complete_namespace
|
from . import complete_namespace
|
||||||
matches = complete_namespace.complete(word, namespace, private)
|
matches = complete_namespace.complete(word, namespace, private=private)
|
||||||
else:
|
else:
|
||||||
# for now we don't have completers for strings
|
# for now we don't have completers for strings
|
||||||
# TODO: add file auto completer for strings
|
# TODO: add file auto completer for strings
|
||||||
@ -96,7 +96,7 @@ def complete(line, cursor, namespace, private):
|
|||||||
return matches, word
|
return matches, word
|
||||||
|
|
||||||
|
|
||||||
def expand(line, cursor, namespace, private=True):
|
def expand(line, cursor, namespace, *, private=True):
|
||||||
"""This method is invoked when the user asks autocompletion,
|
"""This method is invoked when the user asks autocompletion,
|
||||||
e.g. when Ctrl+Space is clicked.
|
e.g. when Ctrl+Space is clicked.
|
||||||
|
|
||||||
@ -150,5 +150,5 @@ def expand(line, cursor, namespace, private=True):
|
|||||||
line = line[:cursor] + prefix + line[cursor:]
|
line = line[:cursor] + prefix + line[cursor:]
|
||||||
cursor += len(prefix.encode('utf-8'))
|
cursor += len(prefix.encode('utf-8'))
|
||||||
if no_calltip and prefix.endswith('('):
|
if no_calltip and prefix.endswith('('):
|
||||||
return expand(line, cursor, namespace, private)
|
return expand(line, cursor, namespace, private=private)
|
||||||
return line, cursor, scrollback
|
return line, cursor, scrollback
|
||||||
|
@ -21,7 +21,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def batch_for_shader(shader, type, content, indices=None):
|
def batch_for_shader(shader, type, content, *, indices=None):
|
||||||
"""
|
"""
|
||||||
Return a batch already configured and compatible with the shader.
|
Return a batch already configured and compatible with the shader.
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
def draw_circle_2d(position, color, radius, segments=32):
|
def draw_circle_2d(position, color, radius, *, segments=32):
|
||||||
"""
|
"""
|
||||||
Draw a circle.
|
Draw a circle.
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class NodeCategory:
|
|||||||
def poll(cls, _context):
|
def poll(cls, _context):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def __init__(self, identifier, name, description="", items=None):
|
def __init__(self, identifier, name, *, description="", items=None):
|
||||||
self.identifier = identifier
|
self.identifier = identifier
|
||||||
self.name = name
|
self.name = name
|
||||||
self.description = description
|
self.description = description
|
||||||
@ -43,7 +43,7 @@ class NodeCategory:
|
|||||||
|
|
||||||
|
|
||||||
class NodeItem:
|
class NodeItem:
|
||||||
def __init__(self, nodetype, label=None, settings=None, poll=None):
|
def __init__(self, nodetype, *, label=None, settings=None, poll=None):
|
||||||
|
|
||||||
if settings is None:
|
if settings is None:
|
||||||
settings = {}
|
settings = {}
|
||||||
@ -92,7 +92,7 @@ class NodeItem:
|
|||||||
|
|
||||||
|
|
||||||
class NodeItemCustom:
|
class NodeItemCustom:
|
||||||
def __init__(self, poll=None, draw=None):
|
def __init__(self, *, poll=None, draw=None):
|
||||||
self.poll = poll
|
self.poll = poll
|
||||||
self.draw = draw
|
self.draw = draw
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ ARRAY_TYPES = (list, tuple, IDPropertyArray, Vector)
|
|||||||
MAX_DISPLAY_ROWS = 4
|
MAX_DISPLAY_ROWS = 4
|
||||||
|
|
||||||
|
|
||||||
def rna_idprop_ui_get(item, create=True):
|
def rna_idprop_ui_get(item, *, create=True):
|
||||||
try:
|
try:
|
||||||
return item['_RNA_UI']
|
return item['_RNA_UI']
|
||||||
except:
|
except:
|
||||||
@ -59,9 +59,9 @@ def rna_idprop_ui_prop_update(item, prop):
|
|||||||
prop_rna.update()
|
prop_rna.update()
|
||||||
|
|
||||||
|
|
||||||
def rna_idprop_ui_prop_get(item, prop, create=True):
|
def rna_idprop_ui_prop_get(item, prop, *, create=True):
|
||||||
|
|
||||||
rna_ui = rna_idprop_ui_get(item, create)
|
rna_ui = rna_idprop_ui_get(item, create=create)
|
||||||
|
|
||||||
if rna_ui is None:
|
if rna_ui is None:
|
||||||
return None
|
return None
|
||||||
@ -73,8 +73,8 @@ def rna_idprop_ui_prop_get(item, prop, create=True):
|
|||||||
return rna_ui[prop]
|
return rna_ui[prop]
|
||||||
|
|
||||||
|
|
||||||
def rna_idprop_ui_prop_clear(item, prop, remove=True):
|
def rna_idprop_ui_prop_clear(item, prop, *, remove=True):
|
||||||
rna_ui = rna_idprop_ui_get(item, False)
|
rna_ui = rna_idprop_ui_get(item, create=False)
|
||||||
|
|
||||||
if rna_ui is None:
|
if rna_ui is None:
|
||||||
return
|
return
|
||||||
@ -143,7 +143,7 @@ def rna_idprop_ui_prop_default_set(item, prop, value):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if defvalue:
|
if defvalue:
|
||||||
rna_ui = rna_idprop_ui_prop_get(item, prop, True)
|
rna_ui = rna_idprop_ui_prop_get(item, prop, create=True)
|
||||||
rna_ui["default"] = defvalue
|
rna_ui["default"] = defvalue
|
||||||
else:
|
else:
|
||||||
rna_ui = rna_idprop_ui_prop_get(item, prop)
|
rna_ui = rna_idprop_ui_prop_get(item, prop)
|
||||||
@ -181,7 +181,7 @@ def rna_idprop_ui_create(
|
|||||||
rna_idprop_ui_prop_update(item, prop)
|
rna_idprop_ui_prop_update(item, prop)
|
||||||
|
|
||||||
# Clear the UI settings
|
# Clear the UI settings
|
||||||
rna_ui_group = rna_idprop_ui_get(item, True)
|
rna_ui_group = rna_idprop_ui_get(item, create=True)
|
||||||
rna_ui_group[prop] = {}
|
rna_ui_group[prop] = {}
|
||||||
rna_ui = rna_ui_group[prop]
|
rna_ui = rna_ui_group[prop]
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ def rna_idprop_ui_create(
|
|||||||
return rna_ui
|
return rna_ui
|
||||||
|
|
||||||
|
|
||||||
def draw(layout, context, context_member, property_type, use_edit=True):
|
def draw(layout, context, context_member, property_type, *, use_edit=True):
|
||||||
|
|
||||||
def assign_props(prop, val, key):
|
def assign_props(prop, val, key):
|
||||||
prop.data_path = context_member
|
prop.data_path = context_member
|
||||||
|
@ -245,7 +245,8 @@ def rna2xml(
|
|||||||
fw("%s</%s>\n" % (root_ident, root_node))
|
fw("%s</%s>\n" % (root_ident, root_node))
|
||||||
|
|
||||||
|
|
||||||
def xml2rna(root_xml,
|
def xml2rna(
|
||||||
|
root_xml, *,
|
||||||
root_rna=None, # must be set
|
root_rna=None, # must be set
|
||||||
):
|
):
|
||||||
|
|
||||||
@ -394,7 +395,7 @@ def xml_file_run(context, filepath, rna_map):
|
|||||||
xml2rna(xml_node, root_rna=value)
|
xml2rna(xml_node, root_rna=value)
|
||||||
|
|
||||||
|
|
||||||
def xml_file_write(context, filepath, rna_map, skip_typemap=None):
|
def xml_file_write(context, filepath, rna_map, *, skip_typemap=None):
|
||||||
|
|
||||||
file = open(filepath, "w", encoding="utf-8")
|
file = open(filepath, "w", encoding="utf-8")
|
||||||
fw = file.write
|
fw = file.write
|
||||||
|
@ -219,7 +219,7 @@ class MeshSelectNext(Operator):
|
|||||||
|
|
||||||
if find_adjacent.select_next(bm, self.report):
|
if find_adjacent.select_next(bm, self.report):
|
||||||
bm.select_flush_mode()
|
bm.select_flush_mode()
|
||||||
bmesh.update_edit_mesh(me, False)
|
bmesh.update_edit_mesh(me, loop_triangles=False)
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ class MeshSelectPrev(Operator):
|
|||||||
|
|
||||||
if find_adjacent.select_prev(bm, self.report):
|
if find_adjacent.select_prev(bm, self.report):
|
||||||
bm.select_flush_mode()
|
bm.select_flush_mode()
|
||||||
bmesh.update_edit_mesh(me, False)
|
bmesh.update_edit_mesh(me, loop_triangles=False)
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
@ -114,9 +114,7 @@ class AddPresetBase:
|
|||||||
filename = self.as_filename(name)
|
filename = self.as_filename(name)
|
||||||
|
|
||||||
target_path = os.path.join("presets", self.preset_subdir)
|
target_path = os.path.join("presets", self.preset_subdir)
|
||||||
target_path = bpy.utils.user_resource('SCRIPTS',
|
target_path = bpy.utils.user_resource('SCRIPTS', path=target_path, create=True)
|
||||||
target_path,
|
|
||||||
create=True)
|
|
||||||
|
|
||||||
if not target_path:
|
if not target_path:
|
||||||
self.report({'WARNING'}, "Failed to create presets path")
|
self.report({'WARNING'}, "Failed to create presets path")
|
||||||
|
@ -90,7 +90,7 @@ class PREFERENCES_OT_copy_prev(Operator):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _old_version_path(cls, version):
|
def _old_version_path(cls, version):
|
||||||
return bpy.utils.resource_path('USER', version[0], version[1])
|
return bpy.utils.resource_path('USER', major=version[0], minor=version[1])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def previous_version(cls):
|
def previous_version(cls):
|
||||||
@ -226,7 +226,11 @@ class PREFERENCES_OT_keyconfig_import(Operator):
|
|||||||
|
|
||||||
config_name = basename(self.filepath)
|
config_name = basename(self.filepath)
|
||||||
|
|
||||||
path = bpy.utils.user_resource('SCRIPTS', os.path.join("presets", "keyconfig"), create=True)
|
path = bpy.utils.user_resource(
|
||||||
|
'SCRIPTS',
|
||||||
|
path=os.path.join("presets", "keyconfig"),
|
||||||
|
create=True,
|
||||||
|
)
|
||||||
path = os.path.join(path, config_name)
|
path = os.path.join(path, config_name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -529,7 +533,11 @@ class PREFERENCES_OT_theme_install(Operator):
|
|||||||
|
|
||||||
xmlfile = self.filepath
|
xmlfile = self.filepath
|
||||||
|
|
||||||
path_themes = bpy.utils.user_resource('SCRIPTS', "presets/interface_theme", create=True)
|
path_themes = bpy.utils.user_resource(
|
||||||
|
'SCRIPTS',
|
||||||
|
path=os.path.join("presets", "interface_theme"),
|
||||||
|
create=True,
|
||||||
|
)
|
||||||
|
|
||||||
if not path_themes:
|
if not path_themes:
|
||||||
self.report({'ERROR'}, "Failed to get themes path")
|
self.report({'ERROR'}, "Failed to get themes path")
|
||||||
@ -622,8 +630,8 @@ class PREFERENCES_OT_addon_install(Operator):
|
|||||||
pyfile = self.filepath
|
pyfile = self.filepath
|
||||||
|
|
||||||
if self.target == 'DEFAULT':
|
if self.target == 'DEFAULT':
|
||||||
# don't use bpy.utils.script_paths("addons") because we may not be able to write to it.
|
# Don't use `bpy.utils.script_paths(path="addons")` because we may not be able to write to it.
|
||||||
path_addons = bpy.utils.user_resource('SCRIPTS', "addons", create=True)
|
path_addons = bpy.utils.user_resource('SCRIPTS', path="addons", create=True)
|
||||||
else:
|
else:
|
||||||
path_addons = context.preferences.filepaths.script_directory
|
path_addons = context.preferences.filepaths.script_directory
|
||||||
if path_addons:
|
if path_addons:
|
||||||
@ -882,7 +890,8 @@ class PREFERENCES_OT_app_template_install(Operator):
|
|||||||
filepath = self.filepath
|
filepath = self.filepath
|
||||||
|
|
||||||
path_app_templates = bpy.utils.user_resource(
|
path_app_templates = bpy.utils.user_resource(
|
||||||
'SCRIPTS', os.path.join("startup", "bl_app_templates_user"),
|
'SCRIPTS',
|
||||||
|
path=os.path.join("startup", "bl_app_templates_user"),
|
||||||
create=True,
|
create=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -988,7 +997,7 @@ class PREFERENCES_OT_studiolight_install(Operator):
|
|||||||
prefs = context.preferences
|
prefs = context.preferences
|
||||||
|
|
||||||
path_studiolights = os.path.join("studiolights", self.type.lower())
|
path_studiolights = os.path.join("studiolights", self.type.lower())
|
||||||
path_studiolights = bpy.utils.user_resource('DATAFILES', path_studiolights, create=True)
|
path_studiolights = bpy.utils.user_resource('DATAFILES', path=path_studiolights, create=True)
|
||||||
if not path_studiolights:
|
if not path_studiolights:
|
||||||
self.report({'ERROR'}, "Failed to create Studio Light path")
|
self.report({'ERROR'}, "Failed to create Studio Light path")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
@ -1034,7 +1043,11 @@ class PREFERENCES_OT_studiolight_new(Operator):
|
|||||||
wm = context.window_manager
|
wm = context.window_manager
|
||||||
filename = bpy.path.ensure_ext(self.filename, ".sl")
|
filename = bpy.path.ensure_ext(self.filename, ".sl")
|
||||||
|
|
||||||
path_studiolights = bpy.utils.user_resource('DATAFILES', os.path.join("studiolights", "studio"), create=True)
|
path_studiolights = bpy.utils.user_resource(
|
||||||
|
'DATAFILES',
|
||||||
|
path=os.path.join("studiolights", "studio"),
|
||||||
|
create=True,
|
||||||
|
)
|
||||||
if not path_studiolights:
|
if not path_studiolights:
|
||||||
self.report({'ERROR'}, "Failed to get Studio Light path")
|
self.report({'ERROR'}, "Failed to get Studio Light path")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
@ -223,7 +223,7 @@ def extend(obj, EXTEND_MODE):
|
|||||||
for f_triple in walk_face(f_act):
|
for f_triple in walk_face(f_act):
|
||||||
apply_uv(*f_triple)
|
apply_uv(*f_triple)
|
||||||
|
|
||||||
bmesh.update_edit_mesh(me, False)
|
bmesh.update_edit_mesh(me, loop_triangles=False)
|
||||||
return STATUS_OK
|
return STATUS_OK
|
||||||
|
|
||||||
|
|
||||||
|
@ -1100,7 +1100,7 @@ class WM_OT_path_open(Operator):
|
|||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
def _wm_doc_get_id(doc_id, do_url=True, url_prefix="", report=None):
|
def _wm_doc_get_id(doc_id, *, do_url=True, url_prefix="", report=None):
|
||||||
|
|
||||||
def operator_exists_pair(a, b):
|
def operator_exists_pair(a, b):
|
||||||
# Not fast, this is only for docs.
|
# Not fast, this is only for docs.
|
||||||
@ -1190,7 +1190,7 @@ class WM_OT_doc_view_manual(Operator):
|
|||||||
doc_id: doc_id
|
doc_id: doc_id
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _find_reference(rna_id, url_mapping, verbose=True):
|
def _find_reference(rna_id, url_mapping, *, verbose=True):
|
||||||
if verbose:
|
if verbose:
|
||||||
print("online manual check for: '%s'... " % rna_id)
|
print("online manual check for: '%s'... " % rna_id)
|
||||||
from fnmatch import fnmatchcase
|
from fnmatch import fnmatchcase
|
||||||
@ -1526,7 +1526,7 @@ class WM_OT_properties_edit(Operator):
|
|||||||
self.default = ""
|
self.default = ""
|
||||||
|
|
||||||
# setup defaults
|
# setup defaults
|
||||||
prop_ui = rna_idprop_ui_prop_get(item, prop, False) # don't create
|
prop_ui = rna_idprop_ui_prop_get(item, prop, create=False)
|
||||||
if prop_ui:
|
if prop_ui:
|
||||||
self.min = prop_ui.get("min", -1000000000)
|
self.min = prop_ui.get("min", -1000000000)
|
||||||
self.max = prop_ui.get("max", 1000000000)
|
self.max = prop_ui.get("max", 1000000000)
|
||||||
@ -1910,7 +1910,7 @@ class WM_OT_toolbar(Operator):
|
|||||||
return context.space_data is not None
|
return context.space_data is not None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def keymap_from_toolbar(context, space_type, use_fallback_keys=True, use_reset=True):
|
def keymap_from_toolbar(context, space_type, *, use_fallback_keys=True, use_reset=True):
|
||||||
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
|
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
|
||||||
from bl_keymap_utils import keymap_from_toolbar
|
from bl_keymap_utils import keymap_from_toolbar
|
||||||
|
|
||||||
@ -2211,7 +2211,7 @@ class WM_OT_batch_rename(Operator):
|
|||||||
actions: CollectionProperty(type=BatchRenameAction)
|
actions: CollectionProperty(type=BatchRenameAction)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _data_from_context(context, data_type, only_selected, check_context=False):
|
def _data_from_context(context, data_type, only_selected, *, check_context=False):
|
||||||
|
|
||||||
mode = context.mode
|
mode = context.mode
|
||||||
scene = context.scene
|
scene = context.scene
|
||||||
|
@ -284,7 +284,7 @@ class TEXT_MT_templates_py(Menu):
|
|||||||
|
|
||||||
def draw(self, _context):
|
def draw(self, _context):
|
||||||
self.path_menu(
|
self.path_menu(
|
||||||
bpy.utils.script_paths("templates_py"),
|
bpy.utils.script_paths(subdir="templates_py"),
|
||||||
"text.open",
|
"text.open",
|
||||||
props_default={"internal": True},
|
props_default={"internal": True},
|
||||||
filter_ext=lambda ext: (ext.lower() == ".py")
|
filter_ext=lambda ext: (ext.lower() == ".py")
|
||||||
@ -296,7 +296,7 @@ class TEXT_MT_templates_osl(Menu):
|
|||||||
|
|
||||||
def draw(self, _context):
|
def draw(self, _context):
|
||||||
self.path_menu(
|
self.path_menu(
|
||||||
bpy.utils.script_paths("templates_osl"),
|
bpy.utils.script_paths(subdir="templates_osl"),
|
||||||
"text.open",
|
"text.open",
|
||||||
props_default={"internal": True},
|
props_default={"internal": True},
|
||||||
filter_ext=lambda ext: (ext.lower() == ".osl")
|
filter_ext=lambda ext: (ext.lower() == ".osl")
|
||||||
|
@ -218,7 +218,7 @@ class ToolSelectPanelHelper:
|
|||||||
assert(type(icon_name) is str)
|
assert(type(icon_name) is str)
|
||||||
icon_value = _icon_cache.get(icon_name)
|
icon_value = _icon_cache.get(icon_name)
|
||||||
if icon_value is None:
|
if icon_value is None:
|
||||||
dirname = bpy.utils.system_resource('DATAFILES', "icons")
|
dirname = bpy.utils.system_resource('DATAFILES', path="icons")
|
||||||
filename = os.path.join(dirname, icon_name + ".dat")
|
filename = os.path.join(dirname, icon_name + ".dat")
|
||||||
try:
|
try:
|
||||||
icon_value = bpy.app.icons.new_triangles_from_file(filename)
|
icon_value = bpy.app.icons.new_triangles_from_file(filename)
|
||||||
|
@ -434,7 +434,7 @@ class _defs_view3d_select:
|
|||||||
from gpu_extras.presets import draw_circle_2d
|
from gpu_extras.presets import draw_circle_2d
|
||||||
props = tool.operator_properties("view3d.select_circle")
|
props = tool.operator_properties("view3d.select_circle")
|
||||||
radius = props.radius
|
radius = props.radius
|
||||||
draw_circle_2d(xy, (1.0,) * 4, radius, 32)
|
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
||||||
|
|
||||||
return dict(
|
return dict(
|
||||||
idname="builtin.select_circle",
|
idname="builtin.select_circle",
|
||||||
@ -1813,7 +1813,7 @@ class _defs_image_uv_select:
|
|||||||
from gpu_extras.presets import draw_circle_2d
|
from gpu_extras.presets import draw_circle_2d
|
||||||
props = tool.operator_properties("uv.select_circle")
|
props = tool.operator_properties("uv.select_circle")
|
||||||
radius = props.radius
|
radius = props.radius
|
||||||
draw_circle_2d(xy, (1.0,) * 4, radius, 32)
|
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
||||||
|
|
||||||
return dict(
|
return dict(
|
||||||
idname="builtin.select_circle",
|
idname="builtin.select_circle",
|
||||||
@ -1858,7 +1858,7 @@ class _defs_image_uv_sculpt:
|
|||||||
if brush is None:
|
if brush is None:
|
||||||
return
|
return
|
||||||
radius = brush.size
|
radius = brush.size
|
||||||
draw_circle_2d(xy, (1.0,) * 4, radius, 32)
|
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
||||||
|
|
||||||
return generate_from_enum_ex(
|
return generate_from_enum_ex(
|
||||||
context,
|
context,
|
||||||
@ -2150,7 +2150,7 @@ class _defs_gpencil_edit:
|
|||||||
from gpu_extras.presets import draw_circle_2d
|
from gpu_extras.presets import draw_circle_2d
|
||||||
props = tool.operator_properties("gpencil.select_circle")
|
props = tool.operator_properties("gpencil.select_circle")
|
||||||
radius = props.radius
|
radius = props.radius
|
||||||
draw_circle_2d(xy, (1.0,) * 4, radius, 32)
|
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
||||||
|
|
||||||
return dict(
|
return dict(
|
||||||
idname="builtin.select_circle",
|
idname="builtin.select_circle",
|
||||||
@ -2372,7 +2372,7 @@ class _defs_node_select:
|
|||||||
from gpu_extras.presets import draw_circle_2d
|
from gpu_extras.presets import draw_circle_2d
|
||||||
props = tool.operator_properties("node.select_circle")
|
props = tool.operator_properties("node.select_circle")
|
||||||
radius = props.radius
|
radius = props.radius
|
||||||
draw_circle_2d(xy, (1.0,) * 4, radius, 32)
|
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
||||||
|
|
||||||
return dict(
|
return dict(
|
||||||
idname="builtin.select_circle",
|
idname="builtin.select_circle",
|
||||||
|
@ -1815,7 +1815,7 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
|
|||||||
addon_user_dirs = tuple(
|
addon_user_dirs = tuple(
|
||||||
p for p in (
|
p for p in (
|
||||||
os.path.join(prefs.filepaths.script_directory, "addons"),
|
os.path.join(prefs.filepaths.script_directory, "addons"),
|
||||||
bpy.utils.user_resource('SCRIPTS', "addons"),
|
bpy.utils.user_resource('SCRIPTS', path="addons"),
|
||||||
)
|
)
|
||||||
if p
|
if p
|
||||||
)
|
)
|
||||||
|
@ -7002,7 +7002,7 @@ class VIEW3D_PT_context_properties(Panel):
|
|||||||
|
|
||||||
if member:
|
if member:
|
||||||
# Draw with no edit button
|
# Draw with no edit button
|
||||||
rna_prop_ui.draw(self.layout, context, member, object, False)
|
rna_prop_ui.draw(self.layout, context, member, object, use_edit=False)
|
||||||
|
|
||||||
|
|
||||||
# Grease Pencil Object - Multiframe falloff tools
|
# Grease Pencil Object - Multiframe falloff tools
|
||||||
|
@ -34,7 +34,7 @@ class SortedNodeCategory(NodeCategory):
|
|||||||
if isinstance(items, list):
|
if isinstance(items, list):
|
||||||
items = sorted(items, key=lambda item: item.label.lower())
|
items = sorted(items, key=lambda item: item.label.lower())
|
||||||
|
|
||||||
super().__init__(identifier, name, description, items)
|
super().__init__(identifier, name, description=description, items=items)
|
||||||
|
|
||||||
|
|
||||||
class CompositorNodeCategory(SortedNodeCategory):
|
class CompositorNodeCategory(SortedNodeCategory):
|
||||||
|
@ -20,4 +20,4 @@ for v in bm.verts:
|
|||||||
|
|
||||||
# Show the updates in the viewport
|
# Show the updates in the viewport
|
||||||
# and recalculate n-gon tessellation.
|
# and recalculate n-gon tessellation.
|
||||||
bmesh.update_edit_mesh(me, True)
|
bmesh.update_edit_mesh(me, loop_triangles=True)
|
||||||
|
@ -125,7 +125,7 @@ static PyObject *bpy_bm_update_edit_mesh(PyObject *UNUSED(self), PyObject *args,
|
|||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args,
|
if (!PyArg_ParseTupleAndKeywords(args,
|
||||||
kw,
|
kw,
|
||||||
"O|O&O&:update_edit_mesh",
|
"O|$O&O&:update_edit_mesh",
|
||||||
(char **)kwlist,
|
(char **)kwlist,
|
||||||
&py_me,
|
&py_me,
|
||||||
PyC_ParseBool,
|
PyC_ParseBool,
|
||||||
|
@ -1103,7 +1103,7 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject
|
|||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args,
|
if (!PyArg_ParseTupleAndKeywords(args,
|
||||||
kw,
|
kw,
|
||||||
"OO|O&O&:from_object",
|
"OO|$O&O&:from_object",
|
||||||
(char **)kwlist,
|
(char **)kwlist,
|
||||||
&py_object,
|
&py_object,
|
||||||
&py_depsgraph,
|
&py_depsgraph,
|
||||||
@ -1204,7 +1204,7 @@ static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *
|
|||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args,
|
if (!PyArg_ParseTupleAndKeywords(args,
|
||||||
kw,
|
kw,
|
||||||
"O|O&O&i:from_mesh",
|
"O|$O&O&i:from_mesh",
|
||||||
(char **)kwlist,
|
(char **)kwlist,
|
||||||
&py_mesh,
|
&py_mesh,
|
||||||
PyC_ParseBool,
|
PyC_ParseBool,
|
||||||
@ -1304,7 +1304,7 @@ static PyObject *bpy_bmesh_transform(BPy_BMElem *self, PyObject *args, PyObject
|
|||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args,
|
if (!PyArg_ParseTupleAndKeywords(args,
|
||||||
kw,
|
kw,
|
||||||
"O!|O!:transform",
|
"O!|$O!:transform",
|
||||||
(char **)kwlist,
|
(char **)kwlist,
|
||||||
&matrix_Type,
|
&matrix_Type,
|
||||||
&mat,
|
&mat,
|
||||||
@ -1366,7 +1366,7 @@ static PyObject *bpy_bmesh_calc_volume(BPy_BMElem *self, PyObject *args, PyObjec
|
|||||||
BPY_BM_CHECK_OBJ(self);
|
BPY_BM_CHECK_OBJ(self);
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(
|
if (!PyArg_ParseTupleAndKeywords(
|
||||||
args, kw, "|O!:calc_volume", (char **)kwlist, &PyBool_Type, &is_signed)) {
|
args, kw, "|$O!:calc_volume", (char **)kwlist, &PyBool_Type, &is_signed)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1858,7 +1858,7 @@ static PyObject *bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw)
|
|||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args,
|
if (!PyArg_ParseTupleAndKeywords(args,
|
||||||
kw,
|
kw,
|
||||||
"|O&O&:BMFace.copy",
|
"|$O&O&:BMFace.copy",
|
||||||
(char **)kwlist,
|
(char **)kwlist,
|
||||||
PyC_ParseBool,
|
PyC_ParseBool,
|
||||||
&do_verts,
|
&do_verts,
|
||||||
@ -2654,7 +2654,7 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec
|
|||||||
if (args != NULL) {
|
if (args != NULL) {
|
||||||
if (!PyArg_ParseTupleAndKeywords(args,
|
if (!PyArg_ParseTupleAndKeywords(args,
|
||||||
kw,
|
kw,
|
||||||
"|OO&:BMElemSeq.sort",
|
"|$OO&:BMElemSeq.sort",
|
||||||
(char **)kwlist,
|
(char **)kwlist,
|
||||||
&keyfunc,
|
&keyfunc,
|
||||||
PyC_ParseBool,
|
PyC_ParseBool,
|
||||||
|
@ -450,7 +450,7 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args,
|
|||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args,
|
if (!PyArg_ParseTupleAndKeywords(args,
|
||||||
kw,
|
kw,
|
||||||
"O!O!O!|OO&O!:face_split",
|
"O!O!O!|$OO&O!:face_split",
|
||||||
(char **)kwlist,
|
(char **)kwlist,
|
||||||
&BPy_BMFace_Type,
|
&BPy_BMFace_Type,
|
||||||
&py_face,
|
&py_face,
|
||||||
|
@ -106,7 +106,7 @@ static PyObject *py_imbuf_resize(Py_ImBuf *self, PyObject *args, PyObject *kw)
|
|||||||
struct PyC_StringEnum method = {method_items, FAST};
|
struct PyC_StringEnum method = {method_items, FAST};
|
||||||
|
|
||||||
static const char *_keywords[] = {"size", "method", NULL};
|
static const char *_keywords[] = {"size", "method", NULL};
|
||||||
static _PyArg_Parser _parser = {"(ii)|O&:resize", _keywords, 0};
|
static _PyArg_Parser _parser = {"(ii)|$O&:resize", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(
|
if (!_PyArg_ParseTupleAndKeywordsFast(
|
||||||
args, kw, &_parser, &size[0], &size[1], PyC_ParseStringEnum, &method)) {
|
args, kw, &_parser, &size[0], &size[1], PyC_ParseStringEnum, &method)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -510,7 +510,7 @@ static PyObject *M_imbuf_write(PyObject *UNUSED(self), PyObject *args, PyObject
|
|||||||
const char *filepath = NULL;
|
const char *filepath = NULL;
|
||||||
|
|
||||||
static const char *_keywords[] = {"image", "filepath", NULL};
|
static const char *_keywords[] = {"image", "filepath", NULL};
|
||||||
static _PyArg_Parser _parser = {"O!|s:write", _keywords, 0};
|
static _PyArg_Parser _parser = {"O!|$s:write", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &Py_ImBuf_Type, &py_imb, &filepath)) {
|
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &Py_ImBuf_Type, &py_imb, &filepath)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ static PyObject *pygpu_offscreen_unbind(BPyGPUOffScreen *self, PyObject *args, P
|
|||||||
BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
|
BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
|
||||||
|
|
||||||
static const char *_keywords[] = {"restore", NULL};
|
static const char *_keywords[] = {"restore", NULL};
|
||||||
static _PyArg_Parser _parser = {"|O&:unbind", _keywords, 0};
|
static _PyArg_Parser _parser = {"|$O&:unbind", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, PyC_ParseBool, &restore)) {
|
if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, PyC_ParseBool, &restore)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
|
|||||||
bool local = false;
|
bool local = false;
|
||||||
|
|
||||||
static const char *_keywords[] = {"absolute", "packed", "local", NULL};
|
static const char *_keywords[] = {"absolute", "packed", "local", NULL};
|
||||||
static _PyArg_Parser _parser = {"|O&O&O&:blend_paths", _keywords, 0};
|
static _PyArg_Parser _parser = {"|$O&O&O&:blend_paths", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(args,
|
if (!_PyArg_ParseTupleAndKeywordsFast(args,
|
||||||
kw,
|
kw,
|
||||||
&_parser,
|
&_parser,
|
||||||
@ -164,8 +164,8 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
|
|||||||
|
|
||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
static const char *_keywords[] = {"type", "subdir", NULL};
|
static const char *_keywords[] = {"type", "path", NULL};
|
||||||
static _PyArg_Parser _parser = {"O&|s:user_resource", _keywords, 0};
|
static _PyArg_Parser _parser = {"O&|$s:user_resource", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, PyC_ParseStringEnum, &type, &subdir)) {
|
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, PyC_ParseStringEnum, &type, &subdir)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ static PyObject *bpy_system_resource(PyObject *UNUSED(self), PyObject *args, PyO
|
|||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
static const char *_keywords[] = {"type", "path", NULL};
|
static const char *_keywords[] = {"type", "path", NULL};
|
||||||
static _PyArg_Parser _parser = {"O&|s:system_resource", _keywords, 0};
|
static _PyArg_Parser _parser = {"O&|$s:system_resource", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, PyC_ParseStringEnum, &type, &subdir)) {
|
if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, PyC_ParseStringEnum, &type, &subdir)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj
|
|||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
static const char *_keywords[] = {"type", "major", "minor", NULL};
|
static const char *_keywords[] = {"type", "major", "minor", NULL};
|
||||||
static _PyArg_Parser _parser = {"O&|ii:resource_path", _keywords, 0};
|
static _PyArg_Parser _parser = {"O&|$ii:resource_path", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(
|
if (!_PyArg_ParseTupleAndKeywordsFast(
|
||||||
args, kw, &_parser, PyC_ParseStringEnum, &type, &major, &minor)) {
|
args, kw, &_parser, PyC_ParseStringEnum, &type, &major, &minor)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -195,7 +195,7 @@ static PyObject *bpy_lib_load(BPy_PropertyRNA *self, PyObject *args, PyObject *k
|
|||||||
bool is_rel = false, is_link = false, use_assets_only = false;
|
bool is_rel = false, is_link = false, use_assets_only = false;
|
||||||
|
|
||||||
static const char *_keywords[] = {"filepath", "link", "relative", "assets_only", NULL};
|
static const char *_keywords[] = {"filepath", "link", "relative", "assets_only", NULL};
|
||||||
static _PyArg_Parser _parser = {"s|O&O&O&:load", _keywords, 0};
|
static _PyArg_Parser _parser = {"s|$O&O&O&:load", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(args,
|
if (!_PyArg_ParseTupleAndKeywordsFast(args,
|
||||||
kw,
|
kw,
|
||||||
&_parser,
|
&_parser,
|
||||||
|
@ -245,7 +245,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject *UNUSED(self), PyObject *args
|
|||||||
"options",
|
"options",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
static _PyArg_Parser _parser = {"OOO!O|O!:subscribe_rna", _keywords, 0};
|
static _PyArg_Parser _parser = {"OOO!O|$O!:subscribe_rna", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(args,
|
if (!_PyArg_ParseTupleAndKeywordsFast(args,
|
||||||
kw,
|
kw,
|
||||||
&_parser,
|
&_parser,
|
||||||
|
@ -324,7 +324,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
|
|||||||
if (pyrna_struct_keyframe_parse(&self->ptr,
|
if (pyrna_struct_keyframe_parse(&self->ptr,
|
||||||
args,
|
args,
|
||||||
kw,
|
kw,
|
||||||
"s|ifsO!:bpy_struct.keyframe_insert()",
|
"s|$ifsO!:bpy_struct.keyframe_insert()",
|
||||||
"bpy_struct.keyframe_insert()",
|
"bpy_struct.keyframe_insert()",
|
||||||
&path_full,
|
&path_full,
|
||||||
&index,
|
&index,
|
||||||
@ -443,7 +443,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
|
|||||||
if (pyrna_struct_keyframe_parse(&self->ptr,
|
if (pyrna_struct_keyframe_parse(&self->ptr,
|
||||||
args,
|
args,
|
||||||
kw,
|
kw,
|
||||||
"s|ifsO!:bpy_struct.keyframe_delete()",
|
"s|$ifsO!:bpy_struct.keyframe_delete()",
|
||||||
"bpy_struct.keyframe_insert()",
|
"bpy_struct.keyframe_insert()",
|
||||||
&path_full,
|
&path_full,
|
||||||
&index,
|
&index,
|
||||||
|
@ -171,7 +171,7 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
|
|||||||
IDUserMapData data_cb = {NULL};
|
IDUserMapData data_cb = {NULL};
|
||||||
|
|
||||||
static const char *_keywords[] = {"subset", "key_types", "value_types", NULL};
|
static const char *_keywords[] = {"subset", "key_types", "value_types", NULL};
|
||||||
static _PyArg_Parser _parser = {"|O$O!O!:user_map", _keywords, 0};
|
static _PyArg_Parser _parser = {"|$OO!O!:user_map", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(
|
if (!_PyArg_ParseTupleAndKeywordsFast(
|
||||||
args, kwds, &_parser, &subset, &PySet_Type, &key_types, &PySet_Type, &val_types)) {
|
args, kwds, &_parser, &subset, &PySet_Type, &key_types, &PySet_Type, &val_types)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -183,7 +183,7 @@ static PyObject *bpyunits_to_value(PyObject *UNUSED(self), PyObject *args, PyObj
|
|||||||
"str_ref_unit",
|
"str_ref_unit",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
static _PyArg_Parser _parser = {"sss#|z:to_value", _keywords, 0};
|
static _PyArg_Parser _parser = {"sss#|$z:to_value", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(
|
if (!_PyArg_ParseTupleAndKeywordsFast(
|
||||||
args, kw, &_parser, &usys_str, &ucat_str, &inpt, &str_len, &uref)) {
|
args, kw, &_parser, &usys_str, &ucat_str, &inpt, &str_len, &uref)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -260,7 +260,7 @@ static PyObject *bpyunits_to_string(PyObject *UNUSED(self), PyObject *args, PyOb
|
|||||||
"compatible_unit",
|
"compatible_unit",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
static _PyArg_Parser _parser = {"ssd|iO&O&:to_string", _keywords, 0};
|
static _PyArg_Parser _parser = {"ssd|$iO&O&:to_string", _keywords, 0};
|
||||||
if (!_PyArg_ParseTupleAndKeywordsFast(args,
|
if (!_PyArg_ParseTupleAndKeywordsFast(args,
|
||||||
kw,
|
kw,
|
||||||
&_parser,
|
&_parser,
|
||||||
|
@ -222,7 +222,7 @@ static PyObject *py_kdtree_find(PyKDTree *self, PyObject *args, PyObject *kwargs
|
|||||||
const char *keywords[] = {"co", "filter", NULL};
|
const char *keywords[] = {"co", "filter", NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(
|
if (!PyArg_ParseTupleAndKeywords(
|
||||||
args, kwargs, "O|O:find", (char **)keywords, &py_co, &py_filter)) {
|
args, kwargs, "O|$O:find", (char **)keywords, &py_co, &py_filter)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@ def _init_addon_blacklist():
|
|||||||
|
|
||||||
|
|
||||||
def addon_modules_sorted():
|
def addon_modules_sorted():
|
||||||
modules = addon_utils.modules({})
|
# Pass in an empty module cache to prevent `addon_utils` local module cache being manipulated.
|
||||||
|
modules = addon_utils.modules(module_cache={})
|
||||||
modules[:] = [
|
modules[:] = [
|
||||||
mod for mod in modules
|
mod for mod in modules
|
||||||
if not (mod.__file__.startswith(BLACKLIST_DIRS))
|
if not (mod.__file__.startswith(BLACKLIST_DIRS))
|
||||||
|
@ -26,12 +26,12 @@ class TestBpyPath(unittest.TestCase):
|
|||||||
self.assertEqual(ensure_ext('', ''), '')
|
self.assertEqual(ensure_ext('', ''), '')
|
||||||
self.assertEqual(ensure_ext('', '.blend'), '.blend')
|
self.assertEqual(ensure_ext('', '.blend'), '.blend')
|
||||||
|
|
||||||
# Test case-sensitive behaviour.
|
# Test case-sensitive behavior.
|
||||||
self.assertEqual(ensure_ext('demo', '.blend', True), 'demo.blend')
|
self.assertEqual(ensure_ext('demo', '.blend', case_sensitive=True), 'demo.blend')
|
||||||
self.assertEqual(ensure_ext('demo.BLEND', '.blend', True), 'demo.BLEND.blend')
|
self.assertEqual(ensure_ext('demo.BLEND', '.blend', case_sensitive=True), 'demo.BLEND.blend')
|
||||||
self.assertEqual(ensure_ext('demo', 'Blend', True), 'demoBlend')
|
self.assertEqual(ensure_ext('demo', 'Blend', case_sensitive=True), 'demoBlend')
|
||||||
self.assertEqual(ensure_ext('demoBlend', 'blend', True), 'demoBlendblend')
|
self.assertEqual(ensure_ext('demoBlend', 'blend', case_sensitive=True), 'demoBlendblend')
|
||||||
self.assertEqual(ensure_ext('demo', '', True), 'demo')
|
self.assertEqual(ensure_ext('demo', '', case_sensitive=True), 'demo')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user