Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge into my branch #28

Merged
merged 8 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions ProjectObsidian/ProtoFlux/Actions/TweenPosition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System.Threading.Tasks;
using Elements.Core;
using FrooxEngine;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Actions
{
[NodeCategory("Obsidian/Actions")]
public class TweenPosition : AsyncActionNode<ExecutionContext>
{
public ValueInput<float3> To;
public ValueInput<float3> From;
[Core.DefaultValueAttribute(1f)]
public ValueInput<float> Duration;
[Core.DefaultValueAttribute(CurvePreset.Smooth)]
public ValueInput<CurvePreset> Curve;
public ValueInput<bool> ProportionalDuration;
public ObjectInput<Slot> Target;
public AsyncCall OnStarted;
public Continuation OnDone;

protected override async Task<IOperation> RunAsync(ExecutionContext context)
{
IField <float3> field = Target.Evaluate(context).Position_Field;
if (field == null)
{
return null;
}
float3 val = field.Value;
float3 val2 = field.Value;
if (To.Source != null)
{
val2 = To.Evaluate(context);
}
if (From.Source != null)
{
val = From.Evaluate(context);
}
float num = Duration.Evaluate(context, 1f);
bool num2 = ProportionalDuration.Evaluate(context, defaultValue: false);
CurvePreset curve = Curve.Evaluate(context, CurvePreset.Smooth);
if (num2 && Coder<float3>.SupportsDistance)
{
float num3 = Coder<float3>.Distance(val, val2);
if (num3.IsValid())
{
num *= num3;
}
}
TaskCompletionSource<bool> completion = new TaskCompletionSource<bool>();
field.TweenFromTo(val, val2, num, curve, null, delegate
{
completion.SetResult(result: true);
});
await OnStarted.ExecuteAsync(context);
await completion.Task;
return OnDone.Target;
}
}
}
61 changes: 61 additions & 0 deletions ProjectObsidian/ProtoFlux/Actions/TweenRotation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System.Threading.Tasks;
using Elements.Core;
using FrooxEngine;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Actions
{
[NodeCategory("Obsidian/Actions")]
public class TweenRotation : AsyncActionNode<ExecutionContext>
{
public ValueInput<floatQ> To;
public ValueInput<floatQ> From;
[Core.DefaultValueAttribute(1f)]
public ValueInput<float> Duration;
[Core.DefaultValueAttribute(CurvePreset.Smooth)]
public ValueInput<CurvePreset> Curve;
public ValueInput<bool> ProportionalDuration;
public ObjectInput<Slot> Target;
public AsyncCall OnStarted;
public Continuation OnDone;

protected override async Task<IOperation> RunAsync(ExecutionContext context)
{
IField <floatQ> field = Target.Evaluate(context).Rotation_Field;
if (field == null)
{
return null;
}
floatQ val = field.Value;
floatQ val2 = field.Value;
if (To.Source != null)
{
val2 = To.Evaluate(context);
}
if (From.Source != null)
{
val = From.Evaluate(context);
}
float num = Duration.Evaluate(context, 1f);
bool num2 = ProportionalDuration.Evaluate(context, defaultValue: false);
CurvePreset curve = Curve.Evaluate(context, CurvePreset.Smooth);
if (num2 && Coder<floatQ>.SupportsDistance)
{
float num3 = Coder<floatQ>.Distance(val, val2);
if (num3.IsValid())
{
num *= num3;
}
}
TaskCompletionSource<bool> completion = new TaskCompletionSource<bool>();
field.TweenFromTo(val, val2, num, curve, null, delegate
{
completion.SetResult(result: true);
});
await OnStarted.ExecuteAsync(context);
await completion.Task;
return OnDone.Target;
}
}
}
61 changes: 61 additions & 0 deletions ProjectObsidian/ProtoFlux/Actions/TweenScale.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System.Threading.Tasks;
using Elements.Core;
using FrooxEngine;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Actions
{
[NodeCategory("Obsidian/Actions")]
public class TweenScale: AsyncActionNode<ExecutionContext>
{
public ValueInput<float3> To;
public ValueInput<float3> From;
[Core.DefaultValueAttribute(1f)]
public ValueInput<float> Duration;
[Core.DefaultValueAttribute(CurvePreset.Smooth)]
public ValueInput<CurvePreset> Curve;
public ValueInput<bool> ProportionalDuration;
public ObjectInput<Slot> Target;
public AsyncCall OnStarted;
public Continuation OnDone;

protected override async Task<IOperation> RunAsync(ExecutionContext context)
{
IField<float3> field = Target.Evaluate(context).Scale_Field;
if (field == null)
{
return null;
}
float3 val = field.Value;
float3 val2 = field.Value;
if (To.Source != null)
{
val2 = To.Evaluate(context);
}
if (From.Source != null)
{
val = From.Evaluate(context);
}
float num = Duration.Evaluate(context, 1f);
bool num2 = ProportionalDuration.Evaluate(context, defaultValue: false);
CurvePreset curve = Curve.Evaluate(context, CurvePreset.Smooth);
if (num2 && Coder<float3>.SupportsDistance)
{
float num3 = Coder<float3>.Distance(val, val2);
if (num3.IsValid())
{
num *= num3;
}
}
TaskCompletionSource<bool> completion = new TaskCompletionSource<bool>();
field.TweenFromTo(val, val2, num, curve, null, delegate
{
completion.SetResult(result: true);
});
await OnStarted.ExecuteAsync(context);
await completion.Task;
return OnDone.Target;
}
}
}
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Devices/ViveTrackerBattery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using ProtoFlux.Runtimes.Execution;
using Obsidian;

