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: 

How to check data type?

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
g2m.agent
359 Views, 6 Replies

How to check data type?

something like this python code:

 

 

if type(var) is list:
    # do list thing
elif type(var) is int:
    # do int thing
elif type(var) is float:
    # do float thing
...

 

 

 

 
6 REPLIES 6
Message 2 of 7

Does this tool what you are looking for?

https://www.youtube.com/watch?v=ISaGk_V6dAg

----------------------------------------------------------------
https://linktr.ee/cg_oglu
Message 3 of 7

no. I want to check the data type inside my custom compound.

and that tool does not work in 2022.
Message 4 of 7
mjcg91
in reply to: g2m.agent

You can't test data types directly like this. if the data is stored as a property or geo_property, then you can test it by checking if the property's data is valid or not when trying to get it.

You could use multiple geo_geo_property_check nodes, all using the same property but each one with the data types you want to test. the found_property port will only return true if both the property and type are valid. For simpler data you could make get_property editable and expose the success port. 

Maxime Jeanmougin - Technical Artist
https://maximejeanmougin.com

Join the Bifrost Addicts community on Discord:
https://discord.gg/bifrost-addicts
Message 5 of 7
g2m.agent
in reply to: g2m.agent

Basically, I want to make a compound to check the array. like this:

maya_qliey6vAmV.png
But it only targets array<float3>.

I have another compound specifically for array<int> and array<float>.

maya_yVf0A43lnq.png

Their processing process is basically the same (numbers_to_string, then string_join), so I wonder if I can combine the two compounds into one, and change it slightly depends on the input data type. but it doesn't seem to work.

Message 6 of 7
mjcg91
in reply to: g2m.agent

If you plan on publishing the compound, then I recommend you make a compound with overloadable port. Basically, depending the input data type of a port, the content of the compound will change.

So you could just make the compound called something like "print_array", have an "array" input, "string_output". You publish the compound a first time with the default data type you want (like float for example), and then you can change the input data type and the content of the compound. After this, re-publish it with overloadable enable, and once you import the compound, it will accept all the data types you've used to publish, and the content will change automatically.

Maxime Jeanmougin - Technical Artist
https://maximejeanmougin.com

Join the Bifrost Addicts community on Discord:
https://discord.gg/bifrost-addicts
Message 7 of 7
g2m.agent
in reply to: g2m.agent

I tried it, but not successful.
I think I'd better wait for the next upgrade of Bifrost. I hope there is a better way.

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

Post to forums  

Autodesk Design & Make Report