THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/01/2007 at 14:55, xxxxxxxx wrote:
Ok! Really what I want to obtain is that on having rotated a called "Plane" object, the entire value of the horizontal rotation of this object assigns to itself to a variable to determine the file of a texture, for example: Tex0123.tif
Thx
main(doc,vActObj)
{
var vObj, vRot;
var vName="Plane";
vObj=doc->FindObject(vName);
if (vObj==NULL) return;
vRot=vObj->GetRotation();
vActObj->SetRotation(vRot);
var fval = "0000" + tostring(vRot);
var mval = strmid( fval, sizeof(fval)-4,4);
var mfn = "F:\\ExemplesXPresso\\Textura\\Arboles\\Tex" + mval + ".tif";
//
var mat = doc->GetFirstMaterial();
mat->SetChannelState(CHANNEL_COLOR, TRUE);
// Sets a texture for it
var color = mat->GetChannel(CHANNEL_COLOR);
var colorC = color->GetContainer();
colorC->SetData(CH_TEXTURE, mfn);
color->SetContainer(colorC);
mat->Update();
}