Skip to content

Instantly share code, notes, and snippets.

View darkvertex's full-sized avatar
👨‍🚀
Pipelines in spaaaaaaaaceeeee!!

Alan Fregtman darkvertex

👨‍🚀
Pipelines in spaaaaaaaaceeeee!!
  • Felix & Paul Studios
  • Montreal, Canada
  • 09:05 (UTC -04:00)
  • X @alanwritescode
View GitHub Profile
@darkvertex
darkvertex / basicExport.py
Created March 17, 2014 20:09
XSI-to-Maya cometSaveWeights export (snippet)
"""
Alan Fregtman's SaveCometWeights for XSI -- http://darkvertex.com/
(snippet edition -- v1.1)
** USAGE:
1. Select one or more enveloped meshes and run this from the script editor.
2. You will have the weights saved as "WEIGHTS__objectname.txt" in Comet's SaveWeights format
under the active XSI project directory.
3. In Maya, use Michael Comet's SaveWeights tool (melscript) to import the weights file.
@darkvertex
darkvertex / randomXSISelectionsExample.py
Created February 27, 2013 21:45
XSI Example: Random Component or Object Selections
from win32com.client import constants as c
import random
xsi = Application
XSIDialog = XSIFactory.CreateObject("XSIDial.XSIDialog")
def get_random_percentage(iterable, percentage):
amount = int( float(len(iterable)) * (percentage/100.0) )
return random.sample(iterable, amount)
@darkvertex
darkvertex / evenCurves.py
Created March 26, 2013 21:34
Evenly distributed points on a Softimage curve
si = Application
def frange(x, y, jump):
'''
Like range() but with float values.
'''
while x < y:
yield x
x += jump
@darkvertex
darkvertex / gatormulti.py
Last active December 16, 2015 11:29
gator for multiple objects
xsi = Application
selected = xsi.Selection
sourceMesh = xsi.PickObject("Pick source (enveloped) mesh", "Pick source (enveloped) mesh")("PickedElement")
if sourceMesh:
freezeMe = []
for targetMesh in selected:
if targetMesh.Envelopes.Count > 0:
xsi.RemoveFlexEnv(targetMesh)
@darkvertex
darkvertex / purgeUnused.py
Created April 21, 2013 02:29
purge unused deformers
from time import clock
xsi = Application
def purgeUnusedDeformers(inColl):
c = clock()
for o in inColl:
if o.Envelopes.Count > 0:
env = o.Envelopes(0)
d = env.Deformers
/* So how does this work?
I'm using ANSI escape sequences to control the behavior of the terminal while
cat is outputting the text. I deliberately place these control sequences inside
comments so the C++ compiler doesn't try to treat them as code.*/
//
/*The commands in the fake code comment move the cursor to the left edge and
clear out the line, allowing the fake code to take the place of the real code.
And this explanation uses similar commands to wipe itself out too. */
//
#include <cstdio>
@darkvertex
darkvertex / Earthfile
Created March 9, 2022 15:35
Example of using Earthly for compiling Python for CentOS via pyenv
# Super easy Python compiler using Earthly.
# (See https://earthly.dev to learn more about the syntax. Docker & Earthly required.)
#
# Arguments:
# --pyver=<version> (Python version to compile. *REQUIRED*)
# --centos_ver=<version> (CentOS version to compile under. Defaults to "7".)
# --pyenv_root=<path> (Path to the Python environment. Optional. Recommendation is to match your current compilation root path.)
#
# For example, run me like this:
# > earthly +pythonwithpip --pyver=2.7.18