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

    access material selection [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 363 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 29/08/2016 at 11:09, xxxxxxxx wrote:

      Does anyone have a creative way of accessing material "selection"? I couldn't find a method in the Python SDK or in C++ so maybe there's a workaround?

      I appreciate any suggestions.

      http://www.dropbox.com/s/vfim279j1j3hc3q/Screen Shot 2016-08-29 at 11.05.00 AM.png?dl=0

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

        On 29/08/2016 at 15:03, xxxxxxxx wrote:

        Hi,
        You can LMB click on most attributes and drag & drop them into the bottom the of the Console or into the script manger to get a rough idea how to get at them.

        Try this:

        import c4d  
        def main() :      
            
          obj = doc.GetActiveObject()   
          if obj is None: return false  
               
          ttag = obj.GetTag(c4d.Ttexture)  
          if ttag is None: return false  
            
          if ttag:  
              selection = ttag[c4d.TEXTURETAG_RESTRICTION]  
              print selection  
                
          c4d.EventAdd()  
          
        if __name__=='__main__':  
          main()
        

        -ScottA

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

          On 29/08/2016 at 15:26, xxxxxxxx wrote:

          Totally forgot about this! Thanks Scott.

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

            On 30/08/2016 at 01:25, xxxxxxxx wrote:

            Hello,

            as Scott shows the "Selection" parameter of a texture tag is just an ordinary parameter that can be accessed like any other parameter. It is just a simple string storing the name of the referenced selection tag. You find some C++ examples on how to handle a texture tag in the TextureTag Manual.

            Best wishes,
            Sebastian

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