I’m looking for a dialog that will prompt the user with the merge objects dialog, such as this:
mergeMAXFile "c:\\MyFile.max" #prompt
But, I want to restrict the user to selecting a single object, and I only want the object name in return. (Don’t actually merge the object.) Is there a scriptable dialog that would let me do this? I know that this dialog exists… for example if you make an Object-Xref, the Proxy Object option allows you to browse to a file and then select a single object in that file. I suppose I could let it merge the object and then immediately delete it after getting it’s name, but that would be a wasteful solution if they want to pick a huge/complicated object.
Any ideas?
Thanks,
Ray
Ray Collett - Technical Director - Newlands & Company Inc.
This command is listed a little further down the maxfile loading page in the MXS docs.
It gives you a list of objects in the file, but doesn’t do a merge.
That’s right, one can use this dialog to peek into the file and get the names of the objects that are inside.
Then, using this data, the mergeMaxFile() method could be called with one or more of these names to be merged.
Alternatively, the names could be displayed in a custom-made dialog containing a listbox or multilistbox to allow for selection.
There is a caveat though - if a user has saved the Max file with the option “Save File Properties” disabled in the Customize>Preferences>Files tab, the above method will fail and possibly even CRASH Max (at least it used to in Max 9) as it depends on reading the names of the objects from the Max file header which contains the stats of the scene and is uncompressed even if the Compress On Save is on.
That’s right, one can use this dialog to peek into the file and get the names of the objects that are inside.
Then, using this data, the mergeMaxFile() method could be called with one or more of these names to be merged.
Alternatively, the names could be displayed in a custom-made dialog containing a listbox or multilistbox to allow for selection.
There is a caveat though - if a user has saved the Max file with the option “Save File Properties” disabled in the Customize>Preferences>Files tab, the above method will fail and possibly even CRASH Max (at least it used to in Max 9) as it depends on reading the names of the objects from the Max file header which contains the stats of the scene and is uncompressed even if the Compress On Save is on.
I ended up using the getMAXFileObjectNames() with a custom made object selector using listbox. What I was looking for, was a command that presents the user with the standard max object selector interface (just like the mergeMAXFile() does), with the ability to restrict the user to selecting single objects, and returning the name of the object.
It’s good to know about the possibility for a failure/crash. So far I have not seen that crash, but it probably would of been a lot of hours of headache trying to figure out the cause of such a crash.
-Ray
Ray Collett - Technical Director - Newlands & Company Inc.
.... it depends on reading the names of the objects from the Max file header which contains the stats of the scene and is uncompressed even if the Compress On Save is on.
Bobo, your reply indicating the names of the objects are stored in the file header makes me wonder if there is a way to pull additional data about the objects out of the header through the IStorage interface (returned by Interface11::OpenMAXStorageFile)
I’d like to be able to filter the names of the objects returned by getMAXFileObjectNames based on whether or not the object is hidden, or in a specific layer --without having to merge the object in just to determine that I didn’t want it.
Bobo, your reply indicating the names of the objects are stored in the file header makes me wonder if there is a way to pull additional data about the objects out of the header through the IStorage interface (returned by Interface11::OpenMAXStorageFile)
I’d like to be able to filter the names of the objects returned by getMAXFileObjectNames based on whether or not the object is hidden, or in a specific layer --without having to merge the object in just to determine that I didn’t want it.
Any idea if this is worth exploring?
In early days (around Max 4), this sort of object data was clearly visible inside the header even in a simple text editor. I used to access it using binary file input out of the Max file. Lately, it appears that the data might not be included in uncompressed form anymore - I suspect that Microsoft might have allowed Windows and 3rd party applications to include file properties in the ZIP stream, but I might be wrong. Using SDK interfaces or DotNet methods it might be accessible, so I think it is worth looking into it.
Let us know if you have any success…