def get_renderchan_sequences(sequence):
     from renderchan.file import RenderChanFile
     
     sequence_list = []
     if sequence.type == "IMAGE":
         for element in sequence.elements:
             path = os.path.join(bpy.path.abspath(sequence.directory), element.filename)
             file = RenderChanFile(path, rcl.main.modules, rcl.main.projects)
             if file.project != None and file.module and file.getRenderPath() == path:
                 sequence_list.append(file)
     elif sequence.type == "MOVIE" or sequence.type == "SOUND":
         path = bpy.path.abspath(sequence.filepath)
         file = RenderChanFile(path, rcl.main.modules, rcl.main.projects)
         if file.project != None and file.module and file.getRenderPath() == path:
             sequence_list.append(file)
     elif sequence.type == "META":
         for subsequence in sequence.sequences:
             for file in get_renderchan_sequence(subsequence):
                 is_unique = True
                 for compare_file in sequence_list:
                     if compare_file.getPath() == file.getPath():
                         is_unique = False
                         break
                 if is_unique:
                     sequence_list.append(file)
     return sequence_list
 def poll(self, context):
     global rcl
     if not rcl.is_project or context.edit_image is None:
         return False
     
     from renderchan.file import RenderChanFile
     path = bpy.path.abspath(context.edit_image.filepath)
     output = io.StringIO()
     with redirect_stdout(output):
         file = RenderChanFile(path, rcl.main.modules, rcl.main.projects)
     return file.project != None and file.module and file.getRenderPath() == path
    def poll(self, context):
        global rcl
        if not rcl.is_project or context.edit_image is None:
            return False

        from renderchan.file import RenderChanFile
        path = bpy.path.abspath(context.edit_image.filepath)
        output = io.StringIO()
        with redirect_stdout(output):
            file = RenderChanFile(path, rcl.main.modules, rcl.main.projects)
        return file.project != None and file.module and file.getRenderPath(
        ) == path
        def get_renderchan_sequences(sequence):
            from renderchan.file import RenderChanFile

            sequence_list = []
            if sequence.type == "IMAGE":
                for element in sequence.elements:
                    path = os.path.join(bpy.path.abspath(sequence.directory),
                                        element.filename)
                    file = RenderChanFile(path, rcl.main.modules,
                                          rcl.main.projects)
                    if file.project != None and file.module and file.getRenderPath(
                    ) == path:
                        sequence_list.append(file)
            elif sequence.type == "MOVIE" or sequence.type == "SOUND":
                path = bpy.path.abspath(sequence.filepath)
                file = RenderChanFile(path, rcl.main.modules,
                                      rcl.main.projects)
                if file.project != None and file.module and file.getRenderPath(
                ) == path:
                    sequence_list.append(file)
            elif sequence.type == "META":
                for subsequence in sequence.sequences:
                    for file in get_renderchan_sequence(subsequence):
                        is_unique = True
                        for compare_file in sequence_list:
                            if compare_file.getPath() == file.getPath():
                                is_unique = False
                                break
                        if is_unique:
                            sequence_list.append(file)
            return sequence_list
    def execute(self, context):
        from renderchan.file import RenderChanFile

        output = io.StringIO()
        with redirect_stdout(output):
            file = RenderChanFile(
                bpy.path.abspath(context.blend_data.filepath),
                rcl.main.modules, rcl.main.projects)
        render_file(file, context.scene, False)
        return {"FINISHED"}
 def is_renderchan_sequence(sequence):
     from renderchan.file import RenderChanFile
     
     if sequence.type == "IMAGE":
         for element in sequence.elements:
             path = os.path.join(bpy.path.abspath(sequence.directory), element.filename)
             file = RenderChanFile(path, rcl.main.modules, rcl.main.projects)
             if file.project != None and file.module and file.getRenderPath() == path:
                 return True
     elif sequence.type == "MOVIE" or sequence.type == "SOUND":
         path = bpy.path.abspath(sequence.filepath)
         file = RenderChanFile(path, rcl.main.modules, rcl.main.projects)
         if file.project != None and file.module and file.getRenderPath() == path:
             return True
     elif sequence.type == "META":
         for subsequence in sequence.sequences:
             if is_renderchan_sequence(subsequence):
                 return True
     return False
