Since version 2.5, you can now specify custom command-lines the editor should run before and after it writes, creates, or deletes files.
You can also specify any number of custom commands. They will appear under the “Version control” menu when right-clicking on an asset in the content-browser.
This helps to manage assets in projects using version control systems such as perforce.
This feature is still experimental. Ultimately we will expose a more deeply integrated version control system showing the status of each asset in the PopcornFX editor directly.
Do not hesitate to contact support if you feel there’s something you need to do but can’t do right now with the current settings.
To access the version control settings, open the user settings window with “Edit > Editor preferences”. Then under “General” settings and select “Version Control”.
Check the “Use Version Control” checkbox to enable the experimental version-control features:
You can now add any number of custom commands, along with the command-line they should run.
A number of special tags are available, which will be expanded before running the command-line:
Name of the custom menu entry. In the example above, if $(ActionName) was used in the 2nd command-line, it would expand to Checkout.
Absolute path of the asset this command was run on. For example: “D:/MyVFXProject/Particles/Test.pkfx“
Space-separated list of the absolute paths of all the other assets the current asset uses. If the command is run on an effect that uses 2 textures and a mesh, it will expand to 3 absolute paths.
These will appear when right-clicking on an asset in the content-browser:
If you click on the “Commandlines (Experimental) (Advanced)” title, it will expand the advanced settings. These allow you to specify a custom commandline to run before or after the editor writes, creates, or removes a file.
This is typically where you’d hook a commandline to call your p4 client and automatically checkout a file before it gets saved.
Whenever the “Pre” commandline returns an error, the editor will abort the action, and not call the “Post” commandline.
Whenever the “Pre” commandline does not return an error, the editor will try to perform the action and will always call the “Post” commandline, even if the action failed.
So for instance, if the “Pre write” commandline succeeded but the editor failed to write the file because it is still readonly, it will still call the “Post write” commandline.
With this setup you can then disable the “Content editors > All Editors > Warn On Open If Read Only” option to have a fully transparent “auto-checkout on save” pipeline.
We provide a python script to ease the use of perforce with the Advanced command-lines.
You can use it as is or take it as example to write your own script for your version control system.
This script requires fixes made in the PopcornFX Editor version 2.9.19 to work, so you will need this version or above.
To use it, download the script here perforce.py and setup the Advanced command-lines like this:
popcornfx_workspace by the name of your workspace.
In an upcoming version, you can expect to be able to specify command-lines to get source-control status. (whether a file is checked in source control or not, if it’s up to date, has local changes, etc…)
Currently, the command-line settings are in the user settings, which are local to each user.
You might want to customize source-control commandlines per-project instead. This should be done in the project settings, which are themselves checked in source-control, so that every single contributor on the project doesn’t have to manually specify command-lines in his/her local user settings. This will come in a future build.