GetGenerator() equivalent in a Python Effector



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

    On 23/01/2012 at 08:43, xxxxxxxx wrote:

    Thanks for the feedback Yannick

    but I think this will be a problem if you use the effector in more than one cloner
    ie an unspecified number of cloers

    😉

    I'm thinking 
    search OM for cloners
    check effector list
    am I in there?



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

    On 24/01/2012 at 00:53, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    But I think this will be a problem if you use the effector in more than one cloner
    ie an unspecified number of cloners

    You can create as many Link user data as cloners.

    Originally posted by xxxxxxxx

    I'm thinking 
    search OM for cloners
    check effector list
    am I in there?

    Yes, meanwhile this solution may be the best for complex situations.



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

    On 24/01/2012 at 01:52, xxxxxxxx wrote:

    Sebastian just told me that in the Python effector scope there's a variable called "gen"... So we can access the cloner object with this variable.



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

    On 24/01/2012 at 07:25, xxxxxxxx wrote:

    A quick example would save a lot of guesswork pls 
    🙂



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

    On 24/01/2012 at 07:42, xxxxxxxx wrote:

    Basically, 'gen' is the name of a variable (referencing the cloner or generator object) added to the execution of main() function in a Python effector, just as the same as 'doc' (document where the effector resides) and 'op' (effector) variables:

    import c4d
    from c4d.modules import mograph as mo
    #Welcome to the world of Python
      
    def main() :
        md = mo.GeGetMoData(op)
        if md==None: return 1.0
        
        # Print variables added to the scope of main()
        print op
        print gen
        print doc
        
        index = md.GetCurrentIndex()
        mode = md.GetBlendID()
        if mode==c4d.ID_MG_BASEEFFECTOR_POSITION:
            return c4d.Vector(0.5)
        else: return 1.0
    


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

    On 24/01/2012 at 07:55, xxxxxxxx wrote:

    Ah - I see

    got it

    place in a Python Effector and run



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

    On 24/01/2012 at 09:01, xxxxxxxx wrote:

    bingo, that works.

    try again, deepshade.
    ( I think you're still working on a python version of d_PolySize.)
    I just tried :

    cloneobj = gen[c4d.MG_OBJECT_LINK]
    print cloneobj

    and it does return the Object the Cloner's cloning onto correctly,
    although it gets funky when there's multiple cloners referencingthe same Effector

    thanks, yannick



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

    On 24/01/2012 at 12:13, xxxxxxxx wrote:

    multiple cloner issue here too

    douwe - re: d_PolySize - still getting stuck on the coffee poly manipulation
    can you annotate to make conversion (a little) easier



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

    On 04/02/2012 at 05:51, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Basically, 'gen' is the name of a variable (referencing the cloner or generator object) added to the execution of main() function in a Python effector, just as the same as 'doc' (document where the effector resides) and 'op' (effector) variables:

    import c4d
    from c4d.modules import mograph as mo
    #Welcome to the world of Python
     
    def main() :
        md = mo.GeGetMoData(op)
        if md==None: return 1.0
        
        # Print variables added to the scope of main()
        print op
        print gen
        print doc
        
        index = md.GetCurrentIndex()
        mode = md.GetBlendID()
        if mode==c4d.ID_MG_BASEEFFECTOR_POSITION:
            return c4d.Vector(0.5)
        else: return 1.0
    

    Why
    When the python effector is set to Full Control
    does GEN returns the Cloner

    and
    when the python effector is set to Parameter Control
    does GEN returns the Cloner Object Link
    ???



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

    On 10/02/2012 at 12:12, xxxxxxxx wrote:

    or to put it another way
    is the variable GEN in parameter mode 
    returned incorrectly ie a bug

    If there is a difference - can someone explain why pls - as there is no documentation of the modes working differently other than (from what I can see) the parameter version appears to be hooked to refresh once for every clone count


Log in to reply