diff --git a/Assets/Splash/rokojori-action-library-splash.png b/Assets/Splash/rokojori-action-library-splash.png new file mode 100644 index 0000000..9491319 Binary files /dev/null and b/Assets/Splash/rokojori-action-library-splash.png differ diff --git a/Assets/Splash/rokojori-action-library-splash.png.import b/Assets/Splash/rokojori-action-library-splash.png.import new file mode 100644 index 0000000..8beb0c0 --- /dev/null +++ b/Assets/Splash/rokojori-action-library-splash.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cj3w71yd4boe" +path="res://.godot/imported/rokojori-action-library-splash.png-d751c80b8a8a96ee0087afb0bd27552e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Scripts/Rokojori/Rokojori-Action-Library/Assets/Splash/rokojori-action-library-splash.png" +dest_files=["res://.godot/imported/rokojori-action-library-splash.png-d751c80b8a8a96ee0087afb0bd27552e.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Runtime/Actions/Actions.cs b/Runtime/Actions/Actions.cs index d58060d..796f1b6 100644 --- a/Runtime/Actions/Actions.cs +++ b/Runtime/Actions/Actions.cs @@ -33,5 +33,21 @@ namespace Rokojori Nodes.ForEachDirectChild( target, a => Actions.Trigger( a ) ); } + + public static void TriggerAll( RJAction action, Node target, bool triggerDirectChildren ) + { + if ( action != null ) + { + Actions.Trigger( action ); + + } + + if ( ! triggerDirectChildren ) + { + return; + } + + Nodes.ForEachDirectChild( target, a => Actions.Trigger( a ) ); + } } } \ No newline at end of file diff --git a/Runtime/Actions/OnPhysicsProcess.cs b/Runtime/Actions/OnPhysicsProcess.cs index 5c94aa1..dc170b7 100644 --- a/Runtime/Actions/OnPhysicsProcess.cs +++ b/Runtime/Actions/OnPhysicsProcess.cs @@ -7,13 +7,17 @@ namespace Rokojori [GlobalClass, Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJOnEvent.svg") ] public partial class OnPhysicsProcess : Node { + /** Actions to execute*/ [Export] - public RJAction action; + public RJAction[] actions; + + /** Whether to execute RJAction child nodes*/ + [Export] + public bool triggerDirectChildren = true; public override void _PhysicsProcess( double delta ) { - // RJLog.Log( "OnReady" ); - Actions.Trigger( action ); + Actions.TriggerAll( actions, this, triggerDirectChildren ); } } } \ No newline at end of file diff --git a/Runtime/Actions/OnReady.cs b/Runtime/Actions/OnReady.cs index 6a30730..8652019 100644 --- a/Runtime/Actions/OnReady.cs +++ b/Runtime/Actions/OnReady.cs @@ -7,13 +7,17 @@ namespace Rokojori [GlobalClass, Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJOnEvent.svg") ] public partial class OnReady : Node { + /** Actions to execute*/ [Export] - public RJAction action; + public RJAction[] actions; + + /** Whether to execute RJAction child nodes*/ + [Export] + public bool triggerDirectChildren = true; public override void _Ready() { - // RJLog.Log( "OnReady" ); - Actions.Trigger( action ); + Actions.TriggerAll( actions, this, triggerDirectChildren ); } } } \ No newline at end of file diff --git a/Runtime/Godot/NodeState.cs b/Runtime/Godot/NodeState.cs index 0beef5e..ac2a487 100644 --- a/Runtime/Godot/NodeState.cs +++ b/Runtime/Godot/NodeState.cs @@ -8,19 +8,41 @@ namespace Rokojori public class NodeState { public static void Configure( Node n, bool processEnabled, bool inputEnabled, bool physicsEnabled, bool signalsEnabled, - Node.ProcessModeEnum processMode ) + Node.ProcessModeEnum processMode, bool visible ) { + if ( n == null ) + { + return; + } + n.SetProcess( processEnabled ); n.SetProcessInput( inputEnabled ); n.SetPhysicsProcess( physicsEnabled ); n.SetBlockSignals( ! signalsEnabled ); n.ProcessMode = processMode; + + + if ( n is Node3D ) + { + ( n as Node3D ).Visible = visible; + } + + if ( n is Node2D ) + { + ( n as Node2D ).Visible = visible; + } + + if ( n is CanvasItem ) + { + ( n as CanvasItem ).Visible = visible; + } + } public static void Set( Node n, bool enabled ) { - Configure( n, enabled, enabled, enabled, enabled, enabled ? Node.ProcessModeEnum.Inherit : Node.ProcessModeEnum.Disabled ); + Configure( n, enabled, enabled, enabled, enabled, enabled ? Node.ProcessModeEnum.Inherit : Node.ProcessModeEnum.Disabled, enabled ); } public static void Set( Node[] nodes, bool enabled ) @@ -33,14 +55,19 @@ namespace Rokojori Set( n, true ); } - public static void Enable( Node[] n ) + public static void Enable( params Node[] n ) { Set( n, true ); } public static void Disable( Node n ) { - Set( n, true ); + Set( n, false ); + } + + public static void Disable( params Node[] n ) + { + Set( n, false ); } } diff --git a/Runtime/Godot/Nodes.cs b/Runtime/Godot/Nodes.cs index a8a2e7c..db2caed 100644 --- a/Runtime/Godot/Nodes.cs +++ b/Runtime/Godot/Nodes.cs @@ -69,6 +69,12 @@ namespace Rokojori return default(T); } + public static void ForEachInScene( Action callback ) where T:class + { + var root = Root.Get().GetWindow(); + ForEach( root, callback ); + } + public static void ForEach( Node root, Action callback ) where T:class { var walker = nodesWalker; diff --git a/Runtime/Tools/Lists.cs b/Runtime/Tools/Lists.cs index 62f1028..e2a213d 100644 --- a/Runtime/Tools/Lists.cs +++ b/Runtime/Tools/Lists.cs @@ -19,6 +19,11 @@ namespace Rokojori return list; } + public static List From( params T[] elements ) + { + return ToList( elements ); + } + public static List ToList( T[] array ) { var list = new List(); @@ -122,13 +127,7 @@ namespace Rokojori return sb.ToString(); } - - public static List From( T[] array ) - { - var copy = new List(); - copy.AddRange( array ); - return copy; - } + public static List From( List list ) {