Instantly share code, notes, and snippets.

View DrawSimple.shader
// Implementation of effect described at: https://willweissman.wordpress.com/tutorials/shaders/unity-shaderlab-object-outlines/
Shader "Custom/DrawSimple" {
SubShader{
ZWrite Off
ZTest Always
Lighting Off
Pass {
CGPROGRAM
#pragma vertex VShader
View VertexWind.shader
Shader "Custom/VertexWind" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness("Smoothness", Range(0,1)) = 0.5
_Metallic("Metallic", Range(0,1)) = 0.0
_Normal("Normal Map", 2D) = "bump" {}
_CutOff("Alpha Cutoff", Range(0, 1)) = 0.5
View Replacer.cs
using UnityEngine;
using UnityEditor;
public class Replacer : EditorWindow
{
[MenuItem("Window/Replacer")]
public static void ShowWindow()
{
EditorWindow.GetWindow<Replacer>("Replace GameObject");
}
View SDFSphere.cs
using UnityEngine;
[ExecuteInEditMode]
public class SDFSphere : MonoBehaviour {
private void Update()
{
// Set a global value that we can use in our shader.
Shader.SetGlobalVector("_sdfSphere_position", this.transform.position);
}
View xformMirror.py
import pymel.core as pm
def xformMirror(transforms=[], across='YZ', behaviour=True):
""" Mirrors transform across hyperplane.
transforms -- list of Transform or string.
across -- plane which to mirror across.
behaviour -- bool
"""
View selectHardEdges.cpp
//
// Copyright (C) Andreas Rånman
//
// File: selectHardEdgesCmd.cpp
//
// MEL Command: selectHardEdges
//
// Author: Maya Plug-in Wizard 2.0
//
View cutHardEdges.py
import pymel.core as pm
# Get all non smooth edges, and cut their UVs
hard_edges = [e for e in pm.selected()[0].e if not e.isSmooth()]
pm.polyMapCut(hard_edges)
View toolToggle.py
import pymel.core as pm
from functools import partial
from maya import OpenMayaUI as omui
try:
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from shiboken2 import wrapInstance
View bad_shapes.py
import pymel.core as pm
def find_bad_shapes():
""" Find and select all shapes which has not inherited their names from their parent transform,
such as transformShape. """
shapes = pm.ls(type="shape")
output = list()
for shape in shapes:
if shape.nodeName() != shape.getParent().nodeName()+'Shape':
View imageFormats.json
{
"AVI": 23,
"Alias PIX": 6,
"Cineon": 11,
"DDS": 35,
"EPS": 9,
"EXR(exr)": 40,
"GIF": 0,
"JPEG": 8,
"MacPaint": 30,