Juzwa Posted February 26, 2015 Share Posted February 26, 2015 Hi, I have some animated parameter from some channel and I use it on the font SOP to display it's value in the viewport. How do I make this value to be always a 3 or 4 digit? eg: - when the value is 0 i want to display 000 - when the value is 5.6663562 5.66 - when the value is 100 i want 100 Quote Link to comment Share on other sites More sharing options...
pezetko Posted February 26, 2015 Share Posted February 26, 2015 E.g. with hexpression (but this example works only for positive numbers): { in = fit01(fit($F,1,100,0,1),0.0,150.0); # input data digits = 4; # digits to display d = digits-strlen(int(in)); mult = 10^d; out = int(in*mult)/mult; # adjust tenths values return ifs(out==0,padzero(digits,out),out); # fix for 0 } pz_round_to_digits.hip 2 Quote Link to comment Share on other sites More sharing options...
Juzwa Posted March 4, 2015 Author Share Posted March 4, 2015 (edited) Hi, Sorry for such late response. Thank you so much. But I'm having some problems. Your example works fine. But when I copy/paste the code to the font SOP I get the code itself, it does not evaluate, how do I make it to evaluate in the font? EDIT: Ok found it > edit expression, then paste and hit apply. Thank you so much! Edited March 4, 2015 by Juzwa Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.