Skip to content

Instantly share code, notes, and snippets.

@rondreas
rondreas / check_ubx.py
Created Jun 17, 2021
Check if mesh is a cube that would be accepted as a unreal collision volume
View check_ubx.py
import lx
import lxu
import modo
from math import isclose
mesh, = modo.Scene().selectedByType('mesh')
result = set()
with mesh.geometry as geo:
normals = set()
@rondreas
rondreas / sheet_conflict.py
Created May 24, 2021
Had issue where some artists had copied configs from another machine and ui elements would just be gone or they'd suffer constant crashes. Figured it could be conflicts in their configs so threw this one together and seems to have solved our issues.
View sheet_conflict.py
import xml.etree.ElementTree as ET
import os
platform = lx.service.Platform()
configs = set() # all unique paths to config files
for i in range(platform.ImportPathCount()):
directory = platform.ImportPathByIndex(i)
for filename in os.listdir(directory):
@rondreas
rondreas / Hello.cpp
Created May 4, 2021
Hello world for Modo
View Hello.cpp
#include <lx_log.hpp>
#include <lxu_log.hpp>
#include <lxu_command.hpp>
#define SRVNAME_COMMAND "hello.world"
class CHelloCommand : public CLxCommand
{
public:
CLxUser_LogService log_service;
@rondreas
rondreas / unreal_menu.py
Created Apr 1, 2021
Example of extending a menu in Unreal using Python
View unreal_menu.py
"""
Example of extending a menu in Unreal using Python
"""
import unreal
def main():
@rondreas
rondreas / pix_rt_dump.py
Created Apr 1, 2021
read a file with render thread data as csv from pix and print out function names and times function was called.
View pix_rt_dump.py
"""
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 Apr 1, 2021
Tool to get a quick overview of number of files and lines of text
View line_count.py
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"
)
View modo_selection_mode.py
# python
import lx
def get_selection_mode():
""" Get the current selection mode
:rtype: int
@rondreas
rondreas / ue_timer.py
Created Mar 15, 2021
Example of Timer in Unreal
View ue_timer.py
"""
Start a timer to call the function "hey" every half second.
Have yet to figure out how to kill this...
"""
import unreal
View modo_perforce_progress.py
# python
import lx
from P4 import P4
from P4 import Progress
from P4 import P4Exception
@rondreas
rondreas / modo_monitor_example.py
Created Mar 2, 2021
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.
View modo_monitor_example.py
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.