diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-13 12:59:15 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-13 12:59:15 +0300 |
commit | ff432a410a46da33203dfbf79ad49a37bc9310b3 (patch) | |
tree | cc844e2d08177b4d639c65e7fe254f84c3d101dc /release/scripts/modules | |
parent | 2be1d8bbafc8a3cedd4d2699ded260215bb07da2 (diff) |
PyAPI: use brief description for operator repr
Only include description in docstring.
Also avoid using op_get_rna.
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/bl_i18n_utils/bl_extract_messages.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/bpy/ops.py | 29 |
2 files changed, 12 insertions, 19 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py index dc4826288e3..764c42be1ef 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -545,7 +545,7 @@ def dump_py_messages_from_files(msgs, reports, files, settings): for n in opname.split('.'): op = getattr(op, n) try: - return op.get_rna().bl_rna.translation_context + return op.get_rna_type().translation_context except Exception as e: default_op_context = i18n_contexts.operator_default print("ERROR: ", str(e)) diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py index 028cce063ac..664dc79b28b 100644 --- a/release/scripts/modules/bpy/ops.py +++ b/release/scripts/modules/bpy/ops.py @@ -116,7 +116,16 @@ class BPyOpsSubModOp: __slots__ = ("_module", "_func") def _get_doc(self): - return op_as_string(self.idname()) + idname = self.idname() + sig = op_as_string(self.idname()) + # XXX You never quite know what you get from bpy.types, + # with operators... Operator and OperatorProperties + # are shadowing each other, and not in the same way for + # native ops and py ones! See T39158. + # op_class = getattr(bpy.types, idname) + op_class = op_get_rna_type(idname) + descr = op_class.description + return f"{sig}\n{descr}" @staticmethod def _parse_args(args): @@ -208,23 +217,7 @@ class BPyOpsSubModOp: def __repr__(self): # useful display, repr(op) # import bpy - idname = self.idname() - as_string = op_as_string(idname) - # XXX You never quite know what you get from bpy.types, - # with operators... Operator and OperatorProperties - # are shadowing each other, and not in the same way for - # native ops and py ones! See T39158. - # op_class = getattr(bpy.types, idname) - op_class = op_get_rna(idname) - descr = op_class.bl_rna.description - # XXX, workaround for not registering - # every __doc__ to save time on load. - if not descr: - descr = op_class.__doc__ - if not descr: - descr = "" - - return "# %s\n%s" % (descr, as_string) + return op_as_string(self.idname()) def __str__(self): # used for print(...) return ("<function bpy.ops.%s.%s at 0x%x'>" % |