Sort Plugin

[WIP] Plugin: Fuzzytotems’ TArray Plugin 0.4 RC 1 BETA

This plugin is currently in very early development stages.  This plugin will provide more access to TArray features within Blueprints.  Hopefully these nodes will make the lives of Blueprint users better/easier.

New additions:

  • Blueprint access to Heap functionality

Existing features:

  • Blueprint access to TArray.Sort() for int32
  • Blueprint access to TArray.Sort() for float
  • Blueprint access to TArray.Sort() for FString
  • Blueprint access to TArray.Sort() for FName
  • Blueprint enumeration that acts as sort modifier
  • ISortable interface for objects that allows for sorting predicate to be implemented in Blueprints
  • Blueprint access to TArray.Sort() for Objects
  • Blueprint access to TArray Heap functionality for all of the above
  • New QueueWrapper Object in Blueprint (runs on Unreal’s TQueue, not the STL Queue)
  • Access to Peek, Enqueue, Dequeue, and IsEmpty
  • QueueWrapper only accepts UObjects and children of UObjects
  • Optional class enforcement mode

Current plans:

  • Blueprint access to a text writer

Possible long-term additions:

  • Blueprint access to a TMap and TMultiMap wrapper (Not absolute access)
  • Blueprint access to a text writer
  • Blueprint access to TSet and TMultiSet wrapper (Not absolute access)

Test Builds [0.4 RC 1 BETA]:

Compiled Plugin:

Built-0-4-RC1 [7z] ~17.56 MB
Built-0-4-RC1 [zip] ~29.12 MB

Source:
Master source branch here

 

Stable Builds [0.3 RC1 BETA]:

Compiled Plugin:
Built-0-3-RC1 [7z] ~17.53 MB
Built-0-3-RC1 [zip] ~29 MB

Source:
Stable source branch here


How do I install this plugin?

Go into your project’s folder.  If there is no folder named “Plugins”, create a folder with that exact name.  Once you’ve created it (or one already exists), go into it, and extract the 7z/ZIP file in there.  The plugin is already nested inside of a folder so that you do not need to create a folder within the “Plugins” folder.

What isn’t working yet?

Heap sort for objects does not work at this time.  It will simply return false.

How do I use this plugin?

Sorting

Sorting is simple!

For sorting, it is nothing more than:

View post on imgur.com

That’s it.  The keywords are already set up for int32, float, string, and name arrays.  Just drag out from the array, type “sort”, and the proper node will appear in the context sensitive menu.

For objects, you will need to do the following…

View post on imgur.com

Go into the class settings of your Blueprint object.

View post on imgur.com

On the right side, click “Add”, and select “ISortable”.  Once you do that, you should see the “Fuzzytotems TArray->Compare” on the left side as so

View post on imgur.com

Once inside there, you will see a function that takes one object as a parameter and returns a boolean.  This is your sort predicate.  This is the function that is called by the sort.

Using the Queue Wrapper

The Queue Wrapper is still very simple.  There are a few more steps, though.

View post on imgur.com

View post on imgur.com

Once you’ve placed that node, set the class of the object to “QueueWrapper”.  Promote that to variable.  Set the “Outer” to the actor that will be the owner of this object.  It is now set up and ready to use!  It is as easy as that!

The next two nodes that I will demonstrate are optional nodes.

View post on imgur.com

The first node you see is “Enforce Same Class”.  You can find it by searching any of these key words: “Queue Enforce Same Class Matching Restrict”.  By setting “IsEnforcing” to true, you must set the next node.  If you leave “IsEnforcing” to false (or don’t set it), the second node does nothing.

The second node seen above is “Set Enforced Class”.  This node can be found by searching for any of these keywords: “Queue Enforced Class”.  This node allows you to set the parent class that you wish for all children to be.  In the above image, I set it to RNG.  Children of RNG are approved, but non-children of RNG are not added to the queue even if you attempt to add them.

View post on imgur.com

This is the enqueue node.  It can be found with any of the following keywords: “Enqueue Add Queue Insert Head Push Emplace +”.  The boolean return value indicates if the value was enqueued or not.  If you are enforcing a class restriction from earlier, it will return “false” here.

View post on imgur.com

This is the dequeue node.  It can be found with any of the following keywords: “Dequeue Remove Queue Tail Pop Remove -“.  The object returned is the object popped from the queue.  The boolean returned indicates whether the action was successful or not.

View post on imgur.com

This is the is empty node.  It can be found with any of the following keywords: “Queue Contains Empty IsEmpty Zero Blank”.  It checks if the queue has anything in it.  The boolean returned is true if it is empty, and it is false if it has 1 or more objects in it.

View post on imgur.com

This is the Peek node.  It can be found with any of the following keywords: “Queue Peek First Top Tail Look”.  The object it returns is the object that would be popped if you called dequeue.  The boolean it returns indicates success or failure.

Leave a Reply