How can I store a ID in a Tag-Container?



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

    On 28/04/2006 at 09:11, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R9.5 
    Platform:   Windows  ;   
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hi,

    this one really gives me a headache, so please help:
    Within my PluginTag I'm trying to use the Container-IDs to characterise them, but I cannot store the ID. Using this code:

      
    var testcont = GetContainer();  
    testcont->SetId(12345);  
    SetContainer(testcont);  
    println("ID1: ", testcont->GetId());  
    println("ID2: ", GetContainer()->GetId());  
    

    the output becomes:
    ID1: 12345
    ID2: -1

    So

    SetId()
    

    writes the ID to testcont, but it is not saved with

    SetContainer(testcont)
    

    , otherwise both outputs should be the same.
    Anyone able to help?

    Cheers, Juergen



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

    On 28/04/2006 at 09:24, xxxxxxxx wrote:

    The ID for your own sub-BaseContainer must be a Plugin ID you received from PluginCafe. Most likely, the ID is being used by some other data otherwise.



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

    On 29/04/2006 at 06:53, xxxxxxxx wrote:

    Just want to clarify that reply. If you are storing data in your own plugin tag you can use any ID not used by CINEMA itself. You can check this in the res files (Tbase) over 2000 is ok afaik.

    As for using a plugin ID...

    You can not store data in a tag that is not your own. A plugin ID will not mean it will work (no more than just using a really high ID), you simply can not do it. Plugin IDs are not for storing data in containers, they are for plugins and messages (I think the only exception is storing data in a document which is allowed, see the SDK docs).



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

    On 29/04/2006 at 10:53, xxxxxxxx wrote:

    It is his own PluginTag as is mentioned, so why is it not working (unless there is something not being shown which may be a contributing factor)? Of course, it is COFFEE, so I'm slightly out of my element.

    Just to get a further clarification: You cannot declare a sub-BaseContainer in the .res file for a plugin resource, but you can store a sub-BaseContainer within your own PluginTag's BaseContainer as long as it has a unique ID (above 1000, 2000 for Shaders)?

    From the docs, Description Resource:

    Note: Generally it is safe to use IDs above 1000 in a local context like this one. However, for shaders you have to use IDs above 2000 to make room for the common radiosity IDs.

    and from BaseContainer:

    It is recommended that you use the available containers to store your own values as well. That way they will be automatically saved. However, if you want to store values in the top level of for example an object container, you'll have to use a unique id. You can use a plugin id from http://www.plugincafe.com for this. A good way is to store a sub-container with this id. Inside this sub-container you can use whatever ids you want.

    I can tell you, this works - with my own PluginTags, of course. Or is it that for your own Plugins, you can just describe a unique ID in the .h enum for the to-be-added sub-BaseContainer, unmentioned in the .res, without requiring a unique 'plugin' ID acquired here?

    Again, just looking for clarification on this.



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

    On 29/04/2006 at 11:16, xxxxxxxx wrote:

    And, I think that I see the problem here:

    println("ID1: ", testcont->GetId());
    println("ID2: ", GetContainer()->GetId());

    That second line gets the plugin's default container ID, which I've always seen as -1. So, this is correct.

    If you want to access your sub-BaseContainer from the default BaseContainer, you need to use:

    println("ID1: ", testcont->GetId());
    println("ID2: ", GetContainer()->GetContainer(12345));

    This gets your sub-BaseContainer from the default BaseContainer.



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

    On 29/04/2006 at 11:17, xxxxxxxx wrote:

    Quote: Originally posted by David O Reilly on 29 April 2006
    >
    > * * *
    >
    > You can not store data in a tag that is not your own. A plugin ID will not mean it will work (no more than just using a really high ID), you simply can not do it. Plugin IDs are not for storing data in containers, they are for plugins and messages (I think the only exception is storing data in a document which is allowed, see the SDK docs).
    >
    > * * *

    Either the docs are not up-to-date or what you say is wrong. Because it worked ever since in COFFEE (I still remember from my old COFFEE days :) and the docs also say so:

    > Quote: Note: You can store your own values in an object container, such as the camera's, but then you must get a unique container id from http://www.plugincafe.com: (Otherwise there might be severe data corruption, if you overwrite C4D's own container values!)
    >
    > * * *
    >
    > * * *

    So actually it should work. But maybe it´s a COFFEE bug or not working ANYMORE. (as some other things in COFFEE since the R9 cycle).



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

    On 29/04/2006 at 11:20, xxxxxxxx wrote:

    Quote: Originally posted by kuroyume0161 on 29 April 2006
    >
    > * * *
    >
    > And, I think that I see the problem here:
    >
    > println("ID1: ", testcont- >GetId());
    > println("ID2: ", GetContainer()->GetId());
    >
    > That second line gets the plugin's default container ID, which I've always seen as -1. So, this is correct.
    >
    > If you want to access your sub-BaseContainer from the default BaseContainer, you need to use:
    >
    > println("ID1: ", testcont->GetId());
    > println("ID2: ", GetContainer()->GetContainer(12345));
    >
    > This gets your sub-BaseContainer from the default BaseContainer.
    >
    >
    > * * *

    I don´t even think he wants to store a sub-container. As GetContainer() and testcont are (or should be) the same pointer! (he overwrites the object container with SetContainer and then gets it again.) Or am I blind now? :-)

    Maybe SetContainer does not work correctly?



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

    On 29/04/2006 at 16:03, xxxxxxxx wrote:

    You may be correct there, Katachi. Again, my COFFEE inexperience - and lack thereof at the time (other type) - ;) may have had it wrong. If that is the case, I don't think you can change the default container's ID (or why would you want to?).

    I was thinking that maybe his intention was to store a sub-BaseContainer. Clarification on that would be helpful. :)

    Thanks,



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

    On 02/05/2006 at 06:48, xxxxxxxx wrote:

    Hi guys,

    thanks already for all those comments ... Katachi is correct in what he said: I don't want to store a sub-Container. All I do is loading the tag-container, overwrite some data, and then store it back using the SetContainer() command.
    However this does not store the Container-ID. The example above was only to show the problem.

    Actually I have a ExpressionPluginTag. In R7 I then used to store the PluginID as the Container-ID as well in the initialisation. This way I can make sure that the Container in initialised with the data I want in it, and when loading I simply check the ID ... but OK, I'll work around it in R9.5 by just setting a custom value in the Container or I'll just leave that check out since every tag should be correctly initialised when it is created.

    Cheers,
    Juergen


Log in to reply