Peer-to-Peer Forum

 

Login Register    
caveat: secret matirx in “Light String w/ Delta”
Posted: 24 August 2010 09:18 AM  
Sr. Member
RankRankRankRank
Total Posts:  547
Joined  2009-03-17

As a warning about the power and danger of scripts ...

I wrote a “Collapse Matrices” script that would find all XForms on Xrefs and collapse them.  Batch mode so I could do dozens of files at a time, and runs ~80% faster than the tool in Creator itself.

I then found that the Place model tools puts a matrix (or matrices) on the group node above the XRef, so pulled the

type mgGetCode rec)
if ( 
type == fltXRef

out of the script, and simply did a check to see if a node had a transform.

We discovered much later that that buggers up all the light strings that were entered as “light string with delta”.  apparently type of light string has an XForm on it somewhere embedded in the record that the user is unaware of, and when you collapse that matrix it pretty much gets rid of all the lightpoints in the string other than the first vertex.

So I put a

type mgGetCode rec)
if ( ( 
type == fltXRef) or (type == fltGroup

in there and everything is fine.

So warning - if you are using scripts to modify a whole bunch of objects in a “destructive” fashion (you can’t unscramble those eggs), thoroughly test, and either CM or make a copy of the pre-modified files until you have a chance to publish and QA the end results 8*).

 
Posted: 24 August 2010 11:06 AM   [ # 1 ]  
Newbie
Rank
Total Posts:  20
Joined  2008-06-11

Hi Kent,

apparently type of light string has an XForm on it somewhere embedded in the record that the user is unaware of, and when you collapse that matrix it pretty much gets rid of all the lightpoints in the string other than the first vertex.

Actually you get the second vertex.

OpenFlight has the concept of replication.  Replication is a transformation and a fltRepCnt greater than zero.  What this will do is render the geometry below the fltRepCnt times Plus One.  The first one is untranformed and each subsequent time it renders, it will transform the geometry by the transformation.  You can try this by using the replication tool in the Duplicate Toolbox.  Create a box, select the group and run the replicate tool.  The parameters are basically the same as the light string tool.

The lightstring uses this same technique.  There is a transformation and fltRepCnt on the fltLightPoint node.  This draws the vertex in place, then transforms and draws the vertex again fltRepCnt times.

If you want to remove the transformation, you will need to duplicate the vertex attach it to the fltLightPoint node and transform it then repeat that fltRepCnt times.  Then you can remove the transforms and set the fltRepCnt to zero.

If you are flattening transformations,  you should also check the fltRepCnt on the group nodes.

Hope this helps.

Nelson

 
Posted: 24 August 2010 11:12 AM   [ # 2 ]  
Sr. Member
RankRankRankRank
Total Posts:  547
Joined  2009-03-17

Thanks.  I figured it was something like that.  We have a plugin that changes the string/delta to vertices.  Just didn’t realize that there could be XForms attached to records that didn’t show up in the hierarchy.  Might occur other places as well.  Just putting the word out so somebody else may learn from my assumptions / mistakes 8*).