コード例 #1
0
bool QtPropertyDataDavaKeyedArcive::UpdateValueInternal()
{
	// update children
	{
		QSet<QtPropertyData *> dataToRemove;

		// at first step of sync we mark (placing to vector) items to remove
		for(int i = 0; i < ChildCount(); ++i)
		{
			QPair<QString, QtPropertyData *> pair = ChildGet(i);
			if(NULL != pair.second)
			{
				dataToRemove.insert(pair.second);
			}
		}

		// as second step we go throught keyed archive and add new data items,
		// and remove deleting mark from items that are still in archive
		if(NULL != curArchive)
		{
			DAVA::Map<DAVA::String, DAVA::VariantType*> data = curArchive->GetArchieveData();
			DAVA::Map<DAVA::String, DAVA::VariantType*>::iterator i = data.begin();

			for(; i != data.end(); ++i)
			{
				QtPropertyData *childData = ChildGet(i->first.c_str());

				// this key already in items list
				if(NULL != childData)
				{
					// remove deleting mark
					dataToRemove.remove(childData);
				}
				// create new child data
				else
				{
					ChildCreate(i->first.c_str(), i->second);
				}
			}
		}

		// delete all marked items
		QSetIterator<QtPropertyData *> it(dataToRemove);
		while(it.hasNext())
		{
			ChildRemove(it.next());
		}
	}

	return false;
}
コード例 #2
0
void TextureDescriptorUtils::SetCompressionParams( const FilePath &descriptorPathname, const DAVA::Map<DAVA::eGPUFamily, DAVA::TextureDescriptor::Compression> & compressionParams, bool convertionEnabled, bool force)
{
	TextureDescriptor *descriptor = TextureDescriptor::CreateFromFile(descriptorPathname);
	if(!descriptor) return;

	auto endIt = compressionParams.end();
	for(auto it = compressionParams.begin(); it != endIt; ++it)
	{
		eGPUFamily gpu = it->first;

		if(force || (descriptor->compression[gpu].format == FORMAT_INVALID))
		{
			descriptor->compression[gpu] = it->second;

			if(convertionEnabled)
			{
				ImageTools::ConvertImage(descriptor, gpu, (PixelFormat)descriptor->compression[gpu].format);
			}
		}
	}

	descriptor->Save();
	SafeRelease(descriptor);
}
コード例 #3
0
void TextureListModel::setHighlight(DAVA::Entity *node)
{
	beginResetModel();

	textureDescriptorsHighlight.clear();

	DAVA::Map<DAVA::String, DAVA::Texture *> texturesInNode;
	SceneDataManager::EnumerateTextures(node, texturesInNode);

	for(DAVA::Map<DAVA::String, DAVA::Texture *>::iterator t = texturesInNode.begin(); t != texturesInNode.end(); ++t)
	{
		const DAVA::String descPath = t->first;
		for(int i = 0; i < textureDescriptorsAll.size(); ++i)
		{
			if(textureDescriptorsAll[i]->pathname == descPath)
			{
				textureDescriptorsHighlight.push_back(textureDescriptorsAll[i]);
			}
		}
	}

	if(curFilterBySelectedNode)
	{
		applyFilterAndSort();
	}

	endResetModel();
}
コード例 #4
0
void TextureListModel::setScene(DAVA::Scene *scene)
{
	beginResetModel();

	clear();

	DAVA::Map<DAVA::String, DAVA::Texture *> texturesInNode;
	SceneDataManager::EnumerateTextures(scene, texturesInNode);

	for(DAVA::Map<DAVA::String, DAVA::Texture *>::iterator t = texturesInNode.begin(); t != texturesInNode.end(); ++t)
	{
		const DAVA::String descPath = t->first;

		// if there is no the same descriptor and this file exists
		if(DAVA::FileSystem::Instance()->IsFile(descPath))
		{
			DAVA::TextureDescriptor * descriptor = DAVA::TextureDescriptor::CreateFromFile(descPath);

			if(NULL != descriptor)
			{
				textureDescriptorsAll.push_back(descriptor);
				texturesAll[descriptor] = t->second;
			}
		}
	}

	applyFilterAndSort();

	endResetModel();
}
コード例 #5
0
void QtPropertyDataDavaVariant::ChildsCreate()
{
	switch(curVariantValue.type)
	{
	case DAVA::VariantType::TYPE_KEYED_ARCHIVE:
		{
			DAVA::KeyedArchive *archive = curVariantValue.AsKeyedArchive();
			DAVA::Map<DAVA::String, DAVA::VariantType*> data = archive->GetArchieveData();
			DAVA::Map<DAVA::String, DAVA::VariantType*>::iterator i = data.begin();

			for(; i != data.end(); ++i)
			{
				ChildAdd(i->first.c_str(), new QtPropertyDataDavaVariant(*(i->second)));
			}
		}
		break;
	case DAVA::VariantType::TYPE_MATRIX2:
		break;
	case DAVA::VariantType::TYPE_MATRIX3:
		break;
	case DAVA::VariantType::TYPE_MATRIX4:
		break;
	case DAVA::VariantType::TYPE_VECTOR2:
		{
			DAVA::Vector2 vec = curVariantValue.AsVector2();
			ChildAdd("X", vec.x);
			ChildAdd("Y", vec.y);
		}
		break;
	case DAVA::VariantType::TYPE_VECTOR3:
		{
			DAVA::Vector3 vec = curVariantValue.AsVector3();
			ChildAdd("X", vec.x);
			ChildAdd("Y", vec.y);
			ChildAdd("Z", vec.z);
		}
		break;
	case DAVA::VariantType::TYPE_VECTOR4:
		{
			DAVA::Vector4 vec = curVariantValue.AsVector4();
			ChildAdd("X", vec.x);
			ChildAdd("Y", vec.y);
			ChildAdd("Z", vec.z);
			ChildAdd("W", vec.w);
		}
		break;
    case DAVA::VariantType::TYPE_COLOR:
        {
//            DAVA::Color color = curVariantValue.AsColor();
//            ChildAdd("R", color.r);
//            ChildAdd("G", color.g);
//            ChildAdd("B", color.b);
//            ChildAdd("A", color.a);
        }
        break;
	case DAVA::VariantType::TYPE_AABBOX3:
        {
            DAVA::AABBox3 box = curVariantValue.AsAABBox3();
            
            ChildAdd("min", FromVector3(box.min));
            ChildAdd("max", FromVector3(box.max));
            
            QtPropertyData* min = ChildGet("min");
            min->SetFlags(FLAG_IS_NOT_EDITABLE);
            min->ChildAdd("X", box.min.x);
            min->ChildAdd("Y", box.min.y);
            min->ChildAdd("Z", box.min.z);
            
            QtPropertyData* max = ChildGet("max");
            max->SetFlags(FLAG_IS_NOT_EDITABLE);
            max->ChildAdd("X", box.max.x);
            max->ChildAdd("Y", box.max.y);
            max->ChildAdd("Z", box.max.z);
        }
		break;
	}
}