Reset tool
Just a little script-tool when you are playing with items…and things go wrong.
This script will reset the selected values of all the items in the container.
Suggestions are welcomed.
Just run it from the lightning or the item menu.
———————————-
var cont = LL.getEvent().getContainer();
var items = cont.getItems();
var bools = [];
bools[0] = confirm(“Reset cell? (only grid items) [0,0]”);
bools[1] = confirm(“Reset position? (only free items) [0,0] “);
bools[2] = confirm(“Reset rotation? (only free items) [0]”);
bools[3] = confirm(“Reset scale? (only free items) [1,1]”);
bools[4] = confirm(“Reset skew? (only free items) [0,0]”);
bools[5] = confirm(“Reset size? (only free items) [cell size]”);
bools[6] = confirm(“Reset visibility? [true]”);
for(var i=0;i var t=items.getAt(i); if(bools[0])t.setCell(0,0,1,1); if(bools[1]) t.setPosition(0,0); if(bools[2]) t.setRotation(0); if(bools[3]) t.setScale(1,1); if(bools[4]) t.setSkew(0,0); if(bools[5]) t.setSize(cont.getCellWidth(),cont.getCellHeight() ); if(bools[6]) t.setVisibility(true); }
< ![CDATA[
Very useful
]]>
< ![CDATA[
Pierre Hébert, I want to ask: is there an limit in those values? Specifically in the scale one.
Testing with my scripts, I manage to had items with scale (from the geometry editor) over 50000…yes, four zeros (Scale*= scale is not a good idea 😛 )
When I run this script it did nothing. I needed to change the scale to 5000, 500…can’t remember now.
That’s why I ask.
]]>
< ![CDATA[
The limit is the floating point operation accuracy and maximum value. The transformation matrix uses 32bits floats. While it can hold large values (thanks to the exponent), it will lose precision rather soon, but I don’t know how it behaves exactly. I would think that 50000 is not large enough to create large arithmetic errors, so the problem may be elsewhere.
]]>