Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.5.0 #127

Merged
merged 4 commits into from
Feb 17, 2025
Merged

0.5.0 #127

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Assets/BrioIcon.afdesign
Binary file not shown.
Binary file added Assets/image-brio01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/image-brio02.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/image-brio03.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions Brio/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.applicable_accessibilities = public, public, private, protected, protected_public, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.applicable_accessibilities = public, public, private, protected, protected_public, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, public, private, protected, protected_public, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles
Expand Down
8 changes: 7 additions & 1 deletion Brio/Brio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Brio.Game.Core;
using Brio.Game.Cutscene;
using Brio.Game.GPose;
using Brio.Game.Input;
using Brio.Game.Posing;
using Brio.Game.Scene;
using Brio.Game.World;
Expand Down Expand Up @@ -115,12 +116,15 @@ private static ServiceCollection SetupServices(DalamudServices dalamudServices)
serviceCollection.AddSingleton<WelcomeService>();
serviceCollection.AddSingleton<InputService>();
serviceCollection.AddSingleton<SceneService>();
serviceCollection.AddSingleton<ProjectSystem>();
serviceCollection.AddSingleton<AutoSaveService>();

// IPC
serviceCollection.AddSingleton<BrioIPCService>();
serviceCollection.AddSingleton<PenumbraService>();
serviceCollection.AddSingleton<GlamourerService>();
serviceCollection.AddSingleton<MareService>();
serviceCollection.AddSingleton<CustomizePlusService>();

// Web
serviceCollection.AddSingleton<WebService>();
Expand Down Expand Up @@ -148,8 +152,9 @@ private static ServiceCollection SetupServices(DalamudServices dalamudServices)
serviceCollection.AddSingleton<CameraService>();
serviceCollection.AddSingleton<ObjectMonitorService>();
serviceCollection.AddSingleton<PhysicsService>();
serviceCollection.AddSingleton<GameInputService>();
serviceCollection.AddSingleton<VirtualCameraManager>();

serviceCollection.AddSingleton<VirtualCamera>();
serviceCollection.AddSingleton<CutsceneManager>();

