Extracted from the resources page at dirtywave.com.
- [DIRECTION] Move the cursor on the screen.
- [SHIFT]+[DIRECTION] Navigate between Views
- [EDIT] Start editing a value; also functions as a “YES” or “ENTER”
import Foundation | |
// Diff values for better test assertions. | |
// | |
// Enums and collections left as an exercise for the reader. | |
// A difference between two values | |
struct Difference: CustomStringConvertible { | |
let path: String | |
let actual: String |
Extracted from the resources page at dirtywave.com.
import collections, random, sys, textwrap | |
# Build possibles table indexed by pair of prefix words (w1, w2) | |
w1 = w2 = '' | |
possibles = collections.defaultdict(list) | |
for line in sys.stdin: | |
for word in line.split(): | |
possibles[w1, w2].append(word) | |
w1, w2 = w2, word |
/// <summary> | |
/// A Timer that execute an async callback after a due time and repeating it after a period (interval). | |
/// Callback is a non reentrant timer (ie. callbacks never overlaps). Dispose method wait for the current callback to finish. | |
/// Timer can be cancelled using a CancellationToken or by calling StopAsync or by calling Dispose. | |
/// Exception inside callbacks are ignored and just traced. | |
/// Callback is invoked at each interval (period) after the end of the previous invocation. | |
/// </summary> | |
public sealed class TimerAsync : IDisposable | |
{ | |
private readonly Func<CancellationToken, Task> _callback; |
# Get all nodes of type Read | |
readnodes = nuke.allNodes('Read') | |
for readnode in readnodes: | |
print readnode | |
# List all knobs for selected node | |
print( nuke.toNode('Read1') ) | |
# List all knobs for specific node | |
print( nuke.selectedNode() ) |
import alembic | |
def any_shapes_in_alembic(filename): | |
"""Return whether Alembic file contains any shape/geometry. | |
Arguments: | |
filename (str): Full path to Alembic archive to read. | |
Returns: | |
bool: Whether Alembic file contains geometry. |
public class Perlin { | |
public int repeat; | |
public Perlin(int repeat = -1) { | |
this.repeat = repeat; | |
} | |
public double OctavePerlin(double x, double y, double z, int octaves, double persistence) { | |
double total = 0; |
// Align object to target vector base on selected normal | |
// Useful when object has some weird orientation baked | |
// in the mesh and you wan to straighten it up. | |
// Point with normal from second wrangler input to align | |
vector from = point(1, 'N', 0); | |
// Allign "from" normal to the following vector | |
vector to = {0,1,0}; |
/* | |
updated 2018-04-28 | |
source lives here: https://gist.github.com/nicobrx/2ecd6fc9ca733dcd883afebba5cf200e | |
standalone script ID for use as a library: 1gZ78JObyrYiH0njoZ86fQ2NgMwavUgiXVhRDrIFetPZL256e31PSNiHq | |
Functions included here: | |
Sheets data array and object functions | |
objectifySheet(sheet,propertyNames,newPropertyNames) - Takes a sheet with a header row and converts it into an array of objects | |
arrayFromSheet(sheet,propertyNames,newPropertyNames) - creates an array from a sheet, can specify column headers |
// Resample into segments of random length | |
// Run over primitives | |
float seed = chf("seed"); | |
float seg_len_min = chi("seg_len_min"); | |
float seg_len_max = chi("seg_len_max"); | |
float seg_padding = chf("padding"); | |
if (seg_len_min <= 0 || seg_len_max < seg_len_min || seg_padding < 0) { | |
error("Make sure 0 < seg_len_min <= seg_len_max and 0 <= seg_padding"); |