Keeping Cloned Parameters Consistent



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

    On 25/09/2003 at 23:59, xxxxxxxx wrote:

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

    ---------

    Hi,

    QUESTION:

    I'm having some trouble getting two parameters in an object generator
    to stay consistent with each other when the generator is cloned.

    What I need is one of the following:
    - a different way to maintain consistency between two parameters
    - a way to make a clone which uses the original's BaseContainer
    - a way to set the original's BaseContainer from a clone
    - a way to propagate changes to a clone to the original

    BACKGROUND:

    You may recall my earlier post about Generated Objects Not Scaling,
    where the scaling tools weren't working on my generator because it
    didn't have any parameters that were Lengths.

    Mikael Sterner:
    > C4D looks for metric description values in generators and scales
    > those linearly

    me:
    > As my "generator" has no natural linear measurement to scale, I've put
    > in a hidden size vector linked to a visible scaling vector, then apply
    > SetScale() to the root of the loaded objects, which works fine.

    Now I'm having trouble if my generator is an input to an "input
    generator" (eg Array), and I scale using the scaling tools.

    The salient parameters are:

      
    VECTOR TRUE_SCALE { UNIT REAL; }  
    VECTOR NOMINAL_SIZE { HIDDEN; UNIT METER; }  
    

    I'm cloning using the following flags:

      
    static const LONG CLONE_FLAGS =  
        COPY_NO_ANIMATION | COPY_NO_INTERNALS;                                                   
    

    What normally happens is this:
    - the object's NOMINAL_SIZE parameter is changed by the scaling tool
    - in GetVirtualObjects(), detect the change in NOMINAL_SIZE and apply
       the appropriate change to TRUE_SCALE

      
       if (op->IsDirty(DIRTY_DATA))  
       {   
          BaseContainer* bc = op->GetDataInstance();  
          Vector new_scale = op->GetVector(NOMINAL_SIZE) / DFLT_NOMINAL_SIZE;  
          if (old_scale != new_scale)  
          {  
            bc->SetVector(TRUE_SCALE, new_scale);  
            old_scale = new_scale;  
          }  
       }  
    

    All of the above happens in a clone, *however* the BaseContainer is a
    clone of the original, so when I apply changes to it, they don't
    effect the original, and the changes are lost, and the original ends
    up in an inconsistent state.

    Thanks.

    .angus.



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

    On 26/09/2003 at 00:59, xxxxxxxx wrote:

    I've just discovered a related problem.

    If my generator is
    - created
        eg: MyGenerator
    - made an input to Array,
        eg: Array <- MyGenerator
    - then my generator's parameters are changed,
    - then my generator is removed from the Array input,
        eg: MyGenerator
    then the original (and remaining) instance of the generator never gets TRUE for IsDirty(DIRTY_DATA),
    so the generator never checks its parameters,
    so it produces incorrect output until it gets IsDirty(DIRTY_DATA) due to another parameter change.

    Suggestions as to how to avoid this welcome!
    Do I have to assume my data is always dirty?

    .angus.



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

    On 12/10/2003 at 05:53, xxxxxxxx wrote:

    Perhaps using a hidden field like this isn't worth the extra risk? Couldn't you remove it and let the user use the other scaling tool, or make it visible so that the user can see what happens?



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

    On 12/10/2003 at 20:02, xxxxxxxx wrote:

    I'm trying to avoid having a "Scale" that's measured in metres.

    .angus.


Log in to reply