// Library
Expand All @@ -172,6 +177,7 @@ private static ServiceCollection SetupServices(DalamudServices dalamudServices)
serviceCollection.AddSingleton<MainWindow>();
serviceCollection.AddSingleton<SettingsWindow>();
serviceCollection.AddSingleton<InfoWindow>();
serviceCollection.AddSingleton<ProjectWindow>();
serviceCollection.AddSingleton<UpdateWindow>();
serviceCollection.AddSingleton<LibraryWindow>();
serviceCollection.AddSingleton<ActorAppearanceWindow>();
Expand Down
7 changes: 4 additions & 3 deletions Brio/Brio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="11.0.0" />
<PackageReference Include="EmbedIO" Version="3.5.2" />
<PackageReference Include="Glamourer.Api" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Glamourer.Api" Version="2.4.0" />
<PackageReference Include="MessagePack" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
<PackageReference Include="OneOf" Version="3.0.271" />
<PackageReference Include="OneOf.SourceGenerator" Version="3.0.271" />
<PackageReference Include="Penumbra.Api" Version="5.3.0" />
<PackageReference Include="Penumbra.Api" Version="5.6.0" />
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
Expand Down
1 change: 1 addition & 0 deletions Brio/Brio.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"Description": "Control actors during GPose sessions.",
"AssemblyVersion": "0.0.0.1",
"InternalName": "Brio",
"publicName": "Brio",
"ApplicableVersion": "any",
"IconUrl": "https://raw.githubusercontent.com/Etheirys/Brio/main/Resources/Images/BrioIcon.png",
"Tags": [
Expand Down
2 changes: 1 addition & 1 deletion Brio/Capabilities/Actor/ActionTimelineCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Brio.Capabilities.Actor;

internal class ActionTimelineCapability : ActorCharacterCapability
public class ActionTimelineCapability : ActorCharacterCapability
{
private readonly IFramework _framework;

Expand Down
113 changes: 108 additions & 5 deletions Brio/Capabilities/Actor/ActorAppearanceCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,45 @@
using Brio.IPC;
using Brio.Resources;
using Brio.UI.Widgets.Actor;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using System;
using System.Threading.Tasks;

namespace Brio.Capabilities.Actor;

internal class ActorAppearanceCapability : ActorCharacterCapability
public class ActorAppearanceCapability : ActorCharacterCapability
{
private readonly ActorAppearanceService _actorAppearanceService;
private readonly PenumbraService _penumbraService;
private readonly CustomizePlusService _customizePlusService;
private readonly GlamourerService _glamourerService;
private readonly MareService _mareService;
private readonly GPoseService _gposeService;
private readonly IFramework _framework;

public string CurrentCollection => _penumbraService.GetCollectionForObject(Character);
public PenumbraService PenumbraService => _penumbraService;

public bool IsCollectionOverridden => _oldCollection != null;
private string? _oldCollection = null;


public string CurrentDesign { get; set; } = "None";
public GlamourerService GlamourerService => _glamourerService;


public (string? name, Guid? id) SelectedDesign { get; set; } = ("None", null);
public (string? data, Guid? id) CurrentProfile => _customizePlusService.GetActiveProfile(Character);
public CustomizePlusService CustomizePlusService => _customizePlusService;


private ActorAppearance? _originalAppearance = null;
public bool IsAppearanceOverridden => _originalAppearance.HasValue;

public bool HasPenumbraIntegration => _penumbraService.IsPenumbraAvailable;
public bool HasPenumbraIntegration => _penumbraService.IsAvailable;
public bool HasGlamourerIntegration => _glamourerService.IsAvailable;
public bool HasCustomizePlusIntegration => _customizePlusService.IsAvailable;

public ActorAppearance CurrentAppearance => _actorAppearanceService.GetActorAppearance(Character);

Expand All @@ -43,17 +59,20 @@ internal class ActorAppearanceCapability : ActorCharacterCapability

public bool CanTint => _actorAppearanceService.CanTint;

public bool CanMcdf => _mareService.IsMareAvailable;
public bool CanMcdf => _mareService.IsAvailable;

public bool IsHidden => CurrentAppearance.ExtendedAppearance.Transparency == 0;

public ActorAppearanceCapability(ActorEntity parent, ActorAppearanceService actorAppearanceService, PenumbraService penumbraService, GlamourerService glamourerService, MareService mareService, GPoseService gPoseService) : base(parent)
public ActorAppearanceCapability(ActorEntity parent, IFramework framework, ActorAppearanceService actorAppearanceService, CustomizePlusService customizePlusService, PenumbraService penumbraService, GlamourerService glamourerService, MareService mareService, GPoseService gPoseService) : base(parent)
{
_actorAppearanceService = actorAppearanceService;
_penumbraService = penumbraService;
_glamourerService = glamourerService;
_mareService = mareService;
_gposeService = gPoseService;
_customizePlusService = customizePlusService;
_framework = framework;

Widget = new ActorAppearanceWidget(this);

_gposeService.OnGPoseStateChange += OnGPoseStateChanged;
Expand All @@ -80,7 +99,6 @@ public void SetCollection(Guid collection)

_ = _actorAppearanceService.Redraw(Character);
}

public void ResetCollection()
{
if(IsCollectionOverridden)
Expand All @@ -91,6 +109,65 @@ public void ResetCollection()
}
}

public void SetDesign(Guid design)
{
_ = _glamourerService.ApplyDesign(design, Character);
}
public void ResetDesign(bool isRest = false)
{
_glamourerService.RevertCharacter(Character);

if(isRest == false && _glamourerService.CheckForLock(Character))
{
ResetCollection();
ResetProfile(true);
}
}

public void SetProfile(string data)
{
_customizePlusService.SetProfile(Character, data);
}
public void ResetProfile(bool isRest = false)
{
_customizePlusService.RemoveTemporaryProfile(Character);

if(isRest == false && _glamourerService.CheckForLock(Character))
{
ResetCollection();
ResetDesign(true);
}

SetSelectedProfile();
}
public Guid? GetActiveProfile()
{
return _customizePlusService.GetActiveProfile(Character).Item2;
}
public void SetSelectedProfile()
{
var profiles = _customizePlusService.GetProfiles();

var activeProfile = GetActiveProfile();
if(activeProfile is not null)
{
foreach(var item in profiles)
{
if(item.UniqueId == activeProfile.Value)
{
SelectedDesign = (item.Name, activeProfile.Value);
}
}
}
else
{
SelectedDesign = ("None", null);
}
}

public async void SetAppearanceAsTask(ActorAppearance appearance, AppearanceImportOptions options)
=> await SetAppearance(appearance, options);

public async Task SetAppearance(ActorAppearance appearance, AppearanceImportOptions options)
{
Brio.Log.Debug($"Setting appearance for gameobject {GameObject.ObjectIndex}...");
Expand All @@ -107,6 +184,12 @@ public async Task SetAppearance(ActorAppearance appearance, AppearanceImportOpti
_modelShaderOverride.Reset();
}

if(Entity is ActorEntity actor && actor.IsProp == true)
await _framework.RunOnTick(() =>
{
AttachWeapon();
}, delayTicks: 5);

Brio.Log.Debug($"Appearance set for gameobject {GameObject.ObjectIndex}.");
}

Expand Down Expand Up @@ -193,6 +276,13 @@ public async Task Redraw()
{
await _actorAppearanceService.Redraw(Character);
ApplyShaderOverride();

if(Entity is ActorEntity actor && actor.IsProp == true)
await _framework.RunOnTick(() =>
{
AttachWeapon();
}, delayTicks: 5);

return;
}

Expand All @@ -212,6 +302,19 @@ public unsafe void AttachWeapon()
Character.Native()->Timeline.TimelineSequencer.PlayTimeline(5616);
}

public Task SetProp(WeaponModelId modelId)
{
var appearance = _actorAppearanceService.GetActorAppearance(Character);
appearance.Weapons.MainHand = modelId;
return SetAppearance(appearance, AppearanceImportOptions.Weapon);
}

public WeaponModelId GetProp()
{
var appearance = _actorAppearanceService.GetActorAppearance(Character);
return appearance.Weapons.MainHand;
}

private unsafe void ApplyShaderOverride()
{
var shaders = Character.GetShaderParams();
Expand Down
4 changes: 2 additions & 2 deletions Brio/Capabilities/Actor/ActorCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace Brio.Capabilities.Actor;

internal abstract class ActorCapability(ActorEntity parent) : Capability(parent)
public abstract class ActorCapability(ActorEntity parent) : Capability(parent)
{
public ActorEntity Actor => (ActorEntity)Entity;

public IGameObject GameObject => Actor.GameObject;
}

internal abstract class ActorCharacterCapability(ActorEntity parent) : ActorCapability(parent)
public abstract class ActorCharacterCapability(ActorEntity parent) : ActorCapability(parent)
{
public ICharacter Character => (ICharacter)GameObject;
}
17 changes: 16 additions & 1 deletion Brio/Capabilities/Actor/ActorContainerCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Brio.Capabilities.Actor;

internal class ActorContainerCapability : Capability
public class ActorContainerCapability : Capability
{
private readonly EntityManager _entityManager;
private readonly ActorSpawnService _actorSpawnService;
Expand Down Expand Up @@ -53,6 +53,21 @@
throw new Exception("Failed to create character");
}

public (EntityId, ICharacter) CreateProp(bool selectInHierarchy)
{
if(_actorSpawnService.SpawnNewProp(out ICharacter? chara))
{
EntityId characterId = new EntityId(chara);

Check warning on line 60 in Brio/Capabilities/Actor/ActorContainerCapability.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'go' in 'EntityId.EntityId(IGameObject go)'.

Check warning on line 60 in Brio/Capabilities/Actor/ActorContainerCapability.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'go' in 'EntityId.EntityId(IGameObject go)'.
if(selectInHierarchy)
{
_entityManager.SetSelectedEntity(chara);
}
return (characterId, chara);
}

throw new Exception("Failed to create prop");
}

public void DestroyCharacter(ActorEntity entity)
{
_actorSpawnService.DestroyObject(entity.GameObject);
Expand Down
2 changes: 1 addition & 1 deletion Brio/Capabilities/Actor/ActorDebugCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Brio.Capabilities.Actor;

internal class ActorDebugCapability : ActorCharacterCapability
public class ActorDebugCapability : ActorCharacterCapability
{

public bool IsDebug => _configService.IsDebug;
Expand Down
30 changes: 30 additions & 0 deletions Brio/Capabilities/Actor/ActorDynamicPoseCapability.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Brio.Entities.Actor;
using Brio.Game.Actor;
using Brio.Game.GPose;
using Brio.UI.Widgets.Actor;

namespace Brio.Capabilities.Actor;
public class ActorDynamicPoseCapability : ActorCharacterCapability
{
private readonly ActorAppearanceService _actorAppearanceService;
private readonly GPoseService _gposeService;

public ActorDynamicPoseCapability(ActorEntity parent, ActorAppearanceService actorAppearanceService, GPoseService gPoseService) : base(parent)
{
_actorAppearanceService = actorAppearanceService;
_gposeService = gPoseService;

Widget = new ActorDynamicPoseWidget(this);
}

public unsafe void TESTactorlook()
{
_actorAppearanceService.TESTactorlook(GameObject);
}

public unsafe void TESTactorlookClear()
{
_actorAppearanceService.TESTactorlookClear(GameObject);
}

}
Loading