Ejemplo n.º 1
0
// ------------------------------------------------------------------------------------------------
AnimationStack::AnimationStack(uint64_t id, const Element& element, const std::string& name, const Document& doc)
: Object(id, element, name)
{
	const Scope& sc = GetRequiredScope(element);

	// note: we don't currently use any of these properties so we shouldn't bother if it is missing
	props = GetPropertyTable(doc,"AnimationStack.FbxAnimStack",element,sc, true);

	// resolve attached animation layers
	const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationLayer");
	layers.reserve(conns.size());

	BOOST_FOREACH(const Connection* con, conns) {

		// link should not go to a property
		if (con->PropertyName().length()) {
			continue;
		}

		const Object* const ob = con->SourceObject();
		if(!ob) {
			DOMWarning("failed to read source object for AnimationLayer->AnimationStack link, ignoring",&element);
			continue;
		}

		const AnimationLayer* const anim = dynamic_cast<const AnimationLayer*>(ob);
		if(!anim) {
			DOMWarning("source object for ->AnimationStack link is not an AnimationLayer",&element);
			continue;
		}
		layers.push_back(anim);
	}
}
Ejemplo n.º 2
0
// ------------------------------------------------------------------------------------------------
// fetch a property table and the corresponding property template 
boost::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc, 
	const std::string& templateName, 
	const Element &element, 
	const Scope& sc,
	bool no_warn /*= false*/)
{
	const Element* const Properties70 = sc["Properties70"];
	boost::shared_ptr<const PropertyTable> templateProps = boost::shared_ptr<const PropertyTable>(
		static_cast<const PropertyTable*>(NULL));

	if(templateName.length()) {
		PropertyTemplateMap::const_iterator it = doc.Templates().find(templateName); 
		if(it != doc.Templates().end()) {
			templateProps = (*it).second;
		}
	}

	if(!Properties70) {
		if(!no_warn) {
			DOMWarning("property table (Properties70) not found",&element);
		}
		if(templateProps) {
			return templateProps;
		}
		else {
			return boost::make_shared<const PropertyTable>();
		}
	}
	return boost::make_shared<const PropertyTable>(*Properties70,templateProps);
}
Ejemplo n.º 3
0
// ------------------------------------------------------------------------------------------------
void DOMWarning(const std::string& message, const Element* element /*= NULL*/)
{
	if(element) {
		DOMWarning(message,element->KeyToken());
		return;
	}
	if(DefaultLogger::get()) {
		DefaultLogger::get()->warn("FBX-DOM: " + message);
	}
}