Exemplo n.º 7
0
def main(argv):
    options, args = process_args()

    renderchan = RenderChan()

    # Parse frozen parameters
    if options.freezeList or options.unfreezeList:
        if not options.freezeList:
            options.freezeList = []
        if not options.unfreezeList:
            options.unfreezeList = []
        frozenListChanged = False
        for filename in options.freezeList:
            filename = os.path.abspath(filename)
            if not filename in options.unfreezeList:
                taskfile = RenderChanFile(filename, renderchan.modules, renderchan.projects)
                taskfile.setFrozen(True)
                frozenListChanged = True
        for filename in options.unfreezeList:
            filename = os.path.abspath(filename)
            if not filename in options.freezeList:
                taskfile = RenderChanFile(filename, renderchan.modules, renderchan.projects)
                taskfile.setFrozen(False)
                frozenListChanged = True
        if frozenListChanged:
            taskfile.project.saveFrozenPaths()

    if options.setLanguage:
        project = RenderChanProject(os.getcwd())
        project.switchLanguage(options.setLanguage)
def load_handler(something):
    from renderchan.file import RenderChanFile

    global rcl
    output = io.StringIO()
    with redirect_stdout(output):
        rcl.blend = RenderChanFile(bpy.data.filepath, rcl.main.modules,
                                   rcl.main.projects)
    rcl.is_project = rcl.blend.project != None
    if not rcl.is_project:
        return

    with redirect_stdout(output):
        deps = rcl.main.parseDirectDependency(rcl.blend, False, True)
    # Temporary fix
    reinit_renderchan()
    if deps[0]:
        bpy.ops.object.rc_load_dialog('INVOKE_DEFAULT')
