URCHN Arkipelago Blendflakes

Blendflakes

From URCHN Arkipelago
Revision as of 19:50, 25 January 2012 by Bassam (talk | contribs)

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.
  • Browse to the file blendflakes.py (usually in tubeSVN/lib/python/addons,) select it and hit Enter
  • Check the activation box next to the addon, and then press "Save As Default" at the bottom of the window.

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)
  • 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)
  • warnings are shown in the info area (drag down the header)
  • if export is checked, they are saved to libraryfile.err (where libraryfile is the name of your .blend file)
  • 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:

Header 1 Header 2 Header 3
row 1, cell 1 row 1, cell 2 row 1, cell 3
row 2, cell 1 row 2, cell 2 row 2, cell 3
row 3, cell 1 row 3, cell 2 row 3, cell 3

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)

Action

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.

Action

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

Their is a group in the Blend file that is not in the description file

Action

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.

Action

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.

Action

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.

Action

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.

Action

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.

Action

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.

Action

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.

Action

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.

Action

Please give it a meaningful name.

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)