Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - branflakes

Pages: [1]
1
Is there a better way to get a selected mesh inside of Maya itself to run through sbsbaker ?

I came up with a hacky solution where I export my selected mesh, and the sbsbaker reads the firepath of the .obj, but I am sure there is a cleaner way to do it, since I think the Substance Maya batch plugin works entirely inside of Maya.

I know it requires a string filepath, but I don't know what the string should be while having an object selected in Maya.

Using
Code: [Select]
cmds.ls(sl=1)[0] doesn't work. The string title of my selected object also doesn't work, so I am lost. :-\

Thanks!



2
Hey !!

Saw the talk from David at GDC, very cool. Been using pixel processor and converting code into graph, but looking at how David was playing with filter kernels got me interested.

My python is super rusty by the way !



DESIRED RESULT ONCE COMPILED: Image of what I am trying to do with just python:




I tried stripping down the raytracer.py file, but that does not seem to work. This sample is way over my head and I just want to get started on a very bare bones basic python file just to get me started, and I could figure out the rest.

Attempts: So far, my code compiles fine, but all it does is create an empty graph inside my .sbs. package and a function graph. Of course this was not what I was looking for.

I am having trouble understanding how to encapsulate this function graph inside my pixel processor node (that never got spawned inside my compiled .sbs file)

Thanks!!

Heres the code

Code: [Select]
import argparse
import functools
import os

from pysbs import context
from pysbs import sbsenum
from pysbs import sbsgenerator

import demo_cmd
import demos
import sbsMath.sbsmath as sm
import sbsMath.sbsmath_tools as st

xOffset = [-200, 0, 0]
yOffset = [0, 200, 0]


def create_base_network(graph, doc):

    pp_node = graph.createCompFilterNode(sbsenum.FilterEnum.PIXEL_PROCESSOR,
                                         aGUIPos=outBaseColor.getOffsetPosition(xOffset))
    return pp_node


def basic(fn):
    """
    Substance function for generating a uv coordinate from a sphere normal and a tiling factor

    :param fn: The function context to create the function in
    :type fn: FunctionContext
    :return: function, a function to call to instantiate the function
    """
    x = fn.input_parameter('x', widget_type=sbsenum.WidgetEnum.COLOR_FLOAT1)
    y = fn.input_parameter('y', widget_type=sbsenum.WidgetEnum.COLOR_FLOAT1)

    return fn.generate(x+y)

def main():
    parser = argparse.ArgumentParser('myPixel')
    demo_cmd.add_default_arguments(parser)
    args = parser.parse_args()
    atk_dir = demo_cmd.get_automation_toolkit_directory(args)
    samples_dir = demo_cmd.get_automation_toolkit_samples_directory(args)
    packages_dir = demo_cmd.get_automation_toolkit_packages_directories(args)

    # Use the python api to find the command line tools
    sbs_context = context.Context()
    sbs_context.setAutomationToolkitInstallPath(atk_dir)
    sbs_context.setDefaultPackagePath(packages_dir)

    output_path = os.path.join(samples_dir, 'myPixel')
    output_file = os.path.join(output_path, 'myPixel.sbs')
    # Make sure the output directory exist
    demos.ensure_directory_creation(output_path)

    # Create our target document
    doc = sbsgenerator.createSBSDocument(sbs_context,
                                         aFileAbsPath=output_file,
                                         aGraphIdentifier='myPixel')

    st.generate_function(basic, doc, name='basic')

   
    # Create a simple network with a pixel processor
    # and some inputs
    # pp_node = create_base_network(graph, doc)
    #pp = pp_node.getPixProcFunction()


    doc.writeDoc()


if __name__ == '__main__':
    main()

Pages: [1]