def get_outputs(self):
"""Return width x height defined by the combination of settings
Returns:
dict: width and height key values
"""
mode = self.mode.currentText()
panel = lib.get_active_editor()
if mode == self.ScaleCustom:
width = self.width.value()
height = self.height.value()
elif mode == self.ScaleRenderSettings:
# width height from render resolution
width = cmds.getAttr("defaultResolution.width")
height = cmds.getAttr("defaultResolution.height")
elif mode == self.ScaleWindow:
# width height from active view panel size
if not panel:
# No panel would be passed when updating in the UI as such
# the resulting resolution can't be previewed. But this should
# never happen when starting the capture.
width = 0
height = 0
else:
width = cmds.control(panel, query=True, width=True)
height = cmds.control(panel, query=True, height=True)
else:
raise NotImplementedError("Unsupported scale mode: "
"{0}".format(mode))
scale = [width, height]
percentage = self.percent.value()
scale = [math.floor(x * percentage) for x in scale]
return {"width": scale[0], "height": scale[1]}
评论列表
文章目录