1

info window showing the difference between the twoI am creating a pie menu to access my most frequently used nodes in my node editor. I have successfully created pie menu but it doesn't have "use_transform" property set to "True" which enables us to drag and place nodes as soon as they are called. Nodes called from blender menu and shortcuts assigned to nodes does have "use_transform" property set to "True", but I want to know how to access that property through pie menu.

SAMPLE CODE....

bl_info = {
    "name": "My test Modifiers CTRL SPACE",
    "author": "Vikrant",
    "version": (1),
    "blender": (2, 79, 0),
    "description": "Pie menu for modifiers",
    "category": "User Interface"
}


import bpy
from bpy.types import Menu

# TEST Pie Menu for Node editor

class An_Nodes(Menu):
    # label is displayed at the center of the pie menu.
    bl_idname = "An_Nodes"
    bl_label = "NODES"
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()
#4
        pie.operator("node.add_node", text="Test").type='ShaderNodeValue'
        ##############
        #FORMATS I HAVE TRIED
        ##############
        #pie.operator("node.add_node", text="Test").type='ShaderNodeValue'.use_transform=True
        #pie.operator("node.add_node", text="Test")(.type='ShaderNodeValue'.use_transform=True)
        #pie.operator(("node.add_node", text="Test").type='ShaderNodeValue').use_transform=True
        #pie.operator("node.add_node", text="Test").type='ShaderNodeValue'.use_transform=True
        #############
            #Where & how to place this "use_transform=True" to eneable the node to be moved as soon as it is accessed via pie menu
#6
        pie.operator("node.add_node", text="Test").type='ShaderNodeGamma'

classes = (
    An_Nodes,
    )


addon_keymaps = []


def register():
    for cls in classes:
        bpy.utils.register_class(cls)

    wm = bpy.context.window_manager
    if wm.keyconfigs.addon:
        km = wm.keyconfigs.addon.keymaps.new(name='Node Generic', space_type='NODE_EDITOR', region_type='WINDOW')
        kmi = km.keymap_items.new('wm.call_menu_pie', 'SPACE', 'PRESS', ctrl=True, shift=True)
        kmi.properties.name = "An_Nodes"
        addon_keymaps.append((km, kmi))

def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)

    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        for km, kmi in addon_keymaps:
            km.keymap_items.remove(kmi)
    addon_keymaps.clear()


if __name__ == "__main__":
    register()
vikrant
  • 41
  • 4
  • 2
    Seems like this is what you are actually asking? https://blender.stackexchange.com/questions/2515/how-to-pass-multiple-operator-properties-via-ui-layout . Also, videos are generally discouraged. Any relevant information should be directly in the body of the question itself, not linked to. If links go down in future then critical information may be lost from this question. – Ray Mairlot May 24 '19 at 17:11
  • Ok, I have now added an image, showing the difference between the two formats invoked in info window. By the pie menu and by the the usual menu mode of blender. This may be sufficient I think. – vikrant May 24 '19 at 17:18
  • 1
    See duplicate, in this case: props = pie.operator("node.add_node", text="Test") – batFINGER May 24 '19 at 17:22
  • 1
    It worked, thanks a lot @batFINGER . It will greatly improve my productivity while handling those many nodes in animation nodes. – vikrant May 24 '19 at 17:35

0 Answers0