I've figured out a hacky workaround until this is officially supported.
from sd.api.sdproperty import SDPropertyCategory
def get_graph_resolution(api):
graph = api.ui_mgr.getCurrentGraph()
# create a temp output node:
output_node = graph.newNode('sbs::compositing::output')
# we have to compute the graph, unfortunately, or else the output node won't have any properties:
graph.compute()
# get the output texture:
properties = output_node.getProperties(SDPropertyCategory.Output)
texture = output_node.getPropertyValue(properties[0]).get()
# this is all we need:
x, y = texture.getSize()
# delete the output node:
graph.deleteNode(output_node)
return x, y
There are a few things that aren't ideal about this workaround:
- It (probably) won't work if the file is read-only (I haven't actually tested this, so I don't really know)
- It dirties the scene.
- It requires the graph to be computed, which can be sloooooow.
If anybody has a better solution please let me know.
Thanks!