Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import hou
- from PySide2.QtGui import QGuiApplication
- clipboard = QGuiApplication.clipboard()
- clipText = clipboard.text().encode('utf-8')
- filename = "C:/Users/Public/Documents/buffer.txt"
- with open(filename, "w") as writeBuffer:
- writeBuffer.write(clipText)
- writeBuffer.close()
- sel = hou.selectedNodes()
- sel = sel[0]
- if sel:
- state = "crap"
- ignoreLine = False
- with open(filename, "r") as readBuffer:
- for theLine in readBuffer:
- elements = theLine.strip().split("\t")
- print elements
- ignoreLine = False
- if len(elements) == 0:
- state = "crap"
- ignoreLine = True
- else:
- if elements.count("X degrees") > 0:
- state = "orientation"
- ignoreLine = True
- if elements.count("X pixels") > 0:
- state = "translate"
- ignoreLine = True
- if ignoreLine == False:
- if len(elements) == 4:
- theFrame = elements[0]
- theXValue = elements[1]
- theYValue = elements[2]
- theZValue = elements[3]
- if state == "translate":
- print ("At frame " + theFrame + " translate to: " + theXValue)
- setKey = hou.Keyframe()
- setKey.setFrame(int(theFrame))
- setKey.setValue(float(theXValue) * 0.01)
- testCh = sel.parm("tx")
- testCh.setKeyframe(setKey)
- setKey = hou.Keyframe()
- setKey.setFrame(int(theFrame))
- setKey.setValue(-float(theYValue) * 0.01)
- testCh = sel.parm("ty")
- testCh.setKeyframe(setKey)
- setKey = hou.Keyframe()
- setKey.setFrame(int(theFrame))
- setKey.setValue(-float(theZValue) * 0.01)
- testCh = sel.parm("tz")
- testCh.setKeyframe(setKey)
- if state == "orientation":
- print ("At frame " + theFrame + " orient to: " + theXValue)
- setKey = hou.Keyframe()
- setKey.setFrame(int(theFrame))
- setKey.setValue(float(theXValue))
- testCh = sel.parm("rx")
- testCh.setKeyframe(setKey)
- setKey = hou.Keyframe()
- setKey.setFrame(int(theFrame))
- setKey.setValue(-float(theYValue))
- testCh = sel.parm("ry")
- testCh.setKeyframe(setKey)
- setKey = hou.Keyframe()
- setKey.setFrame(int(theFrame))
- setKey.setValue(-float(theZValue))
- testCh = sel.parm("rz")
- testCh.setKeyframe(setKey)
- os.remove(filename)
- else:
- print ("Please, select camera")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement