Versioning

Mangrove behavior

When a new version of a node is created, type files (see Types for more details) which “copy” parameter is checked will be copied.
If the node has the version 1 active and a version 2 exists, a version 3 will be created. And File types of version 1 will be copied to version 3.
If a file type of version 3 already exists, it will NOT been overwritten.
First version number and padding is set in the project settings.
With a first version to 1 and a padding to 3, a new node will be created with the version 001.
With a first version to 0 and a padding to 5, a new node will be created with the version 00000.

Deleting a version does not delete the associated files.

Upversion in Softwares

To add a new version in Mangrove while this one is opened in a software, you can use the mgvCom module to drive Mangrove from the software. You have to create a save function that will call mgvCom.newVersion().

Here is some examples.

Houdini

your_path/save_script.py:

import mangrove.mgvCom as mgvCom
new = mgvCom.newVersion()
path = hou.hipFile.name()
pad = len(new)
old = path[-4-pad:-1-pad]
path = path.replace("_v%s." % old,"_v%s." % new)
hou.hipFile.setName(path)
hou.hipFile.save()

your_path/MainMenuCommon.xml:

<?xml version="1.0" encoding="UTF-8"?>
<mainMenu>
  <menuBar>
    <subMenu id="file_menu">
      <label>File</label>
      <scriptItem id="Save+">
      <label>Save+</label>
        <scriptPath>your_path/save_script.py</scriptPath>
        <insertBefore>h.save_as</insertBefore>
      </scriptItem>
    </subMenu>
  </menuBar>
</mainMenu>

user_home/houdiniXX/houdini.env:

HOUDINI_MENU_PATH = "your_path;&"

Nuke

menu.py:

def mgvSaveNewCompVers():
        import mangrove.mgvCom as mgvCom
    new = mangrove.newVersion()
    if new:
        path = nuke.scriptName()
                pad = len(new)
                old = path[-4-pad:-1-pad]
                path = path.replace("_v%s." % old,"_v%s." % new)
                nuke.scriptSaveAs(filename=path)
        else:
                nuke.message("Mangrove is not responsive, saving aborted !!!")

m = nuke.menu( 'Nuke' ).findItem( 'File/Save New Comp Version' )
m.setScript('mgvSaveNewCompVers()')

Blender