コード例 #1
0
def create_gif_thumb(sequence,
                     ext='gif',
                     width='100',
                     height='x100',
                     do_height=True,
                     verbose=True):
    if do_height:
        res = height
    else:
        res = width
    path_object = PathObject(sequence)
    new_res = 'gif'
    path_object_output = path_object.copy(resolution=new_res)
    output_dir = os.path.dirname(path_object_output.path_root)
    out_seq = ''
    command = ''
    if not os.path.exists(output_dir):
        CreateProductionData(path_object=output_dir, project_management=False)
    if '####' in sequence:
        in_seq = '%s*.%s' % (split_sequence(sequence), path_object.ext)
        out_seq = '%s/%sthumb.%s' % (
            output_dir, os.path.basename(split_sequence(sequence)), ext)
        command = '%s %s -resize %s %s' % (CONFIG['magick'], in_seq, res,
                                           out_seq)

    if command:
        cgl_execute(command, verbose=verbose)
        return out_seq
コード例 #2
0
def create_proxy(sequence, ext='jpg', verbose=True, methodology='local'):
    """
    Creates a Jpeg proxy resolution based off the resolution of the given path.
    :param sequence:
    :param ext:
    :param project_management:
    :return:
    """
    out_seq = ''
    path_object = PathObject(sequence)
    start_frame = get_start_frame(sequence)
    new_res = '%s%s' % (path_object.resolution, 'Proxy')
    path_object_output = path_object.copy(resolution=new_res, ext='jpg')
    output_dir = os.path.dirname(path_object_output.path_root)
    if not os.path.exists(output_dir):
        CreateProductionData(path_object=output_dir, project_management=False)
    if '####' in sequence:
        # replace ### with "*"
        number = hash_to_number(sequence)[-1]
        in_seq = '%s*.%s' % (split_sequence(sequence), path_object.ext)
        out_seq = '%s/%s%s.%s' % (output_dir,
                                  os.path.basename(
                                      split_sequence(sequence)), number, ext)
        command = '%s %s -scene %s %s' % (CONFIG['magick'], in_seq,
                                          start_frame, out_seq)
        run_dict = cgl_execute(command,
                               methodology=methodology,
                               verbose=verbose)
        run_dict['file_out'] = out_seq
        write_to_cgl_data(run_dict)
    return run_dict
コード例 #3
0
def make_animated_gif(input_file):
    import subprocess
    input_file = input_file.replace('####', '%04d')
    h, _ = thumb_res.split('x')
    # palette = PathParser.thumbpath_from_path(input_file)
    palette = PathObject(input_file).thumb_path
    path_, _ = os.path.splitext(palette)
    ext = '.palette.png'
    palette = path_ + ext
    if os.path.exists(palette):
        os.remove(palette)
    # output_file = PathParser.thumbpath_from_path(input_file.replace('%04d', 'seq'))
    output_file = PathObject(input_file.replace('%04d', 'seq')).thumb_path
    ext2 = '.gif'
    path_, _ = os.path.splitext(output_file)
    output_file = path_ + ext2
    if not os.path.exists(os.path.dirname(output_file)):
        os.makedirs(os.path.dirname(output_file))
    else:
        if os.path.exists(output_file):
            os.remove(output_file)
    filters = "fps=15,scale=%s:-1:flags=lanczos" % h
    command = '%s -i %s -vf "%s,palettegen" -y %s' % (
        CONFIG['ffmpeg'], input_file, filters, palette)
    print 'command 1', command
    p = subprocess.Popen([
        CONFIG['ffmpeg'], '-i', input_file, '-vf',
        "%s,palettegen" % filters, '-y', palette
    ],
                         stdout=subprocess.PIPE,
                         stdin=subprocess.PIPE,
                         stderr=subprocess.STDOUT)
    print p.stdout.readline()  # read the first line
    for i in range(10):  # repeat several times to show that it works
        print >> p.stdin, i  # write input
        p.stdin.flush()  # not necessary in this case
        print p.stdout.readline(),  # read output
    print p.communicate("n\n")[0],
    p.wait()

    command2 = '%s -i %s -i %s -lavfi "%s [x]; [x][1:v] paletteuse" -y %s' \
               % (CONFIG['ffmpeg'], input_file, palette, filters, output_file.replace('palette.', ''))
    print 'command 2', command2
    p2 = subprocess.Popen([
        CONFIG['ffmpeg'], '-i', input_file, '-i', palette, '-lavfi',
        "%s [x]; [x][1:v] paletteuse" % filters, '-y',
        output_file.replace('palette.', '')
    ],
                          stdout=subprocess.PIPE,
                          stdin=subprocess.PIPE,
                          stderr=subprocess.STDOUT)
    print p2.stdout.readline(),  # read the first line
    for i in range(10):  # repeat several times to show that it works
        print >> p2.stdin, i  # write input
        p2.stdin.flush()  # not necessary in this case
        print p2.stdout.readline(),  # read output
    print p2.communicate("n\n")[0],
    p.wait()
    return output_file
