auts: add misc files
This commit is contained in:
parent
0b4532f516
commit
e3ed1e70ec
Binary file not shown.
|
@ -0,0 +1,18 @@
|
|||
import bpy
|
||||
import sys
|
||||
import os
|
||||
|
||||
print("->", sys.argv)
|
||||
print("export active scene name")
|
||||
|
||||
tmpdir = "/tmp/object_renderer"
|
||||
if not os.path.exists(tmpdir):
|
||||
os.mkdir(tmpdir)
|
||||
|
||||
f = open(tmpdir + "/" + "scene_name.txt", "w")
|
||||
#f.write("test\n")
|
||||
f.write(bpy.context.scene.name + "\n")
|
||||
#f.write("\n")
|
||||
f.close()
|
||||
|
||||
print("done")
|
|
@ -0,0 +1,97 @@
|
|||
#!/bin/bash
|
||||
|
||||
src=$1
|
||||
dst=`realpath $2`
|
||||
tmpf=/tmp/t.png
|
||||
|
||||
yOffset=""
|
||||
|
||||
rm -f $tmpf
|
||||
mkdir $dst
|
||||
cd $src
|
||||
|
||||
for f in 0*.png; do
|
||||
|
||||
# Calculate top extent from center
|
||||
convert -crop 100%x50%+0+0 $f $tmpf
|
||||
convert -trim $tmpf $tmpf
|
||||
top_ext=`identify -format "%h" $tmpf`
|
||||
echo "top_ext: $top_ext"
|
||||
#exit
|
||||
|
||||
# Calculate bottom extent from center
|
||||
magick $f -crop "100%x50%+0+%[fx:h*0.5]" $tmpf
|
||||
convert -trim $tmpf $tmpf
|
||||
bottom_ext=`identify -format "%h" $tmpf`
|
||||
echo "bottom_ext: $bottom_ext"
|
||||
|
||||
max_ext=""
|
||||
if (( $top_ext > $bottom_ext )); then
|
||||
max_ext=$top_ext
|
||||
else
|
||||
max_ext=$bottom_ext
|
||||
fi
|
||||
echo "max_ext: $max_ext"
|
||||
|
||||
# Center image
|
||||
#magick $f -crop "%[fx:$max_ext*2]x%[fx:$max_ext*2]+%[fx:w/2 - $max_ext]+%[fx:h/2 - $max_ext]" $tmpf
|
||||
#cp $tmpf $dst/$f
|
||||
#continue
|
||||
#exit
|
||||
|
||||
convert -trim $f $dst/$f
|
||||
img_w=`identify -format "%w" $dst/$f`
|
||||
img_h=`identify -format "%h" $dst/$f`
|
||||
echo "img_w: $img_w"
|
||||
echo "img_h: $img_h"
|
||||
|
||||
#if (( $img_h > $img_w )); then
|
||||
#
|
||||
#fi
|
||||
|
||||
if [[ "$yOffset" -eq "" ]]; then
|
||||
yOffset=$top_ext
|
||||
#echo $yOffset
|
||||
#exit
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
cd $dst
|
||||
montage -mode concatenate 0*.png -background none out_concat.png
|
||||
#montage -geometry +0+0 0*.png -background none out.png
|
||||
|
||||
max_w=`identify -format "%w %h %fn\n" 0*.png | sort -n -r -k 1 | cut -d ' ' -f 1 | head -n 1`
|
||||
max_h=`identify -format "%w %h %fn\n" 0*.png | sort -n -r -k 2 | cut -d ' ' -f 2 | head -n 1`
|
||||
|
||||
echo "max_w: $max_w"
|
||||
echo "max_h: $max_h"
|
||||
|
||||
max_val=""
|
||||
|
||||
if (( $max_w > $max_h )); then
|
||||
max_val=$max_w
|
||||
else
|
||||
max_val=$max_h
|
||||
fi
|
||||
|
||||
echo "max_val: $max_val"
|
||||
|
||||
#montage -geometry ${max_w}x${max_h}+0+0 0*.png -background none out.png
|
||||
montage -geometry ${max_val}x${max_val}\>+0+0 0*.png -background none -depth 8 out.png
|
||||
montage -geometry ${max_val}x${max_val}\>+0+0 0*.png -background none -depth 16 out_16.png
|
||||
|
||||
# Optimize 16 bit (depth)
|
||||
convert -background white -alpha Remove -depth 11 out_16.png out_16_opt.png
|
||||
#optipng -o7 out_16_opt.png
|
||||
zopflipng -m out_16_opt.png -y out_16_opt.png
|
||||
|
||||
echo ".info:"
|
||||
echo ""
|
||||
echo "originOffsetY=$yOffset"
|
||||
echo ""
|
||||
echo "max_w=$max_w"
|
||||
echo "max_h=$max_h"
|
||||
echo ""
|
||||
|
||||
echo "done"
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
background=""
|
||||
#background="--background"
|
||||
blender=blender-2.7
|
||||
|
||||
|
||||
#$blender "$1" $background --python render.py
|
||||
|
||||
|
||||
# Export active scene's name
|
||||
$blender "$1" -b --python export_scene_name.py #&& true
|
||||
scene_name=`cat /tmp/object_renderer/scene_name.txt | tr -d '\n'`
|
||||
|
||||
|
||||
$blender res/render_scene.blend $background --python render.py -- "$1" "$scene_name"
|
|
@ -0,0 +1,36 @@
|
|||
import bpy
|
||||
import sys
|
||||
import os
|
||||
|
||||
print("->", sys.argv)
|
||||
argv = sys.argv
|
||||
argv = argv[argv.index("--") + 1:] # get all args after "--"
|
||||
|
||||
in_filename = os.path.basename(argv[0])
|
||||
in_path = os.path.abspath(argv[0])
|
||||
in_scene_name = argv[1]
|
||||
|
||||
print("in_filename:", in_filename)
|
||||
print("in_path:", in_path)
|
||||
print("in_scene_name:", in_scene_name)
|
||||
|
||||
filepath = in_filename
|
||||
#directory = in_path + "\\Object\\"
|
||||
#filename = "Cube"
|
||||
directory = in_path + "\\Scene\\"
|
||||
filename = in_scene_name
|
||||
|
||||
print("filepath:", filepath)
|
||||
print("directory:", directory)
|
||||
print("filename:", filename)
|
||||
|
||||
|
||||
bpy.ops.wm.append(
|
||||
filepath=filepath,
|
||||
directory=directory,
|
||||
filename=filename)
|
||||
|
||||
#bpy.ops.wm.append(
|
||||
# filepath="box.blend",
|
||||
# directory="/home/k/dev/mrs/tools/object_renderer/testdata/box.blend\\Object\\",
|
||||
# filename="Cube")
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
isotest/tools/object_renderer/testdata/building1.blend (Stored with Git LFS)
vendored
Normal file
BIN
isotest/tools/object_renderer/testdata/building1.blend (Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
isotest/tools/object_renderer/testdata/building2.blend (Stored with Git LFS)
vendored
Normal file
BIN
isotest/tools/object_renderer/testdata/building2.blend (Stored with Git LFS)
vendored
Normal file
Binary file not shown.
Loading…
Reference in New Issue