void CreateNodesDialog::CreateNode(ResourceEditor::eNodeType nodeType) { SafeRelease(sceneNode); SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive(); EditorScene * editorScene = activeScene->GetScene(); scene = editorScene; switch (nodeType) { case ResourceEditor::NODE_LANDSCAPE: SetHeader(LocalizedString(L"createnode.landscape")); sceneNode = new Entity(); sceneNode->AddComponent(new RenderComponent(ScopedPtr<Landscape>(new Landscape()))); sceneNode->SetName("Landscape"); break; case ResourceEditor::NODE_LIGHT: { SetHeader(LocalizedString(L"createnode.light")); //sceneNode = //EditorLightNode::CreateSceneAndEditorLight(); sceneNode = new Entity(); sceneNode->AddComponent(new LightComponent(ScopedPtr<Light>(new Light))); sceneNode->SetName("Light"); break; } case ResourceEditor::NODE_SERVICE_NODE: { SetHeader(LocalizedString(L"createnode.servicenode")); sceneNode = new Entity(); KeyedArchive *customProperties = sceneNode->GetCustomProperties(); customProperties->SetBool("editor.isLocked", true); sceneNode->SetName("Servicenode"); break; } case ResourceEditor::NODE_CAMERA: { SetHeader(LocalizedString(L"createnode.camera")); sceneNode = new Entity(); Camera * camera = new Camera(); camera->SetUp(Vector3(0.0f, 0.0f, 1.0f)); sceneNode->AddComponent(new CameraComponent(camera)); sceneNode->SetName("Camera"); SafeRelease(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")); sceneNode = new Entity(); sceneNode->SetName("Particle Emitter"); ParticleEmitter3D* newEmitter = new ParticleEmitter3D(); RenderComponent * renderComponent = new RenderComponent(); renderComponent->SetRenderObject(newEmitter); sceneNode->AddComponent(renderComponent); newEmitter->Release(); break; } case ResourceEditor::NODE_USER_NODE: { SetHeader(LocalizedString(L"createnode.usernode")); sceneNode = new Entity(); sceneNode->SetName("UserNode"); sceneNode->AddComponent(new UserComponent()); break; } case ResourceEditor::NODE_SWITCH_NODE: { SetHeader(LocalizedString(L"createnode.switchnode")); sceneNode = new Entity(); sceneNode->SetName("SwitchNode"); sceneNode->AddComponent(new SwitchComponent()); KeyedArchive *customProperties = sceneNode->GetCustomProperties(); customProperties->SetBool(Entity::SCENE_NODE_IS_SOLID_PROPERTY_NAME, false); } break; case ResourceEditor::NODE_PARTICLE_EFFECT: { SetHeader(L"Particle Effect"); sceneNode = new Entity(); ParticleEffectComponent* newEffectComponent = new ParticleEffectComponent(); sceneNode->AddComponent(newEffectComponent); sceneNode->SetName("Particle Effect"); break; } default: break; } propertyList = PropertyControlCreator::Instance()->CreateControlForNode(sceneNode, propertyRect, true); SafeRetain(propertyList); AddControl(propertyList); SetScene(editorScene); propertyList->ReadFrom(sceneNode); }
void CreateNodesDialog::CreateNode(ResourceEditor::eNodeType nodeType) { SafeRelease(sceneNode); SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive(); EditorScene * editorScene = activeScene->GetScene(); scene = editorScene; switch (nodeType) { case ResourceEditor::NODE_LANDSCAPE: SetHeader(LocalizedString(ResourceEditor::CREATE_NODE_LANDSCAPE)); sceneNode = new Entity(); sceneNode->AddComponent(ScopedPtr<RenderComponent> (new RenderComponent(ScopedPtr<Landscape>(new Landscape())))); sceneNode->SetName(ResourceEditor::LANDSCAPE_NODE_NAME); break; case ResourceEditor::NODE_LIGHT: { SetHeader(LocalizedString(ResourceEditor::CREATE_NODE_LIGHT)); //sceneNode = //EditorLightNode::CreateSceneAndEditorLight(); sceneNode = new Entity(); sceneNode->AddComponent(ScopedPtr<LightComponent> (new LightComponent(ScopedPtr<Light>(new Light)))); sceneNode->SetName(ResourceEditor::LIGHT_NODE_NAME); break; } case ResourceEditor::NODE_SERVICE_NODE: { SetHeader(LocalizedString(ResourceEditor::CREATE_NODE_SERVICE)); sceneNode = new Entity(); KeyedArchive *customProperties = sceneNode->GetCustomProperties(); customProperties->SetBool(ResourceEditor::EDITOR_IS_LOCKED, true); sceneNode->SetName(ResourceEditor::SERVICE_NODE_NAME); break; } case ResourceEditor::NODE_CAMERA: { SetHeader(LocalizedString(ResourceEditor::CREATE_NODE_CAMERA)); sceneNode = new Entity(); Camera * camera = new Camera(); camera->SetUp(Vector3(0.0f, 0.0f, 1.0f)); sceneNode->AddComponent(ScopedPtr<CameraComponent> (new CameraComponent(camera))); sceneNode->SetName(ResourceEditor::CAMERA_NODE_NAME); SafeRelease(camera); }break; case ResourceEditor::NODE_IMPOSTER: SetHeader(LocalizedString(ResourceEditor::CREATE_NODE_IMPOSTER)); sceneNode = new ImposterNode(); sceneNode->SetName(ResourceEditor::IMPOSTER_NODE_NAME); break; case ResourceEditor::NODE_PARTICLE_EMITTER: { SetHeader(LocalizedString(ResourceEditor::CREATE_NODE_PARTICLE_EMITTER)); sceneNode = new Entity(); sceneNode->SetName(ResourceEditor::PARTICLE_EMITTER_NODE_NAME); ParticleEmitter3D* newEmitter = new ParticleEmitter3D(); RenderComponent * renderComponent = new RenderComponent(); renderComponent->SetRenderObject(newEmitter); sceneNode->AddComponent(renderComponent); newEmitter->Release(); renderComponent->Release(); break; } case ResourceEditor::NODE_USER_NODE: { SetHeader(LocalizedString(ResourceEditor::CREATE_NODE_USER)); sceneNode = new Entity(); sceneNode->SetName(ResourceEditor::USER_NODE_NAME); sceneNode->AddComponent(ScopedPtr<UserComponent> (new UserComponent())); break; } case ResourceEditor::NODE_SWITCH_NODE: { SetHeader(LocalizedString(ResourceEditor::CREATE_NODE_SWITCH)); sceneNode = new Entity(); sceneNode->SetName(ResourceEditor::SWITCH_NODE_NAME); sceneNode->AddComponent(ScopedPtr<SwitchComponent> (new SwitchComponent())); KeyedArchive *customProperties = sceneNode->GetCustomProperties(); customProperties->SetBool(Entity::SCENE_NODE_IS_SOLID_PROPERTY_NAME, false); } break; case ResourceEditor::NODE_PARTICLE_EFFECT: { SetHeader(ResourceEditor::CREATE_NODE_PARTICLE_EFFECT); sceneNode = new Entity(); sceneNode->AddComponent(ScopedPtr<ParticleEffectComponent> (new ParticleEffectComponent())); sceneNode->SetName(ResourceEditor::PARTICLE_EFFECT_NODE_NAME); break; } case ResourceEditor::NODE_SKYBOX: { SetHeader(L"SkyBox"); //TODO: add skybox creation code here break; } default: break; } propertyList = PropertyControlCreator::Instance()->CreateControlForNode(sceneNode, propertyRect, true); SafeRetain(propertyList); AddControl(propertyList); SetScene(editorScene); propertyList->ReadFrom(sceneNode); }