.. _section_naming: Section - Naming ================ The 'Naming' section might probably be the most technical section of all - but maybe also the most valuable one. It lets smartWrite assemble output paths for your output nodes (Write/DeepWrite/WriteGeo) fully automatically, so you don't need to set any output path manually anymore. This has the following big advantages: - You don't need to assemble the file paths yourself, so you safe time and avoid errors e.g. typos. - An output path is bound to the working file you are working in, so the outputs are in sync with your working file. This mechanism requires a bit of knowledge about regular expressions. If you haven't worked with regular expressions before this might look a bit intimidating, but after having used regular expressions for a bit of time, this becomes actually pretty straight forward to use. .. note:: If you have some difficulties setting up the naming template and output preset, please let us know, we are happy to help: info@cragl.com Please provide us with the following information: - 1) The absolute path of your working file. - 2) The desired absolute output path for your output node. We can assist you setting up the naming template and output preset. But we encourage you to have a deep look at this page first. We won't do your homework, but we are happy to help you. The idea is simple: You describe the structure of your working file path, because usually this path contains valuable information, e.g. about the show your are working on as well as the sequence, shot, probably a task, version number, etc. So you have several naming values at hand that you can then use when it comes to assembling output paths for your Write/DeepWrite/WriteGeo nodes. To do that, the 'Naming' section is divided into four areas: **1) Naming:** This is where you describe your working file path with a regular expression pattern. Depending on your regular expression pattern you can extract naming values from the whole absolute working file path or just from the working file name (a.k.a. the 'basename'). **2) Resolved naming values:** Here you have a live preview of the naming values extracted of your working file path using your regular expression pattern defined in **1)**. **3) Presets:** Here you can choose between several naming template presets. **4) Output path:** Here you see the live output of your naming preset chosen in **3)** applied with the extracted naming values from **2)**. .. image:: img/sections/section_naming.png .. tip:: When creating regular expression patterns we recommend the website http://www.regex101.com as it lets you create patterns with a live feedback. You can then save a custom url for your defined pattern and also share it with others and create incremented version for your patterns which makes defining regular expression patterns very easy and comfortable. When you are done defining your pattern, you can then paste the pattern into the naming area of smartWrite. All four areas are described more in detail below. The Naming area --------------- The **Naming** area is where you define regular expression patterns to define the naming structure of your working file. You can create as many patterns as you like: .. image:: img/sections/section_naming_area_naming.png **1) Pattern dropdown:** Here you can switch between all your patterns. Choosing a pattern updates the pattern text area in **4)**. **2) Add pattern:** Click to add a new pattern. **3) Reveal pattern:** Click to reveal the pattern in your explorer. **4) Pattern text area:** Here is your regular expression pattern defined. Note that all lines starting with a hash symbol ``#`` as well as empty lines are ignored. This gives you some room for adding comments (e.g. adding the related regex101 hyperlink and example paths) and keeping the patterns well structured. A pattern should have just *one* line not starting with a ``#``. Note though that long lines get wrapped into several lines. Resolved naming values area --------------------------- The **Resolved naming values** area gives you live feedback about the naming values extracted from your current working file using the currently selected naming pattern from the **Naming** area. .. image:: img/sections/section_naming_area_resolved_naming_values.png Presets area ------------ The **Presets** area lets you define naming presets to use for your output nodes (Write/DeepWrite/WriteGeo). Here you define absolute output paths by using a mixture of hard coded values (e.g. the drive where you would like to output to) and the naming values previously extracted in the **Resolved naming values** area. You can create as many naming presets as you like: .. image:: img/sections/section_naming_area_presets.png **1) Presets dropdown:** Here you switch between all your naming presets. Choosing a preset updates the presets text area in **4)**. **2) New preset:** Click to create a new preset. **3) Reveal preset:** Click to reveal the preset in your explorer. **4) Preset text area:** Here you define your preset. As mentioned above, this is can be a mixture of hard coded values (e.g. the drive where you would like to output to) and the naming values previously extracted in the **Resolved naming values** area. To refer to an extracted naming value you need to wrap it in curly brackets, e.g. ``{show}``. Output path area ---------------- The **Output path** area shows you a live preview of applying your currently selected **Naming preset** with the extracted naming values of your **Resolved naming values** area: .. image:: img/sections/section_naming_area_output_path.png To illustrate this see the image below where the defined variables are substituted with the extracted naming values: .. image:: img/sections/section_naming_path_assembly_visualized.png A few additional notes: - Naming values that are not set (``null``) get substituted to empty. In this example this is the case for ``task_name`` as it is not defined in the working file's path. - Your can of course use naming values more than once. In this example naming values like ``{show}``, ``{sequence}``, ``{shot}`` amongst others are used in the file root but also in the file basename. - Using ``{file_ext}`` can later be substituted with the chosen file extension in the `Presets `_ section. Example ------- Here is an example naming template and output preset patterns for illustration purposes that will assemble output paths. With the following working file: ``/Volumes/Projects/work/dnh_a100_0120_comp_sij_v033.nk`` using the following naming template: ``(?P[a-z]{3})_(?P[a-z0-9]*)_(?P[0-9]*)_(?P[a-z0-9]*)(-(?P[a-z0-9]*))?_(?P[a-z]*)_v(?P[\d]*)\.nk`` this will split off the following naming values from the working file path:: { "show": "dnh", "sequence": "a100", "shot": "0120", "task_type": "comp", "task_name": null, "user": "sij", "version": "033" } Then, using the following Output preset pattern 'comp': ``Volumes/Projects/{show}/{sequence}/{shot}/render/2d/{task_type}/{show}_{sequence}_{shot}_{task_type}{task_name}_{user}_v{version}/{show}_{sequence}_{shot}_{task_type}{task_name}_{user}_v{version}.%04d.{file_type}`` this will assemble the following output path: ``Volumes/Projects/dnh/a100/0120/render/2d/comp/dnh_a100_0120_comp_sij_v033/dnh_a100_0120_comp_sij_v033.%04d.{file_type}`` And using another preset pattern 'precomp': ``Volumes/Projects/{show}/{sequence}/{shot}/render/2d/pre-renders/{task}/v{version}/{show}_{sequence}_{shot}_{task}_{user}_v{version}.%04d.{file_type}`` this will assemble the following output path: ``Volumes/Projects/dnh/a100/0120/render/2d/pre-renders/{task}/v033/dnh_a100_0120_{task}_sij_v033.%04d.{file_type}`` **Note:** - ``{file_type}`` was not resolved in the above example as it is not given in the output preset pattern. This value will always be substituted with the chosen file type of the output node. For that make sure ``file_type`` is set in the output preset that you apply this output preset pattern to. - ``{task}`` was not resolved in the above example for the precomp output preset pattern as it is not given in the extracted naming values. When applying a preset for an output node then a dialog appears and asks the user for entering this missing naming value so that the output path can be fully assembled. - Naming values being resolved to a None type will be substituted with an empty string. That means if the naming pattern gets no value for a key, it will be an empty string. - The naming template was configured to look only at the file's basename. If needed you can update the template accordingly to get naming values also from the parent directories.