View Full Version : Discussion PaintTraverse and DrawModelEx won't get called
freax
06-28-2010, 03:30 PM
Hey. Since the new CS:S update is out, I use the orange box Source SDK and it works well for most actions (for now). But if I want to add hooks to PaintTraverse (from vgui::IPanel) or DrawModelEx (from IVModelRender), they won't be called.
Does somebody has an idea? Thx!
The Acid
06-28-2010, 03:36 PM
g_PaintTraverseHook->Hook(m_pPanel, &hk_PaintTraverse, 40);
g_DrawModelExecuteHook->Hook(m_pModelRender, &hk_DrawModelExecute, 19);
Works fine for me :D (Remember that if you draw in PaintTraverse, you need to have net_graph 1 (or similar)) - in other words, use panels.
freax
06-28-2010, 03:42 PM
lol, seems my SDK isn't really up to date O_O
PaintTraverse is still 39.
And for DrawModelExecute, I didn't see that.
"(Remember that if you draw in PaintTraverse, you need to have net_graph 1 (or similar)) - in other words, use panels. "
Thanks, I didn't know that. This will stop me from getting confused.
Thanks :>
g_PaintTraverseHook->Hook(m_pPanel, &hk_PaintTraverse, 40);
g_DrawModelExecuteHook->Hook(m_pModelRender, &hk_DrawModelExecute, 19);
Works fine for me :D (Remember that if you draw in PaintTraverse, you need to have net_graph 1 (or similar)) - in other words, use panels.
eh?...
i used painttraverse 3 years ago and required nothing of the sort
freax
06-28-2010, 03:56 PM
"i used painttraverse 3 years ago and required nothing of the sort "
Same for me and it works also with CS:S OB.
Thanks
The Acid
06-28-2010, 04:11 PM
Well, I draw in MatSystemTopPanel and it does not draw when I don't have net_graph 1 or something like it :/
Probaly me doing it wrong then :D
freax
06-28-2010, 05:23 PM
void __stdcall COtherHooks::PaintTraverse(vgui::VPANEL vguiPanel, bool forceRepaint, bool allowForce)
{
PaintTraverse_t pPaintTraverse = pOtherHooks->m_pPaintTraverse;
__asm
{
push allowForce
push forceRepaint
push vguiPanel
mov ecx, pPanel
call pPaintTraverse
}
const char *pszPanelName = pPanel->GetName(vguiPanel);
// this is from aVitamin (if I remember correctly)
// MatSystemTopPanel
if (pszPanelName[0] == 'M' && pszPanelName[3] == 'S' && pszPanelName[9] == 'T' && pszPanelName[12] == 'P' /* && pTools->IsInGame()*/)
{
// testing
pMatSurface->DrawSetColor(255, 0, 0, 255);
pMatSurface->DrawFilledRect(0, 0, 200, 200);
}
}
lev1ath4n
06-28-2010, 06:27 PM
iirc, I used ISurface to draw in DoD:S and not IMatSystemSurface because this crashed.
freax
06-28-2010, 07:37 PM
IMatSystemSurface derives from ISurface, so it doesn't matter since (if you do it right), both instances point to the same address:
pSurface = (vgui::ISurface*)AppSystemFactory(VGUI_SURFACE_INTERFACE_VERSION, NULL);
pMatSurface = (IMatSystemSurface*)pSurface->QueryInterface(MAT_SYSTEM_SURFACE_INTERFACE_VERSION);
This is gonna useless since the ISurface header file doesn't match with the one built into CSS, you can't use much functions of it. Because of this, IMatSystemSurface is totally corrupted.
By the way, for me "MatSystemTopPanel" draws now only ingame so i logged some panels and to render also in menu you can just use it like this:
if ( !strcmp(PanelName, "MatSystemTopPanel") || !strcmp(PanelName, "FocusOverlayPanel")){//Ingame | GameMenu
...
Here are some logged .. but there are ofc some more...
Panel: frame_menu
Panel: frame_minimize
Panel: frame_mintosystray
Panel: GameConsole
Panel: MenuScrollBar
Panel: #GameUI_GameMenu_ResumeGame
Panel: #GameUI_GameMenu_Disconnect
Panel: #GameUI_GameMenu_PlayerList
Panel: #GameUI_GameMenu_FindServers
Panel: #GameUI_GameMenu_CreateServer
Panel: #GameUI_GameMenu_Achievements
Panel: #GameUI_ReportBug
Panel: #GameUI_LaunchBenchmark
Panel: #GameUI_GameMenu_Options
Panel: #GameUI_GameMenu_Quit
Panel: GameMenu
Panel: FocusOverlayPanel
Helo
freax
06-29-2010, 03:58 PM
Done this some time ago:
Panels:
frame_caption
frame_close
ScrollBar
ConsoleHistory
ConsoleSubmit
ConsoleEntry
frame_topGrip
frame_bottomGrip
frame_leftGrip
frame_rightGrip
frame_tlGrip
frame_trGrip
frame_blGrip
frame_brGrip
frame_maximize
frame_menu
frame_minimize
frame_mintosystray
CompletionList
GameConsole
MenuScrollBar
#GameUI_GameMenu_ResumeGame
#GameUI_GameMenu_Disconnect
#GameUI_GameMenu_PlayerList
#GameUI_GameMenu_FindServers
#GameUI_GameMenu_CreateServer
#GameUI_ReportBug
#GameUI_LaunchBenchmark
#GameUI_GameMenu_Options
#GameUI_GameMenu_Quit
GameMenu
staticClientDLLPanel
staticClientDLLToolsPanel
DemoUIPanel
PerfUIPanel
ColorCorrectionUIPanel
CConPanel
CEntityReportPanel
DrawTreeFrame
CTextureListPanel
CVProfGraphPanel
mode label
CFPSPanel
CNetGraphPanel
TextureBudgetPanel
BudgetPanel
VProfPanel
Engine Tools
BugUIPanel
GameMenuButton
GameMenuButton2
CServerBrowserDialog
MenuScrollBar
#GameUI_GameMenu_ResumeGame
#GameUI_GameMenu_Disconnect
#GameUI_GameMenu_PlayerList
#GameUI_GameMenu_FindServers
#GameUI_GameMenu_CreateServer
#GameUI_ReportBug
#GameUI_LaunchBenchmark
#GameUI_GameMenu_Options
#GameUI_GameMenu_Quit
GameMenu
BaseGameUIPanel
frame_caption
frame_close
ScrollBar
ConsoleHistory
ConsoleSubmit
ConsoleEntry
frame_topGrip
frame_bottomGrip
frame_leftGrip
frame_rightGrip
frame_tlGrip
frame_trGrip
frame_blGrip
frame_brGrip
frame_maximize
frame_menu
frame_minimize
frame_mintosystray
CompletionList
GameConsole
GameUI Panel
Engine Debug System
staticGameDLLPanel
FocusOverlayPanel
AskConnectPanel
staticPanel
tooltip
MatSystemTopPanel
They are ordered in right. As you can see, MatSystemTopPanel is the top one (this is a ingame dump).
Powered by vBulletin® Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.