Forum

2020.1.0 and enums

Hi.
I try to use enum in gamma.
This us enum code.

[Flags]
public enum QueueFlags
{
    None = 0,
    Graphics = 1,
    Compute = 2,
    Transfer = 4,
    SparseBinding = 8
}

I made a class and forward this enum in class.
When i try to make pad with this class its null
image
but works in last vvvv with 2019.1 vl
image

I also look at enums in skia


and when i try to make it in my class. I’ve got a problem with operations.
I can make only operation = and !=
and can’t others like & ^ |
How can i make it work in 2020.1 gamma?

in newer vvvv gamma versions you don’t need to import the individual operations of a type, just check the “Forward All Nodes” checkbox… so just adding a forward of that enum type is enough. you will then have all the operations in the node browser.

why the type annotations with that enums doesn’t work is not clear to me… however, you can simply use any operation of that type to get a type anchor for the type inference.

this is not clear to me… did you open the solution explorer (CTRL+SHIFT+J) and dragged the enum type into the definitions of your document?

https://vvvv.gitbooks.io/the-gray-book/content/en/reference/libraries/patching-libraries.html

i drag ENUM
image
but i don’t have operations available and iobox show null and can’t choose enum that i need

Library that i used compiled with .NET standart 2.1 if it can help

ok, it seems that this is a bug of the importer, enums with the [Flags] attribute do not work.

thanks for spotting this, I’ll create an issue.

1 Like

Hey!
I had a look at this and looks like my enum with [Flags] doesn’t have any issue.

I put that one into:

Here is another guess what could have gone wrong in your case:

That sounds not right. You shouldn’t try to turn an enum into a class.

Try to drag the whole enum type QueueFlags over and place it directly into your striped Definitions Patch. In your case it’s the entry ENUM QueueFlags, NOT it’s child entry Static Operations.

DO NOT create a class and DO NOT only drag the operations of the enum over.

The enum i messed around with:

[Flags]
public enum ItalianNumbers
{
    Zero                   = 0,

    Uno                    = 0b0001,    // 1
    Due                    = 0b0010,    // 2
    Quattro                = 0b0100,    // 4
    Otto                   = 0b1000,    // 8

    Quindici               = 0xF,       // 15
    Sedici                 = 0x10,      // 16, 0b_0001_0000

    TrentaDue              = 32,        // 0b_0010_0000
    Sessanta­Quattro        = 64,        // 0b_0100_0000
    CentoVent­Otto          = 128,       // 0b_1000_0000

    DueCentoCinquantaSei   = 0x100,     // 256,  0b__0000_0001__0000_0000  (still 16 more bits available. enum ist encoded as 32 bit int by default)

    UnoODue                = Uno | Due, // 0b0011 also known as 3
}

This is weird, the enum in the DemoLib works, but when testing it with the exact same enum as in the first post, it doesn’t work… we’ll investigate.