Collect all bitmap from object(s) then do something

example case of do something:
make a neat folder, rename each suffix files by properties name of maps then
move that files to new folder(the naming is object name), such as :

"d:\Maps\head_character_00.jpg " become "d:\Maps\JhonDoe_head\head_character_diffuse.jpg"
"e:\Maps\head_character_01.jpg " become "d:\Maps\JhonDoe_head\head_character_opacity.jpg"
"c:\Doc\head_character_02.jpg " become "d:\Maps\JhonDoe_head\head_character_occlusion.jpg"
"d:\Maps\head_character_03.jpg " become "d:\Maps\JhonDoe_head\head_character_bump.jpg"

and etc.

if the filenames are same then a script can be copy the files or skipping (as an option) or move to global folder.

it can be applied to random material (standard, multi material, vraymat, mentalray material and etc)
and random maps (sss, bitmap, fallof, blend and etc )

it would be nice to optimize and make faster(it can use timestamp() fn ) or simple writing maybe.

can start with this function

    fn GrabAllMaps mat arr = 
	(
		if mat.numsubs != 0 then (
			for i = 1 to mat.numsubs do (
				if mat[i] != undefined then (
					if classof mat[i] == SubAnim then (
						if superclassof mat[i].object == textureMap then (
							if mat[i].object != undefined then append arr mat[i].object
						)
					)
				  GrabAllMaps mat[i] arr
				)
			)
		)
	)

or perhaps you have another idea

hope this is a discussion to find a solution.

Thanks and Regards :)

Comments

Comment viewing options

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

...

Then i was lookind the solution which will replace workflow like:
# open f***ed up project (file) with many maps, proxy, ies from different location
# archive all
# open archive and copy all assets to specified folders
# open Asset Tracking and repath all things

When U working on big projects over and over again this can be very annoying.
Also Asset Tracking don't recognize many 3rd-party maps.

I have not had free time to finish the tool. The first part (code that I wrote) can operate on materials only (find maps in extracted archive copy all assets in spec. folders and repath all)
Still need to consider :
1. modifier maps - few of theses have map properties like (Displace, VRayDisplacementMod, Vol.Select etc.)
2. light maps and IES - (VRayLights, Standard and Photometric Lights)
3. environment maps and maps in Render Setup dialog
4. proxy files - (Vray , Mental Ray and maybe Final Render)

bga

Budi G's picture

yes, I know it will be

yes, I know it will be complicated.
but that's what I need, materials only first.
I think for the time being until collecting maps and bitmaps for a while..

give me a time to read and to understand in whole thread.

how about to remove all instance maps from "mapsArr" array ?
I am still not clear when seen in the thread.

have you used makeuniquearray fn to remove all instance maps ? or no need

barigazy's picture

...

No need to use makeUniqueArray because if map is already copied in destination folder not be copy again.
After struct definition use this:

--example
global copy_repath = copyRepathFiles ()
copy_repath.sourceFolderPath = @"d:\Maps\"
-- the folder *JhonDoe_head* must exist. Fn will not created folder for u.
copy_repath.targetMapsFolderPath = @"d:\Maps\JhonDoe_head\" 
-- select some objects and run next line
copy_repath.copyAndRepath doCopy:on doRepath:on

bga

Budi G's picture

ok, I've understood now next

ok, I've understood now

next think about memory allocation.

mapsArr=#() -- as we know it's define an empty Array to store the result

when get All maps and bitmap from one object, we doesn't know if they have many filenames or no. or have a long filepathname or no.
I just think all memory of filenames should be put to external file such as using INI or Dotnet file.
It is safer to the memory allocation of 3dsmax for a while.
I remember(a long time ago in scriptspot forum) as Anubis Said the Dotnet is the best thing.
but I don't know if this is the best method or no for this case before I try this one.

so I need a time to write some code.

btw in here the night time, I need to sleep ... thank you and see you next time

barigazy's picture

...

At the and of calculation I free memory by *mapsArr*.
This process can't be fast. Even if you store all filepaths in external file writhing operation will require some time to process. Even archive process require some time to finish :).
I did not wrote this code over one night, I tested meny posible solution but this (last one) works fine for now.
Ok I give you some time for testing and we can then talk.
Good night Budi :)
BTW my clock shows 6:30PM

bga

barigazy's picture

...

I forgot to ask which version of max u use.
I plan to create .net GUI (devXpress) for future tool which is not supported in 2010 and below. Or if you want to implement this in your existing tool then U welcome. I do not mind.

bga

barigazy's picture

...

I have already disscused about very similar topict with DenisT long ago on CGTalk.

bga

Budi G's picture

interesting ;) ... it works

interesting ;) ... it works on dotnet

but many pieces of the script throws an error when I tried a few pieces from that topic.
so where's a final/last function ? if you don't mind ...

Comment viewing options

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