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:
authorCampbell Barton <ideasman42@gmail.com>2018-01-22 01:45:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-01-22 02:00:40 +0300
commitd9c962a367803134a3925c77d7d5c318339a01b9 (patch)
treebfe31fa0e0a0b093a03bd6fcabe57b56c81d0c46 /release
parenta841e65b850e40d10c1a86d2492c4dde7561e43f (diff)
Fix T53843: Error opening online manual
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_operators/wm.py71
1 files changed, 37 insertions, 34 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index f1f32233a42..c8c85837539 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -906,6 +906,15 @@ class WM_OT_path_open(Operator):
def _wm_doc_get_id(doc_id, do_url=True, url_prefix=""):
+
+ def operator_exists_pair(a, b):
+ # Not fast, this is only for docs.
+ return b in dir(getattr(bpy.ops, a))
+
+ def operator_exists_single(a):
+ a, b = a.partition("_OT_")[::2]
+ return operator_exists_pair(a.lower(), b)
+
id_split = doc_id.split(".")
url = rna = None
@@ -919,7 +928,18 @@ def _wm_doc_get_id(doc_id, do_url=True, url_prefix=""):
class_name, class_prop = id_split
# an operator (common case - just button referencing an op)
- if hasattr(bpy.types, class_name.upper() + "_OT_" + class_prop):
+ if operator_exists_pair(class_name, class_prop):
+ if do_url:
+ url = (
+ "%s/bpy.ops.%s.html#bpy.ops.%s.%s" %
+ (url_prefix, class_name, class_name, class_prop)
+ )
+ else:
+ rna = "bpy.ops.%s.%s" % (class_name, class_prop)
+ elif operator_exists_single(class_name):
+ # note: ignore the prop name since we don't have a way to link into it
+ class_name, class_prop = class_name.split("_OT_", 1)
+ class_name = class_name.lower()
if do_url:
url = (
"%s/bpy.ops.%s.html#bpy.ops.%s.%s" %
@@ -928,48 +948,31 @@ def _wm_doc_get_id(doc_id, do_url=True, url_prefix=""):
else:
rna = "bpy.ops.%s.%s" % (class_name, class_prop)
else:
+ # an RNA setting, common case
rna_class = getattr(bpy.types, class_name)
- # an operator setting (selected from a running operator), rare case
- # note: Py defined operators are subclass of Operator,
- # C defined operators are subclass of OperatorProperties.
- # we may need to check on this at some point.
- if issubclass(rna_class, (bpy.types.Operator, bpy.types.OperatorProperties)):
- # note: ignore the prop name since we don't have a way to link into it
- class_name, class_prop = class_name.split("_OT_", 1)
- class_name = class_name.lower()
+ # detect if this is a inherited member and use that name instead
+ rna_parent = rna_class.bl_rna
+ rna_prop = rna_parent.properties.get(class_prop)
+ if rna_prop:
+ rna_parent = rna_parent.base
+ while rna_parent and rna_prop == rna_parent.properties.get(class_prop):
+ class_name = rna_parent.identifier
+ rna_parent = rna_parent.base
+
if do_url:
url = (
- "%s/bpy.ops.%s.html#bpy.ops.%s.%s" %
+ "%s/bpy.types.%s.html#bpy.types.%s.%s" %
(url_prefix, class_name, class_name, class_prop)
)
else:
- rna = "bpy.ops.%s.%s" % (class_name, class_prop)
+ rna = "bpy.types.%s.%s" % (class_name, class_prop)
else:
- # an RNA setting, common case
-
- # detect if this is a inherited member and use that name instead
- rna_parent = rna_class.bl_rna
- rna_prop = rna_parent.properties.get(class_prop)
- if rna_prop:
- rna_parent = rna_parent.base
- while rna_parent and rna_prop == rna_parent.properties.get(class_prop):
- class_name = rna_parent.identifier
- rna_parent = rna_parent.base
-
- if do_url:
- url = (
- "%s/bpy.types.%s.html#bpy.types.%s.%s" %
- (url_prefix, class_name, class_name, class_prop)
- )
- else:
- rna = "bpy.types.%s.%s" % (class_name, class_prop)
+ # We assume this is custom property, only try to generate generic url/rna_id...
+ if do_url:
+ url = ("%s/bpy.types.bpy_struct.html#bpy.types.bpy_struct.items" % (url_prefix,))
else:
- # We assume this is custom property, only try to generate generic url/rna_id...
- if do_url:
- url = ("%s/bpy.types.bpy_struct.html#bpy.types.bpy_struct.items" % (url_prefix,))
- else:
- rna = "bpy.types.bpy_struct"
+ rna = "bpy.types.bpy_struct"
return url if do_url else rna