add env variable and prefs for tech passes split, and allow customization ofr tech passes split in popup
This commit is contained in:
+58
-7
@@ -18,11 +18,12 @@ from bpy.app.handlers import persistent
|
||||
class RT_prefs(bpy.types.AddonPreferences):
|
||||
bl_idname = __package__
|
||||
|
||||
## path templates
|
||||
use_env_base_path_templates : BoolProperty(
|
||||
name="Use Environment Base Path Templates",
|
||||
description="Use environmenet variables to set base path for file output templates\
|
||||
\nFollowing env variable are available:\
|
||||
\nRENDERTOOLBOX_EXR_PATH_TEMPLATE fo single base path file output\
|
||||
\nRENDERTOOLBOX_EXR_PATH_TEMPLATE for single base path file output\
|
||||
\nRENDERTOOLBOX_MULTILAYER_PATH_TEMPLATE for multilayer base path file output",
|
||||
default=True,
|
||||
)
|
||||
@@ -39,24 +40,74 @@ class RT_prefs(bpy.types.AddonPreferences):
|
||||
default="//render/{node_label}/{node_label}_",
|
||||
)
|
||||
|
||||
## Tech passes
|
||||
use_env_technical_passes : BoolProperty(
|
||||
name="Use Environment Technical Passes",
|
||||
description="Use environmenet variables to set the technical passes name:\
|
||||
\nRENDERTOOLBOX_TECH_PASSES",
|
||||
default=True,
|
||||
)
|
||||
|
||||
tech_passes_names : StringProperty(
|
||||
name="Tech Passes Names",
|
||||
description="Comma separated list of tech passes names to use for file output creation (Use lossless EXR 32bit)",
|
||||
default="uv, normal, depth, position, vector, ao",
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
layout.prop(self, "use_env_base_path_templates", text="Use Environment Base Path Templates")
|
||||
col = layout.column()
|
||||
col.label(text="Output files path templates:")
|
||||
col.prop(self, "use_env_base_path_templates", text="Use Environment Base Path Templates")
|
||||
# col.active = not self.use_env_base_path_templates
|
||||
col.prop(self, "base_path_template", text="Base Path Template")
|
||||
col.prop(self, "base_path_multilayer_template", text="Base Path Multilayer Template")
|
||||
|
||||
if self.use_env_base_path_templates:
|
||||
col.separator()
|
||||
col.label(text="Environment variables will override above templates if set", icon='INFO')
|
||||
# col.label(text="RENDERTOOLBOX_EXR_PATH_TEMPLATE for single base path file output")
|
||||
# col.label(text="RENDERTOOLBOX_MULTILAYER_PATH_TEMPLATE for multilayer base path file output")
|
||||
col.label(text='If environment variables are not found, preferences will be used instead')
|
||||
box=col.box()
|
||||
boxcol = box.column()
|
||||
env_path_template = os.getenv('RENDERTOOLBOX_EXR_PATH_TEMPLATE')
|
||||
env_multi_template = os.getenv('RENDERTOOLBOX_MULTILAYER_PATH_TEMPLATE')
|
||||
|
||||
if not env_path_template or not env_multi_template:
|
||||
boxcol.label(text="Environment variables override above templates if set", icon='INFO')
|
||||
|
||||
if env_path_template or env_multi_template:
|
||||
boxcol.label(text="Environment variables found:", icon='CHECKMARK')
|
||||
|
||||
if env_path_template:
|
||||
boxcol.label(text=f"RENDERTOOLBOX_EXR_PATH_TEMPLATE:")
|
||||
boxcol.label(text=env_path_template)
|
||||
else:
|
||||
boxcol.label(text="RENDERTOOLBOX_EXR_PATH_TEMPLATE env not found, using preferences ") # (single base path file output)
|
||||
|
||||
if env_multi_template:
|
||||
boxcol.label(text=f"RENDERTOOLBOX_MULTILAYER_PATH_TEMPLATE:")
|
||||
boxcol.label(text=env_multi_template)
|
||||
else:
|
||||
boxcol.label(text="RENDERTOOLBOX_MULTILAYER_PATH_TEMPLATE env not found, using preferences") # (multilayer base path file output)
|
||||
|
||||
layout.separator()
|
||||
col = layout.column()
|
||||
col.label(text="Default Separated Technical Passes:")
|
||||
col.prop(self, "use_env_technical_passes", text="Use Environment Technical Passes")
|
||||
|
||||
col.prop(self, "tech_passes_names", text="Technical Passes Names", placeholder="e.g. uv, normal, depth, vector, ...")
|
||||
if self.use_env_technical_passes:
|
||||
box=col.box()
|
||||
boxcol = box.column()
|
||||
|
||||
env_tech_pass = os.getenv('RENDERTOOLBOX_TECH_PASSES')
|
||||
if env_tech_pass:
|
||||
boxcol.label(text="Environment variable found:", icon='CHECKMARK')
|
||||
boxcol.label(text=f"RENDERTOOLBOX_TECH_PASSES:")
|
||||
boxcol.label(text=env_tech_pass)
|
||||
else:
|
||||
boxcol.label(text="Environment variable override tech passes names if set", icon='INFO')
|
||||
boxcol.label(text='RENDERTOOLBOX_TECH_PASSES env not found, using preferences')
|
||||
|
||||
# region Handlers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user