Skip to content

Instantly share code, notes, and snippets.

@kanishk2391
kanishk2391 / matcapsMaya.py
Created February 8, 2019 15:54
Matcaps For Maya - Python
import os
import maya.cmds as cmds
import glob
def matCapShader():
mainShader=cmds.shadingNode("surfaceShader",n="matCapShader",asShader=True)
envBall=cmds.shadingNode("envBall",n="matCapBall",asTexture=True)
placeTextureNode3D=cmds.shadingNode("place3dTexture",n="matCapTexturePlacer3d",asUtility=True)
fileNode=cmds.shadingNode("file",n="matCapFile",asTexture=True)
placeTextureNode2D=cmds.shadingNode("place2dTexture",n="matCapTexturePlacer2d",asUtility=True)
@kanishk2391
kanishk2391 / extrudeCurves.py
Created June 24, 2018 18:27
Maya Script to extrude Multiple Curves at once with Properties
import maya.cmds as cmds
#Thickness of the pipe
circleRadius=5
#Length Spans
lengthSpans=10
#Radial Spans of the Pipe
radialSpans=6
import maya.cmds as cmds
import maya.mel as mel
def cadCleanUp():
mrgVrtx=cmds.checkBox(mrgVtxChkBox,v=True,q=True)
mrgThreshold=0.001
laminaFaces=cmds.checkBox(lamFacChkBox,v=True,q=True)
nonManifoldGeo=cmds.checkBox(nmfGeoChkBox,v=True,q=True)
maintainNormals=cmds.checkBox(mainNorChkBox,v=True,q=True)
@kanishk2391
kanishk2391 / togglePolygonDisplay.py
Created April 22, 2017 04:21
Toggle Viewport Polygon display
def togglePolyDisplay():
x=cmds.modelEditor("modelPanel4", q=True, polymeshes=True)
if x == 0:
cmds.modelEditor("modelPanel4", e=True, polymeshes=True)
else:
cmds.modelEditor("modelPanel4", e=True, polymeshes=False)
@kanishk2391
kanishk2391 / switchCamera.mel
Created February 25, 2017 06:45
Switch Cameras
//Switch Perspective Cameras
$currentCamera = `lookThru -q`;
string $allCameras[];
$allCameras = `listCameras -p`;// This will select perspective cameras only
int $nextCamera;
for($pos=0;$pos<size($allCameras);$pos++)
{
if($currentCamera == $allCameras[$pos]) $nextCamera = $pos+1;
}
if($nextCamera>=size($allCameras)) $nextCamera = 0;
@kanishk2391
kanishk2391 / OpenGL Lights
Created June 4, 2015 21:16
Change OpenGL lights in Blender
#Set OpenGL lights to Maya like viewport
import bpy
l0 = bpy.context.user_preferences.system.solid_lights[0]
l1 = bpy.context.user_preferences.system.solid_lights[1]
l2 = bpy.context.user_preferences.system.solid_lights[2]
l0.use = True
l0.diffuse_color = (0.384, 0.384, 0.384)
l0.specular_color = (0.2333, 0.2333, 0.2333)
l0.direction = (-0.028169013559818268, 0.563380241394043, 0.8257173895835876)
@kanishk2391
kanishk2391 / unsmoothMesh.py
Last active March 16, 2021 03:24
Reconstruct Subdiv for Maya
#---------Reconstruct Subdiv Script for Maya----------
#Script by - Kanishk Chouhan
#Email - kanishk2391@gmail.com
#Blog - www.pixel-architect.blogspot.com
#Description -
#This script allows u to reverse the result of smooth operation in maya after deleting the history
#It also preserves the original UV of the mesh
#Select the mesh u want to unsmooth and execute the script
#Script might take some time to execute depending on the polycount...