Skip to content

Jitter plugins#1027

Draft
andybak wants to merge 7 commits into
mainfrom
feature/jitter-plugins
Draft

Jitter plugins#1027
andybak wants to merge 7 commits into
mainfrom
feature/jitter-plugins

Conversation

@andybak

@andybak andybak commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@andybak andybak added the enhancement Feature added label Apr 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Lua scripting hook intended to let plugins override brush color jitter behavior by running a “JitterScript” instead of the built-in HSV jitter logic.

Changes:

  • Add LuaApiCategory.JitterScript and a JitterScriptsEnabled flag in LuaManager.
  • Add LuaManager.CallActiveJitterScript(fnName, currentColor) to invoke the active jitter script and convert its return value to Color.
  • Update PointerManager.CalculateJitteredColor to delegate jitter computation to Lua when enabled.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Assets/Scripts/PointerManager.cs Routes color jitter calculation through Lua when JitterScriptsEnabled is on.
Assets/Scripts/API/Lua/LuaManager.cs Adds the new jitter category, enable flag, and the API surface for calling the active jitter script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1982 to +1985
if (LuaManager.Instance.JitterScriptsEnabled)
{
return LuaManager.Instance.CallActiveJitterScript("main", currentColor);
}
Comment on lines 128 to +132
[NonSerialized] public bool PointerScriptsEnabled;
[NonSerialized] public bool VisualizerScriptingEnabled;
[NonSerialized] public bool BackgroundScriptsEnabled;
[NonSerialized] public bool JitterScriptsEnabled;

Comment on lines +776 to +782
public Color CallActiveJitterScript(string fnName, Color currentColor)
{
var script = GetActiveScript(LuaApiCategory.JitterScript);
script.Globals.Set("_currentColor", DynValue.FromObject(script, currentColor));
DynValue result = _CallScript(script, fnName);
return result.ToObject<Color>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature added

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants