本文整理汇总了C++中Entity::GetOverridenProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::GetOverridenProperties方法的具体用法?C++ Entity::GetOverridenProperties怎么用?C++ Entity::GetOverridenProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::GetOverridenProperties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPropertySelected
//! called when a property is selected
void PropertyListContainer::OnPropertySelected(wxPGProperty* pWxProperty)
{
if( pWxProperty
&& pWxProperty->GetParent()->IsRoot()
&& pWxProperty->GetLabel() != "ID"
&& pWxProperty->GetLabel() != "Type"
&& m_pPropertyList->GetSelectedObject()->IsA(Entity::TypeID))
{
Entity* pEntity = DYNAMIC_CAST(m_pPropertyList->GetSelectedObject(), Entity);
bool bIsTemplate = pEntity && !pEntity->GetTemplatePath().empty();
bool bOverriden = (pEntity->GetOverridenProperties().GetProperty(std::string(pWxProperty->GetName())) != NULL);
m_pOverrideToggle->Enable(bIsTemplate);
m_pOverrideToggle->SetValue(bOverriden);
}
else
{
m_pOverrideToggle->Enable(false);
}
}
示例2: OnToggleOverride
// event handlers
void PropertyListContainer::OnToggleOverride(wxCommandEvent& event)
{
SHOOT_ASSERT(m_pPropertyList->GetSelectedObject()->IsA(Entity::TypeID), "Tring to override a property of a non-entity");
Entity* pEntity = static_cast<Entity*>(m_pPropertyList->GetSelectedObject());
bool bOverride = event.IsChecked();
wxPGProperty* pWxProperty = m_pPropertyList->GetSelection();
SHOOT_ASSERT(pWxProperty, "Toggling override flag on NULL property");
const char* strPropertyName = pWxProperty->GetLabel().c_str();
PropertyStream& overridenProperties = pEntity->GetOverridenProperties();
if(bOverride)
{
PropertyStream stream(SM_Write);
pEntity->Serialize(stream);
overridenProperties.AddProperty(stream.GetProperty(strPropertyName)->Copy());
m_pPropertyList->EnableProperty(pWxProperty);
}
else
{
overridenProperties.RemoveProperty(overridenProperties.GetProperty(strPropertyName));
m_pPropertyList->DisableProperty(pWxProperty);
}
}