コード例 #1
0
ファイル: ObjFileEditDlg.cpp プロジェクト: gitrider/wxsj2
void ObjFileEditDialog::OnChangeMaterial(wxCommandEvent &e)
{
	if(NULL == m_pEntityListMaterialComboBox
	|| NULL == m_pMaterialListMaterialComboBox)
	return;

	DString entmatname			  = m_pEntityListMaterialComboBox->GetStringSelection().c_str();

	DString matmatname			  = m_pMaterialListMaterialComboBox->GetStringSelection().c_str();

	if(entmatname.empty() && matmatname.empty())
		return;

	DString matname;
	if(entmatname.empty())
	{
		matname = matmatname;
	}
	else
	{
		matname = entmatname;
	}

	Fairy::CGod* pModel = GetDataManipulatr()->FindModel(GetDataManipulatr()->m_CurModelName);

	if(NULL == pModel)
		return;

	std::vector<Ogre::String> matvec = Ogre::StringUtil::split(matname,".");


	pModel->ChangeMat(matvec[0],matvec[0]);
}
コード例 #2
0
ファイル: ObjFileEditDlg.cpp プロジェクト: gitrider/wxsj2
void ObjFileEditDialog::OnChangeLocator(wxCommandEvent &e)
{
	if(NULL == m_pLocatorNameComboBox
	|| NULL == GetDataManipulatr())

	 return;

	Fairy::CGod* pModel = GetDataManipulatr()->FindModel(GetDataManipulatr()->m_CurModelName);

	if(NULL == pModel)
		return;

	DString locatorname			  = m_pLocatorNameComboBox->GetStringSelection().c_str();

	if(locatorname.empty())
		locatorname			      = m_pLocatorNameComboBox->GetValue().c_str();

	if(locatorname.empty())
		return;

	std::vector<Ogre::String> locatorvec = Ogre::StringUtil::split(locatorname,"\\");

	if(locatorvec.size() < 2)
		return;

	const DString bone			  = locatorvec[0];

	const DString locator		  = locatorvec[1];

	pModel->UpdateLocatorPosAndOriData(locator);
}
コード例 #3
0
	sockaddr_in DSocket::parseAddress( const DString& addr, uint16 port )
	{
		sockaddr_in ret;
		std::memset(&ret, 0, sizeof(ret));

		if (addr.empty())
		{
			ret.sin_addr.s_addr = htonl(INADDR_ANY);
		}
		else
		{
			ret.sin_addr.s_addr = inet_addr(addr.c_str());
		}

		if (INADDR_NONE == ret.sin_addr.s_addr)
		{
			hostent* pHostEnt = gethostbyname(addr.c_str());
			if (pHostEnt != NULL)
			{
				std::memcpy(&ret.sin_addr.s_addr,
					pHostEnt->h_addr_list[0], pHostEnt->h_length);
			}
			else
			{
				DUEL_EXCEPT_BRIEF(DException::ET_InvalidParameters,
					"Invalid address: " + addr,
					"Duel::DSocket::parseAddress");	
			}
		}

		ret.sin_family = AF_INET;
		ret.sin_port = htons(port);

		return ret;
	}
