Esempio n. 1
0
void CompoundCommand::serialize(ISerializer& serializer) const
{
	serializer.serialize(getId());
	serializer.serialize(getSubCommands().size());
	for (auto& c : getSubCommands())
	{
		serializer.serialize(c.first);
	}
	getMacroObject().getBase<MacroObject>()->serialize(serializer);
}
void RPURU::saveRedoData(ISerializer& serializer, const ReflectedPropertyUndoRedoHelper& helper)
{
	const char* propertyHeaderTag = RPURU::getPropertyHeaderTag();
	// write header
	serializer.serialize(propertyHeaderTag);
	// write root object id
	serializer.serialize(helper.objectId_.toString());
	// write property fullPath
	serializer.serialize(helper.path_);
	// write value
	serializer.serialize(helper.postValue_);
}
void RPURU::saveRedoData(ISerializer& serializer, const ReflectedMethodUndoRedoHelper& helper)
{
	const char* methodHeaderTag = RPURU::getMethodHeaderTag();
	serializer.serialize(methodHeaderTag);
	serializer.serialize(helper.objectId_.toString());
	serializer.serialize(helper.path_);
	serializer.serialize(helper.parameters_.size());

	for (auto itr = helper.parameters_.cbegin(); itr != helper.parameters_.cend(); ++itr)
	{
		serializer.serialize(*itr);
	}

	serializer.serialize(helper.result_);
}
Esempio n. 4
0
//==============================================================================
bool ContextDefinitionManager::serializeDefinitions(ISerializer& serializer)
{
	std::set<const IClassDefinition*> genericDefs;
	for (auto& definition : contextDefinitions_)
	{
		if (definition->isGeneric())
		{
			genericDefs.insert(definition);
		}
	}

	serializer.serialize(genericDefs.size());
	for (auto& classDef : genericDefs)
	{
		TF_ASSERT(classDef);
		serializer.serialize(classDef->getName());
		const auto & parentNames = classDef->getParentNames();
		if (parentNames.size() == 0)
		{
			serializer.serialize("");
		}
		else
		{
			bool first = true;
			for (const auto & parentName : parentNames )
			{
				if (first)
				{
					serializer.serialize(parentName);
					first = false;
				}
				else
				{
					serializer.serialize("|");
					serializer.serialize(parentName);
				}
			}
		}

		// write all properties
		std::vector<IBasePropertyPtr> baseProps;
		for (PropertyIterator pi = classDef->directProperties().begin(), end = classDef->directProperties().end();
		     (pi != end); ++pi)
		{
			auto metaData = findFirstMetaData<MetaNoSerializationObj>(*(*pi), *this);
			if (metaData != nullptr)
			{
				continue;
			}
			baseProps.push_back(*pi);
		}
		size_t count = baseProps.size();
		serializer.serialize(count);
		for (auto baseProp : baseProps)
		{
			TF_ASSERT(baseProp);
			serializer.serialize(baseProp->getName());
			auto metaType = MetaType::find(baseProp->getType());
			if (metaType != nullptr)
			{
				serializer.serialize(metaType->name());
			}
			else
			{
				serializer.serialize(baseProp->getType().getName());
			}

			uint32_t flags = 0;
			flags |= baseProp->isCollection() ? ContextDefinitionManagerDetails::IS_COLLECTION : 0;
			serializer.serialize(flags);
		}
	}

	genericDefs.clear();
	return true;
}