Closed Thread
Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 35

Thread: Parenting supported by gates, more to come

  1. #11
    Wirererer sk89q's Avatar
    Join Date
    Sep 2009
    Posts
    270

    Default Re: Parenting supported by gates, more to come

    I am able to touch MOST Wire components once they have parented, but with some I am unable to wire them. The numpad for one, as I could not touch that at all with any tool and so I had to undo the parent later, wire, and then re-parent.
    Tabbed Prop Spawn Menu
    My Website, KAF's Anime Music



    Build: F6 quick save, PewPew, interactive tutorial system, custom tools
    Wire: UWSVN, High Speed Snapshot Viewer, EGPv3, bunch of Wiremod fixes
    E2: Prop Core, Constraint Core, Entity Core, holoModelAny(), applyPlayerForce(), etc.
    We have modified and rewritten a number of our addons.

  2. #12
    Have plane will travel Anticept's Avatar
    Join Date
    Feb 2008
    Location
    Ohio, USA
    Posts
    1,503

    Default Re: Parenting supported by gates, more to come

    Try to get us a list of any components that don't work once parented.
    "You can only tie the record for flying low."

  3. #13
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,010

    Default Re: Parenting supported by gates, more to come

    Suggestion:
    I really dislike how the checkboxes work now.
    I think it would be much more clear to have a radio-select button like:

    Constraint:
    • None
    • Weld & no-collide
    • Parent & no-collide

    There is almost no occasion when it shouldn't be no-collided.
    When somebody does has a need to have no no-collide, that's easily done with none selected.
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  4. #14
    Have plane will travel Anticept's Avatar
    Join Date
    Feb 2008
    Location
    Ohio, USA
    Posts
    1,503

    Default Re: Parenting supported by gates, more to come

    Garrysmod supports radio buttons?
    "You can only tie the record for flying low."

  5. #15
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,010

    Default Re: Parenting supported by gates, more to come

    It doesn't?

    Oh, it doesn't.

    Well regardless of that: Those 3 options, checking one, unchecks whatever was selected before.
    So basically a radio button.

    That seems a lot more logical to me, now one blocks the other one from being used.
    For obvious reasons of course, but still it seems unnatural.
    Last edited by Bull; 06-03-2010 at 01:29 PM.
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  6. #16
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: Parenting supported by gates, more to come

    I could try to code a radio button derma item, which we can include in the wire svn. Then people could use it for other things in wiremod as well
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  7. #17
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: Parenting supported by gates, more to come

    Radio button done.

    Videos:
    Video before I had overwritten Paint:

    Video after I had overwritten Paint:


    Code:
    Code:
    local PANEL = {}
    
    function PANEL:Init()
        self:SetSize( 16, 16 )
        self:SetType("none")
        self.Partners = {}
    end
    
    function PANEL:Toggle()
        if (!self:GetChecked()) then
            for k,v in pairs( self.Partners ) do
                if (v == true) then
                    k:SetValue(false)
                    k:SetType("none")
                end
            end
            self:SetValue(true)
            self:SetType("none")
        end
    end
    
    function PANEL:Paint()
        draw.RoundedBox( 8, 0, 0, 16, 16, Color( 0,0,0,255 ) )
        draw.RoundedBox( 6, 2, 2, 12, 12, Color( 255,255,255,255 ) )
        if (self:GetChecked()) then
            draw.RoundedBox( 4, 4, 4, 8, 8, Color( 0,0,0,255 ) )
        end
    end
    
    function PANEL:DrawBorder() end
    function PANEL:PaintOver() end
    function PANEL:ApplySchemeSettings() end
    function PANEL:Scheme() end
    
    function PANEL:AddPartner( Partner )
        if (Partner.Button) then
            self.Partners[Partner.Button] = true
            if (Partner.Button.Partners[self] == nil) then Partner.Button:AddPartner( self ) end
        else
            self.Partners[Partner] = true
            if (Partner.Partners[self] == nil) then Partner:AddPartner( self ) end
        end
    end
    
    function PANEL:RemovePartner( Partner )
        if (Partner.Button) then
            self.Partners[Partner.Button] = nil
            if (Partner.Button.Partners[self] == true) then Partner.Button:AddPartner( self ) end
        else
            self.Partners[Partner] = nil
            if (Partner.Partners[self] == true) then Partner.Button:AddPartner( self ) end
        end
    end
    
    function PANEL:SetPartners( ... )
        local args = {...}
        table.insert( args, self )
        for k,v in ipairs( args ) do
            if (v.Button) then v.Partners = {} else v.Partners = {} end
            for k2, v2 in ipairs( args ) do
                v:AddPartner( v2 )
            end
        end
    end
            
    derma.DefineControl( "DRadioButton", "Radio Button", PANEL, "DCheckBox" )
    
    PANEL = {}
    
    function PANEL:Init()
        self:SetTall( 18 )
        self.Button = vgui.Create("DRadioButton",self)
        function self:DoClick() self.Button:Toggle() end
    end
    
    function PANEL:AddPartner( Partner )
        self.Button:AddPartner( Partner )
    end
    
    function PANEL:RemovePartner( Partner )
        self.Button:AddPartner( Partner )
    end
    
    function PANEL:SetPartners( ... )
        self.Button:SetPartners( ... )
    end
    
    function PANEL:PerformLayout()
        local x = self.m_iIndent or 0
        self.Button:SetSize( 16, 16 )
        self.Button:SetPos( x, 0 )
        if (self.Label) then
            self.Label:SizeToContents()
            self.Label:SetPos( x + 16 + 10, 0 )
        end
    end
    
    function PANEL:SetText( Text )
        if (!self.Label) then
            self.Label = vgui.Create("DLabel",self)
            self.Label:SetMouseInputEnabled(true)
            self.Label.OnMouseReleased = function() self.Button:Toggle() end
        end
        
        self.Label:SetText( Text )
        self:InvalidateLayout()
    end
    
    function PANEL:SetValue( val ) self.Button:SetValue( val ) end
    function PANEL:SetChecked( val ) self.Button:SetChecked( val ) end
    function PANEL:GetChecked( val ) return self.Button:GetChecked() end
    function PANEL:Toggle() self.Button:Toggle() end
    function PANEL:Paint() end
    
    derma.DefineControl( "DRadioButtonLabel", "Radio Button label", PANEL, "DPanel" )
    Example code (used in the 2nd video)
    Code:
    local pnl = vgui.Create("DFrame")
    pnl:ShowCloseButton(true)
    pnl:SetDeleteOnClose(true)
    pnl:SetSize(300,300)
    pnl:Center()
    pnl:MakePopup()
    
    local box1 = vgui.Create("DRadioButton",pnl)
    box1:SetPos( 80, 50 )
    
    local box2 = vgui.Create("DRadioButtonLabel",pnl)
    box2:SetPos( 80, 70 )
    box2:SetText("hello")
    
    local box3 = vgui.Create("DRadioButton",pnl)
    box3:SetPos( 80, 90 )
    
    box1:SetPartners( box2, box3 )
    
    box1 = vgui.Create("DRadioButton",pnl)
    box1:SetPos( 10, 50 )
    
    box2 = vgui.Create("DRadioButtonLabel",pnl)
    box2:SetPos( 10, 70 )
    box2:SetText("hello")
    
    box3 = vgui.Create("DRadioButton",pnl)
    box3:SetPos( 10, 90 )
    
    box1:SetPartners( box2, box3 )
    Usage:
    Code:
    -- First create 2 radio buttons on some parent
    local box1 = vgui.Create("DRadioButton",someparent)
    local box2 = vgui.Create("DRadioButton",someparent)
    -- And don't forget to set their position etc
    
    -- Then use AddPartner, RemovePartner and SetPartners to make them trigger eachother.
    -- For example:
    box1:AddPartner(box2)
    box2:AddPartner(box1)
    -- This will make box1 and box2 uncheck eachother. If you click box1, box2 will be unchecked, and if you click box2, box1 will be unchecked.
    
    -- If you have several checkboxes, writing AddPartner for every combination might be a bit time consuming and annoying. For this reason, I made SetPartners(...).  Simply enter every single box in the "..." argument and it runs AddPartner on every single one.
    box1:SetPartners( box2, box3, box4, box5, box6, box7, box8, etc etc )
    
    -- Remember that SetPartners first resets each control's Partner table, so if you do this:
    box1:AddPartner( box10 )
    box1:SetPartners( box2, box3, box4, box5 )
    -- Box1 and 10 will no longer be linked.
    Suggestions?
    Last edited by Divran; 06-05-2010 at 02:44 PM.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  8. #18
    Wire Sofaking Azrael's Avatar
    Join Date
    Aug 2007
    Posts
    1,946

    Default Re: Parenting supported by gates, more to come

    That's cool, but why not use a dropdown combo-box instead?

  9. #19
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: Parenting supported by gates, more to come

    Because this is cooler. But I haven't committed it yet. Waiting on some more suggestions and ideas (Anticept's and Bull's thoughts on this especially).
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  10. #20
    Wire Sofaking Grocel's Avatar
    Join Date
    Mar 2008
    Location
    Germany, NRW, Remscheid
    Posts
    752

    Default Re: Parenting supported by gates, more to come

    Why Garry didn't made radio buttons for gmod.

    Divran your radio buttons are awesome.
    Quote Originally Posted by Wizard of Ass View Post
    The secret phrase in gmod is: Rusty bullet hole
    Im a molecule!

Closed Thread
Page 2 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots