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 - Melissa Wiederrecht 0

Pages: [1]
1
So sorry about the rookie question, but I've been staring at the python api docs for hours and can't seem to figure out how to do a simple thing:  SAVE the (one and only) output node 2d bitmap as a jpg.  I have a reference to the correct node in my code, have made all the changes I need via code, and I want to save the output.  Help. ;)  In case it helps you understand where I am at, here is my code (yes, adapted from a demo):

Code: [Select]
import os
import glob
from pysbs import sbsenum
from pysbs import context
from pysbs import substance
from pysbs import batchtools

aContext = context.Context()
FILE_PATH = 'filename.sbs'

xOffset = [150, 0, 0]
yOffset = [0, 150, 0]
initPos = [0, 0, 0]

# Open a sbs file
sbsDoc = substance.SBSDocument(aContext, FILE_PATH)
sbsDoc.parseDoc()

aGraph = sbsDoc.getSBSGraph(aGraphIdentifier='graphid')

# Retrieve bitmaps
aPathInputs = sbsDoc.mDirAbsPath + os.path.sep
aListInputs = glob.glob(aPathInputs+"*.jpg")

for x in range(0, len(aListInputs)):
    # Create a Bitmap node
    aBitmapNode = aGraph.createBitmapNode(aSBSDocument=sbsDoc,
                                            aResourcePath=aListInputs[x],
                                            aGUIPos=[y * x for y in yOffset],
                                            aParameters={sbsenum.CompNodeParamEnum.COLOR_MODE:True},
                                            aCookedFormat=sbsenum.BitmapFormatEnum.JPG,
                                            aCookedQuality=1)

    aId = aListInputs[x][aListInputs[x].rfind(os.path.sep)+1:-4]

    trans2dnode = aGraph.getAllFiltersOfKind(sbsenum.FilterEnum.TRANSFORMATION)[0]
   
    aGraph.connectNodes(aLeftNode=aBitmapNode,
                        aRightNode=trans2dnode)

    output = aGraph.getGraphOutputs()[0]
   
    # SAVEEEEEEEEE


Pages: [1]