cgl.core package

Subpackages

Submodules

cgl.core.bid module

cgl.core.cgl_info module

cgl.core.convert module

cgl.core.convert.audio_to_wav(input_audio_path, output_wav_path=None)[source]

Generates an ffmpeg command string to convert an audio file to WAV format.

Parameters:
  • input_audio_path (str) – Path to the input audio file.

  • output_wav_path (str, optional) – Path to save the output WAV file. If not provided, it will use the same filename with a .wav extension.

Returns:

The formatted ffmpeg command string.

Return type:

str

cgl.core.convert.convert_image_to_png(image_path, output_path=None, resolution=None, quiet=True)[source]

Converts any image_plane file (JPG, TIFF, BMP, etc.) to a PNG while preserving aspect ratio. If resolution is provided, resizes the image_plane to fit within it, adding black padding.

Parameters:
  • image_path (str) – Path to the source image_plane.

  • output_path (str, optional) – Path to save the PNG file. If None, auto-generates a path.

  • resolution (tuple, optional) – (width, height) to fit the image_plane within. If None, keeps the original resolution.

Returns:

Output PNG file path or None if conversion failed.

Return type:

str

cgl.core.convert.convert_png_sequence_to_mp4(source_sequence, start_frame=None, dest_mp4=None, fps=24, width=1920, height=1080, force=True)[source]

Converts a PNG image_plane sequence into an MP4 file.

