Removing redundant datablocks?

Hey guys,
as some of you know I like to make game scenes in isolated files and then append them all into one crazy-huge file near the end. Well I just did this with the new Zark game and of course the big new file now contains a couple dozen iterations of my favorite textures in it. You know, as in metal_dirty.001, metal_dirty.002, metal_dirty.003, et cetera. This works wonders on the filesize, as you might imagine. Does anyone know an efficient way to whittle it down to only one copy per datablock? The only way I can think of is to do it by hand, which at this point would probably take several days assuming I forgo sleep and meals. Any suggestions?

I would venture to say it’s because the files were packed before you appended them.

I have no idea how to fix it though.

When I have image file problems I find the “Fix Broken Paths” script helpful, but I don’t think it would help in your situation.

For our buildings and trees p00f came up with an excellent idea!

everything that shares the same texture/material is joined together into 1 big mesh, then we seperate after appending, and unlinking.

you can also append entire scenes, but if you already have a material block withthe same name, expect a few duplicates.

He also says that there is some way to link, and use Proxies later. So we might have 1 master file with the actual models. then we only have to tweak 1 file to fix all the instances in the game, somewhat like the unreal static mesh system.
I will believe it when I see it :stuck_out_tongue:

The way blender appends things is the most lame thing I have ever experienced, even if you append from the exact same scene, with the exact same materials, it assumes you want 200000000 duplicates of the material for some reason.

it was probably made by the same guy who makes the number input fields that max out at 1… so no matter what , if you enter any value except 1 you have to type a %*^&ing “.” every single time.

hope someone comes along with an easier way than what we are using, our plan are for literally hundreds of different buildings and trees.
Manually separating meshes and re-centering them is not “time effective” .

nor is appending a bunch of single objects, then having to re-set the materials,
close blender
re-load blender
make sure all the unwanted materials have a little “0” in front of them.
close blender
then repeat the above steps with every separate material you wish to use.

anyway, I am looking forward to a better solution for this, hope someone comes along with one :slight_smile:

you could probably make a script or something

like and reads through and like matches everything before the .00x or whatever and if thats the same then make all the objects faces that use it use the new one

or something like that i dunno i havnt thought about it much

Haha!, mmph!

just import all your objects with append, then select them all, select the object with the material you want, and press control -L and link the materials :stuck_out_tongue:

save your file

close blender
open blender

save the file again

and you got it :slight_smile:

p00f but what if the objects have more than one texture on them

and not just materials.?

I had that same thought, boots. But p00f’s method is very worthwhile for all of the shared assest (like the Zark model and whatever else may be common).

I don’t do much with the main Blender API, but I do know that a script would be able to automate this for you. The question is, would the time taken in writing the script be less than the time taken to do it manually? I suppose it would be worth writing the script if you knew you would need it again later or if you wanted to share it with the community so that others who use the same method you do could also benefit.

The ultimate solution would be a version of Blender that checks for identical textures and uses the one already in the file if it is available. But that is just dreaming right now…

Yeah, I don’t actually use blender materials except for Dyn settings. I’ve been doing games in Blender since version 2.2 or thereabouts and I’ve become very set in my ways. There aren’t very many materials but there are hundreds of textures, and many duplicate texture images. It is a MESS.

quote-p00f but what if the objects have more than one texture on them

well I usually don’t, I am not sure how to share the textures.

I usualy make the objects, with all the texturing I need on 1 single texture.

We now have a python script, that will take all your textures, and put them and the UV maps on 1 huge texture.
sometimes this dose not work out very well.

something my father told me a long time ago…
the “p’s” of success:
“Proper Pre Planning, Prevents Piss Poor Performance”

The only time I have the need for a huge tiling texture is usually on terrains

here is an example :

wish I could help with the texture data block thing.