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
    • Recent
    • Tags
    • Users
    • Register
    • Login

    how to detect obj selected in InExcludeData()?

    Scheduled Pinned Locked Moved Cinema 4D SDK
    2025python
    4 Posts 2 Posters 32 Views 1 Watching
    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.
    • chuanzhenC Offline
      chuanzhen
      last edited by chuanzhen

      Hi,
      i use this script code to detect obj selected in InExcludeData(),always return "None"

      import c4d
      
      doc: c4d.documents.BaseDocument  # The currently active document.
      op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.
      
      def main() -> None:
          ie = op[c4d.ID_USERDATA,1]
          for i in range(ie.GetObjectCount()):
              print(ie.GetData(i)[c4d.IN_EXCLUDE_DATA_SELECTION])
      
      if __name__ == '__main__':
          main()
      

      i found a example code in this post,but it also not work.

      Thanks for any help!

      相信我,可以的!

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF Offline
        ferdinand @chuanzhen
        last edited by

        Hey @chuanzhen,

        Thank you for reaching out to us. For me this works fine, but I also struggled for a second with this. The crucial information is probably that you have to set SEND_SELCHNGMSG in the InExcludeCustomGui for which this shall work. Since this information is rather obscure, I have updated the docs of InExcludeData::GetData to better reflect this.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        chuanzhenC 1 Reply Last reply Reply Quote 1
        • chuanzhenC Offline
          chuanzhen @ferdinand
          last edited by

          @ferdinand Thanks,it works!

          相信我,可以的!

          1 Reply Last reply Reply Quote 0
          • chuanzhenC Offline
            chuanzhen
            last edited by

            Supplement an example of generating UserData using code:

            import c4d
            
            
            def main() -> None:
                
                
                bc = c4d.GetCustomDataTypeDefault(c4d.CUSTOMDATATYPE_INEXCLUDE_LIST)
                bc[c4d.DESC_NAME] = "Test"
                bc[c4d.IN_EXCLUDE_FLAG_SEND_SELCHANGE_MSG] = True
                did = op.AddUserData(bc)
                c4d.EventAdd()
            
            if __name__ == '__main__':
                main()
            
            

            相信我,可以的!

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