If I have a nurbs object is there a simple way I can just change the position of it when I have it selected?
I finaly found out the problem and got it to work with a nurbs. Now it seems I have a different problem. I can get many buttons to display and work, but when I try and get the value from a slider button, I get an error. What is the proper way to print the value from a Slider button when touched?
print sli.val
if sli is your Sliderbutton. Please post the error-message next time, so it is easier to determine your error.
Yes, that fixed it. Thank you!
Yes, it works. But this message board seems to keep getting rid of my posts!!
The only other problem now, is that the toggle buttons dont change their state when I click them. I am using 7 arguements instead of the 6 in my tutorial becuase the compiler is asking for 7. I also found out that adding a 1 or 0 at the end changes the state. But why does it not change when I click on it? And how do I determine the state after?
First of all, create your Togglebutton (usually as a global variable):
tb = Create(1)
This togglebutton is initally true(pressed), use Create(0) otherwise.
In your gui-function you draw the togglebutton. The trick is to assign the button to itself:
tb = Toggle("Toggle" , 1, 10, 10, 100, 25, tb.val)
You determine the state with tb.val.
To get an explanation for all the Togglebutton-arguments execute the following script inside blender:
import Blender
print Blender.Draw.Toggle.__doc__
I must have bad version of python as these dont work. I will re-install tonight and try again.
I have played a bit. I finaly got the documenation to print out. And some things working, but when I use tb.val in the togglebutton I get this:
UnboundLocalError: Local variable ‘tb’ referenced before assignment. But if I try to print tb.val, it works. Strange.
Ah, that’s an easy one
Put the following line in your gui-function:
global tb
Thankyou Shlops! Thanks to you I have got these buttons working. Now, I have another problem though lol, I can do anything with my active object, but I want to do the same to all selected objects at once. Do I have to send them to a kind of buffer and then make objects of all the items in a kind of loop?
Hey DAK, here is your personal python trainer again!
theeth has anwsered this before: https://blenderartists.org/board/viewtopic.php?t=1118
And map and/or apply might be your friends, see the python-documentation over at http://web.pydoc.org/. Otherwise use a loop