Skip to content

Instantly share code, notes, and snippets.

View masqu3rad3's full-sized avatar

Arda Kutlu masqu3rad3

View GitHub Profile
@masqu3rad3
masqu3rad3 / compund_vs_split_benchmark_maya.py
Created January 21, 2026 14:05
Benchmark for comparing compund versus split connections
import maya.cmds as cmds
import time
import random
import gc
# ---------------------------------------------------------------------
# CONFIGURATION
# ---------------------------------------------------------------------
CHAIN_LENGTH = 4000 # Depth of the chain.
# NOTE: "Atomic" test will create CHAIN_LENGTH * 3 nodes.
@masqu3rad3
masqu3rad3 / sqrt_benchmark_maya.py
Created January 21, 2026 14:02
benchmark for square root calculations with different nodes in Maya.
import maya.cmds as cmds
import time
import random
import gc
# ---------------------------------------------------------------------
# CONFIGURATION
# ---------------------------------------------------------------------
ITERATIONS = 1000
START_FRAME = 0
@masqu3rad3
masqu3rad3 / add_benchmark_maya.py
Created January 21, 2026 12:46
Benchmark for different add nodes in Maya
import maya.cmds as cmds
import time
import random
import gc
# ---------------------------------------------------------------------
# CONFIGURATION
# ---------------------------------------------------------------------
CHAIN_LENGTH = 2500 # Depth of the chain (A -> B -> C...)
START_FRAME = 0
@masqu3rad3
masqu3rad3 / mult_benchmark_maya.py
Created January 21, 2026 12:43
Benchmark for different multiplication nodes available in Maya
import maya.cmds as cmds
import time
import random
import gc
# ---------------------------------------------------------------------
# CONFIGURATION
# ---------------------------------------------------------------------
CHAIN_LENGTH = 2500 # Depth of the chain (A -> B -> C...)
START_FRAME = 0
@masqu3rad3
masqu3rad3 / shelf_creation_snippet.py
Created February 1, 2023 13:59
shelf, shelf button, and shelf button pop-up menu creation snippet for Maya
import maya.cmds as mc
def _null(*args):
pass
class _shelf():
'''A simple class to build shelves in maya. Since the build method is empty,
it should be extended by the derived class to build the necessary shelf elements.
@masqu3rad3
masqu3rad3 / create_hud.py
Created December 8, 2021 11:49
Creates a custom hud from a function or static value
from maya import cmds
def create_hud(label, separation=0, data=None, size="large"):
"""Creates a hud with given arguments
Args:
label: (String) Name of the HUD as it will be visible to user
separation: (Int) Margin from the top
data: (multiple) This can be any value or function.
size: (string) size of the label and data. Acceptable arguments are 'large', 'medium' and 'small'
@masqu3rad3
masqu3rad3 / patch_maker.py
Created July 22, 2021 14:50
Quick and easy way to create patch objects from folder full of images with correct ratios.
#patch maker
from glob import glob
import os
from maya import cmds
image_folder = "/your/image/folder/"
shader_type = "blinn"
@masqu3rad3
masqu3rad3 / get_inbetween_values.py
Last active June 26, 2021 21:47
find the in-between target values on a given base shape
from maya import cmds
import maya.OpenMayaAnim as oa
import maya.OpenMaya as om
def get_inbetween_values(blendshape_node, target_name):
# get the bs api mobject
bs_sel = om.MSelectionList()
bs_sel.add(blendshape_node)
@masqu3rad3
masqu3rad3 / get_selected_vertices.py
Created February 23, 2021 10:47
Small gist to get all the selected vertex id's
def get_selected_vertices():
sel = cmds.ls(sl=True)
for x in sel:
if ":" not in x:
yield int(x[s.find("[")+1:x.find("]")])
else:
start_v = int(x[x.index("[") + 1: x.index(":")])
end_v = int(x[x.index(":") + 1:x.index("]")])
for v in range(start_v, end_v+1):
yield v
@masqu3rad3
masqu3rad3 / frustrum_visualizer.py
Created December 3, 2020 11:40
Slightly modified version of THOMAS HOLLIER's Maya Camera Frustrum Visualizer
## Author: THOMAS HOLLIER
## Modified: Arda Kutlu
## http://relentlessplay.com/maya-frustum-visualizer/
import maya.cmds as cmds
import math, sys
#--------- Gather relevant camera attributes
import maya.cmds as cmds
import math, sys