void SimpleCubeTool::Process(Request *req) { // We really don't need to override Process() here as the default implementation which calls CreateScene() is ok. We // are overriding it so you can get an idea of what the base implementation does if at some point the default implementation // is insufficient. For this SimpleCube example you could replace all the below code with "BaseClass::Process(req);". // Fusion tools pass Parameters between their inputs and outputs. Image, Number, Scene3D, and MtlGraph3D are examples // of subclasses of Parameter that plugin developers will typically see getting passed between inputs and outputs. // Transform3DOperator automatically adds an input(In3D) and output(Out3D) declared to take a Scene3D parameters. It is // the job of the SimpleCubeTool to create a new Scene3D containing the incoming Scene3D and the cube geometry and then // outputing the resulting scene. If we didn't inherit from Transform3DOperator we would have to manually add the main // input/output ourselves. // We're going to start off by setting the output Scene3D to be NULL. This will cause Fusion to fail the render of this // tool. Later on we'll set the output to something valid if we succeed. This is just to make error handling easier. Out3D->Set(req, NULL); Scene3D *inScene = (Scene3D *) In3D->GetValue(req); // get the incoming scene Node3D *root = CreateScene(req); // get the surface node we'll be merging into the incoming scene if (root) { Scene3D *outScene = new Scene3D(Document, req); // create the outgoing scene if (inScene && inScene->RootNode) { // Note that we have to take a copy of the incoming scene rather attaching it to root directly. Any Parameter you get // from an input (ie. via GetValue(req) in Process()) must be treated as read only. The reason is that Parameters are // reference counted shared objects. This is kind of unfortunate, but its not so bad because we're doing a shallow copy // of the node structure and all the heavy data is refcounted across. Node3D *inRoot = inScene->RootNode->Copy(); root->AddChild(inRoot); } ProcessTransform(req, root); // copy the transform from the inputs in the transform tab to the root node outScene->SetRootNode(root); // output the new scene Out3D->Set(req, outScene); } }
void ParticleSystemLoader::ProcessEmiter (TiXmlElement* xmlElem, ParticleSystem* partSys, const std::string& filename) { Emiter* emiter = CreateEmiter (xmlElem, filename); TiXmlElement* content = xmlElem->FirstChildElement (); while (content) { std::string name = content->Value (); if (name == "Particle") { ProcessParticle (content, emiter, filename); } else if (name == "Transform") { ProcessTransform (content, emiter); } else if (name == "EmissionShape") { ProcessEmisShape (content, emiter); } else if (name == "ScaleCurve") { ProcessScaleCurve (content, emiter); } else if (name == "SpeedCurve") { ProcessTweenCurve (content, emiter); } else if (name == "LifetimeRange") { ProcessLifetimeRange (content, emiter); } else if (name == "SpeedRange") { ProcessSpeedRange (content, emiter); } else if (name == "ScaleRange") { ProcessScaleRange (content, emiter); } content = content->NextSiblingElement (); } partSys->SetEmiter (emiter); }
void Selector::Process(Node *node) { System::Object* o = node->GetData(); if (o) { auto type = o->GetType(); if (type->IsEqual(&Virtual::StaticGeometry::Info.Type)) ProcessStaticGeometry(node, (Virtual::StaticGeometry*)o); else if (type->IsEqual(&Virtual::SkinGeometry::Info.Type)) ProcessSkinGeometry(node, (Virtual::SkinGeometry*)o); else if (type->IsEqual(&Virtual::Transform::Info.Type)) ProcessTransform(node, (Virtual::Transform*)o); else if (type->IsEqual(&AI::NaviMesh::Info.Type)) ProcessNaviMesh(node, (AI::NaviMesh*)0); else if (type->IsEqual(&Virtual::TerrainMesh::Info.Type)) ProcessTerrainMesh(node, (Virtual::TerrainMesh*)o); else ProcessChildren(node); } else { ProcessChildren(node); } }