access material selection [SOLVED]

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

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

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

Totally forgot about this! Thanks Scott.

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