tony Posted March 12, 2009 Share Posted March 12, 2009 (edited) Hi. I'm having a problem with turning a tool i have made into a digital asset. I have created the digital asset but only the original seems to work in the scene I created it in, if I drop in a copy or load the otl in a new scene, it won't work. I can't find any absolute paths I have missed so would really appreciate if anyone could show me what I am missing. The tool is a learn to play guitar tool. It takes in a sound file and a guitar tab file. It uses chops on the sound file to get the timings of when the notes are played and then it uses the tab file to work out where the fingers should be on the fretboard. All of the tab parsing is done with python scripts which are embedded on the asset. i've traced through the code to see where it is getting to. What happens is I use the sound file timings to directly drive the y value of my plectrum. I then query this y value in my scripts to see when a note is being played. here is a copy of the function which queries the plectrums position: #Function to get the plectrum moves, which is the sound timings as the plectrum is directly driven by the sound def getPlectrumMoves(): #this function creates a list of frames which relates to when notes start and end #Set the number of frames to look at numFrames = 250 #store the frames the plectrum moved in into a list frames = [] #Flag to record when a note is being played stopLooking = 0 #Record the current frame the user is on currentFrame = hou.frame() #Set the current frame to the first frame hou.setFrame(1) #loop through all frames for i in range(1, numFrames+1): #change the frame in the scene hou.setFrame(i) #Grab the y value of the plectrum and save it into a variable yval = hou.pwd().parm('Plectrum_ty').eval() ###################################### ##This is where it goes wrong. ###################################### #If a note is not being played if stopLooking == 0: #See whether the pick has moved from its resting position if yval < 0.71: #Save the frame number into the list of frames where the plectrum has moved frames.append(i) #Set the flag to say now in the middle of a note being played stopLooking = 1 else: #See if the plectrum has come back to a resting position and therefore the note has ended if yval > 0.71: #Set the flag to say now not in the middle of a note being played stopLooking = 0 #Save the frame number into the list of frames where the plectrum has moved frames.append(i) #set the frames in the scene back to the beginning hou.setFrame(currentFrame) #Return the list of frames return frames What happens is yval always gets assigned the same value (the plectrums initial value on the first frame) when I drop in a new instance of the asset. but if I use the original it seems to work fine and yval updates. So when you hit generate animation on the original it will bake out all of the animation keyframes, but when you hit generate animation on the copy it will only bake out the first frame which is set before it gets to the part where it queries the plectrums y value. Please find attached: A sound file for testing purposes:testSound.wav A tab file for testing purposes:testTab.txt A copy of the houdini file:TonysPlayGuitarTool01.hipnc A copy of the asset otl file: Play_Guitar.otl Any help would be really appreciated. Thanks Tony Edited March 12, 2009 by tony Quote Link to comment Share on other sites More sharing options...
michael Posted March 12, 2009 Share Posted March 12, 2009 now THIS is how to ask for help I don't have any time at the moment to have a look - but I just wanted to say how cool this idea is...once you get it working how about piano? Quote Link to comment Share on other sites More sharing options...
j35ta Posted March 12, 2009 Share Posted March 12, 2009 So when you say it's broken, what exactly are you seeing. Currently I have the Plectrum hand moving up and down once Generate animation is pressed. However the Fret fingers do change their initial position but don't animate. Quote Link to comment Share on other sites More sharing options...
tony Posted March 12, 2009 Author Share Posted March 12, 2009 (edited) So when you say it's broken, what exactly are you seeing. Currently I have the Plectrum hand moving up and down once Generate animation is pressed. However the Fret fingers do change their initial position but don't animate. You should find that as soon as you put the sound file in the plectrum works as it is directly driven from the sound chops network. If you are using the node in the scene called Guitar and you put the tab file in and hit generate animation, it should all work as its meant to. By this I mean: The hand should slide away and then come back and it should go from having one finger with a little circle on the end to having the first 3 fingers with little circles on the end. My problem is if I tab in another guitar node (the asset is called guitar under the tab menu btw) and go through the same process, the hand with the little circles on the end doesn't get keyed properly. You'll notice the original has keyframes up to about frame 115, where as the copy will only have one keyframe and the hand with the circle on the end won't move as you scrub the timeline. I am trying to figure out why it is that the copys of my asset won't work like the original. Thanks Tony Edited March 12, 2009 by tony Quote Link to comment Share on other sites More sharing options...
j35ta Posted March 12, 2009 Share Posted March 12, 2009 ok, I see now. I'm not much of an expert when it comes to Python, but I'm wondering if the hou.pwd() could be the culprit. Surely that returns the path to the current working directory, which I'm assuming is the asset you're in. So when you plunk down a new asset hou.pwd() will be pointing to the original asset. As I say I'm not strong on Python, so please correct me if I'm wrong. Quote Link to comment Share on other sites More sharing options...
tony Posted March 18, 2009 Author Share Posted March 18, 2009 ok, I see now.I'm not much of an expert when it comes to Python, but I'm wondering if the hou.pwd() could be the culprit. Surely that returns the path to the current working directory, which I'm assuming is the asset you're in. So when you plunk down a new asset hou.pwd() will be pointing to the original asset. As I say I'm not strong on Python, so please correct me if I'm wrong. I just did a test on your theory, where I made the asset print hou.pwd() when generate animation is hit. When I dropped in a new copy of the asset, it printed out the name of the new copy, not the original, so I don't think its the hou.pwd() thats the problem. Also I dropped in a new copy and deleted the original and it still ran the beginning part of the script like it did before, which if hou.pwd() was the problem, shouldn't have happened because it would have been looking for the original assets scripts when the original asset no longer existed so it shouldn't have been able to run any script at all. If that makes sense. Tony Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.