THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/01/2010 at 19:55, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 11.5
Platform: Mac OSX ;
Language(s) : C.O.F.F.E.E ;
---------
Evaluate() functions differently in 11.5 than it did in previous versions and its killed many of my distributed plugins.
I've written a LOT of code in coffee that allows the user to specify values inside of the names in a hierarchy, or that pulls such values along with other useful information from a standardized file format outside of my controll. As long as the number, decimal point, whitespace, or negative sign was the first part of the name, I could use evaluate to extract the number. It seems a lot of my plugins are now broken with 11.5 because evaluate now returns a "nil" if the string being evaluated contains string values that are not numbers. Is this an error, or was I just taking advantage of an old leak that got fixed with 11.5?
For example you can quickly try this in a coffee tag, in versions 9.x to 11.027
main(doc,op)
{
println(" evaluation = ", evaluate("15_globular") );
}
prints evaluation = 15.000000 to the console
the exact same code in 11.5 prints "evaluation = nil" to the console
In a much bigger problem, evaluate in 11.5 fails to ignore certain tokens. I have distributed plugins that take a string parsed from a standard format like " -0.1365" and use evaluate to return the number -0.136500, but 11.5 sees the space:negative combination and returns a nil. I now have to parse the number and will have to update all of my plugins if evaluate will continue to function like this. Please tell me its a bug that will change on the next update.
To recap: <11.025 11.5
evaluate(" .1365") 0.136500 0.136500
evaluate("-.1365") -0.136500 -0.136500
evaluate(" -.1365") -0.136500 nil
evaluate(" -.1365_molecule") -0.136500 nil
I personally hope we can return to the version that does lots of parsing automatically, but if not, I need to know what the new rules are so I don't keep producing shortcut code that will become obsolete.
Thanks,
Graham