From: <sv...@ww...> - 2005-06-12 03:20:57
|
Author: mkrose Date: 2005-06-11 20:20:39 -0700 (Sat, 11 Jun 2005) New Revision: 1563 Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Source/Animation.cpp Log: Allow animations to be disconnected from a bus. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1563 Modified: trunk/CSP/CSPSim/CHANGES.current =================================================================== --- trunk/CSP/CSPSim/CHANGES.current 2005-06-12 03:18:33 UTC (rev 1562) +++ trunk/CSP/CSPSim/CHANGES.current 2005-06-12 03:20:39 UTC (rev 1563) @@ -4,6 +4,8 @@ 2005-06-11: onsight * Fix a bug that caused absurdly large turbulence. + * Allow animations to be disconnected from a bus. + 2005-06-06: onsight * Partially fix depth buffer problem with airbase structures. The floor of the open hangars will still z-fight with the Modified: trunk/CSP/CSPSim/Source/Animation.cpp =================================================================== --- trunk/CSP/CSPSim/Source/Animation.cpp 2005-06-12 03:18:33 UTC (rev 1562) +++ trunk/CSP/CSPSim/Source/Animation.cpp 2005-06-12 03:20:39 UTC (rev 1563) @@ -92,19 +92,22 @@ } /** Bind to a named data channel. Returns true on success, and logs errors - * on failure. + * on failure. If bus is null the channel is detached and the method returns + * false. */ bool bind(Bus *bus, std::string const &name) { - assert(bus); - try { - m_Channel = bus->getChannel(name, false); - } catch (simdata::ConversionError &) { - CSP_LOG(OBJECT, WARNING, "Incompatible channel " << name << " for animation; expected double"); - return false; + m_Channel = 0; + if (bus) { + try { + m_Channel = bus->getChannel(name, false); + } catch (simdata::ConversionError &) { + CSP_LOG(OBJECT, WARNING, "Incompatible channel " << name << " for animation; expected double"); + return false; + } + if (!m_Channel) { + CSP_LOG(OBJECT, WARNING, "Unable to bind channel " << name << " for animation"); + } } - if (!m_Channel) { - CSP_LOG(OBJECT, WARNING, "Unable to bind channel " << name << " for animation"); - } return m_Channel.valid(); } @@ -139,19 +142,22 @@ } /** Bind to the named data channel. Returns true on success, and logs errors - * on failure. + * on failure. If bus is null the channel is detached and the method returns + * false; */ bool bind(Bus *bus, std::string const &name) { - assert(bus); - try { - m_Channel = bus->getChannel(name, false); - } catch (simdata::ConversionError &) { - CSP_LOG(OBJECT, WARNING, "Incompatible channel " << name << " for animation; expected enumlink"); - return false; + m_Channel = 0; + if (bus) { + try { + m_Channel = bus->getChannel(name, false); + } catch (simdata::ConversionError &) { + CSP_LOG(OBJECT, WARNING, "Incompatible channel " << name << " for animation; expected enumlink"); + return false; + } + if (!m_Channel) { + CSP_LOG(OBJECT, WARNING, "Unable to bind channel " << name << " for animation"); + } } - if (!m_Channel) { - CSP_LOG(OBJECT, WARNING, "Unable to bind channel " << name << " for animation"); - } return m_Channel.valid(); } @@ -993,12 +999,13 @@ traverse(node, nv); } virtual bool bindChannels(Bus *bus) { - assert(bus); m_Channel = 0; - try { - m_Channel = bus->getChannel(m_Animation->getChannelName(), false); - } catch (simdata::ConversionError &) { - CSP_LOG(OBJECT, WARNING, "Incompatible channel (" << m_Animation->getChannelName() << ") type for DrivenVectorialTranslation"); + if (bus) { + try { + m_Channel = bus->getChannel(m_Animation->getChannelName(), false); + } catch (simdata::ConversionError &) { + CSP_LOG(OBJECT, WARNING, "Incompatible channel (" << m_Animation->getChannelName() << ") type for DrivenVectorialTranslation"); + } } return m_Channel.valid(); } |