Page 1 of 1

NoTranslateScaler

PostPosted: Tue Mar 11, 2014 9:31 pm
by tazinator
WARNING: TOOL MAY CRASH!!!


This plugin makes things bigger along the X and Y axes WITHOUT moving them (translate is the geometry term). It has a simple table where you plugin your # for the x axis, and the y axis. You can use it to stretch objects if you like.


A version which does translate objects will be in the works eventually, as that has it's own usefulness.
In my thoughts is a version which considers scaling with a skew factor (like angles). but that is beyond me at this time. Enjoy!

  Code:
-- Scale Tool for X plane
-- Authored by Thomas of Hilo
-- Based on works by Kaen, raptor, Watusimoto
 
function getArgsMenu()
 
menu =  {
        TextEntryMenuItem.new("Scale X: ", "1", "10.0", "I don't know what's going on here"),
        TextEntryMenuItem.new("Scale Y: ", "1", "10.0", "Woo hoo")
        }
        return "NoTranslateScaler", "Scale selections on the X Y axis without them moving around", "Ctrl+=", menu
end
 
function main()
        local sx = table.remove(arg, 1)
        local sy = table.remove(arg, 1)
 
        local objects = plugin:getSelectedObjects()
       
       
        if #objects == 0 then
                plugin:showMessage("Operation failed.  No objects are selected", false)
                return
        else
                for _, obj in pairs(objects) do
                        local geom = obj:getGeom()
                        local result = Geom.scale(geom, sx, sy)
                        obj:setGeom(result)
                end
        end
 
end
 

Re: NoTranslateScaler

PostPosted: Tue Mar 11, 2014 9:39 pm
by Fordcars
Whoa sweet!

Re: NoTranslateScaler

PostPosted: Wed Mar 12, 2014 3:20 pm
by tazinator
I've discovered that using my scaler tool on multiple teleporters or speedzones can CRASH. I am requesting help figuring this out
I am assuming at the moment that it will happen with all objects with two points.

Now here is some extra relevant information: I used copy, paste, undo, redo, and the in-game Scale tool before I used my tool and found the game to crash. I cannot reproduce the bug now..

Re: NoTranslateScaler

PostPosted: Thu Mar 13, 2014 2:46 am
by watusimoto
Does it happen when sx or sy are 0?

Re: NoTranslateScaler

PostPosted: Thu Mar 13, 2014 3:07 am
by tazinator
Got it!
  Code:
LevelFormat 2
GameType 10 8
LevelName ""
LevelDescription ""
LevelCredits tazinator
Team Blue 0 0 1
Specials
MinPlayers
MaxPlayers
Teleporter -153 -127.5 102 -127.5
Teleporter -127.5 153 127.5 153
 

Step 1. Open level tles (it just has 2 teles i randomly placed using 't' you can make ur own)
Step 2. Use this tool. values are x=1 y=1
step 3. ctrl z
step 4. repeat step 2
CRASH! (i got three times in a row with these steps)

the bug seems intertwined with the use of ctrl z. I dont understand how or why

Re: NoTranslateScaler

PostPosted: Thu Mar 13, 2014 9:35 am
by raptor
In the future, can you please tell us what type of 'CRASH'?

With Lua scripts there are 2 types:
1. The script crashes but you can still play the game
2. The game itself crashes and shutdown (known sometimes as a 'hard crash'). This includes the spinning beachball of death on OSX.

#1 is almost always the fault of the person writing the Lua script. #2 would be a critical bug that we need to fix.

Re: NoTranslateScaler

PostPosted: Thu Mar 13, 2014 10:50 am
by watusimoto
Our goal is to make it impossible to hard-crash the game with a scripting error. Fixing these sorts of crashes is usually our highest priority.

Re: NoTranslateScaler

PostPosted: Thu Mar 13, 2014 11:42 am
by tazinator
#2 crash