I made a batch script for my own purpose some months ago, maybe it'll be useful to others... It's an incremental save function (those coming from 3dsmax will understand its power).
Description : it appends a sequence number to the project file name, or increments the sequence number if the name already has one, and then saves the file to that name. Useful to avoid file corruption or doing fast Save As and keeping multiple versions of the scene efficiently.
Here's the script :
Code: Select all
# Name : Incremental save
# Description: Emulates the 3dsmax "Save +" feature : it appends a sequence
# number to the project file name, or increments the sequence number if
# the name already has one, and then saves the file to that name. Useful to
# avoid file corruption or doing fast Save As.
# Icon : incremental_save.png
# Author : Thomas Hourdel
# Date : Tuesday, 04 June 2007
# Version : 1.0
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Get some needed strings
root_path = scene.getRootPath()
file_name = scene.getFileName()
base_file_name = file_name[0:file_name.find(.flw)]
# Try to detect existing counter using regular expressions
digits = ""
had_digits = False
exp = re.compile("[0-9]*$").search(base_file_name)
digits = exp.group()
had_digits = True
digits = "00"
digits_nbr = len(digits)
base_file_name = base_file_name[0:len(base_file_name)-digits_nbr]
if (digits_nbr < 1):
digits_nbr = 2
digits = int(digits)
digits += 1
digits = str(digits).zfill(digits_nbr)
# Save file
scene.save(root_path + "/" + base_file_name + digits + ".flw")
# Return 0 on success.
if __name__ == "RealFlow":
The icon is attached to this post.
I use it all the time, so I'm pretty sure it's perfectly safe.