Skip to content

Instantly share code, notes, and snippets.

View mottosso's full-sized avatar

Marcus Ottosson mottosso

View GitHub Profile
@mottosso
mottosso / pyblish_in_200_lines.py
Last active October 11, 2023 14:26
Pyblish in 200 lines
import json
import types
import inspect
# The core Pyblish package is mocked.
# These are all relevant members to processing.
pyblish = types.ModuleType("pyblish")
pyblish.api = types.ModuleType("api")
pyblish.plugin = types.ModuleType("plugin")
pyblish.plugin.process = None # Implemented below
@mottosso
mottosso / alt.qml
Last active January 3, 2024 09:40
Animated text in QML
import QtQuick 2.0
/*!
An alternative implementation,
this one causes a binding loop for some reason.
*/
Rectangle {
width: 500
height: 300
@mottosso
mottosso / README.md
Last active November 1, 2015 16:32
Dash - environment management via the command-line

Dash

An early prototype of [Abstract Factory RFC57][1].

Usage

$ dash thedeal/ben/rig
@mottosso
mottosso / README.md
Last active September 5, 2016 06:46
Restore Script Editor focus

Problem

image

On Windows systems using Autodesk Maya, the text input field of the Script Editor doesn't regain focus after having restored focus to the main window. This event handler explicitly restores focus, if it turns out to have been the last active panel at the time of leaving the application.

Usage

Place the full contents of the script below into your userSetup.py and never again lose focus.

@mottosso
mottosso / README.md
Last active February 22, 2016 22:09
QML Console Test

QML Console Test

untitled

@mottosso
mottosso / 0.md
Last active January 8, 2020 11:23
QML Reference Manager 2 - With Python to QML communication

Description

Same as QML Reference Manager except with data being passed from Python to QML, as a "context property".

Context properties are inserted into the global namespace of QML, the name ("myModel") is directly accessible from any QML file, and the object can be any Python object.

@mottosso
mottosso / 0.md
Last active August 29, 2015 14:28
QML Reference Manager

untitled

@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 / 0_README.md
Created August 18, 2015 10:27
Look development serialisation format

Each imported pointcache has an origin from which the original asset is referenced.

Using this, the original reference is looked up and from it, it's look development files imported and re-built.

@mottosso
mottosso / quickstart.py
Last active August 29, 2015 14:26
Learn Pyblish By Example - Quickstart
"""Full Example
From http://forums.pyblish.com/t/learning-pyblish-by-example/108/3
Usage:
Copy and run this entire file in your Maya Script Editor
"""
import os