Skip to content
Merged
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
8 changes: 8 additions & 0 deletions Unity-Package/Assets/root/Editor/Scripts/Data.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
┌─────────────────────────────────────────────────────────────────────────────┐
│ Author: Ivan Murzak (https://github.com/IvanMurzak) │
│ Repository: GitHub (https://github.com/IvanMurzak/Unity-AI-ParticleSystem) │
│ Copyright (c) 2025 Ivan Murzak │
│ Licensed under the MIT License. │
│ See the LICENSE file in the project root for more information. │
└─────────────────────────────────────────────────────────────────────────────┘
*/

#nullable enable
using System.ComponentModel;
using com.IvanMurzak.ReflectorNet.Model;
using com.IvanMurzak.Unity.MCP.Runtime.Data;

namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor
{
/// <summary>
/// Response model for Get ParticleSystem tool.
/// </summary>
[Description("Response containing ParticleSystem data with requested modules.")]
public class GetParticleSystemResponse
{
[Description("Reference to the GameObject containing the ParticleSystem component.")]
public GameObjectRef? gameObjectRef;

[Description("Reference to the ParticleSystem component.")]
public ComponentRef? componentRef;

[Description("Index of the ParticleSystem component in the GameObject's component list.")]
public int componentIndex = -1;

[Description("Whether the ParticleSystem is currently playing.")]
public bool isPlaying;

[Description("Whether the ParticleSystem is currently paused.")]
public bool isPaused;

[Description("Whether the ParticleSystem is currently emitting.")]
public bool isEmitting;

[Description("Whether the ParticleSystem is currently stopped.")]
public bool isStopped;

[Description("Current particle count.")]
public int particleCount;

[Description("Current simulation time.")]
public float time;

[Description("Main module data.")]
public SerializedMember? main;

[Description("Emission module data.")]
public SerializedMember? emission;

[Description("Shape module data.")]
public SerializedMember? shape;

[Description("Velocity over Lifetime module data.")]
public SerializedMember? velocityOverLifetime;

[Description("Limit Velocity over Lifetime module data.")]
public SerializedMember? limitVelocityOverLifetime;

[Description("Inherit Velocity module data.")]
public SerializedMember? inheritVelocity;

[Description("Lifetime by Emitter Speed module data.")]
public SerializedMember? lifetimeByEmitterSpeed;

[Description("Force over Lifetime module data.")]
public SerializedMember? forceOverLifetime;

[Description("Color over Lifetime module data.")]
public SerializedMember? colorOverLifetime;

[Description("Color by Speed module data.")]
public SerializedMember? colorBySpeed;

[Description("Size over Lifetime module data.")]
public SerializedMember? sizeOverLifetime;

[Description("Size by Speed module data.")]
public SerializedMember? sizeBySpeed;

[Description("Rotation over Lifetime module data.")]
public SerializedMember? rotationOverLifetime;

[Description("Rotation by Speed module data.")]
public SerializedMember? rotationBySpeed;

[Description("External Forces module data.")]
public SerializedMember? externalForces;

[Description("Noise module data.")]
public SerializedMember? noise;

[Description("Collision module data.")]
public SerializedMember? collision;

[Description("Trigger module data.")]
public SerializedMember? trigger;

[Description("Sub Emitters module data.")]
public SerializedMember? subEmitters;

[Description("Texture Sheet Animation module data.")]
public SerializedMember? textureSheetAnimation;

[Description("Lights module data.")]
public SerializedMember? lights;

[Description("Trails module data.")]
public SerializedMember? trails;

[Description("Custom Data module data.")]
public SerializedMember? customData;

[Description("Renderer module data.")]
public SerializedMember? renderer;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
┌─────────────────────────────────────────────────────────────────────────────┐
│ Author: Ivan Murzak (https://github.com/IvanMurzak) │
│ Repository: GitHub (https://github.com/IvanMurzak/Unity-AI-ParticleSystem) │
│ Copyright (c) 2025 Ivan Murzak │
│ Licensed under the MIT License. │
│ See the LICENSE file in the project root for more information. │
└─────────────────────────────────────────────────────────────────────────────┘
*/

#nullable enable
using System.ComponentModel;
using com.IvanMurzak.Unity.MCP.Runtime.Data;

namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor
{
/// <summary>
/// Response model for Modify ParticleSystem tool.
/// </summary>
[Description("Response containing the result of modifying a ParticleSystem.")]
public class ModifyParticleSystemResponse
{
[Description("Whether the modification was successful.")]
public bool success;

[Description("Reference to the GameObject containing the ParticleSystem component.")]
public GameObjectRef? gameObjectRef;

[Description("Reference to the modified ParticleSystem component.")]
public ComponentRef? componentRef;

[Description("Index of the ParticleSystem component in the GameObject's component list.")]
public int componentIndex = -1;

[Description("Log of modifications made and any warnings/errors encountered.")]
public string[]? logs;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using com.IvanMurzak.ReflectorNet.Model;
using com.IvanMurzak.Unity.MCP.Runtime.Data;

namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor.API
namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor
{
/// <summary>
/// Data model for ParticleSystem component containing serialized data for all modules.
Expand Down Expand Up @@ -104,132 +104,4 @@ public class ParticleSystemData
[Description("Renderer module data: renderMode, sortMode, lengthScale, velocityScale, cameraVelocityScale, normalDirection, sortingFudge, minParticleSize, maxParticleSize, alignment, flip, allowRoll, pivot, maskInteraction, material, trailMaterial, shadowCastingMode, receiveShadows, shadowBias, motionVectorGenerationMode, sortingLayerID, sortingLayerName, sortingOrder, lightProbeUsage, reflectionProbeUsage, probeAnchor.")]
public SerializedMember? renderer;
}

/// <summary>
/// Response model for Get ParticleSystem tool.
/// </summary>
[Description("Response containing ParticleSystem data with requested modules.")]
public class GetParticleSystemResponse
{
[Description("Reference to the GameObject containing the ParticleSystem component.")]
public GameObjectRef? gameObjectRef;

[Description("Reference to the ParticleSystem component.")]
public ComponentRef? componentRef;

[Description("Index of the ParticleSystem component in the GameObject's component list.")]
public int componentIndex = -1;

[Description("Whether the ParticleSystem is currently playing.")]
public bool isPlaying;

[Description("Whether the ParticleSystem is currently paused.")]
public bool isPaused;

[Description("Whether the ParticleSystem is currently emitting.")]
public bool isEmitting;

[Description("Whether the ParticleSystem is currently stopped.")]
public bool isStopped;

[Description("Current particle count.")]
public int particleCount;

[Description("Current simulation time.")]
public float time;

[Description("Main module data.")]
public SerializedMember? main;

[Description("Emission module data.")]
public SerializedMember? emission;

[Description("Shape module data.")]
public SerializedMember? shape;

[Description("Velocity over Lifetime module data.")]
public SerializedMember? velocityOverLifetime;

[Description("Limit Velocity over Lifetime module data.")]
public SerializedMember? limitVelocityOverLifetime;

[Description("Inherit Velocity module data.")]
public SerializedMember? inheritVelocity;

[Description("Lifetime by Emitter Speed module data.")]
public SerializedMember? lifetimeByEmitterSpeed;

[Description("Force over Lifetime module data.")]
public SerializedMember? forceOverLifetime;

[Description("Color over Lifetime module data.")]
public SerializedMember? colorOverLifetime;

[Description("Color by Speed module data.")]
public SerializedMember? colorBySpeed;

[Description("Size over Lifetime module data.")]
public SerializedMember? sizeOverLifetime;

[Description("Size by Speed module data.")]
public SerializedMember? sizeBySpeed;

[Description("Rotation over Lifetime module data.")]
public SerializedMember? rotationOverLifetime;

[Description("Rotation by Speed module data.")]
public SerializedMember? rotationBySpeed;

[Description("External Forces module data.")]
public SerializedMember? externalForces;

[Description("Noise module data.")]
public SerializedMember? noise;

[Description("Collision module data.")]
public SerializedMember? collision;

[Description("Trigger module data.")]
public SerializedMember? trigger;

[Description("Sub Emitters module data.")]
public SerializedMember? subEmitters;

[Description("Texture Sheet Animation module data.")]
public SerializedMember? textureSheetAnimation;

[Description("Lights module data.")]
public SerializedMember? lights;

[Description("Trails module data.")]
public SerializedMember? trails;

[Description("Custom Data module data.")]
public SerializedMember? customData;

[Description("Renderer module data.")]
public SerializedMember? renderer;
}

/// <summary>
/// Response model for Modify ParticleSystem tool.
/// </summary>
[Description("Response containing the result of modifying a ParticleSystem.")]
public class ModifyParticleSystemResponse
{
[Description("Whether the modification was successful.")]
public bool success;

[Description("Reference to the GameObject containing the ParticleSystem component.")]
public GameObjectRef? gameObjectRef;

[Description("Reference to the modified ParticleSystem component.")]
public ComponentRef? componentRef;

[Description("Index of the ParticleSystem component in the GameObject's component list.")]
public int componentIndex = -1;

[Description("Log of modifications made and any warnings/errors encountered.")]
public string[]? logs;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using com.IvanMurzak.Unity.MCP.Utils;
using Microsoft.Extensions.Logging;

namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor.API
namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor
{
public partial class Tool_ParticleSystem
{
Expand Down Expand Up @@ -121,14 +121,20 @@ public GetParticleSystemResponse Get
bool deepSerialization = false
)
{
if (gameObjectRef == null)
throw new ArgumentNullException(nameof(gameObjectRef));

if (!gameObjectRef.IsValid(out var gameObjectValidationError))
throw new ArgumentException(gameObjectValidationError, nameof(gameObjectRef));

return MainThread.Instance.Run(() =>
{
var go = gameObjectRef.FindGameObject(out var error);
if (error != null)
throw new Exception(error);

if (go == null)
throw new Exception(Error.GameObjectNotFound());
throw new Exception("GameObject not found.");

// Find the ParticleSystem component
UnityEngine.ParticleSystem? ps = null;
Expand All @@ -141,7 +147,7 @@ public GetParticleSystemResponse Get
if (comp == null)
continue;

if (componentRef != null && componentRef.IsValid)
if (componentRef != null && componentRef.IsValid(out _))
{
if (componentRef.Matches(allComponents[i], i))
{
Expand All @@ -160,7 +166,7 @@ public GetParticleSystemResponse Get
}

if (ps == null)
throw new Exception(Error.ParticleSystemNotFound());
throw new Exception("ParticleSystem component not found on the specified GameObject.");

var response = new GetParticleSystemResponse
{
Expand Down
Loading
Loading