View Full Version : Is there an if..then equiv in Xpresso?
Beginning to learn Xpresso, and surprised that I can't really find an "if..then" equivalent. I do see the Condition node, but it's not really the same, reason being that you don't have the option to take no action in the way that an "if..then" does. I could think of a couple work-arounds, but then you start getting awfully complicated for a simple statement. Seems like if you need that sort of expression, it's better to use Coffee? Any inputs on this? Much appreciated.
Iggy
|
|
Per-Anders
03-30-2003, 07:28 AM
ok, there are two ways of doing If, then with xpresso, the first way is nodes only and you should just use a Compare node which you then link the bool output to an xgroups enable input on. you will have to "activate" the xgroup in the AM for this to work, then when the result fo the compare node is true, all teh nodes inside of teh xgroup wil be "executed" otherwise they wil be skipped.
if you want to learn COFFEE i have a couple of tutorials on my site
http://www.peranders.com/c4d8/
and you can use the coffee node to do some "if then" statements, the syntax in coffee is identical to Javascript, C++ or Actionscript i.e.
if (a==b) {
...do this code...
}
good luck.
Hi,
the usual way to create an if/then statement in Xpresso is by using a compare and a condition node. The compare node will give you a true/false value that controls which input of the condition node shall be selected for output. It works more like a case/select structure then if/then, but it's basicaly the same.
Hope this helps
Srek
Great, thanks for the help. Sadie, I hadn't even realized that you could do that! Looks like I've got even more to learn about Xpresso than I thought. But that's exactly the solution that I was looking for. I'm going to have to play with that next. However, for my application, it was much easier to code it in COFFEE. It took only a few lines to code what would have been a fairly time consuming Xpresso expression.
Srek, the reason I didn't like the Condition node, was that I wanted to have no action taken if the condition was false, and I couldn't come up with a good way to do that.
Thanks again to both of you for your offerings...
Iggy
What kind of action are we talking about? There are usualy two ways to prevent unwanted action.
1. read the previous state and write it back when the condition for action is not reached. This can be easily done with the condition node.
2. When the action involves an object node that gets information simply turn that node of to prevent values from beeing set. You can do this directly with the compare node so the Object node gets only active when the condition is true.
Hope this helps
Srek
You're right Srek! I forgot that I can read the previous value. I've *really* got a lot to learn in Xpresso. Felt like I knew it pretty well, but I was fooling myself. I've been slammed in the last week and haven't had time to continue my experiments in this vein, but I'll let you know when I get back to it.
CGTalk Moderation
01-14-2006, 06:00 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.