Problem with decimal symbol

Problem with decimal symbol

kotorotomoto
Explorer Explorer
2,246 Views
28 Replies
Message 1 of 29

Problem with decimal symbol

kotorotomoto
Explorer
Explorer

Problem with decimal symbol, maxscript crashes if a comma is set as a decimal symbol in the Windows settings, because it cannot recognize a decimal number, for example, instead of 0.3 it sees 0,3 and understands it as a sequence of numbers. The problem is not new, there is probably a simple solution without changing the regional settings of Windows

The problem looks old, but I haven't found a solution

0 Likes
2,247 Views
28 Replies
Replies (28)
Message 2 of 29

istan
Advisor
Advisor

I always change the windows regional settings.

There were even certain max versions, which destroyed already stored node/scene props from dot to comma in the scene accidentially.

Therefore I always take care on the proper windows settings, before I open a scene - just to be on the safe side.

To be honest, a dot was and is always the standard floating point separator and not a comma - for a technician at least 😉

0 Likes
Message 3 of 29

denisT.MaxDoctor
Advisor
Advisor

 Just want to confirm what is said above... To avoid problems, match the Windows regional settings with the MAX localization version.

0 Likes
Message 4 of 29

denisT.MaxDoctor
Advisor
Advisor

@istan wrote:

 

To be honest, a dot was and is always the standard floating point separator and not a comma - for a technician at least 😉


commas are for lyrics 😊

0 Likes
Message 5 of 29

istan
Advisor
Advisor

😄😄

0 Likes
Message 6 of 29

kotorotomoto
Explorer
Explorer

I completely agree with you, since childhood I have also a dot in decimal symbols set in the settings,

but for many this is not the case and explaining to someone that the script will stop crashing

if you go into the Windows settings is a bad decision )
I found something like

setLocaleInfo 0 #LC_NUMERIC "."

but I didn’t understand how it works and whether it works at all in maxscript

0 Likes
Message 7 of 29

denisT.MaxDoctor
Advisor
Advisor

is it your script that is crashing?
are you setting/getting any custom settings from the INI file?

0 Likes
Message 8 of 29

denisT.MaxDoctor
Advisor
Advisor

@kotorotomoto wrote:

Problem with decimal symbol, maxscript crashes if a comma is set as a decimal symbol in the Windows settings...


how does a comma appear in a script? MAXScript does not expect a comma in decimal numbers, no matter what localization is used.

0 Likes
Message 9 of 29

kotorotomoto
Explorer
Explorer

But sometimes MAXScript gets it regardless of the location settings.
Try it (Vray 5)


3456334561.png

0 Likes
Message 10 of 29

kotorotomoto
Explorer
Explorer

'

0 Likes
Message 11 of 29

denisT.MaxDoctor
Advisor
Advisor

@kotorotomoto wrote:

But sometimes MAXScript gets it regardless of the location settings.
Try it (Vray 5)


3456334561.png


who adds this user property?

where and how do you get this value?

0 Likes
Message 12 of 29

kotorotomoto
Explorer
Explorer

I didn’t understand the question, but this is the Vray property of the object, the color of the shadow, any value other than black [0,0,0]


RPAFyRnoXN.png

0 Likes
Message 13 of 29

denisT.MaxDoctor
Advisor
Advisor

Does it mean that VRay adds these user properties automatically? Or do your users add the props manually?

 

Do you read these VRay user props in your scripts (tools) or do third-party tools do it?

 

 

0 Likes
Message 14 of 29

kotorotomoto
Explorer
Explorer

In this particular case with color I get this shadow color in my script and change it to another one using color picker
If I have decimal symbol set to "." everything works without problems if decimal symbol set to "," there are no script errors, but the color doesn't change

0 Likes
Message 15 of 29

denisT.MaxDoctor
Advisor
Advisor

You're not answering my question!

Try again...

Does VRay add these custom properties automatically? Or do your users add the props manually?

 

If VRay does it, you can control only reading the props, if users add the properties, you can give them a tool to do it properly. Capeesh?

0 Likes
Message 16 of 29

kotorotomoto
Explorer
Explorer

I don't answer the question because I can't understand its essence, probably lost in translation
There is a task - to get the shadow color in the script's color picker and change it to another.
I get a color this way:   getUserProp obj "VRay_Matte_ShadowColor"
and I change it to another: setUserProp obj "VRay_Matte_ShadowColor" newshadowcolor
color can be different each time. Maybe there is another way, but I didn't find it
If I have decimal symbol set to "." everything works without problems if decimal symbol set to "," there are no script errors, but the color doesn't change. Forcing the user to change the regional settings of windows may cause bewilderment )
That's all

0 Likes
Message 17 of 29

denisT.MaxDoctor
Advisor
Advisor

Well...

It makes no difference to the setUserProp function what locale Windows uses.
It always sets a string value with a decimal separator ".".

 

So my question again:
How did you get "[0,129412,0,0862745,0,0470588]" in the User Defined Props?

 

0 Likes
Message 18 of 29

denisT.MaxDoctor
Advisor
Advisor

you can try to change the Windows locale and set user props in the MAX:

setuserprop $ "VALUE" [pi, e]
setuserprop $ "COLOR" (orange as point4)

with any locale the result has to be the same:

denisTMaxDoctor_0-1713810983872.png

 

0 Likes
Message 19 of 29

kotorotomoto
Explorer
Explorer

gqrXg5jbJz.png

0 Likes
Message 20 of 29

denisT.MaxDoctor
Advisor
Advisor

If the user props have something like "[0, 129412, 0, 0862745, 0, 0470588]" as a string value, there is no clear and explicit way to decode this into a valid Point3.

So you're left with only the option to prevent such data from getting into the buffer, and no way to read it properly.

0 Likes