SHARE
TWEET

Untitled

a guest Jun 26th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import bpy
  2. from random import randint #We need something to generate random numbers with
  3.  
  4. def random_numbers(scene):
  5.     card_number=''
  6.     #card number reset to empty string
  7.  
  8.     if (scene.frame_current%5==0):
  9.     #every 5th frame could be every frame number that has no reminder after dividing by 5
  10.  
  11.         for group_of_4 in range(0,4):
  12.         #we need to do it 4 times so let's use a loop instead of typing
  13.  
  14.             card_number += str(randint(0,9999)).zfill(4) + ' '
  15.             #zfill is for leading zeros
  16.  
  17.         bpy.data.objects['Text'].data.body = card_number
  18.         #let's write the text to the text object
  19.  
  20. bpy.app.handlers.frame_change_pre.append(random_numbers)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top