コード例 #4
0
ファイル: FilesPanel.py プロジェクト: Eric-coder/cglumberjack
 def on_publish_clicked(self):
     print 'Publishing stuff now'
     current = PathObject(self.current_location)
     current.publish()
     dialog = InputDialog(title='Publish Successful',
                          message='Publish Files at: \n%s' %
                          current.publish_render)
     dialog.exec_()
コード例 #5
0
 def on_root_edited(self):
     self.root = os.path.join(self.drive, self.root_line_edit.text()).replace('\\', '/')
     self.to_object = PathObject.copy(self.path_object, root=self.root)
     if self.to_object.context == 'source':
         self.other_to_object = PathObject.copy(self.to_object, context='render')
     else:
         self.other_to_object = PathObject.copy(self.to_object, context='source')
     self.copy_to_path.setText(self.to_object.path_root.replace('\\', '/'))
コード例 #6
0
def get_projects(company):
    """
    returns projects for "company"
    :param company:
    :return:
    """
    d = {'root': ROOT, 'company': company, 'project': '*', 'context': 'source'}
    path_object = PathObject(d)
    return path_object.glob_project_element('project')
コード例 #7
0
 def on_drive_changed(self):
     self.drive = self.drive_combo.currentText()
     self.root = os.path.join(self.drive, 'CGL_EXPORT', 'COMPANIES')
     self.root_line_edit.setText(self.root)
     self.to_object = PathObject.copy(self.path_object, root=self.root)
     if self.to_object.context == 'source':
         self.other_to_object = PathObject.copy(self.to_object, context='render')
     else:
         self.other_to_object = PathObject.copy(self.to_object, context='source')
     self.copy_to_path.setText(self.to_object.path_root.replace('\\', '/'))
コード例 #8
0
ファイル: FilesPanel.py プロジェクト: Eric-coder/cglumberjack
 def version_up_selected_clicked(self):
     current = PathObject(self.current_location)
     # current location needs to have the version in it.
     next_minor = current.new_minor_version_object()
     next_minor.set_attr(filename='')
     next_minor.set_attr(resolution=self.current_location['resolution'])
     next_minor.set_attr(ext='')
     CreateProductionData(next_minor)
     cgl_copy(os.path.dirname(current.path_root), next_minor.path_root)
     # reselect the original asset.
     self.on_task_selected(next_minor)
コード例 #9
0
ファイル: FilesPanel.py プロジェクト: Eric-coder/cglumberjack
 def new_empty_version_clicked(self):
     """
     Action when "Empty Version" is clicked
     :return:
     """
     current = PathObject(self.version_obj)
     next_minor = current.new_minor_version_object()
     next_minor.set_attr(filename='')
     next_minor.set_attr(ext='')
     CreateProductionData(next_minor, create_default_file=True)
     self.on_task_selected(next_minor)
コード例 #10
0
def get_companies():
    """
    returns all companies the system is aware of.
    :return:
    """
    d = {'root': ROOT, 'company': '*'}
    path_object = PathObject(d)
    companies = path_object.glob_project_element('company')
    if '_config' in companies:
        companies.remove('_config')
    return companies
