Skip to content

Commit

Permalink
Merge pull request #143 from brunomikoski/feature/uitk-tweaks
Browse files Browse the repository at this point in the history
Feature/uitk tweaks
  • Loading branch information
brunomikoski authored May 6, 2024
2 parents 0fb4b2b + 2e916e3 commit d5360e7
Show file tree
Hide file tree
Showing 55 changed files with 6,022 additions and 286 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.3.1]
### Added
- Added Addressables support again, now you if addressables is available on your project and the collection is set to non auto loaded, and the collection is set to use addressables, will write some helper code on the static file to load the collectiom from the addressables.
- Added a Addressables Sample project as well
- Added Reset Settings context menu option
- Added the Write Addressable Loading Methods toggle for the collection

### Changed
- Updated the visuals of the CollectionEditor again, make it a bit tighter and more readable
- Refactored the settings again _(sorry, some settings will be lost again)_ to make the system more extensible and easier to maintain, settings are now stored inside the .meta files, so it can be versioned but also keep changes between projects

## [2.3.0]
### Changed
- Refactored CollectionCustomEditor to use UI Elements, getting rid of multiple hacks to make it work with the IMGUI and Reorderable list
Expand Down Expand Up @@ -541,6 +552,7 @@ public bool IsValidConsumable(Consumable consumable)
### Added
- First initial working version

