This file contains hidden or 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
/* ensure array is contiguous, aligned and correct data type */ | |
array = PyArray_FROM_OTF(input_array, NPY_FLOAT32, NPY_CARRAY_RO); | |
/* reshape the input array to the correct dimensions */ | |
PyArray_Dims dims; | |
npy_intp shape[2] = {-1, attr.count}; | |
dims.len = 2; | |
dims.ptr = shape; | |
array = PyArray_Newshape((PyArrayObject *)array, &dims, NPY_CORDER); |
This file contains hidden or 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 partio | |
import numpy as np | |
p = partio.create() | |
size = 3 | |
posattr = p.addAttribute("pos",partio.FLOAT,size) | |
for i in range(8): | |
p.addParticle() | |
data = tuple(i+j*100 for j in range(size)) | |
p.set(posattr, i, data) |
This file contains hidden or 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
%feature("autodoc"); | |
%feature("docstring","Gets a single flattened tuple, containing attribute data for all particles"); | |
PyObject* getTuple(const ParticleAttribute& attr) | |
{ | |
unsigned int numparticles = $self->numParticles(); | |
PyObject* tuple=PyTuple_New(numparticles * attr.count); | |
if(attr.type==Partio::INT){ | |
for(unsigned int i=0;i<numparticles;i++) { |
This file contains hidden or 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
// http://soup-dev.websitetoolbox.com/post/curl-noise-for-maya-5937312 | |
pickWalk -d down; | |
string $part[] = `ls -sl`; | |
addAttr -ln "noiseFrequency" -at double3 $part[0]; | |
addAttr -ln "noiseFrequencyX" -at double -p noiseFrequency $part[0]; | |
addAttr -ln "noiseFrequencyY" -at double -p noiseFrequency $part[0]; | |
addAttr -ln "noiseFrequencyZ" -at double -p noiseFrequency $part[0]; | |
setAttr -type double3 ($part[0] + ".noiseFrequency") 0.4 0.4 0.4; | |
setAttr -e-keyable true ($part[0] + ".noiseFrequency"); |
This file contains hidden or 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
if hou.updateModeSetting() == hou.updateMode.Manual: | |
hou.setUpdateMode(hou.updateMode.AutoUpdate) | |
elif hou.updateModeSetting() == hou.updateMode.AutoUpdate: | |
hou.setUpdateMode(hou.updateMode.Manual) |
This file contains hidden or 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
selpath = hou.hscriptExpression('mousepath()').split('.')[-1] | |
voppath = '/'.join( selpath.split('/')[:-1] ) | |
node = hou.node(voppath) | |
retval, aname = hou.ui.readInput("Attribute Name", buttons=('OK',)) | |
if retval != -1: | |
add = node.createNode('addattrib') | |
add.setName("add_%s"%aname) | |
add.parm('attrib').set(aname) |
This file contains hidden or 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
int i, steps = 80; | |
float sumhist[], sum=0, slice = 1.0/float(steps); | |
seed += 123456789; | |
for (i=0;i<steps;i++) { | |
float pos = (i*slice); | |
float val = chramp("__rndweight", pos); | |
sum += val; | |
push(sumhist, sum); | |
} |
This file contains hidden or 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
float theta = -$PI * x; | |
float phi = $PI * 0.5 * y; | |
float sin_theta = sin(theta); | |
float cos_theta = cos(theta); | |
float sin_phi = sin(phi); | |
float cos_phi = cos(phi); | |
i.z = sin_theta * cos_phi; | |
i.y = sin_phi; |
This file contains hidden or 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
#pragma opname fisheyelens | |
#pragma oplabel "Fisheye Lens" | |
#pragma hint x hidden | |
#pragma hint y hidden | |
#pragma hint Time hidden | |
#pragma hint dofx hidden | |
#pragma hint dofy hidden | |
#pragma hint aspect hidden | |
#pragma hint P hidden |
This file contains hidden or 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
struct Light { | |
float intensity; | |
vec3 colour; | |
vec3 pa; | |
vec3 pb; | |
float w; | |
vec3 L; | |
vec3 nL; | |
}; |
OlderNewer