DETECT MAP TYPE - DIFFUSE, BUMP, REFLECT etc

how to find out map type of a texture

for m in bitmaps do

(

print m.?????????

)

 when I use print bitmaps

I get

name1:Bitmap
name2:Bitmap

But I need

DIFFUSE

BUMP

 

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
artrender.info's picture

add me

add me to your skype! My skype name is also artrender.info
I need to go out, but when I come, I will ask you about payment methods!
Thank you, you really deserve money for your knowledge!

artrender.info's picture

How much to pay!!!!!

I need instead of

Texture: \\S003\all\3d\maps\maps\6_3_9_D.jpg
MAP TREE: Multimaterial\Blend\Multimaterial\Diffuse\Color_Correction\

only

Base material Multimaterial
Texture: \\S003\all\3d\maps\maps\6_3_9_D.jpg
MAP TREE: Blend\Multimaterial\VrayMtl\Diffuse\Color_Correction\

Everything else works fine!!!!

Swordslayer's picture

( struct matDef (mat,

(
	struct matDef (mat, path)
 
	local getSubmats, subMats = #()
 
	fn capitalizeFirst str =
		toUpper str[1] + subString str 2 -1
 
	fn formatName mat index: =
		if isKindOf mat TextureMap OR index == unsupplied then
			capitalizeFirst ((classOf mat) as string) + "\\"
		else (substituteString (getSubTexmapSlotName mat index) " map" "") + "\\"
 
	fn getSubmatsRecurse mat matInst path:"" =
		for propName in (getPropNames mat) do
		(
			local prop = getProperty mat propname
			if superClassOf prop == Material then
				getSubmats prop path:path \
					format:(capitalizeFirst (propname as string) + "\\" + formatName prop)
			else if classOf prop == ArrayParameter do
				for sub = 1 to prop.count where superClassOf prop[sub] == Material do 
					getSubmats prop[sub] path:path \
						format:("Map" + sub as string + "\\" + formatName prop[sub])
		)
 
	fn getSubmats mat path:"" format:"" =
	(
		local matInst = matDef mat:mat path:(path + format)
		append subMats matInst
		getSubmatsRecurse mat matInst path:(path + format)
		subMats
	)
 
	fn recurseMat mat path:"" =
		for i = 1 to (getNumSubTexmaps mat)
			where (local map = getSubTexmap mat i) != undefined do
				if getNumSubTexmaps map > 0 then
					recurseMat map path:(path + formatName mat index:i)
				else if isKindOf map BitmapTexture do
				(
					format "Texture: %\n" map.filename
					format (path + formatName mat index:i + "\n\n") 
				)
 
	local current_mtl = mEdit.getCurMtl()
	local subMatInsts = getSubmats current_mtl
 
	format "\nBase material: %\n\n" (classOf current_mtl)
	for matInst in subMatInsts do
		recurseMat matInst.mat path:("MAP TREE: " + matInst.path)
)
Swordslayer's picture

That's what happens when I

That's what happens when I drop a single argument.. oh well, another iteration:

(
	struct matDef (mat, path)
 
	local getSubmats, subMats = #()
 
	fn capitalizeFirst str =
		toUpper str[1] + subString str 2 -1
 
	fn formatName mat index: =
		if isKindOf mat TextureMap OR index == unsupplied then
			capitalizeFirst ((classOf mat) as string) + "\\"
		else (substituteString (getSubTexmapSlotName mat index) " map" "") + "\\"
 
	fn getSubmatsRecurse mat matInst path:"" =
		for propName in (getPropNames mat) do
		(
			local prop = getProperty mat propname
			if superClassOf prop == Material then
				getSubmats prop path:path
			else if classOf prop == ArrayParameter do
				for sub in prop where superClassOf sub == Material do 
					getSubmats sub path:path
		)
 
	fn getSubmats mat path:"" =
	(
		local matInst = matDef mat:mat path:path
		append subMats matInst
		getSubmatsRecurse mat matInst path:(path + formatName mat)
		subMats
	)
 
	fn recurseMat mat path:"" =
		for i = 1 to (getNumSubTexmaps mat)
			where (local map = getSubTexmap mat i) != undefined do
				if getNumSubTexmaps map > 0 then
					recurseMat map path:(path + formatName mat index:i)
				else if isKindOf map BitmapTexture do
				(
					format "Texture: %\n" map.filename
					format (path + formatName mat index:i + "\n\n") 
				)
 
	local current_mtl = mEdit.getCurMtl()
	local subMatInsts = getSubmats current_mtl
 
	format "\nBase material: %\n\n" (classOf current_mtl)
	for matInst in subMatInsts do
		recurseMat matInst.mat path:("MAP TREE: " + matInst.path)
)
artrender.info's picture

I want to make such a script:

smth like in image

for every ID it's texture paths with it's collor range in bg

AttachmentSize
script.jpg 70.79 KB
artrender.info's picture

I will pay

tell me how much!

artrender.info's picture

Thx but smth missing

results:

Base material: Multimaterial
 
Texture: \\S003\all\3d\maps\maps\6_3_9_D.jpg
MAP TREE: Multimaterial\Diffuse\Color_Correction\
 
Texture: \\S003\all\3d\maps\maps\6_3_9_S.jpg
MAP TREE: Multimaterial\VRayMtl\
 
Texture: \\S003\all\3d\maps\maps\6_3_9_B.jpg
MAP TREE: Multimaterial\VRayMtl\
 
Texture: \\S003\all\3d\maps\maps\6_3_9_S.jpg
MAP TREE: Multimaterial\VRayMtl\
 
Texture: \\S003\all\3d\maps\maps\6_3_9_D.jpg
MAP TREE: Multimaterial\VRayMtl\

in other vrayMtl diffuse, bump reflection etc

artrender.info's picture

close to finish

I've excluded the word map inside "diffuse map" "bump map" etc,

(
	struct matDef (mat, path)
 
	local subMats = #()
 
	fn capitalizeFirst str =
		toUpper str[1] + subString str 2 -1
 
	fn formatName mat index: =
		if isKindOf mat TextureMap OR index == unsupplied then
			capitalizeFirst ((classOf mat) as string) + "\\"
		else  (substituteString (getSubTexmapSlotName mat index) " map" "") + "\\"
 
	fn getSubmatsRecurse mat matInst path:"" =
		for propName in (getPropNames mat) do
		(
			local prop = getProperty mat propname
			if superClassOf prop == Material do
			(
				local matInst = matDef mat:prop path:path
				append subMats matInst
				getSubmatsRecurse prop matInst path:(path + formatName prop)
			)
			if classOf prop == ArrayParameter do
				for sub in prop where superClassOf sub == Material do 
				(
					local matInst = matDef mat:sub path:path
					append subMats matInst
					getSubmatsRecurse sub matInst path:(path + formatName sub)
				)
		)
 
	fn getSubmats mat =
	(
		local matInst = matDef mat:mat path:""
		append subMats matInst
		getSubmatsRecurse mat matInst path:(formatName mat)
		subMats
	)
 
	fn recurseMat mat path:"" =
		for i = 1 to (getNumSubTexmaps mat)
			where (local map = getSubTexmap mat i) != undefined do
				if getNumSubTexmaps map > 0 then
					recurseMat map path:(path + formatName mat index:i)
				else if isKindOf map BitmapTexture do
				(
					format "Texture: %\n" map.filename
					format (path + (substituteString (getSubTexmapSlotName mat i) " map" "") + "\\\n\n") 
				)
 
	local current_mtl = mEdit.getCurMtl()
	local subMatInsts = getSubmats current_mtl
 
	format "\nBase material: %\n\n" (classOf current_mtl)
	for matInst in subMatInsts do
		recurseMat matInst.mat path:("MAP TREE: " + matInst.path)
)

the result:

Texture: \\S003\all\3d\maps\maps\6_3_9_D.jpg
MAP TREE: Multimaterial\Blend\Multimaterial\Diffuse\Map\

but I still can't figure out how to put color corect instead of "Map"

It worked in your second script that you wrote at 1st page. - here:

(
	local bitmaps = getClassInstances BitmapTexture
 
	fn capitalizeFirst str =
	(
		str[1] = toUpper str[1]
		str
	)
 
	fn getTopMats sub =
		for item in refs.dependents sub
			where isKindOf item Material collect item
 
	fn recurseMats mats map previous:#() =
		for mat in mats do
			for i = 1 to (getNumSubTexmaps mat)
				where getSubTexmap mat i == map do
				(
					local topMats = getTopMats mat
					if topMats.count > 0 then
						recurseMats topMats mat previous:(join #(capitalizeFirst ((classOf mat) as string) + "/" + getSubTexmapSlotName mat i) previous)
					else
					(
						format "\tSlot name: %"       (substituteString (getSubTexmapSlotName mat i) " map" "")
						for each in previous do format "/%" each
						format "\n" 
					)
				)
 
	for bmp in bitmaps do
	(
		local mats = getTopMats bmp
		format "\nTexture: %\n" bmp.filename
 
		recurseMats mats bmp
	)		
)
Swordslayer's picture

Yeah, my fault: ( struct

Yeah, my fault:

(
	struct matDef (mat, path)
 
	local getSubmats, subMats = #()
 
	fn capitalizeFirst str =
		toUpper str[1] + subString str 2 -1
 
	fn formatName mat index: =
		if isKindOf mat TextureMap OR index == unsupplied then
			capitalizeFirst ((classOf mat) as string) + "\\"
		else (substituteString (getSubTexmapSlotName mat index) " map" "") + "\\"
 
	fn getSubmatsRecurse mat matInst path:"" =
		for propName in (getPropNames mat) do
		(
			local prop = getProperty mat propname
			if superClassOf prop == Material then
				getSubmats prop path:path
			else if classOf prop == ArrayParameter do
				for sub in prop where superClassOf sub == Material do 
					getSubmats sub path:path
		)
 
	fn getSubmats mat path:"" =
	(
		local matInst = matDef mat:mat path:path
		append subMats matInst
		getSubmatsRecurse mat matInst path:(path + formatName mat)
		subMats
	)
 
	fn recurseMat mat path:"" =
		for i = 1 to (getNumSubTexmaps mat)
			where (local map = getSubTexmap mat i) != undefined do
				if getNumSubTexmaps map > 0 then
					recurseMat map path:(path + formatName mat index:i)
				else if isKindOf map BitmapTexture do
				(
					format "Texture: %\n" map.filename
					format (path + formatName mat + "\n\n") 
				)
 
	local current_mtl = mEdit.getCurMtl()
	local subMatInsts = getSubmats current_mtl
 
	format "\nBase material: %\n\n" (classOf current_mtl)
	for matInst in subMatInsts do
		recurseMat matInst.mat path:("MAP TREE: " + matInst.path)
)
artrender.info's picture

hurraaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay, yay

I'm so glad that you helped me! HUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUGS! Finallllllllllyyyyyyyyyyyy! I will just try to exclude the word map and to put color corect inside

Texture: \\S003\all\3d\maps\maps\6_3_9_D.jpg
MAP TREE: Multimaterial\Blend\Multimaterial\Diffuse map\Map\

where diffuse map\Map\
has to be Diffuse\Color_corect
I'm not sure that I can but I will really try

but everything else works perfectly!

Thank you Swordslayer! I will give you this plugin that I'm making now, and your name will be there like a very GOOD supporter!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.