Skip to content

Instantly share code, notes, and snippets.

@jm991
jm991 / ParticleCollisionHelper.cs
Last active November 6, 2017 21:18
Handy utility to create collision mesh for a particle system in Unity
// This gist has been moved to a full project: https://github.com/jm991/ParticleCollisionTest
@jm991
jm991 / printextensions.mel.c
Last active April 27, 2019 21:15
Extensions for the default mel print statements to add new lines (println) and enable single line, formatted array printing (printarray)
//---------------------------------------------------------------------------------
// Source: https://gist.github.com/jm991/
// print methods for Maya 2017
// Author: John Mac
// Date: 10-29-2017
//
// Description:
// Extensions for the default mel print statements to add new lines (println) and enable single line, formatted array printing (printarray)
// https://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/Commands/print.html
// Installation:
@jm991
jm991 / getCurrentCamera.mel.c
Last active October 30, 2017 04:39
Find out which camera you are working with
//---------------------------------------------------------------------------------
// Source: https://acaciaecho.wordpress.com/2011/08/05/maya-get-current-camera/
// Author: Zhang Jian
// Date: 08-05-2011
//
// Description:
// Find out which camera you are working with. Focus on a model panel,
// in which you can have a camera to tumble/pan/zoom, and run getCurrentCamera,
// you will have the transform name of the camera.
// If you are in some other type of panel, say outliner, empty string will be returned.
@jm991
jm991 / alignPivotToSelection.mel.c
Last active March 11, 2023 09:52
You can align the pivot along a selected normal which can be defined by vertices, edges or a face.
//---------------------------------------------------------------------------------
// Source: https://www.highend3d.com/maya/script/align-pivot-to-selection-mel-for-maya
// alignPivotToSelection Tool for Maya 2010, 2011 & 2012
// Author: Daniel Brkovic
// Thanks to: Tom Ferstl
// Date: 10-12-2011
//
// Description:
// You can align the pivot along a selected normal which can be defined by vertices, edges or a face.
// Commands:
@jm991
jm991 / alignWorkplaneToSelection.mel.c
Created October 30, 2017 04:51
Aligns a construction plane to the normal vector and position of the currently selected polygon and creates an orthographic camera pointed at the plane
//---------------------------------------------------------------------------------
// Source: https://gist.github.com/jm991/
// alignWorkplaneToSelection Tool for Maya 2017
// Author: John Mac
// Date: 10-29-2017
//
// Description:
// Aligns a construction plane to the normal vector and position of the currently selected polygon and creates an orthographic camera pointed at the plane
// Commands:
// alignWorkplaneToSelection(),toggleWorkplaneAndPerspCam()
@jm991
jm991 / constrainJntToDefSkeleton.mel.c
Last active November 7, 2017 04:06
Constrains the joint heirarchy to the deformation heirarchy, joint by joint
//---------------------------------------------------------------------------------
// Source: https://app.pluralsight.com/library/courses/maya-2017-rigging-introduction/table-of-contents
// Author: Eric Kunzendorf and John Mac
// Date: 11-05-2017
//
// Description:
// Constrains the joint hierarchy to the deformation hierarchy, joint by joint
// Has error handling to skip over anything that isn't a joint and to check joint matches based on name
// Assumes joint naming following this convention:
// _c_ center
@jm991
jm991 / toggleVisible.mel.c
Last active November 5, 2017 22:40
Toggles visibility of multiple selected transforms
//---------------------------------------------------------------------------------
// Source: https://gist.github.com/jm991/
// Author: John Mac
// Date: 11-05-2017
//
// Description:
// Toggles visibility of multiple selected transforms
// Installation:
// 1. Copy toggleVisible.mel to C:\Users\[USER]\Documents\maya\[MAYAVERSION]\prefs\scripts\jm991
// 2. Restart maya
@jm991
jm991 / createJointSymmetry.mel.c
Last active November 6, 2017 05:05
Creates a symmetry constraint between two selected joints (useful for arms, legs, eyes, etc.)
//---------------------------------------------------------------------------------
// Source: https://gist.github.com/jm991/
// http://griffinanimation.blogspot.com/2014/11/maya-symmetry-constraint.html
// https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/Maya-Tech-Docs/Nodes/symmetryConstraint-html.html
// Author: John Mac
// Date: 11-05-2017
//
// Description:
// Creates a symmetry constraint between two selected joints (useful for arms, legs, eyes, etc.) using the same settings as Maya default setup as Joint Tool > Symmetry > _-Axis
// Maya has an option to create symmetrical joints using the joint tool, but the constraint doesn't have an option to apply it to existing joints
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TextureFormatCheck : MonoBehaviour
{
public Texture2D tex2D;
public Material mat;
// Use this for initialization