How to apply a .Net method to 3dsMax
IList propertyNames = TheJObject.Properties().Select(p => p.Name).ToList();
this is the code in .net i'm trying to use JSON library. Everything is fine but i can not handle "p => p.Name" part, what is it, how does it work and how can i change it to maxscript? I need it to be able to create a loop.
Thanks in advance.
Comments
Sekopasa, any progress?
I am currently looking at JSON.NET in max script as well
And I'm pretty much at the same point you were in this post
Hey Mambo4, i not try jet
Hey Mambo4,
i not try jet JSON.NET. Tell me what is the adventage ei. purpose of json.net in combination with mxs.
Cheers!
bga
I'm writing MAX export tools
I'm writing MAX export tools for a game engine that uses JSON to load its assets.
functionally JSON does the same thing as XML, which I guess most Max tools utilize.
but it's less verbose and slightly smaller in file size.
my background is manipulating JSON with MAYA/PYTHON, so I like it better.
Jsont.net is simply the first library I found for using json in dot net. It looks powerful, but getting it to cooperate with mxs is a challenge.
Cool. Thanks for the
Cool. Thanks for the explanation.
bga
-
Ok the project is recreating Daz Studio materials in 3dsmax/Vray at least getting the texturemaps connected to materials.
Daz Studio exports a DSF file which is a JSON file defining the materials. I achieved to get the file into 3dsmax i can reach the values by keynames.
But i realised that i would need loops in some cases. JObject has a count value but you can not reach the values like an array. I was looking for how to create a loop, i thought if i had the property names in an array i would create my own loop.
So i found this thread.
http://json.codeplex.com/discussions/231381
this is what i get with showproperties
.Count : <System.Int32>, read-only
.EqualityComparer : <Newtonsoft.Json.Linq.JTokenEqualityComparer>, read-only, static
.First : <Newtonsoft.Json.Linq.JToken>, read-only
.HasValues : <System.Boolean>, read-only
.Item[<System.String>propertyName] : <Newtonsoft.Json.Linq.JToken>
.Item[<System.Object>key] : <Newtonsoft.Json.Linq.JToken>
.Last : <Newtonsoft.Json.Linq.JToken>, read-only
.Next : <Newtonsoft.Json.Linq.JToken>
.Parent : <Newtonsoft.Json.Linq.JContainer>
.Previous : <Newtonsoft.Json.Linq.JToken>
.Root : <Newtonsoft.Json.Linq.JToken>, read-only
.Type : <Newtonsoft.Json.Linq.JTokenType>, read-only
(by the way getPropNames is not working)
I can send the code but there is nothing fancy in it. Maybe i can upload a dsf file somewhere if you like to see. You can open it with text editor.
Yep, you can attach *.dsf
Yep, you can attach *.dsf below. This is interesting.
I know a little dotnet+mxs integration but JSON is not my specialty.
I have a few questions:
#1] Tell me, you use showproperties for what?
#2] If I understand correctly what you need is to convert DAZ material to VRayMtl.Right?
#3] I try something like this
bga
#1 Just to see which
#1 Just to see which properties i can call
#2 Exactly.
#3 This is not what i actualy need but i didnt know that i could use "to" to store the printed values.
t1 - t3 is the most basic form of a material but for example in t5 its different. There is a "extra" slot and all the material is stored in that slot.
But i will give you a example, after i get the dsf file into a Jobject i can reach the values like below. What i need is to get the keys(strings) needed to call the values.
print o.item["scene"].item["materials"].item[0].item["type"].value
This is not easy task. If
This is not easy task. If other members can't solve this i suggest you to post this topic on CGTalk forum
http://forums.cgsociety.org/forumdisplay.php?f=6
bga
Ok, thank you for trying. At
Ok, thank you for trying. At least i learned something from you.
you can simply
you can simply use
or explain what you want to collect,
bga