Skip to content

Instantly share code, notes, and snippets.

View PierrickKoch's full-sized avatar

Pierrick Koch PierrickKoch

View GitHub Profile
@PierrickKoch
PierrickKoch / scan_blend_ctrl.py
Last active December 14, 2015 04:29
Scan the game controllers from all objects in a Blender file
def scan():
for obj in bpy.data.objects:
for ctrl in obj.game.controllers:
print("# bpy.data.objects['%s'].game.controllers['%s']"%\
(obj.name, ctrl.name))
if ctrl.type == 'PYTHON' and ctrl.mode == 'MODULE' and \
ctrl.module.startswith('calling.'):
# TODO remove it
print("### module: %s"%ctrl.module)
@PierrickKoch
PierrickKoch / genom3.sh
Last active December 14, 2015 12:09
my install genom3
#
# http://robotpkg.openrobots.org/install.html
# http://robotpkg.openrobots.org/robotpkg-wip.html
#
# I use ${HOME} as root of both `robotpkg` and `openrobots`
# I already installed ROS Fuerte from .deb's in `/opt/ros/fuerte`
# and `source /opt/ros/fuerte/setup.bash` in my ~/.bashrc
#
# stuff robotpkg told me to install
@PierrickKoch
PierrickKoch / setup.sh
Last active December 14, 2015 13:09
some bash setup with cool PS1
#
# my bashrc
#
# ROS setup
#source ~/work/ros-addons/setup.bash
#source /opt/ros/groovy/setup.bash
source /opt/ros/fuerte/setup.bash
# Python CLI completion and history
set -g default-terminal "screen-256color"
set -g status-utf8 on
bind M source-file ~/.tmux/mac.session
bind L source-file ~/.tmux/linux.session
# set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# THEME
set -g status-bg black
@PierrickKoch
PierrickKoch / stl_scaler.py
Created March 8, 2013 14:38
import *.stl scale and pack in one total.blend
import os
import bpy
def process(filepath):
print("import %s"%filepath)
bpy.ops.import_mesh.stl(filepath=filepath)
for obj in bpy.context.selected_objects:
obj.scale = (.01, .01, .01)
print("done")
@PierrickKoch
PierrickKoch / bake-anim.sh
Created March 14, 2013 09:46
howto bake blender anim
blender --background ~/catmouse.blend --render-output ~/render/render --frame-start 481 --frame-end 3000 --render-anim&
avconv -i ~/render/render%04d.png -b 20M -r 30 out20.avi
@PierrickKoch
PierrickKoch / grasp.builder.py
Last active December 15, 2015 04:59
MORSE Builder : add Near sensor
from morse.builder import *
bpymorse.deselect_all()
bpymorse.add_object(type="EMPTY")
bpymorse.add_sensor(type="NEAR")
obj = bpymorse.get_context_object()
sensor = obj.game.sensors[-1]
sensor.name = "Near"
sensor.property = "Graspable"
sensor.distance = 0.10
@PierrickKoch
PierrickKoch / blend_mesh.py
Last active December 15, 2015 06:59
Blender 2.66 mesh bug
"""
Blender 2.66 mesh bug
EDIT: bug fixed on rev. r55483. by Dalai Felinto:
http://projects.blender.org/tracker/?func=detail&atid=306&aid=34550&group_id=9
This scipt gives:
mat 0 vert 9
@PierrickKoch
PierrickKoch / alert-web-diff.bash
Last active December 16, 2015 19:39
alert web diff
#!/bin/bash
[ -z "$1" ] && echo "usage: $0 URL [TIME]" && exit 1
[ -z "$2" ] && tempo=$2 || tempo=10
url=$1
fileA=`mktemp`
fileB=`mktemp`
wget $url -qO $fileA
import bpy
# for i in `find . -name "*.blend"`; do blender -P blend_save_compress.py -b $i; done
suffix = '.z.blend'
filepath = bpy.data.filepath + suffix
bpy.ops.wm.save_mainfile(filepath=filepath, check_existing=False, compress=True)
bpy.ops.wm.quit_blender()