Find my Tag ??



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

    On 26/03/2011 at 12:15, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11.5 
    Platform:      Mac OSX  ; 
    Language(s) :   C.O.F.F.E.E  ;    PYTHON  ;

    ---------
    Hi, I am stuck with this problem :

    using a coffee tag i want to find "myself"! (my tag, the tag which runs the code)

    main(doc,op)
    {
        var myTag;
        myTag = op->GetFirstTag();      
        
        while (myTag)
        {
            myTag = myTag->GetNext();

    // now how do I find myself???
          // how do I know which myTag is me, the tag this code is running in?
          // there might be even 2 instances of this coffee tag on the object :P
        }
    }

    somehow it must be possible to find "myself"
    i need it because i have userdata on the coffee tag which i want to access
    and i want to be able to have 2 or more of my tags on an object and still find the correct userdata
    (the userdata of the tag whose code is actually executed)
    so using the tags name or id probably wont work because it is the same if i have 2 instances of the tag

    anybody with help on this?
    if not in coffee maybe for a pyhon tag

    thanks steve coffee tag



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

    On 26/03/2011 at 12:40, xxxxxxxx wrote:

    in C++ you would do something like,,

      
     if(myTag->IsInstanceOf(TAGPLUGIN_ID){  
      
    //do something  
      
    }  
    

    not sure if COFFEE has that function but that's how you'd do it with C++  sorry I don't know the COFFEE SDK..

    ~Shawn



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

    On 26/03/2011 at 12:48, xxxxxxxx wrote:

    is the id an unique id for each tag instance ?

    and how do i know my id ?

    :D



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

    On 26/03/2011 at 12:49, xxxxxxxx wrote:

    Looks like the COFFEE equivalent if IsInstanceOf()   is

    instanceof()_<_h4_>_

    the ID is the unique ID for your Tag plugin.



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

    On 26/03/2011 at 12:50, xxxxxxxx wrote:

    btw its no plugin...

    just a simple coffee tag (with userdata i want to find from inside)

    i think instanceof just finds an instance of a plugin by pluginid (?)

    i still have no clue how to address this problem



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

    On 26/03/2011 at 12:53, xxxxxxxx wrote:

    yeah you are right..  let me look at the SDK and get back to you in a min..



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

    On 26/03/2011 at 12:56, xxxxxxxx wrote:

    while I'm looking  you could find an instance of a coffee tag   using the above method...

    just do

    instanceof(Tcoffeeexpression)



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

    On 26/03/2011 at 13:02, xxxxxxxx wrote:

    found this...

    http://www.py4d.com/forum/?wpforumaction=viewtopic&t;=15.0

    (python)

    but still it finds just a type of a tag... not exactly myself :)

    hey thanks for the support shawn !



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

    On 26/03/2011 at 13:04, xxxxxxxx wrote:

    and this... which exactly addresses the same problem

    http://www.psd-tutorials.de/forum/145_c4d-xpresso-thinking-particles-c-o-f-f-e-e-und-py4d/122097-coffee-tag-aufspa-ren.html

    sadly no solution :/



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

    On 26/03/2011 at 13:15, xxxxxxxx wrote:

    Looks like you asked this question before.  :)

    https://plugincafe.maxon.net/topic/3744/3182_coffee-tag-finding-itself-&KW=get+coffee+expression+tag&PID=12984#12984



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

    On 26/03/2011 at 13:33, xxxxxxxx wrote:

    :) oi... this was 2008

    i knew i had the problem before...
    but still ... it is totally unsolved :(



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

    On 26/03/2011 at 13:35, xxxxxxxx wrote:

    lol...    I am not finding a satisfactory answer on my end.  But again,  I am not all that familiar with the COFFEE SDK..  lol   Sorry!



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

    On 26/03/2011 at 14:23, xxxxxxxx wrote:

    The reference 'op' in Coffee tag is not the same as in a Python tag. 'op' in a Coffee tag references
    the object where your tag is attached to. In Python its the tag itself.



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

    On 26/03/2011 at 16:14, xxxxxxxx wrote:

    It's always safest to declare your object in both languages with "obj". Or whatever you prefer.
    That way it's less confusing.

    Here's an example of selecting a tag by it's name:

    var obj = doc->GetActiveObject();  
    if(!obj)return; // Error handling if no object was selected  
      
    var ft = obj->GetFirstTag(); // Get the first tag on the currently selected object  
    while(ft->GetName() != "MyTag") // Looks for a tag with the name MyTag  
      {  
    if(ft->GetNext()==NULL) //If there are no more tags  
       {  
        println("Tag name was not found");  
        return;// End the script  
       }  
    ft = ft->GetNext(); // Get the nex tag    
      }  
    ft->SetBit(BIT_ACTIVE); // Make the tag selected in the OM  
      
    //We've got the proper tag selected...Lets do something with it now.   
    

    You can combine this with the "instanceof" function to filter for your tags.

    If you don't already have my CoffeeBible. Then I recommend that you go get a copy from CGTalk.
    It's free. And it has all kinds of examples in it.

    -ScottA



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

    On 27/03/2011 at 16:09, xxxxxxxx wrote:

    Why does Maxon not add a overloaded 'tag' variable for Tcoffeeexpressions ? There is absolutely no sense in overloading the Origin of the Tag, instead of the Tag!



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

    On 25/04/2011 at 05:13, xxxxxxxx wrote:

    Hi, Basic C4D mac 11.5 user here, trying to get a grip on exactly what PY4D is all about, specially I have a few 3rd party plugins Im trying to install that requires PY4D to get them to work, unfortunately I can seem to find them anywhere, Ive been looking high and low and all I can seem to find out is that Maxon acquired
    PY4D and thats pretty much it. Can anyone PLEASE let me know where I can even find the free beta plugin? thanks



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

    On 25/04/2011 at 07:18, xxxxxxxx wrote:

    @Stribiz: Py4D was available for R11.5 (beta expired in december'10) and is now part of C4D R12.


Log in to reply