PDA

View Full Version : sceneMaterials doesn't update?


macrod
11-14-2007, 12:08 PM
Hello,

Create 2 objects, assign unique material to each.
sceneMaterials.count outputs 2.
Delete 1 object.
sceneMaterials.count still outputs 2.

Who can help me on this?

Thanks in advance!

Bobo
11-14-2007, 02:15 PM
Hello,

Create 2 objects, assign unique material to each.
sceneMaterials.count outputs 2.
Delete 1 object.
sceneMaterials.count still outputs 2.

Who can help me on this?

Thanks in advance!

The SceneMaterials content is only updated when materials are added and when the scene is saved/loaded. (Not sure why, but that's how it is).

So if you keep on adding materials, the only way I know to update the content and remove the "orphaned" materials is to perform some form of a file operation.

One way would be to call holdMaxFile(), but if your scene is large, it would mean wasting time. Thus, it is a much better idea to save an EMPTY Max file and delete it immediately.

sceneMaterials.count --> 2
theFile = (GetDir #Scene + "\\_temp.max") --define the file name
saveNodes #() theFile --save no objects in the file
deleteFile theFile --delete it again
sceneMaterials.count --> 1

Gravey
11-15-2007, 05:28 AM
Great idea bobo. I know that will come in handy

macrod
11-16-2007, 03:35 AM
Really clever method, Bobo, thank you!

EverZen
11-16-2007, 02:08 PM
Nice Spot macrod, and a sublime solution bobo. Cheers.

I am just starting a material cleaning program, and I would have had my head hurting for ages over that one.

much appreciated,

Rich

CGTalk Moderation
11-16-2007, 02:08 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.