resolutionplugin.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:maya-capture-gui 作者: Colorbleed 项目源码 文件源码
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]}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号