Skip to content

Instantly share code, notes, and snippets.

@internetimagery
internetimagery / tool_switch.py
Last active January 14, 2016 16:10
Switch between local and world space on all tools (move, rotate, scale)
import maya.cmds as cmds
mode = cmds.manipMoveContext("Move", q=True, mode=True)
if mode == 1:
new_mode = 2
print "\nworld",
else:
new_mode = 1
print "\nlocal",
cmds.manipMoveContext("Move", e=True, mode=new_mode)
import maya.utils as utils
import maya.cmds as cmds
import subprocess
import threading
import tempfile
import platform
import os.path
import shutil
import re
@internetimagery
internetimagery / isolate.py
Last active May 29, 2021 13:55
Isolate Selected Object in C4D
# Isolate selection
import c4d
import c4d.gui as gui
import urllib
import datetime
import platform
import traceback
import contextlib
import webbrowser
@internetimagery
internetimagery / rename.py
Created January 19, 2016 14:17
Simple batch renaming objects (regular expression driven)
import re
import maya.cmds as cmds
class Rename(object):
""" Rename objects en mass """
pattern = ""
replace = ""
def __init__(s):
sel = cmds.ls(sl=True)
if not sel: return cmds.warning("You need to select at least one thing to renmae.")
@internetimagery
internetimagery / anim_export.py
Last active September 27, 2016 13:30
Import / Export basic animation from C4D
# Copy animation crudely to a file and back
import c4d
import c4d.gui as gui
import c4d.storage as storage
import json
import urllib
import os.path
import datetime
import platform
ssh-keygen -t rsa # ENTER to every field
ssh-copy-id myname@somehost
@internetimagery
internetimagery / controller.py
Created February 23, 2016 12:53
Use Geometry as a controller in Maya
# Use geometry as a Rig Controller.
# Created By Jason Dixon. http://internetimagery.com
#
# Usage: Add code below to a shelf button. Select some polygon faces, and a controller object. Hit the button!
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
@internetimagery
internetimagery / Load Darksouls.bat
Last active May 6, 2016 15:10
Load Dark Souls 3 at 720p and git to backup saves
REM Move to save file path for backups. Load the game and git-bash to handle backups
REM http://tools.taubenkorb.at/change-screen-resolution/
ChangeScreenResolution.exe /w=1280 /h=720 /d=0
start steam://rungameid/374320
cd /d %APPDATA%\DarkSoulsIII
"%SYSTEMDRIVE%\Program Files (x86)\Git\git-bash.exe"
ChangeScreenResolution.exe /w=1920 /h=1080 /d=0
import maya.cmds as cmds
import maya.mel as mel
slider = mel.eval("$tmp = $gPlayBackSlider")
range_ = (cmds.timeControl(slider, q=True, ra=True) or []) if cmds.timeControl(slider, q=True, rv=True) else (cmds.playbackOptions(q=True, min=True), cmds.playbackOptions(q=True, max=True))
keys = set(cmds.keyframe(q=True, t=range_, tc=True) or [])
cmds.confirmDialog(t="Your selected keys", m=("You have selected keyframes at:\n%s" % ", ".join(sorted([str(a) for a in keys]))) if keys else "No keys selected.")
# Automatically return the callback if errored
e = (cb1, cb2)-> return (err, args...)-> if err then cb1 err else cb2 args...
# Demo
div = (num1, num2, callback)->
try
callback null, num1 / num2
catch err
callback err