コード例 #4
0
ファイル: ObjFileEditDlg.cpp プロジェクト: gitrider/wxsj2
void ObjFileEditDialog::OnSelObjTemplate(wxCommandEvent &e)
{
	if(NULL == GetDataManipulatr())
		return;

	Fairy::CGod* pModel = GetDataManipulatr()->FindModel(GetDataManipulatr()->m_CurModelName);

	if(NULL == pModel)
	{
		wxMessageBox("请选择需要创建obj文件的模型!");
		return;
	}

	if(!pModel->m_IsCanSelectTemplate)
	{
		wxMessageBox("该模型已有对应的obj文件,如要生成obj文件,请使用mesh文件创建!");
		return;
	}

	DString templatename			  = m_pObjFileTable->GetStringSelection().c_str();

	if(templatename.empty())
		templatename			      = m_pObjFileTable->GetValue().c_str();

	pModel->m_IsAvatarTemplate = false;

	pModel->UpdateObjTemplateData(templatename);
}
コード例 #5
0
ファイル: ObjFileEditDlg.cpp プロジェクト: gitrider/wxsj2
void ObjFileEditDialog::OnChangeAttributeHints(wxCommandEvent &e)
{

	if(NULL == m_pAttributeHintsComboBox
	|| NULL == m_pAttributeNameComboBox
	|| NULL == GetDataManipulatr())
		return;

	Fairy::CGod* pModel = GetDataManipulatr()->FindModel(GetDataManipulatr()->m_CurModelName);

	if(NULL == pModel)
		return;
	
	DString Attributename = m_pAttributeNameComboBox->GetStringSelection().c_str();

	if(Attributename.empty())
		Attributename     = m_pAttributeNameComboBox->GetValue().c_str();

	DString AttributeHints = m_pAttributeHintsComboBox->GetStringSelection().c_str();

	bool bResult = pModel->ChangeHints(Attributename,AttributeHints);

	if(bResult)
	{
		wxMessageBox(wxString::Format("成功修改属性<%s>提示为<%s>!",Attributename.c_str(),AttributeHints.c_str()));
	}
	else
	{
		wxMessageBox(wxString::Format("操作失败!没有找到属性<%s>!",Attributename.c_str()));
	}
}
コード例 #6
0
ファイル: ObjFileEditDlg.cpp プロジェクト: gitrider/wxsj2
void ObjFileEditDialog::OnChangeEffect(wxCommandEvent &e)
{
	if(NULL == m_pEffectNameComboBox)
		return;

	Fairy::CGod* pModel = GetDataManipulatr()->FindModel(GetDataManipulatr()->m_CurModelName);

	if(NULL == pModel)
		return;

	DString locatorname			  = m_pLocatorNameComboBox->GetStringSelection().c_str();

	if(locatorname.empty())
		locatorname			      = m_pLocatorNameComboBox->GetValue().c_str();

	if(locatorname.empty())
		return;

	std::vector<Ogre::String> locatorvec = Ogre::StringUtil::split(locatorname,"\\");

	if(locatorvec.size() < 2)
		return;

	const DString bone			  = locatorvec[0];

	const DString locator		  = locatorvec[1];

	DString effectname			  = m_pEffectNameComboBox->GetStringSelection().c_str();

	if(effectname.empty())
		return;

	std::vector<Ogre::String> effectvec = Ogre::StringUtil::split(effectname,".");

	const DString effect		  = effectvec[0];

	bool nResult = pModel->ChangeEffect(effect,locator,bone);

	if(!nResult)
	{
		wxMessageBox(wxString::Format("不存在特效对应的挂点<%s>,请检查美术资源!",locator.c_str()));
	}
}
コード例 #7
0
ファイル: ObjFileEditDlg.cpp プロジェクト: gitrider/wxsj2
void ObjFileEditDialog::OnAddSkeleton(wxCommandEvent &e)
{
	if(NULL == m_pSkeletonAdd
	|| NULL == m_pSkeletonTable
	|| NULL == m_pSkeletonName
	|| NULL == GetDataManipulatr())

	return;

	Fairy::CGod* pModel = GetDataManipulatr()->FindModel(GetDataManipulatr()->m_CurModelName);

	if(NULL == pModel)
		return;

	DString skeletonname			  = m_pSkeletonTable->GetStringSelection().c_str();

	if(skeletonname.empty())
		skeletonname			      = m_pSkeletonTable->GetValue().c_str();

	if(skeletonname.empty())
	{
		wxMessageBox("请选择要添加的骨骼!");
		return;
	}

	pModel->m_AniSkelist.push_back(skeletonname);

	DStringList Anilist;

	pModel->m_AniSkelistLink.insert(Fairy::CGod::AniSkelistLink::value_type(skeletonname,Anilist));

	wxMessageBox(wxString::Format("添加骨骼<%s>成功!",skeletonname.c_str()));

	m_pSkeletonName->Clear();

	for(int i=0;i<(int)pModel->m_AniSkelist.size();i++)
	{
		m_pSkeletonName->AppendString(pModel->m_AniSkelist[i].c_str());
	}
}
コード例 #8
0
ファイル: ObjFileEditDlg.cpp プロジェクト: gitrider/wxsj2
void ObjFileEditDialog::OnDelSkeleton(wxCommandEvent &e)
{
	if(NULL == m_pSkeletonAdd
	|| NULL == m_pSkeletonName
	|| NULL == GetDataManipulatr())

	return;

	Fairy::CGod* pModel = GetDataManipulatr()->FindModel(GetDataManipulatr()->m_CurModelName);

	if(NULL == pModel)
		return;

	DString skeletonname			  = m_pSkeletonName->GetStringSelection().c_str();

	if(skeletonname.empty())
	{
		wxMessageBox("请选择要删除的骨骼!");
		return;
	}

	int nSize = pModel->m_AniSkelist.size();

	DStringList::iterator it;

	for(int i=0;i<nSize;i++)
	{
		it = pModel->m_AniSkelist.begin()+i;

		if(skeletonname.compare(pModel->m_AniSkelist[i]) == 0)
		{
			pModel->m_AniSkelist.erase(it);
			break;
		}
	}

	Fairy::CGod::AniSkelistLink::iterator itlink = pModel->m_AniSkelistLink.find(skeletonname);

	if(itlink != pModel->m_AniSkelistLink.end())
	{
		pModel->m_AniSkelistLink.erase(skeletonname);
	}

	wxMessageBox(wxString::Format("删除骨骼<%s>成功!",skeletonname.c_str()));

	m_pSkeletonName->Clear();

	for(int i=0;i<(int)pModel->m_AniSkelist.size();i++)
	{
		m_pSkeletonName->AppendString(pModel->m_AniSkelist[i].c_str());
	}
}
コード例 #9
0
ファイル: View.cpp プロジェクト: aosm/graphviz
pair<Layout::Node*,bool> View::getNode(DString id,bool create) {
	if(id.empty())
		id = randomName('n');
	Layout::Node *n = nodes[id];
	if(n)
		return make_pair(n,false);
	if(!create) 
		return make_pair<Layout::Node*>(0,false);
    NodeAttrs *NA = new NodeAttrs();
	n = layout.create_node(*NA);
    delete NA;
	gd<Name>(n) = id;
	nodes[id] = n;
	return make_pair(n,true);
}
コード例 #10
0
ファイル: View.cpp プロジェクト: aosm/graphviz
pair<Layout::Edge*,bool> View::getEdge(DString id,Layout::Node *t,Layout::Node *h,bool create) {
	Layout::Edge *e=0;
	if(id.empty())
		id = randomName('e');
	else if((e = edges[id]))
		return make_pair(e,false);
	if(!(t && h))
		return make_pair<Layout::Edge*>(0,false);
	e = layout.find_edge(t,h);
	if(e)
		return make_pair(e,false);
	if(!create)
		return make_pair<Layout::Edge*>(0,false);
	e = layout.create_edge(t,h).first;
	gd<Name>(e) = id;
	edges[id] = e;
	return make_pair(e,true);
}