Redraw spline GUI



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

    On 22/04/2012 at 11:43, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R13 
    Platform:      
    Language(s) :

    ---------
    Anyone know how to make the spline GUI in R13 redraw itself to reflect changes in the range?

    I've got a spline GUI in a description and I've added the ability for the user to alter the range of Y values from the default maximum of 1. (Note to Maxon: this ought to be part of the GUI. If it already is, it needs to be easier to find!)

    Anyway, the range change works fine, except that when the user changes the range the spline GUI doesn't redraw to reflect this. I can make it redraw by clicking the little arrow next to the spline GUI, but I'd like to do it from code.

    I've tried a MSG_UPDATE message and EventAdd(EVENT_FORCEREDRAW) but neither work.

    What am I missing?

    Thanks,

    Steve



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

    On 22/04/2012 at 15:38, xxxxxxxx wrote:

    Hi Steve,

    Have you tried

      
    GeSyncMessage(`EVMSG_ASYNCEDITORMOVE);  
    

    that might help.

    `



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

    On 23/04/2012 at 00:59, xxxxxxxx wrote:

    Hi Shawn,

    No, I hadn't tried that but I have now, and it doesn't make any difference I'm afraid.

    Nice idea though - it could have worked, thank you.

    Steve



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

    On 23/04/2012 at 01:00, xxxxxxxx wrote:

    How do you set the range? Could you give a little code snippet?



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

    On 23/04/2012 at 01:17, xxxxxxxx wrote:

    Yes, here's the Message function for this plugin:

      
    Bool XModScale::Message(GeListNode *node, LONG type, void *data)   
    {   
         SplineData *spd = NULL;   
         BaseObject *op = (BaseObject* )node;   
         BaseContainer *bc = op->GetDataInstance();   
      
         if(type == MSG_DESCRIPTION_CHECKUPDATE)   
         {   
              spd = (SplineData* )bc->GetCustomDataType(XMSC_SCALE_SPLINE, CUSTOMDATATYPE_SPLINE);   
              if(spd)   
              {   
                   spd->SetRange(0.0, 1.0, 0.01, 0.0, bc->GetReal(XMSC_SCALE_YMAX), 0.01);   
                   // these next calls don't have any effect   
                   op->Message(MSG_UPDATE);   
                   EventAdd(EVENT_FORCEREDRAW);   
              }   
         }   
      
         return SUPER::Message(node, type, data);   
    }   
    

    As you can see, all that happens is that if the user changes the maximum Y value field, the range is changed. This does work - the new max value is then applicable and can be used - but the GUI doesn't update correctly unless forced to, e.g. by clicking that little arrow next to the GUI name.



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

    On 23/04/2012 at 02:31, xxxxxxxx wrote:

    i am everything but experienced, but why are you trying to implement this as a Mesage and not
    under GetDDescription ? it is a change to the description file of your plugin, won't be 
    GetDDescription the more appropriate place for it ?



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

    On 23/04/2012 at 03:45, xxxxxxxx wrote:

    Just a wild guess, but how about trying to get your hands on the actual GUI element with FindCustomGui() and then calling its Redraw() method?
    It does work in dialogs, I don't know about Descriptions though.



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

    On 23/04/2012 at 07:04, xxxxxxxx wrote:

    Thanks Jack. I don't think I can do that though, because FindCustomGui() is a member of GeDialog and I'm not using a dialog - so there's no way to call the function, unfortunately.



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

    On 23/04/2012 at 08:29, xxxxxxxx wrote:

    Ah right, sorry. I didn't see it's a GeDialog member.



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

    On 23/04/2012 at 09:21, xxxxxxxx wrote:

    It was a good idea though. It made me think of looking at the global function FindCustomGuiPlugin(), which seemed to work, in that it returned something. Unfortunately the 'something' isn't a SplineCustomGui since calling Redraw with that just caused a crash.

    So I'm back to square one :-)


Log in to reply