5
$\begingroup$

I would like to use Blender's interactive help functionality for my custom operators, i.e. RMB an operator's button and choosing Online Manual or Online Python Reference to link to my own manual and code documentation.

So, is there a way to set custom links for a custom operator's help options?

$\endgroup$

2 Answers 2

5
$\begingroup$

There are two functions that takes you to the docs:

# Blender docs
bpy.ops.wm.doc_view_manual(doc_id="")

# Blender Python docs
bpy.ops.wm.doc_view(doc_id="")

It seems that they take their parameters from the property as follows:

doc_id = data.identifier + property_name

where the property has been created in this manner:

col.row().prop(data, property_name)

Those functions search the _manual_map for this doc_id. The manual_map contains by default the blender_default_map which is (prefix, manual_mapping ).

The prefix is simply 'https://blender.org/manual' while manual_mapping is dict you give it the something+doc_id (in this case bpy.ops) and you get the rest of the url
(url = prefix + manual_mapping[doc_id])

So to add you manual you create your addon_map:

import bpy

prefix = "https://myaddon.org/manual/"
my_manual_mapping =(
    ("bpy.ops.myaddon.*", "page_one"),
    ("bpy.ops.myaddon.something.*", "page_one/page_two.html")
)

def my_map():

  ret = (prefix, my_manual_mapping)
  return ret

bpy.utils.register_manual_map(my_map)

bpy.ops.wm.doc_view_manual(doc_id="") will now take you to your site.

(Note: I have this in my addon: bl_idname = "myaddon.simple_operator")

$\endgroup$
3
  • $\begingroup$ There's a template in Text Editor: Addon Add Object. It demonstrates how to use bpy.utils.register_manual_map(). $\endgroup$
    – CodeManX
    Mar 13, 2015 at 16:58
  • $\begingroup$ @CoDEmanX I didn't see it i had to go through the source code to find this :p $\endgroup$
    – Chebhou
    Mar 13, 2015 at 17:02
  • $\begingroup$ Awesome, seems like you guys hit the nail. Thanks, I'll let you know how it worked out for us! :) $\endgroup$
    – KaivS
    Mar 18, 2015 at 8:42
-2
$\begingroup$

There doesn't appear to be a way for us to include custom links on an individual operator basis.

There is a "mapping" table that exists in rna_wiki_reference.py that links internal naming to url creation which always uses "blender.org/manual".

For the python reference, WM_OT_doc_view in wm.py (line 988) uses "blender.org/documentation/blender_python_api" in it's calculation of a url.

Without our addon details existing in either location, we don't have access to those features. I don't know of any plans to extend that to addon developers.

If all your addon operators are in their own custom panel you could create an operator that opens a url to your own site and have an extra "help" button that links to your web page.

For now the only supported way to include links is in our addons bl_info. The two links we can use are wiki_url and tracker_url which are used in the preferences for the "Documentation" and "Report a Bug" buttons shown with the addons info.

bl_info = {
    ...
    "wiki_url": "http://myaddon.com",
    "tracker_url": "http://mybugreports.com",
    }

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks, man, seems like that would have been a good work around in case the other solution hadn't been available. $\endgroup$
    – KaivS
    Mar 18, 2015 at 8:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .