Is the tag an expression tag?



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

    On 06/01/2006 at 21:54, xxxxxxxx wrote:

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

    ---------
    Howdy,

    I'm cycling through an object's tags and I want to know which tags are expression tags. I'm not interested in the type of expression tag it is, just want to know if it IS an expression tag.

    I would image I need to check if the tag has the TAG_EXPRESSION flag set, but I'm not sure how to do this.

    Adios,
    Cactus Dan



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

    On 07/01/2006 at 01:10, xxxxxxxx wrote:

    You should be able to do this:

    if (tag->IsInstanceOf(Texpression)) // it's an expression tag

    This should work for any tag derived from Texpression.

    So, to go through the list:

    for (BaseTag* tag = obj->GetFirstTag(); tag; tag = tag->GetNext())
    {
    if (tag->IsInstanceOf(Texpression)) // do your thing
    }

    The reason to do this instead of obj->GetTag(type, nr) is that it only gets tags of specific types.



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

    On 07/01/2006 at 09:12, xxxxxxxx wrote:

    Howdy,

    Well, that's what I thought at first, too, but it doesn't work. I get an "undefined identifier" error. Texpression doesn't seem to be defined in the API (ge_prepass.h file) and in doing a search for it in the SDK project files, turns up nothing. Texpression seems to only be used for the AM description .h file.

    There are other expression tag types listed in ge_prepass.h like, Tcoffeeexpression, Ttargetexpression, Tfixexpression, Tikexpression, etc.
    But, there doesn't seem to be a Texpression defined.

    Unless there is another .h file that needs to be included in my project, that is not included in the SDK project files?

    I vaguely remember having someone show me once how to use bitwise operators to check bit flags, but I don't really know what I'm doing there.

    Adios,
    Cactus Dan



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

    On 07/01/2006 at 10:24, xxxxxxxx wrote:

    I see that there is Texpressionplugin mentioned in the docs, but not Texpression. It is also mentioned in Texpression.res, but not defined. That does make it sort of difficult, doesn't it?

    You might want to go with the TAG_EXPRESSION check. Use (BaseList2D).GetInfo() to get the tag's flags and then do the check thus:

    for (BaseTag* tag = obj->GetFirstTag(); tag; tag = tag->GetNext())
    {
    if (tag->GetInfo() & TAG_EXPRESSION) // do your thing
    }



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

    On 07/01/2006 at 10:43, xxxxxxxx wrote:

    The bitwise operators can be a pain in the posterior. :) Although much can be done with them, my general usages are setting, unsetting, and checking bits.

    You know how to set a bunch of bits: FLAG1|FLAG2|FLAG3

    Setting individual bits on a variable is similar: flags |= FLAG1. And flags |= (FLAG1|FLAG2).

    Unsetting individual bits is strange ('~' is the unary/bitwise 'one's complement') : flags &= ~FLAG1.

    Checking bits, as shown in the previously post, is: var & FLAG1. Simply use '!' for inverse checks: if (!(var & FLAG1)). Not fancy, but more intuitive than other possible ways of doing the same.

    Bitwise operators are somewhat mysterious, but for coding they are indispensible. For instance, I never do this with integers: a = b / 2 (or any power of 2). Divides are expensive, even when integral. In these cases, best to use the shift operator: a = b >> 1. And you can do multiplication of integers by powers of 2 by going the other way: (a = b << 1) is the same as (a = b * 2).

    That's the lesson for today! :)



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

    On 07/01/2006 at 11:21, xxxxxxxx wrote:

    Howdy,

    Thanks Robert. Once again, you've saved the day. :)

    That works great. I hope I can retain that in memory so the next time I need something similar I can remember. :(

    An odd thing though is, I did this as a test:

      
    for (BaseTag* tag = op->GetFirstTag(); tag; tag = tag->GetNext())  
    {  
          if (tag->GetInfo() & TAG_EXPRESSION)  
          {  
               GePrint(tag->GetName()+" - Expression tag detected");  
          }  
          else GePrint(tag->GetName()+" - not an expression tag");  
    }  
    

    ... and it printed this to the console:
    Target - Expression tag detected
    Phong - not an expression tag
    UVW - not an expression tag
    - not an expression tag
    - not an expression tag

    Not that it's important, but it's got me curious what those other two "nameless" tags are. I only had a Target, Phong and UVW tag on the test object. Tag Manager also showed no other tags on the object.

    Adios,
    Cactus Dan



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

    On 07/01/2006 at 13:44, xxxxxxxx wrote:

    Dan, do what I do (my memory retention is not so great either) and save this page. For 'snippets' of useful SDK information, I've created a snippets text file in which all of these useful, but oft-forgotten pieces of information are stored. Now if I could only remember where the file is... ;)

    Very interesting about those myster tags. I do know that plugin tags can be made undetectable (no TAG_VISIBLE in the RegisterTagPlugin() flags) as well as hidden from use (PLUGINFLAG_HIDE and PLUGINFLAG_HIDEPLUGINMENU). Wonder if these aren't tags used by Cinema 4D of which we are not privy?


Log in to reply