Exemplo n.º 1
0
void
ObjectPropertyEditor::onSelectObject(const Fairy::ObjectPtr& object)
{
    mPropertiesViewer->GetGrid()->Clear();
    mCurrentObject = object;

	if (mObjNameList.GetCount()<=0)
	{
		Ogre::FileInfoListPtr fileInfoList =
			Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(
			Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
			"*.obj");

		for(Ogre::FileInfoList::const_iterator it = fileInfoList->begin(); it != fileInfoList->end(); ++it)
		{	
			const Ogre::String name = it->filename;
			mObjNameList.AddString(name.c_str());
		}
	}

    const Fairy::PropertyList& properties = object->getProperties();
    for (Fairy::PropertyList::const_iterator it = properties.begin(); it != properties.end(); ++it)
    {
        const Fairy::PropertyDef& propertyDef = *it;
        Fairy::uint propertyFlags = object->getPropertyFlags(propertyDef.name);	
		wxPGId id;
		if (propertyDef.name == "actor name")
		{
			wxPGProperty* property = NULL;
			wxString name = propertyDef.name.c_str();
			property = wxEnumProperty(name, name, mObjNameList);
			property->SetValueFromString(propertyDef.defaultValue.c_str(),0);
			id = AddPropertyRecursive(property);
		}
		else
		{
			id = AddPropertyRecursive(mPropertyManager->CreateProperty(propertyDef));
		}
			
		wxPGIdToPtr(id)->SetValueFromString(AS_STRING(object->getPropertyAsString(propertyDef.name)), wxPG_FULL_VALUE);
		
		if (propertyFlags & Fairy::PF_READONLY)
        {
            mPropertiesViewer->DisableProperty(id);
        }
    }

    mPropertiesViewer->Refresh();
}
Exemplo n.º 2
0
wxPGId
ObjectPropertyEditor::AddPropertyRecursive(wxPGProperty* property)
{
    wxString::size_type pos = property->GetName().find_last_of('.');
    if (pos == wxString::npos)
        return mPropertiesViewer->Append(property);

    wxString name = property->GetName().substr(0, pos);
    wxPGId id = mPropertiesViewer->GetPropertyByName(wxPGNameConv(name));
    if (!id.IsOk())
    {
        wxString label = mPropertyManager->GetLabelFromName(name);
        id = AddPropertyRecursive(wxCustomProperty(label, name));
        mPropertiesViewer->DisableProperty(id);
    }
    wxASSERT(wxStrcmp(wxPGIdToPtr(id)->GetClassName(), wxT("wxCustomProperty")) == 0);

    return mPropertiesViewer->AppendIn(id, property);
}
Exemplo n.º 3
0
void
ObjectPropertyEditor::onSelectObject(const WX::ObjectPtr& object)
{
    mPropertiesViewer->GetGrid()->Clear();
    mCurrentObject = object;

    const WX::PropertyList& properties = object->getProperties();
    for (WX::PropertyList::const_iterator it = properties.begin(); it != properties.end(); ++it)
    {
        const WX::PropertyDef& propertyDef = *it;
        WX::uint propertyFlags = object->getPropertyFlags(propertyDef.name);
        wxPGId id = AddPropertyRecursive(mPropertyManager->CreateProperty(propertyDef));
        wxPGIdToPtr(id)->SetValueFromString(AS_STRING(object->getPropertyAsString(propertyDef.name)), wxPG_FULL_VALUE);
        if (propertyFlags & WX::PF_READONLY)
        {
            mPropertiesViewer->DisableProperty(id);
        }
    }

    mPropertiesViewer->Refresh();
}