How To Compile PiPL Resource In Visual Studio
GOAL
Today’s goal is to compile PiPL resource with custom build step in Visual Studio while Adobe plug-in development.
If you’d like to know about PiPL resource, see the appendix “What is PiPL resource?” in this article.
Environment
Windows10
Visual Studio 2015 Community
After Effects CC2019
After Effects 17.1.2 Win SDK
Method
1. Open solution file with Visual Studio
Make sure .r is added to the current solution file.
2. Open properties of PiPL resource file
Right-click the PiPL resource file .r and click “Properties”.
3. Set Item Type
Select “Custom Build Tool” in Item Type list.
4. Set Custom Build Tool
Change each items referring to solution files of sample projects.
The following is the detail of command line input.
cl /I "$(ProjectDir)..\..\..\Headers" /EP ".."\\"%(Filename).r" > "$(IntDir)"\\"%(Filename).rr"
"$(ProjectDir)..\..\..\Resources\PiPLTool" "$(IntDir)%(Filename).rr" "$(IntDir)%(Filename).rrc"
cl /D "MSWindows" /EP $(IntDir)%(Filename).rrc > "$(ProjectDir)"\\"%(Filename)".rc
1. run cl command and generate .rr file from .r with including headers.
cl: Compiler Command
/I: Adds a directory to the list of directories searched for include files.
/EP: Preprocesses C and C++ source files and copies the preprocessed files to the standard output device.
>: Redirection of the file after > to stdin of the file before >.
cl /I "Path_To_Headers" /EP "Path_To_.r" > "PATH_TO_.rr"
2. convert .rr to .rrc with PiPLTool.exe
"Path_To_Resources\PiPLTool" "Path_To_.rr" "Path_To_.rrc"
3. run cl command and generate .rc file from .rrc
cl: Compiler Command
/D: Defines a preprocessing symbol for a source file. (#define “MSWindows”)
/EP: Preprocesses C and C++ source files and copies the preprocessed files to the standard output device.
>: Redirection of the file after > to stdin of the file before >.
cl /D "MSWindows" /EP "Path_To_.rrc" > "Path_To_.rc"
Appendix
What is PiPL resource?
What is a PiPL?
Plug-In Property Lists, or PiPLs, are resources which provide basic information about a plug-in’s behavior, without executing the plug-in.
from PiPL Resources in After Effects SDK Guide
What information does the PiPL provide?
A PiPL specifies the entry point of a plug-in, the display name, as well as the plug-in’s match name.
from PiPL Resources in After Effects SDK Guide
Why should resource file .r be compiled?
In the interest of cross-platform compatibility, use a single .r file for both macOS and Windows versions of your plug-in, like the samples do.
On Windows, PiPLs are compiled by processing a .r file through pipltool.exe, which converts the .r file into a binary .rc file.
from PiPL Resources in After Effects SDK Guide
Hi Nako-san. Are you able to add header macro for .r file ? For example, in header VersionInfo.h – I have
#define GLOBAL_OUTFLAGS PF_OutFlag_SEND_UPDATE_PARAMS_UI | PF_OutFlag_PIX_INDEPENDENT
and in ProductPiPL.r
AE_Effect_Global_OutFlags { GLOBAL_OUTFLAGS },
But this causes PiPL compile error.
Hi Anmol-san. We are able to use header macro for .r file but we can’t use reference such as PF_OutFlag_SEND_UPDATE_PARAMS_UI instead of constant number itself or formula with them.
PF_OutFlag_SEND_UPDATE_PARAMS_UI and PF_OutFlag_PIX_INDEPENDENT are not referenced by PiPLTool.
Use
#define GLOBAL_OUTFLAGS 67109888
instead of#define GLOBAL_OUTFLAGS PF_OutFlag_SEND_UPDATE_PARAMS_UI | PF_OutFlag_PIX_INDEPENDENT
(I know this may not be what you want to do…)That’s because in the first column of the custom build command, GLOBAL_OUTFLAGS is replaced with the value “PF_OutFlag_SEND_UPDATE_PARAMS_UI | PF_OutFlag_PIX_INDEPENDENT” defined in the macro(see generated .rr). After that, the .rr file is parsed with PiPLTool to generate a temporary file .rrc, but PiPLTool doesn’t know what “PF_OutFlag_SEND_UPDATE_PARAMS_UI | PF_OutFlag_PIX_INDEPENDENT” is.
PiPLTool can calculate numbers and operations such as +-*, but it cannot convert either reference or operations such as bit shift.
Here’s how to compile the header macro in resource file.
1. Add “#include VersionInfo.h” in .r file
2. Add the directory where VersionInfo.h exists in custom build command.
For example, if VersionInfo.h is in $(ProjectDir)\header, the first line of custom build command should be the following.
cl /I "$(ProjectDir)..\..\..\Headers" /I "$(ProjectDir)\header" /EP ".."\\"%(Filename).r" > "$(IntDir)"\\"%(Filename).rr"