Limiting user data entries

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

On 24/06/2011 at 21:18, xxxxxxxx wrote:

Hello fine Gents and ladies! 🙂I was hoping to find out If there is a way to dynamically limit the Maximum limit for a user data entry.

for example....

i have a user data value, a float.

width     = op[c4d.ID_USERDATA,6]

and another

bevRadius  = op[c4d.ID_USERDATA,5]

and i want to dynamically set the limit of the bevRadius based on the width. i have been able to get it to hapen within the code, but i was hoping there might be a way to just stop the value from exceeding a certain limit while the user is sliding the control.

thanks for the help! ... again. 😕

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

On 25/06/2011 at 03:53, xxxxxxxx wrote:

Try this.

import      c4d  
  
myUserDataId        = 1  
myNewMaxLimitValue  = 2  
myObject            = doc.GetFirstObject()  
  
allUserdatas        = myObject.GetUserDataContainer()  
  
for descId, container in allUserdatas:  
  # get the UserData id from 'descId'  
  id              = descId[1].id  
  
  if id == myUserDataId:  
      # the id for the maximum value is 6  
      container[6]    = myNewMaxLimitValue  
      myObject.SetUserDataContainer(descId, container)

Cheers,

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

On 25/06/2011 at 15:44, xxxxxxxx wrote:

perfection😄! thanks nux!

EDIT: not only did you help me with this, but that simple loop through User data containers is awesome! thanks so much man!