Determining state of an object



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



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



  • 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; \> }



  • 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'  
    \>  
    

    `

    :)



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



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

    :)



  • 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;  
    \>  }  
    \>    
    \>              
    \>  
    

    `



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



  • 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; \> }



  • 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


Log in to reply