Skip to content

Instantly share code, notes, and snippets.

@jonntd
jonntd / modelPanelScripts.py
Created February 20, 2025 11:57 — forked from redglasses67/modelPanelScripts.py
Maya_ModelPanel_Scripts
# -*- coding: utf-8 -*-
import maya.cmds as mc
import maya.mel as mel
# 33 のビュー変換で使用する名前の一覧クラス. 変更時に文字列指定するので事前にこのように用意しておくと楽そう
class ViewTransformName():
ACES_RRT_v_0_7 = "ACES RRT v0.7"
ACES_RRT_v_1_0 = "ACES RRT v1.0"
Log = "Log"
# python api2.0 setWeights(),setWeight()
# http://ueta.hateblo.jp/entry/2015/08/24/102937
import time
import maya.api.OpenMaya as OpenMaya2
import maya.api.OpenMayaAnim as OpenMayaAnim2
#_time = time.time
_time = time.clock
@jonntd
jonntd / simple_collisions.py
Created November 12, 2024 03:52 — forked from danbradham/simple_collisions.py
Simple collision detection node network for Maya
from maya import cmds
def simple_collision_check(obj_xform, collider_shape):
'''
Create a node network that checks whether an objects xform is colliding with a mesh. Returns a condition node where outputX, Y, and Z are 1
for colliding and 0 when not colliding.
:param obj_xform: Path to object transform
:param collider_shape: Path to mesh transform
@jonntd
jonntd / CMakeLists.txt
Created November 7, 2024 02:18 — forked from mottosso/CMakeLists.txt
Callback on removal, even on undo?
#-
# ==========================================================================
# Copyright (c) 2018 Autodesk, Inc.
# All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# unpublished proprietary information written by Autodesk, Inc., and are
# protected by Federal copyright law. They may not be disclosed to third
# parties or copied or duplicated in any form, in whole or in part, without
# the prior written consent of Autodesk, Inc.
@jonntd
jonntd / pyside_gradient.py
Created November 5, 2024 06:59 — forked from petfactory/pyside_gradient.py
Using a maya gradient control with PySide
from PySide import QtCore, QtGui
from shiboken import wrapInstance
import maya.OpenMayaUI as omui
from functools import partial
import pymel.core as pm
def maya_main_window():
main_window_ptr = omui.MQtUtil.mainWindow()
return wrapInstance(long(main_window_ptr), QtGui.QWidget)
@jonntd
jonntd / test_falloffCurveAttr.py
Created November 4, 2024 09:36 — forked from ryusas/test_falloffCurveAttr.py
A test for Maya's falloffCurveAttr control and attribute.
import maya.cmds as cmds
import maya.mel as mel
cmds.group(em=True)
cmds.addAttr(at='float2', ln='testFCurve', m=True)
cmds.addAttr(at='float', ln='testFCurvePosition', p='testFCurve', dv=-1)
cmds.addAttr(at='float', ln='testFCurveValue', p='testFCurve', dv=-1)
cmds.setAttr('.testFCurve[0]', 0, 0)
cmds.setAttr('.testFCurve[1]', .5, 0)
cmds.setAttr('.testFCurve[2]', .5, 1)
@jonntd
jonntd / README.md
Created September 20, 2024 04:55 — forked from jamiephan/README.md
A script to automatically add ALL items to your account in quixel

Script to add all items from quixel

As quixel is being removed, all items are free to aquire. This script is to automate the process to add items to your account (As of writing, a total of 18874 items)

Note: This script only tested in the latest version of Chrome.

How to use

  1. Copy the script from below (run.js)
  2. Login into https://quixel.com
@jonntd
jonntd / gist:7d98e7aacc4d2014f2651661eabad80e
Created August 3, 2024 07:41 — forked from snail007/gist:83e93e62a3abc390a649b2d96c1a61c4
git仓库删除所有提交历史记录,成为一个干净的新仓库,把旧项目提交到Git上,但是会有一些历史记录,这些历史记录中可能会有项目密码等敏感信息。如何删除这些历史记录,形成一个全新的仓库,并且保持代码不变呢?
1.Checkout
git checkout --orphan latest_branch
2. Add all the files
git add -A
3. Commit the changes
@jonntd
jonntd / extractBlendShape.py
Created May 13, 2024 09:27 — forked from r4inm4ker/extractBlendShape.py
extract blendshape target from blendshape node
import pymel.core as pm
import re
def parseVtxIdx(idxList):
"""convert vertex index list from strings to indexes.
idxList : [u'vtx[1]', u'vtx[3]', u'vtx[6]', u'vtx[8]', u'vtx[12:13]']
return : [1,3,6,8,12,13]
"""
parseIdxList = []
def aim(vector, aimvec, upvec, worldUpVec):
vector = om.MVector(vector)
aimvec = om.MVector(aimvec)
upvec = om.MVector(upvec)
worldUpVec = om.MVector(worldUpVec)
tanvec = worldUpVec - vector
direction = tanvec ^ vector
aimQuat = om.MQuaternion(aimvec, vector)
fromvec = upvec.transformAsNormal(aimQuat.asMatrix())