Xpresso and Spline Text

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 11 November 2005   #1
Xpresso and Spline Text

I built a bar chart the other day and placed a texture with the Spline effect on the top of each bar and then used Xpresso to update the Spline Text with the Y scale value. It all worked pretty well the text updated as the bar grew taller but I had a deadline at the end of the day and didn't have time to really explore xPresso to see what else was possible... Specifically I wanted to find out two things.

1) How to round the decimal value to 1 place. It seemed to have 3 places or none.

2) Concactinate a string onto the end of the value such as "km/h" or "bats" or whatever.

I revisited the file for a few minutes today but didn't get any answers. Does anyone know if either of these is possible? with xPresso?

warmest regards

Cameron Bowyer
 
Old 11 November 2005   #2
1. if you put the thing on integer it will give whole values instead of a value with a comma.
one decimal is another story altogether.

2. you can use maths add to add the km/h. But you must set the math node to string mode in order to work. you can add as many things as you like
 
Old 11 November 2005   #3
xPresso and Spline Text

Thanks base80!

Originally Posted by base80: 1. if you put the thing on integer it will give whole values instead of a value with a comma. one decimal is another story altogether.

Maybe I can turn it into a string and hack off the last two digits somehow. It doesn't really have to round, it just needs to be smaller than 3 decimal places.

2. you can use maths add to add the km/h. But you must set the math node to string mode in order to work. you can add as many things as you like


I'll play around with the add function tomorrow. Thanks again!

warmest regards
Cameron Bowyer
 
Old 11 November 2005   #4
Here’s an expression for rounding decimal values.

The expression works for values between -32,768 and 32,767, which is the range for the C++ short int variable type.

User Data are on the XPresso tag, where the number of decimal places can be set. The Output value is for demonstration purposes and can be removed, along with the node connected to the XGroup output.

The expression seems to work reliably but if there are any problems, feedback would be appreciated.
 
Old 11 November 2005   #5
very cool darter, but could you make the rounding as an input port so i can save the node in the x-pool?

and the limitation of -32k to +32k is not very useful for many things, but ill work around it.
 
Old 11 November 2005   #6
Sure, here's a modified version of the file.
 
Old 11 November 2005   #7
Thanks Darter!
 
Old 11 November 2005   #8
I've reworked the expression so that it works for numbers outside of the -32,768 to 32,767 range.

http://forums.cgsociety.org/showthread.php?t=296922
 
Old 11 November 2005   #9
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:13 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.