Jump to content

Search the Community

Showing results for tags 'extract transformation'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Lounge/General chat
    • Education
    • Jobs
  • Houdini
    • General Houdini Questions
    • Effects
    • Modeling
    • Animation & Rigging
    • Lighting & Rendering
    • Compositing
    • Games
    • Tools (HDA's etc.)
  • Coders Corner
    • HDK : Houdini Development Kit
    • Scripting
    • Shaders
  • Art and Challenges
    • Finished Work
    • Work in Progress
    • VFX Challenge
    • Effects Challenge Archive
  • Systems and Other Applications
    • Other 3d Packages
    • Operating Systems
    • Hardware
    • Pipeline
  • od|force
    • Feedback, Suggestions, Bugs

Found 1 result

  1. Hello ! I'm trying to get an animation transfer from packed geometry to bone to work. It works when transferring the animation to a geometry (there is no visible problem in the viewport), but in the Animation Editor, the keys are not very clean. See below Here is the nice and tidy one, the source : Here is the result from the script, the baked one : As I said, in the viewport it works, but these keys are not very clean. Why do they look like that ? How to make them cleaner ? (See script and scene below) BUT ! What I really want is to bake the animation on a bone, not on a box. The previous problem still apply to this situation. The position works, but the rotation just fails miserably (with the same code !). The very same rotation is applied to the bone as the previous one that was applied to the test box, but the result in the viewport is not the same at all. The red is the source and the blue is the skinned box (to the visible bone). Why is that ? What am I missing ? Here's the code : node = hou.pwd() obj = hou.node("/obj") def extractEulerRotates(self, rotate_order="xyz"): # Thanks to the Houdini help page for that. But there is a problem here though return hou.Matrix4(self.extractRotationMatrix3()).explode(rotate_order=rotate_order)["rotate"] # The extracted rotation from this function is incorrect. def bakePackedAnim(): # Saving out some time-related variables intialFrame = hou.intFrame() startFrame = int(hou.hscriptExpression("$RFSTART")) # Don't know how to do it in Python endFrame = int(hou.hscriptExpression("$RFEND")) # Don't know how to do it in Python hou.setFrame(startFrame) # ''' # Initial setup : Creates a bone and a box, and then skins the box to the bone with a Capture Proximity. theBone = obj.createNode("bone", "tranformed_bone") # Create only one bone. Would put it in a loop to create multiple. # theBone.moveToGoodPosition() # Easier to work without it. Will uncomment in the end # TO REMOVE... But weirdly with -not a bone- it's working. Hmmm. testGeo = obj.createNode("geo", "test_geo") fileNode = testGeo.allSubChildren()[0] testTransform = testGeo.createNode("xform") testTransform.setFirstInput(fileNode) testTransform.moveToGoodPosition() testTransform.setDisplayFlag(True) testTransform.setRenderFlag(True) # Remove up to here skinnedGeo = obj.createNode("geo", "skinned_geo") # skinnedGeo.moveToGoodPosition() # Easier to work without it. Will uncomment in the end skinnedGeo.deleteItems(skinnedGeo.allSubChildren()) # Removes the file node boxNode = skinnedGeo.createNode("box") captureProximNode = skinnedGeo.createNode("captureproximity") captureProximNode.setFirstInput(boxNode) captureProximNode.moveToGoodPosition() captureProximNode.parm("rootpath").set(str(theBone.path())) deformNode = skinnedGeo.createNode("deform") deformNode.setFirstInput(captureProximNode) deformNode.moveToGoodPosition() #deformNode.setDisplayFlag(True) #deformNode.setRenderFlag(True) # Applying some color to the skinned box attribWrangle = skinnedGeo.createNode("attribwrangle", "color") attribWrangle.setFirstInput(deformNode) attribWrangle.parm("snippet").set("@Cd = {0,0,1};") attribWrangle.moveToGoodPosition() attribWrangle.setDisplayFlag(True) attribWrangle.setRenderFlag(True) # ''' # Transfers the animation from the specified geometry to the bone workingNode = hou.node("/obj/animated_box/OUT_script").geometry() # Gets the geometry of my test scenario for i in xrange(startFrame, endFrame+1): # For some reasons, xrange goes from the correct start value to the end value, minus 1. Strange. hou.setFrame(i) theFullTransform = workingNode.prims()[0].fullTransform() thePosition = workingNode.points()[0].attribValue("P") # This code works only for one object. Would do a loop here through all the pack geo. theRotation = extractEulerRotates(theFullTransform) # Got a problem with how this function extracts the rotation # Position key = hou.Keyframe(thePosition[0]) theBone.parm("tx").setKeyframe(key) testTransform.parm("tx").setKeyframe(key) key = hou.Keyframe(thePosition[1]) theBone.parm("ty").setKeyframe(key) testTransform.parm("ty").setKeyframe(key) key = hou.Keyframe(thePosition[2]) theBone.parm("tz").setKeyframe(key) testTransform.parm("tz").setKeyframe(key) # Rotation key = hou.Keyframe(theRotation[0]) theBone.parm("rx").setKeyframe(key) testTransform.parm("rx").setKeyframe(key) key = hou.Keyframe(theRotation[1]) theBone.parm("ry").setKeyframe(key) testTransform.parm("ry").setKeyframe(key) key = hou.Keyframe(theRotation[2]) theBone.parm("rz").setKeyframe(key) testTransform.parm("rz").setKeyframe(key) hou.setFrame(intialFrame) bakePackedAnim() # Would need to create a UI or a button for convenience, calling this out. And the scene : packed_anim_baker.hip Thanks ! EDIT : P.S. If I copy and paste relative reference from the source's rotation to the bone's rotation, the result is the same : obviously wrong rotation.