Notifications
Clear all

[Closed] deleting references to texmaps in maxscript

What is the correct way to delete (unused) texmaps in maxscript ?

Background:

I generate a compositemap, and a larger number of masks + mapList entries.
Later i sometimes need to -remove- some of these masks.

Assuming the composite map is in ´compmap´ i tried the following :

delete compmap.Mask[5]

– Result: maxscript says there is no delete operation for my map

compmap.Mask[5] = undefined

– Result: this removes the link in slate. But slate still shows my submap.

compmap.Mask[2].name = “cheese”
max delete “cheese”

– Result: i hoped that i can trigger a delete using max commands.
The first line adds a name to my mask. The second line should delete it.
In slate i can see my texmap node named ´cheese´ , so the first lines works.
But it is not deleted, so the second line is ignored. Is there some kind of implicit namespace that i had to use ?

rootScene[#SME][#View1]
[#CompositeTexturemap____Composite].Properties.reference.Mask[5] = undefined

– Result: this should work. it is a statement from the max listener, when i manually
delete the texmap in slate (using mouse and keyboard).
But when i do it from inside a maxscript it only removes the link from the composite map
to the subtex mask. And the mask is still visible in slate …

At the moment i dont have an idea what else one can do to really remove the texmap.

Matthias

4 Replies

Try:

compmap.layers.delete 5

(If 5 is the layer you want to delete.)

Hi Dan,

i tried compmap.layers.delete 5
This doesnt solve the issue, the link is removed, but the subtexture remains visible in slate.

Do you think this issue is specific to the compositetexturemap class ?
I can imagine 4 reasons that it doesnt work

  1. one needs to delete texmaps in a different way
  2. there is a specific problem with the compositetexturemap
  3. there are still references to the texmaps so max doesnt dare deleting them
  4. slate needs a specific call to delete texmap nodes

Do you know of a tool / way to show the reference count of max entities ?
Do you know if assigning = undefined ever worked properly (at the moment
i am simply puzzled and dont know where to dig next …)

Best Regards
Matthias

Sorry, I see what you mean now about the subtexture remaining visible. I’m not sure it’s possible to delete it using maxscript unless it is selected in the SME.

I was a bit short of time yesterday but I’ve had another look at this again this morning and I get the same behaviour when deleting maps from a falloff map.

The best I can do is the delete the current sme view, create a new one and put the material back into the new view:

(
	mat = $.material --get a material with a composite map
	mat.diffuseMap.layers.delete 2 --delete the layer (2 in this case)
	sme.DeleteView 1 false --delete the current sme view
	viewIndex = sme.CreateView "New View" --create a new sme view
	nodeView = sme.GetView viewIndex --get the IFP_NodeViewImp of the new view
	nodeView.CreateNode mat [0,0] --put our material into the new sme view
)