Map Decal Painter

Release your plugins here!
User avatar
Doldol
Senior Member
Posts: 192
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Map Decal Painter

Postby Doldol » Fri Jul 11, 2014 8:19 pm

I'm sharing a plugin I coded for personal use, it's meant to paint decals/materials on a map.

It's mainly handy to customize a map a bit to your own clan/community without actually editing the map.
There is an example included which paints some standard CSS decals @ CT spawn on de_dust2, but it fully supports and makes your own materials downloadable, which is it's intended use.

I would greatly appreciate feedback!

Preview (Plugin comes with this setup):
decalpainter_example.jpg


Download:
Attachments
decalpainterv0_1_3.zip
(3.26 KiB) Downloaded 151 times
User avatar
satoon101
Project Leader
Posts: 2587
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Jul 12, 2014 3:38 am

Nice addon!

A few pointers. All C++ exposed modules will eventually be private and forwarded to another package/module. Currently, all of them are, with the exception of constants and tools. That being said, you should not directly import them. GlobalVars is available in the "core" package:

Syntax: Select all

from core import GlobalVars


Also, you might want to look into using the site-package path. You should also look at our paths module. All of the objects from the paths module are "path" instances. This is one way that will help you:

Syntax: Select all

from path import Path

# Get the path to the plugin's directory
base_path = Path(__file__).parent

MODNAME = base_path.namebase
DECALPATH = base_path.joinpath('decallist.json')
COORDSDIR = base_path.joinpath('coords')


def _get_coords_file(self):
map_coords = self.coordsdir.joinpath('{0}{1}.json'.format(self.map_name, self.map_version))
if map_coords.isfile():
return map_coords.open()
map_coords = self.coordsdir.joinpath('{0}.json'.format(self.map_name))
if map_coords.isfile():
return map_coords.open()
return None


One more thing. If a server updates your plugin and does not restart, the old value of your plugin's "version" variable will still show the old version number. Instead you should use something like:

Syntax: Select all

info.cvar = ConVar("{0}_version".format(info.basename), info.version, FCVAR_NOTIFY, info.name)
info.cvar.set_string(info.version)
User avatar
Doldol
Senior Member
Posts: 192
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Postby Doldol » Sat Jul 12, 2014 3:08 pm

I dug trough repo to try and find the best import locations, but I must have missed the one for GlobalVars, thanks for that and the other tips, didn't know about them!

I updated the download.
User avatar
Painkiller
Senior Member
Posts: 425
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: Map Decal Painter

Postby Painkiller » Wed Apr 17, 2019 9:33 am

Hey, I tested it, but it does not load the decals.

Here is my decallist.json

Code: Select all

