void CMarmaladeEventWatcher::OnBeginCommand(const CRhinoCommand& command, const CRhinoCommandContext& context)
{
	const ON_wString s = L"SetCurrentRenderPlugin";

	if (s.CompareNoCase(const_cast<CRhinoCommand&>(command).EnglishCommandName()) == 0)
	{
		m_uuidOldRenderEngine = RhinoApp().GetDefaultRenderApp();
	}
}
bool CMarmaladeAutoMaterial::IsFactoryProductAcceptableAsChild(const IRhRdkContentFactory* pFactory,
        const wchar_t* wszChildSlotName) const
{
    const ON_wString sFactoryKind = pFactory->Kind();

    if (0 == sFactoryKind.CompareNoCase(RDK_KIND_TEXTURE))
        return true; // Factory produces textures.

    return false; // Factory produces something "unpalatable".
}
int CSampleDocumentUserDataPlugIn::FindStringTableItem( const wchar_t* str )
{
  if( 0 == str || 0 == str[0] )
    return -1;

  for( int i = 0; i < m_string_table.Count(); i++ )
  {
    ON_wString item = m_string_table[i];
    if( 0 == item.CompareNoCase(str) )
      return i;
  }

  return -1;
}
void CMarmaladeEventWatcher::OnEndCommand(const CRhinoCommand& command, const CRhinoCommandContext& context, CRhinoCommand::result rc)
{
	const ON_wString s = L"SetCurrentRenderPlugin";

	if ((rc == CRhinoCommand::success) && (s.CompareNoCase(const_cast<CRhinoCommand&>(command).EnglishCommandName()) == 0))
	{
		const UUID uuidRenderEngine = RhinoApp().GetDefaultRenderApp();
		if (m_uuidOldRenderEngine != uuidRenderEngine)
		{
			if (uuidRenderEngine == MarmaladePlugIn().PlugInID())
			{
				MarmaladePlugIn().AddMarmaladeMenu();
			}
			else
			{
				MarmaladePlugIn().RemoveMarmaladeMenu();
			}
		}
	}
}