20th Century Fox Opening
, popularité : 15%
Automatisation de génération d’ouverture type "20th Century Fox"
Le fichier blender est basé principalement sur le travail de Matt Hoecker :
http://blender.sixmonkeys.geek.nz/albums/album41/FOX_Logo_by_Matt_Hoecker.blend
J’ai aussi utilisé le travail suivant : http://ballyweg.net/20th-century-fox.html
une mine d’or pour la suite de mes travaux d’automatisation pour Blender.
Attention le temp de calcul d’une animation est très long, + de 2h sur une machine en Core i7 !!!
Fichier Blender |
---|
Vidéo de présentation
Code source
import bpy
from bpy.props import *
# for modification of dimensions
DimXTwenty = bpy.data.objects['Text_twenty'].dimensions.x #max length
DimYTwenty = bpy.data.objects['Text_twenty'].dimensions.y #initial height
DimZTwenty = bpy.data.objects['Text_twenty'].dimensions.z #initial depth
DimXTh = bpy.data.objects['Text_th'].dimensions.x #max length
DimYTh = bpy.data.objects['Text_th'].dimensions.y #initial height
DimZTh = bpy.data.objects['Text_th'].dimensions.z #initial depth
DimXCentury = bpy.data.objects['PlateTwenty'].dimensions.x #max length
DimYCentury = bpy.data.objects['Text_century'].dimensions.y #initial height
DimZCentury = bpy.data.objects['Text_century'].dimensions.z #initial depth
DimXFox = bpy.data.objects['PlateCentury'].dimensions.x #max length
DimYFox = bpy.data.objects['Text_fox'].dimensions.y #initial height
DimZFox = bpy.data.objects['Text_fox'].dimensions.z #initial depth
ResizePrecision = 0.05
#Text stuff
Text_twenty="20"
Text_th="th"
Text_century="CENTURY"
Text_fox="FOX"
ActiveObjectTextTwenty = bpy.data.objects['Text_twenty']
ActiveObjectTextTh = bpy.data.objects['Text_th']
ActiveObjectTextCentury = bpy.data.objects['Text_century']
ActiveObjectTextFox = bpy.data.objects['Text_fox']
#selecting Text
bpy.context.scene.objects.active = ActiveObjectTextTwenty
bpy.context.scene.objects.active.select = True
#changing text
bpy.ops.object.editmode_toggle()
bpy.ops.font.delete(type='ALL')
bpy.ops.font.text_insert(text=Text_twenty, accent=False)
bpy.ops.object.editmode_toggle()
#changing font
ActiveObjectTextTwenty.data.font = bpy.data.fonts['GOTHICB.TTF']
#deslect
bpy.ops.object.select_all(action='DESELECT')
#selecting Text
bpy.context.scene.objects.active = ActiveObjectTextTh
bpy.context.scene.objects.active.select = True
#changing text
bpy.ops.object.editmode_toggle()
bpy.ops.font.delete(type='ALL')
bpy.ops.font.text_insert(text=Text_th, accent=False)
bpy.ops.object.editmode_toggle()
#changing font
ActiveObjectTextTh.data.font = bpy.data.fonts['GOTHICB.TTF']
#deslect
bpy.ops.object.select_all(action='DESELECT')
#selecting Text
bpy.context.scene.objects.active = ActiveObjectTextCentury
bpy.context.scene.objects.active.select = True
#changing text
bpy.ops.object.editmode_toggle()
bpy.ops.font.delete(type='ALL')
bpy.ops.font.text_insert(text=Text_century, accent=False)
bpy.ops.object.editmode_toggle()
#changing font
ActiveObjectTextCentury.data.font = bpy.data.fonts['GOTHICB.TTF']
#deslect
bpy.ops.object.select_all(action='DESELECT')
#selecting Text
bpy.context.scene.objects.active = ActiveObjectTextFox
bpy.context.scene.objects.active.select = True
#changing text
bpy.ops.object.editmode_toggle()
bpy.ops.font.delete(type='ALL')
bpy.ops.font.text_insert(text=Text_fox, accent=False)
bpy.ops.object.editmode_toggle()
#changing font
ActiveObjectTextFox.data.font = bpy.data.fonts['GOTHICB.TTF']
#deslect
bpy.ops.object.select_all(action='DESELECT')
#Text dimension modification
#selecting Text
bpy.context.scene.objects.active = ActiveObjectTextTwenty
bpy.context.scene.objects.active.select = True
#for Text_century
if (Text_th==""):
#moving twenty text to center
bpy.data.objects['Text_twenty'].location.x += DimXTh/2
while (bpy.data.objects['Text_twenty'].dimensions.x > DimXTwenty+DimXTh):
#realise modification
bpy.data.objects['Text_twenty'].data.size -= ResizePrecision
bpy.data.scenes['Spotlights'].update() #needed to update object datas inside the loop; otherwide infinite loop
else:
while (bpy.data.objects['Text_twenty'].dimensions.x > DimXTwenty):
#realise modification
bpy.data.objects['Text_twenty'].data.size -= ResizePrecision
bpy.data.scenes['Spotlights'].update() #needed to update object datas inside the loop; otherwide infinite loop
bpy.data.objects['Text_twenty'].dimensions.y = DimYTwenty
#convert to mesh to avoid font faces artefact
bpy.ops.object.convert(target='MESH', keep_original=False)
#deslect
bpy.ops.object.select_all(action='DESELECT')
#selecting Text
bpy.context.scene.objects.active = ActiveObjectTextTh
bpy.context.scene.objects.active.select = True
#for Text_century
while (bpy.data.objects['Text_th'].dimensions.x > DimXTh):
#realise modification
bpy.data.objects['Text_th'].data.size -= ResizePrecision
bpy.data.scenes['Spotlights'].update() #needed to update object datas inside the loop; otherwide infinite loop
bpy.data.objects['Text_th'].dimensions.y = DimYTh
#convert to mesh to avoid font faces artefact
bpy.ops.object.convert(target='MESH', keep_original=False)
#deslect
bpy.ops.object.select_all(action='DESELECT')
#selecting Text
bpy.context.scene.objects.active = ActiveObjectTextCentury
bpy.context.scene.objects.active.select = True
#for Text_century
while (bpy.data.objects['Text_century'].dimensions.x > DimXCentury):
#realise modification
bpy.data.objects['Text_century'].data.size -= ResizePrecision
bpy.data.scenes['Spotlights'].update() #needed to update object datas inside the loop; otherwide infinite loop
bpy.data.objects['Text_century'].dimensions.y = DimYCentury
#convert to mesh to avoid font faces artefact
bpy.ops.object.convert(target='MESH', keep_original=False)
#deslect
bpy.ops.object.select_all(action='DESELECT')
#selecting Text
bpy.context.scene.objects.active = ActiveObjectTextFox
bpy.context.scene.objects.active.select = True
#for Text_fox
while (bpy.data.objects['Text_fox'].dimensions.x > DimXFox):
#realise modification
bpy.data.objects['Text_fox'].data.size -= ResizePrecision
bpy.data.scenes['Spotlights'].update() #needed to update object datas inside the loop; otherwide infinite loop
bpy.data.objects['Text_fox'].dimensions.y = DimYFox
#convert to mesh to avoid font faces artefact
bpy.ops.object.convert(target='MESH', keep_original=False)