Skip to content

Instantly share code, notes, and snippets.

View rBrenick's full-sized avatar

rBrenick

View GitHub Profile
@rBrenick
rBrenick / split_subtitle_file_into_multiline.py
Last active September 12, 2024 23:32
Take an .srt file and split the text line if the character count goes above a certain threshold.
import sys
import argparse
"""
Example usecase:
python split_srt_lines.py SUBTITLE_FILE_PATH.srt -o OUTPUT_FILE_PATH.srt --max_line_length=42 --comma_split_percent=75
if you don't specify an output path, it will replace the file content of the input file
@rBrenick
rBrenick / searchable_combo_box.py
Last active September 4, 2022 16:53
Quick function to make a QComboBox into a searchable list
__author__ = "[email protected]"
__created__ = "2022-09-03"
"""
This is mostly a recreation of this stack overflow answer: https://stackoverflow.com/a/65408354
With some changes to make it callable after initialization.
"""
from PySide2 import QtCore, QtWidgets
@rBrenick
rBrenick / maya_progress_bar.py
Last active August 20, 2022 10:57
progress bar convenience class for Maya
__author__ = "[email protected]"
__created__ = "2022-08-11"
from maya import cmds
class ProgressBar(object):
"""
Convenience class for showing a progress bar in Maya
@rBrenick
rBrenick / fancy_separate.py
Created June 30, 2022 19:19
Maya script for a combined Separate/Extract
"""
FancySeparate by Richard Brenick
(written for JKeys)
A combined Separate/Extract script.
Also does some clean up of groups created by seperate function.
"""
import maya.cmds as cmds
import maya.mel as mel
@rBrenick
rBrenick / generate_lowres_textures.py
Created March 11, 2022 09:20
Find all textures in the maya scene, and create a low res proxy using Qt
import os
import pymel.core as pm
import json
from PySide2 import QtCore, QtGui
def generate_lowres_textures(output_textures_folder, new_size=1024):
"""
generate lowres textures from those found in the maya scene
"""
generated_texture_paths = []
@rBrenick
rBrenick / custom_right_click_start_end_frame.py
Last active November 23, 2021 23:08
Adds a custom context menu to start and end frame selectors. So you can easily set the start/end frame without typing. NOTE: Might break on large layout refreshes of Maya UI elements (like a layout load)
__author__ = "[email protected]"
import sys
from functools import partial
from maya import mel
from maya import cmds
from maya import OpenMayaUI as omui
from PySide2 import QtCore, QtWidgets, QtGui
from shiboken2 import wrapInstance
@rBrenick
rBrenick / split_unreal_stubs.py
Last active November 29, 2021 14:41
Quick script to split a big unreal.py stubs file into multiple smaller ones
# quick script to split a big unreal.py stubs file into multiple smaller ones
# for use as autocompletion in PyCharm (without having to increase the memory allocation)
__author__ = "[email protected]"
__version__ = "1"
import os
# path to unreal stubs
unreal_stubs_src_path = r"YOUR_PROJECT_HERE\Intermediate\PythonStub\unreal.py"
@rBrenick
rBrenick / preview_atom_parser.py
Last active October 27, 2021 01:04
Manual python parsing of an .atom file and extracting attribute information
from maya import cmds
class ReturnCode:
anim_layer_found = "anim_layer_found"
def preview_frame_from_atom(atom_path, preview_first_frame=True):
"""
Manual parse through the .atom file and figure out what a frame looks like
@rBrenick
rBrenick / connect_skeleton_to_ik_rig.py
Last active June 8, 2023 08:10
Maya script that connects up a skeleton to IKRig
import pymel.core as pm
# This is a script that connects one of the rigs from Maya's Content Browser to the IKRig from https://github.com/chadmv/cmt
base_ik_rig_list = [
"IKRig_Root",
"IKRig_Hips",
"IKRig_Chest",
"IKRig_Neck",
"IKRig_Head",
__author__ = "Richard Brenick - [email protected]"
__created__ = "2020-09-05"
__license__ = "MIT License"
import os
from Qt import QtCore, QtWidgets
class QtFilePath(QtWidgets.QWidget):