void RenderPreview::filtersChanged() { if (!getScene()->root()) return; GlobalFilterSystem().updateSubgraph(getScene()->root()); queueDraw(); }
void Splash::setProgress(float fraction) { if (_progressBar == NULL) { createProgressBar(); } gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(_progressBar), fraction); queueDraw(); }
void Splash::setText(const std::string& text) { if (_progressBar == NULL) { createProgressBar(); } gtk_progress_bar_set_text(GTK_PROGRESS_BAR(_progressBar), text.c_str()); queueDraw(); }
void XAP_CustomWidgetLU::queueDrawLU(const UT_Rect *clip) { GR_Graphics *gr = getGraphics(); UT_ASSERT(gr); if (clip == NULL) queueDraw(); else { UT_Rect r( gr->tdu(clip->left), gr->tdu(clip->top), gr->tdu(clip->width), gr->tdu(clip->height) ); queueDraw(&r); } }
// Set the model, this also resets the camera void ModelPreview::setModel(const std::string& model) { // If the model name is empty, release the model if (model.empty()) { if (_modelNode) { _entity->removeChildNode(_modelNode); } _modelNode.reset(); stopPlayback(); return; } // Set up the scene if (!_entity) { getScene(); // trigger a setupscenegraph call } if (_modelNode) { _entity->removeChildNode(_modelNode); } _modelNode = GlobalModelCache().getModelNode(model); if (_modelNode) { _entity->addChildNode(_modelNode); // Trigger an initial update of the subgraph GlobalFilterSystem().updateSubgraph(getScene()->root()); // Reset camera if the model has changed if (model != _lastModel) { // Reset preview time stopPlayback(); // Reset the rotation to the default one _rotation = Matrix4::getRotationAboutZDegrees(45); _rotation = _rotation.getMultipliedBy(Matrix4::getRotation(Vector3(1,-1,0), 45)); // Calculate camera distance so model is appropriately zoomed _camDist = -(_modelNode->localAABB().getRadius() * 5.0f); } _lastModel = model; } // Redraw queueDraw(); }
void ModelPreview::setSkin(const std::string& skin) { // Load and apply the skin, checking first to make sure the model is valid // and not null if (_modelNode != NULL) { model::ModelNodePtr model = Node_getModel(_modelNode); if (model) { ModelSkin& mSkin = GlobalModelSkinCache().capture(skin); model->getIModel().applySkin(mSkin); } } // Redraw queueDraw(); }
void ParticlePreview::setParticle(const std::string& name) { std::string nameClean = name; if (boost::algorithm::ends_with(nameClean, ".prt")) { nameClean = nameClean.substr(0, nameClean.length() - 4); } // If the model name is empty, release the model if (nameClean.empty()) { if (_particleNode) { _entity->removeChildNode(_particleNode); } _particleNode.reset(); stopPlayback(); return; } // Set up the scene if (!_entity) { setupSceneGraph(); } if (_particleNode) { _entity->removeChildNode(_particleNode); } // Construct the particle emitter node _particleNode = GlobalParticlesManager().createParticleNode(nameClean); if (_particleNode && _lastParticle != nameClean) { _entity->addChildNode(_particleNode); // Reset preview time stopPlayback(); // Reset the rotation to the default one _rotation = Matrix4::getRotation(Vector3(0,-1,0), Vector3(0,-0.3f,1)); _rotation.multiplyBy(Matrix4::getRotation(Vector3(0,1,0), Vector3(1,-1,0))); // Call update(0) once to enable the bounds calculation _particleNode->getParticle()->update(_rotation); // Use particle AABB to adjust camera distance const AABB& particleBounds = _particleNode->getParticle()->getBounds(); if (particleBounds.isValid()) { _camDist = -2.0f * static_cast<float>(particleBounds.getRadius()); } else { // Bounds not valid, fall back to default _camDist = -40.0f; } _lastParticle = nameClean; // Start playback when switching particles startPlayback(); } // Redraw queueDraw(); }
void CamWnd::update() { queueDraw(); }
// Set the model, this also resets the camera void AnimationPreview::setModelNode(const scene::INodePtr& node) { // Ensure that this is an MD5 model node model::ModelNodePtr model = Node_getModel(node); if (!model) { rError() << "AnimationPreview::setModelNode: node is not a model." << std::endl; _model.reset(); return; } // Set up the scene if (!_entity) { setupSceneGraph(); } try { dynamic_cast<const md5::IMD5Model&>(model->getIModel()); } catch (std::bad_cast&) { rError() << "AnimationPreview::setModelNode: modelnode doesn't contain an MD5 model." << std::endl; _model.reset(); return; } if (_model) { _entity->removeChildNode(_model); } _model = node; // Set the animation to play dynamic_cast<md5::IMD5Model&>(model->getIModel()).setAnim(_anim); // AddChildNode also tells the model which renderentity it is attached to _entity->addChildNode(_model); if (_model != NULL) { // Reset preview time stopPlayback(); // Reset the rotation to the default one _rotation = Matrix4::getRotation(Vector3(0,-1,0), Vector3(0,-0.3f,1)); _rotation.multiplyBy(Matrix4::getRotation(Vector3(0,1,0), Vector3(1,-1,0))); // Use AABB to adjust camera distance const AABB& bounds = _model->localAABB(); if (bounds.isValid()) { _camDist = -5.0f * static_cast<float>(bounds.getRadius()); } else { // Bounds not valid, fall back to default _camDist = -40.0f; } // Start playback when switching particles startPlayback(); } else { stopPlayback(); } // Redraw queueDraw(); }
void Splash::show() { gtk_widget_show_all(GTK_WIDGET(_window)); queueDraw(); }