object is clone??



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

    On 06/05/2009 at 13:13, xxxxxxxx wrote:

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

    ---------
    hey there,

    is it possible to check within one object plugin if it is cloned or not? I have one plugin which creates clones of a child object. now I have another objectplugin which can be used as a child of the first one, too. and i'd like to change the random seed for each of the cloned objects..

    this is how i am currently trying it (change the seed of the child from the parent object) and somwhow the seed is changed, but it seems the seed is the same for each clone, no matter that I pass different seeds (seed+i), where seed is the seed of the current object and i is the iterator

    > `

      
    \>  bc = clone->GetDataInstance();  
    \>  bc->SetLong(SEED,bc->GetLong(SEED) + i + seed);  
    \>  
    

    `

    any help appreciated..



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

    On 07/05/2009 at 08:41, xxxxxxxx wrote:

    Hi,

    i guess you could just set a flag in the BaseContainer of your clones, so you would always know if it was created by your plugin.

    > \> bc = obj->GetDataInstance(); \> bc->SetBool(IS_A\_CLONE,TRUE); \>

    ofc you have to define IS_A_CLONE in your res files, like you probably did with SEED.

    About your seed always being the same, there's probably some small error in your loop. Just recheck it or post some more code ;-)

    greetings,
    Daniel



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

    On 07/05/2009 at 10:35, xxxxxxxx wrote:

    thank you!



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

    On 07/05/2009 at 10:59, xxxxxxxx wrote:

    btw, i guess i understand the issue with the seed. i am using a shared random function and the Random is initialised there, too. i guess it'll be better to create the Random inside every object..



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

    On 07/05/2009 at 12:20, xxxxxxxx wrote:

    when i do random stuff, i have one 'Random r' as private variable of my plugin, which I init in the plugins Init() function with:

    r.Init(GeGetTimer());

    whenever i need some random value i just call

    r.Get01() to get a value between 0 and 1
    or
    r.Get11() * 100 for example, to get a value between -100 and 100

    greetings,
    Daniel



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

    On 07/05/2009 at 13:05, xxxxxxxx wrote:

    thank you very much! now it works...


Log in to reply