fix maya playblast settings

This commit is contained in:
Milan Kolar 2021-03-03 15:26:35 +01:00
parent 68224c0fde
commit f166dee723
4 changed files with 94 additions and 161 deletions

View file

@ -2127,15 +2127,9 @@ def bake_to_world_space(nodes,
def load_capture_preset(path=None, data=None):
import capture_gui
import capture
if data:
preset = data
else:
path = path
preset = capture_gui.lib.load_json(path)
print(preset)
preset = data
options = dict()
@ -2177,29 +2171,27 @@ def load_capture_preset(path=None, data=None):
temp_options2 = {}
id = 'Viewport Options'
light_options = {
0: "default",
1: 'all',
2: 'selected',
3: 'flat',
4: 'nolights'}
for key in preset[id]:
if key == 'high_quality':
if preset[id][key] == True:
temp_options2['multiSampleEnable'] = True
temp_options2['multiSampleCount'] = 4
temp_options2['textureMaxResolution'] = 1024
if key == 'textureMaxResolution':
if preset[id][key] > 0:
temp_options2['textureMaxResolution'] = preset[id][key]
temp_options2['enableTextureMaxRes'] = True
temp_options2['textureMaxResMode'] = 1
else:
temp_options2['multiSampleEnable'] = False
temp_options2['multiSampleCount'] = 4
temp_options2['textureMaxResolution'] = 512
temp_options2['enableTextureMaxRes'] = True
temp_options2['textureMaxResolution'] = preset[id][key]
temp_options2['enableTextureMaxRes'] = False
temp_options2['textureMaxResMode'] = 0
if key == 'multiSample':
if preset[id][key] > 0:
temp_options2['multiSampleEnable'] = True
temp_options2['multiSampleCount'] = preset[id][key]
else:
temp_options2['multiSampleEnable'] = False
temp_options2['multiSampleCount'] = preset[id][key]
if key == 'ssaoEnable':
if preset[id][key] == True:
if preset[id][key] is True:
temp_options2['ssaoEnable'] = True
else:
temp_options2['ssaoEnable'] = False
@ -2211,18 +2203,17 @@ def load_capture_preset(path=None, data=None):
if key == 'headsUpDisplay':
temp_options['headsUpDisplay'] = True
if key == 'displayLights':
temp_options[str(key)] = light_options[preset[id][key]]
else:
temp_options[str(key)] = preset[id][key]
for key in ['override_viewport_options',
'high_quality',
'alphaCut',
'gpuCacheDisplayFilter']:
temp_options.pop(key, None)
for key in ['ssaoEnable']:
'gpuCacheDisplayFilter',
'multiSample',
'ssaoEnable',
'textureMaxResolution'
]:
temp_options.pop(key, None)
options['viewport_options'] = temp_options

View file

@ -45,11 +45,8 @@ class ExtractPlayblast(pype.api.Extractor):
# get cameras
camera = instance.data['review_camera']
try:
preset = lib.load_capture_preset(data=self.capture_preset)
except Exception:
preset = {}
self.log.info('using viewport preset: {}'.format(preset))
preset = lib.load_capture_preset(data=self.capture_preset)
preset['camera'] = camera
preset['format'] = "image"
@ -99,6 +96,9 @@ class ExtractPlayblast(pype.api.Extractor):
# Remove panel key since it's internal value to capture_gui
preset.pop("panel", None)
self.log.info('using viewport preset: {}'.format(preset))
path = capture.capture(**preset)
playblast = self._fix_playblast_output_path(path)

View file

