Accessing Fcurve key 's via scripting 2004-03-19 - By kevin korngut
Back I was wondering if anyone knew of a way to check to see if a key's Slope Length/Orientation was Broken or Unified and a way to set that via scripting. anyone have any ideas? Thanks, Kevin
Kevin Korngut Systems Administrator Janimation www.janimation.com
-- --Original Message-- -- From: Matt Lind [mailto:speye_21@(protected)] Sent: Thursday, September 11, 2003 3:33 PM To: SI_XSI Subject: Re: script: get jscripts 'for in' to work on selection
> On the linux implementaion of JScript, we dont have built in push and > unshift methods (they don't show up until, JScript 5.X, I believe). > Therefore we are left to create our own. If you prepend this to the > head of your example, voila, a predictable creation order is returned. > > The built in push and unshift methods are producing the unreliable results, > not the for/in loop.
[Matt] The built-in push() and unshift() methods are working just fine. If they weren't, the standard for(;;) loop would also be broken.
With each call of push() or unshift() a new strip of memory is allocated to hold the new data. This means the array, while a single entity in script code, is actually fragmented across several memory spaces. The standard for(;;) loop is intelligent in that it checks the location of the specified element in the array when being called, but the for/in loop simply runs through the allocated memory on a first-come, first-serve basis and returns whatever's there. Because the user cannot know or control the layout of memory, the returned value of for/in is random as illustrated in my previous example.
for/in 'appears' to work with your code because your custom unshift and push methods rewrite the array as a series of single-index memory spaces. Because there's only one way to read a memory space that contains a single element, for/in 'appears' to work properly. However, that doesn't fix for/in as you're just working around/hiding it's faults. for/in still returns elements randomly from the memory spaces. If Jscript goes through a garbage collection phase or your array picks up data held in continguous blocks, memory layout can change and for/in will exhibit the same problems all over again.
You still haven't proven for/in returns elements in their creation order.
Matt
Date : Thu, 11 Sep 2003 11:02:44 -0700 To : XSI(at)Softimage.COM >From : Andy Buecker <abuecker(at)ilm.com> Subject : Re: script: get jscripts 'for in' to work on selection
On the linux implementaion of JScript, we dont have built in push and unshift methods (they don't show up until, JScript 5.X, I believe). Therefore we are left to create our own. If you prepend this to the head of your example, voila, a predictable creation order is returned.
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
function push() { for (var i=0; i<arguments.length; i++) { this[this.length] = arguments[i]; } }
function unshift() { var temp = new Array(); for (var i=0; i<arguments.length; i++) { temp[temp.length] = arguments[i]; } for (var i=0; i<this.length; i++) { temp[temp.length] = this[i]; } for (var i=0; i<temp.length; i++) { this[i] = temp[i]; } }
Array.prototype.push = push; Array.prototype.unshift = unshift;
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
The built in push and unshift methods are producing the unreliable results, not the for/in loop.
It's been fun,
-A
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|