Before adding custom inspectors

This commit is contained in:
Josef 2026-02-12 10:48:23 +01:00
parent 537926b050
commit 5e3fe880c6
99 changed files with 2426 additions and 241 deletions

View File

@ -3,19 +3,20 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://b7u8spfui08e7" uid="uid://b7u8spfui08e7"
path="res://.godot/imported/FlareVFX.svg-7c0691138c416c828300e95f7f8b3111.ctex" path.s3tc="res://.godot/imported/FlareVFX.svg-7c0691138c416c828300e95f7f8b3111.s3tc.ctex"
metadata={ metadata={
"vram_texture": false "imported_formats": ["s3tc_bptc"],
"vram_texture": true
} }
[deps] [deps]
source_file="res://addons/rokojori_action_library/Icons/FlareVFX.svg" source_file="res://addons/rokojori_action_library/Icons/FlareVFX.svg"
dest_files=["res://.godot/imported/FlareVFX.svg-7c0691138c416c828300e95f7f8b3111.ctex"] dest_files=["res://.godot/imported/FlareVFX.svg-7c0691138c416c828300e95f7f8b3111.s3tc.ctex"]
[params] [params]
compress/mode=0 compress/mode=2
compress/high_quality=false compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/uastc_level=0 compress/uastc_level=0
@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0
compress/hdr_compression=1 compress/hdr_compression=1
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=true
mipmaps/limit=-1 mipmaps/limit=-1
roughness/mode=0 roughness/mode=0
roughness/src_normal="" roughness/src_normal=""
@ -37,7 +38,7 @@ process/normal_map_invert_y=false
process/hdr_as_srgb=false process/hdr_as_srgb=false
process/hdr_clamp_exposure=false process/hdr_clamp_exposure=false
process/size_limit=0 process/size_limit=0
detect_3d/compress_to=1 detect_3d/compress_to=0
svg/scale=1.0 svg/scale=1.0
editor/scale_with_editor_scale=false editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false editor/convert_colors_with_editor_theme=false

View File

@ -31,7 +31,9 @@ namespace Rokojori
protected override void _OnTrigger() protected override void _OnTrigger()
{ {
var actions = new List<Action>( this.actions ); var actions = new List<Action>( this.actions );
if ( triggerDirectChildren ) if ( triggerDirectChildren )
{ {
@ -59,6 +61,8 @@ namespace Rokojori
sa.onSequenceDone.Once( sa.onSequenceDone.Once(
( fe )=> ( fe )=>
{ {
// this.LogInfo( "Sequence Action finished:", HierarchyName.Of( sa ) );
if ( ! running ) if ( ! running )
{ {
return; return;
@ -71,6 +75,7 @@ namespace Rokojori
if ( Mode.First_Finishes_Sequence == mode ) if ( Mode.First_Finishes_Sequence == mode )
{ {
running = false; running = false;
// this.LogInfo( "DispatchEnd for First_Finishes_Sequence" );
DispatchEnd( sequenceID ); DispatchEnd( sequenceID );
} }
@ -79,6 +84,7 @@ namespace Rokojori
if ( numFinished == sequenceActions.Count ) if ( numFinished == sequenceActions.Count )
{ {
running = false; running = false;
// this.LogInfo( "DispatchEnd for Wait_For_All_To_Finish" );
DispatchEnd( sequenceID ); DispatchEnd( sequenceID );
} }
} }
@ -86,6 +92,7 @@ namespace Rokojori
else else
{ {
running = false; running = false;
// this.LogInfo( "DispatchCancelled for Wait_For_All_To_Finish" );
DispatchCancelled( sequenceID ); DispatchCancelled( sequenceID );
} }
} }

View File

@ -4,6 +4,8 @@ using System.Collections.Generic;
namespace Rokojori namespace Rokojori
{ {
[Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Parallel.svg") ] [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Parallel.svg") ]
public partial class RepeatSequence : SequenceAction public partial class RepeatSequence : SequenceAction
{ {
@ -32,6 +34,8 @@ namespace Rokojori
{ {
var id = DispatchStart(); var id = DispatchStart();
this.LogInfo( "Starting ID:", id );
if ( ! ( action is SequenceAction ) ) if ( ! ( action is SequenceAction ) )
{ {
Trigger( action ); Trigger( action );
@ -39,12 +43,6 @@ namespace Rokojori
return; return;
} }
var sa = (SequenceAction) action;
var executed = 0;
System.Action<SequenceActionFinishedEvent> callBack = null;
var tl = TimeLineManager.Ensure( timeLine ); var tl = TimeLineManager.Ensure( timeLine );
if ( maxNumRepeats <= 0 && ( tl == null || maxRepeatDuration <= 0 ) ) if ( maxNumRepeats <= 0 && ( tl == null || maxRepeatDuration <= 0 ) )
@ -52,44 +50,68 @@ namespace Rokojori
return; return;
} }
var startTime = tl.position; var runner = new RepeatSequenceRunner();
var endTime = tl.position + maxRepeatDuration; runner.Start( id, this );
callBack = ( a )=> }
{
if ( ! a.success )
{
DispatchCancelled( id );
sa.onSequenceDone.RemoveAction( callBack );
return;
}
executed ++;
var finished = ( maxNumRepeats > 0 && executed >= maxNumRepeats ) ||
( tl != null && tl.position >= endTime );
finished = stopSignal || finished;
if ( finished )
{
DispatchEnd( id );
sa.onSequenceDone.RemoveAction( callBack );
return;
}
else
{
Trigger( action );
}
};
sa.onSequenceDone.AddAction( callBack );
}
Trigger( action ); public class RepeatSequenceRunner
{
public RepeatSequence repeatSequence;
public TimeLine timeLine;
public int sequenceID;
public int maxRepeats = 0;
public int started = 0;
public float startTime = 0;
public float endTime = 0;
public void Start( int id, RepeatSequence repeatSequence )
{
this.repeatSequence = repeatSequence;
this.sequenceID = id;
timeLine = TimeLineManager.Ensure( repeatSequence.timeLine );
startTime = timeLine.position;
endTime = startTime + repeatSequence.maxRepeatDuration;
maxRepeats = repeatSequence.maxNumRepeats;
Next();
} }
public void Next()
{
if ( started == maxRepeats )
{
repeatSequence.DispatchEnd( sequenceID );
repeatSequence.LogInfo( "Finished:", sequenceID );
return;
}
started ++;
repeatSequence.LogInfo( "Next:", sequenceID, started );
var sa = (SequenceAction) repeatSequence.action;
sa.onSequenceDone.Once(
async ( fe ) =>
{
// repeatSequence.LogInfo( fe.success );
await sa.RequestNextFrame();
Next();
}
);
sa.Trigger();
}
} }
} }

View File

@ -1,6 +1,6 @@
using Godot; using Godot;
using System.Collections.Generic;
namespace Rokojori namespace Rokojori
{ {
@ -15,8 +15,23 @@ namespace Rokojori
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/SequenceAction.svg")] [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/SequenceAction.svg")]
public abstract partial class SequenceAction : Action public abstract partial class SequenceAction : Action
{ {
[ExportGroup("Debugging")]
[ExportToolButton("Clear Listeners")]
public Callable clearListeners => Callable.From(
()=>
{
onSequenceDone.ResetAndClearAll();
}
);
[Export]
public bool showRunningSequences = false;
[Export]
public int[] runningSequences = [];
int _dispatchCounter = 0; int _dispatchCounter = 0;
public int GetLastSequenceActionID() public int GetLastSequenceActionID()
@ -29,22 +44,40 @@ namespace Rokojori
public int DispatchStart() public int DispatchStart()
{ {
_dispatchCounter ++; _dispatchCounter ++;
if ( showRunningSequences )
{
runningSequences = runningSequences.Add( _dispatchCounter );
}
return _dispatchCounter; return _dispatchCounter;
} }
public void DispatchEnd( int id ) public void DispatchEnd( int id )
{ {
onSequenceDone.DispatchEvent( new SequenceActionFinishedEvent{ id = id, success = true } ); var ev = new SequenceActionFinishedEvent{ id = id, success = true };
onSequenceDone.DispatchEvent( ev );
if ( showRunningSequences )
{
runningSequences = runningSequences.Remove( _dispatchCounter );
}
} }
public void DispatchCancelled( int id ) public void DispatchCancelled( int id )
{ {
onSequenceDone.DispatchEvent( new SequenceActionFinishedEvent{ id = id, success = false } ); var ev = new SequenceActionFinishedEvent{ id = id, success = true };
onSequenceDone.DispatchEvent( ev );
if ( showRunningSequences )
{
runningSequences = runningSequences.Remove( _dispatchCounter );
}
} }
public virtual void CancelAction( int id ) public virtual void CancelAction( int id )
{ {
} }
public int TriggerSequenceAndGetID() public int TriggerSequenceAndGetID()

View File

@ -46,10 +46,10 @@ namespace Rokojori
{ {
Action.Trigger( onAfterLast ); Action.Trigger( onAfterLast );
} }
} },
this
);
);
} }
} }

View File

@ -24,6 +24,14 @@ namespace Rokojori
[Export] [Export]
public Curve curve; public Curve curve;
[ExportGroup( "Editor Testing")]
[Export]
public bool forceStartValue = false;
[Export]
public float forcedStartValue = 0f;
public void OnAnimatorStart(){} public void OnAnimatorStart(){}
public void OnAnimatorEnd(){} public void OnAnimatorEnd(){}
public void OnAnimatorCancel(){} public void OnAnimatorCancel(){}
@ -36,21 +44,10 @@ namespace Rokojori
protected override void _OnTrigger() protected override void _OnTrigger()
{ {
if ( ! interruptCurrent && _actionID != -1 ) if ( ! interruptCurrent && _actionID != -1 )
{ {
// this.LogInfo( "Already running" );
return; return;
} }
// this.LogInfo( "Started Float Tween" );
if ( Engine.IsEditorHint() )
{
return;
}
if ( _actionID != -1 ) if ( _actionID != -1 )
@ -61,6 +58,12 @@ namespace Rokojori
_actionID = DispatchStart(); _actionID = DispatchStart();
var startValue = propertyName.Get( material ); var startValue = propertyName.Get( material );
if ( forceStartValue && Engine.IsEditorHint() )
{
startValue = forcedStartValue;
}
AnimationManager.StartAnimation( this, material, propertyName ); AnimationManager.StartAnimation( this, material, propertyName );
@ -107,7 +110,8 @@ namespace Rokojori
_actionID = -1; _actionID = -1;
_timeID = -1; _timeID = -1;
} }
} },
this
).id; ).id;
} }

View File

