Skip to content

Instantly share code, notes, and snippets.

View rondreas's full-sized avatar

Andreas Rånman rondreas

View GitHub Profile
@rondreas
rondreas / list_notifiers.py
Created February 2, 2022 12:55
Iterate over all notifiers and get their arguments
import lx
notify_system = lx.service.NotifySys()
for i in range(notify_system.Count()):
notifier = notify_system.ByIndex(i) # get the lx.object.Notifier
name = notify_system.NameByIndex(i) # get the str name for the Nofifier
# attempt getting arguments for the notifier,
try:
@rondreas
rondreas / build.bat
Created December 14, 2021 12:45
Thank you handmade hero for making it easier to compile stuff
@echo off
REM adds cl.exe to path
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" x64
REM Set current dir to folder of this script
pushd %~dp0
REM Then create and cd into build folder
mkdir build
# python
import lx
from P4 import P4
from P4 import Progress
from P4 import P4Exception
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 / check_ubx.py
Created June 17, 2021 15:16
Check if mesh is a cube that would be accepted as a unreal collision volume
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 / xformMirror.py
Last active June 8, 2021 21:49
Script to mirror transform similar to Maya's Joint Mirror Tool.
import pymel.core as pm
def xformMirror(transforms=[], across='YZ', behaviour=True):
""" Mirrors transform across hyperplane.
transforms -- list of Transform or string.
across -- plane which to mirror across.
behaviour -- bool
"""
@rondreas
rondreas / Hello.cpp
Created May 4, 2021 14:18
Hello world for Modo
#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 / 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