Hey everyone, Grant for the Flame Learning Channel. In this video… You’ll learn about the new Python scripting capabilities… In the Flame 2018.2 Update. This initial implementation… mainly affects the Batch node compositing in the Flame products. So you are now able to automate a variety of tasks… when integrating within a facility pipeline. This includes running a python script when launching Flame. And there is also additional functionality… to execute python scripts while Flame is currently running. This allows you to validate python scripts directly in the Batch flow-graph… As well as apply certain functions to help move things along. We’ll examine some scenarios… But our main focus will be applying the general Python workflow. Please note that I will assume… That you already understand the basic fundamentals of programming with Python scripting. If you want the detailed breakdown of all the available functions and attributes… Please visit the Flame documentation… And you’ll find a comprehensive guide… listing everything that is currently available… in the Flame 2018.2 Update. So let me start off by showing you how to execute a python script… when launching any of the Flame products. Now in order to establish a context about what we’re about to do… I am currently sitting in an empty Flame project… And the initial Batch Group is empty. This is what you’d normally encounter when launching into a new project. Now you can exit Flame… and return to your system’s desktop. Now firstly… Regardless of whichever operating system you are using… In order to execute a python script… You need to launch Flame from either a shell or a terminal. This allows you to run additional functionality when launching Flame… Which you can’t achieve by clicking on the application’s icon. So to find your application launcher… Type cd /opt/Autodesk/flame_2018.2/bin If you were to list the contents of this directory… You will find the Start Application script. To run Flame from this window… Type ./startApplication … Please remember that this is case sensitive. Small “s” and a capital “A”. Pressing enter at this point… will launch Flame as if you clicked on the icon. To execute the python script during the launch… You need to add a –s variable to the line. Next you need to type the path to the script and its file name. In my case, I’ll type… /var/tmp/flc_python/flc_comp.py So flc_comp.py is the python script I created before recording this video. If all goes well… This will create a new Batch Group… Add some reels with custom names… Import my media into the reels… And build a Batch flow graph with the loaded media. When pressing enter… Flame launches and executes the script. It does take a fraction of a second longer than normal to launch… But the application splash screen appears… And the only thing you need to do… Is choose a new or existing project… That you want use with the Python Script. Click Start… And the project will begin to load and execute the script. For new projects… You may also get the option… to associate the Flame project with a Shotgun Project if you require. We’ll discuss how this can affect you later in the video. Now in practical terms… You would use the Python scripting to automate your pipeline. You could have incoming sources such as camera source media and CGI media… And you can instruct Flame to import and prepare the media… As well as build an initial flow graph. This is a massive timesaver by automating the building processes… And Flame artists can immediately start being creative. Another way to look at this… Is that you could standardize the facility’s working practices… And also call up the correct media through scripting… without depending on someone technical or creative… to set up everything manually. So looking at this Batch Group… It has been called “Learning_RenderPasses”. The script created four Batch Schematic Reels… With custom naming such as… “Direct Passes”, “Indirect Passes”, “Reflection” and “Utility Passes”. It also automatically loaded in AOV render passes produced with Arnold… And placed them in the assigned reels. With the media available in Batch… The Python script assembled the render passes together with Comp nodes… And a write node was created at the end of the flow-graph. The extra utility passes such as Position map, Normals Map and Z-depth map… Are just placed in the Batch Schematic for when the artist would need them. Pointing out some of the finer details… The media was named accordingly on import… And most of the comp nodes had their blend modes set to “Add”… while the reflection comp node is set to “Screen”. I also want to mention at this point… Which is quite important… Is that the colour management on media within this project…. Is still driven by the import rules… and not the Python Scripting. If you wish to know more about setting up your colour management… Please watch the video series on Colour Management… Which is also available on the Flame Learning Channel. Finally,… The write file Media Path is set to write out to a custom directory. So all of this was achieved by launching Flame with a python script. Now I am sure you would like to see how the script was written. So you have two viewing choices to choose from. Firstly… You could open any text editor… And view the python script. There is absolutely nothing wrong with this. However… There is no connection between the text editor and Flame. And if you wanted to validate the script as you coded it… You’d have to restart Flame with the Python script each time to execute the code. So as an alternative… You can close the generic text editor. If you click on the Flame main menu… You can choose SHOTGUN… And you will find the option to launch the SHOTGUN PYTHON CONSOLE. This python console is directly connected to Flame… And you’re able to validate… as well as execute Python scripts in the current Flame Project. Now since this is the Shotgun Python Console for the Flame 2018.2 Update… You would need to link the Flame project to a Shotgun project in order to access the tools. And for that… You will require a Shotgun subscription… to use the Python console in the Flame 2018.2 Update. Now if you just want to test this… There is the free 30-day trial of Shotgun… Which will enable you to link to the Flame Project… And try the Python Console within the Batch environment. I would like to state… that Shotgun is not a requirement to use Python Scripting with Flame. It simply adds interactive functionality. Now I’ll resize the console… And I’ll load the original script that created this Batch Group. Now the top part of the console… Provides the API feedback. When you execute any script… it will also tell you what is happening… and if there is a problem in the code. So it’s very handy to have. The bottom half of the console is where you type your script. As with all Python scripting… You have a set of functions and attributes… that are available via the Flame Python API. Now as I mentioned earlier… You can use this console alongside Flame to validate the scripts. For example… Let’s say you wanted to test part of this script… where the Batch Group is created… And media is imported. So I’ll will purposely clear the Desktop and empty this project. Now as a small usability tip… You may need to ALT+TAB between the Python Console and Flame… In order to switch the active window. If you don’t do this… You will not be able to select anything in the Python console. Now to execute a selection of a script… All you need to do is select the portion you want… And run the script. So the Batch Group is created… The Batch Schematic reels are created and named… And the media is imported and named. Please note, that I am aware that the schematic is not organized… Because that command is further down my Python script. So if I scroll to the bottom of the script… And select the organize function… I can execute it. Tapping in the Batch Schematic… Will organize the nodes for me. So you could have an existing flow graph laid out… And you could run various Python scripts to automate some basic processes. For example… I’ll clear the Desktop one more time… And execute the entire script with no selection. This is the same outcome… when we initially launched Flame using the python script. Now I had set most of the comp nodes to additive in the original python script. But let’s say you wanted all the comp nodes to be set to the “Screen” Blend mode. So I’ll open another short python script… that could do exactly that. In Layman’s terms, the script says… That for all the comp nodes in Batch… Set the Blend mode to “Screen”. When I run the script… The Python console executes the command with no errors. Tapping back on the Batch Schematic… All the nodes are now set to “Screen”. If you want to set them back to “Add”… You can ALT+TAB back to the Python console… And change the attribute to “Add”. Executing the script again… And clicking on the Batch Schematic… All the Comp nodes in the flow-graph… will be set to “Add” once more. So the point I am making here… Is that you can test and validate your scripts… As well as use the Shotgun Python Console to automate a few operations… And in some cases, eliminate potential errors. As a quick example to mention… Is that you could have a data manager using Scripting… And he could ensure… that you always load the correct media through Python scripting. This eliminates the probability of using the wrong media on a production… Especially if a you’re using a freelancer for instance. This is just food for thought. Now very importantly, before I conclude this video… I need to mention that in the current implementation of the Python Scripting… You can add any node… And connect any inputs to outputs. However, you can only change certain attributes within the Comp node and write node. This should be sufficient as the basic building blocks for an incoming composite… And then you can start getting creative from that point. With all that in mind… Understandably, some of you may like compositing with multiple comp nodes like this. However there are a few of you… who prefer to composite these layers in Action. So to show you what is possible… I’ll load my final script in the Python Console. In a brief summary… This script will load a multi-channel clip… And link all the render pass outputs to an Action node. As an added bonus, it will also rename all the media input nodes according to the render passes. So I’ll execute the script… And Flame will create a new Batch Group called “Learning_Multi_Channel”. So here is the Multi-Channel clip in the Media Panel… And the flow-graph has assembled… With all the render passes going into the Action node. If I select the Multi-channel clip and press SHIFT+C… It will un-collapse the clip… And you can see all the render passes going into Action… And the utility passes are also accessible if needed. Now in the case of Action… You can connect media inputs through scripting… But you currently cannot add Action Objects… Or set blending modes. So if you go into the Action node… The media list is loaded… But there are no 3D objects or surfaces in the 3D Composite. Once again, please check the Flame documentation… to see what nodes, functions and attributes are supported… in the current Python scripting implementation. So in summary… The new Python API opens up Flame to pipeline automation… And hopefully improves an artist’s starting point in Batch. The scripting is also compatible with other project management software… including Shotgun for greater pipeline management. Remember that you can execute scripts when starting Flame… And you can edit Python in any editor you choose. I will re-iterate that Shotgun is not required to use Python Scripting with Flame. The Shotgun Python Console just gives you additional interactive functionality if you want it. We hope that this initial implementation of Python scripting will serve you well… And we look forward to hearing your feedback. Don’t forget to also check out the other enhancements, workflows and features to the Flame 2018.2 Update. Comments, feedback and suggestions are always welcome and appreciated. Thank you for watching and please subscribe to
the Flame Learning Channel for future videos.