Forum

#1 2016-09-15 21:16:22

Shioon
Member

List All Layer

hi everyone,

I want to list all Layer in the scene, but when I use the Type "Layer" "RenderLayer" "RenderPass" "Pass" "RenderOutput", each time it list the RenderPass


here is my code:

for node in children (Document, "Layer") do
    print (node:getname ())
end


Jeremy TAN
TD Junior chez OnyxLux3D

Offline

 

#2 2016-09-15 23:08:52

Ben
Guerilla dev, the guy to hug

Re: List All Layer

Hi Shioon,

"RenderLayer" is the official class name for layers, but mind that layers are children of RenderPasses.

To list layers by RenderPasses, use the following:

Code:

for renderpass in children (Document, "RenderPass", nil, true) do
    for layer in children (renderpass, "RenderLayer") do
        print (renderpass:getname (), layer:getname ())
    end
end

To list all layers (independently of their parent render pass), use the following:

Code:

for layer in children (renderpass, "RenderLayer", nil, true) do
    print (layer:getname ())
end

Note the extra arguments of the children iterator:

Code:

children (parent, classname, namepattern, recursive)

The equivalent Python code for the first example is:

Code:

import guerilla
d = guerilla.Document ()
for renderpass in d.children (type="RenderPass", recursive=True):
    for layer in renderpass.children ("RenderLayer"):
        print (renderpass.getname (), layer.getname ())

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

Offline

 

#3 2016-09-22 16:37:07

Shioon
Member

Re: List All Layer

Thanks Ben, it was my first try in LUA script, so I'm not very familiar with it yet.

Another question, is there a chance that these command for guerilla will change with the new engine in guerilla 2.0?

Last edited by Shioon (2016-09-22 16:37:25)


Jeremy TAN
TD Junior chez OnyxLux3D

Offline

 

#4 2016-09-22 18:20:31

hulud
Guerilla dev, the guy to hug

Re: List All Layer

Hi,

No those methods won't change.


Cyril 'Hulud' Corvazier
Guerilla developer
http://www.mercs-eng.com

Offline

 

#5 2016-12-20 11:13:55

Shioon
Member

Re: List All Layer

hi,

for my script, i would like to reset all change when the windows is closed.

I know I have to use the "addtracker" methods but I don't find how to use it.

can you enlighten me on that?


Jeremy TAN
TD Junior chez OnyxLux3D

Offline

 

#6 2016-12-29 11:02:43

Narann
Member

Re: List All Layer

Hope this helps.

Offline

 

#7 2016-12-29 12:43:01

doubleailes
Guerilla dev, the guy to hug

Re: List All Layer

Thanks!


Philippe Llerena

Offline

 

#8 2017-01-02 11:30:03

Shioon
Member

Re: List All Layer

Thanks Narann, I found it on your topic and it help a lot.


by any chance, do you now how to use the addtracker methode in this page ?
Windows doc


Jeremy TAN
TD Junior chez OnyxLux3D

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB