Instantly share code, notes, and snippets.

🐝

# Chris Sprance csprance

🐝
Created October 24, 2021 04:49
A modo script to select verts whose selected weight maps fall within a given range. To use Select a mesh and then select a weight map. Then specify a min and a max value for the range
View select_by_weight.py
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
 import lx import lxu import modo import sys def get_selected_weight_maps(): """ Get the selected weight maps from the scene :return: List of selected weight maps
Created February 9, 2021 01:53
How to calculate barycentric coordinates in houdini using vex given 3 points making up a triangle and a point p we want to get the coordinates for
View barycentric_coordinates.c
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
 // This is the point we want to find barycentric coordinates of vector p = point(0, "P", 3); // These are the vertices of the main triangle we want to find coordinates for vector v1 = point(0, "P", 0), v2 = point(0, "P", 1), v3 = point(0, "P", 2); // Edge Vectors of the main triangle vector e1 = v3 - v2,
Last active March 26, 2020 03:27
Given a set of control points create a bezier curve with n amount of points
View bezier_from_control_points.py
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
 def binomial(i, n): """Binomial coefficient""" return math.factorial(n) / float( math.factorial(i) * math.factorial(n - i)) def bernstein(t, i, n): """Bernstein polynom""" return binomial(i, n) * (t ** i) * ((1 - t) ** (n - i))
Created March 4, 2020 16:24
Given a selected node create a merge node that references that node under the mouse curor.
View CreateMergeNodeFromSelectedNode.py
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
 (node,) = hou.selectedNodes() node.setColor(hou.Color(.302, .525, .114)) parent = node.parent() merge = parent.createNode('object_merge', '%s_MERGE' % node.name().upper()) merge.setPosition(hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor).cursorPosition()) merge.parm('objpath1').set(merge.relativePathTo(node)) merge.setColor(hou.Color(.475,.812,.204))
Created December 19, 2019 14:31
Houdini - How to set multiparm defaults.
View set_multi_parm_defaults.py
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
 lod_presets = [100, 50, 25, 12, 6] def set_hda_defaults(hda): hda.parm("lod_levels").set(5) # if we have a classname detail attrib use that class_name = hda.geometry(0).findGlobalAttrib("classname") if class_name: hda.parm("sopoutput").set("\$HIP/`chs('./base_name')`.fbx") hda.parm("base_name").set(class_name.strings()[0])
Last active September 25, 2019 21:55
Make Line material Function
View MF_Line
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
 Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_0" Begin Object Class=/Script/Engine.MaterialExpressionFunctionOutput Name="MaterialExpressionFunctionOutput_0" End Object Begin Object Name="MaterialExpressionFunctionOutput_0" A=(Expression=MaterialExpressionMultiply'"MaterialGraphNode_21.MaterialExpressionMultiply_2"') bLastPreviewed=True Id=5339DC564EC32B27BB306AB9FBBFEDDA MaterialExpressionEditorX=240 MaterialExpressionEditorY=224 MaterialExpressionGuid=AE145484490C27D4D65D5C8676E814EA
Created May 22, 2019 15:52
More Map Data Functions in FlowType Javascript
View mapUtils.js
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
 // @flow /** * Name: mapUtils * Created by chris on 4/22/2017. * Description: */ import React from 'react'; import ReactDOMServer from 'react-dom/server'; import PlaceIcon from 'material-ui/svg-icons/maps/place'; import _ from 'lodash';
Last active May 9, 2019 16:30
GDAL2Tiles Instructions
View Gdal2Tiles.md
Last active April 6, 2023 16:59
VEX Snippets for Houdini
View Snippets.md
```// Detail Wrangle
vector bbsize = getbbox_size(0);
v@size = bbsize; // For reference

s@x = sprintf('%.3f', bbsize.x);
s@y = sprintf('%.3f', bbsize.y);
s@z = sprintf('%.3f', bbsize.z);```
Last active November 20, 2022 00:16
Chris Sprance - Technical Artist - Resume
View CSprance_Resume.md