1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

Bodygroup preview

Discussion in 'Programming' started by Atebite, Aug 8, 2014.

  1. Got bored and made this bodygroup previewer

    [​IMG]

    ATM it really just looks cool, maybe I could make it export info on the bodygroups so that it'd have some actual use beyond showing you how it looks. You wouldn't have to sift through all bodygroups to see which ones look good.

    Code:
    local PANEL = {}
    
    function PANEL:Init()
    	self:SetTitle("Bodygroup preview")
    	self:SetSize(700, 500)
    	self:Center()
    	
    	self.body_group = 0
    	self.body_group_val = 0
    	
    	self:Populate()
    end
    
    function PANEL:Populate()
    	local list = vgui.Create("DPanelList", self)
    	list:SetPos(2, 24)
    	list:SetSize(300, 474)
    	list:SetSpacing(5)
    	list:SetPadding(5)
    	--list.Paint = function() draw.RoundedBox(0, 0, 0, 300, 500, Color(64,64,64)) end
    	
    	local model = vgui.Create("DModelPanel", self)
    	model:SetPos(list:GetWide()+2, 24)
    	model:SetSize(396, 474)
    	model:SetModel("models/tnb/citizens/male_07.mdl")
    	
    	local bg1_len = #model:GetEntity():GetBodyGroups()[1]["submodels"]
    	local bg_slider2 = vgui.Create("DNumSlider", list)
    	bg_slider2:SetText("Bodygroup value")
    	bg_slider2:SetSize(list:GetWide()-10, 20)
    	bg_slider2:SetMin(0)
    	bg_slider2:SetMax((bg1_len > -1 and bg1_len or 0))
    	bg_slider2:SetDecimals(0)
    	bg_slider2:SetValue(0)
    	bg_slider2.OnValueChanged = function(panel, val)
    		val = math.Round(val)
    		local ent = model:GetEntity()
    		ent:SetBodygroup(self.body_group, val)
    		self.body_group_val = val
    	end
    	
    	local bg_slider1 = vgui.Create("DNumSlider", list)
    	bg_slider1:SetText("Bodygroup")
    	bg_slider1:SetSize(list:GetWide()-10, 20)
    	bg_slider1:SetMin(0)
    	bg_slider1:SetMax(#model:GetEntity():GetBodyGroups()-1)
    	bg_slider1:SetDecimals(0)
    	bg_slider1:SetValue(0)
    	bg_slider1.OnValueChanged = function(panel, val)
    		val = math.Round(val)
    		local ent = model:GetEntity()
    		local bgs = ent:GetBodyGroups()
    		bgs = #bgs[val+1]["submodels"]
    		bg_slider2:SetMax(bgs)
    		self.body_group = val
    		bg_slider2:SetValue(ent:GetBodygroup(val))
    	end
    	
    	local m_tentry = vgui.Create("DTextEntry", list)
    	m_tentry:SetSize(list:GetWide()-10, 20)
    	
    	local m_button = vgui.Create("DButton", list)
    	m_button:SetText("Set model")
    	m_button:SetSize(list:GetWide()-10, 20)
    	m_button.DoClick = function()
    		model:SetModel(m_tentry:GetValue())
    		local ent = model:GetEntity()
    		local bgs = #ent:GetBodyGroups()
    		bg_slider1:SetMax(bgs-1)
    		
    	end
    	
    	list:AddItem(m_tentry)
    	list:AddItem(m_button)
    	list:AddItem(bg_slider1)
    	list:AddItem(bg_slider2)
    end
    
    vgui.Register("bg", PANEL, "DFrame")
    
    local panel = vgui.Create("bg")
    panel:MakePopup()
    
     
  2. Daemon01

    Daemon01 I've covered in wars y'know.

    Looks good.
     
  3. Tomo742

    Tomo742 Guest

    Have it link in with a plugin that allows the admin to bring up said menu, input the model or perhaps even just something like /bodygroupview fred and it brings up freds model in the bodygroup view.

    Then when you are happy with the look, simply click "Print" and it prints it to the console or something. You then copy paste it into chat after say... /bodygroupset fred "Copy pasted here". So it would look perhaps like /bodygroupset fred 1 0 2 4 4 1 5 2.

    No?
     
  4. I dunno if I'll ever make it a plugin.

    Also I just realized I can just make it a bodygroup editor by grabbing whatever player's model and then setting it with the values the model (in the panel) has when done.
     
  5. Can't you just right click and edit icon and get the same results?
     
  6. TimTimTommy

    TimTimTommy birds are my fetish

    who the fuck gets bored then just decides to make a body group previewer, do what everybody else does and jack off or beat up someone.
     
  7. Lev

    Lev certified honorable guy

    Pretty nice.

    Stop making plugins, so I can catch up, please.
     
  8. Tomo742

    Tomo742 Guest

    Yes, good job on posting something without reason
    That and the fact that it had already been posted by someone else, read the thread before you post. Also, this plugin/addon can/could be used for something and allows for easier viewing than icon changing.


    Atebite, please turn this into a plugin like I suggested. It would be quite nice, I bet you. Plugins that make the job easier for admins or players are something that is needed.
     
  9. I don't see how that was without reason. I didn't know about that, really.

    Also I won't be making this a plugin (although whomever is free to try), I did it for fun. At most I'll update it to be a tool for editing bodygroups of players.
     
  10. Tomo742

    Tomo742 Guest

    I only said it was without reason because it had already been posted within the thread, that is all. Good luck with the rest.
     

Previous Readers (Total: 0)