Resourcedump

Plugins linking to this thread: (hide)

Get Closest Filtered pointsAuthor: Paul Smith
Disclaimer: This is from the resourcedump thread on si-community.com so »some restrictions may apply« (but usually don't)

A compound that gets ONLY the closest points in the current pointcloud/geometry that have a »true« boolean. It's much much faster than rifling through arrays. Hopefully someone will find this useful. It works by temporarily moving the filtered points up and away on the Y axis, then the remaining points look in the area where the filtered ones got moved to. Then filtered ones are moved back to their original location. The temporary moving of them is nothing to be concerned about because you wont see it and it doesnt affect simulation.

local backup: Get closest filtered points.xsicompound

User avatar
rray
Moderator
Posts: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Resourcedump

Post by rray » 16 Jan 2013, 00:45

This is going much better than I hoped! :-bd Thanks guys for that. keep on dumping! (I mean fighting of course \m/ )
___
Attached some popup menus for xPop (for misc. Hide, smooth, views and some cloning tools)
Image
Attachments
MiscPopups.zip
(3.93 KiB) Downloaded 355 times
softimage resources section updated Jan 5th 2024

User avatar
rray
Moderator
Posts: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Resourcedump

Post by rray » 16 Jan 2013, 18:48

From another thread, this here exports/converts a selection of objects to MDD PointOven format which can be streamed from disk. (Objects must all have the same topology)
softimage resources section updated Jan 5th 2024

knekke
Posts: 11
Joined: 09 Jun 2009, 09:59
Location: Sweden

Re: Resourcedump

Post by knekke » 17 Jan 2013, 09:06

This is my SI to AfterEffects Exporter. I use it once every two years and then it does the job. No guarantees though...
You just create a group containing the camera and some nulls. Select it and run the script.
A .jsx script is created that you can run inside AfterFX. It creates a new Comp with Camera and Nulls (you can choose to create lights instead, that you can use with OpticalFlares).
It probably does not work with optical center shift or other fancy stuff :|

cheers,
Thomas
Attachments
tvSI2AFX.zip
(3.48 KiB) Downloaded 433 times

julian johnson
Posts: 9
Joined: 27 Apr 2010, 16:10

Re: Resourcedump

Post by julian johnson » 17 Jan 2013, 10:57

Great idea for a thread. I can only apologise for the state this scene and ICE Tree are in. I've tried to clean it up as much as possible. There's some very agricultural ICE hacking in there. Possibly someone might find some use for it. I never had the time to explore it further. It's based on the paper: Meshless Deformations Using Shape matching here:

http://www.beosil.com/download/Meshless ... _SIG05.pdf



The scene can be downloaded here:

https://dl.dropbox.com/u/69741069/shape ... cedump.rar

User avatar
Tekano
Posts: 488
Joined: 09 Jun 2009, 14:49
Location: London, UK

Re: Resourcedump

Post by Tekano » 18 Jan 2013, 12:01

most excellant thread, heres a whirlpool!



here is scene (2013sp1) https://docs.google.com/file/d/0B0WD7fS ... lUcDQ/edit and some compounds attached below which should hopefully work in earlier versions of SI

they are commented from an original SeExpr expression kindly provided by Taikomatsu form here https://vimeo.com/57296151 and the whirlpool compound needs some deformation to the grid beforehand to see the effect. in the example video above I've used Amaan's AAOcean to deform the grid but in my example scene I quickly made some waves with turbulence node (attached) Ive doubled it up and changed the global scales to make the waves more interesting.

think the actual maths involved is called a Logarithmic Spiral http://en.wikipedia.org/wiki/Logarithmic_spiral

cheers!
Attachments
Capture_whirlpool.JPG
Whirlpool.xsicompound
(75.33 KiB) Downloaded 534 times
turb waves.xsicompound
(98.69 KiB) Downloaded 536 times
Last edited by Tekano on 18 Jan 2013, 12:15, edited 1 time in total.
Gossip is what no one claims to like, but everybody enjoys.

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Resourcedump

Post by Hirazi Blue » 18 Jan 2013, 12:08

Concerning the scene file (after Google login): "You need permission to access this item."
Stay safe, sane & healthy!

User avatar
Tekano
Posts: 488
Joined: 09 Jun 2009, 14:49
Location: London, UK

Re: Resourcedump

Post by Tekano » 18 Jan 2013, 12:13

good catch Hirazi - should be ok now :-bd
Gossip is what no one claims to like, but everybody enjoys.

Matic
Posts: 70
Joined: 18 Jun 2009, 19:58

Re: Resourcedump

Post by Matic » 18 Jan 2013, 19:56

Neat whirlpool!

Nowhere near as cool as that, here's a taper deform which only works on the objects local y axis. :D I built it as an example for my site and ran out of time before I added in the transforms to make the axis arbitrary. But it's all nicely commented, so hopefully it will be helpful to someone, learning-wise.

Image

Compound attached, full scene is on my site http://andy.moonbase.net

Cheers
Attachments
Taper Deform Along Local Y.zip
Taper deform on local Y
(25.87 KiB) Downloaded 343 times

povmaniaco
Posts: 9
Joined: 10 Oct 2012, 22:54

Re: Resourcedump

Post by povmaniaco » 23 Jan 2013, 10:18

This is the result of my adaptation of the exporter of Softimage to LuxRender (LuXSI) to export scenes of Softimage to Mitsuba.
It even has more code of LuXSI that needs to be cleaned, but it is already functional.
Exist compiled versions for win32 and win64* and, it has been proved with SI2012 win32 and Mod Tool 7.5 win32.
https://bitbucket.org/povman/mitxsi/downloads

Visit the wiki page, for more information about the state of the exporter.
https://bitbucket.org/povman/mitxsi/wiki/Home

Image
(1) The version x64, it does not include the dll's of shaders, see https://bitbucket.org/povman/mitxsi/src ... at=default

Greetings..

Pooby
Posts: 501
Joined: 27 Aug 2010, 22:25

Get Closest Filtered points

Post by Pooby » 23 Jan 2013, 14:07

Get Closest Filtered points

A compound that gets ONLY the closest points in the current pointcloud/geometry that have a 'true' boolean.
Its much much faster than rifling through arrays.

Hopefully someone will find this useful

It works by temporarily moving the filtered points up and away on the Y axis, then the remaining points look in the area where the filtered ones got moved to. Then filtered ones are moved back to their original location. The temporary moving of them is nothing to be concerned about because you wont see it and it doesnt affect simulation.
Attachments
Get closest filtered points.xsicompound
(14.24 KiB) Downloaded 522 times

Matic
Posts: 70
Joined: 18 Jun 2009, 19:58

Re: Resourcedump

Post by Matic » 24 Jan 2013, 17:58

I liked mucking about with Tekano's very cool whirlpool deformer. For comparison/fun I made a similar deformer using the log spiral in the "display shapes" scene I made a while back. Here it is in case anyone is interested in two scenes which do the same thing, both based on log spirals, but with two different approaches to the ICE part (Tekano's is cleaner lol.)

Image

Of (likely) more interest is that I've included a "ridged turbulence" compound in there for fun.

Image
Image

mirrored on my site http://andy.moonbase.net

Cheers
Attachments
alt_whirlpool.zip
Alternate take on log spiral whirlpool deformer.
(158.69 KiB) Downloaded 703 times

Bullit
Moderator
Posts: 2621
Joined: 24 May 2012, 09:44

Re: Resourcedump

Post by Bullit » 24 Jan 2013, 18:10

That looks very nice.

Matic
Posts: 70
Joined: 18 Jun 2009, 19:58

Re: Resourcedump

Post by Matic » 06 Feb 2013, 02:43

Update: I've added to the taper deformer example a few posts back to support any arbitrary axis etc... Makes a good basis for creating more complex deformers, as the internal deformation "formula" can easily be swapped out with different maths. The scene/compound is posted on my blog http://andy.moonbase.net Cheers - AM

Image

Matic
Posts: 70
Joined: 18 Jun 2009, 19:58

Re: Resourcedump

Post by Matic » 07 Feb 2013, 18:22

On another thread there was a question about using ICE to add random movement to a spotlight interest. Here's a scene which should help, it animates a camera interest to have random but smooth motion.
Attachments
example_ICE_AnimateCamInterest.zip
(165.88 KiB) Downloaded 325 times

User avatar
rray
Moderator
Posts: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Resourcedump

Post by rray » 07 Feb 2013, 18:49

Thanks for all these goodies Andy!
This is a script that spreads the envelope weights from 1 bone over several bones.. Select source bone, target bones in that order then run :)

File: *** DefoRemap.js ***
Hidden content: [ Show ]

Code: Select all

