Garry's Mod Leaks

TexStickers - Texture customizer

Submitted by Zustar, , Thread ID: 67057

Thread Closed
28-12-2017, 10:03 PM
#1
[Image: 053826bde1dcad4d4723c25af0e87834.png]
Content locked
This content has been locked. Please login or register in order to unlock it.

[Image: e7ae914b0574cd877f33dbe6a8588a92.png&w=1...output=jpg] [Image: 14eb5f6bc5a469aae5f336add7709bf4.png&w=1...output=jpg][Image: 02677727fd71b5739ae12771f2116a4b.png&w=1...output=jpg][Image: 188a511b58a663835a3e84d9def06d90.png&w=1...output=jpg][Image: ab3e1c09406a2a2bfa785c5669c56ff1.png&w=1...output=jpg][Image: d6a5521e94847a84a561857e48d24c91.png&w=1...output=jpg][Image: 847289c10f24162054522450cd040854.png&w=1...output=jpg][Image: a17153ea11ab5fb22984aaabec0f1dd0.png&w=1...output=jpg]



TexStickers is a script who add the ability to customize any entity with stickers. One of the most interesting applications of that is car customization.

See examples in thisvideo(v1.0.0).
See v1.2.0 "layer system" examples in thisvideo.

TexStickers gallery (steam)
Share your best car designs by adding#texstickersin the steam screenshot description, they will be added to the TexStickers gallery. If you have difficulties with the editor, click the "help" button to see an example video.


Version 1.2.0 out !
Don't use the v1.0.0 anymore, saved designs are migrated since the 1.1.0.

Features
  • customization platform entity for cars (DarkRP)
  • a tool gun near Material and Color for all gamemodes
  • add your custom stickers
  • TexStickers API
  • materials layer system
  • "!vcustomize" chat command for DarkRP (enter the vehicle or look at it)(deprecated)
  • saved designs are located in "garrysmod/data/texstickers/designs/" (client-side)
Installation
Just place the "texstickers/" folder to the "addons/" folder.
How it works / Configuration
The stickers are generated client-side and synced for all clients, it should be fast. If you experience any troubles, you can modify the generated texture size to something lower or equal to 1024 (512,256,128...).
Add stickers
To add your own stickers to the list, you can create a workshop addon with the folder "materials/stickers/" containing .png images. Then, add the addon to "lua/autorun/server/stickers.lua" to make players download it.
You can also add .png images directly to the "materials/stickers/" folder of TexStickers, but this is slower and can cause the "phantom sticker" issue (a sticker not visible for some people because they had it on another server).

Add fonts
Fonts can't be added with a workshop addon, you need to manually add new fonts in the "texstickers/resource/fonts/" folder with this filename format :
Code:
texstickers_<RealFontName>.ttf

The real font name can be found by opening the font under Windows or with any TTF font visualizer.
A set of premade free fonts from dafont.com can be downloadedhere, extract them in "texstickers/resource/fonts/".
Layer system
Since the 1.2.0, TexStickers can customize any entity submaterials.
This is defined by the layers definition string, who looks like this :

"index[:matcode_name][:resolution],index[:matcode_name][:resolution],..."
Example:"1:s,3:c:256"will edit submaterials 1 (shiny), 3 (chrome,resolution 256)
If no matcode_name is given, TexStickers willtryto copy the original material.
If no resolution is given, 1024 will be used.

You can add your own matcodes definitions to thetexstickers/lua/texstickers_config.luafile.
The layer system add a little more complexity to the script, but give more customization control.
DarkRP
  • disable the TexStickers Customize and TexStickers CarConfig tool guns for players
  • configure the layers definition for each vehicle by testing the indexes with the tool gun (it is recommended to not allow too many textures to prevent clients overload, or to limit their size; for a rim texture a resolution of 256 can be enough)
  • spawn TexStickers customization platform entities
  • as superadmin, type "!texstickers savemap" in chat to save the customization platform positions
  • restart your server
You can probably PermaProps the customization plarforms instead.
The cars layers definition configuration step can take some time, but solve any car incompatibility issue and give you more control to define which parts of the car can be customized.
deprecated:For DarkRP servers who want to use the "!vcustomize" command, check the file "lua/autorun/server/vcustomize.lua" and add your own restrictions (car dealer minimal distance, car owner, restrict police jobs...).
For developers
The API is very simple if you want to add, for example, a designer job (someone who can apply stickers to props), or a clothes designer job.
Callbacks
Sticker custom check (client)
Code:
TexStickers.OnStickerCheck(player,sticker_path)
  • player (Player)
  • sticker_path (string): ex: "stickers/blank.png"
  • return (bool): true to authorize a sticker, false to disable it, if no return value is given, the sticker will be authorized by default
