Is it possible to give every scene the user creates an unique number? I thought about using the UUID lib for that so here is what I got so far:
def register():
pow2_31 = 2**31
mask32b = 0xFFFFFFFF
p_uuid = uuid.uuid4().int
p_uuid1 = p_uuid >> 96
p_uuid1 -= pow2_31 if p_uuid1 >= pow2_31 else 0
p_uuid2 = (p_uuid >> 64) & mask32b
p_uuid2 -= pow2_31 if p_uuid2 >= pow2_31 else 0
p_uuid3 = (p_uuid >> 32) & mask32b
p_uuid3 -= pow2_31 if p_uuid3 >= pow2_31 else 0
p_uuid4 = p_uuid & mask32b
p_uuid4 -= pow2_31 if p_uuid4 >= pow2_31 else 0
bpy.types.Scene.mhfc_uuid1 = IntProperty(
name="projectUUID",
description="An unique ID. DON'T TOUCH THIS UNLESS YOU ARE SURE WHAT YOU DO.",
subtype="UNSIGNED",
default= p_uuid1, # most uniqueness possible??
options=set()
)
bpy.types.Scene.mhfc_uuid2 = IntProperty(
name="projectUUID",
description="An unique ID. DON'T TOUCH THIS UNLESS YOU ARE SURE WHAT YOU DO.",
subtype="UNSIGNED",
default= p_uuid2, # most uniqueness possible??
options=set()
)
bpy.types.Scene.mhfc_uuid3 = IntProperty(
name="projectUUID",
description="An unique ID. DON'T TOUCH THIS UNLESS YOU ARE SURE WHAT YOU DO.",
subtype="UNSIGNED",
default= p_uuid3, # most uniqueness possible??
options=set()
)
bpy.types.Scene.mhfc_uuid4 = IntProperty(
name="projectUUID",
description="An unique ID. DON'T TOUCH THIS UNLESS YOU ARE SURE WHAT YOU DO.",
subtype="UNSIGNED",
default= p_uuid4, # most uniqueness possible??
options=set()
)
The problem is that all scenes have the same uuid while Blender is not restarted. How can I generate a new random number for each scene the user creates?