DefoRemap();
function DefoRemap()
{
    var SrcDefo = Selection(0);   
	
    var TgtDefos = new ActiveXObject("XSI.Collection") ;   
    for(i=1; i<Selection.Count; i++)
        TgtDefos.Add(Selection(i));
    
	var SrcDefoIx;	
	var TgtDefoIx = new Array;	
	var oEnv = getEnvelopeFromDeformer(SrcDefo);
    var aDefos = oEnv.Deformers;
    var nbDefos =  aDefos.count;
    for(i=0; i<nbDefos; i++) {
        for(j=0; j<TgtDefos.Count; j++)
            if(aDefos(i).Name == TgtDefos(j).Name)
                TgtDefoIx[j] = i;
		if(SrcDefo.Name == aDefos(i).Name)
			SrcDefoIx = i;	
	}
	
    var aVBWeights = new VBArray( oEnv.Weights.Array );
    var aWeights = aVBWeights.toArray();   
	var nbPoints = oEnv.Owners(0).Geometry.Points.Count;
	
	logmessage("from "+SrcDefo.Name+" (ix="+SrcDefoIx+") to:");
	for(i=0;i<TgtDefos.Count;i++)
		logmessage(TgtDefos(i).Name+" (ix="+TgtDefoIx[i]+")");

    var max_base_wt = 0;
    for( i=0; i<nbPoints; i++) {
        var wt = aWeights[nbDefos*i + SrcDefoIx]; // base
        if(wt > max_base_wt)
            max_base_wt = wt;
    }
    logmessage("max_base_wt of source deformer="+max_base_wt);

    for( i=0; i<nbPoints; i++) {
        var wt = aWeights[nbDefos*i + SrcDefoIx]; // source weight of this point
		aWeights[nbDefos*i + SrcDefoIx] = 0;
       
		var x = wt/max_base_wt; // [0..1]% of max base weight
        var delta_x = 1/TgtDefos.Count;

        for(j=0; j<TgtDefos.Count; j++) {  		
            var result_pct;
            var ideal_x = j/TgtDefos.Count;
            var diff = (x-ideal_x)/delta_x;
			
			if(j==0) {
				if(diff > 1.0)
					result_pct = 0.0;
				else if(diff < 0.0)
					result_pct = 1.0;
				else
					result_pct = 1.0-Math.abs(diff);
			} else if(j==TgtDefos.Count-1) {
				if(diff < -1.0)
					result_pct =  0.0;
				else if(diff > 0.0)
					result_pct = 1.0;
				else
					result_pct = 1.0-Math.abs(diff);
			} else {				
				if(diff > 1.0 || diff < -1.0)
					result_pct = 0.0;
				else					
					result_pct = 1.0-Math.abs(diff);
			}		
            aWeights[nbDefos*i + TgtDefoIx[j]] = max_base_wt * result_pct;
        }
    }

	//normalize
    for( i=0; i<nbPoints; i++) {
        for(j=0; j<nbDefos.Count; j++)  
			total = total + aWeights[nbDefos*i + j];
		for(j=0; j<nbDefos.Count; j++) 
			if(total)
				aWeights[nbDefos*i + j] = aWeights[nbDefos*i + j] * (100/total);
	}

   oEnv.Weights.Array = aWeights
}

function getEnvelopeFromDeformer(inObj)
{
    var aEnvs = FindObjects(null, "{470CF890-D3AA-11d0-996C-00A0243F0E60}");
    var eEnvs = new Enumerator( aEnvs );
    eEnvs.moveFirst();
    for (; !eEnvs.atEnd(); eEnvs.moveNext() )
    {
        var oEnv = eEnvs.item();
        var aDefs = oEnv.Deformers;
        var eDefs = new Enumerator( aDefs )
        for(;!eDefs.atEnd(); eDefs.moveNext())       
            if(eDefs.item().Name == inObj.Name)
                return oEnv;       
    }
    return null;
}
edit [rr]: wrapped all long scripts of this thread in hideme tags

