Community
Bifrost Forum
Welcome to the Bifrost Forum. This is the place for artists using Bifrost to ask and answer questions, browse popular topics, and share knowledge about creating effects procedurally using Bifrost. You can also visit the Bifrost Community on AREA to download an array of ready-to-use graphs, read Bifrost news and updates, and find the latest tutorials.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Removing duplicates from an array

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
thomas_kutschera
587 Views, 3 Replies

Removing duplicates from an array

I have to figure out a way how to remove duplicates from an array.
My start array is a collection of floats, eg arrayCollection = [0, 1.1, 1.1, 13, 13, 13, 13, 17.5, 17.5].

My goal is to get a second array, arrayFilterd = [0, 1.1, 13, 17.5].

I tried to "remove_from_array" and build_array, but it doesn't work within a loop.

Has anyone a clue how to achieve this?

3 REPLIES 3
Message 2 of 4

I came up with a setup that compares two values and depending on the result (equal or not), replaces the value in the array to the new value or sets it to zero. The problem is the "sequence" array gets overwritten with every loop...

I would somehow need a way to update the new array and populate it with values depending on true or false.

Message 3 of 4

Hi Thomas,

 

I'm attaching a quick compound to show how this can be done with two loops: a for_each and followed by an iterate.

 

To install the compound, just unzip the attachment and copy the .json file to your Bifrost user directory:

 

  • Windows: \Users\username\Autodesk\Bifrost\Compounds
  • macOS: /Users/username/Autodesk/Bifrost/Compounds
  • Linux: /home/username/Autodesk/Bifrost/Compounds

Then, restart Maya (or unload and load the Bifrost plugin).

 

To use it, just connect an array :).

 

I hope that helps. If you have any more questions, just ask.

 

gray


Grahame Fuller
Learning Content Developer
Message 4 of 4

Hi Grahame,

thank you so much for your compound, it does exactly what I was looking for! I´ll have a deeper look in your solution now.

Thomas

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report