Skip to content

Instantly share code, notes, and snippets.

View BigRoy's full-sized avatar

Roy Nieterau BigRoy

View GitHub Profile
@BigRoy
BigRoy / maya_get_shader_in_layer.py
Created June 11, 2019 12:30
For a specific shape or mesh get the assigned shader in a specific renderlayer without switching to that layer.
import maya.cmds as cmds
def get_shader_in_layer(node, layer):
"""Return the assigned shader in a renderlayer without switching layers.
This has been developed and tested for Legacy Renderlayers and *not* for
Render Setup.
Returns:
list: The list of assigned shaders in the given layer.
@BigRoy
BigRoy / publish_instances_on_farm.py
Created July 12, 2019 08:44
A Deadline job script that will trigger a Pyblish publish with only the instances by name defined in env. var. PYBLISH_ACTIVE_INSTANCES
try:
import logging
import pyblish.api
import pyblish.util
except ImportError as exc:
# Ensure Deadline fails by output an error that contains "Fatal Error:"
raise ImportError("Fatal Error: %s" % exc)
handler = logging.basicConfig()
@BigRoy
BigRoy / avalon_compare_alembic_hierarchy_diferences.py
Created July 30, 2019 13:08
An example gist that shows how to compare different the hierarchy paths between published Alembic files and print out the differences. This is a more elaborate example of a prototype I wrote here: https://github.com/getavalon/core/issues/101#issuecomment-516337513
from avalon import api
from avalon import io
import alembic.Abc
def get_alembic_paths(filename):
"""Return all full hierarchy paths from alembic file"""
# Normalize alembic path
path = os.path.normpath(filename)
@BigRoy
BigRoy / alembic_has_any_shapes.py
Last active July 31, 2019 17:09
Python script using Alembic api to detect whether an .abc file contains any shapes.
import alembic
def any_shapes_in_alembic(filename):
"""Return whether Alembic file contains any shape/geometry.
Arguments:
filename (str): Full path to Alembic archive to read.
Returns:
bool: Whether Alembic file contains geometry.
@BigRoy
BigRoy / avalon_dependencies_NodeGraphQt_prototype.py
Created August 6, 2019 13:29
A very quick and dirty simple prototype to showcase the NodeGraphQt as a possibility for visualizing input/output dependencies
import os
import sys
from NodeGraphQt import (
NodeGraph,
BaseNode,
)
from avalon import io, style
@BigRoy
BigRoy / maya_get_shader_overrides_in_renderlayer.py
Created June 11, 2019 09:05
Simple example of how to get shader assignment overrides in renderlayers in Maya. (This is built for renderlayers, *not!* for render setup)
import maya.cmds as cmds
def get_shader_overrides_in_renderlayer(layer):
"""Return shader assignment overrides in renderlayer"""
attr = "{layer}.outAdjustments".format(layer=layer)
indices = cmds.getAttr(attr, multiIndices=True)
overrides = {}
for index in indices:
@BigRoy
BigRoy / avalon_maya_host_ls_optimizations.py
Created September 26, 2019 17:33
Avalon Maya host ls() query optimization tests
from maya import cmds
import maya.api.OpenMaya as om
from avalon.pipeline import AVALON_CONTAINER_ID
import avalon.maya.pipeline
# Current implementation
ls = avalon.maya.pipeline._ls
@BigRoy
BigRoy / blender2019_conference.md
Last active October 25, 2019 09:31
Breakdown of Blender 2019 Live stream conference moments https://www.youtube.com/watch?v=ioAZgnSh7X4

Blender Conference 2019 - LIVE stream breakdown

Stream: https://www.youtube.com/watch?v=ioAZgnSh7X4

Below is a rough breakdown of moments/times of talks in the video. Feel free to comment with more thorough notes you might have taken during the talk or video. Plus, comments that include other timings of talks that are still missing are more than welcome!

Please be aware that most of these talks are also uploaded as separate videos to the Blender youtube channel almost instantly after the talk finishes. I'll link the title of each to the separate video. Here is the full playlist per video

@BigRoy
BigRoy / hou18_solaris_python_addremove_usd_outputprocessors.py
Created January 29, 2020 02:34
Houdini 18 Solaris Add and Remove USD Rop node Output Processors with Python
import contextlib
import hou
def add_output_processor(ropnode, processor):
"""Add USD Output Processor to USD Rop node.
Args:
ropnode (hou.RopNode): The USD Rop node.
processor (str): The output processor name. This is the basename of
the python file that contains the Houdini USD Output Processor.
@BigRoy
BigRoy / maya_renderlayer_fix_unable_to_duplicate.py
Created August 28, 2019 16:55
Fix Maya legacy renderlayer being unable to duplicate (it doesn't show up correctly, but it does create a new renderLayer node visible when Show DAG nodes only is disabled)
# Fix Maya bug where you cannot duplicate a renderlayer correctly bug
# This is with Legacy Renderlayers, not Render Setup.
# Bug has been found in both Maya 2018 + 2019
import maya.cmds as mc
# Recreate all renderlayer overrides (.adjustments)
for layer in mc.ls(type="renderLayer"):
attr = layer + ".adjustments"