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
// | |
// Copyright (C) Andreas Rånman | |
// | |
// File: selectHardEdgesCmd.cpp | |
// | |
// MEL Command: selectHardEdges | |
// | |
// Author: Maya Plug-in Wizard 2.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
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); | |
} |
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
using UnityEngine; | |
using UnityEditor; | |
public class Replacer : EditorWindow | |
{ | |
[MenuItem("Window/Replacer")] | |
public static void ShowWindow() | |
{ | |
EditorWindow.GetWindow<Replacer>("Replace GameObject"); | |
} |
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
// 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 |
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
""" | |
Script to create symbolic links for vimfiles, allowing user download dotfiles | |
to any location. | |
$ python ~/Downloads/foo/makelinks.py | |
Symlink Created for: '/home/user/GitHub/foo/vim/.vim' -> '/home/user/.vim' | |
Symlink Created for: '/home/user/GitHub/foo/vim/.vimrc' -> '/home/user/.vimrc' | |
Symlink Created for: '/home/user/GitHub/foo/vim/.gvimrc' -> '/home/user/.gvimrc' | |
""" |
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 pymel.core as pm | |
def faceNormal(): | |
""" """ | |
# Store old selection, | |
selection = pm.selected() | |
# Convert selection to faces, | |
pm.mel.ConvertSelectionToFaces() |
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
""" | |
Quick script to allow hotkeying a toggle for converting selection, to imitate the default | |
command of CTRL + F9/F10/F11. | |
""" | |
import pymel.core as pm | |
class eSelection(object): |
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
class eSelection(object): | |
""" Enum for selection convertion. """ | |
object = 0 | |
face = 1 | |
edge = 2 | |
vert = 3 |
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
def getActive(): | |
""" Check current selection to find if we're currently only selecting a specific component. """ | |
if all(isinstance(x, pm.MeshFace) for x in pm.selected()): | |
return eSelection.face | |
if all(isinstance(x, pm.MeshEdge) for x in pm.selected()): | |
return eSelection.edge | |
if all(isinstance(x, pm.MeshVertex) for x in pm.selected()): |
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
# Replace selection with transform, for all selected vertices. | |
pm.select( [shape.getTransform() for shape in pm.ls(pm.polyListComponentConversion( fromVertex = True ))], replace = True ) |