def end_card(self): cues = self.subscenes scene_end = self.duration bpy.ops.mesh.primitive_plane_add() play_bar = bpy.context.object play_bar.scale[0] = 15 play_bar.scale[1] = 90 / 720 * 8.4 play_bar.location = [0, -8.4 + play_bar.scale[1], -0.01] bpy.ops.mesh.primitive_plane_add() vid_rec = bpy.context.object vid_rec.scale[0] = 410 / 1280 * 15 vid_rec.scale[1] = 230 / 720 * 8.4 vid_rec.location = [9, -3, -0.01] apply_material(vid_rec, 'color6') bpy.ops.mesh.primitive_cylinder_add() sub_cir = bpy.context.object sub_cir.scale = [98 / 1280 * 30, 98 / 1280 * 30, 0] sub_cir.location = [-11, 3.2, -0.01] #Whole end area bpy.ops.mesh.primitive_plane_add() end_area = bpy.context.object end_area.scale[0] = 1225 / 1280 * 15 end_area.scale[1] = 518 / 720 * 8.4 end_area.location = [0, 0.2, -0.15] logo = svg_bobject.SVGBobject( "Layer", #file_name = "PrimerLogoWhite", location=(-8.7, 3, 0), scale=1.4) for bobj in logo.rendered_curve_bobjects: apply_material(bobj.ref_obj.children[0], 'color2') stroke = logo.rendered_curve_bobjects[0] apply_material(stroke.ref_obj.children[0], 'color3') logo.morph_chains[0][0].ref_obj.location[2] = -1 logo.add_to_blender( appear_time=cues['card']['start'], #subbobject_timing = [90, 30, 40, 50, 60, 70, 80], subbobject_timing=[42, 30, 33, 36, 39, 42, 45], animate=True) patreon = import_object('patreon', 'svgblend', scale=2.297, location=(-11, -3, 0), name='Patreon') patreon.add_to_blender(appear_time=0) thanks = tex_bobject.TexBobject('\\text{Special thanks:}', location=[-8.35, -1.4, 0], color='color2') thanks.add_to_blender(appear_time=0) js = tex_bobject.TexBobject('\\text{Jordan Scales}', location=[-7.8, -2.75, 0], color='color2', scale=1) js.add_to_blender(appear_time=0.5) ap = tex_bobject.TexBobject('\\text{Anonymous Patrons}', location=[-7.8, -4, 0], color='color2', scale=1) ap.add_to_blender(appear_time=0.75) remaining = [logo, patreon, thanks, js, ap] for thing in remaining: thing.disappear(disappear_time=2.5)
def intro_card(self): logo = svg_bobject.SVGBobject( "UCSF_logo_signature", #location = (-5, 3.75, 0), #Centered position #scale = 0.26, #Centered scale location=[-10.675, -6.3, 0], scale=0.128, color='color2', centered=True) baf = svg_bobject.SVGBobject('BaFC_Arial', location=[4.325, -5.2, 0], scale=1.85, color='color2', centered=True) vest = tex_bobject.TexBobject('\\text{Vestibular Videos:}', location=[0, 4.5, 0], scale=2, color='color2', centered=True, typeface='garamond') title = tex_bobject.TexBobject('\\text{Vestibular Neuritis}', location=[0, 1.5, 0], scale=3.14, color='color2', centered=True, typeface='garamond') vert = tex_bobject.TexBobject( '|', location=[-6.35, -4.74, 0], scale=[2, 5.32, 4], centered=True, color='color2', ) logo.add_to_blender(appear_time=-1, animate=False) baf.add_to_blender(appear_time=-1, animate=False) vest.add_to_blender(appear_time=-1, animate=False) title.add_to_blender(appear_time=-1, animate=False) vert.add_to_blender(appear_time=-1, animate=False) for bobj in [logo, baf, vest, vert]: for handle in bobj.ref_obj.children: print(handle.name) print(handle.children[0].name) #For some reason, some handles have extra children try: fade(object=handle.children[0], start_time=0, duration_time=1, fade_out=False) except: pass for bobj in [title]: for handle in bobj.ref_obj.children: print(handle.name) print(handle.children[0].name) #For some reason, some handles have extra children try: fade(object=handle.children[0], start_time=2, duration_time=1, fade_out=False) except: pass
def end_card(self): logo = svg_bobject.SVGBobject( "UCSF_logo", #location = (-5, 3.75, 0), #Centered position #scale = 0.26, #Centered scale location=[0, 0, 0], scale=0.121, color='color2', #centered = True, ) baf = svg_bobject.SVGBobject( 'BaFC_Arial', location=[5.2257280349731445, -0.26257357001304626, 0.0], scale=2.23, color='color2', #centered = True, ) logobaf = bobject.Bobject( logo, baf, location=[-11.57, 2.5, 0], #location = [0, 1.5, Z0], scale=0.852, #centered = True ) logobaf.add_to_blender( appear_time=0, animate=False, ) url = tex_bobject.TexBobject( '\\text{ohns.ucsf.edu/otology-neurotology/balance-and-falls}', location=[0, 0.8, 0], color='color2', name='url', typeface='arial', scale=0.8, centered=True) url.add_to_blender(appear_time=0) mpb_loc = [1, -4.25, 0] mpb = tex_bobject.TexBobject('\\text{Made possible by:}', location=mpb_loc, color='color2', name='mpb', typeface='arial') mzhf = tex_bobject.TexBobject( '\\text{Mount Zion Health Fund}', color='color2', scale=1.2, location=[mpb_loc[0] + 0.5, mpb_loc[1] - 1.4, mpb_loc[2]], name='mzhf', typeface='arial') vpb_loc = [-13, -4.25, 0] vpb = tex_bobject.TexBobject('\\text{Video produced by:}', color='color2', location=vpb_loc, name='vpb', typeface='arial') jh = tex_bobject.TexBobject( '\\text{Justin Helps}', location=[vpb_loc[0] + 0.5, vpb_loc[1] - 1.4, vpb_loc[2]], scale=1.2, color='color2', name='jh', typeface='arial') jds = tex_bobject.TexBobject( '\\text{Jeffrey D. Sharon, MD}', location=[vpb_loc[0] + 0.5, vpb_loc[1] - 2.8, vpb_loc[2]], scale=1.2, color='color2', name='jds', typeface='arial') for bobj in [mpb, mzhf, vpb, jh, jds]: bobj.add_to_blender(appear_time=0, animate=False)
def outline(self): vn = tex_bobject.TexBobject("\\text{Vestibular Neuritis}", location=[0, 0, 0], centered=True, typeface='arial', scale=3) vn.add_to_blender(appear_time=0, subbobject_timing=[30] * 10 + [75] * 8) vn.move_to(new_location=[0, 3.5, 0], start_time=2.5) acronym = tex_bobject.TexBobject( '\\bullet\\text{Vestibular system overview}', color='color2', typeface='arial') cause = tex_bobject.TexBobject('\\bullet\\text{Symptoms}', color='color2', typeface='arial') treat = tex_bobject.TexBobject('\\bullet\\text{Treatments}', color='color2', typeface='arial') contents = tex_complex.TexComplex(acronym, cause, treat, location=[-9, 0.5, 0], scale=1.5, multiline=True) contents.add_to_blender(appear_time=4, subbobject_timing=[0, 35, 70]) contents.disappear(disappear_time=7) #vn.disappear(disappear_time = 7) vn.move_to(new_location=[0, 5.5, 0], start_time=6.5) itis = [] for i in range(14, 18): itis.append(vn.lookup_table[0][i]) for char in itis: char.color_shift( color=COLORS_SCALED[2], start_time=8, duration_time=2, ) neur = [] for i in range(10, 14): neur.append(vn.lookup_table[0][i]) for char in neur: char.color_shift( color=COLORS_SCALED[2], start_time=10.5, duration_time=2, ) vest = [] for i in range(0, 10): vest.append(vn.lookup_table[0][i]) for char in vest: char.color_shift( color=COLORS_SCALED[2], start_time=13, duration_time=2, ) vn.disappear(disappear_time=16)
def intro(self): bvl = tex_bobject.TexBobject("\\text{Bilateral Vestibular Loss}", location=[0, 0, 0], centered=True, typeface='arial', scale=2.4) bvl.add_to_blender(appear_time=0, subbobject_timing=[30] * 9 + [75] * 10 + [120] * 4) bvl.move_to(new_location=[0, 3.5, 0], start_time=2.5) acronym = tex_bobject.TexBobject( '\\bullet\\text{Vestibular system overview}', color='color2', typeface='arial') cause = tex_bobject.TexBobject('\\bullet\\text{Symptoms}', color='color2', typeface='arial') treat = tex_bobject.TexBobject('\\bullet\\text{Causes and treatment}', color='color2', typeface='arial') contents = tex_complex.TexComplex(acronym, cause, treat, location=[-10.1, 0.5, 0], scale=1.5, multiline=True) contents.add_to_blender(appear_time=4, subbobject_timing=[0, 35, 70]) contents.disappear(disappear_time=7) #bvl.disappear(disappear_time = 7) bvl.move_to(new_location=[0, 5.5, 0], start_time=6.5) l = [] for i in range(19, 23): l.append(bvl.lookup_table[0][i]) for char in l: char.color_shift( color=COLORS_SCALED[2], start_time=8, duration_time=2, ) v = [] for i in range(9, 19): v.append(bvl.lookup_table[0][i]) for char in v: char.color_shift( color=COLORS_SCALED[2], start_time=10.5, duration_time=2, ) b = [] for i in range(0, 9): b.append(bvl.lookup_table[0][i]) for char in b: char.color_shift( color=COLORS_SCALED[2], start_time=13, duration_time=2, ) bvl.disappear(disappear_time=16)
def intro_card(self): logo = svg_bobject.SVGBobject( "UCSF_logo_signature", #location = (-5, 3.75, 0), #Centered position #scale = 0.26, #Centered scale location=[-10.675, -6.3, 0], scale=0.128, color='color1', centered=True) baf = svg_bobject.SVGBobject('BaFC_Arial', location=[4.325, -5.2, 0], scale=1.85, color='color1', centered=True) vest = tex_bobject.TexBobject('\\text{Vestibular Videos:}', location=[0, 4.5, 0], scale=2, color='color1', centered=True, typeface='garamond') title = tex_bobject.TexBobject( #'\\text{How The Vestibular System Works}', #'\\text{Dizziness as we age}', #'\\text{The Video Head Impulse Test}', #'\\text{The Rotary Chair Test}', #'\\text{The VEMP Test}', #'\\text{Videonystagmography}', #'\\text{Vestibular Physical Therapy}', '\\text{Vestibular Evoked}', location=[0, 0.75, 0], scale=3, color='color1', centered=True, typeface='garamond') title2 = tex_bobject.TexBobject( #'\\text{How The Vestibular System Works}', #'\\text{Dizziness as we age}', #'\\text{The Video Head Impulse Test}', #'\\text{The Rotary Chair Test}', #'\\text{The VEMP Test}', #'\\text{Videonystagmography}', #'\\text{Vestibular Physical Therapy}', '\\text{Myogenic Potential Test}', location=[0, 0.75, 0], scale=3, color='color1', centered=True, typeface='garamond') title3 = tex_bobject.TexBobject( #'\\text{How The Vestibular System Works}', #'\\text{Dizziness as we age}', #'\\text{The Video Head Impulse Test}', #'\\text{The Rotary Chair Test}', #'\\text{The VEMP Test}', #'\\text{Videonystagmography}', #'\\text{Vestibular Physical Therapy}', '\\text{(VEMP Test)}', location=[0, 0.75, 0], scale=2, color='color1', centered=True, typeface='garamond') vert = tex_bobject.TexBobject( '|', location=[-6.35, -4.74, 0], scale=[2, 5.32, 4], centered=True, color='color1', ) logo.add_to_blender(appear_time=-1, animate=False) baf.add_to_blender(appear_time=-1, animate=False) vest.add_to_blender(appear_time=-1, animate=False) title.add_to_blender(appear_time=-1, animate=False) title2.add_to_blender(appear_time=-1, animate=False) title3.add_to_blender(appear_time=-1, animate=False) vert.add_to_blender(appear_time=-1, animate=False) for bobj in [logo, baf, vest, vert]: for handle in bobj.ref_obj.children: print(handle.name) print(handle.children[0].name) #For some reason, some handles have extra children try: fade(object=handle.children[0], start_time=0, duration_time=1, fade_out=False) except: pass for bobj in [title]: for handle in bobj.ref_obj.children: print(handle.name) print(handle.children[0].name) #For some reason, some handles have extra children try: fade(object=handle.children[0], start_time=2, duration_time=1, fade_out=False) except: pass
def outline(self): sc = tex_bobject.TexBobject("\\text{Superior Canal}", location=[0, 1.5, 0], centered=True, typeface='arial', scale=2.5) sc.add_to_blender(appear_time=0, #subbobject_timing = [30] * 8 + [75] * 5 ) sc.move_to(new_location=[0, 3.5, 0], start_time=4) ds = tex_bobject.TexBobject("\\text{Dehiscence Syndrome}", location=[0, -1.5, 0], centered=True, typeface='arial', scale=2.5) ds.add_to_blender(appear_time=2, subbobject_timing=[30] * 10 + [75] * 8) ds.move_to(new_location=[0, 2, 0], start_time=4) acronym = tex_bobject.TexBobject('\\bullet\\text{Inner ear overview}', color='color2', typeface='arial') cause = tex_bobject.TexBobject('\\bullet\\text{Symptoms}', color='color2', typeface='arial') treat = tex_bobject.TexBobject( '\\bullet\\text{Diagnosis and treatment}', color='color2', typeface='arial') contents = tex_complex.TexComplex(acronym, cause, treat, location=[-9, -1.5, 0], scale=1.5, multiline=True) contents.add_to_blender(appear_time=4, subbobject_timing=[35, 70, 105]) contents.disappear(disappear_time=7) #vn.disappear(disappear_time = 7) sc.move_to(new_location=[-7.5, 6, 0], new_scale=1.6, start_time=6.5) ds.move_to(new_location=[5.2, 6, 0], new_scale=1.6, start_time=6.5) s = [] for i in range(0, 13): s.append(sc.lookup_table[0][i]) for char in s: char.color_shift( color=COLORS_SCALED[2], start_time=8, duration_time=2, ) for char in s: char.color_shift( color=COLORS_SCALED[2], start_time=13, duration_time=2, ) d = [] for i in range(0, 10): d.append(ds.lookup_table[0][i]) for char in d: char.color_shift( color=COLORS_SCALED[2], start_time=10.5, duration_time=2, ) sc.disappear(disappear_time=16) #sc.move_to(new_location = [0, 5.5, 0], start_time = 15.75) ds.disappear(disappear_time=16)
def add_annotation( self, targets = None, alignment = 'top', labels = None, angle = 0, length = 1, label_scale = 0.67, gest_scale = 1 ): #calc points from targets gesture_series = [] tex_bobj = self.tex_bobjects[targets[0]] #label_anchor = None for j, target in enumerate(targets[1]): bobjs = [] path = tex_bobj.paths[target[0]] for i in range(target[1], target[2] + 1): try: bobjs.append(tex_bobj.imported_svg_data[path]['curves'][i]) except: print(i) print(tex_bobj.imported_svg_data[path]['curves']) raise() left_most = math.inf right_most = -math.inf y = 0 for bobj in bobjs: cur = bobj.objects[0] for spline in cur.data.splines: for point in spline.bezier_points: candidatex = cur.location[0] * cur.parent.scale[0] + \ cur.parent.location[0] * cur.parent.parent.scale[0] + \ point.co[0] * cur.scale[0] if right_most < candidatex: right_most = candidatex if left_most > candidatex: left_most = candidatex for point in spline.bezier_points: candidatey = cur.location[1] * cur.parent.scale[1] + \ cur.parent.location[1] * cur.parent.parent.scale[1] + \ point.co[1] * cur.scale[1] if alignment == 'top': if y < candidatey: y = candidatey elif alignment == 'bottom': if y > candidatey: y = candidatey if isinstance(angle, (float, int)): this_angle = angle elif isinstance(angle, list): this_angle = angle[j] if len(target) > 3 and target[3] == None: #No bobjs, empty gesture. HEH. if alignment == 'top': #y += 0 * self.ref_obj.scale[1] * tex_bobj.ref_obj.scale[1] head = ((right_most + left_most) / 2 / gest_scale, y + length, 0) rot = (0, 0, 0) elif alignment == 'bottom': #y -= 0 * self.ref_obj.scale[1] * tex_bobj.ref_obj.scale[1] head = ((right_most + left_most) / 2 / gest_scale, y - length, 0) rot = (0, 0, math.pi) #if label_anchor == None: # label_anchor = list(head) gesture_series.append( { 'type' : None, 'points' : { 'location' : head, 'rotation' : rot } } ) elif len(target) > 3 and target[3] == 'bracket' or \ (len(target) == 3 and len(bobjs) > 1): #Bracket if alignment == 'top': y += 0.2 * self.ref_obj.scale[1] * tex_bobj.ref_obj.scale[1] annotation_point = ((right_most + left_most) / 2 / gest_scale, y + length, 0) left_point = (left_most / gest_scale, y, 0) right_point = (right_most / gest_scale, y, 0) elif alignment == 'bottom': y -= 0.2 * self.ref_obj.scale[1] * tex_bobj.ref_obj.scale[1] annotation_point = ((right_most + left_most) / 2 / gest_scale, y - length, 0) left_point = [right_most / gest_scale, y, 0] right_point = [left_most / gest_scale, y, 0] #if label_anchor == None: # label_anchor = list(annotation_point) gesture_series.append( { 'type' : 'bracket', 'points' : { 'annotation_point' : annotation_point, 'left_point' : left_point, 'right_point' : right_point } } ) elif len(target) > 3 and target[3] == 'arrow' or \ (len(target) == 3 and len(bobjs) == 1): #Arrow if alignment == 'top': y += 0.3 * tex_bobj.ref_obj.scale[1] #* self.ref_obj.scale[1] head = ((right_most + left_most) / 2 / gest_scale + math.tan(this_angle) * 0.4, y / gest_scale, 0) tail = ((right_most + left_most) / 2 / gest_scale + math.tan(this_angle) * length, (y + length) / gest_scale, 0) elif alignment == 'bottom': y -= 0.3 * tex_bobj.ref_obj.scale[1] #* self.ref_obj.scale[1] head = ((right_most + left_most) / 2 / gest_scale - math.tan(this_angle) * 0.4, y / gest_scale, 0) tail = ((right_most + left_most) / 2 / gest_scale - math.tan(this_angle) * length, (y - length) / gest_scale, 0) #if label_anchor == None: # label_anchor = list(tail) gesture_series.append( { 'type' : 'arrow', 'points' : { 'head' : head, 'tail' : tail, } } ) else: raise Warning('Something is wrong with the gesture targets.') container = bobject.Bobject(name = 'annotation') gest = gesture.Gesture( gesture_series = gesture_series, color = 'color2', scale = gest_scale ) container.add_subbobject(gest) tex_bobj.annotations.append([container, targets[1], alignment]) self.annotations.append([container, targets[0]]) #Make TexComplex for the annotation_text t_bobj_count = 0 for label in labels: t_bobj_count = max(len(label), t_bobj_count) for label in labels: while len(label) < t_bobj_count: label.append(None) t_bobjs = [] for i in range(t_bobj_count): strings = [] for label in labels: strings.append(label[i]) #print(len(strings)) t_bobj = tex_bobject.TexBobject(*strings, centered = True, color = 'color2') t_bobjs.append(t_bobj) #label_scale = 0.67 #Smaller than text. Could do this in a more robust way #se;fline_height = 1.2 #Could make this a constant. It's already a default. #dy = (1 + t_bobj_count) / 2 * self.line_height #print(t_bobj_count) if alignment == 'top': dy = (t_bobj_count / 2 + 1/2) * self.line_height if alignment == 'bottom': dy = (t_bobj_count / 2) * self.line_height #Some t_bobjs may start with empty expressions. Initial position #shouldn't take empty lines into account, and position will be adjusted on morph if alignment == 'top': for t_bobj in t_bobjs: if t_bobj.paths[0] == None: dy -= self.line_height# * label_scale #label_anchor[1] += dy label_text = TexComplex( *t_bobjs, multiline = True, centered = True, align_y = 'center', scale = label_scale, name = 'label', location = (0, dy, 0),#label_anchor rotation_euler = [0, 0, -gest.subbobjects[0].ref_obj.rotation_euler[2]] ) gest.subbobjects[0].add_subbobject(label_text) self.add_subbobject(container)