Extensions:2.6/Py/Scripts/3D interaction/Datablock Tools

提供: wiki
移動先: 案内検索
Datablock Tools
Remove duplicated Datablocks of image, mesh and materials of selected objects
UI location View3D -> Object
Version 1.1 Author(s) Vitor Balbio
Blender 2.6.9 License GPL 3+
Category 3D View Distribution External

Executable information
File name DatablockTools.py
Current version download https://raw.github.com/vitorbalbio/code/master/Blender%20add-on/DatablockTools.py

Links http://www.blenderartists.org/forum/showthread.php?320593-Datablock-Tools



That add-on add 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.

2) If you duplicate a object or set instances as Single User there is no way to turn it instance without edit the data one by one.

What it does

Clean Material Datablocks: 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-> DataBlock Tools "Clean Materials Datablock". it will look for the original material (that one without ".xxx" in his name) and apply to the selected objects.

Clean Image Datablocks: 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). To use select the objects to apply and click in Object -> DataBlock Tools -> Clean Images Datablocks

Set Instance: Add a nice way to handle duplicated data (Meshes) turning it in instances of the Active Object. Select all, select one to copy and click in Object-> DataBlock Tools -> Set Instance.


2) There's a limitation in my script today. If you don't have a original (the one without ".xxx" in his name) material or image 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.1 - Fixed some name issues and add the "Set as Instance" tool for replace data

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