Skip to content

Commit

Permalink
more uld image tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
0ceal0t committed Mar 28, 2024
1 parent 988e1e2 commit 015e281
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VFXEditor/FileBrowser/FileBrowserDialog.Header.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private void DrawSearchBar() {

ImGui.SameLine();
var isFavorite = Plugin.Configuration.IsFileBrowserFavorite( CurrentPath );
using( var star = ImRaii.PushColor( ImGuiCol.Text, UiUtils.DALAMUD_ORANGE, isFavorite ) ) {
using( var star = ImRaii.PushColor( ImGuiCol.Text, UiUtils.DALAMUD_YELLOW, isFavorite ) ) {
if( ImGui.Button( FontAwesomeIcon.Star.ToIconString() ) ) {
if( isFavorite ) Plugin.Configuration.RemoveFileBrowserFavorite( CurrentPath );
else Plugin.Configuration.AddFileBrowserFavorite( CurrentPath );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ImageNodeData : UldGenericData {
private readonly ParsedByteBool FlipH = new( "Flip H" );
private readonly ParsedByteBool FlipV = new( "Flip V" );
private readonly ParsedInt Wrap = new( "Wrap", size: 1 );
private readonly ParsedInt Unknown2 = new( "Unknown 2", size: 1 );
private readonly ParsedInt DrawMode = new( "Draw Mode", size: 1 );

public ImageNodeData() {
PartListId = new( "Part List", 0,
Expand All @@ -35,7 +35,7 @@ public override void Read( BinaryReader reader ) {
FlipH.Read( reader );
FlipV.Read( reader );
Wrap.Read( reader );
Unknown2.Read( reader );
DrawMode.Read( reader );
}

public override void Write( BinaryWriter writer ) {
Expand All @@ -45,7 +45,7 @@ public override void Write( BinaryWriter writer ) {
FlipH.Write( writer );
FlipV.Write( writer );
Wrap.Write( writer );
Unknown2.Write( writer );
DrawMode.Write( writer );
}

public override void Draw() {
Expand All @@ -57,7 +57,7 @@ public override void Draw() {
FlipV.Draw();
Wrap.Draw();
Unknown1.Draw();
Unknown2.Draw();
DrawMode.Draw();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using ImGuiNET;
using System.IO;
using System.Numerics;
using VfxEditor.Parsing;
using VfxEditor.Parsing.Int;
using VfxEditor.UldFormat.PartList;
Expand Down Expand Up @@ -73,7 +75,29 @@ public override void Write( BinaryWriter writer ) {
public override void Draw() {
PartListId.Draw();
PartId.Draw();
PartId.Selected?.DrawImage( false );

var part = PartId.Selected;
if( part != null ) {
ImGui.SetCursorPosY( ImGui.GetCursorPosY() + 5 );

var mult = part.ShowHd ? 2f : 1f;
var pos = ImGui.GetCursorScreenPos();
var size = part.Size.Value;
var width = size.X;
var height = size.Y;

part.DrawImage( false );
var drawList = ImGui.GetWindowDrawList();
var color = ImGui.ColorConvertFloat4ToU32( new( 1f, 0f, 0f, 1f ) );

drawList.AddLine( pos + new Vector2( LeftOffset.Value, 0 ) * mult, pos + new Vector2( LeftOffset.Value, height ) * mult, color, 1f );
drawList.AddLine( pos + new Vector2( width - RightOffset.Value, 0 ) * mult, pos + new Vector2( width - RightOffset.Value, height ) * mult, color, 1f );

drawList.AddLine( pos + new Vector2( 0, TopOffset.Value ) * mult, pos + new Vector2( width, TopOffset.Value ) * mult, color, 1f );
drawList.AddLine( pos + new Vector2( 0, height - BottonOffset.Value ) * mult, pos + new Vector2( width, height - BottonOffset.Value ) * mult, color, 1f );

ImGui.SetCursorPosY( ImGui.GetCursorPosY() + 5 );
}

GridParts.Draw();
GridRender.Draw();
Expand Down
2 changes: 1 addition & 1 deletion VFXEditor/Formats/UldFormat/PartList/UldPartItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class UldPartItem {
);
public UldTexture CurrentTexture => TextureId.Selected;

private bool ShowHd = false;
public bool ShowHd = false;

public UldPartItem() { }

Expand Down
5 changes: 2 additions & 3 deletions VFXEditor/Select/SelectDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using VfxEditor.FileManager;
using VfxEditor.FileManager.Interfaces;
using VfxEditor.Select.Lists;
using VfxEditor.Ui;
using VfxEditor.Utils;

namespace VfxEditor.Select {
public enum SelectResultType {
Expand Down Expand Up @@ -50,7 +50,6 @@ public SelectResult( SelectResultType type, string name, string displayString, s
}

public abstract partial class SelectDialog : DalamudWindow {
public static readonly uint FavoriteColor = ImGui.GetColorU32( new Vector4( 1.0f, 0.878f, 0.1058f, 1 ) );
public static readonly List<string> LoggedFiles = [];

public readonly IFileManagerSelect Manager;
Expand Down Expand Up @@ -130,7 +129,7 @@ public bool DrawFavorite( SelectResult selectResult ) {
var isFavorite = IsFavorite( selectResult );

using( var font = ImRaii.PushFont( UiBuilder.IconFont ) )
using( var color = ImRaii.PushColor( ImGuiCol.Text, FavoriteColor, isFavorite ) ) {
using( var color = ImRaii.PushColor( ImGuiCol.Text, UiUtils.DALAMUD_ORANGE, isFavorite ) ) {
ImGui.Text( FontAwesomeIcon.Star.ToIconString() );

if( ImGui.IsItemClicked() ) {
Expand Down

0 comments on commit 015e281

Please sign in to comment.