EC_Mesh *EC_MediaPlayer::GetMeshComponent() { if (!ParentEntity()) return 0; EC_Mesh *mesh = ParentEntity()->GetComponent<EC_Mesh>().get(); return mesh; }
void EC_MediaPlayer::ComponentRemoved(IComponent *component, AttributeChange::Type change) { // If this component is being removed we need to reset to the target meshes original materials and remove the comp. if (component == this) { // Reset EC_WidgetCanvas EC_WidgetCanvas *canvasSource = GetSceneCanvasComponent(); if (canvasSource) { canvasSource->RestoreOriginalMeshMaterials(); canvasSource->SetWidget(0); } // Clean up our EC_WidgetCanvas component from the entity if (ParentEntity() && !sceneCanvasName_.isEmpty()) ParentEntity()->RemoveComponent(EC_WidgetCanvas::TypeNameStatic(), sceneCanvasName_, AttributeChange::LocalOnly); componentPrepared_ = false; } /// \todo Add check if this component has another EC_Mesh then init EC_WidgetCanvas again for that! Now we just blindly stop this EC. else if (component->TypeName() == EC_Mesh::TypeNameStatic()) { componentPrepared_ = false; } }
void EC_MediaPlayer::EntityClicked(Entity *entity, Qt::MouseButton button, RaycastResult *raycastResult) { if (!getinteractive() || !ParentEntity()) return; // We are only interested in left clicks on our entity. if (!raycastResult) return; if (button != Qt::LeftButton) return; if (entity == ParentEntity()) { // We are only interested in clicks to our target submesh index. if (raycastResult->submesh != (unsigned)getrenderSubmeshIndex()) return; // Entities have EC_Highlight if it is being manipulated. // At this situation we don't want to show any ui. if (entity->GetComponent("EC_Highlight")) return; QMenu *popupInteract = GetContextMenu(); if (!popupInteract->actions().empty()) popupInteract->exec(QCursor::pos()); } }
ComponentPtr EC_WaterPlane::FindPlaceable() const { assert(framework); ComponentPtr comp; if(!ParentEntity()) return comp; comp = ParentEntity()->GetComponent<EC_Placeable>(); return comp; }
EC_WidgetCanvas *EC_MediaPlayer::GetSceneCanvasComponent() { if (!ParentEntity()) return 0; if (sceneCanvasName_.isEmpty()) return 0; IComponent *comp = ParentEntity()->GetComponent(EC_WidgetCanvas::TypeNameStatic(), sceneCanvasName_).get(); EC_WidgetCanvas *sceneCanvas = dynamic_cast<EC_WidgetCanvas*>(comp); return sceneCanvas; }
bool Placeable::IsGrandparentOf(Entity *entity) const { if (!entity) { LogError("Placeable::IsGrandParentOf: called with null pointer."); return false; } if (!ParentEntity()) return false; if (entity == ParentEntity()) return true; EntityVector allChildren = Grandchildren(ParentEntity()); EntityVector::ConstIterator iter = allChildren.Find(EntityPtr(entity)); return iter != allChildren.End(); }
void EnvironmentLight::UpdateSignals() { if (!ViewEnabled()) return; Entity* parent = ParentEntity(); if (!parent) return; if (parent->ParentScene()) world_ = parent->ParentScene()->Subsystem<GraphicsWorld>(); if (world_) { Urho3D::Scene* urhoScene = world_->UrhoScene(); node_ = urhoScene->CreateChild("EnvironmentLight"); light_ = node_->CreateComponent<Urho3D::Light>(); light_->SetLightType(Urho3D::LIGHT_DIRECTIONAL); Urho3D::Zone* zone = world_->UrhoZone(); if (zone) zone->SetAmbientColor(ambientColor.Get()); node_->SetDirection(sunDirection.Get()); light_->SetColor(sunColor.Get()); light_->SetBrightness(brightness.Get()); light_->SetCastShadows(sunCastShadows.Get()); // Setup basic shadow cascade for desktops #ifndef ANDROID light_->SetShadowBias(Urho3D::BiasParameters(0.00025f, 0.5f)); // Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance light_->SetShadowCascade(Urho3D::CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f)); #endif } }
void EC_WidgetCanvas::Start() { if (framework->IsHeadless()) return; update_internals_ = true; if (update_interval_msec_ != 0 && refresh_timer_) { if (refresh_timer_->isActive()) refresh_timer_->stop(); refresh_timer_->start(update_interval_msec_); } else Update(); if(!mesh_hooked_) { Entity* entity = ParentEntity(); EC_Mesh* ec_mesh = entity->GetComponent<EC_Mesh>().get(); if (ec_mesh) { connect(ec_mesh, SIGNAL(MaterialChanged(uint, const QString)), SLOT(MeshMaterialsUpdated(uint, const QString))); mesh_hooked_ = true; } } }
void AnimationController::PlayAnimAutoStop(const String &name, const String &fadein, const String &exclusive) { if (!name.Length()) { LogWarning("Empty animation name for PlayAnimAutoStop"); return; } float fadein_ = 0.0f; if (fadein.Length()) fadein_ = ToFloat(fadein); bool exclusive_ = false; if (exclusive.Length()) exclusive_ = ToBool(exclusive); bool success; if (exclusive_) success = EnableExclusiveAnimation(name, false, fadein_, false); else success = EnableAnimation(name, false, fadein_, false); if (!success) { StringVector anims = AvailableAnimations(); void (*log)(const String &) = LogDebug; if (anims.Size() > 0) log = LogWarning; log("Failed to play animation \"" + name + "\" on entity " + ParentEntity()->Name()); log("The entity has " + String(anims.Size()) + " animations available: " + Join(anims, ",")); // Enable autostop, and start always from the beginning SetAnimationAutoStop(name, true); SetAnimationTimePosition(name, 0.0f); } }
void AnimationController::PlayReverseAnim(const String &name, const String &fadein, const String &exclusive) { if (!ViewEnabled()) return; if (!name.Length()) { LogWarning("Empty animation name for PlayReverseAnim"); return; } float fadein_ = 0.0f; if (fadein.Length()) fadein_ = ToFloat(fadein); bool exclusive_ = false; if (exclusive.Length()) exclusive_ = ToBool(exclusive); bool success; if (exclusive_) success = EnableAnimation(name, true, fadein_, false); else success = EnableExclusiveAnimation(name, true, fadein_, fadein_, false); if (!success) { StringVector anims = AvailableAnimations(); void (*log)(const String &) = LogDebug; if (anims.Size() > 0) log = LogWarning; log("Failed to play animation \"" + name + "\" in reverse on entity " + ParentEntity()->Name()); log("The entity has " + String(anims.Size()) + " animations available: " + Join(anims, ",")); SetAnimationToEnd(name); SetAnimationSpeed(name, -1.0f); } }
void EC_MediaPlayer::TargetMeshMaterialChanged(uint index, const QString &material) { if (!componentPrepared_) return; if (sceneCanvasName_.isEmpty()) return; if (!ParentEntity()) return; if (!getenabled()) return; if (index == (uint)getrenderSubmeshIndex()) { EC_WidgetCanvas *sceneCanvas = GetSceneCanvasComponent(); if (sceneCanvas) { if (material != sceneCanvas->GetMaterialName()) { // This will make 3DCanvas to update its internals, which means // our material is re-applied to the submesh. sceneCanvas->SetSubmesh(getrenderSubmeshIndex()); if (pendingMediaDownload_) OnFrameUpdate(downloadingLogo_); else if (mediaPlayer_) mediaPlayer_->ForceUpdateImage(); } } } }
void EC_ProximityTrigger::Update(float /*timeStep*/) { if (!active.Get()) return; float threshold = thresholdDistance.Get(); Entity* entity = ParentEntity(); if (!entity) return; Scene* scene = entity->ParentScene(); if (!scene) return; EC_Placeable* placeable = entity->GetComponent<EC_Placeable>().get(); if (!placeable) return; EntityList otherTriggers = scene->GetEntitiesWithComponent(EC_ProximityTrigger::TypeNameStatic()); for(EntityList::iterator i = otherTriggers.begin(); i != otherTriggers.end(); ++i) { Entity* otherEntity = (*i).get(); if (otherEntity != entity) { EC_Placeable* otherPlaceable = otherEntity->GetComponent<EC_Placeable>().get(); if (!otherPlaceable) continue; float3 offset = placeable->transform.Get().pos - otherPlaceable->transform.Get().pos; float distance = offset.Length(); if ((threshold <= 0.0f) || (distance <= threshold)) { emit triggered(otherEntity, distance); } } } }
void RigidBody::ReaddBody() { if (!impl->world || !ParentEntity() || !impl->body) return; btVector3 localInertia; float m; int collisionFlags; impl->GetProperties(localInertia, m, collisionFlags); impl->world->BulletWorld()->removeRigidBody(impl->body); impl->body->setCollisionShape(impl->shape); impl->body->setMassProps(m, localInertia); impl->body->setCollisionFlags(collisionFlags); // We have changed the inertia tensor properties of the object, so recompute it. // http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=5194&hilit=inertia+tensor#p18820 impl->body->updateInertiaTensor(); impl->world->BulletWorld()->addRigidBody(impl->body, (short)collisionLayer.Get(), (short)collisionMask.Get()); impl->body->clearForces(); impl->body->setLinearVelocity(btVector3(0.0f, 0.0f, 0.0f)); impl->body->setAngularVelocity(btVector3(0.0f, 0.0f, 0.0f)); impl->body->activate(); }
bool RigidBody::HasAuthority() const { if (!impl->world || (impl->world->IsClient() && !ParentEntity()->IsLocal())) return false; return true; }
void RigidBody::CheckForPlaceableAndTerrain() { Entity* parent = ParentEntity(); if (!parent) return; if (!impl->placeable) { SharedPtr<Placeable> placeable = parent->Component<Placeable>(); if (placeable) { impl->placeable = placeable; placeable->AttributeChanged.Connect(this, &RigidBody::PlaceableUpdated); /// \todo Connect to parent transform chain signal once it exists } } if (!impl->terrain) { SharedPtr<Terrain> terrain = parent->Component<Terrain>(); if (terrain) { impl->terrain = terrain; terrain->TerrainRegenerated.Connect(this, &RigidBody::OnTerrainRegenerated); terrain->AttributeChanged.Connect(this, &RigidBody::TerrainUpdated); } } }
void RigidBody::CreateBody() { if (!impl->world || impl->body || !ParentEntity()) return; CheckForPlaceableAndTerrain(); CreateCollisionShape(); btVector3 localInertia; float m; int collisionFlags; impl->GetProperties(localInertia, m, collisionFlags); impl->body = new btRigidBody(m, impl, impl->shape, localInertia); // TEST: Adjust the threshold of when to sleep the object - for reducing network bandwidth. // impl->body->setSleepingThresholds(0.2f, 0.5f); // Bullet defaults are 0.8 and 1.0. impl->body->setUserPointer(this); impl->body->setCollisionFlags(collisionFlags); impl->world->BulletWorld()->addRigidBody(impl->body, (short)collisionLayer.Get(), (short)collisionMask.Get()); impl->body->activate(); UpdateGravity(); }
void Sky::UpdateSignals() { Entity* parent = ParentEntity(); if (!parent) return; // If scene is not view-enabled, no further action if (!ViewEnabled()) return; materialAsset_ = new AssetRefListener(); textureRefListListener_ = new AssetRefListListener(framework->Asset()); if (parent->ParentScene()) world_ = parent->ParentScene()->Subsystem<GraphicsWorld>(); if (world_) { materialAsset_->Loaded.Connect(this, &Sky::OnMaterialAssetLoaded); materialAsset_->TransferFailed.Connect(this, &Sky::OnMaterialAssetFailed); textureRefListListener_->Changed.Connect(this, &Sky::OnTextureAssetRefsChanged); textureRefListListener_->Failed.Connect(this, &Sky::OnTextureAssetFailed); textureRefListListener_->Loaded.Connect(this, &Sky::OnTextureAssetLoaded); CreateSkyboxNode(); } }
void AnimationController::OnComponentStructureChanged(IComponent*, AttributeChange::Type) { Entity *parent = ParentEntity(); if (!parent) return; mesh_ = parent->Component<Mesh>(); }
void EC_WidgetCanvas::ParentEntitySet() { if (framework->IsHeadless()) return; // Warn users if they are creating this component with sync enabled. /// \todo Maybe this component should not be a component anymore as components can no longer be non-serializable. Maybe these rendering operations should be moved to some util code inside SceneWidgetComponents. if (IsReplicated()) LogWarning("EC_WidgetCanvas: My network sync seems to be enabled, this is not advisable in most situations! I don't have any attributes and am intended for local rendering operations."); if (ParentEntity()) connect(ParentEntity(), SIGNAL(ComponentRemoved(IComponent*, AttributeChange::Type)), SLOT(ComponentRemoved(IComponent*, AttributeChange::Type)), Qt::UniqueConnection); }
bool RigidBody::SetShapeFromVisibleMesh() { Entity* parent = ParentEntity(); if (!parent) return false; Mesh* mesh = parent->Component<Mesh>().Get(); if (!mesh) return false; mass.Set(0.0f, AttributeChange::Default); shapeType.Set(TriMesh, AttributeChange::Default); collisionMeshRef.Set(mesh->meshRef.Get(), AttributeChange::Default); return true; }
void RigidBody::UpdateSignals() { Entity* parent = ParentEntity(); if (!parent) return; parent->ComponentAdded.Connect(this, &RigidBody::OnComponentAdded); impl->owner = framework->Module<BulletPhysics>(); Scene* scene = parent->ParentScene(); impl->world = scene->Subsystem<PhysicsWorld>(); }
void EC_RttTarget::PrepareRtt() { if (!ViewEnabled()) return; //\todo XXX reconfig via AttributeUpdated when these change int x = width.Get(); int y = height.Get(); // Get the camera ec EC_Camera *ec_camera = ParentEntity()->GetComponent<EC_Camera>().get(); if (!ec_camera) { LogInfo("No camera for rtt."); return; //XXX note: doesn't reschedule, so won't start working if cam added afterwards } ec_camera->GetCamera()->setAspectRatio(Ogre::Real(x) / Ogre::Real(y)); Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton().getByName(textureName.Get().toStdString()); if (tex.isNull()) { tex = Ogre::TextureManager::getSingleton().createManual(textureName.Get().toStdString(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, x, y, 0, Ogre::PF_A8R8G8B8, Ogre::TU_RENDERTARGET); } Ogre::RenderTexture *render_texture = tex->getBuffer()->getRenderTarget(); if (render_texture) { render_texture->removeAllViewports(); Ogre::Viewport *vp = 0; vp = render_texture->addViewport(ec_camera->GetCamera()); // Exclude ui overlays vp->setOverlaysEnabled(false); // Exclude highlight mesh from rendering vp->setVisibilityMask(0x2); render_texture->update(false); tex->getBuffer()->getRenderTarget()->setAutoUpdated(false); } else LogError("render target texture getting failed."); //create material to show the texture material_name_ = textureName.Get().toStdString() + "_mat"; //renderer_.lock()->GetUniqueObjectName("EC_BillboardWidget_mat"); OgreRenderer::CloneMaterial("HoveringText", material_name_); //would LitTextured be the right thing? XXX \todo Ogre::MaterialManager &material_manager = Ogre::MaterialManager::getSingleton(); Ogre::MaterialPtr material = material_manager.getByName(material_name_); OgreRenderer::SetTextureUnitOnMaterial(material, textureName.Get().toStdString()); }
void EC_WidgetCanvas::RestoreOriginalMeshMaterials() { if (framework->IsHeadless()) return; if (restore_materials_.empty()) { update_internals_ = true; return; } Entity* entity = ParentEntity(); if (material_name_.empty() || !entity) return; uint submesh_count = 0; EC_Mesh* ec_mesh = entity->GetComponent<EC_Mesh>().get(); EC_OgreCustomObject* ec_custom_object = entity->GetComponent<EC_OgreCustomObject>().get(); if (ec_mesh) submesh_count = ec_mesh->GetNumMaterials(); else if (ec_custom_object) submesh_count = ec_custom_object->GetNumMaterials(); else { ///\todo Log out error - entity doesn't contain either a EC_Mesh or EC_OgreCustomObject! return; } // Iterate trough sub meshes for(uint index = 0; index < submesh_count; ++index) { // If submesh not contained, restore the original material if (ec_mesh) { if (ec_mesh->GetMaterialName(index) == material_name_) if (restore_materials_.contains(index)) ec_mesh->SetMaterial(index, QString::fromStdString(restore_materials_[index])); } else { if (ec_custom_object->GetMaterialName(index) == material_name_) if (restore_materials_.contains(index)) ec_custom_object->SetMaterial(index, restore_materials_[index]); } } restore_materials_.clear(); update_internals_ = true; }
void EC_HoveringText::ShowMessage(const QString &text) { if (!ViewEnabled()) return; if (world_.expired()) return; OgreWorldPtr world = world_.lock(); Ogre::SceneManager *scene = world->OgreSceneManager(); assert(scene); if (!scene) return; Entity* entity = ParentEntity(); assert(entity); if (!entity) return; EC_Placeable *node = entity->GetComponent<EC_Placeable>().get(); if (!node) return; Ogre::SceneNode *sceneNode = node->GetSceneNode(); assert(sceneNode); if (!sceneNode) return; // Create billboard if it doesn't exist. if (!billboardSet_) { billboardSet_ = scene->createBillboardSet(world->GetUniqueObjectName("EC_HoveringText"), 1); assert(billboardSet_); billboardSet_->Ogre::MovableObject::setUserAny(Ogre::Any(static_cast<IComponent *>(this))); billboardSet_->Ogre::Renderable::setUserAny(Ogre::Any(static_cast<IComponent *>(this))); sceneNode->attachObject(billboardSet_); } if (billboardSet_ && !billboard_) { billboard_ = billboardSet_->createBillboard(Ogre::Vector3(0, 0, 0.7f)); SetBillboardSize(width.Get(), height.Get()); SetPosition(position.Get()); } Redraw(); }
void AnimationController::UpdateSignals() { // If scene is not view-enabled, no further action if (!ViewEnabled()) return; Entity* parent = ParentEntity(); if (!parent) return; framework->Frame()->Updated.Connect(this, &AnimationController::Update); parent->ComponentAdded.Connect(this, &AnimationController::OnComponentStructureChanged); parent->ComponentRemoved.Connect(this, &AnimationController::OnComponentStructureChanged); if (parent->ParentScene()) world_ = parent->ParentScene()->Subsystem<GraphicsWorld>(); }
void RigidBody::RequestMesh() { Entity *parent = ParentEntity(); String collisionMesh = collisionMeshRef.Get().ref.Trimmed(); if (collisionMesh.Empty() && parent) // We use the mesh ref in Mesh as the collision mesh ref if no collision mesh is set in RigidBody. { SharedPtr<Mesh> mesh = parent->Component<Mesh>(); if (!mesh) return; collisionMesh = mesh->meshRef.Get().ref.Trimmed(); } if (!collisionMesh.Empty()) { // Do not create shape right now, but request the mesh resource AssetTransferPtr transfer = GetFramework()->Asset()->RequestAsset(collisionMesh); if (transfer) transfer->Succeeded.Connect(this, &RigidBody::OnCollisionMeshAssetLoaded); } }
/* void EC_Hydrax::UpdateNoiseModule() { Hydrax::Noise::Noise *noise = 0; switch(noiseType.Get()) { case Perlin: noise = new Hydrax::Noise::Perlin(); break; case FFT: noise = new Hydrax::Noise::FFT(); break; default: LogError("Invalid Hydrax noise module type."); return; } Hydrax::Module::Module *module = 0; switch(noiseModule.Get()) { case ProjectedGrid: module = new Hydrax::Module::ProjectedGrid(impl->hydrax, noise, Ogre::Plane(Ogre::Vector3::UNIT_Y, Ogre::Vector3::ZERO), (Hydrax::MaterialManager::NormalMode)normalMode.Get()); break; case RadialGrid: module = new Hydrax::Module::RadialGrid(impl->hydrax, noise, (Hydrax::MaterialManager::NormalMode)normalMode.Get()); break; case SimpleGrid: module = new Hydrax::Module::SimpleGrid(impl->hydrax, noise, (Hydrax::MaterialManager::NormalMode)normalMode.Get()); break; default: SAFE_DELETE(noise); LogError("Invalid Hydrax noise module type."); return; } //if (impl->module && noise) // impl->module->setNoise(noise); impl->hydrax->setModule(module); impl->module = module; //impl->hydrax->loadCfg("HydraxDemo.hdx"); impl->hydrax->create(); } */ void EC_Hydrax::Update(float frameTime) { if (impl && impl->hydrax) { PROFILE(EC_Hydrax_Update); #ifdef SKYX_ENABLED // Find out if we have SkyX in the scene. If yes, use its sun position. if (impl->skyX.expired()) { std::vector<shared_ptr<EC_SkyX> > skies = ParentEntity()->ParentScene()->Components<EC_SkyX>(); if (!skies.empty()) impl->skyX = *skies.begin(); } // Set Hydrax's sun position to use either sun or moon, depending which is visible. shared_ptr<EC_SkyX> skyX = impl->skyX.lock(); if (skyX && impl->hydrax->isCreated()) { // Decrease sun strength for moonlight. Otherwise the light projection on the water surface looks unnaturally. /// @todo Decrease underwater sun strength too. const float defaultSunlightStrenth = 1.75f; const float defaultMoonlightStrenth = 0.75f; if (skyX->IsSunVisible()) { if (impl->hydrax->getSunStrength() != defaultSunlightStrenth) impl->hydrax->setSunStrength(defaultSunlightStrenth); impl->hydrax->setSunPosition(skyX->SunPosition()); } else if (skyX->IsMoonVisible()) { if (impl->hydrax->getSunStrength() != defaultMoonlightStrenth) impl->hydrax->setSunStrength(defaultMoonlightStrenth); impl->hydrax->setSunPosition(skyX->MoonPosition()); } } #endif if (impl->hydrax->isCreated()) impl->hydrax->update(frameTime); } }
return; } // Return if main camera is not set OgreWorldPtr w = ParentScene()->GetWorld<OgreWorld>(); if (!w || !w->Renderer()) return; if (!w->Renderer()->MainCamera()) { connect(w->Renderer(), SIGNAL(MainCameraChanged(Entity*)), this, SLOT(Create()), Qt::UniqueConnection); return; } disconnect(w->Renderer(), SIGNAL(MainCameraChanged(Entity*)), this, SLOT(Create())); // SkyX is a singleton component, refuse to add multiple in a scene! std::vector<shared_ptr<EC_SkyX> > skies = ParentEntity()->ParentScene()->Components<EC_SkyX>(); if (!skies.empty() && (*skies.begin()).get() != this) { LogError("EC_SkyX: Scene already has SkyX component, refusing to create a new one."); return; } // Init internals try { Remove(); impl = new Impl; impl->skyX = new SkyX::SkyX(w->OgreSceneManager(), impl->controller); impl->skyX->create();
void EC_MediaPlayer::PrepareComponent() { // Don't do anything if rendering is not enabled if (!ViewEnabled() || GetFramework()->IsHeadless()) return; // Some security checks if (componentPrepared_) { LogWarning("EC_MediaPlayer: Preparations seem to be done already, you might not want to do this multiple times."); } if (!mediaPlayer_) { LogError("EC_MediaPlayer: Cannot start preparing, webview object is null. This should never happen!"); return; } // Get parent and connect to the component removed signal. Entity *parent = ParentEntity(); if (parent) connect(parent, SIGNAL(ComponentRemoved(IComponent*, AttributeChange::Type)), SLOT(ComponentRemoved(IComponent*, AttributeChange::Type)), Qt::UniqueConnection); else { LogError("EC_MediaPlayer: Could not get parent entity pointer!"); return; } // Get EC_Mesh component EC_Mesh *mesh = GetMeshComponent(); if (!mesh) { // Wait for EC_Mesh to be added. connect(parent, SIGNAL(ComponentAdded(IComponent*, AttributeChange::Type)), SLOT(ComponentAdded(IComponent*, AttributeChange::Type)), Qt::UniqueConnection); return; } else { // Inspect if this mesh is ready for rendering. EC_Mesh being present != being loaded into Ogre and ready for rendering. if (!mesh->GetEntity()) { connect(mesh, SIGNAL(MeshChanged()), SLOT(TargetMeshReady()), Qt::UniqueConnection); return; } else connect(mesh, SIGNAL(MaterialChanged(uint, const QString&)), SLOT(TargetMeshMaterialChanged(uint, const QString&)), Qt::UniqueConnection); } if (sceneCanvasName_.isEmpty()) sceneCanvasName_ = "VlcMediaPlayerCanvas-" + QUuid::createUuid().toString().replace("{", "").replace("}", ""); // Get or create local EC_WidgetCanvas component ComponentPtr iComponent = parent->GetOrCreateComponent(EC_WidgetCanvas::TypeNameStatic(), sceneCanvasName_, AttributeChange::LocalOnly, false); EC_WidgetCanvas *sceneCanvas = dynamic_cast<EC_WidgetCanvas*>(iComponent.get()); if (!sceneCanvas) { LogError("EC_MediaPlayer: Could not get or create EC_WidgetCanvas component!"); return; } sceneCanvas->SetTemporary(true); sceneCanvas->SetSelfIllumination(getilluminating()); // All the needed components are present, mark prepared as true. componentPrepared_ = true; // We are now prepared, check enabled state and restore possible materials now if (!getenabled()) sceneCanvas->RestoreOriginalMeshMaterials(); // Show downloading info icon or if not downloading, // ask for a image update from the player if (pendingMediaDownload_) OnFrameUpdate(downloadingLogo_); else mediaPlayer_->ForceUpdateImage(); }