Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/modules')
-rw-r--r--release/scripts/modules/bl_app_template_utils.py6
-rw-r--r--release/scripts/modules/bl_i18n_utils/settings.py4
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils_spell_check.py7
-rw-r--r--release/scripts/modules/bpy/utils/__init__.py67
-rw-r--r--release/scripts/modules/keyingsets_utils.py2
-rw-r--r--release/scripts/modules/nodeitems_utils.py12
-rw-r--r--release/scripts/modules/rna_prop_ui.py5
-rw-r--r--release/scripts/modules/sys_info.py7
8 files changed, 89 insertions, 21 deletions
diff --git a/release/scripts/modules/bl_app_template_utils.py b/release/scripts/modules/bl_app_template_utils.py
index b3a4824aa7b..b81971b98b6 100644
--- a/release/scripts/modules/bl_app_template_utils.py
+++ b/release/scripts/modules/bl_app_template_utils.py
@@ -165,12 +165,10 @@ def import_from_id(template_id, ignore_not_found=False):
def activate(template_id=None):
template_id_prev = _app_template["id"]
- # not needed but may as well avoid activating same template
- # ... in fact keep this, it will show errors early on!
- """
+ # not needed but may as well avoids redundant
+ # disable/enable for all add-ons on 'File -> New'
if template_id_prev == template_id:
return
- """
if template_id_prev:
_disable(template_id_prev)
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index 07fc9f0c338..774ca5173d5 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -118,7 +118,7 @@ MSG_COMMENT_PREFIX = "#~ "
MSG_CONTEXT_PREFIX = "MSGCTXT:"
# The default comment prefix used in po's.
-PO_COMMENT_PREFIX= "# "
+PO_COMMENT_PREFIX = "# "
# The comment prefix used to mark sources of msgids, in po's.
PO_COMMENT_PREFIX_SOURCE = "#: "
@@ -130,7 +130,7 @@ PO_COMMENT_PREFIX_SOURCE_CUSTOM = "#. :src: "
PO_COMMENT_PREFIX_GENERATED = "#. "
# The comment prefix used to comment entries in po's.
-PO_COMMENT_PREFIX_MSG= "#~ "
+PO_COMMENT_PREFIX_MSG = "#~ "
# The comment prefix used to mark fuzzy msgids, in po's.
PO_COMMENT_FUZZY = "#, fuzzy"
diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
index 949678b2fc0..b33588c903b 100644
--- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
+++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
@@ -93,7 +93,7 @@ class SpellChecker:
"deadzone",
"deconstruct",
"defocus",
- "denoise",
+ "denoise", "denoising",
"deselect", "deselecting", "deselection",
"despill", "despilling",
"dirtree",
@@ -128,7 +128,7 @@ class SpellChecker:
"multisampling",
"multiscatter",
"multitexture",
- "multithreaded",
+ "multithreaded",
"multiuser",
"multiview",
"namespace",
@@ -357,6 +357,7 @@ class SpellChecker:
"bezier", "beziers",
"bicubic",
"bilinear",
+ "bindpose",
"binormal",
"blackpoint", "whitepoint",
"blinn",
@@ -364,6 +365,7 @@ class SpellChecker:
"catadioptric",
"centroid",
"chrominance",
+ "clearcoat",
"codec", "codecs",
"collada",
"compositing",
@@ -437,6 +439,7 @@ class SpellChecker:
"editmode",
"fcurve", "fcurves",
"fedge", "fedges",
+ "filmic",
"fluidsim",
"frameserver",
"freestyle",
diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py
index 1d555ae7123..6d3e807c2b4 100644
--- a/release/scripts/modules/bpy/utils/__init__.py
+++ b/release/scripts/modules/bpy/utils/__init__.py
@@ -37,6 +37,7 @@ __all__ = (
"register_module",
"register_manual_map",
"unregister_manual_map",
+ "register_submodule_factory",
"make_rna_paths",
"manual_map",
"previews",
@@ -71,6 +72,7 @@ import addon_utils as _addon_utils
_user_preferences = _bpy.context.user_preferences
_script_module_dirs = "startup", "modules"
+_is_factory_startup = _bpy.app.factory_startup
def _test_import(module_name, loaded_modules):
@@ -144,6 +146,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
:type refresh_scripts: bool
"""
use_time = use_class_register_check = _bpy.app.debug_python
+ use_user = not _is_factory_startup
if use_time:
import time
@@ -234,7 +237,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
from bpy_restrict_state import RestrictBlend
with RestrictBlend():
- for base_path in script_paths():
+ for base_path in script_paths(use_user=use_user):
for path_subdir in _script_module_dirs:
path = _os.path.join(base_path, path_subdir)
if _os.path.isdir(path):
@@ -306,7 +309,7 @@ def script_path_pref():
return _os.path.normpath(path) if path else None
-def script_paths(subdir=None, user_pref=True, check_all=False):
+def script_paths(subdir=None, user_pref=True, check_all=False, use_user=True):
"""
Returns a list of valid script paths.
@@ -330,13 +333,24 @@ def script_paths(subdir=None, user_pref=True, check_all=False):
if check_all:
# All possible paths, no duplicates, keep order.
+ if use_user:
+ test_paths = ('LOCAL', 'USER', 'SYSTEM')
+ else:
+ test_paths = ('LOCAL', 'SYSTEM')
+
base_paths = (
- *(path for path in (_os.path.join(resource_path(res), "scripts")
- for res in ('LOCAL', 'USER', 'SYSTEM')) if path not in base_paths),
+ *(path for path in (
+ _os.path.join(resource_path(res), "scripts")
+ for res in test_paths) if path not in base_paths),
*base_paths,
- )
+ )
+
+ if use_user:
+ test_paths = (*base_paths, script_path_user(), script_path_pref())
+ else:
+ test_paths = (*base_paths, script_path_pref())
- for path in (*base_paths, script_path_user(), script_path_pref()):
+ for path in test_paths:
if path:
path = _os.path.normpath(path)
if path not in scripts and _os.path.isdir(path):
@@ -684,6 +698,47 @@ def unregister_module(module, verbose=False):
print("done.\n")
+def register_submodule_factory(module_name, submodule_names):
+ """
+ Utility function to create register and unregister functions
+ which simply load submodules,
+ calling their register & unregister functions.
+
+ .. note::
+
+ Modules are registered in the order given,
+ unregistered in reverse order.
+
+ :arg module_name: The module name, typically ``__name__``.
+ :type module_name: string
+ :arg submodule_names: List of submodule names to load and unload.
+ :type submodule_names: list of strings
+ :return: register and unregister functions.
+ :rtype: tuple pair of functions
+ """
+
+ module = None
+ submodules = []
+
+ def register():
+ nonlocal module
+ module = __import__(name=module_name, fromlist=submodule_names)
+ submodules[:] = [getattr(module, name) for name in submodule_names]
+ for mod in submodules:
+ mod.register()
+
+ def unregister():
+ from sys import modules
+ for mod in reversed(submodules):
+ mod.unregister()
+ name = mod.__name__
+ delattr(module, name.partition(".")[2])
+ del modules[name]
+ submodules.clear()
+
+ return register, unregister
+
+
# -----------------------------------------------------------------------------
# Manual lookups, each function has to return a basepath and a sequence
# of...
diff --git a/release/scripts/modules/keyingsets_utils.py b/release/scripts/modules/keyingsets_utils.py
index 8cef64c3590..7ce5f3e029b 100644
--- a/release/scripts/modules/keyingsets_utils.py
+++ b/release/scripts/modules/keyingsets_utils.py
@@ -232,7 +232,7 @@ bbone_property_ids = (
"bbone_scalein",
"bbone_scaleout",
- # NOTE: These are in the nested bone struct
+ # NOTE: These are in the nested bone struct
# Do it this way to force them to be included
# in whatever actions are being keyed here
"bone.bbone_in",
diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py
index be6f031217c..904062c36cd 100644
--- a/release/scripts/modules/nodeitems_utils.py
+++ b/release/scripts/modules/nodeitems_utils.py
@@ -61,13 +61,19 @@ class NodeItem:
# if no custom label is defined, fall back to the node type UI name
return getattr(bpy.types, self.nodetype).bl_rna.name
+ @property
+ def translation_context(self):
+ if self._label:
+ return bpy.app.translations.contexts.default
+ else:
+ # if no custom label is defined, fall back to the node type UI name
+ return getattr(bpy.types, self.nodetype).bl_rna.translation_context
+
# NB: is a staticmethod because called with an explicit self argument
# NodeItemCustom sets this as a variable attribute in __init__
@staticmethod
def draw(self, layout, context):
- default_context = bpy.app.translations.contexts.default
-
- props = layout.operator("node.add_node", text=self.label, text_ctxt=default_context)
+ props = layout.operator("node.add_node", text=self.label, text_ctxt=self.translation_context)
props.type = self.nodetype
props.use_transform = True
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index c0d92c331b7..e50922593de 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -176,12 +176,11 @@ def draw(layout, context, context_member, property_type, use_edit=True):
if not is_rna:
props = row.operator("wm.properties_edit", text="Edit")
assign_props(props, val_draw, key)
+ props = row.operator("wm.properties_remove", text="", icon='ZOOMOUT')
+ assign_props(props, val_draw, key)
else:
row.label(text="API Defined")
- props = row.operator("wm.properties_remove", text="", icon='ZOOMOUT')
- assign_props(props, val_draw, key)
-
class PropertyPanel:
"""
diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py
index 5b81df28524..e447d8a4dc5 100644
--- a/release/scripts/modules/sys_info.py
+++ b/release/scripts/modules/sys_info.py
@@ -151,6 +151,13 @@ def write_sysinfo(filepath):
else:
output.write("Blender was built without Cycles support\n")
+ opensubdiv = bpy.app.opensubdiv
+ output.write("OpenSubdiv: ")
+ if opensubdiv.supported:
+ output.write("%s\n" % opensubdiv.version_string)
+ else:
+ output.write("Blender was built without OpenSubdiv support\n")
+
openvdb = bpy.app.openvdb
output.write("OpenVDB: ")
if openvdb.supported: