-
Notifications
You must be signed in to change notification settings - Fork 2
/
AnimGen.py
63 lines (48 loc) · 2.1 KB
/
AnimGen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import bpy
def GenerateAnim(hero_text, ticket_no,venue,date, ImageLocation):
#select and change HeroText
bpy.ops.object.select_all(action='DESELECT')
bpy.context.view_layer.objects.active = None
HeroText = bpy.data.objects['HeroText']
bpy.context.view_layer.objects.active = HeroText
HeroText.select_set(True)
HeroText.data.body = hero_text
#select and change TicketNumber
bpy.ops.object.select_all(action='DESELECT')
bpy.context.view_layer.objects.active = None
TicketNumber = bpy.data.objects['TicketNumber']
bpy.context.view_layer.objects.active = TicketNumber
TicketNumber.select_set(True)
TicketNumber.data.body = ticket_no
#select and change Date
bpy.ops.object.select_all(action='DESELECT')
bpy.context.view_layer.objects.active = None
Date = bpy.data.objects['Date']
bpy.context.view_layer.objects.active = Date
Date.select_set(True)
Date.data.body = date
#select and change Venue
bpy.ops.object.select_all(action='DESELECT')
bpy.context.view_layer.objects.active = None
Venue = bpy.data.objects['Venue']
bpy.context.view_layer.objects.active = Venue
Venue.select_set(True)
Venue.data.body = venue
#setup Image
ImageNode = bpy.data.materials["ImageMat"].node_tree.nodes["BGImage"]
img = bpy.data.images.load(ImageLocation)
if img:
ImageNode.image = img
bpy.ops.object.select_all(action='DESELECT')
bpy.context.view_layer.objects.active = None
ImagePlane = bpy.data.objects['ImagePlane']
bpy.context.view_layer.objects.active = ImagePlane
bpy.ops.object.editmode_toggle()
bpy.ops.uv.smart_project(correct_aspect=False, scale_to_bounds=True)
bpy.ops.object.editmode_toggle()
#render stuff
bpy.ops.render.render(animation=True, use_viewport=True)
bpy.context.scene.cycles.device = 'GPU'
bpy.context.scene.render.fps = 15
bpy.context.scene.render.engine = 'BLENDER_EEVEE'
GenerateAnim('Buildspa\ndemos','001','Discord', 'Sep 14', '//Refs\\3.png')