Advertisement
metalx1000

Blender 3D Python Code for Adding Text with Material

Oct 29th, 2018
952
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. #Blender 3D - Create Text Object and add Random Colored Material
  2. #By Kris Occhipinti - October 29th,2018
  3. #filmsbykris.com
  4. #GPLv3 - https://www.gnu.org/licenses/gpl-3.0.txt
  5.  
  6. import bpy
  7. from random import random
  8.  
  9. bpy.ops.object.text_add(radius=1, view_align=False, enter_editmode=True, location=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
  10. bpy.ops.font.select_all()
  11. bpy.ops.font.text_insert(text="www.FilmsByKris.com")
  12. bpy.ops.object.editmode_toggle()
  13.  
  14. bpy.context.object.data.extrude = 0.046
  15. bpy.context.object.data.align_x = 'CENTER'
  16. bpy.ops.transform.rotate(value=1.5708, axis=(1, 0, 0), constraint_axis=(True, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
  17. bpy.context.object.data.bevel_depth = 0.028
  18.  
  19. mat = bpy.data.materials.new(name="Material")
  20. bpy.context.active_object.data.materials.append(mat)
  21. bpy.context.object.active_material.diffuse_color = (random(),random(),random())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement