# Blender render settings
# FYI : only uses default "Scene"
import bpy
FILEFORMAT='FFMPEG' # 'PNG'
#bpy.data.scenes[my_scene_name_here].file_format = 'H264'
#bpy.data.scenes[my_scene_name_here].format = 'H264'
#bpy.data.scenes[my_scene_name_here].use_lossless_output = True
OUTPUTFILENAME='/home/rednuht/temp/'
bpy.context.scene.render.resolution_x = 1920
bpy.context.scene.render.resolution_y = 1080
bpy.context.scene.render.resolution_percentage = 25
bpy.context.scene.frame_start = 1
bpy.context.scene.frame_end = 360
bpy.context.scene.frame_step = 1
bpy.context.scene.render.pixel_aspect_x = 1
bpy.context.scene.render.pixel_aspect_y = 1
bpy.context.scene.render.use_file_extension = True
bpy.context.scene.render.image_settings.color_mode ='RGB'
bpy.context.scene.render.image_settings.file_format=FILEFORMAT
bpy.context.scene.render.image_settings.compression = 90
#bpy.context.scene.render.use_stamp = 1
#bpy.context.scene.render.stamp_background = (0,0,0,1)
bpy.context.scene.render.use_antialiasing = True
##sampling;=path tracing
bpy.context.scene.cycles.progressive = 'PATH'
bpy.context.scene.cycles.samples = 50
bpy.context.scene.cycles.max_bounces = 1
bpy.context.scene.cycles.min_bounces = 1
bpy.context.scene.cycles.glossy_bounces = 1
bpy.context.scene.cycles.transmission_bounces = 1
bpy.context.scene.cycles.volume_bounces = 1
bpy.context.scene.cycles.transparent_max_bounces = 1
bpy.context.scene.cycles.transparent_min_bounces = 1
bpy.context.scene.cycles.use_progressive_refine = True
#Render results
#bpy.ops.render.render(write_still=True)
bpy.ops.render.render(animation=True)
bpy.context.scene.layers[0] = True
bpy.ops.object.mode_set(mode='OBJECT')
cameras=(Camera.top Camera.bottom)
materials=(LL_WireTrans LL_WireHold LL_Clay LL_Glass)
SOURCE=/home/rednuht/projects/blender/Raspberry\ Pi\ 3\ Model\ B\ HiRes/circuitboard22.blend
NAME=C022
LAYERS=0
for cam in ${cameras[@]}; do
for mat in ${materials[@]}; do
./blender --background "$SOURCE" --python ~/projects/blender/camera\ track\ endevour/track.py --python ~/projects/blender/camera\ track\ endevour/materials.py --python ~/projects/blender/camera\ track\ endevour/setup.py -noaudio --python ~/projects/blender/camera\ track\ endevour/render.py -- -c "$cam" -m "$mat" -n "$NAME" -l "$LAYERS"
done
./blender --background "$SOURCE" --python ~/projects/blender/camera\ track\ endevour/track.py --python ~/projects/blender/camera\ track\ endevour/materials.py --python ~/projects/blender/camera\ track\ endevour/setup.py -noaudio --python ~/projects/blender/camera\ track\ endevour/render.py -- -c "$cam" -n "$NAME" -l "$LAYERS"
done
import bpy, math
print("Camera tracking script starting")
TARGET="Empty.target"
TRACK="Curve.camera.track"
CAMERATOP="Camera.top"
CAMERABOTTOM="Camera.bottom"
TRACKSIZE=11
bpy.context.scene.layers[0] = True
# Create empty(camera target)
bpy.ops.object.empty_add(type='SPHERE', view_align=False, location=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.context.object.name = TARGET
# Create camera track curve
bpy.ops.curve.primitive_bezier_circle_add(radius=1, view_align=False, enter_editmode=False, location=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.context.object.name = TRACK
bpy.context.object.scale[1] = TRACKSIZE
bpy.context.object.scale[2] = TRACKSIZE
bpy.context.object.scale[0] = TRACKSIZE
# Create Top camera
bpy.ops.object.camera_add(view_align=True, enter_editmode=False, location=(0, 0, 0), rotation=(0,0,0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.context.object.name = CAMERATOP
# Parent to camera track
bpy.data.objects[TRACK].select = True
bpy.context.scene.objects.active = bpy.data.objects[TRACK]
bpy.ops.object.parent_set(type='OBJECT', keep_transform=False)
bpy.data.objects[TRACK].select = False
bpy.context.scene.objects.active = bpy.data.objects[CAMERATOP]
bpy.context.object.location[1] = 0-TRACKSIZE # Y
bpy.context.object.location[2] = 3 # Z
# Create tracking constraint
bpy.ops.object.constraint_add(type='LOCKED_TRACK')
bpy.context.object.constraints["Locked Track"].target = bpy.data.objects[TARGET]
bpy.context.object.constraints["Locked Track"].track_axis = 'TRACK_NEGATIVE_Z'
bpy.context.object.constraints["Locked Track"].lock_axis = 'LOCK_X'
# Create Bottom camera
bpy.ops.object.duplicate()
bpy.context.object.name = CAMERABOTTOM
bpy.context.object.location[2] = -3 # Z
bpy.data.objects[CAMERABOTTOM].select = False
# Create orbit animation
bpy.data.objects[TRACK].select = True
bpy.data.objects[TRACK].keyframe_insert(data_path='rotation_euler', frame=(bpy.context.scene.frame_current))
bpy.context.scene.frame_end = 360
bpy.context.scene.frame_current = 360
bpy.data.objects[TRACK].rotation_euler = ( 0, 0, math.radians(359) )
bpy.data.objects[TRACK].keyframe_insert(data_path='rotation_euler', frame=(bpy.context.scene.frame_current))
# Set interpolation
for fc in bpy.data.objects[TRACK].animation_data.action.fcurves:
fc.extrapolation = 'LINEAR'
for kp in fc.keyframe_points:
kp.interpolation = 'LINEAR'
print("Camera tracking script finished setup")
bpy.context.scene.layers[0] = True
# Create empty(camera target)
bpy.ops.object.empty_add(type='SPHERE', view_align=False, location=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.context.object.name = TARGET
# Create camera track curve
bpy.ops.curve.primitive_bezier_circle_add(radius=1, view_align=False, enter_editmode=False, location=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.context.object.name = TRACK
bpy.context.object.scale[1] = TRACKSIZE
bpy.context.object.scale[2] = TRACKSIZE
bpy.context.object.scale[0] = TRACKSIZE
# Create Top camera
bpy.ops.object.camera_add(view_align=True, enter_editmode=False, location=(0, 0, 0), rotation=(0,0,0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.context.object.name = CAMERATOP
# Parent to camera track
bpy.data.objects[TRACK].select = True
bpy.context.scene.objects.active = bpy.data.objects[TRACK]
bpy.ops.object.parent_set(type='OBJECT', keep_transform=False)
bpy.data.objects[TRACK].select = False
bpy.context.scene.objects.active = bpy.data.objects[CAMERATOP]
bpy.context.object.location[1] = 0-TRACKSIZE # Y
bpy.context.object.location[2] = 3 # Z
# Create tracking constraint
bpy.ops.object.constraint_add(type='LOCKED_TRACK')
bpy.context.object.constraints["Locked Track"].target = bpy.data.objects[TARGET]
bpy.context.object.constraints["Locked Track"].track_axis = 'TRACK_NEGATIVE_Z'
bpy.context.object.constraints["Locked Track"].lock_axis = 'LOCK_X'
# Create Bottom camera
bpy.ops.object.duplicate()
bpy.context.object.name = CAMERABOTTOM
bpy.context.object.location[2] = -3 # Z
bpy.data.objects[CAMERABOTTOM].select = False
--debug-wm
# Set interpolation
for fc in bpy.data.objects[TRACK].animation_data.action.fcurves:
fc.extrapolation = 'LINEAR'
for kp in fc.keyframe_points:
kp.interpolation = 'LINEAR'
import bpy
import sys # to get command line args
import argparse # to parse options for us and print a nice help message
# argument parsing code from https://developer.blender.org/diffusion/B/browse/master/release/scripts/templates_py/background_job.py
def main():
import sys # to get command line args
import argparse # to parse options for us and print a nice help message
# get the args passed to blender after "--", all of which are ignored by
# blender so scripts may receive their own arguments
argv = sys.argv
if "--" not in argv:
argv = [] # as if no args are passed
else:
argv = argv[argv.index("--") + 1:] # get all args after "--"
# When --help or no args are given, print this help
usage_text = (
"Run blender with this script:"
" blender --python " + __file__ + " -- [options]"
)
parser = argparse.ArgumentParser(description=usage_text)
# Possible types are: string, int, long, choice, float and complex.
parser.add_argument("-m", "--material", dest="material", type=str, required=False,
help="This material will be used for the render layers")
parser.add_argument("-l", "--layers", dest="layers", type=str, required=False,
help="This comma separated list of layer numbers defines which are the render layers")
parser.add_argument("-c", "--camera", dest="camera", type=str, required=False,
help="Camera to set active")
args = parser.parse_args(argv) # In this example we wont use the args
if not argv:
parser.print_help()
return
# Run the example function
#example_function(args.text, args.save_path, args.render_path)
print("setting up")
# Set layers
if args.layers :
print("--layers", args.layers)
layerarray=args.layers.split(',')
for i in range(len(bpy.context.scene.layers)) :
if str(i) in layerarray :
bpy.context.scene.layers[i]=True
else :
bpy.context.scene.layers[i]=False
# Set render material
if args.material:
print("--material", args.material)
if args.material in bpy.data.materials :
bpy.context.scene.render.layers["RenderLayer"].material_override = bpy.data.materials[args.material]
# set camera
if args.camera:
print("--camera", args.camera)
if args.camera in bpy.data.objects :
bpy.context.scene.camera = bpy.data.objects[args.camera]
print("set up complete")
# call main function
main()
1,3,9
import bpy
print("Material library script starting")
# Load materials
bpy.ops.wm.link(filepath="/home/user/camera track endevour/materiallibrary.blend/Material/LL_WireTrans", directory="/home/user/camera track endevour/materiallibrary.blend/Material/", filename="LL_WireTrans", files=[{"name":"LL_Clay", "name":"LL_Clay"}, {"name":"LL_Glass", "name":"LL_Glass"}, {"name":"LL_WireHold", "name":"LL_WireHold"}, {"name":"LL_WireTrans", "name":"LL_WireTrans"}], relative_path=True)
print("Material library script finished")
--debug-wm
--debug-all
blender my.blend --python myscript.py
blender my.blend --python myscript1.py --python myscript2.py
blender my.blend --python myscript1.py --python myscript2.py -- --my-parameter "myvalue"
egrep pubDate scripts/f-log/rss/flog.xml | egrep -o "20[0-9][0-9]" | uniq -c
73 2017
60 2016
61 2015
64 2014
50 2013
32 2012
21 2011
70 2010
45 2009
101 2008
106 2007
email
root
flog archives
Disclaimer:
This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk
I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk
In fact I'm not responsible for anything ever, so there!