These are two scripts that Jakob wrote to send blender plugin files to another PC, and once they arrive, execute blender and have blender run that script.
I didn’t use this during my internship, but I’m 90% sure I might need something like this in the future.
watch_remote.sh
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PREVIOUS_DIR="$(pwd)"
cd "$DIR"
rebuild() {
SSH_A="user@pc"
SSH_CMD="ssh $SSH_A"
#ADDON_DIR="/Users/asuk/Documents/jakob/abc3d/abc3d"
ADDON_DIR="/Users/username/Library/Application Support/Blender/4.2/scripts/addons/abc3d"
BLENDER="/Applications/Blender.app/Contents/MacOS/Blender"
BLENDER_FILE="/Users/username/Documents/jakob/abc3d/fontfile_considerations/font_test_11_empty.blend"
echo "REBUILD $(date)"
$SSH_CMD rm -rf "$ADDON_DIR"/__pycache__
$SSH_CMD killall -9 Blender
rsync -raz --progress \
--exclude="__pycache__" \
--exclude="_vimrc_local.vim" \
--exclude="venv" \
--exclude="testing" \
--exclude="saviour.md" \
--exclude="requirements.txt" \
--exclude="*.swp" \
--exclude="*.swo" \
./abc3d/ "$SSH_A":"$ADDON_DIR"/
$SSH_CMD $BLENDER $BLENDER_FILE &!
}
export SHELL=/bin/bash
export -f rebuild
find ./abc3d -name '*.py' | entr -s "rebuild"
cd "$PREVIOUS_DIR"
watch.sh
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PREVIOUS_DIR="$(pwd)"
cd "$DIR"
rebuild() {
echo "REBUILD $(date)"
rm -rf ./abc3d/__pycache__
windowid=$(xdotool getactivewindow)
if [ -f ./blenderpid ];
then
kill -9 $(cat ./blenderpid)
rm ./blenderpid
else
# kill specific executable
#kill -9 "$(ps aux | grep "git/tools/blender_git/build_linux_v4.1/bin/blender" | head -1 | awk '{print $2}')"
killall -9 blender # whatever
fi
sleep 1
xdotool windowactivate $windowid
#if [ -f ./blenderpid ];
#then
#kill -9 $(cat ./blenderpid)
#rm ./blenderpid
#fi
#float ./run_blender.sh ./fontfile_considerations/font_test_9_bpytest.blend > ./blenderpid
}
export SHELL=/bin/bash
export -f rebuild
find ./abc3d -name '*.py' | entr -s "rebuild"
cd "$PREVIOUS_DIR"