Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Toggle Only select Visible element.

    Cinema 4D SDK
    s24
    2
    3
    835
    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.
    • A
      akramFex
      last edited by m_adam

      Hello i wanted to toggle off and on the ‘Select only Visible elements’ and i know that there is an already build in shortcut for that on cinema, but it only toggles the tool you have active, i want it to toggle the lasso tool (Toggle Only select Visible element on it and the live selection tool in the same time ).while still being on the live selection tool so i came up with this script, this one does toggle only the active tool but i couldn’t make the jump to lasso tool and activate/deactivate there and then come back to live tool, really appreciate some guidance!

      def main():
      
          
          tool = doc.GetActiveToolData()
          c4d.CallCommand(200000083) #Liveselection
          tool[c4d.MDATA_SELECTLIVE_VISIBLE] = not tool[c4d.MDATA_SELECTLIVE_VISIBLE] #Toggle Visible Selection
          
          c4d.CallCommand(200000084) #Lassoselection
          tool[c4d.MDATA_SELECTION_VISIBLE] = not tool[c4d.MDATA_SELECTION_VISIBLE] #Toggle Visible Selection
          
          c4d.CallCommand(200000083) #LiveselectionAgain
          doc.EndUndo()
      
          c4d.EventAdd()
      # Execute main()
      if __name__=='__main__':
          main()
      

      I'm using S24.

      A 1 Reply Last reply Reply Quote 0
      • A
        akramFex @akramFex
        last edited by

        I figured it out, it was a simple take but for a newbie like me, it was difficult.

        Code :

        c4d.CallCommand(200000084)
        
        tool = doc.GetActiveToolData()
        tool[c4d.MDATA_SELECTION_VISIBLE] = not tool[c4d.MDATA_SELECTION_VISIBLE]
        
        
        c4d.CallCommand(200000083)
        
        tool = doc.GetActiveToolData()
        tool[c4d.MDATA_SELECTLIVE_VISIBLE] = not tool[c4d.MDATA_SELECTLIVE_VISIBLE]
        

        Thank you, everyone.

        1 Reply Last reply Reply Quote 1
        • r_giganteR
          r_gigante
          last edited by

          Hi @akramFex , I apologize for the long silence on our side. Unfortunately the thread fell through the cracks of the Xmas period and we lost track of it.

          I'm glad you were able to find the solution and I'm grateful you wanted to share it with the rest of the community.

          Cheers, R

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