Sie sind nicht angemeldet.

1

Mittwoch, 16. September 2015, 06:21

How to "Count" the children layer ?

<layer name="a">
<layer name="b"></layer>
<layer name="c"></layer>
< layer name="d"></layer>
</layer>

<action name="countchild">
for(set(i,0),i LT ??,inc(i), set(layer[get(i)].url,subtxt("image",get(i),".jpg"); )
</action>


?? = 3
layer[0] -> layer[a]
layer[1] -> layer[b]
layer[2] -> layer[c]

Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »iamroco« (16. September 2015, 06:41)


2

Mittwoch, 16. September 2015, 08:18

Quellcode

1
2
3
4
5
<layer name="a">
  <layer name="b"/>
  <layer name="c"/>
  <layer name="d"/>
</layer>

Quellcode

1
2
3
4
5
6
7
8
9
<action name="countchild">
set(parent_a_counter,0);
for(set(i,0),i LT layer.count,inc(i),	
  if(layer[get(i)].parent EQ 'a',
  inc(parent_a_counter);set(layer[get(i)].url,subtxt("image",get(get(i)),".jpg"););
  );
);
trace('Total numbner of children:',get(parent_a_counter));
</action>

3

Mittwoch, 7. September 2016, 12:08

Taken from http://krpano.com/docu/actions/#arrays:

Zitat

Every xml element with a name attribute is an element / item of an Array

In this case surely layer[a], in the OP's example, should be an array?

I would love to access layer[a].count and also a child object, using layer[a][0], but it doesn't seem to work.

Please could someone clarify the situation and give me a pointer if it is just a problem with my syntax?