Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rondreas's full-sized avatar

Andreas Rånman rondreas

View GitHub Profile
@rondreas
rondreas / unreal_menu.py
Created April 1, 2021 08:08
Example of extending a menu in Unreal using Python
"""
Example of extending a menu in Unreal using Python
"""
import unreal
def main():
@rondreas
rondreas / pix_rt_dump.py
Created April 1, 2021 07:40
read a file with render thread data as csv from pix and print out function names and times function was called.
"""
Given a flat list copy pasted as csv from PIX Timing capture, list unique names
"""
def main():
names = list()
with open("renderthread_dump.csv", 'r') as f:
@rondreas
rondreas / line_count.py
Created April 1, 2021 07:35
Tool to get a quick overview of number of files and lines of text
import os
import sys
import re
import argparse
def main():
parser = argparse.ArgumentParser(
description="Tool to get a quick overview of number of files and lines of text"
)
# python
import lx
def get_selection_mode():
""" Get the current selection mode
:rtype: int
@rondreas
rondreas / ue_timer.py
Created March 15, 2021 20:14
Example of Timer in Unreal
"""
Start a timer to call the function "hey" every half second.
Have yet to figure out how to kill this...
"""
import unreal
# python
import lx
from P4 import P4
from P4 import Progress
from P4 import P4Exception
@rondreas
rondreas / modo_monitor_example.py
Created March 2, 2021 08:09
Experimented with implementing a progress bar for longer tasks in Modo, didn't quite get it to work due to focus being stolen from rendering.
import lx
from time import sleep
SECONDS = 15
# Initialize the monitor object, ie progress bar.
monitor = lx.Monitor()
monitor.init(SECONDS)
# Mimic a long operation that users might want to stop.
import unreal
@unreal.uclass()
class OnAssetPostImportAction(unreal.EditorUtilityObject):
@unreal.ufunction(override=True)
def run(self):
""" Add a callable static function to be called whenever an asset is
imported.
@rondreas
rondreas / restore_defaults.py
Created April 15, 2020 09:59
Fire and forget script to parse and restore a kits default configuration.
# python
# -*- coding: utf-8 -*-
"""
Fire and forget script to parse and restore a kits default configuration.
>>> @restore_defaults.py myKit
"""
@rondreas
rondreas / ue_spawn_blutility.py
Created March 12, 2020 10:55
Open the Widget for a Blueprint Widget Utility
"""
Open the Widget for a Blueprint Widget Utility
"""
import unreal
def main():