예제 #1
0
    def draw(self, context):

        # dont show up in other tree menu (needed because we bypassed poll by appending manually)
        tree_type = context.space_data.tree_type
        if not tree_type in sv_tree_types:
            return

        layout = self.layout
        layout.operator_context = 'INVOKE_REGION_WIN'

        if self.bl_idname == 'NODEVIEW_MT_Dynamic_Menu':
            layout.operator("node.sv_extra_search", text="Search", icon='OUTLINER_DATA_FONT')

        for item in menu_structure:
            if item[0] == 'separator':
                layout.separator()
            else:
                if "Add" in item[0]:
                    name = item[0].split("Add")[1]
                    if name in node_cats:
                        if category_has_nodes(name):
                            layout.menu(item[0], **icon(item[1]))

                    else:
                        layout.menu(item[0], **icon(item[1]))
                else:
                # print('AA', globals()[item[0]].bl_label)
                    layout.menu(item[0], **icon(item[1]))

        extra_categories = get_extra_categories()
        if extra_categories:
            layout.separator()
            for category in extra_categories:
                layout.menu("NODEVIEW_MT_EX_" + category.identifier)
예제 #2
0
파일: menu.py 프로젝트: tramper2/sverchok
def draw_add_node_operator(layout, nodetype, label=None, icon_name=None, params=None):
    """
    Draw node adding operator button.
    This is to be used both in Shift-A menu and in T panel.
    """

    default_context = bpy.app.translations.contexts.default
    node_class = get_node_class_reference(nodetype)
    if node_class is None:
        info("cannot locate node class: %s", nodetype)
        return
    node_rna = node_class.bl_rna

    if label is None:
        if hasattr(node_rna, 'bl_label'):
            label = node_rna.bl_label
        elif nodetype == "NodeReroute":
            label = "Reroute"
        else:
            label = node_rna.name

    if params is None:
        params = dict(text=label)
    params['text_ctxt'] = default_context
    if icon_name is not None:
        params.update(**icon(icon_name))
    else:
        params.update(**node_icon(node_rna))

    add = layout.operator("node.sv_add_" + get_node_idname_for_operator(nodetype), **params)

    add.type = nodetype
    add.use_transform = True

    return add
예제 #3
0
파일: menu.py 프로젝트: elfnor/sverchok
def draw_add_node_operator(layout, nodetype, label=None, icon_name=None, params=None):
    """
    Draw node adding operator button.
    This is to be used both in Shift-A menu and in T panel.
    """

    default_context = bpy.app.translations.contexts.default
    node_rna = get_node_class_reference(nodetype).bl_rna

    if label is None:
        if hasattr(node_rna, 'bl_label'):
            label = node_rna.bl_label
        elif nodetype == "NodeReroute":
            label = "Reroute"
        else:
            label = node_rna.name

    if params is None:
        params = dict(text=label)
    params['text_ctxt'] = default_context
    if icon_name is not None:
        params.update(**icon(icon_name))
    else:
        params.update(**node_icon(node_rna))

    add = layout.operator("node.sv_add_" + get_node_idname_for_operator(nodetype), **params)
                            
    add.type = nodetype
    add.use_transform = True

    return add
