Skip to content

Derma model panel modifies the model when it is set on the internal entity. #4534

@dvdvideo1234

Description

@dvdvideo1234

Details

Consider the following code

-- Create `DModelPanel` object
local pnModelPanel = vguiCreate("DModelPanel")
if(not IsValid(pnModelPanel)) then pnFrame:Close()
  asmlib.LogInstance("Model display invalid",gtArgsLogs); return nil end
pnModelPanel:SetParent(pnFrame)
pnModelPanel:SetPos(xyPos.x,xyPos.y)
pnModelPanel:SetSize(xySiz.x,xySiz.y)
pnModelPanel:SetVisible(true)
pnModelPanel:SetName(asmlib.GetPhrase("tool."..gsToolNameL..".pn_display_lb"))
pnModelPanel:SetTooltip(asmlib.GetPhrase("tool."..gsToolNameL..".pn_display"))

-- Go 80 rows down and reference the `DModelPanel`
-- Apply the model on the object by referencing it in another panel element `DListView`
pnListView.OnRowSelected = function(pnSelf, nIndex, pnLine)
  local uiMod =  tostring(pnLine:GetColumnText(5)  or "") -- Actually the model in the table
  local uiAct = (tonumber(pnLine:GetColumnText(2)) or 0); pnModelPanel:SetModel(uiMod) -- Active points amount

  print("OnRowSelected(1)", uiMod)
  print("OnRowSelected(2)", pnModelPanel:GetEntity():GetModel())

end

The output is:

OnRowSelected(1)	models/joe/jtp/throw/harpstand_2_pos.mdl
OnRowSelected(2)	models/harpstand_2_pos.mdl

Gmod version is the following running on Windows 7 x64 with beta option set to NONE:
image

Steps to reproduce

  1. Open Gmod
  2. Create a frame with DListView and DModelPanel
  3. Code DListView.OnRowSelected(pnSelf, nID, pnLine) to call DModelPanel:SetModel()
  4. DModelPanel entity model is set to models/harpstand_2_pos.mdl

Where does the /joe/jtp/throw go from the model path ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Cannot confirmThe issue cannot be confirmed by the developers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions