Jump to content

  • “Great art picks up where nature ends.”  Marc Chagall 

Sign in to follow this  
TonyTsao

Change multi-selected Nulls display ?

Recommended Posts

Hi guys, just learned python in C4D recently

 

I'm trying to make a few scripts that can change the selected null objects turn ON color & Cube display & orientation to XZ

 

The coding below is my approach to make these changes, but it can only change one null at a time
-----------------------------------------------------------------------------------------------------------------------------------------------------------

def main():
    selObj = doc.GetActiveObject()

    dis = selObj[c4d.NULLOBJECT_DISPLAY]
    ori = selObj[c4d.NULLOBJECT_ORIENTATION]
    col = selObj[c4d.ID_BASEOBJECT_USECOLOR]

    print selObj
    print dis
    print ori
    print col

    selObj[c4d.NULLOBJECT_DISPLAY] = 11                  #Cube display
    selObj[c4d.NULLOBJECT_ORIENTATION] = 3        #XZ orientation
    selObj[c4d.ID_BASEOBJECT_USECOLOR] = 1        #turn ON color display

    c4d.EventAdd()

# Execute main()
if __name__=='__main__':
    main()

-----------------------------------------------------------------------------------------------------------------------------------------------------------

I also tried  doc.GetActiveObject(c4d.GETACTIVEOBJECTFLAGS_0), but it didn't work though.

 

Could someone point out what did I do wrong in the code?

 

Thanks in advance.

 

 

 

Share this post


Link to post
Share on other sites

Here is an example for setting just one parameter (for easier reading)

 

def main():
  
    selObj = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN)
        
    for obj in selObj:
        obj[c4d.NULLOBJECT_DISPLAY] = 11
   
    c4d.EventAdd() 

# Execute main()
if __name__=='__main__':
    main()

 

btw you can embedd code by using </> button in the reply interface (top area) and choose which language to use for formatting :)


Free C4D trainings from MAXON professional on our youtube channel

 

https://www.youtube.com/c4dcafe

Share this post


Link to post
Share on other sites
  • Topic Author
  • Oh Thanks you so much, you are a life saver

     

    If I may ask, do you know any resources where I can learn to some of the function for python (didn't know how some of the code work)

     

    Really appreciate it!

     


     

     

    Share this post


    Link to post
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    Sign in to follow this  

    • BLOGS / NEWS & SPECIAL ANNOUNCEMENTS

    About Us

    C4D Cafe is the largest Cinema 4D community. We provide facilities for discussion, showcasing and learning our favourite software.
    Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, watch tutorials directly from our video gallery,  get your own private messenger, post and upload images, manage your profile and much more. If you need to find solution to your problem or otherwise ask for help, C4D Cafe is the right place to be for learning 3D.  :cowboypistol:

    ×
    ×
    • Create New...