Commit d1bda796 authored by Breno Rilho Lemos's avatar Breno Rilho Lemos 💬

Removed unnecessary argument 'cameras' passed on to 'animate_particles.py'

parent 225d5747
......@@ -2,7 +2,7 @@
# animate_particles.py - Animate HEP events
#
# For console only rendering (example):
# $ blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=1 -cameras="BarrelCamera OverviewCamera" \
# $ blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=1 \
# -datafile="esd-detail.dat" -n_event=0 -simulated_t=0.02 -fps=24 -resolution=100 -transparency=1.2 -stamp_note="Texto no canto"\
# -its=1 -tpc=0 -trd=1 -detailed_tpc=1 -emcal=0 -blendersave=0 -picpct=5 -tpc_blender_path="/home/files/blender" -output_path="/tmp/blender"
#
......@@ -30,7 +30,6 @@ parser = ArgumentParserForBlender()
parser.add_argument('-radius','--r_part')
parser.add_argument('-duration','--duration')
parser.add_argument('-cameras','--render_cameras')
parser.add_argument('-datafile','--datafile')
parser.add_argument('-simulated_t','--simulated_t')
parser.add_argument('-fps','--fps')
......@@ -69,23 +68,6 @@ blendersave = int(args.blendersave) # 1 (save Blender file) or 0 (don't)
picpct = int(args.picpct) # percentage of animation to take picture
tpc_blender_path = str(args.tpc_blender_path) # path to 'animate' directory, where .blend file for detailed TPC is saved
# Create array with cameras:
cams_string = str(args.render_cameras)
cams_list = []
j=0
last_space=0
for digit in range(0,len(cams_string)):
if cams_string[digit] == ' ':
cam = ""
for i in range(j,digit):
cam += cams_string[i]
cams_list.append(cam)
j=digit+1
cam = ""
for i in range(j,len(cams_string)):
cam += cams_string[i]
cams_list.append(cam)
# Configure Output
outputPath = str(args.output_path)+"/"
fileIdentifier = "PhysicalTrajectories_"
......@@ -97,12 +79,12 @@ saveBlenderFile = blendersave # False
# Create and configure animation driver
n_particles = 100 # Event Multiplicity
driver = genDriver("GaussianGenerator",n_particles,3.0) # Simple genDriver takes two parameters: number of particles and Gaussian width
driver.configure(cams_list, duration, fps, simulated_t, outputPath, fileIdentifier, resolution_percent)
driver.configure(duration, fps, simulated_t, outputPath, fileIdentifier, resolution_percent)
"""
# Create and configure animation driver
driver = dataDriver("AlirootFileGenerator",n_event,datafile) # Simple dataDriver
driver.configure(cams_list, duration, fps, simulated_t, outputPath, fileIdentifier, resolution_percent)
driver.configure(duration, fps, simulated_t, outputPath, fileIdentifier, resolution_percent)
### Build scene
init(stamp_note,transp_par,detectors,tpc_blender_path) # Cleanup, addCameras, addALICE_TPC
......
......@@ -11,8 +11,7 @@ exec(compile(open(filename).read(), filename, 'exec'))
class animationDriver:
def __init__(self,name):
self.name = name
def configure(self, renderCameras, duration, fps, simulated_t, outputPath, fileIdentifier, resolution_percent=100):
self.renderCameras=renderCameras # array with cameras to render animation with
def configure(self, duration, fps, simulated_t, outputPath, fileIdentifier, resolution_percent=100):
self.duration=duration # total video duration in seconds
self.fps=fps
self.simulated_t=simulated_t # total simulated time in microseconds. (0.01 -> light travels ~ 3 m)
......@@ -26,25 +25,6 @@ class animationDriver:
bcs.frame_start = 0
bcs.frame_end = self.N_frames
def render(self,pic_pct):
bcs = bpy.context.scene
self.output_prefix=[]
for c in range(0,len(self.renderCameras)):
# Set specific output info
self.output_prefix.append(self.fileIdentifier+str(self.xpixels)+"px_"+self.name+self.renderCameras[c])
bcs.render.filepath = "/tmp/alice_blender/"+self.output_prefix[c]
bcs.camera = bpy.data.objects[self.renderCameras[c]]
# Take picture of animation
bcs.frame_current = int(bcs.frame_end * pic_pct/100)
bpy.ops.render.render()
bpy.data.images['Render Result'].save_render(filepath=bcs.render.filepath+".png")
# Render actual animation
bpy.ops.render.render(animation=True)
def configureOutput(self):
# Configure Output
bcsr = bpy.context.scene.render
......
......@@ -556,7 +556,7 @@ elif [ "$SAMPLE" = "false" ]; then
timestamp "${UNIQUEID}, ${EVENT_ID}, SCENE, STARTING, $NUMBER_OF_PARTICLES" >> $PROGRESS_LOG
blender -noaudio --background -P animate_particles.py -- -radius=0.05 \
-duration=${DURATION} -cameras="${CAMERAS}" -datafile="${LOCAL_FILE_WITH_DATA}"\
-duration=${DURATION} -datafile="${LOCAL_FILE_WITH_DATA}"\
-n_event=${EVENT_ID} -simulated_t=0.03 -fps=${FPS} -resolution=${RESOLUTION}\
-transparency=${TRANSPARENCY} -stamp_note="${EVENT_UNIQUE_ID}" -its=${ITS}\
-tpc=${TPC} -trd=${TRD} -emcal=${EMCAL} -detailed_tpc=${DETAILED_TPC} \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment