Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > PYTHON Development
  New Posts New Posts
  FAQ FAQ  Forum Search

Limiting user data entries

Author
Message
  Topic Search Topic Search
avd007 View Drop Down
Member
Member


Joined: 2010 Dec 31
Online Status: Offline
Posts: 134
Direct Link To This Post Topic: Limiting user data entries
    Posted: 2011 Jun 24 at 9:18pm
Hello fine Gents and ladies! SmileI 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. Ermm
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2011 Jun 25 at 3:53am
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,
Back to Top
avd007 View Drop Down
Member
Member


Joined: 2010 Dec 31
Online Status: Offline
Posts: 134
Direct Link To This Post Posted: 2011 Jun 25 at 3:44pm
perfectionBig smile! 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!


Edited by avd007 - 2011 Jun 25 at 3:49pm
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.078 seconds.