This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Generate a weak ref to a python callable accounting for loose functions, bound methods and callable classes. | |
This allows creating references to python functions without increasing their reference countm and creating | |
circular dependencies. | |
""" | |
import typing | |
import weakref | |
import types |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A set of scripts for bootstrapping an Ubuntu install for development. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide6 import QtWidgets, QtCore | |
class SceneSpaceShadowEffect(QtWidgets.QGraphicsDropShadowEffect): | |
""" | |
A drop shadow effect which takes the scene space size into account. | |
""" | |
def __init__(self, parent=None): | |
super().__init__(parent=parent) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide6 import QtWidgets | |
""" | |
This is a simple "trick" that uses "scaled integer arithmatic" to internally represent floating point values as integers. | |
Using this coversion it makes it extremely simple to use the standard interger slider to work on floating point numbers. | |
given a spinner with 2 decimal places. | |
rounded = round(1.1111, 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tank | |
import os | |
auth = tank.authentication.ShotgunAuthenticator() | |
user = auth.get_user() | |
sg = user.create_sg_connection() | |
playlist_ids = [23024] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is a cobbled together "copy paste" abomination which finds the bounding box of one image inside another. | |
Useful for matching compositions. | |
""" | |
import numpy as np | |
import cv2 as cv | |
import matplotlib.pyplot as plt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A minimal example of MVC in PySide utilising a ThreadPollExecutor to offload work to a thread. | |
""" | |
import time | |
from PySide2 import QtGui, QtWidgets, QtCore | |
from concurrent.futures import ThreadPoolExecutor | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is an attempt to make a poor man's version of Katana's look files. | |
We record any shader assignments on the descendants of a given group, each location is recorded as a relative path along | |
with the shading engine that is assigned to it. | |
Encoding: | |
given the following nodes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A very basic example of a image annotation tool using a QWidget as a viewport. | |
This implements | |
- Viewport panning | |
- Viewport zooming (maintaing Point Of Interest) | |
- Basic draggable handles / gizmos | |
""" | |
from PySide6 import QtCore, QtGui, QtWidgets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This example shows how to capture a screenshot of a specific area of the screen. | |
Warning: This has not been tested with multiple monitors. | |
Example: | |
to capture the entire the current screen:: | |
from PySide2 import QtCore, QtWidgets |
NewerOlder