Notifications
Clear all

[Closed] Checksums & Removing dupe scene materials

I recently wrote a blog entry on how to use checksums w/MaxScript to quickly remove duplicate materials in a 3ds Max scene. It can optionally hook into Python, too, for more robustification.

http://techarttiki.blogspot.com

16 Replies
 PEN

Nice work, that was good reading. I posted a link on my home page in the Features links area to your site.

The Tiki has become the latest addition to my ever growing rss feeds of awesomeness.

vScourge,

Top stuff, this sort of python linking is really inspirational, and you are a legend for documenting it so completely. Can I ask exactly why you are linking to python though. Is it for the convenience of the built in Checksum functions (and all the other libraries/functions avaliable in python) or is there a speed implication.

I know that python isnt the fasted language out there, but with linking it via this COM setup does it out perform Maxscript speed wise?

The reason I ask is that I have a flocking system that is written in Maxscript and suffers terrible speed issues for large crowds/boid numbers. Would transfering large amounts of the heavy functionality out to python help at all for a speed gain?

Thanks for the post! Really impressive.

Cheers,

Rich

Thanks, glad you found that useful!

Whether to use Python or not is a case-by-case thing for me. For this it was convenience, and the fact MaxScript just doesn’t have any checksum methods. I suppose I could have dug up how to calculate an MD5 checksum and implemented it in MaxScript, but this was far easier.

Python isn’t as fast as C, but still performs well compared to other dynamic languages. I think you’ll find it rips through a lot of things that take entirely too long in MaxScript. Like plowing through XML/text files, etc. But again, depends on the specific task.

I haven’t found the COM layer to noticibly affect execution speed. I have one Python script that moves an in-Max camera at 30 fps with no hitches at all.

As for your flocking tool, do you know what specifically is the bottleneck?

Some notes on my attempt at using this RemoveDupeMaterials script.

  1. The download .zip file on your website has comments for –getChecksumMXS and –getCheckSum but both lines (even the Python method uses the MXS function.

  2. I ran it on a huge scene and it didn’t work, it took 10minutes (which is totally fine) but it was replacing materials that weren’t at all alike, some it left alone (maybe 30%) but the others it replaced erroneously.

I can zip up a sample if you like, but I did not get predictable results.

-Colin

Fixed the checksum function name and updated the ZIP. I also added the size parameter back into the MXS function call, which should make checksum collisions far less likely. Although the Python one is still far better on that front, use it if you can.

If you’re still getting bad results and can send me that scene, or another repro case that would be excellent. Thanks, Colin!

Absolutely vScourge,
I think you’ve come up with a really great way of removing dupe scene materials! And am anxious to save time and energy using your script. I’ve installed python but for whatever reason I couldn’t get the .py installcom script to work…I’ll try again and figure that out. I would rather use that method anyway. I’ll let you know my results and get back with you soon.

-Colin

Also:

Here’s a suggestion: I would have the script detect if the user can use the python method or if it should use the mxs method. Nesting your python method in a try()catch() in a function called “useWhichMethod” and then storing which one to use in a variable would be a simple way of determining it and storing which method to use down the line…It would make it more fail-safe for our office seeing as most people don’t have python extensions installed.

Just my 2 cents
Colin

here is my python error when running InstallComServer.py

I installed python-2.4.1.msi from the python website…


  Registering COM server...
  Traceback (most recent call last):
    File "C:\Documents and Settings\*\Desktop\InstallComServer.py", line 32 in ?
  	import win32com.server.register as comReg
  ImportError: No module named win32com.server.register
  
Page 1 / 2