Entity* ParticleEmitterNode::Clone(Entity *dstNode /*= NULL*/) { if (!dstNode) { DVASSERT_MSG(IsPointerToExactClass<ParticleEmitterNode>(this), "Can clone only ParticleEmitterNode"); dstNode = new ParticleEmitterNode(); } Entity::Clone(dstNode); ParticleEmitterNode *nd = (ParticleEmitterNode *)dstNode; nd->yamlPath = yamlPath; nd->LoadFromYaml(yamlPath); return dstNode; }
void CreateNodesDialog::CreateNode(ResourceEditor::eNodeType nodeType) { SafeRelease(sceneNode); SceneEditorScreenMain * screen = (SceneEditorScreenMain*)UIScreenManager::Instance()->GetScreen(SCREEN_SCENE_EDITOR_MAIN); EditorScene * editorScene = screen->FindCurrentBody()->bodyControl->GetScene(); scene = editorScene; switch (nodeType) { case ResourceEditor::NODE_LANDSCAPE: SetHeader(LocalizedString(L"createnode.landscape")); sceneNode = new LandscapeNode(); sceneNode->SetName("Landscape"); break; case ResourceEditor::NODE_LIGHT: { SetHeader(LocalizedString(L"createnode.light")); sceneNode = EditorLightNode::CreateSceneAndEditorLight(); sceneNode->SetName("Light"); break; } case ResourceEditor::NODE_SERVICE_NODE: { SetHeader(LocalizedString(L"createnode.servicenode")); sceneNode = new SceneNode(); KeyedArchive *customProperties = sceneNode->GetCustomProperties(); customProperties->SetBool("editor.isLocked", true); sceneNode->SetName("Servicenode"); break; } case ResourceEditor::NODE_BOX: SetHeader(LocalizedString(L"createnode.box")); sceneNode = new CubeNode(); sceneNode->SetName("Cube"); break; case ResourceEditor::NODE_SPHERE: SetHeader(LocalizedString(L"createnode.sphere")); sceneNode = new SphereNode(); sceneNode->SetName("Sphere"); break; case ResourceEditor::NODE_CAMERA: SetHeader(LocalizedString(L"createnode.camera")); sceneNode = new Camera(); ((Camera *)sceneNode)->SetUp(Vector3(0.0f, 0.0f, 1.0f)); sceneNode->SetName("Camera"); break; case ResourceEditor::NODE_IMPOSTER: SetHeader(LocalizedString(L"createnode.imposter")); sceneNode = new ImposterNode(); sceneNode->SetName("Imposter"); break; case ResourceEditor::NODE_PARTICLE_EMITTER: { SetHeader(LocalizedString(L"createnode.particleemitter")); ParticleEmitterNode * node = new ParticleEmitterNode(); node->LoadFromYaml("~res:/Particles/sparkles.yaml"); sceneNode = node; } break; case ResourceEditor::NODE_USER_NODE: SetHeader(LocalizedString(L"createnode.usernode")); sceneNode = new UserNode(); sceneNode->SetName("UserNode"); break; default: break; } propertyList = PropertyControlCreator::Instance()->CreateControlForNode(sceneNode, propertyRect, true); SafeRetain(propertyList); AddControl(propertyList); SetScene(editorScene); propertyList->ReadFrom(sceneNode); }