Skip to content

Instantly share code, notes, and snippets.

@joaen
joaen / debugpy_maya_tutorial.md
Last active April 17, 2024 20:47
How to attach VS Code Python debugger to Autodesk Maya 2022+

If you're having trouble with the MayaPy extension in VS Code note that it still utilizes ptvsd, which Microsoft has deprecated as of 2020.

This tutorial will guide you through the process of setting up debugging with debugpy, the latest and improved Python debugger for VS Code.

Note: This tutorial is primarily intended for users of Python 3 and Maya 2022 (or later).

Note: You need to have the official Python extension installed in VS Code.

Method 1: Remote Attach

@joaen
joaen / hud_button.py
Created May 17, 2022 21:24
Example script to showcase how you can create custom HUD/overlay elements by attaching QT widgets to the viewport in Autodesk: Maya.
import sys
from functools import partial
import maya.OpenMayaUI as OpenMayaUI
from shiboken2 import wrapInstance
from PySide2 import QtWidgets
def create_hud():
# Create an instance of the M3dView class and get the 3D view from the modelPanel4 in Maya
view = OpenMayaUI.M3dView()
OpenMayaUI.M3dView.getM3dViewFromModelPanel("modelPanel4", view)
@joaen
joaen / pose_tool.py
Last active May 5, 2022 21:24
Simple tool to load and save animation poses in Autodesk Maya using .json files.
''''
Name: pose_tool.py
Description: Simple tool to load and save poses in Autodesk Maya using .json files.
Author: Joar Engberg 2022
'''
import json
import sys
import maya.cmds as cmds