Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vegdahl <cessen@cessen.com>2011-04-11 10:10:07 +0400
committerNathan Vegdahl <cessen@cessen.com>2011-04-11 10:10:07 +0400
commit8da041a311f52f0232010132c137218f9dda33f8 (patch)
treec1984dd208b26aad75df7c842b86c89bf4e85b51 /rigify/utils.py
parent940b6cd35872f67265efcf1a616959890076f941 (diff)
Rigify: fixed broken ik/fk snapping (api changes).
Diffstat (limited to 'rigify/utils.py')
-rw-r--r--rigify/utils.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/rigify/utils.py b/rigify/utils.py
index f7a33c22..193a2779 100644
--- a/rigify/utils.py
+++ b/rigify/utils.py
@@ -18,7 +18,8 @@
import bpy
import imp
-from random import randint
+import random
+import time
from mathutils import Vector
from math import ceil, floor
from rna_prop_ui import rna_idprop_ui_prop_get
@@ -497,10 +498,16 @@ def write_metarig(obj, layers=False, func_name="create_sample"):
return "\n".join(code)
-def random_string(length):
+def random_id(length = 8):
+ """ Generates a random alphanumeric id string.
+ """
+ tlength = int(length / 2)
+ rlength = int(length / 2) + int(length % 2)
+
chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
text = ""
- for i in range(0, length):
- text += chars[randint(0, 35)]
+ for i in range(0, rlength):
+ text += random.choice(chars)
+ text += str(hex(int(time.time())))[2:][-tlength:].rjust(tlength, '0')[::-1]
return text