Parameters:
  • source_sequence (str) – Path pattern for the PNG sequence (e.g., “frame_####.png”).

  • start_frame (int, optional) – First frame number (default: auto-detected).

  • dest_mp4 (str, optional) – Output MP4 file path. Auto-generated if None.

  • fps (int, optional) – Frames per second (default: 24).

  • width (int, optional) – Output width (default: 1920).

  • height (int, optional) – Output height (default: 1080).

  • force (bool, optional) – If True, overwrite existing MP4 (default: True).

Returns:

Path to the generated MP4 file or None if conversion failed.

Return type:

str

cgl.core.convert.convert_psd_to_png(psd_path, output_path=None, resolution=None, quiet=True)[source]

Converts a PSD file to a PNG while preserving aspect ratio. If resolution is provided, resizes the image_plane to fit within it, adding black padding.

Parameters:
  • psd_path (str) – Path to the PSD file.

  • output_path (str, optional) – Output PNG path. If None, it auto-generates.

  • resolution (tuple, optional) – (width, height) to fit the image_plane within. If None, keeps the original resolution.

Returns:

The output PNG path or None if failed.

Return type:

str

cgl.core.convert.convert_to_png(source_path, output_path=None, resolution=None)[source]

Converts any image_plane file (PSD, JPG, TIFF, BMP, etc.) to a full-resolution PNG.

Parameters:
  • source_path (str) – Path to the source image_plane.

  • output_path (str, optional) – Path to save the PNG file. If None, it auto-generates.

Returns:

Output PNG file path or None if conversion failed.

Return type:

str

cgl.core.convert.convert_to_wav(input_path, output_wav_path=None)[source]

Converts an audio or video file to WAV format. :param input_path: :param output_wav_path:

Returns:

cgl.core.convert.create_mp4_from_proxy(proxy_folder_path)[source]

Converts a proxy sequence into an mp4 preview file. :param proxy_folder_path:

Returns:

cgl.core.convert.create_mp4_from_single_proxy(proxy_path)[source]

Converts a single proxy image_plane into an mp4 preview file. :param proxy_path:

Returns:

cgl.core.convert.create_png_proxies(path_object, resolution=(1920, 1080))[source]

This script assumes we are working with files in the “Render” folder that we are seeking to create jpg proxies for the purpose of creating quicktime movies. :param path_object: The path object to the render folder. :param resolution: The resolution to convert the images to.

Returns:

cgl.core.convert.get_proxy_frame(proxy_path, frame_number)[source]

This function will return the path to a specific frame of a jpg proxy. :param proxy_path: Path to the jpg proxy file. :param frame_number: The frame number to get the path for.

Returns:

The path to the specific frame.

Return type:

str

cgl.core.convert.psd_to_image(psd_path)[source]

Converts a PSD file to a PIL Image.

Parameters:

psd_path (str) – Path to the PSD file.

Returns:

The converted image_plane or None if failed.

Return type:

PIL.Image

cgl.core.convert.resize_and_pad_image(img, resolution=None)[source]

Resizes an image_plane while maintaining aspect ratio and pads it with black if needed.

Parameters:
  • img (PIL.Image) – The input PIL Image object.

  • resolution (tuple, optional) – (width, height) to fit the image_plane within. If None, returns the original image_plane.

Returns:

The resized and padded image_plane.

Return type:

PIL.Image

cgl.core.convert.video_to_wav(input_video_path, output_wav_path=None)[source]

Generates an ffmpeg command string to convert a video file to a WAV file.

Parameters:
  • input_video_path (str) – Path to the input video file.

  • output_wav_path (str, optional) – Path to save the output WAV file. If not provided, saves in the same directory with the same filename.

Returns:

The formatted ffmpeg command string.

Return type:

str

cgl.core.list_dir module

cgl.core.list_dir.find_missing(sequence, padding)[source]

finds missing numbers in a number sequence and formats a sequence the way nuke does it.

Parameters:

sequence

Returns:

cgl.core.list_dir.generate_sequence(sframe, eframe, remove_frames=0, padding=4)[source]

generates a sequence of files from a start frame to an end frame

cgl.core.list_dir.get_file_numbers(number_list, padding)[source]

formats a list of numbers as a sequence: 1-1000 1-10, 14-33, 44, 66-100

Parameters:

number_list

Returns:

cgl.core.list_dir.get_frame_numbers(file_list)[source]
cgl.core.list_dir.get_frame_range(file_list)[source]
cgl.core.list_dir.get_padding_string(padding)[source]
cgl.core.list_dir.list_dir(dir)[source]

lists all files in a directory

Parameters:

dir

cgl.core.list_dir.remove_elements(input_list, n)[source]

removes n random items from a list :param input_list: :param n: how many random items to remove

Returns:

list with n random items removed

cgl.core.lj_mail module

cgl.core.metadata module

cgl.core.metadata.get_meta_data2(filein, tool='exiftool', print_output=True)[source]

Due to issues with the exiftool module this is provided as a way to parse output directly from exiftool through the system commands and cglexecute. For the moment it’s only designed to get the metadata for a single file. :param filein: :param tool: :param print_output:

Returns:

dictionary containing metadata from exiftool

cgl.core.metadata.get_red_data(filein)[source]

method for pulling metadata from r3d files. REDLINE is a command line interface from RED that is required for this: https://www.red.com/downloads/options?itemInternalId=16144 :param filein:

Returns:

dictionary containing metadata from REDLINE

cgl.core.msd module

cgl.core.notes module

class cgl.core.notes.Notes(path_object: PathObject)[source]

Bases: object

addNote(originator, note)[source]

The function adds a note to a list of notes, including the originator, note content, and date.

Parameters:

originator – The originator parameter represents the user or entity who is adding the note. It

could be a username, user ID, or any other identifier that helps identify the originator of the note.

note: The “note” parameter is the content of the note that you want to add. It can be a string

or any other data type that represents the content of the note.

static create_from_path_object(path: PathObject)[source]
static create_from_path_string(path: str)[source]
load()[source]
save()[source]
cgl.core.notes.json_serial(obj)[source]

JSON serializer for objects not serializable by default json code

cgl.core.project module

cgl.core.read_bid module

cgl.core.review module

cgl.core.review.convert_NA_to_jpg(source_gif, dest_image, width=1920, height=1080)[source]

Converts anything oiiotool can’t handle to a jpg.

Currently, this applies to gifs and webp files or something :param source_gif: :param dest_image: :param width: :param height:

cgl.core.review.convert_doc_to_jpg(source_doc, dest_folder, dest_name, width=1920, height=1080)[source]

Converts a doc/docs to a jpg

Parameters:
  • source_doc

  • dest_folder

  • width

  • height

cgl.core.review.convert_exr_sequence_to_mp4(path_object, fps=24)[source]

converts an exr sequence into an mp4 file suitable for web previews

Parameters:
  • path_object

  • fps

Returns:

path to the mp4 file

cgl.core.review.convert_exr_to_hdr(source_exr)[source]

Converts an exr to an hdr file using oiiotool

cgl.core.review.convert_image_to_jpg(source_image, dest_image=None, width=1920, height=1080)[source]

Converts an image to JPG and resizes it using Pillow (PIL).

Parameters:
  • source_image (str) – Path to the source image.

  • dest_image (str, optional) – Output path. If None, auto-generates.

  • width (int) – Target width (default: 1920).

  • height (int) – Target height (default: 1080).

Returns:

Path to the converted JPG file.

Return type:

str

cgl.core.review.convert_jpg_sequence_to_mp4(source_sequence, start_frame=None, dest_mp4=None, wav_file=None, fps=24, width=1920, height=1080, force=True)[source]

converts a jpg sequence into an mp4 file suitable for web previews

Parameters:
  • source_sequence – source jpg sequence

  • start_frame – start frame of the sequence

  • dest_mp4 – destination mp4 file

  • wav_file – optional wav file to use for audio

  • fps – frame rate of the sequence

  • width – width of the output

  • height – height of the output

cgl.core.review.convert_mov_to_jpg(source_movie, dest_folder, dest_name, fps=24, width=1920, height=1080)[source]

Uses ffmpeg to convert a movie to a jpg :param source_movie: :param dest_name: :param fps: :param width: :param height:

Returns:

highest number

cgl.core.review.convert_movie_to_mp4(source_movie, dest_mp4=None, fps=24, source_audio=None, width='1920', height='1080')[source]

converts a movie into an mp4 file suitable for web previews

Parameters:
  • source_movie

  • dest_mp4

  • fps

  • width

  • height

Returns:

path to the mp4 file

cgl.core.review.convert_ppt_to_jpg(source_ppt, dest_folder, dest_name)[source]

Converts a ppt to a jpg

Parameters:
  • source_ppt

  • dest_folder

  • dest_name

Returns:

highest number

cgl.core.review.convert_single_jpg_to_mp4(source_jpg, start_frame=1, dest_mp4=None, fps=24, width=1920, height=1080)[source]

Converts a single jpg to an mp4 file suitable for web previews

Parameters:
  • source_jpg – source jpg file

  • start_frame – start frame of the sequence

  • dest_mp4 – destination mp4 file

  • fps – frame rate of the sequence

  • width – width of the output

  • height – height of the output

Returns:

path to the mp4 file

cgl.core.review.convert_to_wav(source_audio, dest_wav)[source]

use ffmpeg to convert an audio file to a wav file :param source_audio: :param dest_wav:

cgl.core.review.create_image_thumbnail(path_object, thumb_type='task')[source]
cgl.core.review.create_jpg_proxies(source_folder, dest_folder=None, filename=None)[source]

Creates a jpg proxy of each image_plane in the source folder :param source_folder: :param dest_folder: :return:

cgl.core.review.create_jpg_proxies_from_path_object(path_object: PathObject, all=True)[source]

Create jpg proxes from a PathObject().

cgl.core.review.create_movie_thumbnail(path_object, thumb_type='task', preview_ext='.mp4')[source]
cgl.core.review.create_proxy_mp4(path_object, fps=24, width=1920, height=1080)[source]

Creates a proxy mp4 for a given path object

Parameters:
  • path_object

  • fps

  • width

  • height

cgl.core.review.create_review_jpgs(path_object)[source]
cgl.core.review.create_review_mp4(path_object: str | PathObject)[source]

Creates a review mp4 from a path object, assumes that a jpg sequences is available.

cgl.core.review.create_thumbnail(path_object, thumb_type='task')[source]

Check if this is a movie or an image_plane if it’s a movie use create_thumbnail if it’s an image_plane use create_image_thumbnail :param path_object: :param thumb_type:

Returns:

cgl.core.review.find_frame_number(pattern_path)[source]

Replaces %04d in paths with the actual frame number found on disk. .. rubric:: Example

Input: “path/to/sequence.%04d.png” Output: “path/to/sequence.0001.png” (if 0001.png exists)

cgl.core.review.frame_from_timestamp(timestamp, fps)[source]

converts a timestamp to a frame number :param timestamp: :param fps:

Returns:

timestamp

cgl.core.review.get_highest_number(dest_folder, dest_name, ext='.jpg')[source]

gets all images in the folder and returns the highest number

Parameters:

dest_folder

Returns:

highest number

Raises:

IndexError – if no files are found

cgl.core.review.get_start_frame(dest_sequence)[source]

gets the start frame of the sequence

Parameters:

dest_sequence

Returns:

start frame

cgl.core.review.get_wave_file(path)[source]

Checks if a wav file exists in the same folder as a given path

Parameters:

path

Returns:

wav file if it exists otherwise None

cgl.core.review.movie_is_only_file(source_mov)[source]

Checks to see if the movie is the only file in the folder

Parameters:

source_mov

Returns:

True if the movie is the only file in the folder otherwise False

cgl.core.review.renumber_sequence(sequence, dest_folder, new_start_frame=1)[source]

renumbers a sequence to start at 1

Parameters:
  • sequence – sequence must have #### or %04d or other sequence delimiter in the name.

  • new_start_frame – the new start frame

cgl.core.review.timestamp_from_frame_number(frame_number, fps)[source]

converts a frame number to a timestamp :param frame_number: :param fps:

Returns:

frame number

cgl.core.screen_grab module

class cgl.core.screen_grab.ScreenCapture(parent=None, path_object=None, output=None)[source]

Bases: QDialog

A dialog for capturing a selected area of the screen.

get_rectangle()[source]

Returns the selected rectangle area.

classmethod grab_window()[source]

Launches the ScreenCapture dialog.

mouseMoveEvent(event)[source]

Repaints while moving the mouse.

mousePressEvent(event)[source]

Handles the mouse press event to start area selection.

mouseReleaseEvent(event)[source]

Handles the mouse release event to capture the selected area.

paintEvent(event)[source]

Custom paint event for drawing selection overlay.

set_screen_area()[source]

Sets the screen area to the total desktop size.

staticMetaObject = PySide6.QtCore.QMetaObject("ScreenCapture" inherits "QDialog": )
cgl.core.screen_grab.capture_area(rect, output_path)[source]

Captures the selected screen area, ensuring it works on multiple monitors.

Parameters:
  • rect (QRect) – The selected area to capture.

  • output_path (str) – File path to save the captured image_plane.

Returns:

The captured screen area as a QPixmap.

Return type:

QPixmap

cgl.core.screen_grab.run(path_object=None, output='thumb', parent=None)[source]

Runs the screen capture tool.

Parameters:
  • path_object (object, optional) – Path object.

  • output (str, optional) – Output file path.

  • parent (QWidget, optional) – Parent widget.

Returns:

The path to the saved screenshot.

Return type:

str

cgl.core.slow_task module

class cgl.core.slow_task.BackgroundExecutor(parent=None)[source]

Bases: QObject

complete
error
run(func, args, kwargs)[source]
staticMetaObject = PySide6.QtCore.QMetaObject("BackgroundExecutor" inherits "QObject": Methods:   #5 type=Signal, signature=complete(PyObject), parameters=PyObject   #6 type=Signal, signature=error(PyObject), parameters=PyObject   #7 type=Slot, signature=run(PyObject,PyObject,PyObject), parameters=PyObject, PyObject, PyObject )
class cgl.core.slow_task.ProgressDialog(message='Running...', parent=None)[source]

Bases: QDialog

closeEvent(self, arg__1: PySide6.QtGui.QCloseEvent) None[source]
close_threads()[source]
on_complete(result)[source]
on_error(error)[source]
run_func(func, args, kwargs)[source]
staticMetaObject = PySide6.QtCore.QMetaObject("ProgressDialog" inherits "QDialog": Methods:   #42 type=Signal, signature=submit(PyObject,PyObject,PyObject), parameters=PyObject, PyObject, PyObject   #43 type=Slot, signature=on_complete(PyObject), parameters=PyObject   #44 type=Slot, signature=on_error(PyObject), parameters=PyObject )
submit
cgl.core.slow_task.run_slow_background_task(message, func, *args, **kwargs)[source]

cgl.core.startup module

class cgl.core.startup.ThemeFileWatcher(theme_file)[source]

Bases: QFileSystemWatcher

reread_theme()[source]
staticMetaObject = PySide6.QtCore.QMetaObject("ThemeFileWatcher" inherits "QFileSystemWatcher": )
cgl.core.startup.do_freeze_fix()[source]
cgl.core.startup.do_gui_init()[source]
cgl.core.startup.do_maya_gui_init(gui)[source]
cgl.core.startup.do_nuke_gui_init(gui)[source]
cgl.core.startup.user_init(cfg=None)[source]

Initializes needed User information

Returns:

(project_management, user_info)

Return type:

tuple

Module contents