Wednesday word cloud: SHOOT Summer Top 10


From SHOOTonline, the software used on the SHOOT summer Top 10 leading VFX and Animation spots.

SummerTop10Visual EffectsAnimationChart

The top 10:

  1. PETA’s “98% Human” (Mill+, New York)
  2. Honda UK’s “Hands” (Nexus Productions)
  3. DirecTV’s “Troll” (Method Studios)
  4. Square Enix’s “Murdered: Soul Suspect” game trailer (Digital Domain)
  5. Chumash Casino Resort’s “You Too Are Chumash” (Blacklist)
  6. McLaren FI’s Tooned 50 (episode one) (Framestore, London)
  7. Oreo’s “Bedtime” (Pysop, bicoastal)
  8. Xbox/Ryse: Son of Rome’s “Explosion” game trailer (NTropic)
  9. Jarritos’ “Glass Blowers” (CHRLX)
  10. APES’ “APES: A Project of the Conservation Trust (MassMarket)

Set Flags and bitmasks


SetFlags
Set Flags shows how to store multiple boolean flags in a single integer value. In programming, this is known as a bitmask or as bit flags, and the idea is based on the binary number system where each digit can be only 0 or 1 (on or off, true or false).

For example, in the binary number 1010, you have four bit flags: flags 0 and 3 are false, and flags 1 and 4 are true. The decimal equivalent of 1010 is 10 (21 + 23).

Binary Decimal Power of 2
00000001 1 20
00000010 2 21
00000100 4 22
00001000 8 23
00010000 16 24
00100000 32 25
01000000 64 26
10000000 128 27

Instancing a random shape with a random start frame


Here I’m instancing a group of Arnold standin sequences, and giving each instance a different start frame. (Each standin sequence is an animated bulge on a cylinder.)
random shape w random offset
PS It works fine until you go past the last frame of the sequence, because looping or clamping the ShapeInstanceTime doesn’t seem to prevent SItoA from loading the non-existent ass file.

PPG callbacks and variable scope


The scope of variable b is this snippet. That is, the identifier b exists and has the value 1 only while this snippet is running. After that, it doesn’t exist unless some other code defines it.

Consequently, the OnClicked callback is going to fail with a ‘b’ is undefined error.

var myPset = ActiveSceneRoot.AddProperty("CustomProperty",false,"Mytest");
var myLayout = myPset.PPGLayout;

var b = 1;

function a_OnClicked(){
	LogMessage( b );	
}

myLayout.AddRow()
myLayout.AddButton("a","button");
myLayout.EndRow() 

myLayout.Logic=OnInit.toString() +  a_OnClicked.toString();
myLayout.Language = "JScript" ;

InspectObj(myPset);

The way it works is that Softimage creates a new instance of the JScript ActiveX scripting engine each time it needs to execute some fragment of code. So, the above snippet runs in one instances of the scripting engine (which is destroyed after the code is executed). Then later, when the button is clicked, the OnClicked callback runs in a new and different instances of the scripting engine. And that new instance of the scripting engine, there is no variable named b.

One way around this would be to add b as a parameter:

var myPset=ActiveSceneRoot.AddProperty("CustomProperty",false,"Mytest");
var b =	myPset.AddParameter2("b",siInt4,1,0,100,0,100,siClassifUnknown,siPersistable | siKeyable);

var myLayout=myPset.PPGLayout;

myLayout.AddRow()
myLayout.AddButton("a","button");
myLayout.EndRow() 
myLayout.Logic=OnInit.toString() +  a_OnClicked.toString();
myLayout.Language = "JScript" ;

InspectObj(myPset);

function a_OnClicked(){
	LogMessage(PPG.b);	
}

Another way would be to use a LogicFile, something like this:

// LogicFile for an on-the-fly custom property
var b = 1;
var c = -1;
function OnInit() {
	LogMessage( "OnInit" );
	c = 99;
}
function a_OnClicked(){
	LogMessage( b );	
	LogMessage( c );
}

Then your property would work like this:

var myPset=ActiveSceneRoot.AddProperty("CustomProperty",false,"Mytest");
var myLayout=myPset.PPGLayout;

myLayout.AddRow()
myLayout.AddButton("a","button");
myLayout.SetAttribute( siUILogicFile, "\\some\\path\\LogicFile.js" );

myLayout.EndRow() 
myLayout.Language = "JScript" ;

InspectObj(myPset);

And this would give the following output:

// INFO : OnInit
// INFO : 1
// INFO : 99