예제 #4
0
    def draw(self, context):

        # dont show up in other tree menu (needed because we bypassed poll by appending manually)
        tree_type = context.space_data.tree_type
        if not tree_type in sv_tree_types:
            return

        layout = self.layout
        layout.operator_context = 'INVOKE_REGION_WIN'

        if self.bl_idname == 'NODEVIEW_MT_Dynamic_Menu':
            layout.operator("node.sv_extra_search", text="Search", icon='OUTLINER_DATA_FONT')


        layout.separator()
        layout.menu("NODEVIEW_MT_AddGenerators", **icon('OBJECT_DATAMODE'))
        layout.menu("NODEVIEW_MT_AddCurves", **icon('OUTLINER_OB_CURVE'))
        layout.menu("NODEVIEW_MT_AddSurfaces", **icon('SURFACE_DATA'))
        layout.menu("NODEVIEW_MT_AddFields", **icon('OUTLINER_OB_FORCE_FIELD'))
        layout.menu("NODEVIEW_MT_AddTransforms", **icon('ORIENTATION_LOCAL'))
        layout.menu("NODEVIEW_MT_AddAnalyzers", **icon('VIEWZOOM'))
        layout.menu("NODEVIEW_MT_AddModifiers", **icon('MODIFIER'))
        layout.menu("NODEVIEW_MT_AddCAD", **icon('TOOL_SETTINGS'))
        layout.separator()
        layout.menu("NODEVIEW_MT_AddNumber", **icon("SV_NUMBER"))
        layout.menu("NODEVIEW_MT_AddVector", **icon("SV_VECTOR"))
        layout.menu("NODEVIEW_MT_AddMatrix", **icon('EMPTY_AXIS'))
        layout.menu("NODEVIEW_MT_AddQuaternion", **icon('SV_QUATERNION'))
        layout.menu("NODEVIEW_MT_AddLogic", **icon("SV_LOGIC"))
        layout.menu("NODEVIEW_MT_AddListOps", **icon('NLA'))
        layout.menu("NODEVIEW_MT_AddDictionary", icon='OUTLINER_OB_FONT')
        layout.separator()
        layout.menu("NODEVIEW_MT_AddViz", **icon('RESTRICT_VIEW_OFF'))
        layout.menu("NODEVIEW_MT_AddText", icon='TEXT')
        layout.menu("NODEVIEW_MT_AddScene", **icon('SCENE_DATA'))
        layout.menu("NODEVIEW_MT_AddLayout", icon='NODETREE')
        layout.menu("NODE_MT_category_SVERCHOK_BPY_Data", icon="BLENDER")
        layout.separator()
        layout.menu("NODEVIEW_MT_AddNetwork", **icon("SYSTEM"))
        layout.menu("NODEVIEW_MT_AddBetas", **icon("SV_BETA"))
        layout.menu("NODEVIEW_MT_AddAlphas", **icon("SV_ALPHA"))
        layout.separator()
        layout.menu("NODE_MT_category_SVERCHOK_GROUPS", icon="RNA")
        layout.menu("NODEVIEW_MT_AddPresetOps", icon="SETTINGS")

        extra_categories = get_extra_categories()
        if extra_categories:
            layout.separator()
            for category in extra_categories:
                layout.menu("NODEVIEW_MT_EX_" + category.identifier)
예제 #5
0
 def draw(self, context):
     layout = self.layout
     layout_draw_categories(self.layout, node_cats[self.bl_label])
     layout.menu("NODEVIEW_MT_AddGeneratorsExt", **icon('PLUGIN'))
예제 #6
0
    def draw(self, context):

        # dont show up in other tree menu (needed because we bypassed poll by appending manually)
        tree_type = context.space_data.tree_type
        if not tree_type in sv_tree_types:
            return

        layout = self.layout
        layout.operator_context = 'INVOKE_REGION_WIN'

        if self.bl_idname == 'NODEVIEW_MT_Dynamic_Menu':
            layout.operator("node.sv_extra_search",
                            text="Search",
                            icon='OUTLINER_DATA_FONT')

        layout.separator()
        layout.menu("NODEVIEW_MT_AddGenerators", **icon('OBJECT_DATAMODE'))
        layout.menu("NODEVIEW_MT_AddTransforms", **icon('MANIPUL'))
        layout.menu("NODEVIEW_MT_AddAnalyzers", **icon('VIEWZOOM'))
        layout.menu("NODEVIEW_MT_AddModifiers", **icon('MODIFIER'))
        layout.separator()
        layout.menu("NODEVIEW_MT_AddNumber")
        layout.menu("NODEVIEW_MT_AddVector")
        layout.menu("NODEVIEW_MT_AddMatrix")
        layout.menu("NODEVIEW_MT_AddLogic", **icon("SV_LOGIC"))
        layout.menu("NODEVIEW_MT_AddListOps", **icon('NLA'))
        layout.separator()
        layout.menu("NODEVIEW_MT_AddViz", **icon('RESTRICT_VIEW_OFF'))
        layout.menu("NODEVIEW_MT_AddText")
        layout.menu("NODEVIEW_MT_AddScene", **icon('SCENE_DATA'))
        layout.menu("NODEVIEW_MT_AddLayout", **icon("SV_LAYOUT"))
        layout.menu("NODE_MT_category_SVERCHOK_BPY_Data", icon="BLENDER")
        layout.separator()
        layout.menu("NODEVIEW_MT_AddNetwork", **icon("OOPS"))
        layout.menu("NODEVIEW_MT_AddBetas", **icon("SV_BETA"))
        layout.menu("NODEVIEW_MT_AddAlphas", **icon("SV_ALPHA"))
        layout.separator()
        layout.menu("NODE_MT_category_SVERCHOK_GROUPS", icon="RNA")
        layout.menu("NODEVIEW_MT_AddPresetOps", icon="SETTINGS")
