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

    Determining state of an object

    Scheduled Pinned Locked Moved SDK Help
    15 Posts 0 Posters 1.2k 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 26/08/2009 at 17:11, xxxxxxxx wrote:

      Not sure what you are trying to achieve here. This code is a bit cleaner but you return the same value (!blnSymmetryActive) whether it is a polygon object or not:

      > Bool TrueSymmetry::GetDEnabling(GeListNode \*node, const DescID &id;,GeData &t;\_data,LONG flags,const BaseContainer \*itemdesc) \> {      \>      /////////////////CHECK FOR EDITABLE/////////////////////// \> // Is the plugin a tag plugin? \>      BaseObject\* op = (BaseTag\* )(node)->GetObject(); \>      // ??? Not used - BaseContainer\* bc =     (BaseObject\* )(node)->GetDataInstance(); \>       \>      if (op->IsInstanceOf(Opolygon)) \>      {      \>           GePrint ("The object is NOT Editable"); \>           switch (id[0].id) \>           { \>                case SYMMETRY_PLANE: \>                     return !blnSymmetryActive; \>           } \>           return FALSE; \>      } \>      else \>      { \>           GePrint ("The object is editiable"); \>           switch (id[0].id) \>           { \>                case SYMMETRY_PLANE: \>                     return !blnSymmetryActive; \>           } \>           return TRUE; \>      } \>      /////////////////////////////////////////////////////////// \>       \>      // Enable/disable our parameters \>      switch (id[0].id) \>      { \>           case SYMMETRY_PLANE: \>                return !blnSymmetryActive; \>      } \>      return TRUE; \> }

      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 26/08/2009 at 17:16, xxxxxxxx wrote:

        I am trying to set it up so that if it is an editable polygon, then the checkbox is enabled,

        if it is not an editable polygon, the checkbox is not enabled.

        What should I change to make it do that.

        Also, when I use this code, It makes Cinema 4D crash and tells me that
        "op" is not being initialized.

        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 26/08/2009 at 17:22, xxxxxxxx wrote:

          There is really no such thing as an editable polygon object. There is, but you won't be able to tell (has deformers under it for instance). The only determinable thing that is editable is something that isn't a polygon object (Ocube, Onull, Osds, etc.).

          Get the BaseContainer, as I showed but uncommented, and set the value accordingly:

          bc->SetBool(SYMMETRY_PLANE, TRUE);
          - or -
          bc->SetBool(SYMMETRY_PLANE, FALSE);

          I wouldn't do this in GetDEnabling() as it is strictly for enabling/disabling (greying out of) of the plugin's Attribute Manager elements. Execute() may be more appropriate but GetDDescription() if you are overriding that function.

          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 26/08/2009 at 17:39, xxxxxxxx wrote:

            That's what I want it to do.. I want it to gray it out if it is not a polygon object

            So I think I need to do it in GetDEnabled..

            Is there a way to initialize op within GetDEnabled?

            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 26/08/2009 at 18:12, xxxxxxxx wrote:

              Ah. Then you must return TRUE (enable) or FALSE (disable) from GetDEnabling(). This is on a case by case basis (by description ID).

              > Bool TrueSymmetry::GetDEnabling(GeListNode \*node, const DescID &id;,GeData &t;\_data,LONG flags,const BaseContainer \*itemdesc) \> {      \>      /////////////////CHECK FOR EDITABLE/////////////////////// \>      BaseObject\* op = (BaseTag\* )(node)->GetObject(); \>       \>      switch (id[0].id) \>      { \>           case SYMMETRY_PLANE: \>                if (op->IsInstanceOf(Opolygon)) \>                {      \>                     GePrint ("The object is NOT Editable"); \>                     return FALSE; \>                } \>                else \>                { \>                     GePrint ("The object is editiable"); \>                     return TRUE; \>                } \>      } \>      return TRUE; \> }

              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 26/08/2009 at 18:21, xxxxxxxx wrote:

                Thank you for your help..

                Now I get this error.

                > `

                  
                \>  1>c:\users	he fosters\desktop\cinema4dr11010\plugins	ruesymmetry\source	ag	ruesymmetry.cpp(124) : error C2039: 'GetObject' : is not a member of 'GeListNode'  
                \>  1>        c:\users	he fosters\desktop\cinema4dr11010\resource_api\c4d_baselist.h(380) : see declaration of 'GeListNode'  
                \>  
                

                `

                🙂

                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 26/08/2009 at 18:35, xxxxxxxx wrote:

                  I think you can do it one of these two ways (this always confuses me when going into the casted class) :

                  (BaseTag* )node->GetDataInstance();

                  or

                  static_cast<BaseTag*>(node)->GetDataInstance();

                  The first is C style and the second is C++ style. I've been trying to do the C++ style as it is more clearly determined in the C++ standard than the old C style.

                  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 26/08/2009 at 18:49, xxxxxxxx wrote:

                    LOL.. well At least I got a different error this time.

                    1>c:\users he fosters\desktop\cinema4dr11010\plugins ruesymmetry\source ag ruesymmetry.cpp(126) : error C2440: 'initializing' : cannot convert from 'BaseContainer *' to 'BaseObject *'
                    1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

                    I tried both C and C++ style C style gave me the original error. C++ style gave me the above error.

                    🙂

                    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 26/08/2009 at 18:50, xxxxxxxx wrote:

                      current code

                      > `

                        
                      \>  Bool TrueSymmetry::GetDEnabling(GeListNode *node, const DescID &id;,GeData &t;_data,LONG flags,const BaseContainer *itemdesc)  
                      \>  {       
                      \>       /////////////////CHECK FOR EDITABLE///////////////////////  
                      \>    
                      \>         
                      \>        BaseObject* op = static_cast<BaseTag*>(node)->GetDataInstance();  
                      \>       switch (id[0].id)  
                      \>       {  
                      \>            case SYMMETRY_PLANE:  
                      \>                 if (op->IsInstanceOf(Opolygon))  
                      \>                 {       
                      \>                      GePrint ("The object is NOT Editable");  
                      \>                      return FALSE;  
                      \>                 }  
                      \>                 else  
                      \>                 {  
                      \>                      GePrint ("The object is editiable");  
                      \>                      return TRUE;  
                      \>                 }  
                      \>       }  
                      \>       return TRUE;  
                      \>         
                      \>       // Enable/disable our parameters  
                      \>       switch (id[0].id)  
                      \>       {  
                      \>            case SYMMETRY_PLANE:  
                      \>                 return !blnSymmetryActive;  
                      \>       }  
                      \>       return TRUE;  
                      \>  }  
                      \>    
                      \>              
                      \>  
                      

                      `

                      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 26/08/2009 at 18:58, xxxxxxxx wrote:

                        Obviously,

                        BaseObject* op = static_cast<BaseTag*>(node)->GetDataInstance();

                        is not correct. You want the object of the tag not the BaseContainer, so use:

                        BaseObject* op = static_cast<BaseTag*>(node)->GetObject();

                        Also, the second switch() will never be encountered. If you want to do both setting by the type of object and allow it to be set using blnSymmetryActive, you will need to combine the two sets of conditions (&& or ||) under the first switch() statement.

                        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 26/08/2009 at 19:03, xxxxxxxx wrote:

                          Bool TrueSymmetry::GetDEnabling(GeListNode \*node, const DescID &id;,GeData &t;\_data,LONG flags,const BaseContainer \*itemdesc) \> {      \>      /////////////////CHECK FOR EDITABLE/////////////////////// \> \>      switch (id[0].id) \>      { \>           case SYMMETRY_PLANE: \>                   BaseObject\* op = static_cast<BaseTag\*>(node)->GetObject(); \>                if (op->IsInstanceOf(Opolygon)) \>                {      \>                     GePrint ("The object is NOT Editable"); \>                     // blnSymmetryActive won't change this outcome ;) \>                     return FALSE; \>                } \>                else \>                { \>                     GePrint ("The object is editiable"); \>                     return !blnSymmetryActive; \>                } \>      } \>      return TRUE; \> }

                          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 26/08/2009 at 19:14, xxxxxxxx wrote:

                            lol..   works like a champ now..

                            Thanks for your help Robert. You are a true help and a wonderful resource.

                            Thanks,

                            ~Shawn

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