Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcus Ottosson mottosso

View GitHub Profile
@mottosso
mottosso / CMakeLists.txt
Last active April 7, 2021 10:41
Maya 2022 crash - dagItem was nullptr
View CMakeLists.txt
#-
# ==========================================================================
# 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.
@mottosso
mottosso / CMakeLists.txt
Last active March 19, 2023 00:53
Callback on removal, even on undo?
View CMakeLists.txt
#-
# ==========================================================================
# 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.
@mottosso
mottosso / README.md
Last active February 9, 2023 18:25
Hidden scriptJob with "virus" and "vaccine" keywords from CG Monastery
View README.md

This is a scene file from the CG Monastery Discord chat user @roly, containing an embedded script that auto-installs and calls itself on SceneSave. The script was found in the rig bat_rig_04.mb, rather than the animation file, TURN_ani_bat_23.ma. Find the imported scene file below (5340 kb).

What happens?

  • Installs itself on scene-open, as a cmds.scriptJob
  • Installs itself on Maya open, as ~/maya/scripts/vaccine.py
  • Warning on scene save with the following message
View CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
# include the project setting file
include($ENV{DEVKIT_LOCATION}/cmake/pluginEntry.cmake)
# specify project name
set(PROJECT_NAME ArrayData)
set(SOURCE_FILES
Sender.cpp
@mottosso
mottosso / ArrayPlug.cpp
Last active November 1, 2022 01:42
Maya API Example - Writing to an Array Plug
View ArrayPlug.cpp
/*
An example of writing to an array plug
Description
-----------------------------------------------------------
There are two ways of achieving this
1. Based on input, dynamically generate plugs in an array
2. Based on a connected array output, write to that
@mottosso
mottosso / CMakeLists.txt
Last active August 29, 2020 11:13
MyData - How to use MPxData with Maya
View CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
# include the project setting file
include($ENV{DEVKIT_LOCATION}/cmake/pluginEntry.cmake)
# specify project name
set(PROJECT_NAME MyData)
set(SOURCE_FILES
Sender.cpp
@mottosso
mottosso / README.md
Last active March 14, 2021 20:17
Parallel Evaluation in Maya 2018+
View README.md

An example of parallel evaluation in Maya 2018+

Scenes

  1. Independent hierarchies, with parent constraint

Usage

Files prefixed scene* generate nodes suitable for parallelism, profile* contain ways to measure performance. Each snippet of code is meant to be copy/pasted into the Script Editor and run.

View index.html
<table cellspacing="0" cellpadding="0" width="325" style="font-family:Arial;padding:20px">
<tbody style="color:rgb(151,153,155);font-size:13px;line-height:18px;letter-spacing:1px">
<tr>
<td>
<img width=50 src="https://user-images.githubusercontent.com/2152766/37761204-ef2d0f0c-2db0-11e8-8109-3a1ac2e08c99.png" class="CToWUd">
</td>
<td style="padding-top:10px">
<span style="text-transform:uppercase;color:rgb(0,163,173)">
MARCUS&nbsp;OTTOSSON
</span>
@mottosso
mottosso / Dock.py
Last active January 26, 2023 16:55 — forked from liorbenhorin/Simple_MayaDockingClass.py
Simple way to dock Qt widgets to Maya 2017+
View Dock.py
from maya import cmds, OpenMayaUI as omui
from Qt import QtWidgets, QtCore, QtCompat
def Dock(Widget, width=300, show=True):
"""Dock `Widget` into Maya
Arguments:
Widget (QWidget): Class
show (bool, optional): Whether to show the resulting dock once created