Skip to content

Instantly share code, notes, and snippets.

@jmacey
jmacey / dumObj.py
Created January 16, 2024 09:17
Dump all top level groups to obj
# work in progress dump scene to individual obj needs some error checking etc.
import maya.OpenMaya as OpenMaya
# Assume 'selected_group' is the name of the selected group
selected_group = 'kitchen_group'
# Create a selection list
selection_list = OpenMaya.MSelectionList()
selection_list.add(selected_group)
@jmacey
jmacey / rsync.cmd
Created February 23, 2021 11:54
rsync.cmd
@echo off
SETLOCAL
SET CWRSYNCHOME=%HOMEDRIVE%\%HOMEPATH%\cwrsync
SET HOME=%HOMEDRIVE%\%HOMEPATH%\
SET CWOLDPATH=%PATH%
SET PATH=%CWRSYNCHOME%\bin;%PATH%
rsync.exe %*
@jmacey
jmacey / point find
Created December 14, 2020 20:21
Point Find
#include <iostream>
#include <random>
#include <numeric>
std::random_device rd;
std::mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd()
std::uniform_real_distribution<float> dis(-100.0f, 100.0f);
struct Point
{
@jmacey
jmacey / bashrc
Last active September 24, 2019 10:03
NCCA .bashrc
source /etc/profile.d/prompt.sh
alias E='/opt/code/bin/code -r'
alias vdiff='/opt/code/bin/code -d '
alias ls='ls --color'
alias ll='ls -al'
alias rm='rm -i'
export PATH=$PATH:/public/bin/2019:$HOME/scripts:/public/devel/2019/bin
export PATH=/opt/qt/5.12.3/gcc_64/bin:/opt/qt/Tools/QtCreator/bin:$PATH
export PYTHONPATH=$PYTHONPATH:$HOME/NGL/lib:/public/devel/2018/lib64/python2.7/site-packages/
Outside of function put
constexpr auto normalShader="normalShader";
in initializeGL put
shader->createShaderProgram(normalShader);
shader->attachShader("normalVertex",ngl::ShaderType::VERTEX);
shader->attachShader("normalFragment",ngl::ShaderType::FRAGMENT);
shader->attachShader("normalGeo",ngl::ShaderType::GEOMETRY);
@jmacey
jmacey / HoudiniRotate.py
Last active July 11, 2018 17:10
Code for my Houdini Rotation Demo
# import math so we can use cos and sin
import math
# these are generated by houdini and give us access to the current node.
node = hou.pwd()
geo = node.geometry()
# create a 4x4 matrix, passing in 1 creates it as the identity matrix
rotX=hou.Matrix4(1)
# which is the same as calling
# rotX.setToIdentity()
@jmacey
jmacey / bash colours
Last active October 4, 2016 20:19
Sample Defines for adding colours to the bash shell as used in my lectures
# more colours here http://misc.flogisoft.com/bash/tip_colors_and_formatting
# Add this to your .bashrc and use in the PS2 prompt
RED='\e[31m'
GREEN='\e[32m'
DEFAULT='\e[39m'
BLACK='\e[30m'
YELLOW='\e[33m'
BLUE='\e[34m'
MAGENTA='\e[35'
CYAN='\e[36m'
@jmacey
jmacey / Basic Qt Project
Created September 18, 2014 21:58
Basic Qt Project
# This specifies the exe name
TARGET=SimpleNGL
# where to put the .o files
OBJECTS_DIR=obj
# core Qt Libs to use add more here if needed.
QT+=gui opengl core
# as I want to support 4.8 and 5 this will set a flag for some of the mac stuff
# mainly in the types.h file for the setMacVisual which is native in Qt5
isEqual(QT_MAJOR_VERSION, 5) {