Jump to content

Freemorpheme

Edit multiple nodes / Access all SDS

Recommended Posts

Hi, I have been dragging all of my SDS objets into an Xpresso field and attaching them to a null with a Boolean switch on so I can turn the SDS on and off globally. This worksvery nicely.

 

 

My (basic) question is, is there a way of editing more than one node at a time? If I drag in ten SDS objects, I would like to select them all at once and access the 'Enabled' switch. Then I would like to connect them all at once to my null node. Can this be done?

 

Failing that, is there a global object for 'all SDS objects in scene' or something like that?

 

Thanks

 

EDIT 

Look at this horror, it took me ages. There must be a better way.

 

 

Screen Shot 2018-10-17 at 13.46.22 copy.jpg

Share this post


Link to post
Share on other sites

You can use a list iterator instead of doing each object nod eindividually.

  • Like 1

Share this post


Link to post
Share on other sites

isntead of xpresso, try just using a Selection Object.  Select all of your SDS objects, then go to Select > Selection Filter > Create Selection Object.  This creates a null object w an Object tab.  The tab has a list of all your SDS objects that were selected at the time of creation, and a button for "Restore Selection."  You can press the button to get all your object selected, then in the Basic tab, check/uncheck Enable.

 

Alternatively, clicking the closed eyeball in the upper right of the obj mgr will open a window that lets you select objects, tags, layers, etc.  Here you could right click the SDS object, and choose Select All, and perform the same enable/disable function as in the previous paragraph.

 

Eric

  • Like 1

Share this post


Link to post
Share on other sites
  • Topic Author
  • 1 hour ago, esmall said:

    try just using a Selection Object. 

    Thanks, I've never used that before. My question was more of a workflow one for Xpresso really. I have looked up the list iterator but it seems pretty heavy, so I guess I will stick with my spiderweb for now.

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • 1 minute ago, bezo said:

    you can still use coffee plugins/scripts.

     

    Thanks very much, but really I was trying to learn a little more about how Xpresso works. I feel like you should be able to select more than one node and add ports, that kind of thing. 

    Share this post


    Link to post
    Share on other sites

    The Iterator is nothing to fear, check the attached scene. Select the Xpresso tag to see the bool that controls all cubes

    Enable-Iterator.c4d

    • Like 1

    Share this post


    Link to post
    Share on other sites

    well, if you are Ok with some Python - this a solution. But keep in mind that it will iterate over every object in the scene. It should be quite fast anyway :)

    sds xpresso python.c4d

    • Like 1

    Share this post


    Link to post
    Share on other sites

    this is the code in the node for everyone interested

    import c4d
    
    def main():
        global result  #  sets a global output variable, cause the xpresso needs it :) 
        result = state  # sets the same output to the input state
        obj = doc.GetFirstObject() # this assigns the first object in the object manager to a variabale named "obj"
    
        while obj:  # while there is an object returned
            if obj.GetType() == c4d.Osds:  # if the object is a SDS object
                obj[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = state  # toggle it based on the null's object enabled's state
            obj = walker(obj)  # keep checking all the objects in the scene.
        c4d.EventAdd()
    
    def walker(obj):
        if not obj:
            return
        elif obj.GetDown():
            return obj.GetDown()
        while obj.GetUp() and not obj.GetNext():
            obj = obj.GetUp()
        return obj.GetNext()

     

    • Like 1

    Share this post


    Link to post
    Share on other sites

    Thank you for describing steps in code Alex,

    It´s a first time I see placed "subcode" under main code. There is no important where is placed?

    When I play with with Basic language 30 years ago (where every line of code has own number), there was command GOTO and number where was placed "subcode"...( :D just for laught)

     

    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.


    • Recently Browsing   0 members

      No registered users viewing this page.

    YOUTUBE CHANNEL:

    ABOUT US:

    C4D Cafe is the largest CINEMA 4D community. We provide facilities for discussion, showcasing and learning our favorite 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, get your own private messenger, post status updates, manage your profile and much more. If you need to find solution to your problem or otherwise ask for help, Cafe is the right place.
    ×
    ×
    • Create New...