MSG_POINTS_CHANGED



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

    On 02/06/2011 at 07:02, xxxxxxxx wrote:

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

    ---------
    Howdy,

    It seems that when an object with my tag on it is in a ClothNURBS, the tag receives the message MSG_POINTS_CHANGED when in fact the object's points have not changed. This is causing a crash in my routine to remap the stored data when receiving that message.

    In my debugging I've noticed that when it crashes, the document pointer is NULL. Would it be safe to assume that the tag only needs to react on the message MSG_POINTS_CHANGED when the document actually exists?

    Adios,
    Cactus Dan



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

    On 06/06/2011 at 06:09, xxxxxxxx wrote:

    It seems to be true for every generator that creates geometry, like Cloth NURBS, Hyper NURBS etc.

    Which document pointer do you mean?

    cheers,
    Matthias



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

    On 06/06/2011 at 06:56, xxxxxxxx wrote:

    Howdy,

    Well, in the TagData::Message() function I'm getting the document pointer like this:

    BaseDocument *doc = node->GetDocument();
    

    But, I've since noticed that editor tools, like Subdivide, which change the point count also send MSG_POINTS_CHANGED to the tag before the final object is inserted into the document. So, with that bit of information, I reckon it isn't safe to assume that the message can be ignored if there is no document. 😠

    Adios,
    Cactus Dan



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

    On 07/06/2011 at 07:14, xxxxxxxx wrote:

    It seems to work on the caches of the object. When I compare the point number of the tag's parent object with the VariableChanged point numbers it equals the new point number. I have to think about a solution.

    cheers,
    Matthias



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

    On 07/06/2011 at 08:00, xxxxxxxx wrote:

    Howdy,

    Well, I think I may have a solution.

    My tag is storing the point count in the tag's container, so that when it has to cycle through the stored data in a loop it retrieves the count from the container. This point count is updated whenever the data is remapped when the point count actually changes.

    The crash problem was happening in the standard C++ library's memcpy() function, which is called by the Cinema 4D API CopyMem() function. In debugging, I added a dummy LONG variable to the function that is calling CopyMem(), to retrieve the stored point count from the tag's container, so I could see the stored count in the debugger when it crashed. And sure enough the count was not the same as the vchg->old_cnt.

    So my solution is to compare the vchg->old_cnt with the stored point count in the tag's container, and if they're not equal, ignore the MSG_POINTS_CHANGED message.

    It seems to work so far, but I'm still testing.

    Adios,
    Cactus Dan


Log in to reply