{
"Example Skull":{
   "vtf":"hud/leaderboard_dead.vtf",
   "vmt":"hud/leaderboard_dead.vmt"
   },
"Example Numbers":{
   "vtf":"sprites/numbers.vtf",
   "vmt":"sprites/numbers.vmt"
   },
"RocKs":{
   "vtf":"decals/custom/suicide.vtf",
   "vmt":"decals/custom/suicide.vmt",
   "vtf":"decals/custom/alien.vtf",
   "vmt":"decals/custom/alien.vmt",
   "vtf":"decals/custom/alien1.vtf",
   "vmt":"decals/custom/alien1.vmt",
   "vtf":"decals/custom/baum.vtf",
   "vmt":"decals/custom/baum.vmt",
   "vtf":"decals/custom/car.vtf",
   "vmt":"decals/custom/car.vmt",
   "vtf":"decals/custom/dark.vtf",
   "vmt":"decals/custom/dark.vmt",
   "vtf":"decals/custom/dead1.vtf",
   "vmt":"decals/custom/dead1.vmt",
   "vtf":"decals/custom/dead2.vtf",
   "vmt":"decals/custom/dead2.vmt",
   "vtf":"decals/custom/game.vtf",
   "vmt":"decals/custom/game.vmt",
   "vtf":"decals/custom/dirty.vtf",
   "vmt":"decals/custom/dirty.vmt",
   "vtf":"decals/custom/healthpack.vtf",
   "vmt":"decals/custom/healthpack.vmt",
   "vtf":"decals/custom/mercy.vtf",
   "vmt":"decals/custom/mercy.vmt",
   "vtf":"decals/custom/nhfa.vtf",
   "vmt":"decals/custom/nhfa.vmt",
   "vtf":"decals/custom/norge.vtf",
   "vmt":"decals/custom/norge.vmt",
   "vtf":"decals/custom/rlod.vtf",
   "vmt":"decals/custom/rlod.vmt",
   "vtf":"decals/custom/taste.vtf",
   "vmt":"decals/custom/taste.vmt",
   "vtf":"decals/custom/wwyd.vtf",
   "vmt":"decals/custom/wwyd.vmt",
   "vtf":"decals/custom/yad.vtf",
   "vmt":"decals/custom/yad.vmt",
   "vtf":"decals/custom/yagtd.vtf",   
   "vmt":"decals/custom/yagtd.vmt",
   "vtf":"decals/custom/splat1.vtf",
   "vmt":"decals/custom/splat1.vmt",
   "vtf":"decals/custom/splat2.vtf",
   "vmt":"decals/custom/splat2.vmt",
   "vtf":"decals/custom/splat3.vtf",
   "vmt":"decals/custom/splat3.vmt",
   "vtf":"decals/custom/splat4.vtf",
   "vmt":"decals/custom/splat4.vmt",
   "vtf":"decals/custom/splat5.vtf",   
   "vmt":"decals/custom/splat5.vmt",
   "vtf":"decals/custom/crane.vtf",
   "vmt":"decals/custom/crane.vmt",
   "vtf":"decals/custom/death.vtf",   
   "vmt":"decals/custom/death.vmt",
   "vtf":"decals/custom/fear.vtf",
   "vmt":"decals/custom/fear.vmt",
   "vtf":"decals/custom/penta.vtf",
   "vmt":"decals/custom/penta.vmt",
   "vtf":"decals/custom/splitt.vtf",
   "vmt":"decals/custom/splitt.vmt",
   "vtf":"decals/custom/us.vtf",
   "vmt":"decals/custom/us.vmt",
   "vtf":"decals/custom/zombie.vtf",
   "vmt":"decals/custom/zombie.vmt",
   "vtf":"decals/custom/blatt.vtf",
   "vmt":"decals/custom/blatt.vmt",
   "vtf":"decals/custom/blut1.vtf",
   "vmt":"decals/custom/blut1.vmt",
   "vtf":"decals/custom/blut3.vtf",
   "vmt":"decals/custom/blut3.vmt",
   "vtf":"decals/custom/blut4.vtf",   
   "vmt":"decals/custom/blut4.vmt",
   "vtf":"decals/custom/blut5.vtf",
   "vmt":"decals/custom/blut5.vmt",
   "vtf":"decals/custom/blut6.vtf",
   "vmt":"decals/custom/blut6.vmt",
   "vtf":"decals/custom/blut7.vtf",
   "vmt":"decals/custom/blut7.vmt",
   "vtf":"decals/custom/blut8.vtf",
   "vmt":"decals/custom/blut8.vmt",
   "vtf":"decals/custom/blut9.vtf",   
   "vmt":"decals/custom/blut9.vmt",
   "vtf":"decals/custom/blut10.vtf",
   "vmt":"decals/custom/blut10.vmt",
   "vtf":"decals/custom/blut11.vtf",   
   "vmt":"decals/custom/blut11.vmt",
   "vtf":"decals/custom/gas.vtf",
   "vmt":"decals/custom/gas.vmt",
   "vtf":"decals/custom/gestruep.vtf",
   "vmt":"decals/custom/gestruep.vmt",
   "vtf":"decals/custom/gestruep1.vtf",
   "vmt":"decals/custom/gestruep1.vmt",
   "vtf":"decals/custom/gestruep2.vtf",
   "vmt":"decals/custom/gestruep2.vmt",
   "vtf":"decals/custom/gtrabbi.vtf",
   "vmt":"decals/custom/gtrabbi.vmt",
   "vtf":"decals/custom/moos.vtf",
   "vmt":"decals/custom/moos.vmt",
   "vtf":"decals/custom/moos1.vtf",
   "vmt":"decals/custom/moos1.vmt",
   "vtf":"decals/custom/rocks.vtf",
   "vmt":"decals/custom/rocks.vmt",
   "vtf":"decals/custom/rocks1.vtf",
   "vmt":"decals/custom/rocks1.vmt",
   "vtf":"decals/custom/rocks2.vtf",
   "vmt":"decals/custom/rocks2.vmt",
   "vtf":"decals/custom/stein.vtf",   
   "vmt":"decals/custom/stein.vmt",
   "vtf":"decals/custom/stein1.vtf",
   "vmt":"decals/custom/stein1.vmt",
   "vtf":"decals/custom/stroh.vtf",
   "vmt":"decals/custom/stroh.vmt",
   "vtf":"decals/custom/wand.vtf",
   "vmt":"decals/custom/wand.vmt",
   "vtf":"decals/custom/wand1.vtf",
   "vmt":"decals/custom/wand1.vmt",
   "vtf":"decals/custom/wand2.vtf",
   "vmt":"decals/custom/wand2.vmt",
   "vtf":"decals/custom/wand3.vtf",
   "vmt":"decals/custom/wand3.vmt",
   "vtf":"decals/custom/wand4.vtf",
   "vmt":"decals/custom/wand4.vmt",
   "vtf":"decals/custom/wand5.vtf",
   "vmt":"decals/custom/wand5.vmt",
   "vtf":"decals/custom/wand6.vtf",
   "vmt":"decals/custom/wand6.vmt",
   "vtf":"decals/custom/wand7.vtf",
   "vmt":"decals/custom/wand7.vmt",
   "vtf":"decals/custom/wand8.vtf",
   "vmt":"decals/custom/wand8.vmt",
   "vtf":"decals/custom/wand9.vtf",
   "vmt":"decals/custom/wand9.vmt",
   "vtf":"decals/custom/wand10.vtf",   
   "vmt":"decals/custom/wand10.vmt",
   "vtf":"decals/custom/wand11.vtf",
   "vmt":"decals/custom/wand11.vmt",
   "vtf":"decals/custom/wand12.vtf",
   "vmt":"decals/custom/wand12.vmt",
   "vtf":"decals/custom/wand13.vtf",
   "vmt":"decals/custom/wand13.vmt",
   "vtf":"decals/custom/zebrastreifen.vtf",
   "vmt":"decals/custom/zebrastreifen.vmt",
   "vtf":"decals/custom/zebrastreifen1.vtf",
   "vmt":"decals/custom/zebrastreifen1.vmt"   
     }
}


and my map config (I took these from sourcemod decals)

adv_torus_ver1.json

Code: Select all

{
"RocKs":[
   [1310.124512 -946.622742 -853.294739],
   [-77.790283 957.883423 -873.664307],
   [1285.415649 963.992920 -872.617859],
   [-64.246124 -954.771484 -876.698730]
   ]
}
User avatar
Painkiller
Senior Member
Posts: 425
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: Map Decal Painter

Postby Painkiller » Sun Apr 21, 2019 2:24 pm

I think this is the problem.

Can anybody help?

Code: Select all

Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin
    plugin = self.manager.load(plugin_name)
  File "../addons/source-python/packages/source-python/plugins/manager.py", line 194, in load
    plugin._load()
  File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
    self.module = import_module(self.import_name)
  File "../addons/source-python/plugins/decalpainter/decalpainter.py", line 5, in <module>
    from tools import ServerTools

ModuleNotFoundError: No module named 'tools'

Return to “Plugin Releases”

Who is online

Users browsing this forum: No registered users and 1 guest