Exemplo n.º 9
0
def main(argv):
    options, args = process_args()

    renderchan = RenderChan()
    renderchan.projects.readonly = True

    if options.profile:
        renderchan.setProfile(options.profile)
    if options.stereo in ("left","l"):
        renderchan.setStereoMode("left")
    elif options.stereo in ("right","r"):
        renderchan.setStereoMode("right")

    if options.active_project:
        renderchan.projects.load(options.active_project)

    if options.compare_time:
        compare_time=float(options.compare_time)
    else:
        compare_time=None
    if not ( options.action and options.action in ['render','merge','snapshot'] ):
        options.action = 'render'

    if options.action != 'snapshot':
        taskfile = RenderChanFile(options.filename, renderchan.modules, renderchan.projects)
        taskfile.setFormat(options.format)

        if options.action == 'merge' and options.stereo and ( options.stereo[0:1]=="v" or options.stereo[0:1]=="h" ):
            pass
        else:
            (isDirty, tasklist, maxTime)=renderchan.parseDirectDependency(taskfile, compare_time)
            if isDirty:
                print("ERROR: There are unrendered dependencies for this file!", file=sys.stderr)
                print("       (Project tree changed or job started too early?)", file=sys.stderr)
                print("       Aborting.", file=sys.stderr)
                exit(1)

    if options.action == 'render':
        if options.start and options.end:
            renderchan.job_render(taskfile, taskfile.getFormat(), updateCompletion, int(options.start), int(options.end), compare_time)
        else:
            renderchan.job_render(taskfile, taskfile.getFormat(), updateCompletion, compare_time)
    elif options.action == 'merge':
        if options.stereo and ( options.stereo[0:1]=="v" or options.stereo[0:1]=="h" ):
            renderchan.job_merge_stereo(taskfile, options.stereo)
        else:
            renderchan.job_merge(taskfile, taskfile.getFormat(), renderchan.projects.stereo, compare_time)
    elif options.action == 'snapshot':
        if not options.snapshot_target:
            print("ERROR: Please specify output filename using --target-dir option.", file=sys.stderr)
        renderchan.job_snapshot(options.filename, os.path.abspath(options.snapshot_target))
        def is_renderchan_sequence(sequence):
            from renderchan.file import RenderChanFile

            if sequence.type == "IMAGE":
                for element in sequence.elements:
                    path = os.path.join(bpy.path.abspath(sequence.directory),
                                        element.filename)
                    file = RenderChanFile(path, rcl.main.modules,
                                          rcl.main.projects)
                    if file.project != None and file.module and file.getRenderPath(
                    ) == path:
                        return True
            elif sequence.type == "MOVIE" or sequence.type == "SOUND":
                path = bpy.path.abspath(sequence.filepath)
                file = RenderChanFile(path, rcl.main.modules,
                                      rcl.main.projects)
                if file.project != None and file.module and file.getRenderPath(
                ) == path:
                    return True
            elif sequence.type == "META":
                for subsequence in sequence.sequences:
                    if is_renderchan_sequence(subsequence):
                        return True
            return False
    def execute(self, context):
        from renderchan.file import RenderChanFile

        path = bpy.path.abspath(self.properties.filepath)
        output = io.StringIO()
        with redirect_stdout(output):
            file = RenderChanFile(path, rcl.main.modules, rcl.main.projects)
        if file.project == None or not file.module:
            # Not a RenderChan file, just add
            if os.path.splitext(path)[1] in bpy.path.extensions_movie:
                bpy.ops.sequencer.movie_strip_add(filepath=path,
                                                  relative_path=self.rel_path,
                                                  frame_start=self.start,
                                                  channel=self.channel,
                                                  replace_sel=self.replace,
                                                  sound=self.sound)
            elif os.path.splitext(path)[1] in bpy.path.extensions_image:
                file_list = []
                for f in self.files:
                    file_list.append({"name": f.name})
                bpy.ops.sequencer.image_strip_add(directory=os.path.dirname(
                    bpy.path.abspath(self.filepath)),
                                                  files=file_list,
                                                  relative_path=self.rel_path,
                                                  frame_start=self.start,
                                                  channel=self.channel,
                                                  replace_sel=self.replace)
            elif os.path.splitext(path)[1] in bpy.path.extensions_audio:
                bpy.ops.sequencer.sound_strip_add(filepath=path,
                                                  relative_path=self.rel_path,
                                                  frame_start=self.start,
                                                  channel=self.channel,
                                                  replace_sel=self.replace,
                                                  cache=self.cache)
            else:
                self.report({"ERROR"}, "Could not handle this file format")
        else:
            # It is a RenderChan file, render if necessary and then add.
            if file.getRenderPath() == path:
                path = file.getPath()
            render_file(file, context.scene, False)

            if os.path.isdir(file.getRenderPath()):
                file_list = []
                for i in range(file.getStartFrame(), file.getEndFrame()):
                    file_list.append(
                        {"name": "file.%05d.%s" % (i, file.getFormat())})
                bpy.ops.sequencer.image_strip_add(
                    directory=file.getRenderPath(),
                    files=file_list,
                    relative_path=self.rel_path,
                    frame_start=self.start,
                    channel=self.channel,
                    replace_sel=self.replace)
            elif os.path.splitext(
                    file.getRenderPath())[1] in bpy.path.extensions_movie:
                bpy.ops.sequencer.movie_strip_add(
                    filepath=file.getRenderPath(),
                    relative_path=self.rel_path,
                    frame_start=self.start,
                    channel=self.channel,
                    replace_sel=self.replace,
                    sound=self.sound)
            elif os.path.splitext(
                    file.getRenderPath())[1] in bpy.path.extensions_image:
                bpy.ops.sequencer.image_strip_add(
                    directory=os.path.dirname(file.getRenderPath()),
                    files=[{
                        "name": os.path.basename(file.getRenderPath())
                    }],
                    relative_path=self.rel_path,
                    frame_start=self.start,
                    channel=self.channel,
                    replace_sel=self.replace)
            else:
                self.report({"ERROR"}, "Could not handle this file format")
        return {"FINISHED"}
 def execute(self, context):
     from renderchan.file import RenderChanFile
     
     path = bpy.path.abspath(self.properties.filepath)
     output = io.StringIO()
     with redirect_stdout(output):
         file = RenderChanFile(path, rcl.main.modules, rcl.main.projects)
     if file.project == None or not file.module:
         # Not a RenderChan file, just add
         if os.path.splitext(path)[1] in bpy.path.extensions_movie:
             bpy.ops.sequencer.movie_strip_add(filepath=path, relative_path=self.rel_path, frame_start=self.start, channel=self.channel, replace_sel=self.replace, sound=self.sound)
         elif os.path.splitext(path)[1] in bpy.path.extensions_image:
             file_list = []
             for f in self.files:
                 file_list.append({"name": f.name})
             bpy.ops.sequencer.image_strip_add(directory=os.path.dirname(bpy.path.abspath(self.filepath)), files=file_list, relative_path=self.rel_path, frame_start=self.start, channel=self.channel, replace_sel=self.replace)
         elif os.path.splitext(path)[1] in bpy.path.extensions_audio:
             bpy.ops.sequencer.sound_strip_add(filepath=path, relative_path=self.rel_path, frame_start=self.start, channel=self.channel, replace_sel=self.replace, cache=self.cache)
         else:
             self.report({"ERROR"}, "Could not handle this file format");
     else:
         # It is a RenderChan file, render if necessary and then add.
         if file.getRenderPath() == path:
             path = file.getPath()
         render_file(file, context.scene, False)
         
         if os.path.isdir(file.getRenderPath()):
             file_list = []
             for i in range(file.getStartFrame(), file.getEndFrame()):
                 file_list.append({"name": "file.%05d.%s" % (i, file.getFormat())})
             bpy.ops.sequencer.image_strip_add(directory=file.getRenderPath(), files=file_list, relative_path=self.rel_path, frame_start=self.start, channel=self.channel, replace_sel=self.replace)
         elif os.path.splitext(file.getRenderPath())[1] in bpy.path.extensions_movie:
             bpy.ops.sequencer.movie_strip_add(filepath=file.getRenderPath(), relative_path=self.rel_path, frame_start=self.start, channel=self.channel, replace_sel=self.replace, sound=self.sound)
         elif os.path.splitext(file.getRenderPath())[1] in bpy.path.extensions_image:
             bpy.ops.sequencer.image_strip_add(directory=os.path.dirname(file.getRenderPath()), files=[{"name":os.path.basename(file.getRenderPath())}], relative_path=self.rel_path, frame_start=self.start, channel=self.channel, replace_sel=self.replace)
         else:
             self.report({"ERROR"}, "Could not handle this file format");
     return {"FINISHED"}
