Hi,
I’m quite new to Blender and Python.
At the moment I’m trying to create a simple xml exporter. Everything worked fine until I began to add some GUI elements for setting parameters. One huge problem I have is that when I type something into a textfield (String), focus some other element and then move the mouse cursor out of the python window the textfield becomes blank again.
Same with sliders. Those reset to their initial position.
Maybe you could point me to some commom error that could cause this. The GUI code is very close to the one in the Blender Python tutorial.
BTW: I’m using blender 2.34 on Linux if that is of any relevance.
Are you sure you create() the button only once? One thing I can think of that would cause this is creating the button inside the draw function, or simply by the code altering the text (the val button parameter).
Ok, in that case the code for the string button is not correct. It should be:
B_Filename = String('',EVENT_NOEVENT,90,140,165,18, B_Filename.val,100,'the filename you want to export to')
Blender must know the parameter to return the text you type in. The Blender python documentation is misleading, it is not just the initial value of the string.
Good suggestion. I’ll think about it. Problem is that the alignment of all the text fields doesn’t look that good when using this method. I’ll probably stick to my custom layout.
But as my exporter is now feature complete (for now) I won’t change a thing until something else needs fixing.