Author Topic: CoronaPhysicalMtl className return string  (Read 909 times)

2022-07-09, 10:04:22

Siger

  • Active Users
  • **
  • Posts: 167
    • View Profile
    • Siger Studio
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

2022-07-12, 12:06:53
Reply #1

Siger

  • Active Users
  • **
  • Posts: 167
    • View Profile
    • Siger Studio
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"

:)
« Last Edit: 2022-07-12, 12:10:19 by Siger »

2022-07-12, 13:12:16
Reply #2

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 9085
  • Turning coffee to features since 2009
    • View Profile
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)
Rendering is magic.How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2022-07-19, 20:35:22
Reply #3

Siger

  • Active Users
  • **
  • Posts: 167
    • View Profile
    • Siger Studio
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.
« Last Edit: 2022-07-19, 20:44:18 by Siger »