namespace ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Input;
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Devices;

[NodeCategory("Obsidian/Devices")]
public class ViveTrackerBattery : VoidNode<FrooxEngineContext>
Expand Down
19 changes: 19 additions & 0 deletions ProjectObsidian/ProtoFlux/Interaction/FindGrabbableFromSlot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using FrooxEngine;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Users.Avatar
{
[ContinuouslyChanging]
[NodeCategory("ProtoFlux/Obsidian/Avatar")]
public class FindGrabbableFromSlot : ObjectFunctionNode<ExecutionContext, IGrabbable>
{
public readonly ObjectInput<Slot> Slot;

protected override IGrabbable Compute(ExecutionContext context)
{
Slot slot = Slot.Evaluate(context);
return slot == null ? null : slot.GetComponentInParents<Grabbable>();
}
}
}
33 changes: 33 additions & 0 deletions ProjectObsidian/ProtoFlux/Slots/CreateEmptySlot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using FrooxEngine;
using FrooxEngine.ProtoFlux;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Users.Avatar
{
[ContinuouslyChanging]
[NodeCategory("ProtoFlux/Obsidian/Slots")]
public class CreateEmptySlot : ActionBreakableFlowNode<FrooxEngineContext>
{
public readonly ObjectInput<Slot> Parent;
public readonly ObjectInput<string> Name;
public readonly ObjectInput<string> Tag;
public readonly ValueInput<bool> Persistent;
public readonly ValueInput<bool> Active;

public readonly ObjectOutput<Slot> Slot;

protected override bool Do(FrooxEngineContext context)
{
Slot slot = context.LocalUser.LocalUserSpace.AddSlot();
slot.Parent = Parent.Evaluate(context);
slot.Name = Name.Evaluate(context);
slot.Tag = Tag.Evaluate(context);
slot.PersistentSelf = Persistent.Evaluate(context);
slot.ActiveSelf = Active.Evaluate(context);

Slot.Write(slot, context);
return true;
}
}
}
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Strings/CountSubstring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Strings
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
[NodeCategory("Obsidian/String")]
public class CountSubstringNode : ValueFunctionNode<FrooxEngineContext, int>
Expand Down
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Strings/DecodeBase64Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Strings
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
[NodeCategory("Obsidian/String")]
public class DecodeBase64Node : ObjectFunctionNode<FrooxEngineContext, string>
Expand Down
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Strings/DecodeMorseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Strings
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
[NodeCategory("Obsidian/String")]
public class DecodeMorseNode : ObjectFunctionNode<FrooxEngineContext, string>
Expand Down
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Strings/EncodeBase64Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Strings
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
[NodeCategory("Obsidian/String")]
public class EncodeBase64Node : ObjectFunctionNode<FrooxEngineContext, string>
Expand Down
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Strings/EncodeMD5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Strings
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
[NodeCategory("Obsidian/String")]
public class EncodeMD5Node : ObjectFunctionNode<FrooxEngineContext, string>
Expand Down
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Strings/EncodeMorse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using ProtoFlux.Runtimes.Execution;
using Obsidian;

namespace ProtoFlux.Runtimes.Execution.Nodes.Strings
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
[NodeCategory("Obsidian/String")]
public class EncodeMorseNode : ObjectFunctionNode<FrooxEngineContext, string>
Expand Down
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Strings/EncodeSHA256.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Strings
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
[NodeCategory("Obsidian/String")]
public class EncodeSha256Node : ObjectFunctionNode<FrooxEngineContext, string>
Expand Down
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Strings/HMAC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Strings
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
public enum HashFunction
{
Expand Down
2 changes: 1 addition & 1 deletion ProjectObsidian/ProtoFlux/Strings/HammingDistanceNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Strings
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
[NodeCategory("Obsidian/String")]
public class HammingDistanceNode : ObjectFunctionNode<FrooxEngineContext, int?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.Strings
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Strings
{
[NodeCategory("Obsidian/String")]
public class HammingDistanceNonNullableNode : ValueFunctionNode<FrooxEngineContext, int>
Expand Down
24 changes: 24 additions & 0 deletions ProjectObsidian/ProtoFlux/Users/Avatar/AvatarRootSlot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Collections.Generic;
using FrooxEngine;
using FrooxEngine.CommonAvatar;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Users.Avatar
{
[ContinuouslyChanging]
[NodeCategory("ProtoFlux/Obsidian/Avatar")]
public class AvatarRootSlot : ObjectFunctionNode<ExecutionContext, Slot>
{
public readonly ObjectInput<User> User;

protected override Slot Compute(ExecutionContext context)
{
User user = User.Evaluate(context);
Slot slot = user.Root.Slot;
List<AvatarRoot> list = new List<AvatarRoot>();
slot.GetFirstDirectComponentsInChildren(list);
return user == null || list.Count == 0 ? null : list[0].Slot;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;

namespace ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Locomotion
namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Locomotion
{
[ContinuouslyChanging]
[NodeCategory("Obsidian/Locomotion")]
Expand Down
Loading