Notifications
Clear all

[Closed] getting data from a max file without loading it

 lo1

Hi

Is there a way to get any sort of custom data from a scene without opening the max file, other than a list of objects in that scene?

for example, scene file properties? I can see them in the windows file properties. How can I get these values in maxscript?

18 Replies
3 Replies
(@denist)
Joined: 11 months ago

Posts: 0

if you work with max 2010 and + , if you want to store some data with max file and read it without opening the file see Accessing AssetManager, AssetUser and Asset Metadata in MAX Files

 lo1
(@lo1)
Joined: 11 months ago

Posts: 0

Thanks, denis, unfortunately this must be done for max 2009.

I can actually see the text when editing the .max file in notepad! If I could somehow open it as a filestream maybe I could get it there.

(@denist)
Joined: 11 months ago

Posts: 0

lo,
look at this link http://calummclellan.com/code.aspx#9
Structured Storage Version 10.2

using this dll and max dotnet you can get access to any file property (get, set, add, delete).

if possible and you know the structure of max file you could probably get out of any data.
Even by just searching for the keywords. If nothing else this could work.

 lo1

sorry, I don’t understand what do you mean? search for keywords where?

open a max file as a filestream or stringstream and search in it. Otherwise I don’t know any other way. Somebody else may know.

 lo1

Thanks losbellos
I’ve tried what you said, but I can not open a max file with filestream (only about 8 characters are returned!)
Have you done this successfully?

Hej I am looking into it. I think you have to open the file in binary mode “rb”. And then search in it, and then readline. I’ll check it out.

it does read only the first 8 chars… HMm, trying to find it out why.

you have to use fopen, and then read it in either binary or text mode. I think the best if you convert-read the part you need into a stringstream and operate on it.
This way it will read all chars/strings what you need. Binary file stream is a bit more limited.
Also the file info/properties data seesm to be encoded. And further on you have to convert the hexadecimal into string or ascii.

 lo1

can you tell me what is the syntax you are using?

I tried
x=fopen @“C: est.max” “rb”
and
x=fopen @“C: est.max” “rt”

but that still just gives me back 8 characters…

clearlistener()
maxfile = “d:\wine.max”
file = fopen maxfile “r”
for i=1 to 100 do (
str = ReadByte file
print str
)
fclose file

also it is possible that the whole max format uses some sort of compression. So be careful.

Page 1 / 2