コード例 #11
0
ファイル: FilesPanel.py プロジェクト: Eric-coder/cglumberjack
 def update_task_location(self, path_object):
     """
     Method that sends the path object dictionary for anything happening within the Tasks Panel.
     :param path_object:
     :return:
     """
     if path_object:
         if isinstance(path_object, dict):
             path_object = PathObject(path_object)
         self.current_location = path_object.data
         self.path_object = path_object.copy()
         self.location_changed.emit(self.path_object)
コード例 #12
0
    def __init__(self, path_object):
        LJDialog.__init__(self)
        self.path_object = path_object
        if self.path_object.context == 'source':
            self.other_path_object = PathObject.copy(path_object, context='render')
        else:
            self.other_path_object = PathObject.copy(path_object, context='source')
        # TODO - i need something here to check if i'm in a task or not, if not send a popup
        task = path_object.task
        seq = path_object.seq
        shot = path_object.shot
        self.to_object = None
        self.root = ''
        all_ = r'%s/%s/%s' % (seq, shot, task)
        self.setWindowTitle('Export %s to drive' % all_)
        v_layout = QtWidgets.QVBoxLayout(self)
        grid_layout = QtWidgets.QGridLayout()
        button_layout = QtWidgets.QHBoxLayout()
        drive_label = QtWidgets.QLabel('External Drive:')
        self.drive_combo = AdvComboBox()
        root_label = QtWidgets.QLabel('External Drive Root:')
        self.root_line_edit = QtWidgets.QLineEdit()
        copy_from_label = QtWidgets.QLabel('copy from:')
        self.copy_from_path = QtWidgets.QLabel(path_object.path_root)
        copy_to_label = QtWidgets.QLabel('copy to')
        self.copy_to_path = QtWidgets.QLabel('')
        self.message = QtWidgets.QLabel('')
        self.cancel_button = QtWidgets.QPushButton('Cancel')
        self.ok_button = QtWidgets.QPushButton('Copy Task')

        grid_layout.addWidget(drive_label, 0, 0)
        grid_layout.addWidget(self.drive_combo, 0, 1)
        grid_layout.addWidget(root_label, 1, 0)
        grid_layout.addWidget(self.root_line_edit, 1, 1)
        grid_layout.addWidget(copy_from_label, 2, 0)
        grid_layout.addWidget(self.copy_from_path, 2, 1)
        grid_layout.addWidget(copy_to_label, 3, 0)
        grid_layout.addWidget(self.copy_to_path, 3, 1)

        button_layout.addStretch(1)
        button_layout.addWidget(self.cancel_button)
        button_layout.addWidget(self.ok_button)

        v_layout.addLayout(grid_layout)
        v_layout.addWidget(self.message)
        v_layout.addLayout(button_layout)

        self.drive_combo.currentIndexChanged.connect(self.on_drive_changed)
        self.root_line_edit.textChanged.connect(self.on_root_edited)
        self.cancel_button.clicked.connect(self.on_cancel_clicked)
        self.ok_button.clicked.connect(self.on_copy_clicked)
        self.get_available_drives()
コード例 #13
0
    def execute(self, context):

        # my_users =  bpy.props.EnumProperty(items = split_string(self.my_string))

        path_object = get_asset_from_name(bpy.types.Scene.scene_enum.replace('publish', self.users))
        path_object = path_object.copy(task=self.task, set_proper_filename=True)
        path_object = path_object.latest_version().copy(set_proper_filename=True)
        render = path_object.copy(context='render')

        if os.path.isfile(render.path_root):
            path_object = render
        open_file = path_object.path_root

        message = 'selected {}'.format(open_file)

        try:
            bpy.ops.object.mode_set(mode='OBJECT')
        except RuntimeError:
            pass

        if os.path.isfile((open_file)):
            from cgl.core.path import PathObject
            file_to_be_imported = PathObject(open_file)
            if file_to_be_imported.task == 'bndl':
                from cgl.plugins.blender.tasks import bndl
                bndl.bundle_import(file_to_be_imported.msd_path)
                return

            if path_object.type in ['char', ] and path_object.task == 'rig':

                object = lay.import_rig(path_object)

        from cgl.plugins.blender.utils import parent_object
            else:
