def _export(self, settings, item, path):

        samples = []  # 1 sample per frame
        samples_setting = settings.get("Sub Samples")
        if samples_setting and samples_setting.value:
            samples = samples_setting.value

        nodes = []  # export the whole scene
        cyclic = True  # samples if exist would be relative to frame. ie. [0.4, 0.8]
        frame_count = 0

        try:
            with Progress(
                    "Exporting animation as Alembic Cache...") as progress:
                rumba_alembic.export_nodes(
                    path,
                    nodes,
                    frame_count=frame_count,
                    samples=samples,
                    cyclic=cyclic,
                    progress=progress.update,
                )
        except RuntimeError as error:
            message_box(
                "Error exporting to file {}:\n{}".format(path, error),
                title="Exporting Error",
                widget=widget("MainWindow"),
                level="error",
            )
Ejemplo n.º 2
0
def _save_as():
    from sgtk.platform.qt import QtGui

    main_window = rumbapy.widget("MainWindow")
    actions = main_window.findChildren(QtGui.QAction)
    for a in actions:
        if a.text() == "Save As...":
            a.trigger()
Ejemplo n.º 3
0
def _save_session(path):
    """
    Save the current session to the supplied path.
    """

    # Ensure that the folder is created when saving
    folder = os.path.dirname(path)
    ensure_folder_exists(folder)

    active_doc = rumba.active_document()
    if active_doc:
        main_window = rumbapy.widget("MainWindow")
        main_window.save_at(path)
Ejemplo n.º 4
0
    def _export(self, settings, item, path):
        nodes = []  # export the whole scene

        try:
            with Progress("Exporting to Usd...") as progress:
                export_to_Usd(path, nodes, [], progress.update)
        except RuntimeError as error:
            message_box(
                "Error exporting to file {}:\n{}".format(path, error),
                title="Exporting Error",
                widget=widget("MainWindow"),
                level="error",
            )
Ejemplo n.º 5
0
 def _get_dialog_parent(self):
     """
     Get the QWidget parent for all dialogs created through
     show_dialog & show_modal.
     """
     return rumbapy.widget("MainWindow")
Ejemplo n.º 6
0
def _save_as():
    main_window = rumbapy.widget("MainWindow")
    main_window.save_as()
Ejemplo n.º 7
0
    def execute(self, operation, file_path, context, parent_action,
                file_version, read_only, **kwargs):
        """
        Main hook entry point

        :param operation:       String
                                Scene operation to perform

        :param file_path:       String
                                File path to use if the operation
                                requires it (e.g. open)

        :param context:         Context
                                The context the file operation is being
                                performed in.

        :param parent_action:   This is the action that this scene operation is
                                being executed for.  This can be one of:
                                - open_file
                                - new_file
                                - save_file_as
                                - version_up

        :param file_version:    The version/revision of the file to be opened.  If this is 'None'
                                then the latest version should be opened.

        :param read_only:       Specifies if the file should be opened read-only or not

        :returns:               Depends on operation:
                                'current_path' - Return the current scene
                                                 file path as a String
                                'reset'        - True if scene was reset to an empty
                                                 state, otherwise False
                                all others     - None
        """
        active_doc = rumba.active_document()

        if operation == "current_path":
            current_project_filename = rumba.active_document_filename()
            return current_project_filename

        elif operation == "open":
            rumba.load_document(file_path)

        elif operation == "save":
            if active_doc:
                current_project_filename = rumba.active_document_filename()
                if current_project_filename != "untitled":
                    active_doc.write(current_project_filename)

        elif operation == "save_as":
            if active_doc:
                main_window = rumbapy.widget("MainWindow")
                main_window.save_at(file_path)

        elif operation == "reset":
            if active_doc:
                rumba.new_document()
            return True

        elif operation == "prepare_new":
            rumba.new_document()
            return True