Checking for values in edit fields in a tag



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

    On 30/07/2012 at 08:47, xxxxxxxx wrote:

    I'm creating a new TagData object in Python.
    There are values in some edit fields that I want to check, when they are changed.
    How can I do that?
    I'm already checking for any change with:

    def Message(self,node,type,data) :
         if type==c4d.MSG_DESCRIPTION_VALIDATE:

    But then, how do I know what item was changed?
    If I print the data variable, it always returns None.

    Rui Batista



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

    On 30/07/2012 at 11:21, xxxxxxxx wrote:

    Check the docs: At NodeData.Message() it says:

    MSG_DESCRIPTION_VALIDATE Allows you to update dependencies or to check for invalid values after a parameter has been changed (For example: the light's inner radius always must be smaller than the light's outer radius - so this routine checks for it and corrects it). The corresponding data is DescriptionValidate.

    The data parameter should contain information about the item that has changed. Among the docs it should be a DescriptionValidate object. Dunno if that's correct (as the docs doesn't link to the documenation of DescriptionValidate ). Just print data and see what you can do with it.

    -Nik



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

    On 30/07/2012 at 11:33, xxxxxxxx wrote:

    I did, Niklas.

    I tested the code:

    def Message(self,node,type,data) :
         if type==c4d.MSG_DESCRIPTION_VALIDATE: print data
         return True

    It prints out None
    The sentence "The corresponding data is DescriptionValidate" gives me no information of how to use DescriptionValidate or even what it is.



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

    On 30/07/2012 at 11:42, xxxxxxxx wrote:

    DescriptionValidate doesn't do anything - it only has a constructor and a flags member which isn't used.

    Basically, when this message is received, Cinema is telling you that something has changed and is asking you to check that all your values are valid. You can do anything or nothing in response. So, if you have a numeric text field where the value mustn't exceed n, then just check to make sure the value doesn't exceed n and take corrective action if it does (like setting it back to n, for example). There's nothing more fancy to it than that.

    Edit: I should also have said that if you want to check the value of a field when a particular field changes, you should respond to MSG_DESCRIPTION_CHECKUPDATE instead - this does tell you what element was changed.



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

    On 30/07/2012 at 11:55, xxxxxxxx wrote:

    Well, I tried:

    def Message(self,node,type,data) :
         if type==c4d.MSG_DESCRIPTION_CHECKUPDATE:
              print data

    And I still get None :-(



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

    On 30/07/2012 at 11:58, xxxxxxxx wrote:

    I was using MSG_DESCRIPTION_POSTSETPARAMETER in C++, the corresponding data should be DescriptionPostSetValue. Maybe it's valid in Python, you may try it. :)

    -Nik



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

    On 30/07/2012 at 12:10, xxxxxxxx wrote:

    But the sentence "the corresponding data should be DescriptionPostSetValue" doesn't explain me how to use it ;-)

    if I code:

    def Message(self,node,type,data) :
         if type==c4d.MSG_DESCRIPTION_POSTSETPARAMETER:
              print c4d.DescriptionPostSetValue

    I get an error telling me:
    AttributeError: 'module' object has no attribute 'DescriptionPostSetValue'



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

    On 30/07/2012 at 12:25, xxxxxxxx wrote:

    No, do print data again. If that is not None, you can use print dir(data) and watch out for attributes that may be interesting to you. :)

    -Nik



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

    On 30/07/2012 at 12:38, xxxxxxxx wrote:

    It still prints None :-(
    But I managed to do it, just by testing the fields that I need to test when the type is c4d.MSG_DESCRIPTION_VALIDATE



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

    On 30/07/2012 at 12:57, xxxxxxxx wrote:

    Maybe try to always print data and the corresponding ID, and then search for the ID in the c4d module. This way, you would see to what type of message you actually recieve a not-None value for data.

    -Nik


Log in to reply