コード例 #14
0
ファイル: FilesPanel.py プロジェクト: Eric-coder/cglumberjack
 def on_file_dragged_to_source(self, data):
     object_ = PathObject.copy(self.version_obj, context='source')
     process_method(self.parent().progress_bar,
                    self.on_file_dragged,
                    args=(object_, data),
                    text='Lumber-hacking Files')
     self.on_task_selected(object_)
コード例 #15
0
 def go_to_location(self, to_path):
     path_object = PathObject(to_path).copy(context='source',
                                            user='',
                                            resolution='',
                                            filename='',
                                            ext='',
                                            filename_base='',
                                            version='')
     self.location_changed.emit(path_object)
コード例 #16
0
def run(lumbermill):
    """
    Copies Entire Folder Structures to an external Drive
    :param session:
    :return:
    """
    path_object = PathObject(lumbermill.path_widget.text.replace('/*', ''))
    dialog = ExportDialog(path_object=path_object)
    dialog.exec_()
コード例 #17
0
 def on_view_in_lumbermill_clicked(self):
     path_object = PathObject(
         self.current_selection[0][PUBLISH_FILEPATH]).copy(context='source',
                                                           user='',
                                                           resolution='',
                                                           filename='',
                                                           ext='',
                                                           filename_base='',
                                                           version='')
     self.location_changed.emit(path_object)
コード例 #18
0
def make_full_res_jpg(input_file, preview_path=None):
    if not preview_path:
        # preview_path = PathParser.preview_path_from_frame_path(input_file, file_type='image')
        preview_path = PathObject(path_object=input_file).preview_path
        if not os.path.isdir(os.path.split(preview_path)[0]):
            os.makedirs(os.path.split(preview_path)[0])
    command = r"%s %s --ch R,G,B -o %s" % (CONFIG['magick'], input_file,
                                           preview_path)
    if command:
        cgl_execute(command, verbose=True)
    return preview_path
コード例 #19
0
ファイル: panels.py プロジェクト: Eric-coder/cglumberjack
def prep_list_for_table(list_, path_filter=None, split_for_file=False):
    list_.sort()
    output_ = []
    for each in list_:
        if path_filter:
            filtered = PathObject(each).data[path_filter]
            output_.append([filtered])
        else:
            if split_for_file:
                each = os.path.basename(each)
            output_.append([each])
    return output_
コード例 #20
0
 def ingest_file(self, index, row, from_file, to_file, current_date):
     print 'FILETYPE =', row['Filetype']
     if not self.test:
         print 'Copying %s to %s' % (from_file, to_file)
         CreateProductionData(os.path.dirname(to_file))
         cgl_copy(from_file, to_file, methodology=METHODOLOGY)
         self.shared_data['publish_path_object'] = PathObject(to_file)
     self.data_frame.at[index, 'Status'] = 'Published'
     self.data_frame.at[index, 'Publish_Date'] = current_date
     row['Publish_Date'] = current_date
     row['Status'] = 'Published'
     self.make_source_file(to_file, row)
コード例 #21
0
ファイル: FilesPanel.py プロジェクト: Eric-coder/cglumberjack
    def load_render_files(self, widget):

        logging.debug('loading render files')
        widget.files_area.work_files_table.show()
        render_table = widget.files_area.export_files_table
        current = PathObject(self.version_obj)
        if widget.files_area.work_files_table.user:
            renders = current.copy(
                context='render',
                task=widget.task,
                user=widget.files_area.work_files_table.user,
                version=widget.files_area.work_files_table.version,
                resolution=widget.files_area.work_files_table.resolution,
                filename='*')
            files_ = glob.glob(renders.path_root)
            if current.user == 'publish':
                render_files_label = 'Published Files'
                widget.files_area.publish_button.hide()
                widget.files_area.new_version_button.hide()
            else:
                widget.files_area.new_version_button.show()
                widget.files_area.review_button.show()
                widget.files_area.publish_button.show()
                render_files_label = 'Ready to Review/Publish'
            logging.debug('Published Files for %s' % current.path_root)
            data_ = self.prep_list_for_table(files_, basename=True, length=1)
            model = FilesModel(data_, [render_files_label])
            widget.setup(render_table, model)
            render_table.show()
            widget.files_area.open_button.show()
            widget.empty_state.hide()
            if not files_:
                widget.files_area.review_button.hide()
                widget.files_area.publish_button.hide()
                if not self.work_files:
                    render_table.hide()
                    widget.files_area.open_button.hide()
                    widget.files_area.new_version_button.hide()
                    widget.files_area.work_files_table.hide()
                    widget.empty_state.show()
