Querying value of a texture attribute



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

    On 19/02/2009 at 16:56, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hi All,

    In my plugin, I'm trying to determine the current value of a texture's animation mode. So I can get the string:

    > \> BaseContainer data = chan->GetData(); \> String timeMode = LongToString(data.GetLong(BASECHANNEL_TIME_MODE, 0)); \>

    Now I want test the value, my naive attempt:

    > \> if (timeMode == "Loop") \> { \>     // do some work \> } \>

    It doesn't seem right to me that I would hard code the actual "Loop" string though, is there a better way to implement this?

    Thanks!



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

    On 19/02/2009 at 18:54, xxxxxxxx wrote:

    OK, I just realized that my previous lame example makes no sense. "LongToString" is not what I want to do.

    So, If I get the data:

    > \> LONG timeMode = data.GetLong(BASECHANNEL_TIME_MODE, 0); \>

    how do I find out if the returned LONG value represents "Simple", "Loop", or "Ping-Pong"?

    I found resource/strings_us/description, which contain GITMAPSHADER_TIMING_MODE_SIMPLE, etc., but I'm not sure how to use it.

    Is this explained in the docs somewhere? If so, point me to it and I'll go away.

    Thanks!



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

    On 20/02/2009 at 00:27, xxxxxxxx wrote:

    The animation mode is a LONG description element with a CYCLE flag. Please have a look at the docu's 'LONG (description elelment)' chapter. CYCLE flag is used to create combobox like description elements. You can find the ID for each entry in the 'Xbitmap.h' file.

    Here is a little example:

    > \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \>      BaseMaterial \*bmat = NULL; \>      bmat = doc->GetFirstMaterial(); \> \>      if(bmat) \>      { \>           BaseChannel \*chn = NULL; \>           chn = bmat->GetChannel(CHANNEL_COLOR); \>           if(chn && chn->GetShaderID()==Xbitmap) \>           { \>                BaseContainer data = chn->GetData(); \>                LONG mode = data.GetLong(BASECHANNEL_TIME_MODE); \>                 \>                switch(mode) \>                { \>                     case BITMAPSHADER_TIMING_MODE_SIMPLE: \>                          // 'Simple' mode, do something \>                          break; \>                     case BITMAPSHADER_TIMING_MODE_LOOP: \>                          // 'Loop' mode, do something \>                          break; \>                     case BITMAPSHADER_TIMING_MODE_PINGPONG: \>                          // 'Ping-Pong' mode, do something \>                          break; \>                } \>           } \>      } \> \>      return TRUE; \> } \>

    cheers,
    Matthias



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

    On 20/02/2009 at 10:59, xxxxxxxx wrote:

    Perfect, thanks!


Log in to reply