'------------------------------------------------------------------------------
' sceneInfoDisplay ver1.1
' mail@grahamdclark.com
' Date : July 24th, 2003
' Updated: July 26th, 2003
' (c) Copyright 2003  Lawson&Clark
'------------------------------------------------------------------------------
' Description: creates a displayInfo custom parameter set based on selected object name
' and current scene_name_with_spaces, and current frame.
' 
' So displayInfo_Custompset param 1 = slected object name, param 2 = "scene", param 3 = "Shot", 
' param 4 = "Title", param 5 = "Worktype", param 6 = "Version", param 7 = "Pass", 
' param 8 to (last-1) ="otherInfo(n)",  param last ="Creator"
'
' Use:Name XSI scene file according to Scene_Shot_Title_Worktype_Version_Pass_otherinfo_Creator
' or rename or change number of params below in script in the Array section to match your file naming scheme
' Then select object(probably a camera), runscript.
'
' You can add as many "otherInfos" as you like in scene file name ie:
' Scene_Shot_Title_Worktype_Version_Pass_otherinfo_someotherinfo_moreotherinfo_etc_Creator
' ie. DogHump_01_closeUp_anim_01_shadow_tweakedLegs_GDC
' within reason as filenames should not be too long
'
' Note: if scene name has no spaces "_", script will fail, must have a least one space _.
'------------------------------------------------------------------------------
Dim A
'Put your own naming scheme here (minimum of two params so scene name must have at least one space):
A = Array("Object_Camera","Scene","Shot","Title","Worktype","Version","Pass","otherinfo","Creator")

logmessage "making custom paramset based on scene_name"


set oObj = ActiveProject.ActiveScene
set othisy = Application.Selection(0)
set oCpset = othisy.AddProperty("Custom_parameter_list",, "DisplayInfo_CustomPSet")
param = othisy.name
SIAddCustomParameter oCpset, A(0), siString, param, 0, 1, , 4, 0, 1

'silly name loop look for spaces
spacer = InStr(oObj.name, "_")-1
n = 1
Do Until spacer = 0
	spacey = spacer+1
	spacer = InStr(spacer+1, oObj.name, "_")
	if spacer < 1 then
		exit do
	else
		if spacer = spacey then
			param = left(oObj.name, spacer-1)
			SIAddCustomParameter oCpset, A(1), siString, param, 0, 1, , 4, 0, 1
		else
			word = left(oObj.name, spacer-1)
			param = right(word,spacer-spacey)
			if n<(UBound(A)-1) then
			SIAddCustomParameter oCpset, A(n), siString, param, 0, 1, , 4, 0, 1
			else
			SIAddCustomParameter oCpset, A(UBound(A)-1), siString, param, 0, 1, , 4, 0, 1
			end if
		end if
	end if
	n = n+1    
Loop  
param = Right(oObj.name,Len(oObj.name)-spacey+1)
logmessage UBound(A)
SIAddCustomParameter oCpset, A(UBound(A)), siString, param, 0, 1, , 4, 0, 1
SIAddCustomParameter oCpset, "Current_Frame", siDouble, 0, -40000, 40000, , 5, -40000, 40000
SetExpr oCpset&".Current_Frame", "Fc"
SetValue "*.camvis.custominfo", True