This is a client-side only callback. You can also check the special sticker path "!text" to authorize or not textual stickers.
Functions
Apply stickers to an entity submaterial
Code:
TexStickers.SetStickers(entity,mat_index,resolution,stickers,mat_code)
  • entity (Entity): the entity to customize
  • mat_index (number): the submaterial index (starts at 1)
  • resolution (number): the generated texture resolution (1024 for best results)
  • stickers (table): stickers list, see the sticker structure
  • mat_code (string): material creation code executed client-side, if nil, will try to copy the base material
Apply stickers to an entity submaterial (layers version)
Code:
TexStickers.SetStickersLayers(entity,layers)
  • entity (Entity): the entity to customize
  • layers (Layers): layers structure with stickers (if empty table "{}", will clear the entity)
Begin stickers editing for an entity submaterial
Code:
TexStickers.StartEdit(player,entity,mat_index,resolution,stickers,mat_code,onvalid)
  • player (Player): a player
  • entity (Entity): the entity to customize
  • mat_index (number): the submaterial index (starts at 1)
  • resolution (number): the generated texture resolution (1024 for best results)
  • stickers (table): stickers list, see the sticker structure
  • mat_code (string): material creation code executed client-side, if nil, will try to copy the base material
  • onvalid(layers) (function): called when the editing is valided, can return false to reject the modifications
Example:
Code:
TexStickers.StartEdit(p,e,1,1024,
  [[
    local mc = TexStickers.matcode
    mc.newmat = CreateMaterial(mc.newname,mc.mat:GetShader(),{
      ["$envmap"] = "env_cubemap"
    })
    mc.newmat:SetVector("$envmaptint",Vector(0.25,0.25,0.25))
  ]]
)

Begin stickers editing for an entity submaterial (layers version)
Code:
TexStickers.StartEditLayers(player,entity,layers,onvalid)
  • player (Player): a player
  • entity (Entity): the entity to customize
  • layers (Layers): layers structure without stickers
  • onvalid(layers) (function): called when the editing is valided, can return false to reject the modifications
Structures
A sticker added to a sticker list (a table) is built like this :
Code:
{pngpath_relative_to_materials,{x,y},{sx,sy},rot,zindex,{r,g,b} }

Code:
local stickers = {
  {"stickers/blank.png",{0.5,0.5},{1,1},45,1,{255,0,0}},
  {"stickers/blank.png",{0.5,0.5},{1,1},135,1,{0,255,0}}
}

will display two squares in the center of the texture with different rotations (red and green)
The layers structure is built like this (matcode can be nil) :
Code:
local layers = {
[1] = { matcode = [[...]], stickers = {{...}}, res = 1024 },
[5] = { matcode = [[...]], stickers = {{...}}, res = 1024 },
...
}

or
Code:
local layers = {}
local l1 = {}
l1.res = 1024
l1.stickers = {{...}}

local l5 = {}
l5.res = 1024
l5.stickers = {{...}}

layers[1] = l1
layers[5] = l5

Matcode
The mat_code parameter is just lua code executed client-side to change material creation.
Since the 1.2.0, the matcode is required to set the material texture.

TexStickers.matcode structure:
  • mat (in/IMaterial): the base material
  • newname (in/string): the name of the created material, needs to be this one, and only this one
  • tex (in/ITexture): the TexStickers generated texture
  • newmat (out/IMaterial): the created material
Example:
Code:
[[
local mc = TexStickers.matcode -- get the useful matcode vars
mc.newmat = CreateMaterial(mc.newname,mc.mat:GetShader(),{ -- generate the new material with the given name and custom properties
   ["$envmap"] = "env_cubemap"
})
mc.newmat:SetVector("$envmaptint",Vector(0.25,0.25,0.25)) -- set a shader parameter
mc.newmat:SetTexture("$basetexture",mc.tex) -- bind the TexStickers texture to the material
]]

For a clear example, check the file "lua/autorun/server/vcustomize.lua".
Warning: changing the in-game resolution while playing on the server will break the custom textures
The link in this hidden content has been reported as down 0 times this month.
1 times in total

RE: TexStickers - Texture customizer

#2
Link is down, therefore the thread has been closed. OP if you wish to update your link please send me or anyone of the staff team a message.
Please read the award requirements here before applying for them.
Rules and Regulations | Support Section | How to use Hide Tags
Don't message me to join a group, simply request to join one here.

Users browsing this thread: 1 Guest(s)