(not much tested and doesn't seem to work with only 2 bones)
softimage resources section updated Jan 5th 2024

Bullit
Moderator
Posts: 2621
Joined: 24 May 2012, 09:44

Re: Resourcedump

Post by Bullit » 28 Feb 2013, 20:00

Camera Sequencer .Js. It was done by Dan Lane while XSIbase was alive.

File: *** Camera_Sequencer_v0_03.js ***
Hidden content: [ Show ]

Code: Select all

Camera Sequencer v0.03

History:
v0.01  03-02-2012
v0.02 (24-05-2012) now works with cameras which are children of a Model null.
v0.03 (30-05-2012) Works with cameras without interest nulls.

Creates a new camera which matches a list of cameras.
work in progress needs lots of error checking/trapping including!

Dan Lane 03-02-2012
*/
	if ( findObj( "Camera_Sequencer" ) != false){
	deleteObj("Camera_Sequencer");
	}
	
	//--------------------------------------
	// UI Layout
	//--------------------------------------
	var oCustomProperty = ActiveSceneRoot.AddCustomProperty( 
					"Camera_Sequencer", 
					false ) ;
	oCustomProperty.AddParameter( "camQueue", siString ) ;
	oCustomProperty.AddParameter3( "Start", siDouble, 0,0,2000,false) ;
	oCustomProperty.AddParameter3( "End", siDouble, 0,0,2000,false) ;
	
	var oPPGLayout = oCustomProperty.PPGLayout ;
	oPPGLayout.AddTab( "Chars" );
	
	var updateButton = oPPGLayout.AddButton( "ADD_TO_LIST" , "Add Selected" ) ;
	updateButton.SetAttribute( siUICX , 260 );
	
	oPPGLayout.AddRow() ;
		
	var removeButton = oPPGLayout.AddButton( "REMOVE_FROM_LIST" , "Remove Item" ) ;
	removeButton.SetAttribute( siUICX , 130 );

	var clearButton = oPPGLayout.AddButton( "CLEAR_LIST" , "Clear list" ) ;
	clearButton.SetAttribute( siUICX , 130 );
		
	oPPGLayout.EndRow() ;
	  
	oPPGLayout.AddGroup( "Camera Queue" , true , 1 ) ;
	   
		AddListBox( oPPGLayout, "camQueue" , 260 , false ) ;
	    
		oPPGLayout.EndGroup() ;
	 
	oPPGLayout.AddGroup( "Time Range", true, 1 ) ;
	oPPGLayout.AddRow() ;
		
			var startSlider = oPPGLayout.AddItem( "Start" ,  "Start:" ) ;
			startSlider.SetAttribute( siUICX , 65 );
			
			var endSlider = oPPGLayout.AddItem( "End" ,  "End:" ) ;
			endSlider.SetAttribute( siUICX , 65 );
		
	oPPGLayout.EndRow() ;
	oPPGLayout.EndGroup() ;
	
	var processButton = oPPGLayout.AddButton( "process" , "Process Queue" ) ;
	processButton.SetAttribute( siUICX , 260 );
	processButton.SetAttribute( siUICY , 35 );

	oPPGLayout.Language = "JScript" ;
	
	oPPGLayout.Logic =	 ADD_TO_LIST_OnClicked.toString() +
						 camQueue_OnChanged.toString() +
						 getItemIndex.toString() +
						 Start_OnChanged.toString() +
						 End_OnChanged.toString() +
						 process_OnClicked.toString() +
						 CLEAR_LIST_OnClicked.toString() +
						 REMOVE_FROM_LIST_OnClicked.toString() +
						 findObj.toString();
					
	InspectObj( oCustomProperty, "", "Camera_Sequencer" , siLock  );




	//--------------------------------------
	// Button Functions
	//--------------------------------------
	function REMOVE_FROM_LIST_OnClicked()
	{
		var itemIndex = getItemIndex();
		
		logmessage("item index = " + itemIndex);
		// get the entire list of items
		var oLayout =  PPG.PPGLayout ;
		var oItem = oLayout.Item("camQueue");
		var vbItems = new VBArray(oItem.UIItems);
		var aItems = vbItems.toArray();

		var newList = new Array();
		
		for ( var i = 0 ; i < aItems.length  ; i++ )
			{
				if(i != itemIndex && i != (itemIndex - 1)){
				newList[newList.length] = aItems[i];
				}
			}// end i loop
			
		oItem.UIItems = newList ;
		PPG.Refresh() ;
	}

	function CLEAR_LIST_OnClicked()
	{

		// get current list

		var oLayout =  PPG.PPGLayout ;
		var oItem = oLayout.Item("camQueue");
		var aItems = new Array();
		oItem.UIItems = aItems ;
		PPG.Refresh() ;

	}

	function ADD_TO_LIST_OnClicked()
	{
		// get current list

		var oLayout =  PPG.PPGLayout ;
		var oItem = oLayout.Item("camQueue");
		var vbItems = new VBArray(oItem.UIItems);
		var aItems = vbItems.toArray();
		
		//var aItems = oItem.UIItems;
		var notInList = true;
		

		inName = selection(0).fullname;
	
		if(notInList){
		logmessage("Name not in list");
			// add to the end of the list
			
			var startTimeStr = "0";
			var endTimeStr = "100";
			
			// if this is not the first item
			if(aItems.length != 0){
			
				var lastString = aItems[aItems.length - 2];
			
				var dashIndex = ( lastString.indexOf("-", 0  ));
				
				startTimeStr =  (   parseFloat(lastString.slice(dashIndex + 2 ,lastString.length)) + 1 );
				endTimeStr = (parseFloat( lastString.slice(dashIndex + 2 ,lastString.length) ) + 100) ;
			}
			
			
			//20 chars
			var blankString = "                     ";
			var inLength = inName.length
			
			if(blankString.length > inName.length){
			
			}else{
			
			}
			var gapString = blankString.slice(inName.length ,blankString.length);
			
			aItems[aItems.length] = (inName + gapString + "@ "+startTimeStr+" - " + endTimeStr) ;
			aItems[aItems.length] = inName ;
			
		}// end if notInList
		
		oItem.UIItems = aItems ;
		PPG.Refresh() ;
		
	}// end function

	function camQueue_OnChanged()
	{
		var itemIndex = getItemIndex();
		
		//logmessage("item index = " + itemIndex);
		// get the entire list of items
		var oLayout =  PPG.PPGLayout ;
		var oItem = oLayout.Item("camQueue");
		var vbItems = new VBArray(oItem.UIItems);
		var aItems = vbItems.toArray();
			
			var timesString = aItems[itemIndex - 1];
			var atIndex =   timesString.indexOf("@", 0  );
			var useString = timesString.slice(atIndex , timesString.length);
			
			// extract the times from the timeString
			var spaceIndex = ( useString.indexOf(" ", 0  ));
			
			//logmessage("space index " + spaceIndex);
			var dashIndex = ( useString.indexOf("-", 0  ));
			//logmessage("dash Index " + dashIndex);
			
			var startTimeFloat =     parseFloat(useString.slice(spaceIndex + 1 , dashIndex - 1))  ;
			var endTimeFloat = parseFloat( useString.slice(dashIndex + 2 ,timesString.length) )  ;

			//logmessage("startTimeFloat = " + startTimeFloat);
			
			// set the sliders to these times
			var startSlider = oLayout.Item("Start");
			var endSlider = oLayout.Item("End");
			PPG.Start.Value = startTimeFloat;
			//startSlider.value = startTimeFloat;
			PPG.End.Value = endTimeFloat;
	}// end function

	function Start_OnChanged(){

		if(PPG.Start.Value > PPG.End.Value){
		PPG.End.Value = PPG.Start.Value;
		
		}
		var itemIndex = getItemIndex();
		logmessage( "itemIndex = "+ itemIndex);

		var oLayout =  PPG.PPGLayout ;
		var oItem = oLayout.Item("camQueue");
		var vbItems = new VBArray(oItem.UIItems);
		var aItems = vbItems.toArray();
		
		var timeString = aItems[itemIndex - 1];
		logmessage("aItems[itemIndex - 1] = "+ aItems[itemIndex - 1]);
		
		var atIndex =   timeString.indexOf("@", 0  );
		var useString = timeString.slice(0, atIndex + 1);
		
		aItems[itemIndex - 1] = ( useString + " " + PPG.Start.Value +" - " + PPG.End.Value) ;
		
		oItem.UIItems = aItems ;
		PPG.Refresh() ;
		
	}

	function End_OnChanged(){

		if(PPG.Start.Value > PPG.End.Value){
		PPG.Start.Value = PPG.End.Value;
		
		}
		var itemIndex = getItemIndex();
		//logmessage( "itemIndex = "+ itemIndex);

		var oLayout =  PPG.PPGLayout ;
		var oItem = oLayout.Item("camQueue");
		var vbItems = new VBArray(oItem.UIItems);
		var aItems = vbItems.toArray();
		
		
		var timeString = aItems[itemIndex - 1];
		//logmessage("aItems[itemIndex - 1] = "+ aItems[itemIndex - 1]);
		
		var atIndex =   timeString.indexOf("@", 0  );
		var useString = timeString.slice(0, atIndex + 1);
		
		aItems[itemIndex - 1] = ( useString + " " + PPG.Start.Value +" - " + PPG.End.Value) ;
		//aItems[aItems.length] = inName ;
		oItem.UIItems = aItems ;
		PPG.Refresh() ;
		
	}

	function getItemIndex(){

		// find out which item is clicked
		var clickedStr =  PPG.Inspected(0).Parameters("camQueue").Value;

		// get the entire list of items
		var oLayout =  PPG.PPGLayout ;
		var oItem = oLayout.Item("camQueue");
		var vbItems = new VBArray(oItem.UIItems);
		var aItems = vbItems.toArray();

		// find the clicked item in the entire list
		var itemIndex = -1;
		var counter =  0;
		while(counter < aItems.length){
		
			if( clickedStr == aItems[counter]){
			itemIndex = counter;
			counter =  (aItems.length + 1);
			}
		
		counter ++ ;
		}// end while loop

	return(itemIndex);
	}

function process_OnClicked()
{
	var matchCam = findObj( "matchCam" ) ;
	
	if (matchCam == false){
	}else{
		// use the camera
		var o3DObjCamera = Dictionary.GetObject("matchCam");
		var oPrimObjCameraInterest = o3DObjCamera.Interest;
		deleteObj(o3DObjCamera.fullname);
		//deleteObj(oPrimObjCameraInterest.fullname);
	}
		// create camera
		rtn = SIGetPrimCamera( "Camera", "matchCam", "matchCamInterest" );
		var o3DObjCamera = rtn.Value("3DObjCamera" );
		var o3DObjCameraInterest = rtn.Value("3DObjCameraInterest" );
		var oPrimObjCamera = rtn.Value( "PrimObjCamera" );
		var oPrimObjCameraInterest = rtn.Value(" PrimObjCameraInterest" );
		deleteObj(o3DObjCameraInterest.fullname);
		
	var oLayout =  PPG.PPGLayout ;
	var oItem = oLayout.Item("camQueue");
	var vbItems = new VBArray(oItem.UIItems);
   	var aItems = vbItems.toArray();

	// generate the pose constraints
	for ( var i = 0 ; i < aItems.length  ; i += 2 )
	{
		//Use i
		var timesString = aItems[i];
		var nameValue = aItems[i + 1];
		//logmessage("timeString " + timesString);
		var atIndex =   timesString.indexOf("@", 0  );
		var useString = timesString.slice(atIndex , timesString.length);
		
		// extract the times from the timeString
		var spaceIndex = ( useString.indexOf(" ", 0  ));
		
		//logmessage("space index " + spaceIndex);
		var dashIndex = ( useString.indexOf("-", 0  ));
		//logmessage("dash Index " + dashIndex);
		
		var startTimeFloat =     parseFloat(useString.slice(spaceIndex + 1 , dashIndex - 1))  ;
		var endTimeFloat = parseFloat( useString.slice(dashIndex + 2 ,timesString.length) )  ;
		
		// get the camera to match to
		logmessage(nameValue);
		var matchCamera = Dictionary.GetObject(nameValue);
		
		// get some settings off the camerea
		if(i == 0){
		var camFormat = matchCamera.Parameters("std").Value;
		o3DObjCamera.Parameters("std").Value = camFormat;
		}
		if( matchInt == null){
		
			


				logmessage("Undefined");
		}else{
		
				logmessage("OK");
		}
		
		// get the interest to match to
		var matchInt = matchCamera.Interest;
		
		// add the constraints
		var oConstaintCam = o3DObjCamera.Kinematics.AddConstraint( "Pose", matchCamera , false );
		//var oConstaintInt = o3DObjCameraInterest.Kinematics.AddConstraint( "Pose", matchInt , false );
		
		// key the active parameters
		var activeParam = oConstaintCam.Parameters("active");
		//var activeParamInt = oConstaintInt.Parameters("active");
		
		if ( ClassName(activeParam.source) != "FCurve" ) {
					activeParam.AddFCurve2();
			}
		//if ( ClassName(activeParamInt.source) != "FCurve" ) {
		//			activeParamInt.AddFCurve2();
		//	}
		
		var activeCurveCamera = activeParam.Source;
		//var activeCurveInt = activeParamInt.Source;
		
		activeCurveCamera.AddKey( startTimeFloat - 1 , 0  ) ;
		activeCurveCamera.AddKey( startTimeFloat , 1  ) ;
		activeCurveCamera.AddKey( endTimeFloat + 1 , 0  ) ;
		activeCurveCamera.AddKey( endTimeFloat , 1  ) ;
		
		
		//activeCurveInt.AddKey( startTimeFloat - 1 , 0  ) ;
		//activeCurveInt.AddKey( startTimeFloat , 1  ) ;
		//activeCurveInt.AddKey(  endTimeFloat + 1 , 0  ) ;
		//activeCurveInt.AddKey(  endTimeFloat , 1  ) ;
		
	}// end i loop

	// create the script op for the fov
	var inFovParam = o3DObjCamera.Parameters( "fov" );
	var code = " function myCns_Update( In_UpdateContext, Out ," ; 

			//InTimeWarp , InpreviewSpeed 
			var camNamesArray = new Array();
			var counter = 0;
			for ( var i = 0 ; i < aItems.length  ; i += 2 )
				{
					if(i > 0){
							
							camNamesArray[camNamesArray.length] = "Infov" + counter;
						
						}else{
							
							camNamesArray[camNamesArray.length] = "Infov";
						}
					counter ++;
				};
				
		var camNameString = camNamesArray.join(",");
			
		code += camNameString ; 
		code += " ) \n" ;
		code += " { \n";
		code += "	var current_frame = In_UpdateContext.operator.current_frame.value; \n " ;
		var counter = 0;
		for ( var i = 0 ; i < aItems.length  ; i += 2 )
				{
				
				var timesString = aItems[i];
				var nameValue = aItems[i + 1];
				//logmessage("timeString " + timesString);
				var atIndex =   timesString.indexOf("@", 0  );
				var useString = timesString.slice(atIndex , timesString.length);
				
				// extract the times from the timeString
				var spaceIndex = ( useString.indexOf(" ", 0  ));
				
				//logmessage("space index " + spaceIndex);
				var dashIndex = ( useString.indexOf("-", 0  ));
				//logmessage("dash Index " + dashIndex);
				
				var startTimeFloat =     parseFloat(useString.slice(spaceIndex + 1 , dashIndex - 1))  ;
				var endTimeFloat = parseFloat( useString.slice(dashIndex + 2 ,timesString.length) )  ;
				
				if(i == 0){
						code += "if(current_frame >= " + startTimeFloat + " && current_frame <= " + endTimeFloat + "){ \n" ;
						
					}else{
					
						code += "else if(current_frame >= " + startTimeFloat + " && current_frame <= " + endTimeFloat + "){ \n" ;
					}
					code += " var outValue = " + camNamesArray[counter] + ".Value ; \n";
					code += " } " ;
					
					
				counter ++ ;
				}// end i loop
		
		
		code += "\n  Out.Value = outValue ; \n";
		code += " } \n";
		
		var op = XSIFactory.CreateScriptedOp( "myCns", code , "JScript" );
		op.AddOutputPort( inFovParam , "");
		
		for ( var i = 0 ; i < aItems.length  ; i += 2 )
				{
				op.AddInputPort(  aItems[i + 1] + ".camera.fov" );
				}
				
		
		
		var pdef = XSIFactory.CreateParamDef("current_Frame", siInt4, 0, siAnimatable, "", "", 1, -100000, 100000,0,1);
		var current_Frame_param = op.AddParameter(pdef);
		op.Connect();
		SetExpr(op + ".current_frame","fc");
	

	}// end function

	function AddListBox( in_oLayout, in_Name , width , multi)
	{
		// Insert a ListBox into the layout
		var oItem = in_oLayout.AddItem( in_Name, "", "ListBox" ) ;
		oItem.SetAttribute( "CY", 175 ) ;
		oItem.SetAttribute( "CX", width ) ;
		oItem.SetAttribute( "NoLabel", true ) ;
		//Note: Multi-selection list box control only applies to string parameter.
		oItem.SetAttribute( siUIMultiSelectionListBox, multi ) ;
	}

	function findObj( inObj ) {
		var oColl = new ActiveXObject("XSI.Collection"); 
		oColl.items = inObj;
		
		if (oColl.count > 0) {
			return(oColl(0));
		} else {
			return(false);
		}
		
	}
edit [rr]: wrapped all long scripts of this thread in hideme tags

I have taken off the email from Dan Lane to not get into search engines. PM me if needed.

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests