Hey,

Adding an answer to my original post. The following script will create a
BlinkScript node and works interactively or when running from the command
line.

Hope that helps somebody besides me,
HP


    def createBlinkScriptNode( blinkScriptPath, inputs, name=None ):
        fh = file( blinkScriptPath, 'r' )
        fileText = fh.read()
        fh.close()

        if name == None:
            name = 'BlinkScript'

        blinkNode = nuke.nodes.BlinkScript(
kernelSourceFile=blinkScriptPath, kernelSource=fileText, name=name )

        # Needed if running from the command line
        blinkNode['reloadKernelSourceFile'].execute()
        blinkNode['recompile'].execute()

        # Optional - Turning off GPU usage
        #blinkNode['useGPUIfAvailable'].setValue( 0.0 )

        # Optional - Percentgae of image to send to GPU at once
        #blinkNode['maxTileLines'].setValue( 100.0 )

        # Optional - Max percentage of GPU memory to use
        #blinkNode['maxGPUMemory'].setValue( 80.0 )

        for i in range(len(inputs)):
            blinkNode.setInput(i, inputs[i])

        return blinkNode





On Mon, Apr 28, 2014 at 9:57 AM, Haarm-Pieter Duiker <
l...@duikerresearch.com> wrote:

> Adding an answer to one question in the thread.
>
> The environment variable FN_BLINK_INCLUDE_PATHS controls the search path
> used for #include statements in Blink kernels.
>
> HP
>
>
>
>
>
> On Thu, Apr 24, 2014 at 1:24 PM, Haarm-Pieter Duiker <
> l...@duikerresearch.com> wrote:
>
>> Hello again,
>>
>> Let me add an additional, hopefully simple, question.
>> - How do you create and initialize a BlinkScript node from Python.
>>
>> I wrote the following function
>>
>> def createBlinkScriptNode( blinkScriptPath, inputs ):
>>     blinkNode = nuke.nodes.BlinkScript()
>>     blinkNode['kernelSourceFile'].setValue( blinkScriptPath )
>>     nuke.show(blinkNode)
>>     blinkNode['clearKernelSource'].execute()
>>     blinkNode['reloadKernelSourceFile'].execute()
>>
>>     for i in range(len(inputs)):
>>         blinkNode.setInput(i, inputs[i])
>>
>>     return blinkNode
>>
>> This does the job when working interactively but is problematic when
>> working in batch. Without the 'nuke.show()' call in the middle of the
>> function, the subsequent clear kernel and reload kernel calls don't have
>> any affect, when running interactively. That probably has something to do
>> with why we're seeing problems in batch too.
>>
>> Without the UI update that you get interactively, the batch version of
>> the node doesn't know how many inputs it should have or understand what
>> kernel parameters should be exposed for the given 'kernelSourceFile'.
>>
>> Thanks again for your help,
>> HP
>>
>>
>>
>>
>>
>>
>> On Tue, Apr 22, 2014 at 9:12 AM, Haarm-Pieter Duiker <
>> l...@duikerresearch.com> wrote:
>>
>>> Hi,
>>>
>>> I'm working with Blink and have a couple of basic questions.
>>> - What environment variables control the directories searched when you
>>> use an #include statement?
>>>  - Is there a way to get more verbose output when a kernel fails to
>>> compile or run?
>>> --- Sometimes I get 'Error running kernel' in a red bar over the Nuke
>>> viewer and that's it.
>>> --- If there's a syntax error in an included header and the compilation
>>> fails, you only get the warning that the compilation failed. If the error
>>> is in the main .blink file being loaded, you get proper information about
>>> which line has the problem and what mistake you've made.
>>>
>>> Is there a secret blink.log file somewhere on disk with lots of verbose
>>> output from the compiler and runtime?
>>>
>>> Thanks in advance for your help. I'm having fun playing with Blink thus
>>> far.
>>>  HP
>>>
>>
>>
>
_______________________________________________
Nuke-dev mailing list
Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to