1 |
# |
# |
2 |
# Copyright (c) 2003, Tuomas J. Lukka |
# Copyright (c) 2003, Tuomas J. Lukka |
3 |
# |
# |
4 |
# This file is part of Gzz. |
# This file is part of Fenfire. |
5 |
# |
# |
6 |
# Gzz is free software; you can redistribute it and/or modify it under |
# Fenfire is free software; you can redistribute it and/or modify it under |
7 |
# the terms of the GNU Lesser General Public License as published by |
# the terms of the GNU Lesser General Public License as published by |
8 |
# the Free Software Foundation; either version 2 of the License, or |
# the Free Software Foundation; either version 2 of the License, or |
9 |
# (at your option) any later version. |
# (at your option) any later version. |
10 |
# |
# |
11 |
# Gzz is distributed in the hope that it will be useful, but WITHOUT |
# Fenfire is distributed in the hope that it will be useful, but WITHOUT |
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
13 |
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General |
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General |
14 |
# Public License for more details. |
# Public License for more details. |
15 |
# |
# |
16 |
# You should have received a copy of the GNU Lesser General |
# You should have received a copy of the GNU Lesser General |
17 |
# Public License along with Gzz; if not, write to the Free |
# Public License along with Fenfire; if not, write to the Free |
18 |
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
19 |
# MA 02111-1307 USA |
# MA 02111-1307 USA |
20 |
# |
# |
58 |
self.replaceScene = None |
self.replaceScene = None |
59 |
self.mainNode = mainNode |
self.mainNode = mainNode |
60 |
self.connectors = connectors |
self.connectors = connectors |
61 |
def nadir(self, cs): |
def _nadir(self, cs): |
62 |
n = self.vs.coords.nadirUnitSq(cs, self.nadirCS) |
n = self.vs.coords.nadirUnitSq(cs, self.nadirCS) |
63 |
self.vs.matcher.add(cs, n, "NADIR") |
self.vs.matcher.add(cs, n, "NADIR") |
64 |
return n |
return n |
96 |
self.links = [] |
self.links = [] |
97 |
for connector in self.connectors: |
for connector in self.connectors: |
98 |
connector.addBuoys(vs, into, self.mainNode, self) |
connector.addBuoys(vs, into, self.mainNode, self) |
99 |
for l in self.links: self.linkReally(*l) |
for l in self.links: self._linkReally(*l) |
100 |
self.cs[into] = None |
self.cs[into] = None |
101 |
|
|
102 |
# Interpolation : old buoy -> to new main vp |
# Interpolation : old buoy -> to new main vp |
109 |
|
|
110 |
def link(self, *args): |
def link(self, *args): |
111 |
self.links.append(args) |
self.links.append(args) |
112 |
def linkReally(self, direction, anchorCS, otherNode, linkId, otherAnchor): |
def _linkReally(self, direction, anchorCS, otherNode, linkId, otherAnchor): |
113 |
if dbg: pa('link really') |
if dbg: pa('link really') |
114 |
|
|
115 |
anchorUnit = self.vs.unitSqCS(anchorCS, "UN") |
anchorUnit = self.vs.unitSqCS(anchorCS, "UN") |
149 |
if 0: |
if 0: |
150 |
dbg1 = self.vs.unitSqCS(into, "U") |
dbg1 = self.vs.unitSqCS(into, "U") |
151 |
self.vs.put(coloredQuad((0,1,0)), dbg1) |
self.vs.put(coloredQuad((0,1,0)), dbg1) |
152 |
into = self.nadir(into) |
into = self._nadir(into) |
153 |
# into = self.vs.orthoBoxCS(into, "Kludge CS", 0, 0,0, 1,1, w*sca, h*sca) |
# into = self.vs.orthoBoxCS(into, "Kludge CS", 0, 0,0, 1,1, w*sca, h*sca) |
154 |
self.vs.activate(into) |
self.vs.activate(into) |
155 |
otherAnchorCS = otherNode.renderBuoy(self.vs, into, linkId, otherAnchor, None) |
otherAnchorCS = otherNode.renderBuoy(self.vs, into, linkId, otherAnchor, None) |