handsomematt / 3d2d-vgui Goto Github PK
View Code? Open in Web Editor NEW:eyes: Render and control 2D VGUI in 3D world space for Garry's Mod
License: MIT License
:eyes: Render and control 2D VGUI in 3D world space for Garry's Mod
License: MIT License
I getting this:
Couldn't include file 'includes\modules\3d2dvgui.lua' (File not found) (@addons/profile/lua/autorun/client/cl_init.lua (line 146))
I placed 3d2dvgui.lua in "lua/includes/modules" but it still can't find it. Where do i need to place 3d2dvgui.lua?
I noticed when you pressed e on the panels when its not on anywhere besides the background the panels starts to shift down and right every time you press e on the panel.
Attempting to hold E and drag/move a frame does not work correctly. Upon trying to move a created frame to the left, or up, relative to the plane it was placed on, the direction reverses and the frame starts to move right or down respectively.
Steps to reproduce:
Is this because it was never supported, just a bug or am I doing something wrong....
My code:
local DFrame = vgui.Create( "DFrame" )
DFrame:SetTitle( "" )
DFrame:SetPos( 0, 0 )
DFrame:SetSize( 920, 450 )
DFrame:SetDraggable(false)
DFrame:ShowCloseButton(false)
DFrame.Paint = function(s, w, h)
draw.SimpleText("Blah","DermaLarge",w / 2,20,Color( 0, 0, 0, 255 ),TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP)
end
local InfoBtn = vgui.Create( "DImageButton", DFrame )
InfoBtn:SetPos( 10, 345 )
InfoBtn:SetImage( "icon16/information.png" )
InfoBtn:SizeToContents()
InfoBtn.DoClick = function()
LocalPlayer():ChatPrint("Hey lmao")
end
local testbtn = vgui.Create("DButton", DFrame)
testbtn:SetPos(200, 100)
testbtn:SetSize(100,100)
testbtn:SetText("Text")
testbtn.DoClick = function()
LocalPlayer():ChatPrint("Hey lmao")
end
That looks like this
As you can see the 3 main components... The title at the top, the big test button, and the small info logo button.
If I click the big button I get a "Hey lmao" message in my chat box however when I click that little logo... I get nothing... So the main issue is that DImageButtons are not working. Maybe it's something I did wrong? I'm not sure but thanks for reading!
Having this installed fucks up gui.MouseX and gui.MouseY for all other addons:
https://github.com/HandsomeMatt/3d2d-vgui/blob/master/3d2dvgui.lua#L88-L95
You probably should fall back to x, y = gui.MousePos()
if x and y are 'nan'
https://github.com/HandsomeMatt/3d2d-vgui/blob/master/3d2dvgui.lua#L48
this is SetPos(-1000, 0)
https://imgur.com/a/fprIWlb
this is SetPos(-1000, -1000)
https://imgur.com/a/XVRZAdR
can go right and left but cant go up
All derma drawing is discarded beyond a certain size (Seems that this size is similar to the screen's resolution).
Since Gmod Derma uses the very screen it may happen that this will not work never, but if there's a solution aside from scaling up the derma it would be nice. (Sure that scaling up the viewport may patch the issue, but the resolution is drastically decreased).
Create any derma panel using vgui.Create('DFrame');
, then set a size higher than your screen resolution.
if SERVER then return; end; --Ensure clientside only
function ENT:Initialize()
local frame = vgui.Create( "DFrame" );
frame:SetTitle( self.title );
frame:SetPos( 0, 0 );
frame:SetSize( 2048, 2048 ); --This can be any W x H
self.frame = frame;
end
function ENT:Draw()
self:DrawModel();
local o = self:GetPos();
local ang = self:GetAngles();
local topleft = ang:Forward() * self.corner.x + ang:Right() * self.corner.y;
-- Above code is for positioning the screen only.
vgui.Start3D2D( o - topleft + ang:Up() * 1.6, ang, self.scale);
self.frame:Paint3D2D(); -- here paint the frame
vgui.End3D2D();
end
My 3D2D Vgui is broken , the position of button in Paint is working but , the position for the mouse clicker is not working !
My swep is like that : http://prntscr.com/nym9cj
I run my vgui.Start3D2D in SWEP:ViewModelDrawn()
With ParentToHUD() , i can't click on any buttons !
Without ParentToHUD(), the position of button is broken.
watebvr
hello, this is what im getting when using this:
hook.Add( "PostDrawOpaqueRenderables", "DrawSample3D2DFrame", function()
vgui.Start3D2D( pos, angle, 0.5)
hitbutton1:Paint3D2D()
vgui.End3D2D()
end)
[ERROR] gamemodes/rp1950s/gamemode/libraries/client/cl_3d2d.lua:180: attempt to call method 'OThink' (a nil value)
[ERROR] stack overflow
Hey there,
i am satisfied with the 3d2d-vgui-"Library" so far.
But there's one thing i can't handle.
If i add a ScrollPanel to no matter which existing Panel, the elements (which should be invisible) are still visible.
Just ignore these error-images.
I was messing around with this and decided to place the spawn menu on a wall and was welcomed with a stack overflow when I tried to do so:
[ERROR] stack overflow
1. __index - [C]:-1
2. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:198
3. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
4. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
5. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
6. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
7. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
8. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
9. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
10. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
11. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
12. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
13. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
14. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
15. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
16. OThink - addons/ut2k4gmod/lua/autorun/client/l/3d2dvgui.lua:203
Here is how I created the panel:
local sampleFrame = vgui.Create( "SpawnMenu" )
sampleFrame:SetPos( 0, 0 )
sampleFrame:Open()
I'm probably spawning it wrong but I thought to post it just in case it is something with your code
When I click on a DTextEntry it posts the OnMousePressed event via
pnl[event](pnl, ...)
in
local function postPanelEvent(pnl, event, ...)
but I can't verify if the text box is actually getting focused or not.
I spent a couple hours on this. Just wondering if you have any ideas/plans for this functionality.
Great job otherwise!
Hello,
when I open a new frame on m entity I can't use anymore my tab menu (in darkrp). I seen the problem is the position of the frame at points 0 , 0. The frame is work correctly on the entity but the frame is display transparently on my screen: I can click on button and the click hovered is display (on my screen and on my entity) :/ . My question is: How can I block the displaying of the frame on my screen ?
PS: Sorry for the misspelling, I'm French.
Yo, so basically I'm using this in my addon and sooner or later it's probably going to conflict with someone else's version of it I imagine. vON has approached this issue by just asking everyone to add it to their addon locally rather than globally - like this.
Do you think this is going to be an issue in the future and does something need to be done about it?
Hey matt,
This 2D3D VGUI script is perfect for me right now because i need this sort of interaction on a panel im using for entities however i have found that DComboBoxes don't stick to the the parent frame when it is open and the options aren't displayed on the 3D2D panel, instead they throw an error and display on your screen instead. How would this be fixed?
The error:
[ERROR] lua/vgui/dmenu.lua:185: attempt to call field 'PerformLayout' (a nil value)
- PerformLayout - lua/vgui/dmenu.lua:185
- unknown - lua/vgui/dscrollpanel.lua:14
TL;DR : Video with debugs instructions (I mean Lua instruction, so Lua code)
https://www.youtube.com/watch?v=M3GgOIgpm10
Sorry for baguette accent
Some times (yes, you have to try about 6 time to make it work), when switching between tabs, the function postPanelEvent, will not call the mouse even on the right tab.
The non 3d2d version of my derma works great.
Basically the code that converts the mouse position to screen position in 3D space only seems to work at 90 degree angles, or else it starts to slip and go wrong:
http://i.imgur.com/n4JQRlK.gifv
I also edited the code a bit to give a helper + symbol where the mouse thinks it is
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.