Home Technical Talk

Maxscript favor needed, anyon wanna help

polycounter lvl 18
Offline / Send Message
Rhinokey polycounter lvl 18
Any max script gurus out there, how hard would it be to make a script that goes in the material editor. looks at the name of the texture in the difues slot. paste that name in the name slot at the top of each heiarchy of the material,, so if you have a multi sub with 60 materials, it will look at the difuse texture in each slot, copy that name to the bitmap name slot, the material name slot (for that material not the multisub). and then also copy it in the big list of names on the multi sub list.

I'm not sure how complex this is to do. but if its some easy thing one you super heroes could do i would appreciate it

i tried the one linked at the bottom of this page http://www.scriptspot.com/forums/3ds-max/general-scripting/rename-multisub-materials and while its a start, it only changes the material name and not the bitmap name, and not the name in the multisub list.

Thanks.

Replies

  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    ok.
    fn copy_bitmapname_to_materials=
    (
    	myslot = medit.getactivemtlslot()
    	mymat = getmeditmaterial(myslot)
    	if classof mymat == multimaterial then
    	(
    		--iterate over multimaterial materiallist
    		for i = 1 to mymat.materiallist.count do
    		(
    			m=mymat.materiallist[i]
    			--if there is a diffusemap, get the filename
    			if classof m == standardmaterial then
    			(
    				--if it is a bitmap
    				if classof m.diffusemap == bitmaptexture then
    				(
    					try(thepicname = getfilenamefile(m.diffusemap.filename))catch()
    					if thepicname != undefined and thepicname != "" then
    					(
    						m.diffusemap.name = thepicname
    						m.name = thepicname
    						mymat.names[i] = thepicname
    					)
    				)
    			)
    		)
    	)
    )
    
    copy_bitmapname_to_materials()
    

    If you need any tweaks just let me know. It will name the multisub name, material name and bitmaptexture name to be the filename (minus extension) of the bitmaptexture.
  • Rhinokey
    Options
    Offline / Send Message
    Rhinokey polycounter lvl 18
    This seems to work PERFECT! thanks a lot!
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    no probs, glad to help.
  • TokyoWarfare
    Options
    Offline / Send Message
    Wow thank you so much! still super usefull in 2016 :).  Teste in max 2014. Life saver.
Sign In or Register to comment.