Jump to content

Edit multiple nodes / Access all SDS


Recommended Posts

  • Silver Contributor

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

Link to post

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

Link to post
  • Silver Contributor
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.

Link to post
  • Silver Contributor
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. 

Link to post

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()

 

Link to post

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)

 

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...