Skip to content

Instantly share code, notes, and snippets.

View JokerMartini's full-sized avatar
😀

John Martini JokerMartini

😀
View GitHub Profile
@JokerMartini
JokerMartini / Resize Images and Save New Format | .py
Last active July 5, 2017 14:19
Nuke: This snippet of code takes all read nodes within a given Nuke comp and resizes the images and then saves them out to either png or jpeg.
#import a python module so we can do the search&replace stuff
import re
import os
#select all nodes in the root graph
nuke.selectAll()
############# variables
writeNodeList = [];
imgType = "png" # use either 'png' / 'jpeg'
@JokerMartini
JokerMartini / Offset object along vector | .ms
Last active July 5, 2017 14:19
Maxscript: Places object along vector at specified distance
fn GenPos posA posB offset: = (posB-(normalize (posB-posA))*offset)
delete objects
inset = 10
ptStart = [100,75,0]
ptEnd = [250,175,10]
p1 = point pos:ptStart size:5 wirecolor:green cross:true box:false
p2 = point pos:ptEnd size:5 wirecolor:green cross:true box:false
@JokerMartini
JokerMartini / Desktop Notification | .ms
Last active June 3, 2021 00:11
Maxscript: Send a simple desktop notification similar to skype, from 3ds Max to the desktop. When users click on the balloon notification, in this example, it will open a windows explorer.
fn closeIcon s e = s.dispose()
fn balloonClicked s e = shelllaunch @"c:\windows\" ""
a = dotnetobject "notifyicon"
a.visible = true
a.icon = (dotnetclass "system.drawing.systemIcons").information
dotnet.addEventHandler a "BalloonTipClosed" closeIcon
dotnet.addEventHandler a "BalloonTipClicked" balloonClicked
a.showballoontip 1000 "test" "test2" (dotnetclass "tooltipicon").info
@JokerMartini
JokerMartini / Set Last In Focus Window To Foreground | .cs
Last active July 5, 2017 14:19
C#: Get last in focus windows application by name and bring to the foreground
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
@JokerMartini
JokerMartini / Solid Fragment Shader | .gs
Last active May 14, 2021 23:30
GLSL Shader: A simple solid color shader
void main()
{
gl_FragColor = vec4(1.0,0.5,0.5,.5);
}
@JokerMartini
JokerMartini / Color Transition | .ms
Last active July 5, 2017 14:20
Maxscript: Color transition from one color to another maintaining specified color gradation.
try(destroyDialog ::progressTest)catch()
rollout progressTest "Progress Test"
(
button doit "Process Scene" -- button to start processing
spinner spnSelectAmount fieldwidth:96 range:[0,512,0] type:#integer
progressbar pb color:red -- a red progress bar
on doit pressed do -- when the button is pressed...
(
objArray = geometry as array -- get all geometry objects into array
@JokerMartini
JokerMartini / Shuffle Array Indices | .ms
Last active July 5, 2017 14:20
Maxscript: Shuffles the array returning an array of shuffled indices based on the supplied count.
fn ShuffleIndexes count =
(
list = #()
list.count = count
for k = 1 to count do
(
i = random 1 k
list[k] = list[i]
list[i] = k
)
@JokerMartini
JokerMartini / Randomize Array Items | .ms
Last active July 5, 2017 14:20
Maxscript: Randomize Array returns an array of shuffled items
oldarray=#("One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten")
fn RandomizeArray arr:#() =
(
local list = #()
while arr.count != 0 do
(
id = random 1 arr.count
append list arr[id]
deleteItem arr id