Skip to content

Commit

Permalink
slightly improved spped on motion trail
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonghwan Hwang authored and Jonghwan Hwang committed Jun 1, 2020
1 parent 0502a42 commit b4f9699
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions animBuddy/DrawArc/MotionTrailDraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import MotionTrailUtil as util
reload(util)
import maya.cmds as cmds
import datetime

def maya_useNewAPI():
"""
Expand Down Expand Up @@ -126,6 +127,7 @@ def __init__(self, obj):
self.allPoints = {}
self.allFramePoints = {}
self.callbacks = []
self.timestamp = datetime.datetime.now()

def getDepNode(self, n):
return OpenMaya.MGlobal.getSelectionListByName(n).getDependNode(0)
Expand Down Expand Up @@ -164,7 +166,7 @@ def prepareForDraw(self, objPath, cameraPath, frameContext, oldData):
fnThisNode = OpenMaya.MFnDependencyNode(selectedNode)
worldMatrixAttr = fnThisNode.attribute("worldMatrix")
pointPlug = OpenMaya.MPlug(selectedNode, worldMatrixAttr)
pointPlug = pointPlug.elementByLogicalIndex(0)
pointPlug = pointPlug.elementByLogicalIndex(0)

activeCam = util.getCam()

Expand Down Expand Up @@ -210,8 +212,7 @@ def prepareForDraw(self, objPath, cameraPath, frameContext, oldData):
points = {}
if not data.isRelative:
for i in range(int(currentTime.value - timeBuffer), int(currentTime.value + timeBuffer + 1)):
#Get matrix plug as MObject so we can get it's data.

#Get matrix plug as MObject so we can get it's data.
try:
points[i] = self.allPoints[i]
except:
Expand Down Expand Up @@ -344,7 +345,9 @@ def keyFrameEditedCallback(self, nodes, client_data):
return True

def graphEditorChangedCallback(self, client_data):
self.isPointCached = False
if (datetime.datetime.now() - self.timestamp).total_seconds() > 1:
self.isPointCached = False
self.timestamp = datetime.datetime.now()

def deleteCallbacks(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion animBuddy/Install/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
logger = logging.getLogger("AnimBuddy")

#This is Local Version
VERSION = "1.0.2"
VERSION = "1.0.3"

def getLatestSetupPyFileFromRepo():
"""Parses latest setup.py's version number"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name = 'animBuddy',
version = '1.0.2',
version = '1.0.3',
url = 'https://github.com/darkuress/animBuddy.git',
author = 'Huile De Olive',
author_email = "huiledolivemaster@gmail.com",
Expand Down

0 comments on commit b4f9699

Please sign in to comment.