Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Bug Reporting => [Max] Resolved Bugs => Topic started by: Siger on 2022-07-09, 10:04:22

Title: CoronaPhysicalMtl className return string
Post by: Siger on 2022-07-09, 10:04:22
It's not a bug, but anyway...
When I try to get the ClassName of the CoronaPhysicalMtl, I get a returned strange string: "\rCoronaPhysicalMtl"
With line breaks :) This is not a problem, strings can be filtered.

My test pseudocode (MaxSdk .Net API):

IMtlBase matBase.ClassName // MaxSDK pre 2022
IMtlBase matBase.ClassName(false) // MaxSDK 2022 and up
Title: Re: CoronaPhysicalMtl className return string
Post by: Siger on 2022-07-12, 12:06:53
Maxscript returns:
classOf meditMaterials[24]
///
_CoronaPhysicalMtl

As I said, this is not a problem, but I have to be very careful when serializing/deserializing Json.

XML serialization result: "
CoronaPhysicalMtl"

:)
Title: Re: CoronaPhysicalMtl className return string
Post by: Ondra on 2022-07-12, 13:12:16
this is a hack we do to list the material first in list of Corona materials. We return this from ClassName, but return normal name from InternalName. The latter should be used in maxscript. Is just "CoronaPhysicalMtl" working as expected when you try to use it? (despite max returning the "hacked" version)
Title: Re: CoronaPhysicalMtl className return string
Post by: Siger on 2022-07-19, 20:35:22
I understood.
It's probably normal practice - I also come up with some hacks for sorting (it happens) :)

I think that XML and Json serialize the string differently because the UTF encodings are different. XML: UTF-8, Json: UTF-16. I am now writing a custom Json serializer to unify. I'm eliminating XML for the database almost everywhere (in some places it will remain for backward compatibility reasons) - Json is faster.