Hello, I am looking for a script to randomly rotate the image texture of an object. Inside the interface that kind of rotation could be done with the Layered Image Editor, but the rotation options are limited to 90, 180 et 270 degrees.
I used the code from @Esemwy (https://www.daz3d.com/forums/discussion/62783/surface-selection-script/p1) to access to the surfaces Tab and a function to generate integer numbers from 0 to 360 degrees. There is no error message in the console but the image texture doesn't move.
function RandomPos(min, max) {
min = Math.ceil(0);
max = Math.floor(360);
return Math.floor(Math.random() * (max - min +1)) + min;
var nNodes = Scene.findNodeByLabel("Duvet");
for (var i=0; i < nNodes; i++) {
var oNode = Scene.getNode(i)
var oObj = oNode.getObject();
if (! oObj) continue;
var nShapes = oObj.getNumShapes();
for (var j=0; j < nShapes; j++) {
var oShape = oObj.getShape(j);
var nMat = oShape.getNumMaterials();
for (var k=0; k < nMat; k++) {
var oMat = oShape.getMaterial(k);
oMat.select(true);
oMat.getXRotControl().setValue(RandomPos());
}
}
}
}
The last line works for moving an object but not here ; it's probably due to the absence of transforms controllers in the surfaces editor...
Does anyone have a image texture rotation script that works ?