From 24444461fd1e27ee5402eccd5c240d2c78afc073 Mon Sep 17 00:00:00 2001
From: Zachary Lockwood
Date: Thu, 5 Sep 2024 16:58:44 -0400
Subject: [PATCH] add current palette icon documentation
---
Writerside/topics/Palette-Icons.md | 146 +++++++++++++++++++++++++++++
Writerside/topics/Snippets.topic | 14 +++
Writerside/upe.tree | 1 +
3 files changed, 161 insertions(+)
create mode 100644 Writerside/topics/Palette-Icons.md
diff --git a/Writerside/topics/Palette-Icons.md b/Writerside/topics/Palette-Icons.md
new file mode 100644
index 0000000..a530c37
--- /dev/null
+++ b/Writerside/topics/Palette-Icons.md
@@ -0,0 +1,146 @@
+# Palette Icons
+Use UPEs lua api to add custom palette icons to your part pages
+Use UPEs lua api to add custom palette icons to your part pages
+Use UPEs lua api to add custom palette icons to your part pages
+
+## Feature
+
+You can add custom palette icons with this feature, like Creepy & Cute and Bot Parts do.
+
+## API
+
+
+
+
+
+
+Palette Icons exposes the following API:
+
+
+
+ Adds a new palette icon to the list of palette icons.
+
+
+ PaletteIcon
required
+
+
+
+
+
+And binds the `PaletteIcon` C++ object:
+
+
+
+ Constructs a new palette icon with an id of `id` and a layout of `0x98F661C7`.
+
+
+ FNVHash
required
+
+
+
+
+ Sets the sequence of a palette icon.
+ This controls the order in which your palette icon appears relative to other palette icons.
+
+
+ integer
required
+
+
+
+
+ Sets the layout id of a palette icon.
+ Usually, you don't need to change this.
+
+
+ FNVHash
required
+
+
+
+
+ Sets the icon of a palette icon.
+
+
+ ResourceKey
required
+
+
+ ResourceKey
required
+
+
+
+
+ Sets the name (visible on hovering) of the palette icon with a LocalizedString
.
+
+
+ LocalizedString
required
+
+
+
+
+ Sets the name (visible on hovering) of the palette icon with a lookup into the locale strings.
+
+
+ FNVHash
required
+
+
+ FNVHash
required
+
+
+ string
optional - only used if the provided tableID
and instanceID
can't find a valid locale string.
+
+
+
+
+ Sets the name (visible on hovering) of the palette icon from a App::Property::TextProperty
stored in a Property
object.
+
+
+ App::Property::TextProperty
required
+
+
+
+
+
+## Usage
+
+The following is an example of how you might add a custom palette icon:
+
+Create our new palette icon:
+```
+local palette_icon = PaletteIcon("MyCoolMod")
+```
+Set the sequence:
+```
+palette_icon:SetSequence(1025)
+```
+Set the icon:
+```
+palette_icon:SetIcon(ResourceKey(0x011C0BDE, "MyCoolModIcon", "png"),
+ ResourceKey(0x011C0BDE, "MyCoolModBGIcon", "png"))
+```
+this makes the game look at `common~!mycoolmodicon.png` and `common~!mycoolmodbgicon.png` for the icons.
+
+Set the name of the icon:
+```
+palette_icon:SetName("MyCoolMod", "IconName", "MyCoolIcon")
+```
+This looks for a `mycoolmod.locale` with an entry `0xC3CDE5FF` (hash of `IconName`) to use for the name of this palette_icon, if this entry doesn't exist, it will fallback to "MyCoolIcon" as the name.
+
+You can directly set the name: `palette_icon:SetName("MyCoolIcon")`, but this prevents people from localizing your mod.
+
+You can also read the name from a `TextProperty` to set the name: `palette_icon:SetName(prop:Get())`, where prop contains a text property.
+
+And finally add it to the game:
+```
+AddPaletteIcon(palette_icon)
+```
+
+Lastly add this property to any page you want to use your icon:
+```
+int32 palettePageSetId hash(MyCoolMod)
+```
+
+
+
+ Universal Property Enhancer
+ Spore LuaAPI
+
+
\ No newline at end of file
diff --git a/Writerside/topics/Snippets.topic b/Writerside/topics/Snippets.topic
index fb5fbdc..2d301a2 100644
--- a/Writerside/topics/Snippets.topic
+++ b/Writerside/topics/Snippets.topic
@@ -29,4 +29,18 @@
+
+
+
+
+ Ensure your mod's priority is lower than this mod, otherwise you won't be able to easily access these APIs.
+
+
+
+
+ These APIs aren't added to the global environment until OnPropManagerInitialized
is called.
+ If your going to use these APIs, make sure your code runs after that function is called.
+
+
+
\ No newline at end of file
diff --git a/Writerside/upe.tree b/Writerside/upe.tree
index 93fc092..a186c69 100644
--- a/Writerside/upe.tree
+++ b/Writerside/upe.tree
@@ -5,6 +5,7 @@
+