This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
si = Application | |
def frange(x, y, jump): | |
''' | |
Like range() but with float values. | |
''' | |
while x < y: | |
yield x | |
x += jump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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.*/ | |
//[2K[2D[A[2K[A[2K[A[2K[A[2K[A | |
/*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. */ | |
//[2K[2D[A[2K[A[2K[A[2K[A | |
#include <cstdio> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |