[Closed] How do you get empty Container nodes
I’ve been searching through Google and the help files and I cant seem to find the answer to my problem. Basically I need to include empty Container nodes into my my array so that when I pass the array to a loop later on it wont come up as undefined when I use the total amount of containers as a count.
Here is what im working with,
CONTAINER_array=#()
OBJECT_array=#(); counter=1; meshCounter = 0; emptynodecounter = 0;
DEFINE_array=#()
MESHCOUNT_array=#()
POINTCOUNT_array=#()
clearlistener()
CONTAINER_array=#()
OBJECT_array=#(); counter=1; meshCounter = 0; emptynodecounter = 0;
DEFINE_array=#()
MESHCOUNT_array=#()
POINTCOUNT_array=#()
clearlistener()
for hlp in helpers where classof hlp == container do(
append CONTAINER_array hlp.children.count
for c in hlp do(
if superclassof c == geometryclass do(
OBJECT_array [counter] = meshCounter; meshCounter = meshCounter +1; counter = counter +1;
append DEFINE_array 1
);
if ? c == ? do(
OBJECT_array [counter] = emptynodecounter; emptynodecounter = emptynodecounter +1; counter = counter +1;
append Define_array -1
)
)
)
count = 0 –take note that this 0 shows up in the listener
for GR = 1 to CONTAINER_array.count do(
count = count +1
–print OBJECT_array[count]
–print DEFINE_array[count]
)
"sample download"
[ https://mega.co.nz/#!3UYUBQCJ!QwtIekXiegDIX79jJrMIEKyHUIUGbSLLQBAXNy7YU00 ]( https://mega.co.nz/#!3UYUBQCJ!QwtIekXiegDIX79jJrMIEKyHUIUGbSLLQBAXNy7YU00)
as you can see I have those question marks below the superclassof geometry loop, I need to know how I can get just an empty container node into the OBJECT_array... "Same goes for the DEFINE_array"
Another example of this would be "if you use my example file"~
if you write in the c loop "print c" you will see
$Container:Container1 @ [0.361481,0.790634,0.000000]
$Box:Object 1 @ [0.361481,0.790634,0.000000]
$Sphere:Object 3 @ [-4.051605,-57.888153,0.000000]
$Container:Container2 @ [41.923866,-16.448822,0.000000]
$Box:Object 2 @ [41.923866,-16.448822,0.000000]
$Container:Container3 @ [-37.661911,-7.149628,0.005000]
$Pyramid:Object 4 @ [-37.661911,-7.149628,0.005000]
$Container:Container4 @ [3.665382,54.370110,0.000000]
$Teapot:Object 6 @ [27.931046,56.037415,0.000000]
$Cylinder:Object 5 @ [-20.600281,52.702805,0.000000]
$Container:Container5 @ [-66.596298,32.164368,0.000000]
$Container:Container0 @ [53.204178,-74.887756,0.000000]
$Container:Container6 @ [-61.381828,-47.164047,0.000000]
Im looking to get "$Container:Container6 @" and such that has no children into the OBJECT and DEFINE array.
"I know certain areas of the script seem whonkey but on my full script I have them coded like that for a reason, just saying.."
select empty containers :
select \
(
for c in helpers where iskindof c containerhelper collect
(
c.getcontentnodes on &nodes
if nodes.count > 0 then dontcollect else c
)
)
to check number of a container children is not correct. a container helper node can have children which are not contained in this container.