Skip to content

Instantly share code, notes, and snippets.

View mottosso's full-sized avatar

Marcus Ottosson mottosso

View GitHub Profile
@mottosso
mottosso / ArrayPlug.cpp
Last active August 27, 2025 03:14
Maya API Example - Writing to an Array Plug
/*
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 July 21, 2025 20:20
MyData - How to use MPxData with Maya
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 / object_under_cursor.py
Last active July 11, 2025 23:33
Get object under cursor - Autodesk Maya
"""Illustration of how to retrieve the shape under the mouse cursor
Usage:
Run `start()` to start listening for when the mouse stops and to display a tooltip
Run `stop()` to stop listening
"""
from maya import cmds
from PySide import QtGui, QtCore
@mottosso
mottosso / README.md
Last active March 4, 2025 03:19
Minimal QML SceneGraph

untitled

Usage

python main.py --amount 100
  • Panning by left-click + drag
  • Scale by rotating the mouse wheel
@mottosso
mottosso / README.md
Last active December 2, 2024 01:46
QML Reloading in PyQt5

Usage

git clone https://gist.github.com/fa01c80080363df3433d.git qmlreload
cd qmlreload
python main.py

Edit either SceneGraphEditor.qml or Viewport.qml and then hover it and hit F5 to reload.

@mottosso
mottosso / CMakeLists.txt
Last active November 7, 2024 02:18
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.
@mottosso
mottosso / 0_README.md
Last active June 28, 2024 07:15
Bi-directional communication over Popen

Bi-directional Communication over Popen

This gist illustrates how two processes can exchange information via subprocess.Popen.

untitled

Goal

Integrate an externally running user interface, potentially written in another language. For example, a GUI written in PyQt5 and Python 3 running inside of Autodesk Maya (Python 2.7, PySide).

@mottosso
mottosso / CompositeItem.qml
Created March 25, 2015 10:52
Composite Items in QML
import QtQuick 2.3
Item {
id: composite
property Component body
Row {
anchors.fill: parent
@mottosso
mottosso / README.md
Last active January 3, 2024 10:07
LinkedIn Ad-blocker

On LinkedIn, some of the posts in your "Feed" are ads. They carry a little indicator (by law) to tell you as much. This script looks for those indicators and hides it for you. It works by installing an event listener for when you scroll, and looks for newly promoted posts to hide.

Usage

Copy/paste the above script into your Console when visiting LinkedIn. You can use an extension to run the above script whenever visiting LinkedIn, such as "Custom JavaScript for Websites 2"


Changes