BL_ArmatureChannel* BL_ArmatureObject::GetChannel(int index)
{
	LoadChannels();
	if (index < 0 || index >= m_channelNumber)
		return NULL;
	SG_DList::iterator<BL_ArmatureChannel> cit(m_poseChannels);
	for (cit.begin(); !cit.end() && index; ++cit, --index);
	return (cit.end()) ? NULL : *cit;
}
BL_ArmatureChannel* BL_ArmatureObject::GetChannel(const char* str)
{
	LoadChannels();
	SG_DList::iterator<BL_ArmatureChannel> cit(m_poseChannels);
	for (cit.begin(); !cit.end(); ++cit) 
	{
		BL_ArmatureChannel* channel = *cit;
		if (!strcmp(channel->m_posechannel->name, str))
			return channel;
	}
	return NULL;
}
BL_ArmatureChannel* BL_ArmatureObject::GetChannel(bPoseChannel* pchan)
{
	LoadChannels();
	SG_DList::iterator<BL_ArmatureChannel> cit(m_poseChannels);
	for (cit.begin(); !cit.end(); ++cit) 
	{
		BL_ArmatureChannel* channel = *cit;
		if (channel->m_posechannel == pchan)
			return channel;
	}
	return NULL;
}
Exemplo n.º 4
0
int ScorebotInput::Load()
{
    LoadChannels();
    m_bot = wxGetApp().GetMainFrame()->GetScorebot();
    
    if (m_bot)
    {
        m_host = m_bot->GetHost();
        m_port = m_bot->GetPort();
        m_abbrev = m_bot->GetGame();
        GetSbsTitleIn()->SetValue(m_bot->GetTitle());
        GetSbsInterIn()->SetValue(m_bot->GetInterval());
        GetSbsChanIn()->SetStringSelection(m_bot->GetChannel());

        LoadServer();
    }

    if (m_bot && m_bot->IsRunning())
        GetSbsStatusOut()->SetLabel("Scorebot Running");
    else
    {
        GetSbsStatusOut()->SetLabel("Scorebot Stopped");

        //If scorebot stopped, load in the current server from the main frame.
        wxString host, abbrev;
        int port;
        QueryInput *qi = wxGetApp().GetMainFrame()->GetQueryInput();
        if (qi->GetCurrentServer(host, port, abbrev) && abbrev != "Unk")
        {
            m_host = host;
            m_port = port;
            m_abbrev = abbrev;
            LoadServer();
        }
        else
        {
            wxMessageBox("No or unknown server selected");
            return wxID_CANCEL;
        }

        GetSbsCustChk()->Enable(true);
    }

    //load custom list
    PyGetBotList(m_botlist);
    for (int i = 0; i < m_botlist.GetCount(); i++)
        GetSbsBnameIn()->Append(m_botlist[i].name, (void *) &m_botlist[i]);

    m_pybot = dynamic_cast<PyScoreBot *>(m_bot);
    if (m_pybot)
    {
        BotType *bt = NULL;
        for (int i = 0; i < m_botlist.GetCount(); i++)
        {
            if (m_pybot->Check(&m_botlist[i]))
                bt = &m_botlist[i];
        }

        //bot should be in the list
        wxASSERT(bt);
        
        GetSbsCustChk()->SetValue(true);
        GetSbsBnameIn()->SetStringSelection(bt->name);
        if (GetSbsCustChk()->IsEnabled())
            GetSbsBnameIn()->Enable(true);

        LoadOptions(bt);
    }

    return ShowModal();
}
Exemplo n.º 5
0
void ScorebotInput::OnChan( wxCommandEvent &event )
{
    ChannelInput ci(this, -1, "Channels");
    ci.ShowModal();
    LoadChannels();
}