@ -284,13 +284,6 @@
"isolate_view": true,
"off_screen": true
},
"IO": {
"name": "",
"open_finished": true,
"raw_frame_numbers": true,
"recent_playblasts": [],
"save_file": true
},
"PanZoom": {
"pan_zoom": true
},
@ -303,19 +296,20 @@
"percent": 1.0,
"mode": "Custom"
},
"Time Range": {
"start_frame": 0,
"end_frame": 0,
"frame": "",
"time": "Time Slider"
},
"Viewport Options": {
"override_viewport_options": true,
"displayLights": "0",
"textureMaxResolution": 1024,
"multiSample": 4,
"shadows": true,
"textures": true,
"twoSidedLighting": true,
"ssaoEnable": true,
"cameras": false,
"clipGhosts": false,
"controlVertices": false,
"deformers": false,
"dimensions": false,
"displayLights": 0,
"dynamicConstraints": false,
"dynamics": false,
"fluids": false,
@ -325,7 +319,6 @@
"grid": false,
"hairSystems": true,
"handles": false,
"high_quality": true,
"hud": false,
"hulls": false,
"ikHandles": false,
@ -340,17 +333,13 @@
"nRigids": false,
"nurbsCurves": false,
"nurbsSurfaces": false,
"override_viewport_options": true,
"particleInstancers": false,
"pivots": false,
"planes": false,
"pluginShapes": false,
"polymeshes": true,
"shadows": true,
"strokes": false,
"subdivSurfaces": false,
"textures": false,
"twoSidedLighting": true
"subdivSurfaces": false
},
"Camera Options": {
"displayGateMask": false,

View file

@ -163,42 +163,7 @@
}
]
},
{
"type": "dict",
"key": "IO",
"children": [
{
"type": "label",
"label": "<b>IO</b>"
},
{
"type": "text",
"key": "name",
"label": "Name"
},
{
"type": "boolean",
"key": "open_finished",
"label": "Open finished"
},
{
"type": "boolean",
"key": "raw_frame_numbers",
"label": "Raw frame numbers"
},
{
"type": "list",
"key": "recent_playblasts",
"label": "Recent Playblasts",
"object_type": "text"
},
{
"type": "boolean",
"key": "save_file",
"label": "Save file"
}
]
},
{
"type": "dict",
"key": "PanZoom",
@ -222,9 +187,12 @@
"label": "<b>Renderer</b>"
},
{
"type": "text",
"type": "enum",
"key": "rendererName",
"label": " Renderer name"
"label": "Renderer name",
"enum_items": [
{ "vp2Renderer": "Viewport 2.0" }
]
}
]
},
@ -273,48 +241,66 @@
{
"type": "splitter"
},
{
"type": "dict",
"key": "Time Range",
"children": [
{
"type": "label",
"label": "<b>Time Range</b>"
},
{
"type": "number",
"key": "start_frame",
"label": " Start frame",
"decimal": 0,
"minimum": 0,
"maximum": 999999
},
{
"type": "number",
"key": "end_frame",
"label": "End frame",
"decimal": 0,
"minimum": 0,
"maximum": 999999
},
{
"type": "text",
"key": "frame",
"label": "Frame"
},
{
"type": "text",
"key": "time",
"label": "Time"
}
]
},
{
"type": "dict",
"collapsible": true,
"key": "Viewport Options",
"label": "Viewport Options",
"children": [
{
"type": "boolean",
"key": "override_viewport_options",
"label": "override_viewport_options"
},
{
"type": "enum",
"key": "displayLights",
"label": "Display Lights",
"enum_items": [
{ "default": "Default Lighting"},
{ "all": "All Lights"},
{ "selected": "Selected Lights"},
{ "flat": "Flat Lighting"},
{ "nolights": "No Lights"}
]
},
{
"type": "number",
"key": "textureMaxResolution",
"label": "Texture Clamp Resolution",
"decimal": 0
},
{
"type": "number",
"key": "multiSample",
"label": "Anti Aliasing Samples",
"decimal": 0,
"minimum": 0,
"maximum": 32
},
{
"type": "boolean",
"key": "shadows",
"label": "Display Shadows"
},
{
"type": "boolean",
"key": "textures",
"label": "Display Textures"
},
{
"type": "boolean",
"key": "twoSidedLighting",
"label": "Two Sided Lighting"
},
{
"type": "boolean",
"key": "ssaoEnable",
"label": "Screen Space Ambient Occlusion"
},
{
"type": "splitter"
},
{
"type": "boolean",
"key": "cameras",
@ -340,14 +326,6 @@
"key": "dimensions",
"label": "dimensions"
},
{
"type": "number",
"key": "displayLights",
"label": "displayLights",
"decimal": 0,
"minimum": 0,
"maximum": 10
},
{
"type": "boolean",
"key": "dynamicConstraints",
@ -393,11 +371,6 @@
"key": "handles",
"label": "handles"
},
{
"type": "boolean",
"key": "high_quality",
"label": "high_quality"
},
{
"type": "boolean",
"key": "hud",
@ -468,11 +441,6 @@
"key": "nurbsSurfaces",
"label": "nurbsSurfaces"
},
{
"type": "boolean",
"key": "override_viewport_options",
"label": "override_viewport_options"
},
{
"type": "boolean",
"key": "particleInstancers",
@ -498,11 +466,6 @@
"key": "polymeshes",
"label": "polymeshes"
},
{
"type": "boolean",
"key": "shadows",
"label": "shadows"
},
{
"type": "boolean",
"key": "strokes",
@ -512,16 +475,6 @@
"type": "boolean",
"key": "subdivSurfaces",
"label": "subdivSurfaces"
},
{
"type": "boolean",
"key": "textures",
"label": "textures"
},
{
"type": "boolean",
"key": "twoSidedLighting",
"label": "twoSidedLighting"
}
]
},