Announcement

Collapse
No announcement yet.

Override Material Exclusion list Maxscript help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Override Material Exclusion list Maxscript help

    Hi,

    I'm trying to make a quick script to add the currently selected object/objects to the exclude list for the Override Mtl in the render settings and am not having any luck. A little background... I'm working on a revit file with 100's of objects that I'm currently redoing the materials on. Initially I set up the scene with an override material to preview progress. As I update the material on an object want to just click a toolar button and have that object added to the exclude list rather than having to open the exclude list and find that particular object.

    Here's what I have so far:
    Code:
        vr=renderers.current
        ExclList=vr.excludeListOverrideMtl
        Geo =  for o in selection where superClassOf o == geometryClass collect  o
        appendIfUnique ExclList Geo
    Seems straightforward but nothing gets added to the list. I have a feeling it's something simple I'm overlooking. Any help is much appreciated.
    www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

  • #2
    afaik you can't directly append to the override list.
    You need to check if your object is ever into, build you own list, and finnally set your own list as vr.excludeListOverrideMtl

    Comment


    • #3
      Originally posted by KiboOst View Post
      afaik you can't directly append to the override list.
      You need to check if your object is ever into, build you own list, and finnally set your own list as vr.excludeListOverrideMtl
      Exactly right. Simply replacing the append with a findItem and a full replace did the trick. Thank you.
      www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

      Comment


      • #4
        If anyone's interested here's my somewhat finished script. It works just like I need it to, select an object and click on the toolbar to add it to the exclusion list. I did have a small problem where deleted objects that were already excluded were still in the list as "undefined" so there's a small loop to clean those out. I'm planning on popping up a little message box confirming what was added or skipped so there's a few extra lines in there that aren't strictly necessary but don't get in the way. Thanks again for the help - huge timesaver.

        Code:
        macroScript AddToOverrideExcl category:"dPict Tools" tooltip:"Add to Override Exclude List"(
        	vr=renderers.current
        	newExclList= vr.excludeListOverrideMtl
        		
        	--cleanup existing exclusion list for undefined
        	for i = newExclList.count to 1 by -1 do 
        	(
        		if newExclList[i] ==undefined then 
        		(
        			deleteItem newExclList i
        		)
        	)
        		
        	if selection.count>0 then
        	(
        		For o in selection where superClassOf o == geometryClass do
        		(
        			if (findItem newExclList o)==0 then 
        			(
        				append newExclList o
        			)
        			
        		)
        		vr.excludeListOverrideMtl = newExclList
        		
        	)
        	else 
        			messageBox "Nothing Selected"
        )
        Last edited by dlparisi; 09-03-2015, 05:46 PM. Reason: Fixed Maxscript
        www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

        Comment

        Working...
        X