Scripting display fliters [SOLVED]

On 26/10/2014 at 09:48, xxxxxxxx wrote:

I'd like to setup a script so that I can associate a hotkey with showing/hiding the SDS display filter.

Not getting errors, but can't figure out how to get it actually update the viewport. Also, what's the smartest way to set this up so that it toggles on and off with the same hotkey?

  
import c4d   
from c4d import documents   
  
  
  
def main() :   
    draw = doc.GetActiveBaseDraw()   
  
    draw[c4d.DISPLAYFILTER_SDS] = True   
    print(draw.GetDisplayFilter())   
  
if __name__=='__main__':   
    main()   
  

On 27/10/2014 at 01:34, xxxxxxxx wrote:

Hello,

GetDisplayFilter() returns a bit field. You can use the flags described in the documentation to check if a filter is set. To actually change the filters you have to use the parameter IDs defined in dbasedraw.res :

  
  # swich BASEDRAW_DISPLAYFILTER_HYPERNURBS  
    
  draw = doc.GetActiveBaseDraw()  
  drawFilter = draw.GetDisplayFilter()  
    
  if drawFilter & c4d.DISPLAYFILTER_HYPERNURBS:  
      draw[c4d.BASEDRAW_DISPLAYFILTER_HYPERNURBS] = False  
  else:  
      draw[c4d.BASEDRAW_DISPLAYFILTER_HYPERNURBS] = True  
        
        
  draw.Message(c4d.MSG_CHANGE)  
  c4d.EventAdd()  
  

Please notice also the difference between the filters "Subdivision Surface" and "SDS Mesh".

best wishes,
Sebastain