Skip to content

Reference custom sprite_type

Chaofan Yang edited this page Sep 19, 2023 · 5 revisions

Update in 0.7.4:

If you enable GFX index, then all sprite_types are loaded when vscode starts. To enable GFX index, you can put "gfxIndex" in setting hoi4ModUtilities.featureFlags. For detailed information, see Feature flags and Extension settings.

Original content:

In custom focus tree/technology tree file, modders may use icons or GUI components from GFX or GUI files in their mod. To make HOI4 mod utilities to know this and correctly render preview, some hints must be added to the focus tree/technology tree file to list dependencies of current file.

Example

#!gfx:interface\mygfx1.gfx
#!gfx:interface\mygfx2.gfx

focus_tree = {
...
}

Format

The format of the dependency is below. There must not be any spaces between each components and on the start of the line. A file can have multiple dependencies. And they can be put in any place of the file.

<#!> <gfx|gui|focus|event|localization|localisation> <:> <path to the file>

Resolving dependencies and updating preview

The dependencies is recursively resolved. If a technology tree file has dependency A.gui and A.gui has dependency B.gfx, the technology file also has dependency B.gfx even it's not explicitly in the file.

When Some of the dependencies changed in VSCode, the preview will automatically refreshes.

Supported dependency types

File type Native dependencies Dependencies added by #!
Focus tree interface/goals.gfx gfx, focus (File that contains shared focuses)
Event N/A event (Related events), localisation, localization
Technology tree interface/countrytechtreeview.gui, interface/countrytechtreeview.gfx, interface/countrytechnologyview.gfx, interface/technologies.gfx gui, gfx
GFX file N/A N/A
GUI file <path name of GUI except ext>.gfx gui, gfx
default.map All map related files N/A