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
    • Login

    Scripting display fliters [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 215 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 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()   
        
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        Hello,

        GetDisplayFilter()[URL-REMOVED] 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


        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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