Page 1 of 1

Need help to understand an code a scriptgraph

PostPosted: Fri Sep 18, 2015 12:46 pm
by Wallan
I think image explains quite well what I want to do.
That is a scriptgraph that takes an RGB image and an Transform Value as inputs and outputs a new image with the selected transform values.

From example code I have managed to figure out how to add the inputs and outputs but I cant figure out how to create new RGB Image as a copy of the one in the input.
I suppose that if I just can get some help to create the image and connect to the output then I can probably figure out how to change transform values by myself.

Would be really grateful for help on this .

Any tips on how to write and debug scripgraphs would also be appreciated.
Normally I would use print() and error() to help in debug in editor but using print() in the scriptgraph don't seem to show up anyware(not that strange) and error() crashes Octane (not that surprising).

Re: Need help to understand an code a scriptgraph

PostPosted: Fri Sep 18, 2015 3:51 pm
by bepeg4d
Hi,
since you have opened a new discussion in the right place, i will respond to you here ;)
Ok, here is my attempt:
Schermata 2015-09-18 alle 17.48.29.jpg

OffsetTex-01.lua
(2.09 KiB) Downloaded 336 times

It almost works as expected, If you use the first two output ports... but for some unknown reason (from me) the output ports are duplicated and inverted :roll:
Maybe you can find my mistake ;)
ciao beppe

Re: Need help to understand an code a scriptgraph

PostPosted: Fri Sep 18, 2015 4:38 pm
by Wallan
Thank's' will take a look. :)

Re: Need help to understand how to code a scriptgraph

PostPosted: Fri Sep 18, 2015 6:23 pm
by Wallan
Well, it works but I found a problem.

First.
Looking at the code I can't see any reason for double outputs either.
Nice structured code that will helped me understand it.
Will try to rebuild it from scratch later on to see if that will help me figure out why and when double outputs appears.


But.
Problem is that when i reload the project, any connections made from the outputs to my materials are lost.
Same happen if I select the Scriptgraph and press refresh.
Any ideas?

Re: Need help to understand an code a scriptgraph

PostPosted: Fri Sep 18, 2015 10:15 pm
by Wallan
OK.

Made some progress.
Did some rewrite and made the code look more like the example code from the API.
After fiddling around a little, mostly not really knowing what I did I did manage to get rid of the duplicate outputs, connections are no longer lost on project reload.

I'm not sure what made things work better.

The real mystery is that I tried to connect input[1] to output[1] but got did it wrong and got some errors so I removed the code part. But strangely, what's put in at input[1] comes out at output[1] without any connections has been made in code.
Is there something working behind the scenes here, that connect input[1] to output[1] automatically?
Well, I have no idea.

Anyone that knows?

I have attached the modified code if someone want to take a look.

bepeg4d:
Thank's for your help.
Most appreciated.

Re: Need help to understand an code a scriptgraph

PostPosted: Fri Sep 18, 2015 11:48 pm
by bepeg4d
Hi Wallan,
thank you too for let me understand my mistake, now I have revisited my code and there are no more double connections ;)
OffsetTex-01.lua
(1.67 KiB) Downloaded 435 times

About the output 1, I guess there is any direct connection, I have revisited your code adding a Tex1 line:
TextureTransform.lua
(2.51 KiB) Downloaded 445 times


ciao beppe