Custom Attribute Editor Template for plugins / whitespaces in string attributes

Hey folks

Because It seems like bonus tools 2022 and above have removed the stringFormat node, i have dived into plugins for the first time and done my own. Very simple, just a node to convert a float to string and combine it with an optional prefix. Using it to drive annotations nodes and text nodes with live values.

Right now I can’t get the string attribute for the prefix to accept a trailing whitespace, ie i want it to be "Value: " but i end up with “Value:”.

if I set the string attr with setAttr its fine, but if I input it into the attribute editor it’s trimmed. I can find basic info about setting up custom Attribute Editor Template but can’t find anything as specific as this. Normal Maya textFields allow trailing / leading whitespaces but maybe something in the attr editor is trimming it when you hit return.


The answer was, that even when rolling your own attributeEditorTemplate, the general guidance to sync the UI of it with the attribute itself is to use connectControl. But unfortunately this is the bit that strips and trims whitespaces. So I had to recreate that functionality. The results of which can be seen here maya_tools/plugins/string_format at main · AronDurkinSSS/maya_tools · GitHub