URCHN Arkipelago Blendflakes

Blendflakes

From URCHN Arkipelago

Introduction

This is a simple script that, like pyflakes for python scripts, checks a Blendfile for 'niceness' From our perspective, it does checks that make it easier for people to understand/use each other's library files, and uses/enforces/creates a text description file with the same name, so that we can describe our groups:

libraryfile.blend and libraryfile.txt

errors/warnings are written to libraryfile.err

Installation and Usage

Installation

  • Start a new file and go to the User Preferences, select the Addons tab, and click on "Install Addon..." in the lower part of the window.
    Blendflakes addon.png

  • Browse to the file blendflakes.py (usually in tubeSVN/lib/python/addons,) select it and hit Enter
    Blendflakes browse.png

  • Check the activation box next to the addon, and then press "Save As Default" at the bottom of the window.
    Blendflakes activate.png

Usage

  • Open a model file you want to check.
  • Press 'w' and select Show Warnings/Errors in library file (you can also use the spacebar search)
    Blendflakes specials.png

  • Blender will output all warnings by default, and select offending objects.
  • If you use w and want to change options, do so in the last operator region in the toolbar, then press w again (If you use spacebar search you will get a popup anyway)
    Blendflakes repeat.png

  • warnings are shown in the info area (drag down the header)
    Blendflakes info.png

  • if export is checked, they are saved to libraryfile.err (where libraryfile is the name of your .blend file)

Objects not in groups: platform_bounding_box Data not Named(default name): Mball.004 Object Name Copied (use _n not .nnn): caja.001 caja.002 caja.003 wire_shape.001 wire_shape_2.001 Group dupli layers don't match text file: platform_LO Objects in unspecified layers: wire_shape.001 wire_shape_2 wire_shape_2.001 Group in text file without description: platform_V_wire platform_V_boxes platform_LO Object not Named(default name): Cube Data Name not equal Object Name: Mball.004 platform_V_boxes platform_V_tubes Groups text file not in Blend: Groups with objects in unspecified layers: platform_HI_1 Groups not in text file: funnygrop

  • If you have a lot of warnings you might want to uncheck some of them and tackle them a few at a time.

List of Warnings

Following is a list of the things we check for:

Button Error File Header Description Action
Default Data Name Data not Named(default name) The Object Data (e.g. Mesh or Curve) has a default name like Cube, Cone, Armature, (note not the object name) Change the object data names, preferebly to match their Objects. You can use the outliner, the properties editor, python console or an AddOn to do this. If Select was checked, the offending objects will be selected.
Out of Sync Data Name Data Name not equal Object Name The object data and object names do not match; i.e. Cube with the mesh Sphere; the script is smart enough to deal with multi-user data differently. Change the object data names to match their Objects. You can use the outliner, the properties editor, python console or an AddOn to do this. If Select was checked, the offending objects will be selected.
Group Unrecorded Groups not in text file There is a group in the Blend file that is not in the description file Open the libraryfile.txt and add your group into it as follows:

group name description of what the group is for (specify if it is for linking e.g.) comma seperated list of layers (starting with 0) that the group duplis. similar to the above, but for un-duplid layers blank line

Groups in Blend Groups text file not in Blend There is a group in the text file that is not in the .blend. Either delete it's lines from the text file (see above) if it is not needed, or create and use it in the .blend.
Group Descriptions Group in text file without description The Group description in the text file is a blank line. Open the libraryfile.txt and find the group. immeadiatly after it is a blank line, please type a meaningful description into this line, then save and commit.
Group Duplis Group dupli layers don't match text file the dupli layers (the ones that are in the group box in the property editor) don't match what it says in the description file. Either change the buttons in the .blend file to match the .txt file, or vice-versa, depending on what you think is correct. Please note that numbering here starts from zero, not one.
Group layers Groups with objects in unspecified layers This lists groups that have objects in them that aren't specced by the .txt file. Either ammend the .txt file and/or the group, or ammend the layers that the object is on.
Unknown Groups Objects not in groups There are objects in the file not in any group. Please place these objects in a group! if there isn't a good one, create a new group and name it nicely, and create the appropriate description for it in the .txt. It's valid to have '__backup_objects' or so, so long as you don't overly clutter your files with them.
Unknown Layers Objects unspecified layers These objects are in groups, but not in the correct layers for those groups. Either move the objects to the correct layers, or add the layers they are on to the group/s and or the text file.
Copied Object Name Object Name Copied (use _n not .nnn) An object exists with a .001 (for example) in the name. If it really should have a number, change this to _1 (for example). Or rename it if it isn't logically supposed to be numbered.
Default Object Name Object not Named(default name) An object that hasn't been named (Mesh or Cube or...) is in the file. Please give it a meaningful name.

Text Descriptor file Example

TEMPORARY HEADER __vertical_support_cables Vertical cables that are holding up the majority of the wires and gears. 0, 5 -1

__cables_wall Cables that go from wall to wall. These hold up the pulleys and other wires. 0, 5 -1

__small_connectors Connecters in between each pulley segment that connect each segment to the next and eventually to the wall. 0, 5 -1

__main_wall_connectors Connectors at the ends of the wires that connect to the wall sockets. 0, 5 -1

__large_pulleys Large pulleys that operate the gears. 0, 5 19

__small_pulleys Small pulleys that are at the end of each individual vertical support cable. 0, 5 -1

__spring Springs from individual pulleys to long horizontal train track (?) wires. 0, 5 -1

__wall_sockets Wires go through these into the walls, hence them being wall sockets. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 -1

overhead_cables_end Not sure what this group is used for. Bit of a mystery. 0 5

overhead_cables_roof Not sure what this group is used for. Bit of a mystery. 0 5

overhead_cables_V Everything is being grouped under this. 0, 5 19

Error File Example

Future work

More checks

We can check other datablocks , for instance images, materials, etc. We can verify also that file paths (for images) are correct.

Scene files

A subset of these tests are good for scene files, but we might need more, like an 'error' checker, that double-alerts us to blender warnings (these can prevent rendering on the farm)