Exemplo n.º 1
0
    def _create_texture_node(self, path):
        """
        Import an image as Canvas in Alias

        :param path:  Path to the image.
        """
        if not os.path.exists(path):
            raise Exception("File not found on disk - '%s'" % path)
        alias_api.create_texture_node(path)
Exemplo n.º 2
0
    def create_texture_node(self, path, standalone=True):
        """Create a texture node."""
        self.logger.debug("Creating a texture node of {}".format(path))

        if not os.path.exists(path):
            raise Exception("File not found on disk - '%s'" % path)

        success, message = alias_api.create_texture_node(path)
        self.logger.debug("Result: {}, Message: {}".format(success, message))

        if not standalone:
            message_type = "information" if success else "warning"
            return dict(
                message_type=message_type,
                message_code=message,
                publish_path=path,
                is_error=False if success else True,
            )

        if not success:
            raise Exception("Error creating a texture node")

        QtGui.QMessageBox.information(
            self.get_parent_window(),
            "Texture Node",
            "Texture node created successfully.",
        )