コード例 #22
0
ファイル: FilesPanel.py プロジェクト: Eric-coder/cglumberjack
 def on_create_asset(self):
     if self.current_location['scope'] == 'IO':
         dialog = InputDialog(self,
                              title='Create Input Company',
                              message='Enter the CLIENT or name of VENDOR',
                              combo_box_items=['CLIENT'])
         dialog.exec_()
         self.current_location[
             'ingest_source'] = dialog.combo_box.currentText()
         ingest_source_location = PathObject(
             self.current_location).path_root
         if ingest_source_location.endswith(dialog.combo_box.currentText()):
             CreateProductionData(self.current_location, json=False)
     else:
         from apps.lumbermill.elements import asset_creator
         if 'asset' in self.current_location:
             task_mode = True
         else:
             task_mode = False
         dialog = asset_creator.AssetCreator(
             self, path_dict=self.current_location, task_mode=task_mode)
         dialog.exec_()
コード例 #23
0
def add_namespace(task = 'bndl'):
    set_source_path()

    bndl = utils.get_object(task)

    for obj in bndl.children:
        print(obj.name)

        path_object = PathObject(add_root(obj['source_path']))
        asset = path_object.asset
        new_name = '{}:{}'.format(asset, obj.name)

        if ':' not in obj.name:
            obj.name = new_name
コード例 #24
0
 def run(self):
     path_object = self.shared_data['path_object']
     user = path_object.user
     if path_object.context != 'render':
         path_object = PathObject.copy(path_object, context='render')
     from_dir = os.path.dirname(path_object.path_root)
     pub_obj = PathObject(from_dir)
     pub_obj = pub_obj.copy(latest=True)
     pub_obj.set_attr(user='******')
     pub_obj = pub_obj.next_major_version()
     major_version_obj = pub_obj.copy(user=user)
     for each in os.listdir(from_dir):
         print(os.path.join(from_dir, each), os.path.join(major_version_obj.path_root, each))
         print(os.path.join(from_dir, each), os.path.join(pub_obj.path_root, each))
         cgl_copy(os.path.join(from_dir, each), os.path.join(major_version_obj.path_root, each))
         cgl_copy(os.path.join(from_dir, each), os.path.join(pub_obj.path_root, each))
     self.pass_check('Done Copying Render Files to %s' % pub_obj.path_root)
コード例 #25
0
ファイル: panels.py プロジェクト: Eric-coder/cglumberjack
 def on_main_asset_selected(self, data):
     print 'selecting'
     if data:
         print data[0][2]
         path_object = PathObject(data[0][2])
         if not path_object.task:
             path_object.set_attr(task='*')
         else:
             path_object.set_attr(user=None)
         self.update_location(path_object)
コード例 #26
0
ファイル: panels.py プロジェクト: Eric-coder/cglumberjack
 def load_assets(self):
     red_palette = QtGui.QPalette()
     red_palette.setColor(self.foregroundRole(), QtGui.QColor(255, 0, 0))
     self.assets.data_table.clearSpans()
     items = glob.glob(self.path_object.path_root)
     data = []
     temp_ = []
     self.assets.add_button.clicked.connect(self.on_create_asset)
     d = None
     if items:
         self.assets.data_table.show()
         self.assets.search_box.show()
         self.assets.message.hide()
         self.assets.message.setText('')
         for each in items:
             obj_ = PathObject(str(each))
             d = obj_.data
             shot_name = '%s_%s' % (d['seq'], d['shot'])
             if shot_name not in temp_:
                 temp_.append(shot_name)
                 if d['scope'] == 'assets':
                     data.append([d['seq'], d['shot'], each, '', '', ''])
                 elif d['scope'] == 'shots':
                     data.append([d['seq'], shot_name, each, '', '', ''])
         if d['scope'] == 'assets':
             self.assets.setup(
                 ListItemModel(data, [
                     'Category', 'Name', 'Path', 'Due Date', 'Status',
                     'Task'
                 ]))
         elif d['scope'] == 'shots':
             self.assets.setup(
                 ListItemModel(
                     data,
                     ['Seq', 'Shot', 'Path', 'Due Date', 'Status', 'Task']))
         self.assets.data_table.hideColumn(0)
         self.assets.data_table.hideColumn(2)
         self.assets.data_table.hideColumn(3)
         self.assets.data_table.hideColumn(5)
     else:
         self.assets.data_table.hide()
         self.assets.message.setText(
             'No %s Found! \nClick + button to create %s' %
             (self.path_object.scope.title(), self.path_object.scope))
         self.assets.message.setPalette(red_palette)
         self.assets.message.show()
