Skip to content

Instantly share code, notes, and snippets.

Andreas Rånman rondreas

Block or report user

Report or block rondreas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rondreas
rondreas / PurgeTags.py
Created Jun 10, 2019
Purge tags for selected items
View PurgeTags.py
#python
"""
Remove all tags for selected items.
In Modo run:
> @PurgeTags.py
"""
@rondreas
rondreas / SelectionService.py
Created Jun 4, 2019
Quick reminder of how to deal with some quirks of Modo
View SelectionService.py
# python
"""
Snippets for dealing with Modo's Selection Service
"""
__author__ = "AndreasR"
@rondreas
rondreas / countScriptCtx.py
Created Dec 7, 2018
Count the number of scriptCtx in scene, checking only default named ones.
View countScriptCtx.py
"""
Count the number of scriptCtx in scene, checking only default named ones.
"""
import pymel.core as pm
def countScriptCtx():
count = 0
mel_command = 'scriptCtx -ex "scriptCtx{}"'
View vertToObject.py
# Replace selection with transform, for all selected vertices.
pm.select( [shape.getTransform() for shape in pm.ls(pm.polyListComponentConversion( fromVertex = True ))], replace = True )
View getActive.py
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()):
@rondreas
rondreas / eSelection.py
Created Nov 20, 2018
snippet for blog post on toggleComponent
View eSelection.py
class eSelection(object):
""" Enum for selection convertion. """
object = 0
face = 1
edge = 2
vert = 3
@rondreas
rondreas / toggleComponents.py
Created Nov 19, 2018
Quick script to allow hotkeying a toggle for converting selection, to imitate the default command of CTRL + F9/F10/F11.
View toggleComponents.py
"""
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):
@rondreas
rondreas / fixNormals.py
Last active Nov 19, 2018
hardsurface modelling script to set normals for all vertices on a face.
View fixNormals.py
import pymel.core as pm
def faceNormal():
""" """
# Store old selection,
selection = pm.selected()
# Convert selection to faces,
pm.mel.ConvertSelectionToFaces()
View makelinks.py
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
You can’t perform that action at this time.