Viewport Filters



  • On 13/06/2014 at 02:10, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R14 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi Folks,
     
    I've seen some python code on how to turn some viewport filters on/off, but the c++ was a little confusing to me (maybe the syntax?). Is someone in the know able to clarify the following:
     
    1. There's DOCUMENT_SELECTIONFILTER and DOCUMENTFILTER_ flags, which is used for turning off, say viewport polygons, and how is it done? Below is one of the variations I've tried:

    BaseDocument *doc = GetActiveDocument();
    BaseContainer bc = doc->GetData(DOCUMENTSETTINGS_DOCUMENT);
    LONG Filter = bc.GetLong(DOCUMENT_SELECTIONFILTER);
     
    bc.SetLong(DISPLAYFILTER_POLYGON,...);  // <--- does something go here?
    doc->SetData(DOCUMENTSETTINGS_DOCUMENT,bc);
    

    2. Second to the above, can this be done on a per-viewport basis? I've tried the GetBaseDrawCount() to try and find a window count, but it always returns the same value (which is 4 for me) which leaves me unsure on how to get a viewport on an individual basis (if possible).
     
    Cheers,
     
    WP



  • On 13/06/2014 at 08:06, xxxxxxxx wrote:

    What you've got there is code for the SelectionFilter option. Not the DisplayView option.
    This is how to enable/disable the DV polygon option.
    AFAIK. This option can't be different for multiple windows.

        BaseDraw *bd = doc->GetActiveBaseDraw();  
      
      //Use "TRUE" or "FALSE" to turn it on/off  
      bd->SetParameter(DescLevel(BASEDRAW_DISPLAYFILTER_POLYGON), FALSE, DESCFLAGS_SET_0);
    

    Since you've said you don't understand that code you posted.
    Here's also examples of how to use it to enable/disable the SelectionFilter's  polygon option.
    The SelectionFilter uses bitwise operators to enable/disable them.

    //This code Turns the Select->SelectionFilter menu polygon filter option OFF  
    //The option found in the Select->Selection Filter menu  
      
      //Gets the document's container which includes the selection filter bit mask  
      BaseContainer bc = doc->GetData(DOCUMENTSETTINGS_DOCUMENT);  
      
      LONG sf = bc.GetLong(DOCUMENT_SELECTIONFILTER);   //Get the filter bit mask  
       
      if(!(sf & SELECTIONFILTERBIT_POLYGON))            //If the polygon option is enabled  
      {        
          LONG f = sf | SELECTIONFILTERBIT_POLYGON;     //Turns the polygon filter option off using the bitwise switching off code  
          bc.SetLong(DOCUMENT_SELECTIONFILTER, f);  
      }  
      doc->SetData(DOCUMENTSETTINGS_DOCUMENT, bc);  
      
      EventAdd();  
      
      
      
      
    //This code Turns the Select->SelectionFilter menu polygon filter option ON  
    //The option found in the Select->Selection Filter menu  
      
      //Gets the document's container which includes the selection filter bit mask  
      BaseContainer bc = doc->GetData(DOCUMENTSETTINGS_DOCUMENT);  
      
      LONG sf = bc.GetLong(DOCUMENT_SELECTIONFILTER);  //Get the filter bit mask  
       
      if(sf & SELECTIONFILTERBIT_POLYGON)             //If the polygon option is enabled  
      {       
          LONG f = sf &~ SELECTIONFILTERBIT_POLYGON;   //Turns the polygon filter option on using the bitwise switching ON code  
          bc.SetLong(DOCUMENT_SELECTIONFILTER, f);  
      }  
      doc->SetData(DOCUMENTSETTINGS_DOCUMENT, bc);  
      
      EventAdd();
    

    -ScottA



  • On 14/06/2014 at 03:21, xxxxxxxx wrote:

    Hi Scott,
    thanks for the above, I seem to have the viewport filters under control now. I was all over the place with them!
     
    The selection ones don't seem to be doing much for me - I'll need to have a closer look at them.
     
    WP.


Log in to reply