Skip to content

Instantly share code, notes, and snippets.

View K240-zz's full-sized avatar

Hideki Suzuki K240-zz

View GitHub Profile
@K240-zz
K240-zz / export_chan.py
Created July 18, 2018 05:00
Export Nuke chan
import pymel.core as pm
import math
def exportCameraChan(obj, st, ed, filename):
bt = pm.currentTime( query=True )
fd = open(filename, 'wt')
@K240-zz
K240-zz / PMVC wrangle
Created February 17, 2016 20:18
Houdini PMVC deformer
int npoints = npoints(1);
vector cagePos = {0};
int success;
float w[] = pointattrib(0, "PMVCweights", @ptnum, success);
if (success)
{
@K240-zz
K240-zz / LoadHipFile.py
Last active December 10, 2015 08:25
hou.hipFile.loadの不具合対策 for Windows
import os
import hou
def LoadHipFile(filename):
path = os.path.dirname(os.path.abspath(filename)).replace("\\", '/')
hou.hscript('set HIP='+path)
return hou.hipFile.load(os.path.basename(filename))
@K240-zz
K240-zz / python_startup.ms
Last active November 5, 2015 10:08
startup for python
print "Setting for python"
pythonpath = #(
-- add your python path.
@"d:\dev\3dsmax\python\lib"
)
for p in pythonpath do
(
format "add python path:%\n" p
@K240-zz
K240-zz / execute_python
Created November 5, 2015 09:51
execute python from file instead of python.executeFile
fn execute_python filename =
(
try
(
fd = openFile filename mode:"r"
seek fd #eof
maxlen=filepos fd
seek fd 0
code = readChars fd maxlen errorAtEOF:false
close fd
void setStyle( QApplication* app, QWidget* mainwindow )
{
app->setStyle( QString("plastique") );
QPalette pal = app->palette();
pal.setColor(QPalette::Window, QColor(0x32,0x32,0x32) );
pal.setColor(QPalette::WindowText, QColor(0xc2,0xc2,0xc2));
pal.setColor(QPalette::Base, QColor(0x1a,0x1a,0x1a) );
pal.setColor(QPalette::AlternateBase, QColor(0x22,0x22,0x22) );
@K240-zz
K240-zz / gist:1d32bbe18f57af5f8bc9
Last active August 29, 2015 14:15
How to access Ramp by python
node_name = '/obj/geo1/null1'
ramp_name = 'color'
n = hou.node(node_name)
ramp = n.parm(ramp_name).evalAsRamp()
for i in range(len(ramp.keys())):
# Position
# get
pos = n.parm('%s%dpos' % (ramp_name, i+1)).eval()
# set
n.parm('%s%dpos' % (ramp_name, i+1)).set(pos * 0.5)
@K240-zz
K240-zz / gist:5450389
Created April 24, 2013 07:48
Import from any path
def import_path(fullpath):
"""
Import a file with full path specification. Allows one to
import from anywhere, something __import__ does not do.
"""
path, filename = os.path.split(fullpath)
filename, ext = os.path.splitext(filename)
sys.path.append(path)
module = __import__(filename)
reload(module) # Might be out of date
#include "mainwindow.h"
#include <QApplication>
#include <QStyleFactory>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setStyle( QStyleFactory::create("fusion") );
MainWindow w;
w.setStyleSheet(
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setStyle( "Fusion");
MainWindow w;
w.setStyleSheet(
"font-family: \"Verdana\";"