mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Removed camera from render instance and added validator to check camera
This commit is contained in:
parent
a0c25edab9
commit
153a299901
4 changed files with 46 additions and 13 deletions
|
|
@ -213,18 +213,6 @@ class CreateRenderlayer(plugin.Creator):
|
|||
|
||||
return aov_file_products
|
||||
|
||||
@staticmethod
|
||||
def set_render_camera(asset_group):
|
||||
# There should be only one camera in the instance
|
||||
found = False
|
||||
for obj in asset_group.all_objects:
|
||||
if isinstance(obj, bpy.types.Object) and obj.type == "CAMERA":
|
||||
bpy.context.scene.camera = obj
|
||||
found = True
|
||||
break
|
||||
|
||||
assert found, "No camera found in the render instance"
|
||||
|
||||
@staticmethod
|
||||
def imprint_render_settings(node, data):
|
||||
RENDER_DATA = "render_data"
|
||||
|
|
@ -262,7 +250,6 @@ class CreateRenderlayer(plugin.Creator):
|
|||
# We set the render path, the format and the camera
|
||||
bpy.context.scene.render.filepath = render_product
|
||||
self.set_render_format(ext, multilayer)
|
||||
self.set_render_camera(asset_group)
|
||||
|
||||
render_settings = {
|
||||
"render_folder": render_folder,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
import bpy
|
||||
|
||||
import pyblish.api
|
||||
|
||||
|
||||
class ValidateRenderCameraIsSet(pyblish.api.InstancePlugin):
|
||||
"""Validate that there is a camera set as active for rendering."""
|
||||
|
||||
order = pyblish.api.ValidatorOrder
|
||||
hosts = ["blender"]
|
||||
families = ["renderlayer"]
|
||||
label = "Validate Render Camera Is Set"
|
||||
optional = False
|
||||
|
||||
def process(self, instance):
|
||||
if not bpy.context.scene.camera:
|
||||
raise RuntimeError("No camera is active for rendering.")
|
||||
|
|
@ -41,6 +41,11 @@
|
|||
"active": true,
|
||||
"exclude_families": []
|
||||
},
|
||||
"ValidateRenderCameraIsSet": {
|
||||
"enabled": true,
|
||||
"optional": false,
|
||||
"active": true
|
||||
},
|
||||
"ValidateMeshHasUvs": {
|
||||
"enabled": true,
|
||||
"optional": true,
|
||||
|
|
|
|||
|
|
@ -51,6 +51,30 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"collapsible": true,
|
||||
"key": "ValidateRenderCameraIsSet",
|
||||
"label": "Validate Render Camera Is Set",
|
||||
"checkbox_key": "enabled",
|
||||
"children": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "enabled",
|
||||
"label": "Enabled"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "optional",
|
||||
"label": "Optional"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "active",
|
||||
"label": "Active"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "collapsible-wrap",
|
||||
"label": "Model",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue