Get Tag Data in a shader Plugin



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

    On 10/10/2009 at 14:19, xxxxxxxx wrote:

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

    ---------
    Hi there,
    i was about getting my hands on using a tag plugin to pass data from the generator plugin to a shader plugin.. the tags values are set properly (i can see it when converting the generator and looking at the tag), but the shader doesnt get the proper values. its always zero..
    _
              RayObject *robj = NULL;
              robj = cd->vd->op;
              if (!robj) return 0.0;
              BaseTag *ht = robj->link->GetTag(1000001);//
              if (ht)
              {
                   BaseContainer *bc = ht->GetDataInstance();
                   if (bc)
                        result = bc->GetVector(MATERIAL_COLOR);
              }
    _

    thank you for all input??

    cheers,
    ello



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

    On 11/10/2009 at 03:49, xxxxxxxx wrote:

    or is this the same problem like here

    > Quote: __
    >
    > * * *
    >
    > The problem is you are working on a virtual object which is not yet in the document. Expressions will not work.
    >
    >
    >
    >
    > * * *

    and if so.. how can i achive the following:
    1. create clones with an objectPlugin,
    2. create custom tags for those clones to to certain things, like facing toward an object for example
    3. reading the tag data by a shader plugin??

    all this while the object maintains the plugin object



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

    On 11/10/2009 at 04:13, xxxxxxxx wrote:

    ok.. i did something wrong and didnt use tag->GetData() (this works for the facing thing, but colors in the shaderplugin still dont work)

    but still, as long as the pluginobject is not converted nothing works.. this is not so cool

    furthermore, it seems that the shaderplugin doesnt find the tag.. my tag has the ID 1000001 for testing, so i create it in my objectplugin by using obj- >MakeTag(1000001);
    and in the shader i do this:
    BaseTag *ht = robj- >link->GetTag(1000001);
    isnt that right??



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

    On 11/10/2009 at 15:48, xxxxxxxx wrote:

    hm, i am not getting nothing to work here.. the tag plugin isnt working as long as my generator plugin isnt converted and my shader plugin is not able to access the tag plugin

    some snippet:
    tagPlugin:

    > `

      
    \>       Bool facing = tag->GetData().GetBool(FACING);  
    \>       BaseObject* targetHelper = doc->SearchObject("Facing Helper");  
    \>       if (targetHelper && facing)  
    \>       {  
    \>            GePrint("Hello");  
    \>       }  
    \>  
    

    `

    in the attribute manager i have set the facing bool and the "Facing Helper" object is in the scene.. but GePrint is not called (and i found out that it is the facing thats not read correctly), why is this??

    shader plugin:
    > `

      
    \>  Vector eShade3Data::Output(PluginShader *chn, ChannelData *cd)  
    \>  {  
    \>       Vector result = 0.0;  
    \>       if (cd->vd)  
    \>       {  
    \>            RayObject *robj = NULL;  
    \>            robj = cd->vd->op;  
    \>            if (!robj) return 0.0;  
    \>            BaseTag *ht = robj->link->GetTag(HELPERTAG);//  
    \>            if (ht) result = Vector(1.0,0.0,0.0);  
    \>            return result;  
    \>       }  
    \>  endit:  
    \>       return 1.0;  
    \>  }  
    \>  
    

    `

    tag is there and so i thought the object should get a red color, but its not happening

    i have no clue what i am doing wrong there nor what to try else...

    hopefully someone can point me to something.
    cheers,
    ello



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

    On 12/10/2009 at 01:45, xxxxxxxx wrote:

    I can't confirm, it is working for me. Maybe you did something wrong with the tag creation. I used the same code as you in my shader.

    cheers,
    Matthias



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

    On 12/10/2009 at 04:04, xxxxxxxx wrote:

    hi,

    what could that be?? i tried different things. obj->MakeTag(helperTag), as well as BaseTag::Alloc(helperTag)

    are there other options??

    cheers,
    ello


Log in to reply