Exemplo n.º 13
0
def main(argv):
    options, args = process_args()

    renderchan = RenderChan()
    renderchan.projects.readonly = True

    if options.profile:
        renderchan.setProfile(options.profile)
    if options.stereo in ("left", "l"):
        renderchan.setStereoMode("left")
    elif options.stereo in ("right", "r"):
        renderchan.setStereoMode("right")

    if options.active_project:
        renderchan.projects.load(options.active_project)

    if options.compare_time:
        compare_time = float(options.compare_time)
    else:
        compare_time = None
    if not (options.action
            and options.action in ['render', 'merge', 'snapshot']):
        options.action = 'render'

    if options.action != 'snapshot':
        taskfile = RenderChanFile(options.filename, renderchan.modules,
                                  renderchan.projects)
        taskfile.setFormat(options.format)

        if options.action == 'merge' and options.stereo and (
                options.stereo[0:1] == "v" or options.stereo[0:1] == "h"):
            pass
        else:
            (isDirty, tasklist, maxTime) = renderchan.parseDirectDependency(
                taskfile, compare_time)
            if isDirty:
                print(
                    "ERROR: There are unrendered dependencies for this file!",
                    file=sys.stderr)
                print(
                    "       (Project tree changed or job started too early?)",
                    file=sys.stderr)
                print("       Aborting.", file=sys.stderr)
                exit(1)

    if options.action == 'render':
        if options.start and options.end:
            renderchan.job_render(taskfile, taskfile.getFormat(),
                                  updateCompletion, int(options.start),
                                  int(options.end), compare_time)
        else:
            renderchan.job_render(taskfile, taskfile.getFormat(),
                                  updateCompletion, compare_time)
    elif options.action == 'merge':
        if options.stereo and (options.stereo[0:1] == "v"
                               or options.stereo[0:1] == "h"):
            renderchan.job_merge_stereo(taskfile, options.stereo)
        else:
            renderchan.job_merge(taskfile, taskfile.getFormat(),
                                 renderchan.projects.stereo, compare_time)
    elif options.action == 'snapshot':
        if not options.snapshot_target:
            print(
                "ERROR: Please specify output filename using --target-dir option.",
                file=sys.stderr)
        renderchan.job_snapshot(options.filename,
                                os.path.abspath(options.snapshot_target))