Randomize objects in object manager?



  • On 06/02/2013 at 02:14, xxxxxxxx wrote:

    Hi all,

    Is there a way to make a script that randomizes the order of objects under a null in the object manager?

    Grtz,
    Hans Willem



  • On 06/02/2013 at 03:14, xxxxxxxx wrote:

    Easy:

    import random
      
    def main() :
        objs = op.GetChildren()
        [x.Remove() for x in objs]
        random.shuffle(objs)
        [x.InsertUnder(op) for x in objs]
      
    main()
    

    Note: no undos



  • On 06/02/2013 at 03:26, xxxxxxxx wrote:

    Wow! Thanks!



  • On 06/02/2013 at 14:11, xxxxxxxx wrote:

    Forgot to add c4d.EventAdd() as the last line of the main() function. This will update the Cinema
    4D interface so you can see the change immediately.


Log in to reply