Skip to content

Instantly share code, notes, and snippets.

View Fweeb's full-sized avatar

Jason van Gumster Fweeb

View GitHub Profile
@Fweeb
Fweeb / get_renderpath.markdown
Last active September 22, 2022 15:31
How I retrieve the render path from a .blend file

Getting the render path (or any variable) from a .blend file

Update: I posted a related question to the Blender StackExchange and got a very helpful response on how some of this information could be extracted from a .blend file without launching Blender. So while the technique I describe below works, it might be better to use the method described in the StackExchange answer.

When doing my work, sometimes I need to get information out of a .blend file. For example, I sometimes need to do batch image processing (renaming, file conversion, etc.) on my rendered output. There's not a nice way to just query the .blend file for that information. Sure, there's BAM and even the old blenderaid tools, but they're a bit heavy-handed if you don't have them installed. So here's the hacky solution I'm currently using.

The following line of bash assigns a RENDERPATH variable using a Frankencod

@Fweeb
Fweeb / blender-multi_gpu.markdown
Last active November 12, 2023 00:33
Rendering in Blender on a machine with multiple GPUs

Rendering in Blender on a machine with multiple GPUs

So here's the premise: For scenes that take around a minute or less to render, performance is actually worse if you render on all of the cards with a single instance of Blender. This is because (AFAIK) there's a bit of additional time necessary to collect the render results from each card and stitch them together. That time is a fixed short duration, so it's negligible on larger/longer render jobs. However, on shorter render jobs, the 'stitch time' has a much more significant impact.

I ran into this with a machine I render on that has 4 Quadro K6000s in it. To render animations, I ended up writing a few little scripts to facilitate launching 4 separate instances of Blender, each one tied to one GPU. Overall rendertime was much shorter with that setup than one instance of Blender using all 4 GPUs.

The setup works basically like this... I have a the following Python script (it can be anywhere on your hard drive, so long as you remember the path to it).

@Fweeb
Fweeb / lockview.py
Last active April 13, 2024 14:03
Blender add-on for exposing the 3D View's rotation locking feature
# ***** BEGIN GPL LICENSE BLOCK *****
#
#
# This program 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 your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@Fweeb
Fweeb / blender-pullbuild.sh
Last active August 29, 2015 14:27
From an already cloned Blender repo, pull in updates and rebuild
#!/bin/bash
# This script should be run from within your build directory (assuming cmake), e.g. ~/src/blender/build
cd ../blender
git pull --rebase
git submodule foreach git pull --rebase origin master
cd ../build
make $MAKEFLAGS
# make install
@Fweeb
Fweeb / forkicate.sh
Last active August 29, 2015 14:26
Steps to fork a github project
# THIS IS NOT MEANT TO BE A SCRIPT YOU ACTUALLY RUN.
####################################################
# Use these steps to work on a project fork on GitHub and create your own dev branch
# (this assumes that you've already created a fork through GitHub's interface)
cd ~/src # or where ever you keep your source code
git clone https://github.com/YourUser/project.git # Where "YourUser" is your username and "project" is your forked project
cd project
# Track the upstream project you forked from
@Fweeb
Fweeb / print-friendly.xml
Created July 23, 2015 09:59
"Print-Friendly" Blender theme used in Blender For Dummies, 3rd edition
<bpy>
<Theme>
<user_interface>
<ThemeUserInterface menu_shadow_fac="0.5"
menu_shadow_width="12"
icon_file=""
icon_alpha="1"
axis_x="#dc0000"
axis_y="#00dc00"
axis_z="#0000dc">