Skip to content

Commit

Permalink
- Replaced ParticleMaster with the new LiveParticleEditor
Browse files Browse the repository at this point in the history
- Made alpha slider easier to understand
- Made SyncLinearKey a seperate class to avoid confusion
- Updated ReadMe
- Minor Text Fixes
  • Loading branch information
Epimonster committed Feb 14, 2021
1 parent daad59e commit 27a95af
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 15 deletions.
57 changes: 57 additions & 0 deletions LiveParticleEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using BaseX;
using FrooxEngine;
using FrooxEngine.UIX;
using CodeX;

namespace ParticleWorkshop
{
[Category("Gareth")]
class LiveParticleEditor : Component, ICustomInspector
{
public readonly SyncRef<ParticleStyle> ParticleStyle;
public readonly SyncList<SyncLinearKey<color>> Colors;
public readonly SyncList<SyncLinearKey<float>> Alpha;

//Ui is needed
public void BuildInspectorUI(UIBuilder ui)
{
WorkerInspector.BuildInspectorUI(this, ui);
}
protected override void OnAttach()
{
if (ParticleStyle != null&&!ParticleStyle.IsDisposed)
{
ParticleStyle.Changed += Update_Paticles;
Colors.Changed += Colors_Changed;
Alpha.Changed += Alpha_Changed;
}
base.OnAttach();
}
private void Colors_Changed(IChangeable obj)
{
ParticleStyle.Target.ColorOverLifetime.Clear();
foreach (SyncLinearKey<color> key in Colors)
{
ParticleStyle.Target.ColorOverLifetime.Append(key);
}
}

private void Alpha_Changed(IChangeable obj)
{
ParticleStyle.Target.AlphaOverLifetime.Clear();
foreach (SyncLinearKey<float> key in Alpha)
{
ParticleStyle.Target.AlphaOverLifetime.Append(key);
}
}

private void Update_Paticles(IChangeable obj)
{
ParticleStyle.Target.UseColorOverLifetime.Value = true;
Colors_Changed(Colors);
Alpha_Changed(Alpha);
}

}
}
7 changes: 0 additions & 7 deletions ParticleMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

namespace ParticleWorkshop
{
public class SyncLinearKey<T> : SyncObject where T : IEquatable<T>
{
[Range(0.0f, 1f, "0.0000")]
public readonly Sync<float> Position;
public readonly Sync<T> Value;
public static implicit operator LinearKey<T>(SyncLinearKey<T> key) => new LinearKey<T>(key.Position.Value, key.Value.Value);
}
[Category("Gareth")]
class ParticleMaster : Component, ICustomInspector
{
Expand Down
6 changes: 5 additions & 1 deletion ParticleWorkshop.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="ParticleMaster.cs" />
</ItemGroup>

<ItemGroup>
<Reference Include="BaseX">
<HintPath>E:\Steam\steamapps\common\NeosVR\BaseX.dll</HintPath>
Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,28 @@ Created by Gareth48 with some huge help from Epsilion!

## What to do once you're in game
1. Open the component browser and navigate to the tab labaled "Gareth"
1. There are two new components
1. Particle Master, which allows you to create a tailored particle based on custom inputs
1. Random Particles, which randomly generates a set amount of particles
1. Once you've created a particle, save it to your inventory, remove the launch option addition and reboot Neos
1. There are three new components
1. Live particle editor, which accepts and can edit a particle system in realtime (make sure the blend mode on your particle material is set to alpha if you want to see alpha changes!)
1. Random Particles, which randomly generates particles with a set amount of alpha and color transitions
1. If you use the live particle editor, once you're satisfied with your changes you can just delete the component and your changes will be saved
1. Once you've created a particle, save it to your inventory, remove the launch option addition and reboot Vanilla Neos
1. Enjoy your new particle! Feel free to use it as you please, if you do something neat with it I would love to see a picture!

## How this works
1. If it helps, think of this plugin like an inventory editor
1. Using it, we can create objects that Neos technically supports but that we have no way to generate at the moment
1. An example of color over time in the base game is the particle spray tip! It's rainbow effect is acheived in this way
1. All this plugin does is provide a GUI for you to edit those values

## Known issues
1. You cannot add duplicate color or alpha transitions
1. You can only add up to 8 unique color transitions AND 8 unique alpha transitions
1. The gradient display will not update unless your sliders are linearly ordered by time
1. The gradient display does not support alpha (yet)
1. Driving randomiterations to a large number will crash the game!
1. If the component somehow stops working, delete all instances of it, restart your game and send your logs to Gareth48
1. As a good rule of thumb, deleting the component, restarting your game and reapplying it should fix most trivial bugs
1. Once you assign a particle style to the Live Particle Editor's reference field the component it is locked on. To edit another particle system simply create another Live Particle Editor

## Contribution Guidelines
1. Please send any bugs or suggestions you have to Gareth48 in Neos, or report them via the github
1. If you would like, open an issue stating your problem or motivation and a suggested solution.
1. Create a pull request which links to your issue.
1. Create a pull request which links to your issue.
17 changes: 17 additions & 0 deletions SyncLinearKey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using BaseX;
using FrooxEngine;
using System;
using System.Collections.Generic;
using System.Text;

namespace ParticleWorkshop
{
public class SyncLinearKey<T> : SyncObject where T : IEquatable<T>
{
[Range(0.0f, 1f, "0.000")]
public readonly Sync<float> TransitionTime;
[Range(0.0f, 1f, "0.00")]
public readonly Sync<T> Value;
public static implicit operator LinearKey<T>(SyncLinearKey<T> key) => new LinearKey<T>(key.TransitionTime.Value, key.Value.Value);
}
}

0 comments on commit 27a95af

Please sign in to comment.