コード例 #27
0
ファイル: FilesPanel.py プロジェクト: Eric-coder/cglumberjack
    def new_files_dragged(self, files):
        to_object = PathObject(self.sender().to_object)
        to_folder = to_object.path_root

        for f in files:
            file_ = os.path.split(f)[-1]
            to_file = os.path.join(to_folder, file_)
            if '.' in file_:
                logging.info('Copying %s to %s' % (f, to_file))
                cgl_copy(f, to_file)
                CreateProductionData(path_object=to_object)
                self.on_task_selected(self.version_obj)
            else:
                logging.info('Copying directory %s to %s' % (f, to_file))
                cgl_copy(f, to_file)
                CreateProductionData(path_object=to_object)
                self.on_task_selected(self.version_obj)
コード例 #28
0
 def make_source_file(self, to_path, row):
     source_path = PathObject(to_path)
     source_path.set_attr(context='source')
     source_path.set_attr(filename='system_report.csv')
     dir = os.path.dirname(source_path.path_root)
     data = []
     data.append((row["Filepath"], row["Filename"], row["Filetype"], row["Frame_Range"], row["Tags"],
                  row["Keep_Client_Naming"], row["Scope"], row["Seq"], row["Shot"], row["Task"],
                  row["Publish_Filepath"], row["Publish_Date"], row["Status"]))
     df = pd.DataFrame(data, columns=self.shared_data['ingest_browser_header'])
     if not self.test:
         df.to_csv(source_path.path_root, index=False)
コード例 #29
0
    def run(self):
        """
        Checking to see if there are files within the "render" folder area.  I should expect that i'm going to get a
        filename, but i will check for it anyway.
        :return:
        """
        path_object = self.shared_data['path_object']
        if path_object.filename:
            if path_object.context != 'render':
                path_object = PathObject.copy(path_object, context='render')
            render_dir = os.path.dirname(path_object.path_root)
            if os.path.exists(render_dir):
                if os.listdir(render_dir):
                    self.pass_check('Found Render Files')
                    return
        else:
            print 'File Name Not Defined'

        self.fail_check('No Render Files Found at: %s \nCheck Failed' %
                        os.path.dirname(path_object.path_root))
コード例 #30
0
 def ingest_sequence(self, index, row, from_file, to_file, current_date):
     to_dir = os.path.dirname(to_file)
     if not self.test:
         CreateProductionData(to_dir)
     from_filename = os.path.split(from_file)[-1]
     self.shared_data['publish_path_object'] = PathObject(
         os.path.join(to_dir, from_filename))
     print 'Copying sequence %s to %s' % (from_file, to_dir)
     seq = self.shared_data['publish_path_object'].seq
     shot = self.shared_data['publish_path_object'].shot
     info_ = cgl_copy(from_file,
                      to_dir,
                      methodology=METHODOLOGY,
                      job_name='%s_%s' % (seq, shot))
     self.shared_data['copy_job_id'] = info_['job_id']
     self.data_frame.at[index, 'Status'] = 'Published'
     self.data_frame.at[index, 'Publish_Date'] = current_date
     row['Publish_Date'] = current_date
     row['Status'] = 'Published'
     self.make_source_file(to_dir, row)