Skip to content

Instantly share code, notes, and snippets.

View davidlatwe's full-sized avatar
:shipit:
Awesome

David Lai davidlatwe

:shipit:
Awesome
View GitHub Profile
@davidlatwe
davidlatwe / README.md
Created February 7, 2020 13:07
Weird Maya bug that involves referencing shared unknown nodes and threading

Maya version: 2018 update 6 OS: Windows 10

  1. Save those two .ma file in a folder.
  2. Open work.ma, it should have upstream.ma referenced.
  3. Execute the script crash.py.
  4. Save the scene and Maya will crash.
"""Testing generator that yields within a context and interrupt by error
Looks like the context is being closed by the python garbage collection if
error raised during the iteration.
https://stackoverflow.com/a/19825163/4145300
"""
import sys
from contextlib import contextmanager
@davidlatwe
davidlatwe / Xdummy
Last active September 2, 2021 18:44
Xdummy (-ldl added)
#!/bin/sh
# ----------------------------------------------------------------------
# Copyright (C) 2005-2011 Karl J. Runge <runge at-sign karlrunge.com>
# All rights reserved.
#
# This file is part of Xdummy.
#
# Xdummy is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
@davidlatwe
davidlatwe / allzpark_with_memory_profile.py
Created November 6, 2020 17:33
Testing Allzpark with memory-based package repository
import os
import sys
from rez.config import config as rezconfig
from allzpark import cli, allzparkconfig
os.environ["PATH"] += ";C:/Graphviz/bin"
# os.environ["ALLZPARK_NOTHREADING"] = "1"
os.environ["REZ_PACKAGES_PATH"] = os.pathsep.join([
"memory@any",
@davidlatwe
davidlatwe / mem_test.py
Last active November 6, 2020 23:57
Testing Rez's conflict resolve and package not found detailed message
import os
os.environ["REZ_PACKAGES_PATH"] = "memory@any"
def memory_repository(packages):
from rez.package_repository import package_repository_manager
repository = package_repository_manager.get_repository("memory@any")
@davidlatwe
davidlatwe / 123.py
Last active November 11, 2020 11:26
Monkey patch pymongo.auth for Houdini 18.5.351 to avoid "ValueError: unsupported hash type" when connecting MongoDB with Auth enabled (error raised on all version of MongoDB and all versions of PyMongo)
def patch():
import hmac
import hashlib
from pymongo import auth
def _hi(hash_name, data, salt, iterations):
"""A simple implementation of PBKDF2-HMAC.
This is grabed from pymongo.auth module
@davidlatwe
davidlatwe / mem_test.py
Created November 18, 2020 16:05
Testing Rez's package not found detailed message
import os
os.environ["REZ_PACKAGES_PATH"] = "memory@any"
def memory_repository(packages):
from rez.package_repository import package_repository_manager
repository = package_repository_manager.get_repository("memory@any")
'''
This plugin was ported to python from C++,
All credits by Anno Schachner
original plugin is here https://github.com/wiremas/tension
'''
import sys
import maya.api.OpenMaya as om2
import maya.OpenMaya as om
@davidlatwe
davidlatwe / pref_test.md
Last active April 19, 2021 12:28
Point Reference AOV 製程分析

Point Reference AOV

以下測試同一角色在不同 shot 的以不同方式製作 Point Reference 的差異 👇

方案一: 採用該角色在各 shot 第一格的狀態為參考

  • Shot A 的場景狀態

shotA_scene

@davidlatwe
davidlatwe / README.md
Last active May 20, 2021 17:31
Virtual env based python rez package (filesystem combined package)

Virtual env based python rez package

This is a combined package, which cannot be built but simply copying python.py into package repository. And it will provide clean, re-usable virtual env that created from system installed python that it could find.

$ rez-search python
python-2.7-venv
python-3.6-venv
python-3.7-venv
python-3.8-venv