Polished Nodes/NodeStates
This commit is contained in:
parent
c2c548ae04
commit
a53865f099
Binary file not shown.
After Width: | Height: | Size: 413 KiB |
|
@ -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
|
|
@ -33,5 +33,21 @@ namespace Rokojori
|
||||||
|
|
||||||
Nodes.ForEachDirectChild<RJAction>( target, a => Actions.Trigger( a ) );
|
Nodes.ForEachDirectChild<RJAction>( 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<RJAction>( target, a => Actions.Trigger( a ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,13 +7,17 @@ namespace Rokojori
|
||||||
[GlobalClass, Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJOnEvent.svg") ]
|
[GlobalClass, Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJOnEvent.svg") ]
|
||||||
public partial class OnPhysicsProcess : Node
|
public partial class OnPhysicsProcess : Node
|
||||||
{
|
{
|
||||||
|
/** <summary for="field actions">Actions to execute</summary>*/
|
||||||
[Export]
|
[Export]
|
||||||
public RJAction action;
|
public RJAction[] actions;
|
||||||
|
|
||||||
|
/** <summary for="field triggerDirectChildren">Whether to execute RJAction child nodes</summary>*/
|
||||||
|
[Export]
|
||||||
|
public bool triggerDirectChildren = true;
|
||||||
|
|
||||||
public override void _PhysicsProcess( double delta )
|
public override void _PhysicsProcess( double delta )
|
||||||
{
|
{
|
||||||
// RJLog.Log( "OnReady" );
|
Actions.TriggerAll( actions, this, triggerDirectChildren );
|
||||||
Actions.Trigger( action );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,13 +7,17 @@ namespace Rokojori
|
||||||
[GlobalClass, Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJOnEvent.svg") ]
|
[GlobalClass, Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJOnEvent.svg") ]
|
||||||
public partial class OnReady : Node
|
public partial class OnReady : Node
|
||||||
{
|
{
|
||||||
|
/** <summary for="field actions">Actions to execute</summary>*/
|
||||||
[Export]
|
[Export]
|
||||||
public RJAction action;
|
public RJAction[] actions;
|
||||||
|
|
||||||
|
/** <summary for="field triggerDirectChildren">Whether to execute RJAction child nodes</summary>*/
|
||||||
|
[Export]
|
||||||
|
public bool triggerDirectChildren = true;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
// RJLog.Log( "OnReady" );
|
Actions.TriggerAll( actions, this, triggerDirectChildren );
|
||||||
Actions.Trigger( action );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,19 +8,41 @@ namespace Rokojori
|
||||||
public class NodeState
|
public class NodeState
|
||||||
{
|
{
|
||||||
public static void Configure( Node n, bool processEnabled, bool inputEnabled, bool physicsEnabled, bool signalsEnabled,
|
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.SetProcess( processEnabled );
|
||||||
n.SetProcessInput( inputEnabled );
|
n.SetProcessInput( inputEnabled );
|
||||||
n.SetPhysicsProcess( physicsEnabled );
|
n.SetPhysicsProcess( physicsEnabled );
|
||||||
n.SetBlockSignals( ! signalsEnabled );
|
n.SetBlockSignals( ! signalsEnabled );
|
||||||
|
|
||||||
n.ProcessMode = processMode;
|
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 )
|
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 )
|
public static void Set( Node[] nodes, bool enabled )
|
||||||
|
@ -33,14 +55,19 @@ namespace Rokojori
|
||||||
Set( n, true );
|
Set( n, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Enable( Node[] n )
|
public static void Enable( params Node[] n )
|
||||||
{
|
{
|
||||||
Set( n, true );
|
Set( n, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Disable( Node n )
|
public static void Disable( Node n )
|
||||||
{
|
{
|
||||||
Set( n, true );
|
Set( n, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Disable( params Node[] n )
|
||||||
|
{
|
||||||
|
Set( n, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,12 @@ namespace Rokojori
|
||||||
return default(T);
|
return default(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ForEachInScene<T>( Action<T> callback ) where T:class
|
||||||
|
{
|
||||||
|
var root = Root.Get().GetWindow();
|
||||||
|
ForEach<T>( root, callback );
|
||||||
|
}
|
||||||
|
|
||||||
public static void ForEach<T>( Node root, Action<T> callback ) where T:class
|
public static void ForEach<T>( Node root, Action<T> callback ) where T:class
|
||||||
{
|
{
|
||||||
var walker = nodesWalker;
|
var walker = nodesWalker;
|
||||||
|
|
|
@ -19,6 +19,11 @@ namespace Rokojori
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<T> From<T>( params T[] elements )
|
||||||
|
{
|
||||||
|
return ToList( elements );
|
||||||
|
}
|
||||||
|
|
||||||
public static List<T> ToList<T>( T[] array )
|
public static List<T> ToList<T>( T[] array )
|
||||||
{
|
{
|
||||||
var list = new List<T>();
|
var list = new List<T>();
|
||||||
|
@ -122,13 +127,7 @@ namespace Rokojori
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<T> From<T>( T[] array )
|
|
||||||
{
|
|
||||||
var copy = new List<T>();
|
|
||||||
copy.AddRange( array );
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<T> From<T>( List<T> list )
|
public static List<T> From<T>( List<T> list )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue