Created
February 11, 2017 22:58
-
-
Save loveJesus/ff7b67503e28ad75d755ca04cb77632a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Hallelujah | |
#Jesus Juve | |
import bpy | |
import bmesh | |
from mathutils import Vector | |
import sys | |
argv_aleluya = sys.argv | |
argv_aleluya = argv_aleluya[argv_aleluya.index("--") + 1:] if("--" in argv_aleluya) else []; | |
bpy.context.object | |
def create_text_aleluya(text_aleluya,materialname_aleluya = "fAleluya"): | |
#bpy.ops.object.mode_set(mode='OBJECT') | |
bpy.ops.object.text_add() | |
bpy.ops.object.mode_set(mode='EDIT') | |
bpy.ops.font.delete(type="ALL") | |
bpy.ops.font.text_insert(text=text_aleluya) | |
bpy.ops.object.mode_set(mode='OBJECT') | |
bpy.ops.object.convert(target="MESH") | |
bpy.ops.object.mode_set(mode='EDIT') | |
bpy.ops.mesh.select_all(action='TOGGLE') | |
obj_aleluya = bpy.context.edit_object | |
m_aleluya = obj_aleluya.data | |
bm_aleluya = bmesh.from_edit_mesh(m_aleluya) | |
mvert_aleluya = max([e.co[0] for e in bm_aleluya.verts]) | |
print("Hallelujah " + str(mvert_aleluya)) | |
bme_aleluya = bmesh.ops.extrude_face_region(bm_aleluya, geom = bm_aleluya.faces ) | |
verts_aleluya = [e for e in bme_aleluya['geom'] if isinstance(e, bmesh.types.BMVert)] | |
bmesh.ops.translate(bm_aleluya, vec=Vector((0, 0, 0.5)), verts=verts_aleluya) | |
bmesh.update_edit_mesh( bpy.context.object.data ) | |
#bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={"mirror":False}, TRANSFORM_OT_translate={"value":(0, 0, 0.185867), "constraint_axis":(False, False, True), "constraint_orientation":'NORMAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "texture_space":False, "remove_on_cancel":False, "release_confirm":False}) | |
bpy.ops.object.mode_set(mode='OBJECT') | |
bpy.context.object.rotation_euler[0] = 1.5708; | |
bpy.context.object.location = [-1.77, -0.2 , 1.45]; | |
bpy.context.object.scale = [0.78 * ( 4.6 / mvert_aleluya ), 0.78, 0.78 ]; | |
#bpy.context.object.data.materials[0] = bpy.data.materials[materialname_aleluya] | |
bpy.context.object.data.materials.append(bpy.data.materials[materialname_aleluya]) | |
for p_aleluya in bpy.context.object.data.polygons: | |
p_aleluya.material_index = 0 | |
area_aleluya = bpy.context.area | |
old_type_aleluya = area_aleluya.type | |
area_aleluya.type = 'VIEW_3D' | |
materialname_aleluya = next(iter(argv_aleluya), "mAleluya"); | |
string_aleluya = " ".join(argv_aleluya[1:]) if len(argv_aleluya) > 1 else "Hallelujah"; | |
create_text_aleluya(string_aleluya, materialname_aleluya ) | |
area_aleluya.type = old_type_aleluya | |
#exec(bpy.data.texts["scriptAleluya.py"]); bpy.ops.render.render() | |
#Praise the good Lord! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment