Getting Slider Value on Mouse Release?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/05/2011 at 01:24, xxxxxxxx wrote:
Sorry it took me so long to respond. I'm using Undo's in the normal way. Basically in my Command() function I am doing:
if id==10013:
self.Tweening(self.GetReal(10013))inside of my Command() function, that's all. Obviously 10013 is the ID of the slider itself. It seems to store each value as I drag it. I want it to not run until I let go of my click instead of as im dragging the slider.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/05/2011 at 04:09, xxxxxxxx wrote:
This is a coffe snippet that should do what you want.
Just use GetInputSate() in Python.if(msg->GetData(BFM_ACTION_INDRAG) == FALSE && msg->GetData(BFM_ACTION_VALCHG) == FALSE)
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/05/2011 at 11:58, xxxxxxxx wrote:
Thanks Nux,
But is there something I must do first to set the msg basecontainer? I tried InputState() but I am not sure which should be the the askdevice and which should be the askchannel.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/05/2011 at 17:40, xxxxxxxx wrote:
Here's an example:
if id == 1002: # The slider's ID getvalue = self.GetReal(1002) # Gets the value of the slider bc = c4d.BaseContainer() # Create a container to hold the slider's state state = self.GetInputState(1002, 0, bc) # Gets the state of the slider if state == False: # If the slider has stopped being dragged bc.SetReal(0,getvalue) # Set the value of the container's first element to the slider's value print bc[0] # Print the value of the container's first element; # In other words....The slider's current position c4d.EventAdd()
This will get the slider's value. And store it in the new container.
But only after the slider has stopped moving.This does not however, seem to have any impact on using undo's as far as I can see.
So if you figure out how to use undo's on the sliders themselves. Please post it here.
Because it's something I'd like to know how to do myself. And I can't find any examples of how to do it anywhere.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/05/2011 at 18:30, xxxxxxxx wrote:
Hey Scott,
Thanks for the code, but unfortunately it does not work. I will try to present the problem a little bit clearer to hopefully show the problem but I can't post much of the code(in addition to not being able to show the code, there's also just a ton of code too )
If you use that Code, even if I just click on my slider and not drag, I get at least 2 prints to the console. If I click and drag, I get much much more. See this image here: http://dl.dropbox.com/u/5823011/ConsoleOutput.jpg
That was me just draging the slider a little bit.
The reason why this is bad is because I have a function that does some stuff with keys. That function on it's own is working great, it works with the buttons, etc. But because when I adjust the slider it's executing so many times, the function gets called so many times(it makes far too many keys.)
I basically just need to get the value from when I let go, and no matter what I do, I get something like that console pic. :/.
I really appreciate the efforts you guys are putting in though. Thanks for the help so far.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/05/2011 at 15:54, xxxxxxxx wrote:
Sebastian pointed me to looking at the Command's bc(ie msg) but I apparently was not passing a BC in my Command() function(was doing msg=None). So I changed that.
Then he suggested I do:
if id==10013:
if bc.GetBool(c4d.BFM_ACTION_INDRAG) is False:
doFunction()Easy Peasy. I feel stupid now.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/05/2011 at 17:48, xxxxxxxx wrote:
The code you posted does the same thing.
The slider's changes get cached. Then it returns them all, once the function is called:def Command(self, id, msg) : if id == 1002: # The slider's ID bc = c4d.BaseContainer() if bc.GetBool(c4d.BFM_ACTION_INDRAG) is False: print self.GetReal(1002) return True
What do you mean you changed msg from msg=none?
What did you change it to?-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/05/2011 at 22:18, xxxxxxxx wrote:
I was originally using:
def Command(self, id, msg=None) :
...I eventually changed it so it wasn't None(I have no clue why I even made it None), and then what I wrote appeared to work. I dunno.
< ="utf-8">
if id==10013:
if bc.GetBool(c4d.BFM_ACTION_INDRAG) is False:
print "YEEEEEEEEHAW!!!!"
It still gets all the values like my image shows, but that extra if allows me to only execute it at the end. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/05/2011 at 11:31, xxxxxxxx wrote:
Originally posted by xxxxxxxx
def Command(self, id, msg) : if id == 1002: # The slider's ID bc = c4d.BaseContainer() if bc.GetBool(c4d.BFM_ACTION_INDRAG) is False: print self.GetReal(1002) return True
The code doesn't make sense. You create a new BaseContainer and try to get a value. This vill obviously return 'None' since the container didn't ever recieve a value for c4d.BFM_ACTION_INDRAG.
Change bc to msg.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/05/2011 at 12:06, xxxxxxxx wrote:
^ I know it doesn't make sense.
That's why I was asking for an example.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/05/2011 at 12:51, xxxxxxxx wrote:
Ahh yes i see the confusion now my bad.
It is as nux said you need to run that check from the basecontainer passed in the command function. Usually that is msg. For some reason i changed it to be bc so it was Command(self, id, bc). That is the bc i refer to in my code but normally that would be msg.