Skip to content

Commit 3154d51

Browse files
committed
right click shortcut: edit sprite/particle/beam material
creates a material_2d part for it and auto-links it
1 parent 8d1d3e7 commit 3154d51

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

lua/pac3/editor/client/panels/properties.lua

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,6 +1982,33 @@ do -- base editable
19821982

19831983
if self.CurrentKey == "Material" or self.CurrentKey == "SpritePath" then
19841984
populate_bookmarks(menu, "materials", self)
1985+
1986+
local part_material = pace.current_part:GetProperty(self.CurrentKey)
1987+
local mat_name = part_material:match(".+/(.+)") or ""
1988+
mat_name = mat_name .. "_" .. string.sub(pace.current_part.UniqueID,1,6)
1989+
mat_name = string.Replace(mat_name, " ", "")
1990+
local menu2, pnl = menu:AddSubMenu("Edit Material (will be named " .. mat_name .. ")", function()
1991+
local newmaterial = pac.CreatePart("material_2d") newmaterial:SetParent(pace.current_part)
1992+
newmaterial:SetName(mat_name)
1993+
newmaterial:SetProperty("LoadVmt", part_material)
1994+
pace.current_part:SetProperty(self.CurrentKey, mat_name)
1995+
end)
1996+
pnl:SetImage("icon16/paintcan.png")
1997+
1998+
menu2:AddOption("Make transparent (vertex alpha) (for transparent textures)", function()
1999+
local newmaterial = pac.CreatePart("material_2d") newmaterial:SetParent(pace.current_part)
2000+
newmaterial:SetName(mat_name)
2001+
newmaterial:SetProperty("LoadVmt", part_material)
2002+
pace.current_part:SetProperty(self.CurrentKey, mat_name)
2003+
newmaterial:Setvertexalpha(true)
2004+
end):SetImage("icon16/paintcan.png")
2005+
menu2:AddOption("Make transparent (additive) (for black backgrounds)", function()
2006+
local newmaterial = pac.CreatePart("material_2d") newmaterial:SetParent(pace.current_part)
2007+
newmaterial:SetName(mat_name)
2008+
newmaterial:SetProperty("LoadVmt", part_material)
2009+
pace.current_part:SetProperty(self.CurrentKey, mat_name)
2010+
newmaterial:Setadditive(true)
2011+
end):SetImage("icon16/paintcan.png")
19852012
end
19862013

19872014
if string.find(pace.current_part.ClassName, "sound") then

0 commit comments

Comments
 (0)