Notifications
Clear all

[Closed] Toggle Show Map in Viewport for Multi-Sub?

I have a couple of scripts I use for toggling the display of maps in the viewport for selected objects. They work fine on objects that are using a standard material and either shows or hides the maps. But if the object(s) have multi-sub materials, they don’t work. Any idea what it would take to make them work with objects with multi-subs? Here is the Hide script:

(
	fn viewportmaps sel val=
	(
		for s in sel do
		(
			try (showTextureMap s.material val)
			catch()
		)
	)

	viewportmaps (selection as array) false  -- or false!
)

Thanks!

4 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

you have to apply showTextureMap for all sub materials of the multi-material…

Hmmm… I have found an old Boboscript that would seem to do what I want but it doesn’t seem to work. The old SMIV (Show Map In Viewport v2.3) seems to be able to show/hide maps down in multisubs (according to the code itself) but errors out when I try to use it on an object with a multisub material.

Thanks for the ideas. In the meantime, I have found a script at Scriptspot that will toggle the display of materials and maps.


 (
  	fn viewportmaps sel val=
  	(
  		for s in sel do
  		(
  			try (showTextureMap s.material val)
  			catch()
 if s.material != undefined AND classOf s.material == multiSubMaterial do
 (
 for m in s.material.materialList do showTextureMap m
 )
  		)
  	)
  
  	viewportmaps (selection as array) false  -- or false!
  )
 

dunno if
multiSubMaterial
is the correct class but you get the idea