Hey there,
I'm using 3ds Max 2017 and want to read a json file in my maxscript and be able to access items in the json.
Is this supported by max or will I have to download some third party library to achieve this?
Thanks.
Solved! Go to Solution.
Solved by Swordslayer. Go to Solution.
Check this thread http://forums.cgsociety.org/showthread.php?t=1044194
Since 2017 you can also use the python-maxscript interop, simply do json = python.import #json MAXScript side and you can call all its methods as if you were in python. Doesn't get much easier than that.
Hi, I need exactly the same thing - reading-writing json files from/to maxscript data (dictionary of strings, floats and arrays)
I could read/write using python only:
import json fileIN = open ("D:\\TMP2\\original.json", "r") pythonData = json.loads(fileIN.read()) fileIN.close() fileOUT = open ("D:\\TMP2\\new.json", "w") fileOUT.write(json.dumps(pythonData, indent=4)) fileOUT.close()
But this would result in a python dictionary; my question is how to have this as maxscript data.
I am trying to use
json = python.import #json
but unfortunately I have no knowledge of python.
It would be awesome if someone could help me get this working inside maxscript!
MANY THANKS!
PS this is the json file I am trying to read/write as maxscript dictionary / arrays
{ "NumTextures": 2, "Positions": [ [-0.19283, 0.00000, 26.94215], [0.19282, 0.00000, -26.94215] ], "Cameras": [ [360, 180, [-0.19283, 0.00000, 26.94215], [-0.19283, 0.00000, 25.94215], [0.00000, 1.00000, 0.00000], "color0", "enabled"], [360, 180, [0.19282, 0.00000, -26.94215], [0.19282, 0.00000, -27.94215], [0.00000, 1.00000, 0.00000], "color1", "enabled"] ], "InitialPosition": [-70.14005, 0.00000, 53.26647], "InitialRotation": 0, "NumNearCameras": 2, "NumWideCameras": 2, "BackColorFactorA": 20.0, "BackColorFactorB": 0.1, "BackRotation": 0 }
Hi, I tried to convert my .obj file to json to load it with three.js. I've done that with MaxScript and the result is the following:
{ "metadata": { "sourceFile": "", "generatedBy": "3ds max ThreeJSExporter", "formatVersion": 3, "vertices": 0, "normals": 0, "colors": 0, "uvs": 0, "triangles": 0, "materials": 0 }, "materials": [ ], "vertices": [], "normals": [], "colors": [], "uvs": [[]], "faces": [] }
It returns empty [], what can I do?