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

New Nodes: FindGrabbableFromSlot.cs AvatarRootSlot.cs CreateEmptySlot.cs #17

Closed
wants to merge 0 commits into from

Conversation

LeCloutPanda
Copy link
Contributor

Don't know if it works or not but good luck.
You need to make bindings because I don't know how.

Copy link
Owner

@Xlinka Xlinka left a comment

Choose a reason for hiding this comment

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

Binding

Copy link
Owner

Choose a reason for hiding this comment

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

using FrooxEngine;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;
using ProtoFlux.Users.Avatar;

[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Avatar" })]
public class FindGrabbableFromSlotBinding : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode<ExecutionContext, IGrabbable>
{
    public readonly SyncRef<INodeObjectOutput<Slot>> Slot;

    public override Type NodeType => typeof(FindGrabbableFromSlot);

    public FindGrabbableFromSlot TypedNodeInstance { get; private set; }

    public override INode NodeInstance => TypedNodeInstance;

    public override int NodeInputCount => base.NodeInputCount + 1;

    public override N Instantiate<N>()
    {
        if (TypedNodeInstance != null)
        {
            throw new InvalidOperationException("Node has already been instantiated");
        }
        FindGrabbableFromSlot findGrabbableFromSlotInstance = (TypedNodeInstance = new FindGrabbableFromSlot());
        return findGrabbableFromSlotInstance as N;
    }

    protected override void AssociateInstanceInternal(INode node)
    {
        if (node is FindGrabbableFromSlot typedNodeInstance)
        {
            TypedNodeInstance = typedNodeInstance;
            return;
        }
        throw new ArgumentException("Node instance is not of type " + typeof(FindGrabbableFromSlot));
    }

    public override void ClearInstance()
    {
        TypedNodeInstance = null;
    }

    protected override ISyncRef GetInputInternal(ref int index)
    {
        ISyncRef inputInternal = base.GetInputInternal(ref index);
        if (inputInternal != null)
        {
            return inputInternal;
        }
        if (index == 0)
        {
            return Slot;
        }
        index -= 1;
        return null;
    }
}

Copy link
Owner

Choose a reason for hiding this comment

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

using System;
using FrooxEngine;
using FrooxEngine.ProtoFlux;
using FrooxEngine.ProtoFlux.Runtimes.Execution;
using ProtoFlux.Core;
using ProtoFlux.Users.Avatar;

[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Slots" })]
public class CreateEmptySlotBinding : ActionBreakableFlowNode<FrooxEngineContext>
{
    public readonly SyncRef<INodeObjectOutput<Slot>> Parent;
    public readonly SyncRef<INodeObjectOutput<string>> Name;
    public readonly SyncRef<INodeObjectOutput<string>> Tag;
    public readonly SyncRef<INodeValueOutput<bool>> Persistent;
    public readonly SyncRef<INodeValueOutput<bool>> Active;

    public readonly SyncRef<INodeObjectInput<Slot>> Slot;

    public override Type NodeType => typeof(CreateEmptySlot);

    public CreateEmptySlot TypedNodeInstance { get; private set; }

    public override INode NodeInstance => TypedNodeInstance;

    public override int NodeInputCount => base.NodeInputCount + 5;

    public override int NodeOutputCount => base.NodeOutputCount + 1;

    public override N Instantiate<N>()
    {
        if (TypedNodeInstance != null)
        {
            throw new InvalidOperationException("Node has already been instantiated");
        }
        TypedNodeInstance = new CreateEmptySlot();
        return TypedNodeInstance as N;
    }

    protected override void AssociateInstanceInternal(INode node)
    {
        if (node is CreateEmptySlot typedNodeInstance)
        {
            TypedNodeInstance = typedNodeInstance;
            return;
        }
        throw new ArgumentException("Node instance is not of type " + typeof(CreateEmptySlot));
    }

    public override void ClearInstance()
    {
        TypedNodeInstance = null;
    }

    protected override ISyncRef GetInputInternal(ref int index)
    {
        ISyncRef inputInternal = base.GetInputInternal(ref index);
        if (inputInternal != null)
        {
            return inputInternal;
        }
        switch (index)
        {
            case 0:
                return Parent;
            case 1:
                return Name;
            case 2:
                return Tag;
            case 3:
                return Persistent;
            case 4:
                return Active;
            default:
                index -= 5;
                return null;
        }
    }

    protected override ISyncRef GetOutputInternal(ref int index)
    {
        ISyncRef outputInternal = base.GetOutputInternal(ref index);
        if (outputInternal != null)
        {
            return outputInternal;
        }
        if (index == 0)
        {
            return Slot;
        }
        index -= 1;
        return null;
    }
}

Copy link
Owner

@Xlinka Xlinka Apr 3, 2024

Choose a reason for hiding this comment

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

using System;
using FrooxEngine;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;
using ProtoFlux.Users.Avatar;

[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Avatar" })]
public class AvatarRootSlotBinding : ObjectFunctionNode<ExecutionContext, Slot>
{
    public readonly SyncRef<INodeObjectOutput<User>> User;

    public override Type NodeType => typeof(AvatarRootSlot);

    public AvatarRootSlot TypedNodeInstance { get; private set; }

    public override INode NodeInstance => TypedNodeInstance;

    public override int NodeInputCount => base.NodeInputCount + 1;

    public override N Instantiate<N>()
    {
        if (TypedNodeInstance != null)
        {
            throw new InvalidOperationException("Node has already been instantiated");
        }
        TypedNodeInstance = new AvatarRootSlot();
        return TypedNodeInstance as N;
    }

    protected override void AssociateInstanceInternal(INode node)
    {
        if (node is AvatarRootSlot typedNodeInstance)
        {
            TypedNodeInstance = typedNodeInstance;
            return;
        }
        throw new ArgumentException("Node instance is not of type " + typeof(AvatarRootSlot));
    }

    public override void ClearInstance()
    {
        TypedNodeInstance = null;
    }

    protected override ISyncRef GetInputInternal(ref int index)
    {
        if (index == 0)
        {
            return User;
        }
        index -= 1;
        return base.GetInputInternal(ref index);
    }
}

@Xlinka
Copy link
Owner

Xlinka commented Apr 4, 2024

Will test Nodes Later today then if they all work will merge.

@Xlinka Xlinka changed the title Added more crap New Nodes: FindGrabbableFromSlot.cs AvatarRootSlot.cs CreateEmptySlot.cs Apr 4, 2024
@Xlinka Xlinka added the enhancement New feature or request label Apr 4, 2024
@Xlinka Xlinka self-assigned this Apr 4, 2024
@github-actions github-actions bot added the Has Conflicts Has conflicts on merge. label Apr 17, 2024
@Xlinka
Copy link
Owner

Xlinka commented Apr 19, 2024

dont use bindings now since the new binding generator and can you fix the merge conflicts so i can merge this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Has Conflicts Has conflicts on merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants