Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Set List of Objects to show in Attribute Manager

    Scheduled Pinned Locked Moved PYTHON Development
    14 Posts 0 Posters 1.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 10/10/2016 at 20:35, xxxxxxxx wrote:

      Hey Andreas,

      Doing that does not seem put the information into the Attribute Manager. I have tried both SetBit with c4d.BIT_ACTIVE, and I've also tried doc.SetSelection.

      Is there a particular EventAdd() flag I am supposed use?

      I have a list of markers and I want to select each one in that list, so what I had done was:

      marks=self.GetFilteredMarkers()
                  print marks
                  for id, mark in enumerate(marks) :
                      #mark.SetBit(c4d.BIT_ACTIVE)
                      if id==0:
                          self.doc.SetSelection(mark, c4d.SELECTION_NEW)
                      else:
                          self.doc.SetSelection(mark, c4d.SELECTION_ADD)
                  c4d.EventAdd(c4d.EVENT_FORCEREDRAW)

      but it's not working.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 11/10/2016 at 09:25, xxxxxxxx wrote:

        Hello Bret,

        well, for me it worked quite nicely here. No, no special flags needed on EventAdd(), not even EVENT_FORCEREDRAW.

        Looking at your code, I'm wondering if we are talking about objects in the sense of BaseObject or some other kind of objects (in the sense of BaseList2D derived entities)?
        Also, what kind of plugin are you implementing (CommandData, ObjectData,...)?
        And in what function of your plugin are you using above code?

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 11/10/2016 at 09:31, xxxxxxxx wrote:

          It is a commandData plugin, and this is under my def Command section. It is supposed to trigger when a button is clicked in my UI.

          They are not Objects in the BaseObject sense, they are Markers which are BaseList2D objects.

          As I mentioned in my first post, I have other buttons in my UI that allow you to access a single marker in the Attribute Manager, but I have another button that I would like to not only select each one and put all the attributes in the Attribute Manager at once, but also select them in the timeline.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 11/10/2016 at 09:35, xxxxxxxx wrote:

            Ah, sorry, I overlooked the "(They would all be markers)". Yep, that may indeed work a little different. I'll look into it tomorrow.

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 11/10/2016 at 10:58, xxxxxxxx wrote:

              This should make the question clearer.
              The selection status for markers can be done with bits. But the attributes won't show up unless you physically click on one of them:

              import c4d  
              def main() :  
                marker = c4d.documents.GetFirstMarker(doc)    
                   
                #Select all of the makers  
                while(marker) :   
                    marker.ChangeNBit(c4d.NBIT_TL1_SELECT, c4d.NBITCONTROL_SET)         
                    #marker.ChangeNBit(c4d.NBIT_TL1_SELECT, c4d.NBITCONTROL_CLEAR)          
                    marker = marker.GetNext()  
                
              ###### At this point the AM pallet does not show the attributes for the selected markers ######  
                
                c4d.EventAdd(c4d.EVENT_FORCEREDRAW)  #<-- does not work  
                c4d.EventAdd()    <---does not work  
                
                #In many cases. The AM can be forced to show up like this  
                #But in this case it does not work  
                c4d.SendCoreMessage(c4d.COREMSG_CINEMA, c4d.BaseContainer(c4d.COREMSG_CINEMA_FORCE_AM_UPDATE))  
                
                #Bret tried to force it to refesh using something like this:  
                did = c4d.DescID(c4d.TLMARKER_TIME)  
                c4d.gui.ActiveObjectManager_SetObject(c4d.ACTIVEOBJECTMODE_TIMELINE, obj, c4d.ACTIVEOBJECTMANAGER_SETOBJECTS_OPEN, did)  
                
              #None of these work.   
              #The AM pallet for the markers refuses to show itself without physically clicking on one of them!!  
                
              if __name__=='__main__':  
                main()
              

              -ScottA

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 12/10/2016 at 09:25, xxxxxxxx wrote:

                Hi Bret,

                as I said yesterday, I was on the completely wrong track in my first post. Sorry, for that.
                Scott already pointed out the correct bit to use in order to select markers (note, that there are four of these for the four Timeline Managers that can be opened in parallel). And as Scott also found out, none of his ways works to have multiple selected markers shown in Attribute Manager. I played around with it today and I'm very sorry, but I also wasn't able to find a workaround.
                What really is missing here in Python is ActiveObjectManager_SetObjects() (note the additional s in the end) from the C++ API. We have added it to our list of missing Python functions and will hopefully be able to provide it with one of the future updates.

                I know, we are in the Python sub-forum, but just for completeness in C++ it would work like so:

                		AutoAlloc<AtomArray> arr;
                		BaseList2D* marker = GetFirstMarker(doc);
                		if (!marker || !arr)
                			return true;
                		while (marker)
                		{
                			arr->Append(marker);
                			marker = marker->GetNext();
                		}
                		ActiveObjectManager_SetObjects(ACTIVEOBJECTMODE_TIMELINE, arr, 0);
                		EventAdd();
                
                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 12/10/2016 at 10:30, xxxxxxxx wrote:

                  Rats. That's unfortunate it's missing. Thanks for the help.

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    On 25/10/2017 at 00:16, xxxxxxxx wrote:

                    Any news on the addition of the ActiveObjectManager_SetObjects() function in python?

                    As a workaround.. Is there maybe an undocumented way to call c++ functions from python?

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      On 25/10/2017 at 01:32, xxxxxxxx wrote:

                      https://developers.maxon.net/docs/py/2023_2/modules/c4d.gui/index.html#c4d.gui.ActiveObjectManager_SetObject

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        On 25/10/2017 at 01:50, xxxxxxxx wrote:

                        Hi,

                        unfortunately ActiveObjectManager_SetObjects() did not make it in R19 SP1. It's not forgotten and slowly moves to the top of our ToDo list.

                        @gr4ph0s: You may have overlooked the "s" or thought it's a typo, but there's indeed another function ActiveObjectManager_SetObjects() in the C++ SDK, which is currently not yet exposed to Python.

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          Helper
                          last edited by

                          On 25/10/2017 at 01:51, xxxxxxxx wrote:

                          -- EDIT--
                          Andreas already answered while I was tying this post.. sorry 😉

                          Nice to hear it is not forgotten and will be eventually in one of the next Updates.

                          ~~@graphos:
                          The Link you provided points to c4d.gui.ActiveObjectManager_SetObject () which can only show one object. I was referring to the c++ function c4d.gui.ActiveObjectManager_SetObject s () ( notice the trailing 's' ) which is able to show an array of objects in the object manager. This function was mentioned above by Andreas.

                          Just to be sure I tried calling the function you mentioned with an array, which, sure enough, resulted in a "TypeError: argument 2 must be c4d.Atom, not list"~~

                          1 Reply Last reply Reply Quote 0
                          • H Offline
                            Helper
                            last edited by

                            On 25/10/2017 at 02:21, xxxxxxxx wrote:

                            Sorry to have bring false hope. I missed the "s".

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post