Closed zeffii closed 8 years ago
These small snippets are really useful.
great idea!
I haven tried this but I think this also allows for other uses, because this example calls the
bpy.ops.text.open(internal=True, filepath=whatever_was_clicked)
so if we made an operator that can load scripts as nodes then our def draw might include a line like
bpy.utils.script_paths("templates_my_py"),
"svrx.load_as_node",
{"internal": True},
this would load as node and also import the text file to a text datablock , if it handled the "internal" parameter. :)
if not, we can make a util function that does do it this way :)
As long as the first argument to
self.path_menu()
is a list["/home/blablab/dir"]
, it will expose all .py files in that dir as menu items.