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
#!/usr/bin/env sh | |
# A script that receives start and end parameters in the format HH:mm and | |
# exit with an error code if the current time is not within the desired | |
# window. | |
# The given times are not inclusive, so if you want 06:00-10:00 inclusive | |
# you need to specify 05:59 and 10:01 respectively. | |
# This script assumes that we are interested in time periods shorter than | |
# a single day, and it handles overnight periods. | |
# Inspired by https://unix.stackexchange.com/a/395936/305967 |
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 os | |
import sys | |
import bpy | |
output = None | |
input = None | |
info = None | |
error = None | |
write = None |
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 maya.api.OpenMaya as om | |
import pymel.core as pm | |
def intersect_mesh(pos, vec, mesh_name): | |
selectionList = om.MSelectionList() | |
selectionList.add(mesh_name) | |
dagPath = selectionList.getDagPath(0) | |
fnMesh = om.MFnMesh(dagPath) |
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 maya.OpenMaya as om | |
import maya.cmds as cmds | |
def getUvShelList(name): | |
selList = om.MSelectionList() | |
selList.add(name) | |
selListIter = om.MItSelectionList(selList, om.MFn.kMesh) | |
pathToShape = om.MDagPath() | |
selListIter.getDagPath(pathToShape) | |
meshNode = pathToShape.fullPathName() |
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
# colored stream handler for python logging framework (use the ColorStreamHandler class). | |
# | |
# based on: | |
# http://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output/1336640#1336640 | |
# how to use: | |
# i used a dict-based logging configuration, not sure what else would work. | |
# | |
# import logging, logging.config, colorstreamhandler | |
# |
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
''' | |
Exposes the MayaPyManager class, which is used to run instances of MayaPy with explict control over paths and environment variables. A Manager can run scripts, modules, or command strings in a separate MayaPy environment; results and errors are captured and returned. | |
Typical uses might be: | |
- running unit tests | |
- running a copy of Maya.standalone as a headless RPC server with StandaloneRPC https://github.com/theodox/standaloneRPC | |
- spawning multipe copies of maya to batch process files in parallel on a multi-core machine | |
- do any of the above on multiple maya versions concurrently |
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
""" | |
Simple demonstration of how to implement Server-sent events (SSE) in Python | |
using Bottle micro web-framework. | |
SSE require asynchronous request handling, but it's tricky with WSGI. One way | |
to achieve that is to use gevent library as shown here. | |
Usage: just start the script and open http://localhost:8080/ in your browser. | |
Based on: |