View Full Version : Expresso Problem: Iterator
01-12-2006, 10:37 AM
I have tried to figure some weird behavour of Iterators in Expresso for weeks now,
There seems something either buggy or not logical to me about the execution of Iterators.
I have supersimplified a setup that in my logic should work (see file & screenshot).
Thats just an iterator counting from 0 to 15, and a compare node that should switch the Xgroup on when input is >5.
The iterator value is passed to the Xgroup and then to a Print to Console node (just so that the result can be observed in the console).
I would expect the console to print out all values over 5 then--
But what happens? nothing!
When I remove the connection from compare node, then the console prints out all 15 passed values as expected--
I have observed some weirdnesses with iterators & Xgroups (especially with the Tag Iterator),so i thought i would study them with simple setups, but this setup here is really leaving me clueless---why does it refuse to work?
Maybe its something about how Expresso is being executed that i dont understand---
01-12-2006, 01:08 PM
I think that an event is needed to drive the Iteration node. For example, disconnecting and reconnecting Input 1 of the Compare node makes the expression work. After this has been done at least once, switching Enable off and on for the Iteration node or running Execute Last Plugin from the Console also works.
Perhaps because this is not a typical use of the Iteration node, it doesn't automatically run when you first hook everything up.
01-12-2006, 02:39 PM
---Thanks a lot , Darter.:applause:
This pointed me to the solution:
I hooked a constant (1) into the ON port of the iterator.
This done, the Expresso performs just as expected (when I press play in timeline it is executed properly on every frame).
Seems the problems I had with iterators in certain Expressos could be related to this odd phenomenon.Must check later to make sure.
I had lots of problems with the Tag-Iterator in certain constructions (especially when using an object from a link-List to feed the Tag Iterator)
I will stop to think about how many hours I have lost trying to figure out the problem in my Expressos.
Well, like always it is a good idea to simplify and isolate to find the problems cause.
01-12-2006, 04:04 PM
Testet the found phenomenon on my TagIterator problem, unfortunately this does not help in this case at least not fully (the setup outputs).
I will post the problem setup here--
The iterators output weird data it seems
What I am trying to construct is an Expresso that will step through a number of vertexmaps on a single object and read out the Value for each point of each VMap.
The main goal is to construct an Expresso that helps find Points on characters that dont have a total weight of 100% when all Vmaps are added up.
01-13-2006, 04:20 AM
This is probably due to a lack of coordination between the Tag and Iteration nodes. They're sitting there but not talking to each other. A Vertex Map tag equivalent of the Selection node would be needed, I think.
Anyway, I've created a script which prints out the name and values for each vertex map on an object. The number of values which the Console can display is limited so for e.g. a default Sphere, more than one Vertex Map will result in a truncated list. I'd be happy to try updating the script to e.g. filter or do something else with the values.
I'm in the early stages of learning COFFEE, so if there are any problems or suggestions, please let me know.
if(!instanceof(op, PointObject)) return;
var tag = op->GetFirstTag();
var array, i;
var cnt = op->GetPointCount();
if(tag->GetType() == Tvertexmap)
tagName = tag->GetName();
array = tag->GetData();
for(i = 0; i < cnt; i++)
weight = array[i];
println("[", i, "] ", weight);
tag = tag->GetNext();
01-13-2006, 07:09 AM
Thanks a million again--
with the starting help of your code I might try to use coffee to reach what I want.
The final masterplan is a script that checks every single point of all vMaps, adds them up, and re-distributes the weights of the points so that the total is 100%.
Mathemtically simple, now lets have a look at how to work with arrays in coffee--
01-13-2006, 09:37 AM
Sounds like an interesting challenge. Let me know if you'd like any more input.
01-14-2006, 12:26 PM
I will keep you updated when I continue with it.
Will have to do some other stuff first I am afraid.
01-14-2006, 12:56 PM
Thanks, I look forward to seeing how it goes.
One small thing, the script that I posted originally was inefficiently getting the point count for each iteration of the while loop. I've replaced it with an updated version, in case you do decide to use the code.
01-17-2006, 08:21 AM
Will use it as a starting base.
01-17-2006, 08:21 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.