FAQ  •  Register  •  Login

STRETCH TOOL

Forum rules
Post confirmed bugs and approved feature requests here. Unapproved feature requests will be deleted.

Please limit posts to One Feature per Thread unless features are closely related.
<<

tazinator

Posts: 352

Joined: Fri Jul 05, 2013 7:35 pm

Post Mon Mar 10, 2014 12:43 am

STRETCH TOOL

OK.

Game based on vertexes. Has scale tool which works fine, but not stretching along one plane/axis. something is wrong here :P
Last edited by tazinator on Mon Mar 10, 2014 9:28 pm, edited 1 time in total.
Play my new level! Two different teams fight over a nexus: One mainly defends while the other attacks! is fun
viewtopic.php?f=33&p=21002#p21002
<<

sky_lark

User avatar

Posts: 2053

Joined: Wed Mar 10, 2010 6:00 pm

Post Mon Mar 10, 2014 6:46 pm

Re: STRETCH TOOL

Like a resize tool along only one plane?
Follow Bitfighter! FacebookTwitterDiscord
<<

tazinator

Posts: 352

Joined: Fri Jul 05, 2013 7:35 pm

Post Mon Mar 10, 2014 8:52 pm

Re: STRETCH TOOL

Yeah. I would code it if I A. knew how B. could compile
Play my new level! Two different teams fight over a nexus: One mainly defends while the other attacks! is fun
viewtopic.php?f=33&p=21002#p21002
<<

Fordcars

User avatar

Posts: 1016

Joined: Fri Apr 20, 2012 3:51 pm

Location: Some city, somewhere

Post Mon Mar 10, 2014 8:59 pm

Re: STRETCH TOOL

Plug-in?
skybax: Why is this health pack following me?
bobdaduck: uh, it likes you.
<<

tazinator

Posts: 352

Joined: Fri Jul 05, 2013 7:35 pm

Post Mon Mar 10, 2014 9:29 pm

Re: STRETCH TOOL

No such plugin has been found by me :Z
I really want to try making one because this is such a simple thing to be missing, I think even I can do it. Most plugins look pretty simple it just takes understanding the functions and variables.
Play my new level! Two different teams fight over a nexus: One mainly defends while the other attacks! is fun
viewtopic.php?f=33&p=21002#p21002
<<

Fordcars

User avatar

Posts: 1016

Joined: Fri Apr 20, 2012 3:51 pm

Location: Some city, somewhere

Post Mon Mar 10, 2014 10:26 pm

Re: STRETCH TOOL

Go ahead :)
skybax: Why is this health pack following me?
bobdaduck: uh, it likes you.
<<

watusimoto

Site Admin

Posts: 1558

Joined: Tue Feb 23, 2010 7:07 pm

Location: Quartz's mom's house

Post Tue Mar 11, 2014 3:00 am

Re: STRETCH TOOL

A plugin would be pretty easy...

1. Pop up a dialog asking for an x and y scaling factor
2. Cycle through all items.
3. If item is selected, apply scaling factor to object's geometry (there may be a function to do this in the geom.lua lib that came with Bitfighter)

There should be examples of how to do all of these things in other plugins.

I'd recommend taking an existing plugin, renaming it, deleting the parts you don't need, and using that as a skeleton for yours.
<<

tazinator

Posts: 352

Joined: Fri Jul 05, 2013 7:35 pm

Post Tue Mar 11, 2014 2:27 pm

Re: STRETCH TOOL

STEP 1: POW! TABLE
Step 2: Selecting is a go
Step 3: geometry.. working on it. I don't understand how to do things with geometry. This is the hard part
  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 "XYScaler", "Scale selection on the X or Y axis", "Ctrl+=", menu
end

function main()
    local objects = plugin:getSelectedObjects()
   
   
    if #objects == 0 then
        plugin:showMessage("Operation failed.  No objects are selected", false)
        return
    end
end

 


making it a bit better, fured out how to use args 1 and 2 from the table

  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 "XYScaler", "Scale selection on the X Y axis", "Ctrl+=", menu
end

function main()
    local sx = table.remove(arg, 1)
    local sy  = table.remove(arg, 2)

    local objects = plugin:getSelectedObjects()
   
   
    if #objects == 0 then
        plugin:showMessage("Operation failed.  No objects are selected", false)
        return
    else
    end
end


Almost finished.. see my comment at the bottom of the plugin
  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 "XYScaler", "Scale selection on the X Y axis", "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 typeId = obj:getObjType()
            local geom = obj:getGeom()
            local team = obj:getTeamIndex()
            local result = Geom.scale(geom, sx, sy)

--[[ the following two lines outside brackets do not work.
I need to table.insert?
And object is global, i need a local object
]]
--       
   object:setGeom(geom)
   bf:addItem(object)

        end
    end

end
Play my new level! Two different teams fight over a nexus: One mainly defends while the other attacks! is fun
viewtopic.php?f=33&p=21002#p21002
<<

Fordcars

User avatar

Posts: 1016

Joined: Fri Apr 20, 2012 3:51 pm

Location: Some city, somewhere

Post Tue Mar 11, 2014 9:34 pm

Re: STRETCH TOOL

I think
  Code:
sx = arg[1]
sy = arg[2]

would be a bit better than using table.remove :) But I might be wrong

Yours actually look great, but it might be a tiny bit more computer extensive
skybax: Why is this health pack following me?
bobdaduck: uh, it likes you.

Return to Bitfighter Features

Who is online

Users browsing this forum: No registered users and 31 guests

cron