Browse Source

Ensure all responder states are converted

pull/10/head
Adam Johnson 10 years ago
parent
commit
10bdf645b9
  1. 10
      korman/nodes/node_responder.py

10
korman/nodes/node_responder.py

@ -71,10 +71,10 @@ class PlasmaResponderNode(PlasmaNodeVariableInput, bpy.types.Node):
def get_state(self, node): def get_state(self, node):
for idx, (theNode, theState) in enumerate(self.states): for idx, (theNode, theState) in enumerate(self.states):
if theNode == node: if theNode == node:
return (idx, theState) return (idx, theState, True)
state = plResponderModifier_State() state = plResponderModifier_State()
self.states.append((node, state)) self.states.append((node, state))
return (len(self.states) - 1, state) return (len(self.states) - 1, state, False)
def save(self): def save(self):
resp = self.responder resp = self.responder
@ -112,7 +112,7 @@ class PlasmaResponderStateNode(PlasmaNodeVariableInput, bpy.types.Node):
layout.prop(self, "default_state") layout.prop(self, "default_state")
def convert_state(self, exporter, tree, so, stateMgr): def convert_state(self, exporter, tree, so, stateMgr):
idx, state = stateMgr.get_state(self) idx, state, converted = stateMgr.get_state(self)
# No sanity checking here. Hopefully nothing crazy has happened in the UI. # No sanity checking here. Hopefully nothing crazy has happened in the UI.
if self.default_state: if self.default_state:
@ -123,8 +123,10 @@ class PlasmaResponderStateNode(PlasmaNodeVariableInput, bpy.types.Node):
if toStateNode is None: if toStateNode is None:
state.switchToState = idx state.switchToState = idx
else: else:
toIdx, toState = stateMgr.get_state(toStateNode) toIdx, toState, converted = stateMgr.get_state(toStateNode)
state.switchToState = toIdx state.switchToState = toIdx
if not converted:
toStateNode.convert_state(exporter, tree, so, stateMgr)
class CommandMgr: class CommandMgr:
def __init__(self): def __init__(self):

Loading…
Cancel
Save