How to use GeGetVersionType



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/08/2004 at 11:00, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.100 
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Howdy,

    I'd like to have my plugin check to see if it's running with a demo version of C4D, but I'm not sure I understand how to use GeGetVersionType().

    I tried this...

    LONG cVersion = GeGetVersionType();
    if (cVersion == VERSION_DEMO)

    ...but that's obviously wrong.

    When I printed the LONG value, the number came up 147.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/08/2004 at 12:17, xxxxxxxx wrote:

    if(GeGetVersionType()&VERSION;_DEMO)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/08/2004 at 14:06, xxxxxxxx wrote:

    Howdy,

    Thanks Samir. That worked, only I decided to use it this way:

    if (!(GeGetVersionType()&VERSION;_DEMO))

    Just out of curiosity, can you offer an explination as to what the &VERSION;_DEMO after the function call actually means?

    Thanks again.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/08/2004 at 00:20, xxxxxxxx wrote:

    & is a bitwise logical AND operator. Bits between the two comparators that are both 1 remain 1 while those that aren't are 0.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/08/2004 at 05:28, xxxxxxxx wrote:

    Exactly and as these are bitflags they can only be checked with the bit operator. (sometimes it works with a relational operator but don´t trust them :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/08/2004 at 07:21, xxxxxxxx wrote:

    Howdy,

    Aha, I think I understand now, but double check me on this.

    When GeGetVersionType() returns the long value 147, it's binary form is 10010011 (the demo version), and when it returns 131, it's binary form is 10000011 (my licensed version). The version bits are shown in the operatingsystem.h file as:

    // GeGetVersionType
    #define VERSION_CINEMA4D          (1<<0)
    #define VERSION_BODYPAINT          (1<<1)
    #define VERSION_NET                         (1<<2)
    #define VERSION_SERVER               (1<<3)
    #define VERSION_DEMO                    (1<<4)
    #define VERSION_BENCHMARK          (1<<6)
    #define VERSION_BODYPAINT2     (1<<7)

    The line #define VERSION_DEMO   (1<<4) is saying that VERSION_DEMO is 00010000 (in binary form). So, using the & operator on the returned value and the VERSION_DEMO value...

    10010011 - GeGetVersionType()
    00010000 - VERSION_DEMO

    will return a result of 00010000 which is TRUE for that bit and...

    10000011 - GeGetVersionType()
    00010000 - VERSION_DEMO

    will return a result of 00000000 which is FALSE for that bit.

    Is this correct?

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/08/2004 at 06:51, xxxxxxxx wrote:

    Si :)
    In general, use & to check bits, and | to set bits.
    a & b = ( b if all bits of b are set in a; != b else )
    a | b = c, where c is a plus all set bits of b


Log in to reply