@ -44,6 +44,12 @@ namespace Rokojori
public class AnimationManager public class AnimationManager
{ {
static MultiMap<GodotObject,string,Animator> _animatingObjects = new MultiMap<GodotObject,string,Animator>(); static MultiMap<GodotObject,string,Animator> _animatingObjects = new MultiMap<GodotObject,string,Animator>();
static MultiMap<GodotObject,string,object,Animator> _animatingReferences = new MultiMap<GodotObject,string,object,Animator>();
public static Animator GetAnimator( GodotObject go, string memberName, object obj )
{
return _animatingReferences.Get( go, memberName, obj );
}
public static Animator GetAnimator( GodotObject go, string memberName ) public static Animator GetAnimator( GodotObject go, string memberName )
{ {
@ -55,6 +61,11 @@ namespace Rokojori
return GetAnimator( material, propertyName.propertyName ); return GetAnimator( material, propertyName.propertyName );
} }
public static bool IsAnimating( Animator animator, GodotObject go, string memberName, object obj )
{
return GetAnimator( go, memberName, obj ) == animator;
}
public static bool IsAnimating( Animator animator, GodotObject go, string memberName ) public static bool IsAnimating( Animator animator, GodotObject go, string memberName )
{ {
return GetAnimator( go, memberName ) == animator; return GetAnimator( go, memberName ) == animator;
@ -103,6 +114,18 @@ namespace Rokojori
_animatingObjects.Set( go, member, animator ); _animatingObjects.Set( go, member, animator );
} }
public static void StartAnimation( Animator animator, GodotObject go, string member, object obj )
{
var activeAnimator = GetAnimator( go, member, obj );
if ( activeAnimator != null )
{
activeAnimator.OnAnimatorCancel();
}
_animatingReferences.Set( go, member, obj, animator );
}
public static void StartAnimation( Animator animator, Node node, AnimationMember member ) public static void StartAnimation( Animator animator, Node node, AnimationMember member )
{ {
var activeAnimator = GetAnimator( node, member.name ); var activeAnimator = GetAnimator( node, member.name );
@ -142,9 +165,20 @@ namespace Rokojori
{ {
StartAnimation( animator, nodes[ i ], members ); StartAnimation( animator, nodes[ i ], members );
} }
} }
public static void EndAnimation( Animator animator, GodotObject go, string member )
public static void EndAnimation( Animator animator, GodotObject go, string member, object obj )
{
var activeAnimator = GetAnimator( go, member, obj );
if ( activeAnimator != null )
{
activeAnimator.OnAnimatorCancel();
}
}
public static void EndAnimation( Animator animator, GodotObject go, string member )
{ {
var activeAnimator = GetAnimator( go, member ); var activeAnimator = GetAnimator( go, member );

View File

@ -14,56 +14,58 @@ namespace Rokojori
[Export] [Export]
public FlashEffect flashEffect; public FlashEffect flashEffect;
Node3D[] _targets = []; // Node3D[] _targets = [];
[Export] [Export]
public Node3D[] targets public Node3D[] targets;
{ // {
get => _targets; // get => _targets;
set // set
{ // {
_targets = value; // _targets = value;
_allTargets = null; // _allTargets = null;
} // }
} // }
[Export] [Export]
public bool includeChildren = false; public bool includeChildren = false;
bool refresh = false; bool refresh = false;
Node3D[] _allTargets; // Node3D[] _allTargets;
public Node3D[] allTargets // public Node3D[] allTargets
{ // {
get // get
{ // {
if ( _allTargets != null ) // if ( _allTargets != null )
{ // {
return _allTargets; // return _allTargets;
} // }
if ( includeChildren ) // if ( includeChildren )
{ // {
_allTargets = Nodes.GetAnyChildren( _targets ).ToArray(); // _allTargets = Nodes.GetAnyChildren( _targets ).ToArray();
} // }
else // else
{ // {
_allTargets = _targets; // _allTargets = _targets;
} // }
_allTargets = Lists.Filter( Lists.From( allTargets ), t => t as GeometryInstance3D != null ).ToArray(); // _allTargets = Lists.Filter( Lists.From( allTargets ), t => t as GeometryInstance3D != null ).ToArray();
return _allTargets; // return _allTargets;
} // }
} // }
int animationID = -1;
int actionID = -1;
Vector3 randomization;
List<Material> _materials;
OmniLight3D light = null; // int animationID = -1;
// int actionID = -1;
// Vector3 randomization;
// List<Material> _materials;
// OmniLight3D light = null;
// [Export] // [Export]
// public Node3D debugProcessIndicator; // public Node3D debugProcessIndicator;
@ -112,6 +114,26 @@ namespace Rokojori
return color; return color;
} }
List<Node3D> GetAllTargets()
{
var allTargets = new List<Node3D>();
if ( includeChildren )
{
allTargets = Nodes.GetAnyChildren( targets );
}
else
{
allTargets.AddRange( targets );
}
allTargets = Lists.Filter( Lists.From( allTargets ), t => t as GeometryInstance3D != null );
return allTargets;
}
int actionID = -1;
protected override void _OnTrigger() protected override void _OnTrigger()
{ {
if ( actionID != -1 ) if ( actionID != -1 )
@ -122,16 +144,30 @@ namespace Rokojori
actionID = DispatchStart(); actionID = DispatchStart();
var currentTargets = GetAllTargets();
if ( currentTargets.Count == 0 )
{
DispatchEnd( actionID );
return;
}
var runner = new FlashRunnerData();
runner.targets = currentTargets;
_runnerData[ actionID ] = runner;
var random = LCG.WithSeed( networkSeed ); var random = LCG.WithSeed( networkSeed );
// RJLog.Log( "Setting actionID id", actionID, GetLastSequenceActionID() ); // RJLog.Log( "Setting actionID id", actionID, GetLastSequenceActionID() );
var flashCurve = flashEffect.flashCurve; var flashCurve = flashEffect.flashCurve;
var color = flashEffect.color.GetHDRColor(); var color = flashEffect.color.GetHDRColor();
var timeline = flashEffect.timeline; var timeline = TimeLineManager.Ensure( flashEffect.timeline );
randomization = flashCurve.Randomize( random ); runner.randomization = flashCurve.Randomize( random );
var duration = flashCurve.GetRandomizedDuration( randomization ); var duration = flashCurve.GetRandomizedDuration( runner.randomization );
var transparentColor = color; var transparentColor = color;
@ -141,10 +177,18 @@ namespace Rokojori
Material material = null; Material material = null;
this.LogInfo( "Applying Targets:", currentTargets );
OmniLight3D light;
if ( FlashEffect.FlashLightMode.No_Light != flashEffect.lightMode ) if ( FlashEffect.FlashLightMode.No_Light != flashEffect.lightMode )
{ {
light = allTargets[ 0 ].CreateChild<OmniLight3D>(); runner.light = currentTargets[ 0 ].CreateChild<OmniLight3D>();
light = runner.light;
light.LightColor = ComputeLightColor( color, 0 ); light.LightColor = ComputeLightColor( color, 0 );
light.LightEnergy = 0; light.LightEnergy = 0;
light.OmniRange = flashEffect.lightRange; light.OmniRange = flashEffect.lightRange;
@ -194,19 +238,14 @@ namespace Rokojori
_materials = new List<Material>(); runner.materials = new List<Material>();
if ( Engine.IsEditorHint() ) currentTargets.ForEach(
{
_allTargets = null;
}
Arrays.ForEach( allTargets,
t => t =>
{ {
var m = (Material) material.Duplicate( true ); var m = (Material) material.Duplicate( true );
_materials.Add( m ); runner.materials.Add( m );
Materials.AddOverlay( t, m ); Materials.AddOverlay( t, m );
@ -218,13 +257,13 @@ namespace Rokojori
animationID = TimeLineManager.ScheduleSpanIn( timeline, 0, duration, runner.animationID = TimeLineManager.ScheduleSpanIn( timeline, 0, duration,
( TimeLineSpan span, TimeLineSpanUpdateType type )=> ( TimeLineSpan span, TimeLineSpanUpdateType type )=>
{ {
// debugProcessIndicator.Position = debugProcessIndicatorFull * span.phase; // debugProcessIndicator.Position = debugProcessIndicatorFull * span.phase;
if ( animationID != span.id ) if ( runner.animationID != span.id )
{ {
return; return;
} }
@ -234,21 +273,25 @@ namespace Rokojori
var phase = span.phase; var phase = span.phase;
var value = flashCurve.Sample( phase ); var value = flashCurve.Sample( span.elapsed );
var phaseColor = color; var phaseColor = color;
phaseColor.A = value * initialAlpha; phaseColor.A = value * initialAlpha;
this.LogInfo( phase, value );
// debugMaterial.AlbedoColor = phaseColor; // debugMaterial.AlbedoColor = phaseColor;
if ( light != null ) if ( runner.light != null )
{ {
light.LightEnergy = value * flashEffect.lightFlashCurveScale; runner.light.LightEnergy = value * flashEffect.lightFlashCurveScale;
light.LightColor = ComputeLightColor( color, phase ); runner.light.LightColor = ComputeLightColor( color, phase );
} }
_materials.ForEach( runner.materials.ForEach(
( m )=> ( m )=>
{ {
if ( FlashEffect.MaterialMode.Flat_Standard3D == flashEffect.materialMode ) if ( FlashEffect.MaterialMode.Flat_Standard3D == flashEffect.materialMode )
@ -265,7 +308,7 @@ namespace Rokojori
{ {
var sm = m as ScanGradientMaterial; var sm = m as ScanGradientMaterial;
sm.albedo.Set( phaseColor ); sm.albedo.Set( phaseColor );
sm.offset.Set( phase * 3 ); sm.offset.Set( phase );
} }
else if ( FlashEffect.MaterialMode.Shield_TriPlanarOverlay == flashEffect.materialMode ) else if ( FlashEffect.MaterialMode.Shield_TriPlanarOverlay == flashEffect.materialMode )
{ {
@ -284,10 +327,10 @@ namespace Rokojori
if ( type == TimeLineSpanUpdateType.End ) if ( type == TimeLineSpanUpdateType.End )
{ {
if ( light != null ) if ( runner.light != null )
{ {
light.LightEnergy = 0; runner.light.LightEnergy = 0;
light.LightColor = new Color( 0, 0, 0, 0 ); runner.light.LightColor = new Color( 0, 0, 0, 0 );
} }
CancelAction( actionID ); CancelAction( actionID );
@ -300,42 +343,52 @@ namespace Rokojori
).id; ).id;
} }
Dictionary<int,FlashRunnerData> _runnerData = new Dictionary<int, FlashRunnerData>();
public override void CancelAction( int id ) public override void CancelAction( int id )
{ {
if ( ! _runnerData.ContainsKey( id ))
{
return;
}
var data = _runnerData[ id ];
var light = data.light;
var nodes = data.targets;
var materials = data.materials;
if ( light != null ) if ( light != null )
{ {
// RJLog.Log( "Removing Light", light.Name ); // RJLog.Log( "Removing Light", light.Name );
Nodes.RemoveAndDelete( light ); Nodes.RemoveAndDelete( light );
light = null;
} }
RemoveMaterials( nodes, materials );
RemoveMaterials(); _runnerData.Remove( id );
} }
void RemoveMaterials() void RemoveMaterials( List<Node3D> allTargets, List<Material> materials )
{ {
if ( _materials == null || allTargets == null || _materials.Count != allTargets.Length )
{
return;
}
for ( int i = 0; i < allTargets.Length; i++ ) for ( int i = 0; i < allTargets.Count ; i++ )
{ {
Materials.RemoveOverlay( allTargets[ i ], _materials[ i ] ); Materials.RemoveOverlay( allTargets[ i ], materials[ i ] );
} }
_materials.Clear(); // _materials.Clear();
} }
public class FlashRunnerData
} {
public List<Node3D> targets;
public List<Material> materials;
public OmniLight3D light;
public int animationID;
public int actionID;
public Vector3 randomization;
}
}
} }

View File

@ -26,5 +26,4 @@ color = SubResource("Resource_54hj8")
lightMode = 1 lightMode = 1
lightRange = 5.0 lightRange = 5.0
lightFlashCurveScale = 5.0 lightFlashCurveScale = 5.0
lightHasShadows = true
materialMode = 3 materialMode = 3

View File

@ -8,7 +8,7 @@
[sub_resource type="Resource" id="Resource_54hj8"] [sub_resource type="Resource" id="Resource_54hj8"]
script = ExtResource("1_nmdum") script = ExtResource("1_nmdum")
color = Color(0.86, 0.12426996, 0.1118, 0.5254902) color = Color(0.86, 0.12426996, 0.1118, 0.5254902)
colorMultiply = 3.0 rgbMultiply = 3.0
[sub_resource type="Curve" id="Curve_tp3r5"] [sub_resource type="Curve" id="Curve_tp3r5"]
_data = [Vector2(0, 1), 0.0, -1.0, 0, 1, Vector2(1, 0), -1.0, 0.0, 1, 0] _data = [Vector2(0, 1), 0.0, -1.0, 0, 1, Vector2(1, 0), -1.0, 0.0, 1, 0]

View File

@ -173,8 +173,11 @@ namespace Rokojori
combined.position = Smoother.SmoothTimeVariant( current.position, combined.position, delta, smoothStrength ); combined.position = Smoother.SmoothTimeVariant( current.position, combined.position, delta, smoothStrength );
combined.rotation = Smoother.SmoothTimeVariant( current.rotation, combined.rotation, delta, smoothStrength ); combined.rotation = Smoother.SmoothTimeVariant( current.rotation, combined.rotation, delta, smoothStrength );
combined.scale = Smoother.SmoothTimeVariant( current.scale, combined.scale, delta, smoothStrength ); combined.scale = Smoother.SmoothTimeVariant( current.scale, combined.scale, delta, smoothStrength );
} }
// this.LogInfo( combined.rotation );
combined.Set( targets[ i ], shakeEffect.globalPosition, shakeEffect.globalRotation ); combined.Set( targets[ i ], shakeEffect.globalPosition, shakeEffect.globalRotation );
} }

View File

@ -45,7 +45,7 @@ namespace Rokojori
_randomizations.Add( curve.Randomize() ); _randomizations.Add( curve.Randomize() );
} }
var timeline = animations.timeline; var timeline = TimeLineManager.Ensure( animations.timeline );
var duration = animations.GetMaxDuration( _randomizations ); var duration = animations.GetMaxDuration( _randomizations );
var start = timeline.position; var start = timeline.position;

View File

@ -37,6 +37,11 @@ namespace Rokojori
var animatedValue = Sample( time, randomization ); var animatedValue = Sample( time, randomization );
animatedValue = ApplyOperator( animatedValue, originalValue ); animatedValue = ApplyOperator( animatedValue, originalValue );
if ( transformTarget == TransformTarget.Global_Rotation || transformTarget == TransformTarget.Local_Rotation )
{
animatedValue = MathX.DegreesToRadians * animatedValue;
}
TransformTargets.Set( animatedValue, node, transformTarget ); TransformTargets.Set( animatedValue, node, transformTarget );
} }

View File

@ -91,7 +91,7 @@ namespace Rokojori
else if ( TransformTarget.Global_Rotation == transformTarget ) else if ( TransformTarget.Global_Rotation == transformTarget )
{ {
var rotation = target.GlobalRotation; var rotation = target.GlobalRotation;
target.GlobalRotation = value * MathX.DegreesToRadians; target.GlobalRotation = value;// * MathX.DegreesToRadians;
// RJLog.Log( "GlobalRotation = ", rotation, ">>", value, target.GlobalRotation ); // RJLog.Log( "GlobalRotation = ", rotation, ">>", value, target.GlobalRotation );
} }
else if ( TransformTarget.Local_Position == transformTarget ) else if ( TransformTarget.Local_Position == transformTarget )
@ -101,7 +101,7 @@ namespace Rokojori
else if ( TransformTarget.Local_Rotation == transformTarget ) else if ( TransformTarget.Local_Rotation == transformTarget )
{ {
var rotation = target.Rotation; var rotation = target.Rotation;
target.Rotation = value * MathX.DegreesToRadians; target.Rotation = value;// * MathX.DegreesToRadians;
// RJLog.Log( "Rotation = ", rotation, ">>", value, target.Rotation ); // RJLog.Log( "Rotation = ", rotation, ">>", value, target.Rotation );
} }
else if ( TransformTarget.Local_Scale == transformTarget ) else if ( TransformTarget.Local_Scale == transformTarget )

View File

@ -5,11 +5,19 @@ namespace Rokojori
{ {
public static class ColorX public static class ColorX
{ {
public static Color WithIntensity( this Color c, float intensity )
{
var intensified = c.SrgbToLinear();
intensified *= Mathf.Pow( 2f, intensity );
return intensified.LinearToSRGB();
}
public static float GetColorScale( this Color c ) public static float GetColorScale( this Color c )
{ {
return Mathf.Max( 1f, Mathf.Max( c.R, Mathf.Max( c.G, c.B ) ) ); return Mathf.Max( 1f, Mathf.Max( c.R, Mathf.Max( c.G, c.B ) ) );
} }
public static Color ScaleColor( this Color c, float scale ) public static Color ScaleColor( this Color c, float scale )
{ {
return new Color( c.R * scale, c.G * scale, c.B * scale, c.A ); return new Color( c.R * scale, c.G * scale, c.B * scale, c.A );

View File

@ -208,7 +208,20 @@ namespace Rokojori
float distanceToBlue = Mathf.Min( 1.0f, Mathf.Abs( hue - 240.0f ) / blendRadius ); float distanceToBlue = Mathf.Min( 1.0f, Mathf.Abs( hue - 240.0f ) / blendRadius );
return changeHue360( hue, offset * distanceToYellow * distanceToBlue ); return changeHue360( hue, offset * distanceToYellow * distanceToBlue );
}
public HSLColor ShiftTemperature( float temperature, float saturation, float lightness, float blendRadius = 60 )
{
var color = new HSLColor(
ShiftTemparatureOfHue( this.h, temperature, blendRadius ),
s + saturation,
l + lightness
);
color.ClampToLimits();
return color;
} }
public static Color Lerp( Color x, Color y, float t ) public static Color Lerp( Color x, Color y, float t )

View File

@ -20,10 +20,23 @@ namespace Rokojori
public bool hasListeners => _once.Count > 0 || _actions.Count > 0; public bool hasListeners => _once.Count > 0 || _actions.Count > 0;
public void ResetAndClearAll()
{
_actions.Clear();
_once.Clear();
_additions.Clear();
_onceAdditions.Clear();
_removals.Clear();
_canModify = true;
}
public void AddAction( Action<T> action ) public void AddAction( Action<T> action )
{ {
if ( _actions.IndexOf( action ) != - 1 || _additions.IndexOf( action ) != -1 ) if ( HasAction( action ) )
{ {
RJLog.Error( this, "This action already exists", action );
return; return;
} }
@ -42,7 +55,9 @@ namespace Rokojori
{ {
if ( _canModify ) if ( _canModify )
{ {
_actions.Remove( action ); var removed = _actions.Remove( action );
// RJLog.Log( "Removed:", action, removed );
} }
else else
{ {
@ -50,8 +65,19 @@ namespace Rokojori
} }
} }
public bool HasAction( Action<T> action )
{
return _actions.Has( action ) || _additions.Has( action ) || _onceAdditions.Has( action );
}
public void Once( Action<T> action ) public void Once( Action<T> action )
{ {
if ( HasAction( action ) )
{
RJLog.Error( this, "This action already exists", action );
return;
}
if ( _canModify ) if ( _canModify )
{ {
_actions.Add( action ); _actions.Add( action );
@ -60,9 +86,7 @@ namespace Rokojori
else else
{ {
_onceAdditions.Add( action ); _onceAdditions.Add( action );
} }
} }
protected void _UpdateLists() protected void _UpdateLists()
@ -73,6 +97,15 @@ namespace Rokojori
if ( _removals.Count > 0 ) if ( _removals.Count > 0 )
{ {
Lists.RemoveRange( _actions, _removals ); Lists.RemoveRange( _actions, _removals );
// _removals.ForEach(
// r =>
// {
// var removed = _actions.Remove( r );
// RJLog.Log( "Removed:", r, removed );
// }
// );
_removals.Clear(); _removals.Clear();
} }

View File

@ -0,0 +1,51 @@
using System.Collections.Generic;
using Godot;
namespace Rokojori
{
public static class GradientExtensions
{
public enum GradientRepeatMode
{
Clamp,
Repeat,
MirrorRepeat
}
public static Gradient Create( IEnumerable<Color> colors )
{
var g = new Gradient();
g.Colors = Lists.FromAny( colors ).ToArray();
var offsets = new List<float>();
for ( int i = 0; i < g.Colors.Length; i++ )
{
offsets.Add( i / (float) ( g.Colors.Length - 1f ) );
}
g.Offsets = offsets.ToArray();
return g;
}
public static Color SampleRepeated( this Gradient gradient, float t, GradientRepeatMode repeatMode )
{
var repeatedT = t;
if ( GradientRepeatMode.Repeat == repeatMode )
{
repeatedT = MathX.Repeat( t, 1f );
}
else if ( GradientRepeatMode.MirrorRepeat == repeatMode )
{
repeatedT = MathX.Repeat( t, 2f );
if ( repeatedT > 1f )
{
repeatedT = 2f - 1f;
}
}
return gradient.Sample( repeatedT );
}
}
}

View File

@ -0,0 +1 @@
uid://cajsf1ang6ls2

View File

@ -7,6 +7,26 @@ namespace Rokojori
{ {
public static class Node3DExtensions public static class Node3DExtensions
{ {
public static Vector3 GetCenter( IEnumerable<Node3D> node3D)
{
var center = Vector3.Zero;
var num = 0;
foreach ( var n in node3D )
{
center += n.GlobalPosition;
}
if ( num == 0 )
{
return center;
}
center /= num;
return center;
}
public static Vector3? GetBoundsCenter( this Node3D self, bool onlyVisisble = true ) public static Vector3? GetBoundsCenter( this Node3D self, bool onlyVisisble = true )
{ {
var optionalBounds = self.GetWorldBounds(); var optionalBounds = self.GetWorldBounds();

View File

@ -193,6 +193,7 @@ namespace Rokojori
return list; return list;
} }
public static List<T> GetAll<T>( this Node root, Func<T,bool> filter = null, bool includeRoot = true) where T:class public static List<T> GetAll<T>( this Node root, Func<T,bool> filter = null, bool includeRoot = true) where T:class
{ {
var list = new List<T>(); var list = new List<T>();

View File

@ -20,12 +20,12 @@ member = "amount"
curve = SubResource("Curve_btbfg") curve = SubResource("Curve_btbfg")
metadata/_custom_type_script = "uid://dvvfvlutisecy" metadata/_custom_type_script = "uid://dvvfvlutisecy"
[sub_resource type="Resource" id="Resource_ie6m2"] [sub_resource type="Resource" id="Resource_4xviq"]
script = ExtResource("1_0ail8") script = ExtResource("1_0ail8")
[sub_resource type="Resource" id="Resource_p64cs"] [sub_resource type="Resource" id="Resource_p64cs"]
script = ExtResource("2_tc21q") script = ExtResource("2_tc21q")
owner = SubResource("Resource_ie6m2") owner = SubResource("Resource_4xviq")
layer = ExtResource("2_4xviq") layer = ExtResource("2_4xviq")
[sub_resource type="Curve" id="Curve_7axlu"] [sub_resource type="Curve" id="Curve_7axlu"]
@ -58,7 +58,6 @@ effect_callback_type = 4
needs_motion_vectors = false needs_motion_vectors = false
needs_normal_roughness = false needs_normal_roughness = false
script = ExtResource("3_dryyw") script = ExtResource("3_dryyw")
amount = 0.0
outlineWidth = -0.0516 outlineWidth = -0.0516
outlineWidthCurve = SubResource("CurveTexture_p64cs") outlineWidthCurve = SubResource("CurveTexture_p64cs")
edgeColor = Color(0.14817011, 0.21073082, 0.29634023, 1) edgeColor = Color(0.14817011, 0.21073082, 0.29634023, 1)
@ -91,7 +90,7 @@ metadata/_custom_type_script = "uid://dvvfvlutisecy"
[sub_resource type="Resource" id="Resource_hpfyh"] [sub_resource type="Resource" id="Resource_hpfyh"]
script = ExtResource("2_tc21q") script = ExtResource("2_tc21q")
owner = SubResource("Resource_ie6m2") owner = SubResource("Resource_4xviq")
layer = ExtResource("2_4xviq") layer = ExtResource("2_4xviq")
[sub_resource type="Gradient" id="Gradient_frwbc"] [sub_resource type="Gradient" id="Gradient_frwbc"]
@ -110,7 +109,6 @@ needs_motion_vectors = false
needs_normal_roughness = false needs_normal_roughness = false
script = ExtResource("6_hdnet") script = ExtResource("6_hdnet")
distortionAmount = 0.0049 distortionAmount = 0.0049
blendAmount = 0.0
smearingSteps = 1 smearingSteps = 1
smearing = 1.0 smearing = 1.0
redShift = 0.0 redShift = 0.0
@ -136,7 +134,7 @@ metadata/_custom_type_script = "uid://dvvfvlutisecy"
[sub_resource type="Resource" id="Resource_gxlxg"] [sub_resource type="Resource" id="Resource_gxlxg"]
script = ExtResource("2_tc21q") script = ExtResource("2_tc21q")
owner = SubResource("Resource_ie6m2") owner = SubResource("Resource_4xviq")
layer = ExtResource("2_4xviq") layer = ExtResource("2_4xviq")
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_4n83u"] [sub_resource type="CompressedTexture2D" id="CompressedTexture2D_4n83u"]
@ -158,7 +156,6 @@ needs_motion_vectors = false
needs_normal_roughness = false needs_normal_roughness = false
script = ExtResource("6_hdnet") script = ExtResource("6_hdnet")
distortionAmount = 0.0026 distortionAmount = 0.0026
blendAmount = 0.0
smearingSteps = 1 smearingSteps = 1
smearing = 1.0 smearing = 1.0
redShift = 0.0 redShift = 0.0
@ -174,7 +171,7 @@ metadata/_custom_type_script = "uid://balixgskgouhm"
[sub_resource type="Resource" id="Resource_3tnad"] [sub_resource type="Resource" id="Resource_3tnad"]
script = ExtResource("2_tc21q") script = ExtResource("2_tc21q")
owner = SubResource("Resource_ie6m2") owner = SubResource("Resource_4xviq")
layer = ExtResource("2_4xviq") layer = ExtResource("2_4xviq")
[sub_resource type="CompositorEffect" id="CompositorEffect_hdnet"] [sub_resource type="CompositorEffect" id="CompositorEffect_hdnet"]

View File

@ -3,7 +3,7 @@
float timeSine( float _TIME, float duration ) float timeSine( float _TIME, float duration )
{ {
float t = TIME / duration * 2.0 * PI; float t = _TIME / duration * 2.0 * PI;
return sin( t ); return sin( t );
} }

View File

@ -220,6 +220,11 @@ namespace Rokojori
} }
public static void AddToNextPass( Material material, Material nextPassMaterial )
{
GetLastMaterial( material ).NextPass = nextPassMaterial;
}
public static void RemoveOverlay( Node node, Material material, bool forceTop = true ) public static void RemoveOverlay( Node node, Material material, bool forceTop = true )
{ {
if ( node is GeometryInstance3D gi ) if ( node is GeometryInstance3D gi )

View File

@ -0,0 +1,36 @@
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Light.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc"
uniform vec4 albedo : source_color;
uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable;
uniform float grow : hint_range(-16.0, 16.0, 0.001);
uniform float fresnelSharpness = 2;
uniform float fresnelMultiply = 1;
uniform float fresnelOffset = 0;
uniform bool clampAlpha = false;
void vertex()
{
VERTEX += NORMAL * grow;
}
void fragment()
{
vec2 uv = UV;
float fresnelAmount = fresnel( NORMAL, VIEW, fresnelSharpness) * fresnelMultiply + fresnelOffset;
fresnelAmount = clamp( fresnelAmount, 0.0, 1.0 );
vec4 albedo_tex = texture( texture_albedo, uv );
ALBEDO = albedo.rgb * albedo_tex.rgb;
ALPHA *= albedo.a * albedo_tex.a * fresnelAmount;
if ( clampAlpha )
{
ALPHA = clamp( ALPHA, 0.0, 1.0 );
}
}

View File

@ -0,0 +1 @@
uid://dm8v3hgd0ac0c

View File

@ -1,31 +1,5 @@
// NOTE: Shader automatically converted from Godot Engine 4.3.rc.mono's StandardMaterial3D.
shader_type spatial; shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded, shadows_disabled; render_mode blend_mix, depth_draw_opaque, cull_back, unshaded, shadows_disabled;
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Light.gdshaderinc" #include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc"
uniform vec4 albedo : source_color;
uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable;
uniform float grow : hint_range(-16.0, 16.0, 0.001);
uniform float fresnelSharpness = 2;
uniform float fresnelMultiply = 1;
uniform float fresnelOffset = 0;
void vertex()
{
VERTEX += NORMAL * grow;
}
void fragment()
{
vec2 uv = UV;
float fresnelAmount = fresnel( NORMAL, VIEW, fresnelSharpness) * fresnelMultiply + fresnelOffset;
fresnelAmount = clamp( fresnelAmount, 0.0, 1.0 );
vec4 albedo_tex = texture( texture_albedo, uv );
ALBEDO = albedo.rgb * albedo_tex.rgb;
ALPHA *= albedo.a * albedo_tex.a * fresnelAmount;
}

View File

@ -0,0 +1,4 @@
shader_type spatial;
render_mode blend_add, depth_draw_opaque, cull_back, unshaded, shadows_disabled;
#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc"

View File

@ -0,0 +1 @@
uid://c8wibq5djliwr

View File

@ -2,7 +2,6 @@ using Godot;
namespace Rokojori namespace Rokojori
{ {
// Generated by ShaderClassGenerator
public class FresnelOverlayShader public class FresnelOverlayShader
{ {
@ -10,6 +9,22 @@ namespace Rokojori
"res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlay.gdshader" "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlay.gdshader"
); );
public static readonly CachedResource<Shader> addShader = new CachedResource<Shader>(
"res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayAdd.gdshader"
);
public static readonly CachedResource<Shader> subtractShader = new CachedResource<Shader>(
"res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlaySubtract.gdshader"
);
public static readonly CachedResource<Shader> multiplyShader = new CachedResource<Shader>(
"res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayMultiply.gdshader"
);
public static readonly CachedResource<Shader> preMultiplyShader = new CachedResource<Shader>(
"res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresnelOverlayPreMultiply.gdshader"
);
public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" ); public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" );
public static readonly FloatPropertyName grow = FloatPropertyName.Create( "grow" ); public static readonly FloatPropertyName grow = FloatPropertyName.Create( "grow" );
public static readonly FloatPropertyName fresnelSharpness = FloatPropertyName.Create( "fresnelSharpness" ); public static readonly FloatPropertyName fresnelSharpness = FloatPropertyName.Create( "fresnelSharpness" );
@ -17,6 +32,39 @@ namespace Rokojori
public static readonly FloatPropertyName fresnelOffset = FloatPropertyName.Create( "fresnelOffset" ); public static readonly FloatPropertyName fresnelOffset = FloatPropertyName.Create( "fresnelOffset" );
public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" ); public static readonly Sampler2DPropertyName textureAlbedo = Sampler2DPropertyName.Create( "texture_albedo" );
public static readonly BoolPropertyName clampAlpha = BoolPropertyName.Create( "clampAlpha" );
public static Shader GetShaderWithBlendMode( BaseMaterial3D.BlendModeEnum blendMode )
{
if ( BaseMaterial3D.BlendModeEnum.Mix == blendMode )
{
return shader.Get();
}
if ( BaseMaterial3D.BlendModeEnum.Add == blendMode )
{
return addShader.Get();
}
if ( BaseMaterial3D.BlendModeEnum.Mul == blendMode )
{
return multiplyShader.Get();
}
if ( BaseMaterial3D.BlendModeEnum.Sub == blendMode )
{
return subtractShader.Get();
}
if ( BaseMaterial3D.BlendModeEnum.PremultAlpha == blendMode )
{
return preMultiplyShader.Get();
}
return null;
}
} }
[Tool] [Tool]
@ -30,17 +78,22 @@ namespace Rokojori
public readonly CustomMaterialProperty<float> fresnelMultiply; public readonly CustomMaterialProperty<float> fresnelMultiply;
public readonly CustomMaterialProperty<float> fresnelOffset; public readonly CustomMaterialProperty<float> fresnelOffset;
public readonly CustomMaterialProperty<Texture2D> textureAlbedo; public readonly CustomMaterialProperty<Texture2D> textureAlbedo;
public readonly CustomMaterialProperty<bool> clampAlpha;
public FresnelOverlayMaterial() public FresnelOverlayMaterial()
{ {
Shader = FresnelOverlayShader.shader.Get(); Shader = FresnelOverlayShader.shader.Get();
albedo = new CustomMaterialProperty<Color>( this, FresnelOverlayShader.albedo ); albedo = new CustomMaterialProperty<Color>( this, FresnelOverlayShader.albedo );
grow = new CustomMaterialProperty<float>( this, FresnelOverlayShader.grow ); grow = new CustomMaterialProperty<float>( this, FresnelOverlayShader.grow );
fresnelSharpness = new CustomMaterialProperty<float>( this, FresnelOverlayShader.fresnelSharpness ); fresnelSharpness = new CustomMaterialProperty<float>( this, FresnelOverlayShader.fresnelSharpness );
fresnelMultiply = new CustomMaterialProperty<float>( this, FresnelOverlayShader.fresnelMultiply ); fresnelMultiply = new CustomMaterialProperty<float>( this, FresnelOverlayShader.fresnelMultiply );
fresnelOffset = new CustomMaterialProperty<float>( this, FresnelOverlayShader.fresnelOffset ); fresnelOffset = new CustomMaterialProperty<float>( this, FresnelOverlayShader.fresnelOffset );
textureAlbedo = new CustomMaterialProperty<Texture2D>( this, FresnelOverlayShader.textureAlbedo ); textureAlbedo = new CustomMaterialProperty<Texture2D>( this, FresnelOverlayShader.textureAlbedo );
clampAlpha = new CustomMaterialProperty<bool>( this, FresnelOverlayShader.clampAlpha );
} }
} }

View File

@ -0,0 +1,4 @@
shader_type spatial;
render_mode blend_mul, depth_draw_opaque, cull_back, unshaded, shadows_disabled;
#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc"

View File

@ -0,0 +1 @@
uid://bedxovddacc5w

View File

@ -0,0 +1,4 @@
shader_type spatial;
render_mode blend_premul_alpha, depth_draw_opaque, cull_back, unshaded, shadows_disabled;
#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc"

View File

@ -0,0 +1 @@
uid://cg21q1crfjmwu

View File

@ -0,0 +1,4 @@
shader_type spatial;
render_mode blend_sub, depth_draw_opaque, cull_back, unshaded, shadows_disabled;
#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/FresnelOverlay/FresneOverlayBase.gdshaderinc"

View File

@ -0,0 +1 @@
uid://dcje2exdw01o7

View File

@ -0,0 +1,4 @@
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded, shadows_disabled;
#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc"

View File

@ -0,0 +1 @@
uid://bvu272trv53hw

View File

@ -0,0 +1,4 @@
shader_type spatial;
render_mode blend_add, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded, shadows_disabled;
#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/Impact/ImpactBase.gdshaderinc"

View File

@ -0,0 +1 @@
uid://c5714xo0bl3cw

View File

@ -0,0 +1,66 @@
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Light.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Time.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Noise.gdshaderinc"
uniform vec4 albedo : source_color;
uniform float driver:hint_range(0,1) = 0;
group_uniforms Impact;
uniform vec3 impactPositionWorld;
uniform sampler2D impactRadiusTexture : source_color, filter_linear_mipmap, repeat_disable;
uniform sampler2D impactRangeTexture : source_color, filter_linear_mipmap, repeat_disable;
uniform sampler2D impactTexture : source_color, filter_linear_mipmap, repeat_enable;
group_uniforms;
group_uniforms Noise;
uniform float noiseAmount: hint_range(0, 1) = 0.5;
uniform float noiseScale: hint_range(0, 100) = 1;
uniform vec3 noiseScroll = vec3( 1, 1, 1 );
uniform vec2 noiseDriverScale = vec2( 1.0, 1.0 );
group_uniforms;
group_uniforms Noise2;
uniform float noiseAmount2: hint_range(0, 1) = 0.5;
uniform float noiseScale2: hint_range(0, 100) = 1;
uniform vec3 noiseScroll2 = vec3( 1, 1, 1 );
uniform vec2 noiseDriverScale2 = vec2( 1.0, 1.0 );
group_uniforms;
void fragment()
{
vec2 uv = UV;
vec3 worldVertex = viewToWorld( VERTEX, INV_VIEW_MATRIX );
vec3 relativeWorldVertex = worldVertex - NODE_POSITION_WORLD;
float currentRadius = textureLod( impactRadiusTexture, vec2( driver, 0.0 ), 0 ).r;
float impactRange = textureLod( impactRangeTexture, vec2( driver, 0.0 ), 0 ).r;
vec3 scanDir = worldVertex - impactPositionWorld;
vec3 normalizedScanDir = normalize( scanDir );
float d = max( 0.0, length( scanDir ) - currentRadius );
d /= impactRange;
d = clamp01( d );
vec4 impactColor = texture( impactTexture, vec2( d, 0.0 ) );
float driverScale = mix( noiseDriverScale.x, noiseDriverScale.y, driver );
float driverScale2 = mix( noiseDriverScale2.x, noiseDriverScale2.y, driver );
float noise = perlin3D( relativeWorldVertex * noiseScale * driverScale + noiseScroll * TIME );
noise = mix( 1, noise, noiseAmount );
float noise2 = perlin3D( relativeWorldVertex * noiseScale2 * driverScale2 + noiseScroll2 * TIME );
noise2 = mix( 1, noise2, noiseAmount2 );
ALBEDO = albedo.rgb * impactColor.rgb;
ALPHA = clamp01( albedo.a * impactColor.a * noise * noise2 );
}

View File

@ -0,0 +1 @@
uid://b1w62csgf0ijn

View File

@ -13,12 +13,15 @@ uniform vec4 albedo : source_color;
uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable; uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable;
uniform float grow : hint_range(-16.0, 16.0, 0.001); uniform float grow : hint_range(-16.0, 16.0, 0.001);
uniform float offset:hint_range(0,1) = 0;
uniform sampler2D scanTexture : source_color, filter_linear_mipmap, repeat_enable; uniform sampler2D scanTexture : source_color, filter_linear_mipmap, repeat_enable;
uniform float range; uniform float rangeStart = 0.0;
uniform float offset; uniform float rangeEnd = 1.0;
uniform float rangeWobble = 0.1; uniform float rangeWobble = 0.1;
uniform float rangeWobbleDuration = 1; uniform float rangeWobbleDuration = 1;
uniform float offsetWobble = 0.1; uniform float offsetWobble = 0.1;
uniform float offsetWobbleDuration = 1; uniform float offsetWobbleDuration = 1;
@ -44,12 +47,18 @@ void fragment()
float rangeWobbleValue = timeSine( TIME, rangeWobbleDuration ); float rangeWobbleValue = timeSine( TIME, rangeWobbleDuration );
float offsetWobbleValue = timeSine( TIME, offsetWobbleDuration ); float offsetWobbleValue = timeSine( TIME, offsetWobbleDuration );
float animatedRange = range + rangeWobbleValue * rangeWobble; float currentRangeWobble = rangeWobbleValue * rangeWobble;
float animatedOffset = - ( offset + offsetWobbleValue * offsetWobble ); float currentOffsetWobble = offsetWobbleValue * offsetWobble;
vec4 albedo_tex = texture( texture_albedo, uv );
float scanUV = normalizeToRange01( localVertex.y, animatedOffset - animatedRange, animatedOffset + animatedRange ); float minRange = rangeStart - currentRangeWobble;
float maxRange = rangeEnd + currentRangeWobble;
float localYOffset = mix( minRange, maxRange, offset );
float scanUV = normalizeToRange01( localVertex.y + currentOffsetWobble + localYOffset, minRange, maxRange );
vec4 scanColor = texture( scanTexture, vec2( scanUV, 0 ) ); vec4 scanColor = texture( scanTexture, vec2( scanUV, 0 ) );
vec4 albedo_tex = texture( texture_albedo, uv );
float noise = perlin3D( localVertex * noiseScale + noiseOffset * TIME ); float noise = perlin3D( localVertex * noiseScale + noiseOffset * TIME );
noise = mix( 1, noise, noiseAmount ); noise = mix( 1, noise, noiseAmount );
ALBEDO = albedo.rgb * scanColor.rgb * rgbScale; ALBEDO = albedo.rgb * scanColor.rgb * rgbScale;

View File

@ -0,0 +1,4 @@
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, unshaded, shadows_disabled;
#include "res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/Scanner/ScannerBase.gdshaderinc"

View File

@ -0,0 +1 @@
uid://bdjl44rcb2la0

View File

@ -0,0 +1,83 @@
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Light.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Time.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Noise.gdshaderinc"
uniform vec4 albedo : source_color;
uniform float driver:hint_range(0,1) = 0;
group_uniforms Scanner;
uniform vec3 position;
uniform vec3 direction;
uniform float scannerSize;
uniform sampler2D scanTexture : source_color, filter_linear_mipmap, repeat_enable;
group_uniforms;
group_uniforms Noise;
uniform float noiseAmount: hint_range(0, 1) = 0.5;
uniform float noiseScale: hint_range(0.1, 100) = 1;
uniform vec3 noiseScroll = vec3( 1, 1, 1 );
uniform float noiseScrollFromScanDirection = 0;
group_uniforms;
group_uniforms Noise2;
uniform float noiseAmount2: hint_range(0, 1) = 0.5;
uniform float noiseScale2: hint_range(0.1, 100) = 1;
uniform vec3 noiseScroll2 = vec3( 1, 1, 1 );
uniform float noiseScrollFromScanDirection2 = 0;
group_uniforms;
float lineFactor( vec3 p, vec3 start, vec3 end )
{
vec3 dir = end - start;
float dotDir = dot( dir, dir );
if ( dotDir < 0.0000001 )
{
return 0.0;
}
float lineParameter = dot( p - start, dir ) / dotDir;
return clamp01( lineParameter );
}
void vertex()
{
// localVertex = VERTEX * ( MODEL_NORMAL_MATRIX );
}
void fragment()
{
vec2 uv = UV;
vec3 relativeWorldVertex = viewToWorld( VERTEX, INV_VIEW_MATRIX );
vec3 scanDir = ( direction );
vec3 normalizedScanDir = normalize( scanDir );
vec3 scanStart = position;
vec3 scanEnd = position + direction;
vec3 currentScanPosition = mix( scanStart, scanEnd, driver );
vec3 scannerDirection = normalizedScanDir * scannerSize * 0.5;
vec3 scanGradientBegin = currentScanPosition - scannerDirection;
vec3 scanGradientEnd = currentScanPosition + scannerDirection;
float d = lineFactor( relativeWorldVertex, scanGradientBegin, scanGradientEnd );
vec4 scanColor = texture( scanTexture, vec2( d, 0.0 ) );
float noise = perlin3D( relativeWorldVertex * noiseScale + ( noiseScroll + noiseScrollFromScanDirection * normalizedScanDir )* TIME );
noise = mix( 1, noise, noiseAmount );
float noise2 = perlin3D( relativeWorldVertex * noiseScale2 + ( noiseScroll2 + noiseScrollFromScanDirection2 * normalizedScanDir )* TIME );
noise2 = mix( 1, noise2, noiseAmount2 );
ALBEDO = albedo.rgb * scanColor.rgb;
ALPHA = clamp01( albedo.a * scanColor.a * noise * noise2 );
}

View File

@ -0,0 +1 @@
uid://but35f3ivfkmd

View File

@ -25,7 +25,7 @@ void vertex()
{ {
vec3 normal = NORMAL; vec3 normal = NORMAL;
uv_power_normal = pow( abs (NORMAL ), vec3( uv_blend_sharpness ) ); uv_power_normal = pow( abs (NORMAL), vec3( uv_blend_sharpness ) );
uv_power_normal /= dot( uv_power_normal, vec3( 1.0 ) ); uv_power_normal /= dot( uv_power_normal, vec3( 1.0 ) );
vec3 scaledVertex = VERTEX * extractScale( MODEL_NORMAL_MATRIX ); vec3 scaledVertex = VERTEX * extractScale( MODEL_NORMAL_MATRIX );
@ -37,7 +37,9 @@ void vertex()
void fragment() void fragment()
{ {
vec4 albedo_tex = triplanarTexture( texture_albedo, uv_power_normal, uv_triplanar_pos ); vec4 albedo_tex = triplanarTexture( texture_albedo, uv_power_normal, uv_triplanar_pos );
ALBEDO = albedo.rgb * albedo_tex.rgb; float alpha = albedo.a * albedo_tex.a;
ALPHA *= albedo.a * albedo_tex.a; float albedoAlphaBoost = max( 1.0, alpha );
ALBEDO = albedo.rgb * albedo_tex.rgb * albedoAlphaBoost;
ALPHA = clamp( alpha, 0.0, 1.0 );
} }

View File

@ -0,0 +1,71 @@
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
namespace Rokojori
{
public class MultiMap<K1,K2,K3,V>:Map<K1,Map<K2,Map<K3,V>>>
{
public bool Has( K1 key1, K2 key2, K3 key3 )
{
if ( ! ContainsKey( key1 ) )
{
return false;
}
if ( ! this[ key1 ].ContainsKey( key2 ) )
{
return false;
}
return this[ key1 ][ key2 ].ContainsKey( key3 );
}
public V Get( K1 key1, K2 key2, K3 key3 )
{
if ( key1 == null || key2 == null || key3 == null || ! Has( key1, key2, key3 ) )
{
return default(V);
}
return this[ key1 ][ key2 ][ key3 ];
}
public void Set( K1 key, K2 key2, K3 key3, V value )
{
if ( ! ContainsKey( key ) )
{
this[ key ] = new Map<K2,Map<K3,V>>();
this[ key ][ key2 ] = new Map<K3, V>();
}
this[ key ][ key2 ][ key3 ] = value;
}
public void Remove( K1 key, K2 key2, K3 key3, V value )
{
if ( ! Has( key, key2, key3 ) )
{
return;
}
this[ key ][ key2 ].Remove( key3 );
if ( this[ key ][ key2 ].Count == 0 )
{
this[ key ].Remove( key2 );
}
if ( this[ key ].Count == 0 )
{
Remove( key );
}
}
}
}

View File

@ -0,0 +1 @@
uid://dby1sjayw5vjm

View File

@ -13,7 +13,7 @@ namespace Rokojori
public partial class SecondsDuration:Duration public partial class SecondsDuration:Duration
{ {
[Export] [Export]
public float seconds; public float seconds = 1f;
public override float GetDurationInSeconds() public override float GetDurationInSeconds()
{ {

View File

@ -30,12 +30,12 @@ namespace Rokojori
public float duration => end - start; public float duration => end - start;
public float elapsed => timeLine.position - start ;
public float phase public float phase
{ {
get get
{ {
var position = timeLine.position; return Mathf.Clamp( elapsed / duration, 0, 1 );
return Mathf.Clamp( ( position - start ) / duration, 0, 1 );
} }
} }
} }

View File

@ -448,6 +448,18 @@ namespace Rokojori
return ToList( elements ); return ToList( elements );
} }
public static List<T> FromAny<T>( IEnumerable<T> elements )
{
var list = new List<T>();
foreach ( var e in elements )
{
list.Add( e );
}
return list;
}
public static List<T> FromLists<T>( params List<T>[] elements ) public static List<T> FromLists<T>( params List<T>[] elements )
{ {
var list = new List<T>(); var list = new List<T>();
@ -558,7 +570,7 @@ namespace Rokojori
return list; return list;
} }
public static bool Has<T>( List<T> list, T item ) public static bool Has<T>( this List<T> list, T item )
{ {
return list.IndexOf( item ) != - 1; return list.IndexOf( item ) != - 1;
} }

View File

@ -436,9 +436,8 @@ namespace Rokojori
return Lists.Map( infos, i => GetDataMemberValue<T>( instance, i ) ); return Lists.Map( infos, i => GetDataMemberValue<T>( instance, i ) );
} }
public static MemberInfo GetDataMemberInfo( object instance, string memberName, BindingFlags flags = BindingFlags.Public | BindingFlags.Instance ) public static MemberInfo GetDataMemberInfo( Type type, string memberName, BindingFlags flags = BindingFlags.Public | BindingFlags.Instance )
{ {
var type = instance.GetType();
var fieldInfo = type.GetField( memberName, flags ); var fieldInfo = type.GetField( memberName, flags );
if ( fieldInfo != null ) if ( fieldInfo != null )
@ -449,6 +448,11 @@ namespace Rokojori
return type.GetProperty( memberName, flags ); return type.GetProperty( memberName, flags );
} }
public static MemberInfo GetDataMemberInfo( object instance, string memberName, BindingFlags flags = BindingFlags.Public | BindingFlags.Instance )
{
return GetDataMemberInfo( instance.GetType(), memberName, flags );
}
public const BindingFlags defaultBindings = BindingFlags.Public | public const BindingFlags defaultBindings = BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.Instance |

View File

@ -63,77 +63,77 @@ namespace Rokojori
[Export( PropertyHint.Range, "0,1")] [Export( PropertyHint.Range, "0,1")]
float speedMultiply = 1f; public float speedMultiply = 1f;
[Export] [Export]
Vector4 innerHsl = Vector4.Zero; public Vector4 innerHsl = Vector4.Zero;
[Export] [Export]
Vector4 outerHsl = Vector4.Zero; public Vector4 outerHsl = Vector4.Zero;
[Export( PropertyHint.Range, "0,5")] [Export( PropertyHint.Range, "0,5")]
float colorFillRange = 0.5f; public float colorFillRange = 0.5f;
[Export( PropertyHint.Range, "0.01,5")] [Export( PropertyHint.Range, "0.01,5")]
float colorFillDistributionPower = 1f; public float colorFillDistributionPower = 1f;
[ExportGroup( "Streaks")] [ExportGroup( "Streaks")]
[Export( PropertyHint.Range, "0,8")] [Export( PropertyHint.Range, "0,8")]
float streaksFrequency = 1f; public float streaksFrequency = 1f;
[Export( PropertyHint.Range, "0,16")] [Export( PropertyHint.Range, "0,16")]
float streaksRotation = 0f; public float streaksRotation = 0f;
[Export( PropertyHint.Range, "0,1")] [Export( PropertyHint.Range, "0,1")]
float streaksRotationSpeed = 0f; public float streaksRotationSpeed = 0f;
[Export( PropertyHint.Range, "0,2")] [Export( PropertyHint.Range, "0,2")]
float streaksNoise = 0f; public float streaksNoise = 0f;
[Export( PropertyHint.Range, "-2,2")] [Export( PropertyHint.Range, "-2,2")]
float streaksNoiseOffset = 0f; public float streaksNoiseOffset = 0f;
[Export( PropertyHint.Range, "-1,1")] [Export( PropertyHint.Range, "-1,1")]
float streaksNoiseScroll = 0f; public float streaksNoiseScroll = 0f;
[ExportGroup( "Streaks 2")] [ExportGroup( "Streaks 2")]
[Export] [Export]
bool streaks2Enabled = false; bool streaks2Enabled = false;
[Export( PropertyHint.Range, "0,1")] [Export( PropertyHint.Range, "0,1")]
float streaksAddVsMult = 0f; public float streaksAddVsMult = 0f;
[Export( PropertyHint.Range, "0,5")] [Export( PropertyHint.Range, "0,5")]
float streaks2Multiply = 0f; public float streaks2Multiply = 0f;
[Export( PropertyHint.Range, "0,8")] [Export( PropertyHint.Range, "0,8")]
float streaksFrequency2 = 1f; public float streaksFrequency2 = 1f;
[Export( PropertyHint.Range, "0,16")] [Export( PropertyHint.Range, "0,16")]
float streaksRotation2 = 0f; public float streaksRotation2 = 0f;
[Export( PropertyHint.Range, "0,1")] [Export( PropertyHint.Range, "0,1")]
float streaksRotationSpeed2 = 0f; public float streaksRotationSpeed2 = 0f;
[Export( PropertyHint.Range, "0,2")] [Export( PropertyHint.Range, "0,2")]
float streaksNoise2 = 0f; public float streaksNoise2 = 0f;
[Export( PropertyHint.Range, "-2,2")] [Export( PropertyHint.Range, "-2,2")]
float streaksNoiseOffset2 = 0f; public float streaksNoiseOffset2 = 0f;
[Export( PropertyHint.Range, "-1,1")] [Export( PropertyHint.Range, "-1,1")]
float streaksNoiseScroll2 = 0f; public float streaksNoiseScroll2 = 0f;
[ExportGroup( "Mask")] [ExportGroup( "Mask")]
[Export( PropertyHint.Range, "0,1")] [Export( PropertyHint.Range, "0,1")]
float maskScale = 0.5f; public float maskScale = 0.5f;
[Export( PropertyHint.Range, "0,2")] [Export( PropertyHint.Range, "0,2")]
float maskRange = 0.1f; public float maskRange = 0.1f;
[Export( PropertyHint.Range, "0,1")] [Export( PropertyHint.Range, "0,1")]
float maskRangeOscillation = 0.1f; public float maskRangeOscillation = 0.1f;
[Export( PropertyHint.Range, "0,1")] [Export( PropertyHint.Range, "0,1")]
float maskRangeOscillationSpeed = 0.1f; public float maskRangeOscillationSpeed = 0.1f;
[Export( PropertyHint.Range, "0,2")] [Export( PropertyHint.Range, "0,2")]
float maskInnerSize = 1f; public float maskInnerSize = 1f;
[Export( PropertyHint.Range, "0,2")] [Export( PropertyHint.Range, "0,2")]
float maskFrequency = 1f; public float maskFrequency = 1f;
[Export( PropertyHint.Range, "0,1")] [Export( PropertyHint.Range, "0,1")]
float maskRotation = 0f; public float maskRotation = 0f;
[Export( PropertyHint.Range, "-1,1")] [Export( PropertyHint.Range, "-1,1")]
float maskRotationSpeed = 0f; public float maskRotationSpeed = 0f;
[ExportGroup( "Noise Blend")] [ExportGroup( "Noise Blend")]
[Export( PropertyHint.Range, "0,0.5")] [Export( PropertyHint.Range, "0,0.5")]
float blendingRange = 0.1f; public float blendingRange = 0.1f;
[ExportGroup( "Noise","noise")] [ExportGroup( "Noise","noise")]

View File

@ -31,7 +31,7 @@ namespace Rokojori
List<FlareLayer.Data> _layers = []; List<FlareLayer.Data> _layers = [];
void UpdateFlare() public void UpdateFlare()
{ {
if ( preset == null ) if ( preset == null )
{ {

View File

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="FlarePreset" load_steps=105 format=3 uid="uid://dp4g3uk1vgdg5"] [gd_resource type="Resource" script_class="FlarePreset" load_steps=106 format=3 uid="uid://dp4g3uk1vgdg5"]
[ext_resource type="Script" uid="uid://dmswtuayeoagf" path="res://addons/rokojori_action_library/Runtime/VFX/FlareVFX/FlareChromaticAberation/OrientatedFlareChromaticAberation.cs" id="1_ho1cr"] [ext_resource type="Script" uid="uid://dmswtuayeoagf" path="res://addons/rokojori_action_library/Runtime/VFX/FlareVFX/FlareChromaticAberation/OrientatedFlareChromaticAberation.cs" id="1_ho1cr"]
[ext_resource type="Script" uid="uid://c67s0ccpomg2s" path="res://addons/rokojori_action_library/Runtime/VFX/FlareVFX/FlareFading/EdgeFlareFading.cs" id="2_lw24a"] [ext_resource type="Script" uid="uid://c67s0ccpomg2s" path="res://addons/rokojori_action_library/Runtime/VFX/FlareVFX/FlareFading/EdgeFlareFading.cs" id="2_lw24a"]
@ -110,6 +110,12 @@ screenOffsetLayerScale = 0.153
screenOffsetLayerDirection = Vector2(1, 1) screenOffsetLayerDirection = Vector2(1, 1)
metadata/_custom_type_script = "uid://u3g0mlwlpd6s" metadata/_custom_type_script = "uid://u3g0mlwlpd6s"
[sub_resource type="Resource" id="Resource_lw24a"]
script = ExtResource("1_ho1cr")
amount = 7.9906
smear = 4.4186
metadata/_custom_type_script = "uid://dmswtuayeoagf"
[sub_resource type="Resource" id="Resource_xxny3"] [sub_resource type="Resource" id="Resource_xxny3"]
script = ExtResource("2_lw24a") script = ExtResource("2_lw24a")
power = 2.0 power = 2.0
@ -145,7 +151,7 @@ curve = SubResource("Curve_nt8a7")
[sub_resource type="Resource" id="Resource_ade2u"] [sub_resource type="Resource" id="Resource_ade2u"]
script = ExtResource("4_1hsao") script = ExtResource("4_1hsao")
layerName = "Big Hexagons" layerName = "Big Hexagons Ghosts"
opacity = 0.1879 opacity = 0.1879
numLayers = 8 numLayers = 8
flareType = SubResource("Resource_adfmi") flareType = SubResource("Resource_adfmi")
@ -167,6 +173,7 @@ screenOffsetLayerDirection = Vector2(100, 100)
rotationOverX = 45.0 rotationOverX = 45.0
rotationPerLayer = -2.0 rotationPerLayer = -2.0
fading = SubResource("Resource_xxny3") fading = SubResource("Resource_xxny3")
chromaticAberation = SubResource("Resource_lw24a")
metadata/_custom_type_script = "uid://u3g0mlwlpd6s" metadata/_custom_type_script = "uid://u3g0mlwlpd6s"
[sub_resource type="Resource" id="Resource_0y4dn"] [sub_resource type="Resource" id="Resource_0y4dn"]
@ -197,7 +204,7 @@ curve = SubResource("Curve_ymqbv")
[sub_resource type="Resource" id="Resource_jvxnt"] [sub_resource type="Resource" id="Resource_jvxnt"]
script = ExtResource("4_1hsao") script = ExtResource("4_1hsao")
layerName = "Small Circles" layerName = "Small Circles Ghosts"
opacity = 0.3343 opacity = 0.3343
numLayers = 50 numLayers = 50
flareType = SubResource("Resource_0y4dn") flareType = SubResource("Resource_0y4dn")
@ -325,7 +332,7 @@ curve = SubResource("Curve_008mr")
[sub_resource type="Resource" id="Resource_nt8a7"] [sub_resource type="Resource" id="Resource_nt8a7"]
script = ExtResource("4_1hsao") script = ExtResource("4_1hsao")
layerName = "Blend" layerName = "Blend God Rays"
opacity = 0.0141 opacity = 0.0141
flareType = SubResource("Resource_ui5ll") flareType = SubResource("Resource_ui5ll")
overwriteColor = Color(1.8247963, 1.8247963, 1.8247963, 1) overwriteColor = Color(1.8247963, 1.8247963, 1.8247963, 1)
@ -734,7 +741,7 @@ curve = SubResource("Curve_6xf1f")
[sub_resource type="Resource" id="Resource_skhw3"] [sub_resource type="Resource" id="Resource_skhw3"]
script = ExtResource("4_1hsao") script = ExtResource("4_1hsao")
layerName = "Rainbow Streaks" layerName = "Rainbow God Rays"
opacity = 0.1 opacity = 0.1
flareType = SubResource("Resource_sxovr") flareType = SubResource("Resource_sxovr")
overwriteColor = Color(2.8845115, 2.8845115, 2.8845115, 1) overwriteColor = Color(2.8845115, 2.8845115, 2.8845115, 1)

View File

@ -0,0 +1,57 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public partial class FlashPreset:Resource
{
[Export]
public GradientGenerator colorGradient;
[Export]
public Curve opacityCurve;
[Export]
public Duration duration;
[Export]
public FlashType flashType;
public enum PositionMode
{
World_Origin,
Origin_Of_First,
Center_Of_All,
Position_Offset
}
[ExportGroup("Light", "light")]
[Export]
public bool lightEnabled = false;
[Export]
public PositionMode lightPosition = PositionMode.Origin_Of_First;
[Export]
public Vector3 lightPositionOffset = Vector3.Zero;
[Export]
public float lightRange = 5;
[Export]
public float lightAttenutation = 2f;
[Export]
public float lightEnergy = 2f;
[Export]
public bool lightShadowCasting = false;
}
}

View File

@ -0,0 +1 @@
uid://c78b88pjvobsi

View File

@ -0,0 +1,19 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public partial class CustomFlashPosition:Resource
{
[Export]
public FlashPreset.PositionMode positionMode;
[Export]
public Vector3 offset;
[Export]
public Vector3PropertyName propertyName;
}
}

View File

@ -0,0 +1 @@
uid://bn31ol127rm2i

View File

@ -0,0 +1,72 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public partial class CustomFlashType:FlashType
{
[Export]
public Material flashMaterial;
[Export]
public ColorPropertyName colorPropertyName;
[Export]
public bool multiplyColorAlpha = true;
[Export]
public FloatPropertyName opacityPropertyName;
[Export]
public FloatPropertyName phasePropertyName;
[Export]
public CustomFlashPosition flashPosition;
public override void ApplyFlashType(
FlashVFXRunner runner, float phase, Color color, float opacity,
GeometryInstance3D gi, Material material )
{
var materialColor = color;
if ( multiplyColorAlpha )
{
materialColor.A *= opacity;
}
if ( colorPropertyName != null )
{
colorPropertyName.Set( material, materialColor );
}
if ( opacityPropertyName != null )
{
opacityPropertyName.Set( material, opacity );
}
if ( phasePropertyName != null )
{
phasePropertyName.Set( material, phase );
}
}
public override Material CreateMaterial( FlashVFXRunner runner, GeometryInstance3D gi )
{
var duplicateMaterial = (Material)flashMaterial.Duplicate();
if ( flashPosition != null )
{
flashPosition.propertyName.Set( duplicateMaterial, runner.GetFlashPosition( flashPosition.positionMode, flashPosition.offset ) );
}
return duplicateMaterial;
}
}
}

View File

@ -0,0 +1 @@
uid://chl43fdu0vn81

View File

@ -0,0 +1,26 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public abstract partial class FlashType:Resource
{
public abstract void ApplyFlashType(
FlashVFXRunner runner, float phase, Color color, float opacity,
GeometryInstance3D gi, Material material
);
public abstract Material CreateMaterial( FlashVFXRunner runner, GeometryInstance3D gi );
public Material CreateAndInitializeMaterial( FlashVFXRunner runner, GeometryInstance3D gi, Color color, float opacity = 0f )
{
var material = CreateMaterial( runner, gi );
ApplyFlashType( runner, -1f, color, opacity, gi, material );
return material;
}
}
}

View File

@ -0,0 +1 @@
uid://blxhc8xcka2hf

View File

@ -0,0 +1,44 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public partial class FlatFlashType:FlashType
{
[Export]
public BaseMaterial3D.BlendModeEnum blendMode = BaseMaterial3D.BlendModeEnum.Add;
[Export]
public BaseMaterial3D.TransparencyEnum transparency = BaseMaterial3D.TransparencyEnum.Alpha;
[Export]
public BaseMaterial3D.ShadingModeEnum shadingMode = BaseMaterial3D.ShadingModeEnum.Unshaded;
public override void ApplyFlashType(
FlashVFXRunner runner, float phase, Color color, float opacity,
GeometryInstance3D gi, Material material )
{
var sm = (StandardMaterial3D)material;
var materialColor = color;
materialColor.A *= opacity;
sm.AlbedoColor = materialColor;
}
public override Material CreateMaterial( FlashVFXRunner runner, GeometryInstance3D gi )
{
var material = new StandardMaterial3D();
material.ShadingMode = shadingMode;
material.BlendMode = blendMode;
material.Transparency = transparency;
return material;
}
}
}

View File

@ -0,0 +1 @@
uid://dp3vhm6l8mc62

View File

@ -0,0 +1,54 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public partial class FresnelFlashType:FlashType
{
[Export]
public BaseMaterial3D.BlendModeEnum blendMode = BaseMaterial3D.BlendModeEnum.Add;
[Export]
public float fresnelSharpness= 1f;
[Export]
public float fresnelMultiply = 1;
[Export]
public float fresnelOffset = 0;
[Export]
public float grow = 0;
[Export]
public bool clampAlpha = true;
public override void ApplyFlashType(
FlashVFXRunner runner, float phase, Color color, float opacity,
GeometryInstance3D gi, Material material )
{
var materialColor = color;
materialColor.A *= opacity;
FresnelOverlayShader.albedo.Set( material, materialColor );
}
public override Material CreateMaterial( FlashVFXRunner runner, GeometryInstance3D gi )
{
var sm = new ShaderMaterial();
sm.Shader = FresnelOverlayShader.GetShaderWithBlendMode( blendMode );
FresnelOverlayShader.fresnelSharpness.Set( sm, fresnelSharpness );
FresnelOverlayShader.fresnelMultiply.Set( sm, fresnelMultiply );
FresnelOverlayShader.fresnelOffset.Set( sm, fresnelOffset );
FresnelOverlayShader.grow.Set( sm, grow );
FresnelOverlayShader.clampAlpha.Set( sm, clampAlpha );
return sm;
}
}
}

View File

@ -0,0 +1 @@
uid://ovls0u6yc8li

View File

@ -0,0 +1,336 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public partial class FlashVFX:SequenceAction, Animator
{
[Export]
public FlashPreset preset;
[Export]
public Node[] targets;
[Export]
public bool includeChildren = false;
public enum MaterialAssignementMode
{
Replace_Per_Target,
Add_For_Each_Material
}
[ExportGroup("Material Assignment")]
[Export]
public MaterialAssignementMode assignementMode = MaterialAssignementMode.Add_For_Each_Material;
[Export]
public Node3D positionOffset;
public void OnAnimatorStart(){}
public void OnAnimatorEnd(){}
public void OnAnimatorCancel(){}
Dictionary<int,FlashVFXRunner> _running = new Dictionary<int, FlashVFXRunner>();
protected override void _OnTrigger()
{
if ( assignementMode == MaterialAssignementMode.Replace_Per_Target )
{
_OnTrigger_ReplacePerTarget();
}
if ( assignementMode == MaterialAssignementMode.Add_For_Each_Material )
{
_OnTrigger_AddForEachMaterial();
}
}
protected void _OnTrigger_ReplacePerTarget()
{
var id = DispatchStart();
var duration = preset.duration == null ? new SecondsDuration() : preset.duration;
var tl = TimeLineManager.Ensure( duration.timeLine );
var OVERLAY = GeometryInstance3D.PropertyName.MaterialOverlay;
var runner = new FlashVFXRunner();
runner.flashVFX = this;
runner.targets = VFXTools.GetGeometryInstance3Ds( targets, includeChildren );
var gradient = preset.colorGradient.GetGradient();
var gradientRepeat = preset.colorGradient.GetRepeat();
var gradientRepeatMode = preset.colorGradient.GetRepeatMode();
var opacityCurve = preset.opacityCurve;
if ( runner.targets.Count == 0 )
{
DispatchEnd( id );
return;
}
runner.materials = runner.targets.Map( gi =>
{
return preset.flashType.CreateAndInitializeMaterial( runner, gi, gradient.Sample( 0 ) );
}
);
_running[ id ] = runner;
runner.AddLight();
for ( int i = 0; i < runner.targets.Count; i++ )
{
var t = runner.targets[ i ];
AnimationManager.StartAnimation( this, t, OVERLAY );
t.MaterialOverlay = runner.materials[ i ];
runner.assignedMaterials[ t ] = runner.materials[ i ];
}
TimeLineManager.ScheduleSpanIn( tl, 0, duration.GetDurationInSeconds(),
( span, type )=>
{
var timeNow = tl.position;
var phase = span.phase;
var color = gradient.SampleRepeated( phase * gradientRepeat, gradientRepeatMode );
var opacity = opacityCurve.Sample( phase );
runner.UpdateLight( phase, color, opacity );
for ( int i = 0; i < runner.targets.Count; i++ )
{
var gi = runner.targets[ i ];
if ( ! AnimationManager.IsAnimating( this, gi, OVERLAY ) )
{
continue;
}
var material = runner.materials[ i ];
preset.flashType.ApplyFlashType( runner, span.phase, color, opacity, gi, material );
}
if ( type == TimeLineSpanUpdateType.End )
{
for ( int i = 0; i < runner.targets.Count; i++ )
{
var gi = runner.targets[ i ];
if ( gi.MaterialOverlay == runner.assignedMaterials[ gi ] )
{
gi.MaterialOverlay = null;
}
AnimationManager.EndAnimation( this, gi, OVERLAY, runner.materials[ i ] );
}
runner.RemoveLight();
DispatchEnd( id );
}
},
this
);
}
protected void _OnTrigger_AddForEachMaterial()
{
var id = DispatchStart();
var duration = preset.duration == null ? new SecondsDuration() : preset.duration;
var tl = TimeLineManager.Ensure( duration.timeLine );
var OVERLAY = GeometryInstance3D.PropertyName.MaterialOverlay;
var runner = new FlashVFXRunner();
runner.flashVFX = this;
runner.targets = VFXTools.GetGeometryInstance3Ds( targets, includeChildren );
if ( runner.targets.Count == 0 )
{
DispatchEnd( id );
return;
}
runner.AddLight();
var gradient = preset.colorGradient.GetGradient();
var gradientRepeat = preset.colorGradient.GetRepeat();
var gradientRepeatMode = preset.colorGradient.GetRepeatMode();
var opacityCurve = preset.opacityCurve;
Material nullMaterial = null;
for ( int i = 0; i < runner.targets.Count; i++ )
{
var t = runner.targets[ i ];
if ( t.MaterialOverlay == null )
{
if ( nullMaterial == null )
{
nullMaterial = preset.flashType.CreateAndInitializeMaterial( runner, null, gradient.Sample( 0 ) );
runner.materials.Add( nullMaterial );
runner.assignedMaterials[ t ] = nullMaterial;
}
}
else
{
var original = t.MaterialOverlay;
Material extended = null;
if ( ! runner.mappedMaterials.ContainsKey( original ) )
{
var mapped = preset.flashType.CreateAndInitializeMaterial( runner, null, gradient.Sample( 0 ) );
extended = t.MaterialOverlay.Duplicate() as Material;
Materials.AddToNextPass( extended, mapped );
runner.materials.Add( extended );
runner.mappedMaterials[ original ] = extended;
}
else
{
extended = runner.mappedMaterials[ original ];
}
runner.originalMaterials[ t ] = original;
runner.assignedMaterials[ t ] = extended;
t.MaterialOverlay = extended;
}
}
_running[ id ] = runner;
TimeLineManager.ScheduleSpanIn( tl, 0, duration.GetDurationInSeconds(),
( span, type )=>
{
var timeNow = tl.position;
var phase = span.phase;
var color = gradient.SampleRepeated( phase * gradientRepeat, gradientRepeatMode );
var opacity = opacityCurve.Sample( phase );
runner.UpdateLight( phase, color, opacity );
for ( int i = 0; i < runner.materials.Count; i++ )
{
var material = runner.materials[ i ];
preset.flashType.ApplyFlashType( runner, span.phase, color, opacity, null, material );
}
if ( type == TimeLineSpanUpdateType.End )
{
for ( int i = 0; i < runner.targets.Count; i++ )
{
var gi = runner.targets[ i ];
var material = runner.assignedMaterials[ gi ];
if ( gi.MaterialOverlay == material )
{
gi.MaterialOverlay = runner.originalMaterials.ContainsKey( gi ) ? runner.originalMaterials[ gi ] : null;
}
}
DispatchEnd( id );
runner.RemoveLight();
}
},
this
);
}
}
public class FlashVFXRunner
{
public FlashVFX flashVFX;
public FlashPreset preset => flashVFX.preset;
public List<GeometryInstance3D> targets = [];
public List<Material> materials = [];
public OmniLight3D light;
public Dictionary<GeometryInstance3D,Material> originalMaterials = new Dictionary<GeometryInstance3D, Material>();
public Dictionary<GeometryInstance3D,Material> assignedMaterials = new Dictionary<GeometryInstance3D, Material>();
public Dictionary<Material,Material> mappedMaterials = new Dictionary<Material, Material>();
public Vector3 GetFlashPosition( FlashPreset.PositionMode mode, Vector3 offset )
{
if ( FlashPreset.PositionMode.Position_Offset == mode )
{
return flashVFX.positionOffset.GlobalPosition + offset;
}
else if ( FlashPreset.PositionMode.Origin_Of_First == mode )
{
return targets[ 0 ].GlobalPosition + offset;
}
else if ( FlashPreset.PositionMode.Center_Of_All == mode )
{
return Node3DExtensions.GetCenter( targets ) + offset;
}
else
{
return offset;
}
}
public void AddLight()
{
if ( ! preset.lightEnabled )
{
return;
}
light = flashVFX.CreateChild<OmniLight3D>();
light.LightColor = new Color( 0, 0, 0 );
light.GlobalPosition = GetFlashPosition( preset.lightPosition, preset.lightPositionOffset );
light.OmniRange = preset.lightRange;
light.OmniAttenuation = preset.lightAttenutation;
light.LightEnergy = preset.lightEnergy;
light.ShadowEnabled = preset.lightShadowCasting;
}
public void UpdateLight( float phase, Color color, float opacity )
{
if ( light == null )
{
return;
}
light.LightColor = color * opacity;
}
public void RemoveLight()
{
if ( light == null )
{
return;
}
light.DeleteSelf();
}
}
}

View File

@ -0,0 +1 @@
uid://degpoh0ab3gpl

View File

@ -0,0 +1,41 @@
[gd_resource type="Resource" script_class="FlashPreset" load_steps=10 format=3 uid="uid://bsvm0ca6kdwiw"]
[ext_resource type="Script" uid="uid://mer2h3i8xjot" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/RainbowGradient.cs" id="1_eid4b"]
[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_mw8wy"]
[ext_resource type="Script" uid="uid://ovls0u6yc8li" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs" id="3_elmbg"]
[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="4_r4a2w"]
[sub_resource type="Gradient" id="Gradient_tsojp"]
offsets = PackedFloat32Array(0, 0.09090909, 0.18181819, 0.27272728, 0.36363637, 0.45454547, 0.54545456, 0.6363636, 0.72727275, 0.8181818, 0.90909094, 1)
colors = PackedColorArray(3.2944157, 0.58140206, 0.58140206, 16, 3.2944157, 2.0612278, 0.58140206, 16, 3.0477781, 3.2944157, 0.58140206, 16, 1.5679523, 3.2944157, 0.58140206, 16, 0.58140206, 3.2944157, 1.0746772, 16, 0.58140206, 3.2944157, 2.5545027, 16, 0.58140206, 2.5545022, 3.2944157, 16, 0.58140206, 1.0746772, 3.2944157, 16, 1.5679523, 0.58140206, 3.2944157, 16, 3.0477774, 0.58140206, 3.2944157, 16, 3.2944157, 0.58140206, 2.0612273, 16, 3.2944157, 0.58140206, 0.58140206, 16)
[sub_resource type="Resource" id="Resource_e6c6u"]
script = ExtResource("1_eid4b")
lightness = 63.9394
intensity = 2.0
resolution = 12
outputGradient = SubResource("Gradient_tsojp")
repeat = 3.0
repeatMode = 1
metadata/_custom_type_script = "uid://mer2h3i8xjot"
[sub_resource type="Resource" id="Resource_k277t"]
script = ExtResource("2_mw8wy")
metadata/_custom_type_script = "uid://ddhwhwos5kkrm"
[sub_resource type="Resource" id="Resource_it5p0"]
script = ExtResource("3_elmbg")
fresnelSharpness = 2.0
metadata/_custom_type_script = "uid://ovls0u6yc8li"
[sub_resource type="Curve" id="Curve_61uky"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.05454545, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3
[resource]
script = ExtResource("4_r4a2w")
colorGradient = SubResource("Resource_e6c6u")
opacityCurve = SubResource("Curve_61uky")
duration = SubResource("Resource_k277t")
flashType = SubResource("Resource_it5p0")
metadata/_custom_type_script = "uid://c78b88pjvobsi"

View File

@ -0,0 +1,37 @@
[gd_resource type="Resource" script_class="FlashPreset" load_steps=10 format=3 uid="uid://im8nc0763r7r"]
[ext_resource type="Script" uid="uid://ckr83rn42kvf2" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/CustomGradient.cs" id="1_oea31"]
[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_x2dmj"]
[ext_resource type="Script" uid="uid://dp3vhm6l8mc62" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs" id="3_u6gyh"]
[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="4_r80hv"]
[sub_resource type="Gradient" id="Gradient_ymeji"]
offsets = PackedFloat32Array(0)
colors = PackedColorArray(1, 0, 0, 1)
[sub_resource type="Resource" id="Resource_3gtgp"]
script = ExtResource("1_oea31")
gradient = SubResource("Gradient_ymeji")
metadata/_custom_type_script = "uid://ckr83rn42kvf2"
[sub_resource type="Resource" id="Resource_j11dc"]
script = ExtResource("2_x2dmj")
seconds = 0.3
metadata/_custom_type_script = "uid://ddhwhwos5kkrm"
[sub_resource type="Resource" id="Resource_puepo"]
script = ExtResource("3_u6gyh")
metadata/_custom_type_script = "uid://dp3vhm6l8mc62"
[sub_resource type="Curve" id="Curve_854jy"]
_limits = [0.0, 2.0, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.026515156, 1.8006134), 0.0, 0.0, 0, 0, Vector2(0.47727275, 0), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 4
[resource]
script = ExtResource("4_r80hv")
colorGradient = SubResource("Resource_3gtgp")
opacityCurve = SubResource("Curve_854jy")
duration = SubResource("Resource_j11dc")
flashType = SubResource("Resource_puepo")
metadata/_custom_type_script = "uid://c78b88pjvobsi"

View File

@ -0,0 +1,37 @@
[gd_resource type="Resource" script_class="FlashPreset" load_steps=10 format=3 uid="uid://dt7ue6b8iknrf"]
[ext_resource type="Script" uid="uid://ckr83rn42kvf2" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/CustomGradient.cs" id="1_f0lav"]
[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_ja8q1"]
[ext_resource type="Script" uid="uid://dp3vhm6l8mc62" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/FlatFlashType/FlatFlashType.cs" id="3_uq5g2"]
[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="4_abpyj"]
[sub_resource type="Gradient" id="Gradient_xf1he"]
offsets = PackedFloat32Array(0)
colors = PackedColorArray(3.325515, 3.325515, 3.325515, 1)
[sub_resource type="Resource" id="Resource_gbubg"]
script = ExtResource("1_f0lav")
gradient = SubResource("Gradient_xf1he")
metadata/_custom_type_script = "uid://ckr83rn42kvf2"
[sub_resource type="Resource" id="Resource_1s8ae"]
script = ExtResource("2_ja8q1")
seconds = 0.3
metadata/_custom_type_script = "uid://ddhwhwos5kkrm"
[sub_resource type="Resource" id="Resource_2dgt6"]
script = ExtResource("3_uq5g2")
metadata/_custom_type_script = "uid://dp3vhm6l8mc62"
[sub_resource type="Curve" id="Curve_vekw0"]
_limits = [0.0, 2.0, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.030303031, 2), 0.0, 0.0, 0, 0, Vector2(0.18939394, 0), 0.0, 0.0, 0, 0, Vector2(0.4621212, 0), 0.0, 0.0, 0, 0, Vector2(0.5, 1.5015337), 0.0, 0.0, 0, 0, Vector2(0.655303, 0), 0.10755398, 0.10755398, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 7
[resource]
script = ExtResource("4_abpyj")
colorGradient = SubResource("Resource_gbubg")
opacityCurve = SubResource("Curve_vekw0")
duration = SubResource("Resource_1s8ae")
flashType = SubResource("Resource_2dgt6")
metadata/_custom_type_script = "uid://c78b88pjvobsi"

View File

@ -0,0 +1,47 @@
[gd_resource type="Resource" script_class="FlashPreset" load_steps=10 format=3 uid="uid://dmlpjt3b1xp15"]
[ext_resource type="Script" uid="uid://cjyssfkixctwe" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/TemperatureGradient.cs" id="1_7saw8"]
[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_msqee"]
[ext_resource type="Script" uid="uid://ovls0u6yc8li" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs" id="3_us2h7"]
[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="4_s4ag5"]
[sub_resource type="Gradient" id="Gradient_d8o7a"]
offsets = PackedFloat32Array(0, 0.5, 1)
colors = PackedColorArray(0.24000007, 0.96, 0.57723343, 1, 0, 0.78162026, 1, 1, 0, 0.025296224, 0.8, 1)
[sub_resource type="Resource" id="Resource_205gq"]
script = ExtResource("1_7saw8")
baseColor = Color(0, 0.78162026, 1, 1)
centerAttraction = 0.0
temperaturePolarBlendRadius = 30.0
startTemperatureShift = 45.0
startSaturationShift = -10.0
startLightnessShift = 10.0
endTemperatureShift = -45.0
endSaturationShift = 10.0
endLightnessShift = -10.0
outputGradient = SubResource("Gradient_d8o7a")
metadata/_custom_type_script = "uid://cjyssfkixctwe"
[sub_resource type="Resource" id="Resource_7pyme"]
script = ExtResource("2_msqee")
seconds = 0.3
metadata/_custom_type_script = "uid://ddhwhwos5kkrm"
[sub_resource type="Resource" id="Resource_l2t0j"]
script = ExtResource("3_us2h7")
metadata/_custom_type_script = "uid://ovls0u6yc8li"
[sub_resource type="Curve" id="Curve_n2yo8"]
_limits = [0.0, 2.0, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.026515156, 1.8006134), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3
[resource]
script = ExtResource("4_s4ag5")
colorGradient = SubResource("Resource_205gq")
opacityCurve = SubResource("Curve_n2yo8")
duration = SubResource("Resource_7pyme")
flashType = SubResource("Resource_l2t0j")
lightEnabled = true
metadata/_custom_type_script = "uid://c78b88pjvobsi"

View File

@ -0,0 +1,47 @@
[gd_resource type="Resource" script_class="FlashPreset" load_steps=10 format=3 uid="uid://irftyqm8w762"]
[ext_resource type="Script" uid="uid://cjyssfkixctwe" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/TemperatureGradient.cs" id="1_b51fw"]
[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_uu5id"]
[ext_resource type="Script" uid="uid://ovls0u6yc8li" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/FresnelFlashType/FresnelFlashType.cs" id="3_w2g18"]
[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="4_cee5e"]
[sub_resource type="Gradient" id="Gradient_uu5id"]
offsets = PackedFloat32Array(0, 0.5, 1)
colors = PackedColorArray(0.96, 0.9211765, 0.24000007, 1, 1, 0.19607843, 0, 1, 0.8, 0, 0.4431372, 1)
[sub_resource type="Resource" id="Resource_w2g18"]
script = ExtResource("1_b51fw")
baseColor = Color(1, 0.19607843, 0, 1)
centerAttraction = 0.0
temperaturePolarBlendRadius = 30.0
startTemperatureShift = 45.0
startSaturationShift = -10.0
startLightnessShift = 10.0
endTemperatureShift = -45.0
endSaturationShift = 10.0
endLightnessShift = -10.0
outputGradient = SubResource("Gradient_uu5id")
metadata/_custom_type_script = "uid://cjyssfkixctwe"
[sub_resource type="Resource" id="Resource_58b12"]
script = ExtResource("2_uu5id")
seconds = 0.3
metadata/_custom_type_script = "uid://ddhwhwos5kkrm"
[sub_resource type="Resource" id="Resource_l1caf"]
script = ExtResource("3_w2g18")
metadata/_custom_type_script = "uid://ovls0u6yc8li"
[sub_resource type="Curve" id="Curve_mem7v"]
_limits = [0.0, 2.0, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.026515156, 1.8006134), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3
[resource]
script = ExtResource("4_cee5e")
colorGradient = SubResource("Resource_w2g18")
opacityCurve = SubResource("Curve_mem7v")
duration = SubResource("Resource_58b12")
flashType = SubResource("Resource_l1caf")
lightEnabled = true
metadata/_custom_type_script = "uid://c78b88pjvobsi"

View File

@ -0,0 +1,77 @@
[gd_resource type="Resource" script_class="FlashPreset" load_steps=19 format=3 uid="uid://uwqptosumnks"]
[ext_resource type="Script" uid="uid://cjyssfkixctwe" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/TemperatureGradient.cs" id="1_0dcww"]
[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_m3qwr"]
[ext_resource type="Script" uid="uid://y2p0r8c5rs45" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/ColorPropertyName.cs" id="3_j8fax"]
[ext_resource type="Material" uid="uid://eklfe1i0kt1e" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashVFXPresets/Scanner/Scanner.material" id="4_nhwmm"]
[ext_resource type="Script" uid="uid://jqgdm3r2u8xq" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/FloatPropertyName.cs" id="5_1uu41"]
[ext_resource type="Script" uid="uid://rukdqg1uo30" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector3PropertyName.cs" id="5_j8fax"]
[ext_resource type="Script" uid="uid://chl43fdu0vn81" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs" id="6_lpua8"]
[ext_resource type="Script" uid="uid://bn31ol127rm2i" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs" id="6_nhwmm"]
[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="7_d6aiv"]
[sub_resource type="Gradient" id="Gradient_vc6ua"]
offsets = PackedFloat32Array(0.08335, 0.5, 0.91665)
colors = PackedColorArray(1, 1, 0.82500005, 1, 0.28650653, 1.825, 0, 1, 0, 0.9363221, 0.8340571, 1)
[sub_resource type="Resource" id="Resource_k2ykb"]
script = ExtResource("1_0dcww")
baseColor = Color(0.28650653, 1.825, 0, 1)
centerAttraction = 0.1667
temperaturePolarBlendRadius = 30.0
startTemperatureShift = 90.0
endTemperatureShift = -62.8662
endSaturationShift = 20.6349
endLightnessShift = -44.4339
outputGradient = SubResource("Gradient_vc6ua")
metadata/_custom_type_script = "uid://cjyssfkixctwe"
[sub_resource type="Resource" id="Resource_hs1rr"]
script = ExtResource("2_m3qwr")
seconds = 0.5
metadata/_custom_type_script = "uid://ddhwhwos5kkrm"
[sub_resource type="Resource" id="Resource_q7vi4"]
script = ExtResource("3_j8fax")
propertyName = "albedo"
metadata/_custom_type_script = "uid://y2p0r8c5rs45"
[sub_resource type="Resource" id="Resource_1uu41"]
script = ExtResource("5_j8fax")
propertyName = "position"
metadata/_custom_type_script = "uid://rukdqg1uo30"
[sub_resource type="Resource" id="Resource_lpua8"]
script = ExtResource("6_nhwmm")
positionMode = 1
offset = Vector3(0, -0.5, 0)
propertyName = SubResource("Resource_1uu41")
metadata/_custom_type_script = "uid://bn31ol127rm2i"
[sub_resource type="Resource" id="Resource_1djbv"]
script = ExtResource("5_1uu41")
propertyName = "driver"
metadata/_custom_type_script = "uid://jqgdm3r2u8xq"
[sub_resource type="Resource" id="Resource_ug21n"]
script = ExtResource("6_lpua8")
flashMaterial = ExtResource("4_nhwmm")
colorPropertyName = SubResource("Resource_q7vi4")
phasePropertyName = SubResource("Resource_1djbv")
flashPosition = SubResource("Resource_lpua8")
metadata/_custom_type_script = "uid://chl43fdu0vn81"
[sub_resource type="Curve" id="Curve_ud7rl"]
_limits = [0.0, 2.0, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 37.714283, 0, 1, Vector2(0.053030305, 2), 0.0, 0.0, 0, 0, Vector2(1, 0), -0.05551173, 0.0, 0, 0]
point_count = 3
[resource]
script = ExtResource("7_d6aiv")
colorGradient = SubResource("Resource_k2ykb")
opacityCurve = SubResource("Curve_ud7rl")
duration = SubResource("Resource_hs1rr")
flashType = SubResource("Resource_ug21n")
lightEnabled = true
lightEnergy = 1.0
metadata/_custom_type_script = "uid://c78b88pjvobsi"

View File

@ -0,0 +1,103 @@
[gd_resource type="Resource" script_class="FlashPreset" load_steps=22 format=3 uid="uid://cwdpmuqt0svwm"]
[ext_resource type="Script" uid="uid://cjyssfkixctwe" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/TemperatureGradient.cs" id="1_gli2s"]
[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_kuv45"]
[ext_resource type="Script" uid="uid://y2p0r8c5rs45" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/ColorPropertyName.cs" id="3_ad8tv"]
[ext_resource type="Shader" uid="uid://bdjl44rcb2la0" path="res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader" id="4_gli2s"]
[ext_resource type="Script" uid="uid://rukdqg1uo30" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector3PropertyName.cs" id="5_ad8tv"]
[ext_resource type="Script" uid="uid://jqgdm3r2u8xq" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/FloatPropertyName.cs" id="5_dr54e"]
[ext_resource type="Script" uid="uid://bn31ol127rm2i" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs" id="6_0xqn3"]
[ext_resource type="Script" uid="uid://chl43fdu0vn81" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs" id="6_7nrn2"]
[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="7_7sesa"]
[sub_resource type="Gradient" id="Gradient_kuv45"]
offsets = PackedFloat32Array(0.051560313, 0.1667, 0.74226034)
colors = PackedColorArray(1, 0.9495292, 0.82500005, 1, 1.825, 0, 1.4388391, 1, 0.15339342, 0, 0.9363221, 1)
[sub_resource type="Resource" id="Resource_lggrh"]
script = ExtResource("1_gli2s")
baseColor = Color(1.825, 0, 1.4388391, 1)
centerPosition = 0.1667
centerAttraction = 0.3093
temperaturePolarBlendRadius = 30.0
startTemperatureShift = 90.0
endTemperatureShift = -62.8662
endSaturationShift = 20.6349
endLightnessShift = -44.4339
outputGradient = SubResource("Gradient_kuv45")
metadata/_custom_type_script = "uid://cjyssfkixctwe"
[sub_resource type="Resource" id="Resource_5soom"]
script = ExtResource("2_kuv45")
seconds = 0.5
metadata/_custom_type_script = "uid://ddhwhwos5kkrm"
[sub_resource type="Resource" id="Resource_q7vi4"]
script = ExtResource("3_ad8tv")
propertyName = "albedo"
metadata/_custom_type_script = "uid://y2p0r8c5rs45"
[sub_resource type="Gradient" id="Gradient_ad8tv"]
offsets = PackedFloat32Array(0.011450382, 0.55725193, 1)
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_0xqn3"]
gradient = SubResource("Gradient_ad8tv")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dr54e"]
render_priority = 0
shader = ExtResource("4_gli2s")
shader_parameter/albedo = Color(4.2130003, 4.2130003, 4.2130003, 1)
shader_parameter/driver = 0.0
shader_parameter/position = Vector3(0, 0, 0)
shader_parameter/direction = Vector3(0, 1, 0)
shader_parameter/scannerSize = 0.8965
shader_parameter/scanTexture = SubResource("GradientTexture1D_0xqn3")
shader_parameter/noiseAmount = 0.114000005415
shader_parameter/noiseScale = 8.87900041849262
shader_parameter/noiseScroll = Vector3(0, 0, 0)
shader_parameter/noiseScrollFromScanDirection = 3.0
shader_parameter/noiseAmount2 = 0.2390000113525
shader_parameter/noiseScale2 = 4.03300018830762
shader_parameter/noiseScroll2 = Vector3(0, 0, 0)
shader_parameter/noiseScrollFromScanDirection2 = 4.0
[sub_resource type="Resource" id="Resource_dr54e"]
script = ExtResource("5_ad8tv")
propertyName = "position"
metadata/_custom_type_script = "uid://rukdqg1uo30"
[sub_resource type="Resource" id="Resource_7nrn2"]
script = ExtResource("6_0xqn3")
positionMode = 1
offset = Vector3(0, -0.5, 0)
propertyName = SubResource("Resource_dr54e")
metadata/_custom_type_script = "uid://bn31ol127rm2i"
[sub_resource type="Resource" id="Resource_1djbv"]
script = ExtResource("5_dr54e")
propertyName = "driver"
metadata/_custom_type_script = "uid://jqgdm3r2u8xq"
[sub_resource type="Resource" id="Resource_5604o"]
script = ExtResource("6_7nrn2")
flashMaterial = SubResource("ShaderMaterial_dr54e")
colorPropertyName = SubResource("Resource_q7vi4")
phasePropertyName = SubResource("Resource_1djbv")
flashPosition = SubResource("Resource_7nrn2")
metadata/_custom_type_script = "uid://chl43fdu0vn81"
[sub_resource type="Curve" id="Curve_s7w4q"]
_limits = [0.0, 2.0, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 37.714283, 0, 1, Vector2(0.053030305, 2), 0.0, 0.0, 0, 0, Vector2(1, 0), -0.05551173, 0.0, 0, 0]
point_count = 3
[resource]
script = ExtResource("7_7sesa")
colorGradient = SubResource("Resource_lggrh")
opacityCurve = SubResource("Curve_s7w4q")
duration = SubResource("Resource_5soom")
flashType = SubResource("Resource_5604o")
lightEnabled = true
lightEnergy = 1.0
metadata/_custom_type_script = "uid://c78b88pjvobsi"

View File

@ -0,0 +1,96 @@
[gd_resource type="Resource" script_class="FlashPreset" load_steps=22 format=3 uid="uid://bne3wk6xbt48p"]
[ext_resource type="Script" uid="uid://mer2h3i8xjot" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/RainbowGradient.cs" id="1_03l83"]
[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_y5iyo"]
[ext_resource type="Script" uid="uid://y2p0r8c5rs45" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/ColorPropertyName.cs" id="3_p1cg2"]
[ext_resource type="Shader" uid="uid://bdjl44rcb2la0" path="res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/Scanner/Scanner.gdshader" id="4_uu110"]
[ext_resource type="Script" uid="uid://jqgdm3r2u8xq" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/FloatPropertyName.cs" id="5_jquqm"]
[ext_resource type="Script" uid="uid://rukdqg1uo30" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Vector3PropertyName.cs" id="5_p1cg2"]
[ext_resource type="Script" uid="uid://chl43fdu0vn81" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs" id="6_phuds"]
[ext_resource type="Script" uid="uid://bn31ol127rm2i" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashPosition.cs" id="6_uu110"]
[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="7_5xn3m"]
[sub_resource type="Gradient" id="Gradient_8gpm3"]
offsets = PackedFloat32Array(0, 0.09090909, 0.18181819, 0.27272728, 0.36363637, 0.45454547, 0.54545456, 0.6363636, 0.72727275, 0.8181818, 0.90909094, 1)
colors = PackedColorArray(3.2944157, 0.58140206, 0.58140206, 16, 3.2944157, 2.0612278, 0.58140206, 16, 3.0477781, 3.2944157, 0.58140206, 16, 1.5679523, 3.2944157, 0.58140206, 16, 0.58140206, 3.2944157, 1.0746772, 16, 0.58140206, 3.2944157, 2.5545027, 16, 0.58140206, 2.5545022, 3.2944157, 16, 0.58140206, 1.0746772, 3.2944157, 16, 1.5679523, 0.58140206, 3.2944157, 16, 3.0477774, 0.58140206, 3.2944157, 16, 3.2944157, 0.58140206, 2.0612273, 16, 3.2944157, 0.58140206, 0.58140206, 16)
[sub_resource type="Resource" id="Resource_1d707"]
script = ExtResource("1_03l83")
intensity = 2.0
resolution = 12
outputGradient = SubResource("Gradient_8gpm3")
repeat = 2.0
repeatMode = 1
metadata/_custom_type_script = "uid://mer2h3i8xjot"
[sub_resource type="Resource" id="Resource_w5yc7"]
script = ExtResource("2_y5iyo")
metadata/_custom_type_script = "uid://ddhwhwos5kkrm"
[sub_resource type="Resource" id="Resource_ff4i8"]
script = ExtResource("3_p1cg2")
propertyName = "albedo"
metadata/_custom_type_script = "uid://y2p0r8c5rs45"
[sub_resource type="Gradient" id="Gradient_nekbm"]
offsets = PackedFloat32Array(0, 0.5152672, 0.84351146, 0.980916)
colors = PackedColorArray(1, 1, 1, 0, 1.195908, 1.195908, 1.195908, 0.81632656, 1.8247963, 1.8247963, 1.8247963, 1, 1, 1, 1, 0)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_n4dn7"]
gradient = SubResource("Gradient_nekbm")
use_hdr = true
[sub_resource type="ShaderMaterial" id="ShaderMaterial_1sieh"]
render_priority = 0
shader = ExtResource("4_uu110")
shader_parameter/albedo = Color(4.2130003, 4.2130003, 4.2130003, 1)
shader_parameter/driver = 0.0
shader_parameter/position = Vector3(0, 0, 0)
shader_parameter/direction = Vector3(0, 1, 0)
shader_parameter/scannerSize = 0.8965
shader_parameter/scanTexture = SubResource("GradientTexture1D_n4dn7")
shader_parameter/noiseAmount = 0.7630000362425
shader_parameter/noiseScale = 6.300000295990119
shader_parameter/noiseScroll = Vector3(0, 0, 0)
shader_parameter/noiseScrollFromScanDirection = 3.0
shader_parameter/noiseAmount2 = 0.25200001197
shader_parameter/noiseScale2 = 39.37700186714763
shader_parameter/noiseScroll2 = Vector3(0, 0, 0)
shader_parameter/noiseScrollFromScanDirection2 = 10.0
[sub_resource type="Resource" id="Resource_jquqm"]
script = ExtResource("5_p1cg2")
propertyName = "position"
metadata/_custom_type_script = "uid://rukdqg1uo30"
[sub_resource type="Resource" id="Resource_phuds"]
script = ExtResource("6_uu110")
positionMode = 1
offset = Vector3(0, -0.5, 0)
propertyName = SubResource("Resource_jquqm")
metadata/_custom_type_script = "uid://bn31ol127rm2i"
[sub_resource type="Resource" id="Resource_jv2hp"]
script = ExtResource("5_jquqm")
propertyName = "driver"
metadata/_custom_type_script = "uid://jqgdm3r2u8xq"
[sub_resource type="Resource" id="Resource_ihcvp"]
script = ExtResource("6_phuds")
flashMaterial = SubResource("ShaderMaterial_1sieh")
colorPropertyName = SubResource("Resource_ff4i8")
phasePropertyName = SubResource("Resource_jv2hp")
flashPosition = SubResource("Resource_phuds")
metadata/_custom_type_script = "uid://chl43fdu0vn81"
[sub_resource type="Curve" id="Curve_set2r"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.05454545, 1), 0.0, 0.0, 0, 0, Vector2(0.36969694, 0.33470583), -1.5141176, -1.5141176, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 4
[resource]
script = ExtResource("7_5xn3m")
colorGradient = SubResource("Resource_1d707")
opacityCurve = SubResource("Curve_set2r")
duration = SubResource("Resource_w5yc7")
flashType = SubResource("Resource_ihcvp")
metadata/_custom_type_script = "uid://c78b88pjvobsi"

View File

@ -0,0 +1,56 @@
[gd_resource type="Resource" script_class="FlashPreset" load_steps=13 format=3 uid="uid://510bn18vu41x"]
[ext_resource type="Script" uid="uid://cjyssfkixctwe" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/TemperatureGradient.cs" id="1_2leyg"]
[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_bbgcl"]
[ext_resource type="Script" uid="uid://y2p0r8c5rs45" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/ColorPropertyName.cs" id="3_u0jxk"]
[ext_resource type="Material" uid="uid://72uftobdukh1" path="res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlay WhiteShield.material" id="4_mjl48"]
[ext_resource type="Script" uid="uid://chl43fdu0vn81" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs" id="5_it0s6"]
[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="6_q83s8"]
[sub_resource type="Gradient" id="Gradient_f1y5t"]
offsets = PackedFloat32Array(0, 0.3712, 1)
colors = PackedColorArray(0.24000007, 0.96, 0.8858049, 1, 0, 0.78162026, 1, 1, 0, 0.025296224, 0.8, 1)
[sub_resource type="Resource" id="Resource_kshrd"]
script = ExtResource("1_2leyg")
baseColor = Color(0, 0.78162026, 1, 1)
centerPosition = 0.3712
centerAttraction = 0.0
temperaturePolarBlendRadius = 30.0
startTemperatureShift = 19.2857
startSaturationShift = -10.0
startLightnessShift = 10.0
endTemperatureShift = -45.0
endSaturationShift = 10.0
endLightnessShift = -10.0
outputGradient = SubResource("Gradient_f1y5t")
metadata/_custom_type_script = "uid://cjyssfkixctwe"
[sub_resource type="Resource" id="Resource_llh0f"]
script = ExtResource("2_bbgcl")
metadata/_custom_type_script = "uid://ddhwhwos5kkrm"
[sub_resource type="Resource" id="Resource_cdbbq"]
script = ExtResource("3_u0jxk")
propertyName = "albedo"
metadata/_custom_type_script = "uid://y2p0r8c5rs45"
[sub_resource type="Resource" id="Resource_wt2ea"]
script = ExtResource("5_it0s6")
flashMaterial = ExtResource("4_mjl48")
colorPropertyName = SubResource("Resource_cdbbq")
metadata/_custom_type_script = "uid://chl43fdu0vn81"
[sub_resource type="Curve" id="Curve_fikcq"]
_limits = [0.0, 2.0, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.026515156, 1.8006134), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3
[resource]
script = ExtResource("6_q83s8")
colorGradient = SubResource("Resource_kshrd")
opacityCurve = SubResource("Curve_fikcq")
duration = SubResource("Resource_llh0f")
flashType = SubResource("Resource_wt2ea")
lightEnabled = true
metadata/_custom_type_script = "uid://c78b88pjvobsi"

View File

@ -0,0 +1,89 @@
[gd_resource type="Resource" script_class="FlashPreset" load_steps=17 format=3 uid="uid://brau730pxm8vs"]
[ext_resource type="Script" uid="uid://cjyssfkixctwe" path="res://addons/rokojori_action_library/Runtime/VFX/GradientGenerator/TemperatureGradient.cs" id="1_oyb3j"]
[ext_resource type="Script" uid="uid://ddhwhwos5kkrm" path="res://addons/rokojori_action_library/Runtime/Time/Duration/SecondsDuration.cs" id="2_r88h0"]
[ext_resource type="Script" uid="uid://y2p0r8c5rs45" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/ColorPropertyName.cs" id="3_68boq"]
[ext_resource type="Shader" uid="uid://wpdnt74fu7gs" path="res://addons/rokojori_action_library/Runtime/Shading/Shaders/Effects/TriPlanarOverlay/TriPlanarOverlay.gdshader" id="4_nxqd7"]
[ext_resource type="Script" uid="uid://chl43fdu0vn81" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashTypes/CustomFlashType/CustomFlashType.cs" id="5_0wgqk"]
[ext_resource type="Script" uid="uid://c78b88pjvobsi" path="res://addons/rokojori_action_library/Runtime/VFX/FlashVFX/FlashPreset.cs" id="6_yxd3y"]
[sub_resource type="Gradient" id="Gradient_mxwxr"]
offsets = PackedFloat32Array(0.20638719, 0.3712, 0.65038717)
colors = PackedColorArray(0.96, 0.5802865, 0.24000007, 1, 1, 0.15119159, 0, 1, 0.8, 0, 0.47904664, 1)
[sub_resource type="Resource" id="Resource_vjxa6"]
script = ExtResource("1_oyb3j")
baseColor = Color(1, 0.15119159, 0, 1)
centerPosition = 0.3712
centerAttraction = 0.3363
temperaturePolarBlendRadius = 30.0
startTemperatureShift = 19.2857
startSaturationShift = -10.0
startLightnessShift = 10.0
endTemperatureShift = -45.0
endSaturationShift = 10.0
endLightnessShift = -10.0
outputGradient = SubResource("Gradient_mxwxr")
metadata/_custom_type_script = "uid://cjyssfkixctwe"
[sub_resource type="Resource" id="Resource_ux5u2"]
script = ExtResource("2_r88h0")
metadata/_custom_type_script = "uid://ddhwhwos5kkrm"
[sub_resource type="Resource" id="Resource_v2dhn"]
script = ExtResource("3_68boq")
propertyName = "albedo"
metadata/_custom_type_script = "uid://y2p0r8c5rs45"
[sub_resource type="Gradient" id="Gradient_inhvc"]
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 1)
[sub_resource type="FastNoiseLite" id="FastNoiseLite_xc1mo"]
noise_type = 2
frequency = 0.0225
fractal_type = 0
fractal_lacunarity = 0.76
cellular_return_type = 0
domain_warp_type = 2
domain_warp_amplitude = 7.79
domain_warp_frequency = 0.01
domain_warp_fractal_octaves = 1
domain_warp_fractal_lacunarity = 1.0
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_d3k6i"]
width = 256
height = 256
noise = SubResource("FastNoiseLite_xc1mo")
color_ramp = SubResource("Gradient_inhvc")
seamless = true
seamless_blend_skirt = 0.289
[sub_resource type="ShaderMaterial" id="ShaderMaterial_kadqf"]
render_priority = 0
shader = ExtResource("4_nxqd7")
shader_parameter/albedo = Color(1, 1, 1, 1)
shader_parameter/texture_albedo = SubResource("NoiseTexture2D_d3k6i")
shader_parameter/uv_blend_sharpness = 22.558001071505
shader_parameter/uv_scale = Vector3(2, 2, 2)
shader_parameter/uv_offset = Vector3(0, 0, 0)
shader_parameter/uvMovement = Vector3(0, -0.5, 0.2)
[sub_resource type="Resource" id="Resource_8ybvd"]
script = ExtResource("5_0wgqk")
flashMaterial = SubResource("ShaderMaterial_kadqf")
colorPropertyName = SubResource("Resource_v2dhn")
metadata/_custom_type_script = "uid://chl43fdu0vn81"
[sub_resource type="Curve" id="Curve_pqigg"]
_limits = [0.0, 2.0, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.026515156, 1.8006134), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3
[resource]
script = ExtResource("6_yxd3y")
colorGradient = SubResource("Resource_vjxa6")
opacityCurve = SubResource("Curve_pqigg")
duration = SubResource("Resource_ux5u2")
flashType = SubResource("Resource_8ybvd")
lightEnabled = true
metadata/_custom_type_script = "uid://c78b88pjvobsi"

View File

@ -0,0 +1,33 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public partial class CustomGradient:GradientGenerator
{
[Export]
public Gradient gradient;
public override Gradient GetGradient()
{
return gradient;
}
[Export]
public float repeat = 1f;
public override float GetRepeat()
{
return repeat;
}
[Export]
public GradientExtensions.GradientRepeatMode repeatMode = GradientExtensions.GradientRepeatMode.Clamp;
public override GradientExtensions.GradientRepeatMode GetRepeatMode()
{
return repeatMode;
}
}
}

View File

@ -0,0 +1 @@
uid://ckr83rn42kvf2

View File

@ -0,0 +1,22 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public abstract partial class GradientGenerator:Resource
{
public abstract Gradient GetGradient();
public virtual float GetRepeat()
{
return 1f;
}
public virtual GradientExtensions.GradientRepeatMode GetRepeatMode()
{
return GradientExtensions.GradientRepeatMode.Clamp;
}
}
}

View File

@ -0,0 +1 @@
uid://ch6x28ycuk0xj

View File

@ -0,0 +1,68 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public partial class RainbowGradient:GradientGenerator
{
[Export( PropertyHint.Range, "0,360" )]
public float hueStart = 0;
[Export( PropertyHint.Range, "0,100" )]
public float saturation = 100f;
[Export( PropertyHint.Range, "0,100" )]
public float lightness = 50f;
[Export( PropertyHint.Range, "0,10" )]
public float intensity = 0f;
[Export( PropertyHint.Range, "6,36" )]
public int resolution = 6;
[Export]
public Gradient gradient;
[ExportGroup("Output")]
[ExportToolButton( "Show Output")]
public Callable showOutputButton => Callable.From( ()=> outputGradient = GetGradient() );
[Export]
public Gradient outputGradient;
public override Gradient GetGradient()
{
var colors = new List<Color>();
for ( int i = 0; i < resolution; i++ )
{
var hue = i / (float)( resolution - 1 ) * 360f + hueStart;
hue = MathX.Repeat( hue, 360f );
var color = new HSLColor( hue, saturation / 100f, lightness / 100f );
var rgb = color.ToRGBA();
colors.Add( rgb.WithIntensity( intensity ) );
}
return GradientExtensions.Create( colors );
}
[ExportGroup("Repeat")]
[Export]
public float repeat = 1f;
public override float GetRepeat()
{
return repeat;
}
[Export]
public GradientExtensions.GradientRepeatMode repeatMode = GradientExtensions.GradientRepeatMode.Clamp;
public override GradientExtensions.GradientRepeatMode GetRepeatMode()
{
return repeatMode;
}
}
}

View File

@ -0,0 +1 @@
uid://mer2h3i8xjot

View File

@ -0,0 +1,76 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Flash.svg") ]
public partial class TemperatureGradient:GradientGenerator
{
[Export]
public Color baseColor;
[Export( PropertyHint.Range, "0,1" )]
public float centerPosition = 0.5f;
[Export( PropertyHint.Range, "0,1" )]
public float centerAttraction = 0.25f;
[Export]
public float temperaturePolarBlendRadius = 60f;
[ExportGroup( "Start", "start")]
[Export( PropertyHint.Range, "-180,180")]
public float startTemperatureShift = 0;
[Export( PropertyHint.Range, "-100,100")]
public float startSaturationShift = 0;
[Export( PropertyHint.Range, "-100,100")]
public float startLightnessShift = 0;
[ExportGroup( "End", "end")]
[Export( PropertyHint.Range, "-180,180")]
public float endTemperatureShift = 0;
[Export( PropertyHint.Range, "-100,100")]
public float endSaturationShift = 0;
[Export( PropertyHint.Range, "-100,100")]
public float endLightnessShift = 0;
[ExportGroup("Output")]
[ExportToolButton( "Show Output")]
public Callable showOutputButton => Callable.From( ()=> outputGradient = GetGradient() );
[Export]
public Gradient outputGradient;
[ExportGroup("Repeat")]
[Export]
public float repeat = 1f;
[Export]
public GradientExtensions.GradientRepeatMode repeatMode = GradientExtensions.GradientRepeatMode.Clamp;
public override Gradient GetGradient()
{
var gradient = new Gradient();
gradient.Colors =
[
baseColor.ToHSL().ShiftTemperature( startTemperatureShift, startSaturationShift / 100f, startLightnessShift / 100f, temperaturePolarBlendRadius ),
baseColor,
baseColor.ToHSL().ShiftTemperature( endTemperatureShift, endSaturationShift / 100f, endLightnessShift / 100f, temperaturePolarBlendRadius ),
];
gradient.Offsets =
[
Mathf.Lerp( 0f, centerPosition, centerAttraction ),
centerPosition,
Mathf.Lerp( 1f, centerPosition, centerAttraction ),
];
return gradient;
}
}
}

View File

@ -0,0 +1 @@
uid://cjyssfkixctwe

20
Runtime/VFX/VFXTools.cs Normal file
View File

@ -0,0 +1,20 @@
using Godot;
using System.Collections.Generic;
using System.Linq;
namespace Rokojori
{
public class VFXTools
{
public static List<GeometryInstance3D> GetGeometryInstance3Ds( Node[] targets, bool includeChildren )
{
if ( ! includeChildren )
{
var list = targets.ToList();
return list.FilterType<Node,GeometryInstance3D>();
}
return Nodes.GetAnyChildren<Node>( targets ).FilterType<Node,GeometryInstance3D>();
}
}
}

View File

@ -0,0 +1 @@
uid://kpv1q8b3frge

View File

@ -0,0 +1,55 @@
using System;
using System.Reflection;
using Godot;
namespace Rokojori.Tools;
public abstract partial class GodotEditorAttributeDrawer<A> : GodotEditorInspector<GodotObject> where A : Attribute
{
public GodotObject godotObject;
public override bool _ParseProperty(
GodotObject obj, Variant.Type type, string name,
PropertyHint hintType, string hintString,
PropertyUsageFlags usageFlags, bool wide
)
{
godotObject = obj;
if ( GetValueOfMemberWithAttribute( obj, name, typeof(A), out object value ) )
{
var control = GetPropertyEditor( type, name, hintType, hintString, usageFlags, wide, value );
AddPropertyEditor( name, control );
return true;
}
return base._ParseProperty( obj, type, name, hintType, hintString, usageFlags, wide );
}
protected abstract Control GetPropertyEditor(
Variant.Type type, string name, PropertyHint hintType,
string hintString, PropertyUsageFlags usageFlags, bool wide, object value
);
protected bool GetValueOfMemberWithAttribute(
GodotObject obj, string memberName, Type attributeType, out object resultValue
)
{
resultValue = null;
var flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
var info = ReflectionHelper.GetDataMemberInfo( obj, memberName, flags );
if ( info != null && info.IsDefined( attributeType ) )
{
resultValue = ReflectionHelper.GetDataMemberValue<object>( obj, info );
return true;
}
return false;
}
}

View File

@ -0,0 +1 @@
uid://bm2y1d646juyg

View File

@ -0,0 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using Godot;
namespace Rokojori.Tools;
public abstract partial class GodotEditorInspector<T> : EditorInspectorPlugin where T : GodotObject
{
public override bool _CanHandle( GodotObject obj ) => obj is T t && CanHandle( t );
protected virtual bool CanHandle( T t ) => true;
}

View File

@ -0,0 +1 @@
uid://bsap2ukq7q174