Skip to content

Instantly share code, notes, and snippets.

View BigRoy's full-sized avatar

Roy Nieterau BigRoy

View GitHub Profile
@BigRoy
BigRoy / ayon_python_api_create_folders_and_tasks.py
Created October 30, 2024 19:16
AYON simple create folders and task via Python API example
from ayon_core.pipeline import get_current_project_name
import ayon_api
from ayon_api.entity_hub import EntityHub
project_name = get_current_project_name()
hub = EntityHub(project_name)
for folder_name in ["asset1", "asset2"]:
folder_entity = hub.add_new_folder(
folder_type="Shot", # folder type must exist in project
@BigRoy
BigRoy / ayon_debug_print_all_pyblish_plugins_for_family.py
Created October 14, 2024 15:08
AYON Print all pyblish publish plugins targeting a particular 'family' of the publish instance (usually also the same as the product type)
from ayon_core.pipeline import registered_host
from ayon_core.pipeline.create import CreateContext
import pyblish.api
family = "pointcache"
host = registered_host()
context = CreateContext(host)
plugins = pyblish.api.plugins_by_family(context.publish_plugins, family)
for plugin in plugins:
@BigRoy
BigRoy / maya_shape_components_expand.md
Last active September 13, 2024 07:02
Maya shapes with components are returned as "transform.component"

When doing face assignments or other component members into a set and then query cmds.sets(my_set, query=True) you get the members like:

  • pCube1.f[0:4]

Instead of

  • pCubeShape1.f[0:4]

For whatever reason someone thought it would be nice to make it look as if the components are on the transform instead of shape. Does anyone know a maya command to expand that to the shape?

@BigRoy
BigRoy / ayon_publisher_report_json_to_time_spent.py
Created July 30, 2024 16:02
OpenPype / AYON publisher json report get timings printout in seconds
import json
path = r"C:\Users\User\Downloads\publish-report-240730-17-33.json"
with open(path, "r") as f:
data = json.load(f)
for plugin_data in data["plugins_data"]:
label = plugin_data["label"]
@BigRoy
BigRoy / ayon_set_version_status.py
Created July 23, 2024 23:14
AYON - Set status for versions
"""WARNING! Set random status for all your versions in the project."""
import random
from ayon_core.pipeline import get_current_project_name
from ayon_api import get_project, get_versions
from ayon_api.operations import OperationsSession
project_name = get_current_project_name()
@BigRoy
BigRoy / openpype_to_ayon_core.md
Last active August 29, 2024 16:03
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 / 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 / houdini_lop_get_houdini_editor_node_from_usd_shader.py
Created February 23, 2024 15:16
Houdini Solaris find the Houdini Editor Node for a Shader or Material in a Houdini Material Library
import os
import logging
from typing import List
import hou
import loputils
from pxr import Usd, UsdShade
log = logging.getLogger(__name__)
@BigRoy
BigRoy / houdini_lop_materiallibrary_get_material_to_houdini_node_mapping.py
Last active February 23, 2024 15:51
Houdini Solaris Material Library LOP get the USD Material Prim Path mapping to the Houdini Material node in the Material Library
import logging
from typing import Dict
import hou
log = logging.getLogger(__name__)
def get_material_library_paths(material_lib: hou.LopNode) -> Dict[str, str]:
"""Return Houdini material node path to USD path mapping
@BigRoy
BigRoy / houdini_lop_attributewrangle_reset_scale.py
Last active February 20, 2024 11:44
Houdini AttributeWrange LOP: remove any scaling - make sure primitive scale is {1, 1, 1}, for example useful for cameras.
// Remove any scaling from parent prims
matrix transform = usd_worldtransform(0, @primpath);
vector scale = cracktransform(0, 0, 2, {0, 0, 0}, transform);
if (scale != {1, 1, 1}) {
usd_addscale(0, @primpath, "remove_scale", 1 / scale);
}