Forum

#1 2010-08-17 06:51:42

rajaram
Member

create function

Hi Ben,

what is the input parameters for create and what it will return ?

can we use this function in script editor???

Offline

 

#2 2010-08-17 13:23:29

Ben
Guerilla dev, the guy to hug

Re: create function

Hello Rajaram,

What do you mean by the 'create' function ? There is no such 'create' function in Guerilla.

Ben


Benjamin 'Ben' Legros
Guerilla developer
http://www.guerillarender.com

Offline

 

#3 2010-08-19 09:27:18

rajaram
Member

Re: create function

in sl.gnode
    local self = create(ref(1),"GAShaderNodeSL",parent,(id or 17))

it is there in Library as util Node ...

Offline

 

#4 2010-08-19 12:37:05

Ben
Guerilla dev, the guy to hug

Re: create function

Ooh!
You peeked into the library nodes! Good point...
Unfortunately, this function is a wrapper for our internal create function dedicated to file loading, and is not available otherwise. For the moment, you have to stick with the SDK, and notably the 'addnode' function available in Shader class. More generally, you can load any kind of node inside another node using the Node loadfile method, which returns a table of nodes (provided these nodes can be added into said parent)

Code:

local nodes = Document:loadfile ("$(LIBRARY)/materials/matte.gmaterial")
if nodes then
    for k, node in pairs (nodes) do
        print ("Added node " .. node:getname ())
    end
end

There are some class constructors, but they are not yet documented as we have a few things to sort out before they are fully functional (for instance, you can see that the nodes saved into the file are called "GAShaderNodeSL" instead of "ShaderNodeSL", and that's because ShaderNodeSL is a SDK wrapper for the actual class.)

So, right now, stick with what is documented. We'll try to arrange things and document constructor in a near future version.

Cheers,
Ben


Benjamin 'Ben' Legros
Guerilla developer
http://www.guerillarender.com

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB