Notifications
Clear all

[Closed] Finding file objects and other information

This is going to be a silly question, but is there a way to get node properties and information without having to open the file up?

Like if i want to run a batch tool that looks in a bunch of files to see if a certain object is found inside, do i have to run a batch program that opens each one of the files up, or is there another way.

Here is the code i’m currently using, and it requires a batch to work properly, just basically wondering if other people have a more efficient way of doing this.

Thanks

(
try
(
FindText = “reflectonly”

FoundNodes = for o in objects where matchpattern o.name pattern:("*"+FindText+"*") collect o

if FoundNodes.count != 0 then
   (
     print "----"
     print ( (FoundNodes.count as string) + " " + FindText + " nodes found in file " + maxfilename)
     print 
   )

)
catch()

)

5 Replies

It is possible to get the object names from a MAX file without opening it, as long as Save File Properties is enabled in Customize>Preferences>File tab. Max writes some statistics about the Max file including all object names, polycounts and some plugin usage into the file header which is accessible even when the rest is compressed.

The MAXScript method [b]getMAXFileObjectNames/b reads that info and returns an array of the object names in the scene.

There is also a MaxFind utility that can scan files for properties, and it can be run outside of Max, too. (see MaxFind.exe in the Max root folder). It accesses the same header data.

MaxFind is a really cool tool. Is there anyway to emulate some of its capabilities in maxscript? such as the search for a material? Or any of its other options?

Actually yes, you can open the MAX file for binary input and read until you hit the data – I’ve done this in the past to determine file content without loading huge scenes.
It is a fun form of hacking

 PEN

That is funny Bobo, I have done the same to find CA defs as well.

That sounds like exactly what i’m looking for…if you have the time, could you give me a quick example of how to do this, or be able to point me in the right direction? I’m not to familiar/experienced with reading in file information with code.

Thanks again.