Updating version ids in Blender addons automatically with Notepad++

Blender addons use a version identifier that consists of three numbers, for example:
bl_info = {
 "name": "Awesome object generator",
 "author": "Me",
 "version": (1, 0, 20150425140302),
 "blender": (2, 74, 0),
 "location": "View3D > Add > Mesh",
 "description": "Adds an awesome object at the 3d cursor",
 "warning": "",
 "wiki_url": "",
 "tracker_url": "",
 "category": "Add Mesh"}
I do virtually all addon development with the help of Notepad++ and I really wanted to have a way to automatically update this version information when I change something. Cvs (and svn) have functionality to update specific strings but I wanted to use this addon version information because having two different tags doesn't sound logical to me. Fortunately with the help of the Python Script plugin for Notepad++ it is quite simple to create a save event listener that does exactly what I want:
from datetime import datetime

# Just in case, we'll clear all the existing callbacks for FILEBEFORESAVE
notepad.clearCallbacks([NOTIFICATION.FILEBEFORESAVE])

def ts(m):
 dt=datetime.now()
 ds=dt.strftime("%Y%m%d%H%M%S")
 return m.group(1)+ds+m.group(3)
 
# Define the function to call just before the file is saved
def addSaveStamp(args):
 currentBufferID = notepad.getCurrentBufferID()
 notepad.activateBufferID(args["bufferID"])
 editor.rereplace(r"(version.*?\(\s*?\d+\s*,\s*\d+\s*,\s*)(\d+)(\s*\))", ts)
 notepad.activateBufferID(currentBufferID)
    
# ... and register the callback 
notepad.callback(addSaveStamp, [NOTIFICATION.FILEBEFORESAVE])
If you place that code in the startup.py file (typically in your roaming profile, for example: C:\Users\Michel\AppData\Roaming\Notepad++\plugins\config\PythonScript\scripts\startup.py ) and make sure the Python Script plugin is activated on startup (by selecting Plugins -> Python script -> Configuration -> Initialization = ATSTARTUP and restarting Notepad++) then any subsequent save will look for a version identifier and will replace the third number with a timestamp.

WeightLifter add-on: small bugfix release

Version 20150418 fixes a small bug that could show an error when using WeightLifter on a mesh with an associated particle system. The new version is of course available free of charge to people who have already purchased the add-on. Check the BlenderMarket page for more details.

Floor boards: additional pattern

The latest version (20150404) of the floor board addon adds a border option to the square pattern. Besides parquetry this might come in handy for wooden patio tiles and the like

Overview

The floor boards addon has quite some history on this blog and elsewhere so for convienience I've gathered the most important links here.

Download

The addon is available on GitHub. (Click to download it to any location on your PC, then in Blender go to File->User Preferences->Addons and choose Install from file. If you have a previous version of this addon you should not forget to remove the addon first by locating it in the list of addons and clicking Remove. The addon can be found under the Add Mesh category.)

Discussion

If you like you can give feedback on this addon in this blog or in this BlenderArtists thread.

History

Full Review: Blender Cycles Materials and Textures Cookbook, 3rd edition

Bigger and better


many revised editions of books offer just minor improvements but this book offers much, much more. Expanded to just under 400 pages it covers everything about Cycles in a clear and extremely detailed manner.

(click to go to publisher's site)
The author clearly knows what he is talking about and explains in a structured manner how Cycles works, how to set up node based materials and to design materials from the bottom up. That last part is crucial: in order to create a material that is believable or even photorealistic a lot of detail is needed. The best way to get results is to design from the bottom up and add layers of detail step by step and in this book this is illustrated in minute detail.

Another great addition to this edition is attention for special effects: features like fog, fire, global illumination or shadeless materials. Cycles is quite capable to create those effects but these are not always easy to configure. The new sections in this edition do an excellent job in explaining them.

pros:
  • up to date
  • detailed description of general concepts and specific materials
  • well structured
  • featurmaterials (like leather, stone) as well as effects (like fog, fire)
  • downloadable materials are a good starting library
  • quality of materials is excellent
cons:
  • hi-res illustrations must be downloaded separately (there are only lo-res ones in the pdf. This distracts greatly from the reading experience)
  • some more information on lighting would have been useful. This could easily fill a whole book itself but some information on this subject would make it easier to get the most out of these materials.
Conclusion:

Good value for your money.

next week or so i will be reading the third edition of the Blender Cycles materials and textures cookbook. I'll post a full review on this blog when I'm done. The previous edition was pretty good so I am curious to see how this edition will turn out.

Floor boards revisted

or why a bit of competition is a good thing

A while ago Cedric Brandin (clarkx at BlenderArtists) was working on an addon that could produce parquetry patterns and because he knew my floor boards addon he asked me some small code specific questions. I was happy enough to help him out of course and he went on to create a very useful addon.
But the idea of patterning a wooden floor sounded to me like a great addition to my addon, and I kept thinking about it. I even looked at his code and in the end decided to incorporate the idea of parquetry patterns. I didn't actually use any of the code because it proved to be difficult to merge the different styles of coding but I owe him a big thank you for the idea.


I did not yet implement all the different patterns but each pattern gets the same benefits as the regular flooring, including randomization options, modifiers and the option to use a floor plan.
At the same time I cleaned up the code, made the interface a bit more use friendly, made it possible to assign materials and keep them through changes and provided more efficiently packed uv maps.
In the near future I might add some additional parquetry patterns. The code itself is quite modular so this should be easy enough to do.

Code availability

The new version (20150320) is available from GitHub.

New features

patterns
currently just regular flooring, herringbone parquetry and square, alternating tiles
materials
assigned to the flooring are now retained even if you change the flooring later (thank you Lell for the suggestion)
size
The length and width of the flooring are now exact (any excess is trimmed of with the bisect_plane modifier)
uv-maps
randomized uv-maps are now packed more efficiently (in 'Shuffle' mode)

Known bugs and misfeatures

  • matching a floor to a floorplan is buggy: Blender's booleans don't seem good enough to deliver quality results, showing odd behaviour when the gaps between planks are small. Also if the floorplan is not 2D, the addon crashes.
  • The randomized uv-maps are still not packed in an optimal way
  • The default values for the bevel modifier are awful
Any comments are welcome of course and this BlenderArtists thread might be the best place for discussion.

Transfer vertex weights to vertex colors and vice versa

In a previous article I mentioned that my WeightLifter addon was updated and could now (besides many other things) transfer vertex weights to vertex colors and vice versa. Because this might be of use to many people I decided to split off this specific functionality into a separate addon and provide it for free.

After installing the addon in the usual manner you get two new menu options: one in the Weights menu in Weight Paint mode called VertexColorsToWeights and a corresponding one in the Paint menu in Vertex Paint mode.


Weight paint mode

In weight paint mode clicking on Weights -> VertexColorToWeight will transfer a color from the active vertex color layer to the active vertex group. If there is no vertex color layer present a will cretae a new one. You have an option to choose which color channel to use as weight or to combine all colors.

Vertex paint mode

In vertex paint mode clicking on Paint -> WeightToVertexColor will transfer the weights from the active vertex group to the active vertex color layer. if there is no veretx group present it will create a new one. You have again an option to transfer the weights to a single color channel or to all color channels.

Code Availability

The code can be downloaded from my GitHub repository.