[2.3.1]: https://github.com/badawe/ScriptableObjectCollection/releases/tag/v2.3.1
[2.3.0]: https://github.com/badawe/ScriptableObjectCollection/releases/tag/v2.3.0
[2.2.4]: https://github.com/badawe/ScriptableObjectCollection/releases/tag/v2.2.4
[2.2.3]: https://github.com/badawe/ScriptableObjectCollection/releases/tag/v2.2.3
Expand Down
41 changes: 41 additions & 0 deletions Editor/UXML/CollectionCustomEditorTreeAsset.uxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<ui:Template name="GroupBoxVisualElement" src="project://database/Packages/com.brunomikoski.scriptableobjectcollection/Editor/UXML/GroupBoxVisualElement.uxml?fileID=9197481963319205126&amp;guid=83f2f2f1ea7e26e45b87253e97a81186&amp;type=3#GroupBoxVisualElement" />
<Style src="project://database/Packages/com.brunomikoski.scriptableobjectcollection/Editor/USS/CollectionStyle.uss?fileID=7433441132597879392&amp;guid=f6040fd5efe6a1e43a9e95760a53fcba&amp;type=3#CollectionStyle" />
<ui:VisualElement name="ContentGroup" view-data-key="content-group" style="flex-grow: 1; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;">
<ui:Instance template="GroupBoxVisualElement" name="GroupBoxVisualElement" view-data-key="group-box">
<AttributeOverrides element-name="Label" text="Items" />
<uie:ToolbarSearchField name="ToolbarSearchField" style="width: auto; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0; padding-bottom: 0; top: -18px; left: 200px; right: 30px; position: absolute;" />
<ui:Button parse-escape-sequences="true" display-tooltip-when-elided="true" name="expand-button" tooltip="Expand / Collapse Items" text="▸◂" enable-rich-text="false" style="width: 18px; height: 18px; position: absolute; right: 0; top: -20px;" />
<ui:ListView virtualization-method="DynamicHeight" show-border="false" show-alternating-row-backgrounds="All" reorderable="true" show-foldout-header="false" header-title="Items" show-add-remove-footer="false" reorder-mode="Animated" show-bound-collection-size="false" name="items-list-view" horizontal-scrolling="false" selection-type="Single" view-data-key="collection-item-list-view" style="display: flex;" />
</ui:Instance>
<ui:VisualElement name="unity-list-view__footer" class="unity-list-view__footer">
<ui:Button name="unity-list-view__remove-button" text="-" class="unity-text-element unity-button" />
<ui:Button name="unity-list-view__add-button" text="+" class="unity-text-element unity-button" />
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="BottonGroup">
<ui:Instance template="GroupBoxVisualElement" name="GroupBoxVisualElement">
<ui:VisualElement name="advanced-options-visual-element" style="flex-grow: 1; border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;">
<ui:Toggle label="Automaticaly Loaded" name="automatic-loaded-toggle" binding-path="automaticallyLoaded" tooltip="When enabled, this is automatically loaded by the system when the registry loads from Resources/Addressables. If disabled, it is removed prior to playtime and the reference is deleted from the registry at build time." class="unity-base-field__aligned" style="flex-grow: 0; -unity-font-style: normal;" />
<ui:Toggle label="Write as Partial Class" name="write-partial-class-toggle" tooltip="If enabled, attempts to declare the new static class as partial, allowing direct usage from the same type. This option is disabled when the class or generated file resides in a different assembly." class="unity-base-field__aligned" />
<ui:Toggle label="Use Base Class for Items" name="base-class-for-items-toggle" tooltip="If enabled, this will enforce the use of the base type in the static file declaration, regardless of any objects extending it to a child type." class="unity-base-field__aligned" />
<ui:Toggle label="Enforce Indirect Access" name="enforce-indirect-access" tooltip="Useful if the collection is not auto-loaded, loaded through addressables, or if better memory management is desired. This setting ensures that there are no direct references to the scriptable object." class="unity-base-field__aligned" />
<uie:ObjectField label="Generated Scripts Folde" type="UnityEditor.DefaultAsset, UnityEditor.CoreModule" allow-scene-objects="false" name="generated-scripts-parent-folder" tooltip="Specifies the target folder for generating the static file access. If left null, the file will be generated in the same location as the original file." class="unity-base-field__aligned" />
<ui:TextField picking-mode="Ignore" label="Static Filename" value="filler text" name="static-filename-textfield" is-delayed="true" class="unity-base-field__aligned" />
<ui:TextField picking-mode="Ignore" label="Namespace" value="filler text" name="namespace-textfield" is-delayed="true" class="unity-base-field__aligned" />
<ui:Toggle label="Generate Addressables Loading Methods" name="write-addressables-load-toggle" class="unity-base-field__aligned" />
</ui:VisualElement>
<ui:VisualElement style="flex-grow: 1; flex-direction: row; height: 26px; border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0;">
<ui:Button text="Generate Static File" parse-escape-sequences="true" display-tooltip-when-elided="true" tooltip="Uses Code Generation to generate the Static File to access collection items by code." name="generate-static-file-button" style="flex-grow: 1; padding-right: 0; padding-left: -2px; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-bottom: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 4px; border-top-left-radius: 0; border-top-right-radius: 0;" />
<ui:Button text="Generate Items" parse-escape-sequences="true" display-tooltip-when-elided="true" tooltip="Uses Code Generation to generate the Static File to access collection items by code." name="generate-auto-items" style="flex-grow: 1; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0;" />
<ui:Button text="Synchronize Assets" parse-escape-sequences="true" display-tooltip-when-elided="true" tooltip="Check for invalid references and reload found items into the collection" name="synchronize-items-button" style="flex-grow: 1; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 2px; padding-bottom: 0; padding-left: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 0;" />
</ui:VisualElement>
</ui:Instance>
<ui:Instance template="GroupBoxVisualElement" name="GroupBoxVisualElement">
<AttributeOverrides element-name="Label" text="Default Inspector" enable-rich-text="false" />
<ui:VisualElement name="extra-properties-visual-element" style="flex-grow: 1; margin-top: 0; padding-top: 10px; padding-right: 10px; padding-left: 10px; padding-bottom: 10px; flex-wrap: nowrap; align-items: stretch;">
<ui:IMGUIContainer />
</ui:VisualElement>
</ui:Instance>
</ui:VisualElement>
</ui:UXML>
52 changes: 0 additions & 52 deletions Editor/UXML/CollectionInspectorTreeAsset.uxml

This file was deleted.

4 changes: 2 additions & 2 deletions Editor/UXML/CollectionItemTreeAsset.uxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<Style src="project://database/Packages/com.brunomikoski.scriptableobjectcollection/Editor/USS/CollectionStyle.uss?fileID=7433441132597879392&amp;guid=f6040fd5efe6a1e43a9e95760a53fcba&amp;type=3#CollectionStyle" />
<ui:VisualElement name="VisualElement" style="flex-grow: 1; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;">
<ui:Foldout name="header-foldout" text="Title" value="true">
<ui:VisualElement name="VisualElement" view-data-key="item-box" style="flex-grow: 1; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;">
<ui:Foldout name="header-foldout" text="Title" value="false">
<ui:IMGUIContainer name="imgui-container" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-bottom: 0;" />
</ui:Foldout>
<ui:TextField picking-mode="Ignore" value="Default Endless" name="rename-text-field" is-delayed="true" style="display: none; position: absolute; flex-grow: 1; top: 0; width: 100%; background-color: rgba(0, 0, 0, 0); -unity-font-style: bold; margin-left: 0; left: 2px; overflow: visible; visibility: visible;" />
Expand Down
Loading

0 comments on commit d5360e7

Please sign in to comment.