Giter Site home page Giter Site logo

ollyisonit / maya-style-incremental-saves Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 24 KB

Plugins for other applictions to implement "Increment and Save" the same way that Maya does! Currently implemented for Krita, ToonBoom, and Nuke.

License: MIT License

Python 89.60% JavaScript 6.76% Batchfile 3.64%
maya nuke nuke-addon krita krita-plugin krita-scripting toonboom toonboom-harmony

maya-style-incremental-saves's Introduction

Maya-Style Incremental Save Plugins

Maya has a really neat feature called incremental save where as you save your project a version history will be saved in an adjacent folder called incrementalSaves. I've often found myself wishing that other applications would organize incremental saving the same way that Maya did, so I've decided to start implementing Maya-style incremental save system in other applications I use.

Each folder in this repository contains an incremental save script or plugin designed to add Maya-style incremental saves to another application, as well as instructions for how to install it. Feel free to fork and submit a PR if you want to add an application that isn't supported yet! Make sure to read through the Behavior and Implementation sections though, as the purpose of this repository is to make incremental save behave exactly the same across all applications it's implemented for. You can also use the increment method in incrementaltools.py--it's designed to work with any software as long as you pass in the right methods.

Behavior

There are two main features in Maya's incremental save. The first is that if you save a file, its version history will be saved in an incrementalSaves folder in the same directory as filename.####.ext. However, if you open a file in the version history and save it, then the file you saved will become the new current version. Here's an example:

Let's say you have a file called test.ma. If you save the file, the original test.ma will be copied to incrementalSaves/test.0000.ma and then the new version of the file will be saved as test.ma. Each time test.ma is saved, a new version is copied to incrementalSaves.

Now let's say that you have three incremental saves: test.0001.ma, test.0002.ma, and test.0003.ma. If you open test.0002.ma and then save it, the original test.ma will be copied to test.0004.ma and the file you saved will become the new test.ma. Saving an incremented file is like rolling back to an older version.

This is what the directory structure would look like:

- test.ma
- incrementalSaves
	| - test.0001.ma
	| - test.0002.ma
	| - test.0003.ma
	| - test.0004.ma

Implementation

Here's the algorithm that I use for incremental saving. These steps should run when the incremental save operation is run. Code implementation is in incrementaltools.py:

  1. Check whether the currently opened file is an incremental save of a different file. If the current file has a name of the form NAME.####.ext, is saved in a directory called incrementalSaves, and a file called NAME.ext exists in the parent directory, then the current file is an incremental save.
  2. If the currently opened file is not an incremental save, copy the file to incrementalSaves/NAME.####.ext. Figure out the number to use by scanning the incrementalSaves directory and finding the highest current increment number, then adding one. If incrementalSaves doesn't exist, create the directory and copy the file as NAME.0000.ext. Once the old version is copied, run File > Save (or equivalent) to save the new version of the file as NAME.ext
  3. If the currently opened file is an incremental save, copy the original file (NAME.ext) to the incrementalSaves folder using the same process as step 2, then save the currently opened file as NAME.ext.

maya-style-incremental-saves's People

Contributors

ollyisonit avatar

Watchers

 avatar

maya-style-incremental-saves's Issues

Nuke Error When Saving File For First Time

When you incremental save on an unnamed file (ie. saving for the first time) you get an error saying that you haven't saved a file yet. It should probably trigger the Save As... functionality instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.