Skip to content

Commit

Permalink
added master/slave object color synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
PyrApple committed Feb 14, 2016
1 parent 173e37f commit 46cbb88
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class Object:
ORIENTATION = b'o'
SCALE = b's'
VISIBILITY = b'v'
COLOR3 = b'd'
COLOR4 = b'c'

def default(self):
pass
Expand All @@ -61,6 +63,7 @@ def __init__(self, parent, item):
self._previousOrientation = mathutils.Matrix()
self._previousScale = mathutils.Vector()
self._previousVisibility = True
self._previousColor = mathutils.Vector((0.8,0.8,0.8,1.0))


def getSynchronizerBuffer(self):
Expand All @@ -86,6 +89,15 @@ def getSynchronizerBuffer(self):
buff.command(self.VISIBILITY)
buff.boolean(self._previousVisibility)

if self._previousColor != self._item.color:
self._previousColor = self._item.color.copy()
if len(self._item.color) == 4:
buff.command(self.COLOR4)
buff.vector_4(self._previousColor)
if len(self._item.color) == 3:
buff.command(self.COLOR3)
buff.vector_3(self._previousColor)

return buff


Expand All @@ -108,6 +120,13 @@ def _processCommand(self, command, buff):
if command == self.VISIBILITY:
self._item.setVisible(buff.boolean())

if command == self.COLOR3:
self.logger.debug(self._item.color)
self._item.color = buff.vector_3()

if command == self.COLOR4:
self.logger.debug(self._item.color)
self._item.color = buff.vector_4()

def processSynchronizerBuffer(self, buff):
while len(buff) > 0:
Expand Down

0 comments on commit 46cbb88

Please sign in to comment.