Hi Guys
I'm using the following additional code below to check for object file_name (i.e. no wheel logo). Works great except the missing wheel logo fallbacks only pop-on after I move the wheel. The constructor method is triggered then only the on_progress method is activated at the point where the wheel moves so I need a way to loop through and check file_name properties at the point of load.
class WheelEntry extends ConveyorSlot {
constructor() {
base.constructor( ::fe.add_artwork( myConfig["orbit_art"] ));
//base.constructor( ::fe.add_image( "parts/no-logo.png" ) ); //this loads but doesn't then place the wheel art
}
function on_progress( progress, var ) {
local p = progress / 0.1;
local slot = p.tointeger();
p -= slot;
slot++;
if ( slot < 0 ) slot=0;
if ( slot >= 10 ) slot=10;
/* ADDITIONAL */
if(m_obj.file_name == ""){
m_obj.file_name = "parts/no-logo.png";
m_obj.preserve_aspect_ratio = true;
}
/* ADDITIONAL */
m_obj.x = wheel_x[slot] + p * ( wheel_x[slot+1] - wheel_x[slot] );
m_obj.y = wheel_y[slot] + p * ( wheel_y[slot+1] - wheel_y[slot] );
m_obj.width = wheel_w[slot] + p * ( wheel_w[slot+1] - wheel_w[slot] );
m_obj.height = wheel_h[slot] + p * ( wheel_h[slot+1] - wheel_h[slot] );
m_obj.rotation = wheel_r[slot] + p * ( wheel_r[slot+1] - wheel_r[slot] );
m_obj.alpha = wheel_a[slot] + p * ( wheel_a[slot+1] - wheel_a[slot] );
}
};
Ideally a solution should not touch the main conveyor.nut file (which I've not been able to successfully locate actually: is it this one "/usr/local/share/attract/modules/conveyor.nut" ?).
So close but not close enough.
Many thanks
Dal