The node Add menu is registered from C code, but without an associated RNA type ... I could only find one other instances of this type of C menu, namely the "open recent" file menu.
I would like to replace this menu at some point with a python class. We now have nice operators too which do what the old Add menu does (NODE_OT_add_node for adding nodes at mouse position). What is still needed is a way of getting a list of node types for the active tree type (shader/texture/compo nodes) and by category to build the submenus. For getting the name of a group node you need the name of the data block. For a group node "gnode" this is simply: gnode.node_tree.name Be aware that gnode.node_tree might be None in some cases, e.g. if the data block could not be linked on loading. If OTOH you want the name of the *edited* node group from the node editor, you can use the space data: context.space_data.edit_tree.name with opened node group edit_tree is the currently edited group tree, as opposed to space_data.node_tree which is always the basic underlying node tree. Not sure about the purpose of node group presets, IMO we should rather try to improve asset management, so we can link those data blocks. But that's up to you of course :) On Thu, Dec 13, 2012 at 11:02 AM, Fabio Russo <[email protected]> wrote: > Hello to all. > I am continuing to improve the Addon Compositing Presets. > I wanted to add a list of presets also in the menu of the nodes, but will > not > let me: > bpy.types.NODE_MT_add.append (menu_func) > AttributeError: 'RNA_Types' object has no attribute 'NODE_MT_add' > Can anything be done? > I also wanted to know if it is possible to obtain the name of the selected > group: > http://www.pasteall.org/pic/show.php?id=41756 > > Thank you very much, > ruesp83 > > P.S.: I started developing for saving presets! ;-) > http://www.pasteall.org/pic/show.php?id=41708 > _______________________________________________ > Bf-committers mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-committers _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
