Garry's Mod

Garry's Mod

Screenshot Editor
 This topic has been pinned, so it's probably important
Chev  [developer] 1 Jan, 2023 @ 11:53am
Developer API basics
Adding a frame or filter
Create a client-sided Lua file. The placement of the file does not matter as long as the Lua file runs before GM:Initialize.
Create a hook with the name ScreenshotEditorInitialize.

In this hook, you can use screenshot_editor.AddFrame and screenshot_editor.AddFilter to add frames and filters.

Example usage for AddFrame:
screenshot_editor.AddFrame({ FrameName = "Display Name", MaterialPath = "path/to/material.png" })

Example usage for AddFilter:
screenshot_editor.AddFilter({ FilterName = "Display Name", FilterCallback = function(width, height, screenshotMat) -- Surface/render code goes here. -- Width and height are the size of the screenshot editor panel -- (which should be the same as the game's resolution) -- screenshotMat is the IMaterial for the screenshot -- currently being rendered. end })

Creating the editor VGUI menu
Simply use:
vgui.Create("DScreenshotEditor")
Last edited by Chev; 1 Jan, 2023 @ 12:13pm