How to use the translators.cycles_shaders.cycles_nodes.keys function in translators

To help you get started, we’ve selected a few translators examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appleseedhq / blenderseed / properties / nodes.py View on Github external
def node_categories(osl_nodes):
    osl_surface = []
    osl_shaders = []
    osl_2d_textures = []
    osl_3d_textures = []
    osl_color = []
    osl_utilities = []
    osl_other = []

    from ..translators.cycles_shaders import cycles_nodes
    
    cyc_nodes = [nodeitems_utils.NodeItem(key) for key in cycles_nodes.keys()]

    for node in osl_nodes:
        node_item = nodeitems_utils.NodeItem(node[0])
        node_category = node[1]
        if node_category == 'shader':
            osl_shaders.append(node_item)
        elif node_category == 'texture2d':
            osl_2d_textures.append(node_item)
        elif node_category == 'utility':
            osl_utilities.append(node_item)
        elif node_category == 'texture3d':
            osl_3d_textures.append(node_item)
        elif node_category == 'surface':
            osl_surface.append(node_item)
        elif node_category == 'color':
            osl_color.append(node_item)
github appleseedhq / blenderseed / translators / nodetree.py View on Github external
def __traverse_tree(self, node, tree_list, engine):
        for socket in node.inputs:
            if socket.is_linked:
                linked_node = socket.links[0].from_node
                if linked_node.bl_idname in cycles_nodes.keys() or isinstance(linked_node, AppleseedOSLNode):
                    self.__traverse_tree(linked_node, tree_list, engine)
                else:
                    logger.error(f"Node {linked_node.name} is not a node compatible with appleseed, stopping traversal")
                    engine.report({'ERROR'}, f"Node {linked_node.name} is not a node compatible with appleseed, stopping traversal")

        tree_list.append(node)
        
        return tree_list