Re: [Scripting] FindChildren with Annotations....

Date : Wed, 2 May 2007 17:21:26 +0200
To : XSI(at)Softimage.COM
From : Guillaume Laforge <guillaume(at)alamaison.fr>
Subject : Re: [Scripting] FindChildren with Annotations....
Hi Dan,

You can try something like this :

if(!isDansDataExist())
var myAnotn = AddProp( "Annotation", myScnroot, siDefaultPropagation, myAnotnName );

function isDansDataExist()
{
	myScnroot = ActiveProject.ActiveScene.Root;
	myAnotnName = "DansData";
	result = 0;

	oEnum = new Enumerator( myScnroot.properties ) ;
	for (;!oEnum.atEnd();oEnum.moveNext() )
	{
		var oProp = oEnum.item() ;
		if(oProp.Name == "DansData" )
		{
			LogMessage("your annotation already exist under the scene root")
			result = 1;
		}
	}
	return result
}

Cheers

--
Guillaume Laforge | La Maison


On Wed, 2 May 2007 16:02:53 +0100, "Dan Yargici" <danyargici(at)gmail.com> wrote:
> I'm attempting to write a little script which will create an Annotation on
> the scene root, however i'd like to check if this rather uniquely-named
> Annotation already exists so I can zap it and re-make it....  I've tried:
> 
> //------------------------------
> 
> myScnroot = ActiveProject.ActiveScene.Root;
> myAnotnName = "DansData";
> 
> var myAnotn = AddProp( "Annotation", myScnroot, siDefaultPropagation,
> myAnotnName );
> 
> myTrash = myScnroot.FindChildren (myAnotnName);
> logmessage (myTrash.Name);
> 
> //-----------------------------
> 
> and it outputs:
> 
> //INFO :
> 
> Nothing, basically..... I notice in the SDK (under FindChildren) that
> there
> doesn't appear to be a Type for annotations - is this why?
> 
> Also, what's the best way to check it exists or not? Would my example (if
> it
> worked) return an error if it found nothing? or just keep going?
> 
> Thanks,
> 
> DAN
> 
> 


---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.