Generating GUIDs

It is not necessary to generate your own GUIDs for plug-ins and mental ray shaders, as they are automatically generated by the either the development or installation techniques discussed elsewhere in the SOFTIMAGE|SDK guides. However, the following describes how to generate your own should you need to.

A GUID is a globally unique identifier that is 128 bits long. A GUID is unique across both space and time, and is either guaranteed to be different from all other UUIDs/GUIDs generated until 3400 A.D. or extremely likely to be different (it depends on the actual algorithm used).

In short, a GUID is a combination of the network address and current time at the moment and place it was generated. Assuming that network addresses are unique and that time never runs backwards, this guarantees that GUIDs really are unique. For systems that don’t have network cards, another algorithm is used to generate unique values.

The string representation of a GUID looks like this:

166769E1-88E8-11CF-A6BB-0080C7B2D682

Generating GUIDs in XSIs Script Editor

Use the XSIFactory.CreateGuid method to generate GUIDs directly in XSI’s script editor. For example:

// JScript
Application.LogMessage( XSIFactory.CreateGuid );

 

Generating GUIDs on Windows

Microsoft Visual C++ includes two utilities for generating GUIDs:

uuidgen: a command-line utility

guidgen: a sample dialog-based MFC application

uuidgen

Using uuidgen allows you to generate blocks of GUIDs. For example, if you type this command:

uuidgen -n5 > guids.txt

the uuidgen utility generates a block of GUIDs that looks like this:

{12340001-4980-1920-6788-123456789012}
{12340002-4980-1920-6788-123456789012}
{12340003-4980-1920-6788-123456789012}
{12340004-4980-1920-6788-123456789012}
{12340005-4980-1920-6788-123456789012}

You could use uuidgen to generate an arbitrarily large block of GUIDs for your SPDL files.

guidgen

If you don’t mind generating GUIDs one at a time, you can also use guidgen:

1. Select the Registry Format.

2. Click Copy to copy the GUID to the clipboard, so you can paste it into a SPDL file.

3. When you need another GUID, click New GUID.

Generating GUIDs on Linux

On Linux, the DCE development environment includes the uuid_gen utility.



SOFTIMAGE|XSI v6.01     

Return to Softimage XSI Index