Skip to content

Instantly share code, notes, and snippets.

@Farfarer
Farfarer / getSetSceneTag.py
Created October 5, 2016 16:21
Set and get the value of a tag that's stored with the scene in MODO.
# !/usr/bin/env python
import lx
import lxu
import lxu.select
def setSceneTag (tagID, tagValue)
if isinstance (tagID, basestring):
if len (tagID) != 4:
lx.out('Tag ID must be 4 characters long!')
@Farfarer
Farfarer / deleteNamelessVMaps.py
Created July 15, 2016 10:16
Install to "lxserv" directory in your script directory. Restart MODO. Use it by calling the command "ffr.deleteNamelessVMaps".
#!/usr/bin/env python
import lx
import lxifc
import lxu.command
class DeleteMaps (lxifc.Visitor):
def __init__ (self, meshmap):
self.meshmap = meshmap
@Farfarer
Farfarer / combineVMaps.py
Created July 13, 2016 17:16
Install to "lxserv" directory in your script directory. Restart MODO. Use it by calling the command "ffr.combinevmaps"
#!/usr/bin/env python
import lx
import lxifc
import lxu.command
import lxu.select
default_type = 'weight'
default_source_name = 'Weight'
default_target_name = 'Weight'
@Farfarer
Farfarer / createBBOX.py
Created July 13, 2016 08:46
AABB and AACyl creation for MODO.
#!/usr/bin/env python
# Uses Smallest Enclosing Circle code which is:
# Copyright (c) 2014 Nayuki Minase
# http://nayuki.eigenstate.org/page/smallest-enclosing-circle
import lx
import lxifc
import lxu.command
import lxu.select
@Farfarer
Farfarer / Cable.cs
Created July 5, 2016 15:45
Catenary curves in Unity. Creates a catenary curve between two points with a given amount of slack. http://farfarer.com/temp/unity_cables.png
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.EventSystems;
[System.Serializable]
public class CableCurve {
[SerializeField]
Vector3 m_start;
#!/usr/bin/env python
import lx
import lxifc
import lxu.command
class DeleteMaps (lxifc.Visitor):
def __init__ (self, meshmap):
self.meshmap = meshmap
#!/usr/bin/env python
# Transfer the selected weight maps from the primary (first selected) mesh to all other active (selected) meshes (map is created if required).
# Transfer happens via vertex index, if the two meshes have different vertex counts nothing will happen.
# If no weight maps are selected, all are transferred.
# Optional target map argument will cause the first selected weight map found on the primary mesh to be transferred to a weight map of the given name on the active mesh (map is created on the active mesh if required).
# NOTE: With the optional map argument given, only one map will be transferred.
import lx
import lxifc
#!/usr/bin/env python
import lx
import lxu
import lxifc
import lxu.command
class ListUVMaps (lxifc.Visitor):
def __init__ (self, meshmap):
self.meshmap = meshmap
@Farfarer
Farfarer / xNormalHelpers.py
Created January 5, 2015 10:09
Just a few helper bits for xNormal/python.
#!/usr/bin/env python
import lx
import subprocess
import os
# Paths for xNormal.
path_xnormal_basedir = r'C:\Program Files\Santiago Orgaz'
path_xnormal_exedir = r'\x64\xNormal.exe'
path_xnormal = r'C:\Program Files\Santiago Orgaz\xNormal 3.18.9\x64\xNormal.exe'
import math
# Given a matrix, return euler angles of rotation as (X,Y,Z) in radians.
# Matrix is assumed to be either a lx.object.Matrix or a list[3][3] of floats.
def matrixToEuler (matrix, rotOrder):
if type(matrix) != list:
m = matrix.Get3 ()
else:
m = matrix