BaseContainer <> operator conflict?



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

    On 19/05/2009 at 04:30, xxxxxxxx wrote:

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

    ---------
    Need to check.
    In a coffee expression plugin tag or a regular COFFEE tag I have a Userdata.
    Thing is, if I try to set it to a value (like current frame as in the
    included code) it doesn't update the Userdata if "inside" a BaseContainer
    call and the basecontainer is a constant variable.
    I can print the Userdata from "within" the bc and it's correct,
    but not actually set the correct value of the Userdata.
    Setting the Userdata before or after the bc is ok.

    Should this be considered normal? To me it looks inconsistent
    (Since it prints)
    Cheers
    Lennart

    > \> const var MYMEMORY_ID = 1000001; \> \> main(doc,op) \> { \> var frame = doc->GetTime()->GetFrame(doc->GetFps()); \> var pos = op->GetMg()->GetV0(); \> \> ////// before container \> var bc = op->GetContainer(); \> \> op#ID_USERDATA:1 = frame; // not work "inside" bc \> println(op#ID_USERDATA:1); // works "inside" bc \> \> var memopos = bc->GetData(MYMEMORY_ID); \> if(!memopos) memopos = pos; \> bc->SetData(MYMEMORY_ID,pos); \> op->SetContainer(bc); \> ///// after container \> } \>



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

    On 25/05/2009 at 08:33, xxxxxxxx wrote:

    The problem with your code is that you directly access the user data with the # operator but at the end of your code you overwrite the container again. Since the user data are stored in the container as well you overwrite the user data. I recommend to only use the # operator or to put the var bc = op- >GetContainer(); line after you have accessed the user data.

    cheers,
    Matthias


Log in to reply