예제 #7
0
    def draw(self, context):

        # dont show up in other tree menu (needed because we bypassed poll by appending manually)
        tree_type = context.space_data.tree_type
        if not tree_type in sv_tree_types:
            return

        layout = self.layout
        layout.operator_context = 'INVOKE_REGION_WIN'

        if self.bl_idname == 'NODEVIEW_MT_Dynamic_Menu':
            layout.operator("node.sv_extra_search", text="Search", icon='OUTLINER_DATA_FONT')


        layout.separator()
        layout.menu("NODEVIEW_MT_AddGenerators", **icon('OBJECT_DATAMODE'))
        layout.menu("NODEVIEW_MT_AddTransforms", **icon('MANIPUL'))
        layout.menu("NODEVIEW_MT_AddAnalyzers", **icon('VIEWZOOM'))
        layout.menu("NODEVIEW_MT_AddModifiers", **icon('MODIFIER'))
        layout.separator()
        layout.menu("NODEVIEW_MT_AddNumber")
        layout.menu("NODEVIEW_MT_AddVector")
        layout.menu("NODEVIEW_MT_AddMatrix")
        layout.menu("NODEVIEW_MT_AddLogic", **icon("SV_LOGIC"))
        layout.menu("NODEVIEW_MT_AddListOps", **icon('NLA'))
        layout.separator()
        layout.menu("NODEVIEW_MT_AddViz", **icon('RESTRICT_VIEW_OFF'))
        layout.menu("NODEVIEW_MT_AddText")
        layout.menu("NODEVIEW_MT_AddScene", **icon('SCENE_DATA'))
        layout.menu("NODEVIEW_MT_AddLayout", **icon("SV_LAYOUT"))
        layout.menu("NODE_MT_category_SVERCHOK_BPY_Data", icon="BLENDER")
        layout.separator()
        layout.menu("NODEVIEW_MT_AddNetwork", **icon("OOPS"))
        layout.menu("NODEVIEW_MT_AddBetas", **icon("SV_BETA"))
        layout.menu("NODEVIEW_MT_AddAlphas", **icon("SV_ALPHA"))
        layout.separator() 
        layout.menu("NODE_MT_category_SVERCHOK_GROUPS", icon="RNA")
        layout.menu("NODEVIEW_MT_AddPresetOps", icon="SETTINGS")
예제 #8
0
 def draw(self, context):
     layout = self.layout
     layout_draw_categories(self.layout, node_cats[self.bl_label])
     layout.menu("NODEVIEW_MT_AddGeneratorsExt", **icon('PLUGIN'))
예제 #9
0
 def draw(self, context):
     layout = self.layout
     layout.operator_context = 'INVOKE_REGION_WIN'
     for i in self.items:
         item = menu_structure[i]
         layout.menu(item[0], **icon(item[1]))