예제 #1
0
    def publish_alembic(self, instance_obj):
        output_path = resolve.Resolver().filepath_from_id(
            self.shot_tape, "caches", instance_obj.instance,
            mapping.Datatypes.CACHE)
        version_number = resolve.Resolver().get_next_version_number(
            output_path)

        instance_geo = [
            instance_obj.geo_node(long=True)
            or instance_obj.root_node(long=True)
        ]

        recorder = record.Recorder()
        with recorder.publish_record(filepath, version_number):
            exporter = main_export.Exporter(instance_geo,
                                            frame_range=self.scene_frame_range)
            om.MGlobal.displayInfo("Recording {}...".format(
                instance_obj.instance))
            exporter.export(
                alembic_engine.AbcEngine(),
                filepath,
                exports=instance_geo,
                frame_range=self.scene_frame_range,
            )
            recorder.status = record.Status.PUBLISHED
예제 #2
0
def publishUsdComposition(tapeEntity, workfileName, recorder=None):   
    resolver = resolve.Resolver()
    songPath = resolver.filepath_from_asset(tapeEntity, 
                                            tapeEntity.task,
                                            "usdComposition",
                                            workfileName,
                                            "usd"
                                            )
    versionNumber = resolver.get_next_version_number(songPath)

    recorder = recorder or record.Recorder()
    with recorder.publish_record(songPath, versionNumber):
       writeUsdComposition(songPath)   
       recorder.status = record.Status.PUBLISHED
예제 #3
0
def publishComposition(mayaFile=None, batch=False):
    if batch:
        cmds.file(new=True, force=True)  # clear scene
        cmds.file(mayaFile, force=True, o=True)

    mayaFile = mayaFile or cmds.file(query=True, l=True)[0]
    mayaFile = mayaFile.replace("\\", "/")
    workfileName = os.path.splitext(os.path.basename(mayaFile))[0]
    tapeEntity = tape.Tape.from_filepath(mayaFile)
    workfileArchivePath = tapeEntity.get_workfile_archive_path()
    recorder = record.Recorder()
    
    recorder.archive_workfile(workfileArchivePath, mayaFile)
    publishUsdComposition(tapeEntity, tapeEntity.name, recorder=recorder)
예제 #4
0
    def publish_workfile(self):

        maya_file = cmds.file(q=True, sn=True)
        # TODO: move this to core as "archive_workfile"
        output_path = resolve.Resolver().filepath_from_asset(
            self.asset_tape, "rigging", "workfile")
        filepath = os.path.join(output_path, os.path.basename(maya_file))
        version_number = resolve.Resolver().get_next_version_number(filepath)
        recorder = record.Recorder()

        om.MGlobal.displayInfo("Archiving workfile {}...".format(maya_file))
        with recorder.publish_record(filepath, version_number):
            shutil.copyfile(maya_file, filepath)
            recorder.status = record.Status.PUBLISHED
예제 #5
0
    def publish_rig(self):

        maya_file = cmds.file(q=True, sn=True)
        # Ignore incremental versions
        extension = os.path.splitext(maya_file)[1]

        # TODO: move this to core as "archive_workfile"
        output_path = resolve.Resolver().filepath_from_asset(
            self.asset_tape, "rigging", "rig")
        basename = "{}{}".format(self.asset_tape.name, extension)
        filepath = os.path.join(output_path, basename)

        version_number = resolve.Resolver().get_next_version_number(filepath)

        self.tag_rig(self.asset_tape.name, version_number)

        recorder = record.Recorder()

        om.MGlobal.displayInfo("Publishing rig {}...".format(maya_file))
        with recorder.publish_record(filepath, version_number):
            shutil.copyfile(maya_file, filepath)
            recorder.status = record.Status.PUBLISHED