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

    CheckDisplayFilter question

    Scheduled Pinned Locked Moved SDK Help
    14 Posts 0 Posters 987 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 29/04/2011 at 03:31, xxxxxxxx wrote:

      The R12 docs are currently wrong about CheckDisplayFilter. I will try to get an updated description of the function.

      cheers,
      Matthias

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 29/04/2011 at 07:04, xxxxxxxx wrote:

        Doh!
        I was afraid of that.

        If I use this instead:  LONG filter = docdata->GetLong(SELECTIONFILTERBIT_POLYGON);
        It doesn't produce any errors...However the state of the filter doesn't seem to respond properly.

        Thanks for looking into this.
        -ScottA

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 12/05/2011 at 09:12, xxxxxxxx wrote:

          I know you're probably very busy Matthias.
          But is there any update on this yet?

          -ScottA

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 17/05/2011 at 06:15, xxxxxxxx wrote:

            Sorry for the delay, here are some examples how to access the selection and display filters.

            Selection filter:

              
            // retrieve the document info container that includes the selection filter bit mask  
            BaseContainer bc = doc->GetData(DOCUMENTSETTINGS_DOCUMENT);  
              
            // get the filter bit mask  
            LONG sf = bc.GetLong(DOCUMENT_SELECTIONFILTER);  
              
            // check if a bit is set or not  
            if (!(sf & SELECTIONFILTERBIT_NULL))  
            {  
              // do something  
              GePrint("Null");  
            }  
            

            Display filter:

              
            BaseDraw *bd = doc->GetActiveBaseDraw();  
              
            LONG i;  
              
            // iterate through all display filters  
            for (i=(BASEDRAW_DISPLAYFILTER_BEGIN+1); i<BASEDRAW_DISPLAYFILTER_END; i++)  
            {  
              if (bd->GetParameterData(i).GetLong())  
              {  
                  // i is the ID of the set filter; do something  
                  GePrint(LongToString(i));  
              }  
            }  
            

            cheers,
            Matthias

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 17/05/2011 at 11:44, xxxxxxxx wrote:

              Nice.
              Thank you sir. 👍

              -ScottA

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 17/05/2011 at 17:31, xxxxxxxx wrote:

                Darn it!
                Getting the state of the tool is only half of the solution.
                I still can't figure out how to toggle their bits to turn them on/off in the menu.

                BaseContainer bc = doc->GetData(DOCUMENTSETTINGS_DOCUMENT);   
                LONG sf = bc.GetLong(DOCUMENT_SELECTIONFILTER);  
                if (!(sf & SELECTIONFILTERBIT_POLYGON)) // If the polygon option is enabled  
                {  
                  // How do I Set the bit to 1(off) to turn it off in the menu?     
                }
                

                -ScottA

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 18/05/2011 at 00:19, xxxxxxxx wrote:

                  I guess you would do:

                    
                  sf = sf | SELECTIONFILTERBIT_POLYGON;   
                  bc.SetLong(DOCUMENT_SELECTIONFILTER);   
                  doc->SetData(DOCUMENTSETTINGS_DOCUMENT, bc);   
                  
                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 18/05/2011 at 08:16, xxxxxxxx wrote:

                    Thanks spedler.
                    That works for turning the option off:

                    BaseContainer bc = doc->GetData(DOCUMENTSETTINGS_DOCUMENT); // Gets the document info container that includes the selection filter bit mask  
                     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 poygon option off  
                    bc.SetLong(DOCUMENT_SELECTIONFILTER, f);  
                      }  
                     doc->SetData(DOCUMENTSETTINGS_DOCUMENT, bc);  
                     EventAdd();
                    

                    But how do I toggle it on?
                    I looked up the bitwise operators on the internet and tried them. But none of them worked.
                    If I use the || bitwise operator. It turns on the Null option no matter which filter name I use.

                    I was kind of hoping I could use ToggleBit(BIT_ACTIVE) with this. But I keep running into pointer errors when trying to use it.

                    -ScottA

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

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 18/05/2011 at 08:26, xxxxxxxx wrote:

                      The opposite of a bitwise OR '|' is AND-NOT '&~'.

                      So, setting bits (to 1) is accomplished with:

                      sf |= BITFLAGS;

                      And unsetting bits (to 0) is accomplished with:

                      sf &= ~BITFLAGS;

                      (Note that BITFLAGS is just an example constant.  To do more than one flag in either case, wrap in () and | them, such as sf &= ~(BITFLAG_0|BITFLAG_1|BITFLAG_4); which unsets all three of these bits).

                      Hope that helps! 😄

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

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 18/05/2011 at 08:29, xxxxxxxx wrote:

                        The || operator is not a bit operator but a logic operator. The bit operator is just one |.

                        Btw. for the selection filter mask the behaviour is like this, if a bit is set the option is disabled.

                        cheers,
                        Matthias

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

                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                          On 18/05/2011 at 09:25, xxxxxxxx wrote:

                          &~ did the trick.

                          So many little things to learn. It seems to never end. 😉
                          Thanks a lot for the help guys.

                          -ScottA

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