Skip to content

Instantly share code, notes, and snippets.

View BigRoy's full-sized avatar

Roy Nieterau BigRoy

View GitHub Profile
@BigRoy
BigRoy / ayon_docker_notes.md
Last active May 7, 2024 14:59
Ayon docker, install, setup and management notes

Note these are not any official notes - just random scribbles

Bootstrap

Running bootstrap wont give you the latest dev versions, only whats been released on the bootstrap server by the ynput team.

Updating it from time to time is a good way to see what progress has been made in terms of addons etc. It shouldnt remove old addon version, only add the new ones. That way you can still use older addons should you need. You would need to create a new bundle to accommodate that.

@BigRoy
BigRoy / openpype_to_ayon_core.md
Last active April 25, 2024 16:42
OpenPype codebase refactor to AYON core

Transition code from OpenPype to Ayon Core

Refactor

  • openpype -> ayon_core
  • Loader plugins update method now takes context instead of representation argument | ynput/ayon-core#130
  • Loader plugins attribute families (list) -> product_types (set) | ynput/ayon-core#191
  • Creator plugins: family -> productType | ynput/ayon-core#113
  • Refactor OpenPypeModule -> AYONAddon | ynput/ayon-core#22
    • now in ayon_core.addon instead of ayon_core.modules
@BigRoy
BigRoy / maya_usd_define_primitive.py
Last active April 22, 2024 01:34
Maya USD define Usd Primitives on the stage using Python for MayaUsdProxyShape
# Tested December 21st, 2020
# This is just a test example of how one could use the USD Api against a mayaUsdProxyShape and its USD stage.
# Note: The outliner doesn't really like it when you change the stage
# so you might need to toggle shape display off and on to get it to update.
import mayaUsd
from maya import cmds
from pxr import Usd, UsdGeom
shape = cmds.ls(type="mayaUsdProxyShape", long=True)[0] # make sure to use long full paths
stage = mayaUsd.ufe.getStage('|world' + shape)
@BigRoy
BigRoy / maya_cycle_evaluation_error.py
Created January 12, 2022 00:36
Maya check Cycle Errors more thoroughly where maya.cmds.cycleCheck(list=True) fails.
from maya import cmds
import contextlib
@contextlib.contextmanager
def capture_cycle_errors():
"""Capture the plugs in Cycle Error warnings.
During this context "Cycle on 'x' may not evaluate as expected"
are captured and 'x' is extracted as plugs in the yielded list.
@BigRoy
BigRoy / maya_query_mesh_uv_udim_tiles.py
Last active March 21, 2024 06:18
Query the used UDIM tiles for the UVs of an input mesh
from maya import cmds
def get_bounding_box_tiles(bb):
u_minmax, v_minmax = bb
# If the max is exactly on the integer boundary we allow it to be
# part of the tile of the previos integer so we can subtract one.
# But since we'll need to add one to iterate "up to" the maximum for
# the `range` function we will instead add one to the opposite cases.
@BigRoy
BigRoy / usdviewport_qt.py
Last active March 16, 2024 08:47
Example of how to embed a simple USD viewport in Qt application
"""
MIT License
Copyright (c) 2019 Roy Nieterau
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@BigRoy
BigRoy / maya_remove_CgAbBlastPanelOptChangeCallback.py
Created August 8, 2019 09:50
Little snippet to remove "CgAbBlastPanelOptChangeCallback" error from Maya scene - // Error: line 1: Cannot find procedure "CgAbBlastPanelOptChangeCallback". //
"""
This will iterate all modelPanels and remove the "CgAbBlastPanelOptChangeCallback"
As such, after running this the following error should be fixed:
// Error: line 1: Cannot find procedure "CgAbBlastPanelOptChangeCallback". //
"""
from maya import cmds
for model_panel in cmds.getPanel(typ="modelPanel"):
@BigRoy
BigRoy / resolve_get_media_pool_item_usage.py
Created February 28, 2024 16:51
Blackmagic Design Resolve Python API get all TimelineItems usage for a MediaPoolItem
def find_clip_usage(media_pool_item, project):
"""Return all Timeline Items in the project using the Media Pool Item.
Each entry in the list is a tuple of Timeline and TimelineItem so that
it's easy to know which Timeline the TimelineItem belongs to.
Arguments:
media_pool_item (MediaPoolItem): The Media Pool Item to search for.
project (Project): The resolve project the media pool item resides in.
@BigRoy
BigRoy / blender28_run_qt_ui.py
Created August 1, 2019 10:04
Simple example of running a Qt interface in Blender 2.8 without blocking Blender.
import bpy
from PyQt5 import QtWidgets
class QtModalOperator(bpy.types.Operator):
"""A base class for Operators that run a Qt interface."""
def modal(self, context, event):
if self._app:
@BigRoy
BigRoy / qt_qcolumnview_selection.py
Created March 8, 2017 14:14
Set QColumnView selection (and update the columns)
import sys
import os
from Qt import QtWidgets, QtCore, QtGui
def main():
app = QtWidgets.QApplication(sys.argv)
path = r"C:\test\subfolder\file.txt"