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
local x = Point(1, 2) | |
for key, value in pairs(getmetatable(x)) do | |
print(key, value) | |
end | |
print(x + Point(3, 4)) | |
print(x * 5) |
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
local dlg = Dialog { title = "Alt Hotkeys" } | |
dlg:button { | |
id = "a", | |
text = "&ABC", | |
onclick = function() | |
app.alert("A") | |
end | |
} |
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 bpy | |
import math | |
from mathutils import Vector | |
grease_data = bpy.data.grease_pencils.new("Stroke") | |
grease_layers = grease_data.layers | |
active_layer = grease_layers.new("Layer") | |
grease_frames = active_layer.frames | |
active_frame = grease_frames.new( | |
bpy.context.scene.frame_current, |
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 bpy | |
from mathutils import Vector | |
cam_data = bpy.data.cameras.new("Camera") | |
cam_data.type = 'ORTHO' | |
cam_data.ortho_scale = 4.0 | |
cam_obj = bpy.data.objects.new(cam_data.name, cam_data) | |
cam_obj.location = (10.0, 10.0, 5.0) |
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
shader closureExample( | |
normal Normal = N, | |
float DiffuseRoughness = 0.01, | |
color DiffuseColor = 0.0, | |
float GlassRoughness = 0.125, | |
float GlassIor = 1.45, | |
float GlassReflectivity = 0.125, | |
color GlassColor = 1.0, |
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
float zigzag(float t) { | |
float a = t * 0.5; | |
float b = a - floor(a); | |
return 1.0 - abs(b + b - 1.0); | |
} | |
float oscillate(float t) { | |
return 0.5 + 0.5 * sin(M_PI * (t - 0.5)); | |
} |
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
shader modScalar( | |
float A = 0.0, | |
float B = 1.0, | |
output float Mod = 0.0) { | |
Mod = mod(A, B); | |
} |
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
shader fractScalar( | |
float A = 0.0, | |
output float Fract = 0.0, | |
output int Trunc = 0.0, | |
output float Floor = 1.0) { | |
Trunc = trunc(A); | |
Fract = A - Trunc; | |
Floor = 1.0 - Fract; |
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
shader mixLab( | |
color A = 0.0, | |
color B = 1.0, | |
float T = 0.5, | |
color LB = 0.0, | |
color UB = 1.0, | |
output color Color = 0.5) { | |
color aLinear = sRgbTolRgb(A); |
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
vector xyzToLab(vector xyz) { | |
float vx = xyz[0] / 0.95047; | |
float vy = xyz[1]; | |
float vz = xyz[2] / 1.08883; | |
vx = select(7.787 * vx + 16.0 / 116.0, pow(vx, 1.0 / 3.0), vx > 0.008856); | |
vy = select(7.787 * vy + 16.0 / 116.0, pow(vy, 1.0 / 3.0), vy > 0.008856); | |
vz = select(7.787 * vz + 16.0 / 116.0, pow(vz, 1.0 / 3.0), vz > 0.008856); | |
return vector( |