Lock or Protect Attribute User Text?

Hi All,

I’m wondering if there is a way to ‘lock’ or protect the Rhino 6 Attribute User Text that is easy to implement within a script? In particular, the ‘Object Name’ is a causing a bit of a problem for me at the moment:

I have a short script and dialogue window to accept/set a series of user-determined parameters which are applied to an object and stored in Attribute User Text fields. That all works fine and in my script I can set the object name in the Attribute User Text using the line:

rs.SetUserText(objectInstance, ‘Object Name’, ‘%<ObjectName("{}")>%’.format(str(objectInstance)))

to ‘set’ the Object Name in the Attribute User Text properly using the script. This seems to mimic the action of the ‘Text Field’ button and selecting ‘Object Name’ from the list. So if the name is updated in the ‘Properties’ it auto-updates in the Attribute User Text which is good.

The problem comes later on, as the user is working away and the Attribute User Text panel is there, it’s easy to accidentally try and rename the Object through the Attribute User Text panel, rather than back on the ‘Properties’ panel. This then breaks the link and causes problems down the line…

So, is there any easy way to ‘lock’ or ‘protect’ the Attribute User Text from accidental overwriting? I’d like the user to be able to see the params as they work, just not be able to (try and) overwrite the object name through the panel - only through the pop-up dialog that I’m writing or on the Properties dialogue.

Any thoughts on how to implement such a protection are much appreciated!!

Currently there is not a way. I’ve been thinking of ways to make UserText attributes that contain functions more obvious in the UI to combat this scenario.

The best thing that I have come up with is to add another column to the panel that has some form of icon that would indicate where function are applied and how they are applied.

icons might include: Fx one way binding or Fx two way binding

This could help the user know that this user text is bound to a function and how that binding works.

Now if you change the value manually you would see some indicator of a broken binding and could undo. There are some other situations where the Key could break things. The block attribute is one possible way where renaming the key could break a block attribute binding. In this scenario some form of key icon is desirable.

Ah - gotcha, thank you for the clarification.

Yes I agree: something that indicates its a ‘link’ would be helpful. Maybe A color or font change, or like Excel it could just show the formula when you ‘click in’ to the cell there. Something that indicates its being driven by another place though would be great.

at any rate, thanks for the feedback.