Skip to content

Instantly share code, notes, and snippets.

@oglops
oglops / AEaddModelPanel.py
Last active March 26, 2021 22:34
embed a model panel into script editor with xml attribute editor template in maya 2015
import maya.cmds as cmds
import maya.utils as mutils
def AEaddModelPanelModule( plug, uiLabel, annot):
paneLayoutName = cmds.paneLayout(h=300)
modelPanel = "customModelPanel"
if cmds.modelPanel(modelPanel, q=1, ex=1):
cmds.modelPanel(modelPanel, e=1, p=paneLayoutName)
else:
@oglops
oglops / ma_parser.py
Last active July 22, 2016 07:23
a .ma parser to extract reference information and loaded status
class MayaRefParser(object):
'''
This parses .ma file and get refrenced files info, store them in itself
'''
def __init__(self , maFile=None):
self.header = ''
self.refHeader = ''
self.otherHeader = ''
self.contents = ''
self.contentsLineNum = 0
@oglops
oglops / testQcompleter_goto.py
Last active July 22, 2016 06:16
test qcompleter similar to ctrl+r in sublime
#!/usr/bin/env python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import QtGui, QtCore
import sys
import re
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
@oglops
oglops / enhancedScriptEditor_v2.py
Last active October 17, 2022 22:37
add some hotkeys to maya script editor
# author: [email protected] The Tree Widget guy
# todo
# ctrl+d remove multiple line
# double click go to line
# ctrl+g go to line
# ctrl+r sublime style
try:
qApp.removeEventFilter(filter)
@oglops
oglops / howto-tomato-install-extras.markdown
Created July 16, 2016 21:03 — forked from dferg/howto-tomato-install-extras.markdown
HOWTO: Install extra kernel modules on Shibby TomatoUSB

Introduction

This howto describes installing the extra kernel modules for the Tomato open-source router firmware. We will install them in the /opt/extras area.

Requirements

  • Router running Shibby's fork of TomatoUSB
  • entware installed to a USB stick mounted at /opt

This Howto Was Tested With

@oglops
oglops / test_qtextedit_maya.py
Last active July 15, 2016 08:16
intercept maya hotkey, add ctrl+/ comment toggle and hack ctrl+e , tab / shift+tab
from PyQt4.QtCore import Qt,QObject,QEvent
from PyQt4.QtGui import QTextCursor,qApp
import maya.cmds as mc
import maya.mel as mel
import maya.OpenMayaUI as apiUI
import sip
class CustomFilter(QObject):
@oglops
oglops / pyToMelCall.py
Created July 13, 2016 04:30
call mel script in python style
import maya.mel as mm
from numbers import Number
import collections
import sys
import logging
_logger = logging.getLogger(__file__)
consoleHandler = logging.StreamHandler()
_logger.addHandler(consoleHandler)
_logger.setLevel(logging.INFO)
@oglops
oglops / qtextedit_test.py
Last active July 14, 2016 05:34
test toggling comment in qtextedit
import os
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import uic
import textwrap
from functools import partial
@oglops
oglops / test_event_filter.py
Last active October 15, 2017 21:29
install an event filter to main maya window, and only intercept the ctrl+/ key when mouse pointer is on top of script editor
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import maya.cmds as mc
import maya.mel as mel
class CustomFilter(QObject):
def eventFilter(self, obj, event):
@oglops
oglops / upload-imgur-detail.sh
Created July 10, 2016 18:13
upload images to imgur and open detailed info url in browser
# !/bin/env bash
imgur(){
for i in "$@";do
curl -# -F "image"=@"$i" -H "Authorization: Client-ID 3e7a4deb7ac67da" https://api.imgur.com/3/upload.xml|\
grep -Eo '<[a-z_]+>http[^<]+'|sed 's/^<.\|_./\U&/g;s/_/ /;s/<.*>//' | sed 's/^.*imgur\.com\//http:\/\/imgur.com\//g;s/\.[^.]*$//' | xargs xdg-open
done
}
imgur "$@"