Skip to content

Instantly share code, notes, and snippets.

@ivogrig
ivogrig / CmdSetMeshInstance.py
Created June 10, 2015 14:08
Sets a new source mesh to a mesh instance, by manipulating the 'meshInst' and 'source' graphs.
################################################################################
#
# SetMeshInstance.py
#
# Version: 0.1
#
# Author: Ivo Grigull
#
# Last Update: 10/06/2015
#
@ivogrig
ivogrig / Monitor example
Created June 23, 2015 09:26
Modo Monitor example
import time
import lx
dialog_svc = lx.service.StdDialog()
# Allocate monitor
mon = lx.object.Monitor(dialog_svc.MonitorAllocate('Calculating Center Of Mass ...'))
steps = 50
@ivogrig
ivogrig / ImagePixel.py
Last active August 3, 2020 11:37
Loading an image clip and reading a pixel
import lxu
import lxu.select
def loadImage(filepath, width, height):
'''
Loads an image as clip and returns it's image interface object.
'''
if not os.path.exists(filepath):
raise AttributeError("Path does not exist")
@ivogrig
ivogrig / aimRotation.py
Last active March 27, 2022 04:15
Example method for turning a direction vector into an euler rotation (TD SDK)
# python
#
# Example method for turning a direction vector into an euler rotation
#
# There is a similar example using the API for this by Lukasz Pazera: https://gist.github.com/lukpazera/5994547
# This function really does the same, using the mathutils of the TD SDK
import modo
import math