Dev:Py/Scripts/3D interaction/Datablock Tools

提供: wiki
移動先: 案内検索

Description

some tools for fix some issues with the style that blender handle databloks for materials, textures, images and data (meshes). Today we don't have a asset browser to handle with append/ link/import in a nice way so is common to have issues like:

The Problem

1) If you import/append/CTRL+V (from another file) two times a single object, it will make 2 different materials and images. Some like material and material.001, image.png and image.001.png. what is insane in terms of scene management. In a ideal world blender would ask you if you want if you want new datablocks for that or use the one inside your scene. If you import 50 times you will have to edit manually 50 materials and will have 50 garbage images in your UV image editor.

The Solution

1) While we don't have a asset browser, i wrote a python add-on that handle that kind of problem. Just select a group of objects and click in Object-> "Clean Materials Datablock". it will look for the original material (that one without ".xxx" in his name) and apply to the selected objects.

2) I wrote a tool to handle duplicated images in UV/Image Editor too, that can help if you use blender as a Asset Creator for game engines and need set the face texture. In this case the script will handle looking for each face of the selected object and apply the original texture ( The on without .xxx in his name)

TODO

1) I will wrote yet a nice way to handle duplicated data (Meshes). Is so much common duplicate several times a object and after you see that you need edit all the objects manually. So we need to delete all objects, edit one and duplicate again... would be nice just to have that meshes turned in instances of the active one. Select all, select one to copy and click one button.... That will be very useful to me at least

2) There one limitation to my script today. If you don't have a original (the one without ".xxx" in his name) material or image so the script just give up. would be nice if he apply the smaller, the ".001" for example. I will see a way to implement it soon

Release Log

Version 1.0 - The first release. Clean Material and Image duplicated