share my first compound, number to string with decimal and round!

share my first compound, number to string with decimal and round!

g2m.agent
Collaborator Collaborator
407 Views
1 Reply
Message 1 of 2

share my first compound, number to string with decimal and round!

g2m.agent
Collaborator
Collaborator

Finally! I have completed my first compound! It's a bit rough, and maybe it's not very efficient, but it works.

It's basically similar to the Python round() function, except that it outputs a string:

 

0 => "0.00"
15.5 => "15.50"
-0.3876 => "-0.39"

 

number: plugin some number.
has_decimal: decide how many decimal places to keep. 0: do not keep decimals; 1: keep one decimal place; 2: keep two decimal places. and so on.
is_round: whether to round.

 

I hope that in the future Bifrost's round_to_nearest and number_to_string will replace this compound because these two nodes should be handling these basic functions.

 

408 Views
1 Reply
Reply (1)
Message 2 of 2

Christoph_Schaedl
Mentor
Mentor

I have to study this one. There is a lot more goin on than i tought.

Thanks for sharing!

----------------------------------------------------------------
https://linktr.ee/cg_oglu