Skip to content

Instantly share code, notes, and snippets.

import json
import math
import urllib.request
class Material(dict):
def __init__(self, data):
self.update(data)
def __getattr__(self, key):
@KentMrng
KentMrng / proximityWrap.py
Created February 7, 2022 08:56
Create proximityWrap and add driver from python
from maya import cmds
def proximityWrap(driven, drivers, name=''):
from maya.internal.nodes.proximitywrap import node_interface
kwargs = {'type': 'proximityWrap'}
if name:
kwargs['name'] = name
pw = cmds.deformer(driven, **kwargs)
pwni = node_interface.NodeInterface(pw[0])
'''
I wanted to easily reproduce maya's expression in a node.
The value of the argument can be a node attribute name or a number (int, float).
All functions return the attribute name that will be the final output of the value.
Add(3, 2)
>>> plusMinusAverage1.output1D
@KentMrng
KentMrng / changeMayaScriptEditorFont.py
Last active July 23, 2019 04:57
change maya script editor's font
import maya.OpenMayaUI as omui
from PySide2 import QtWidgets
from shiboken2 import wrapInstance
def changeMayaScriptEditorFont(fontFamily='Source Code Pro'):
widgetStr = mel.eval('string $tempString = $gCommandLayout')
ptr = omui.MQtUtil.findControl(widgetStr)
widget = wrapInstance(long(ptr), QtWidgets.QWidget)