void ModelObjectVectorController::attach(const model::ModelObject& modelObject) { detach(); m_modelObject = modelObject; attachModel(modelObject.model()); connect(m_model->getImpl<model::detail::Model_Impl>().get(), static_cast<void (model::detail::Model_Impl::*)(std::shared_ptr<detail::WorkspaceObject_Impl>, const IddObjectType &, const UUID &) const>(&model::detail::Model_Impl::addWorkspaceObject), this, &ModelObjectVectorController::objectAdded, Qt::QueuedConnection); connect(m_model->getImpl<model::detail::Model_Impl>().get(), static_cast<void (model::detail::Model_Impl::*)(std::shared_ptr<detail::WorkspaceObject_Impl>, const IddObjectType &, const UUID &) const>(&model::detail::Model_Impl::removeWorkspaceObject), this, &ModelObjectVectorController::objectRemoved, Qt::QueuedConnection); connect(m_modelObject->getImpl<model::detail::ModelObject_Impl>().get(), &model::detail::ModelObject_Impl::onRelationshipChange, this, &ModelObjectVectorController::changeRelationship); connect(m_modelObject->getImpl<model::detail::ModelObject_Impl>().get(), &model::detail::ModelObject_Impl::onDataChange, this, &ModelObjectVectorController::dataChange); connect(m_modelObject->getImpl<model::detail::ModelObject_Impl>().get(), &model::detail::ModelObject_Impl::onChange, this, &ModelObjectVectorController::change); }
void VpeMain::cForPBProject( WFileName &pj, bool nt ) { WString mask( "wp6d" ); if( nt ) { mask = "np2d"; } #ifdef __NT__ mask.concat( 'n' ); #else mask.concat( 'w' ); #endif if( _project == NULL || _project->filename() != pj && okToClear() ) { clearProject(); // eventually access should be provided by WCLASS if( !access( pj, F_OK ) ) { loadProject( pj ); } else { _project = new MProject( pj ); attachModel( _project ); WFileName targname( pj ); targname.setExt( ".dll" ); MRule *rule = _config->findMatchingRule( targname, mask ); MComponent* mcomp = new MComponent( _project, rule, mask, targname ); _project->addComponent( mcomp ); VComponent* vcomp = new VComponent( this, mcomp, vCompStyle() ); _compViews.add( vcomp ); mcomp->updateItemList(); } } // update targets if( _project != NULL ) { unsigned cnt; MComponent *mcomp; cnt = _project->components().count(); for( ; cnt > 0; cnt -- ) { mcomp = (MComponent *)(_project->components()[cnt - 1] ); mcomp->updateItemList(); } } }
void setIsModel(bool newValue) { if(newValue && !m_isModel) { detachTraverse(); attachModel(); m_nameKeys.setKeyIsName(Static<KeyIsName>::instance().m_keyIsName); m_model.modelChanged(m_modelKey.c_str()); } else if(!newValue && m_isModel) { detachModel(); attachTraverse(); m_nameKeys.setKeyIsName(keyIsNameDoom3Doom3Group); } m_isModel = newValue; updateTransform(); }
BugReportForm::BugReportForm(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) { setupUi(this); setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); PgModelerUiNS::configureWidgetFont(hint_lbl, PgModelerUiNS::MEDIUM_FONT_FACTOR); connect(cancel_btn, SIGNAL(clicked(void)), this, SLOT(close(void))); connect(create_btn, SIGNAL(clicked(void)), this, SLOT(generateReport(void))); connect(attach_mod_chk, SIGNAL(toggled(bool)), attach_tb, SLOT(setEnabled(bool))); connect(attach_tb, SIGNAL(clicked()), this, SLOT(attachModel())); connect(output_tb, SIGNAL(clicked()), this, SLOT(selectOutput())); connect(actions_txt, SIGNAL(textChanged()), this, SLOT(enableGeneration())); connect(output_edt, SIGNAL(textChanged(QString)), this, SLOT(enableGeneration())); output_edt->setText(QFileInfo(GlobalAttributes::TEMPORARY_DIR).absoluteFilePath()); //Installs a syntax highlighter on model_txt widget hl_model_txt=new SyntaxHighlighter(model_txt); hl_model_txt->loadConfiguration(GlobalAttributes::XML_HIGHLIGHT_CONF_PATH); QDir tmp_dir=QDir(GlobalAttributes::TEMPORARY_DIR, QString("*.dbm"), QDir::Name, QDir::Files | QDir::NoDotAndDotDot); tmp_dir.setSorting(QDir::Time); QStringList list=tmp_dir.entryList(); if(!list.isEmpty()) { QFile input; //Opens the last modified model file showing it on the proper widget input.setFileName(GlobalAttributes::TEMPORARY_DIR + GlobalAttributes::DIR_SEPARATOR + list[0]); input.open(QFile::ReadOnly); model_txt->setPlainText(QString(input.readAll())); input.close(); } }
/** Attach the kart model and wheels to the scene node. * \return the node with the model attached */ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool always_animated) { assert(!m_is_master); scene::ISceneNode* node = NULL; m_render_info.setKartModelRenderInfo(m_krt); if (animated_models) { LODNode* lod_node = new LODNode("kart", irr_driver->getSceneManager()->getRootSceneNode(), irr_driver->getSceneManager() ); node = irr_driver->addAnimatedMesh(m_mesh, "kartmesh", NULL/*parent*/, getRenderInfo()); // as animated mesh are not cheap to render use frustum box culling if (CVS->isGLSL()) node->setAutomaticCulling(scene::EAC_OFF); else node->setAutomaticCulling(scene::EAC_FRUSTUM_BOX); if (always_animated) { // give a huge LOD distance for the player's kart. the reason is that it should // use its animations for the shadow pass too, where the camera can be quite far lod_node->add(10000, node, true); scene::ISceneNode* static_model = attachModel(false, false); lod_node->add(10001, static_model, true); m_animated_node = static_cast<scene::IAnimatedMeshSceneNode*>(node); } else { lod_node->add(20, node, true); scene::ISceneNode* static_model = attachModel(false, false); lod_node->add(100, static_model, true); m_animated_node = static_cast<scene::IAnimatedMeshSceneNode*>(node); } attachHat(); #ifdef DEBUG std::string debug_name = m_model_filename+" (animated-kart-model)"; node->setName(debug_name.c_str()); #if SKELETON_DEBUG irr_driver->addDebugMesh(m_animated_node); #endif #endif m_animated_node->setLoopMode(false); m_animated_node->grab(); node = lod_node; // Become the owner of the wheels for(unsigned int i=0; i<4; i++) { if (!m_wheel_model[i] || !m_wheel_node[i]) continue; m_wheel_node[i]->setParent(lod_node); } // Become the owner of the speed weighted objects for(size_t i=0; i<m_speed_weighted_objects.size(); i++) { if(!m_speed_weighted_objects[i].m_node) continue; m_speed_weighted_objects[i].m_node->setParent(lod_node); } // Enable rim lighting for the kart irr_driver->applyObjectPassShader(lod_node, true); std::vector<scene::ISceneNode*> &lodnodes = lod_node->getAllNodes(); const u32 max = (u32)lodnodes.size(); for (u32 i = 0; i < max; i++) { irr_driver->applyObjectPassShader(lodnodes[i], true); } } else { // If no animations are shown, make sure to pick the frame // with a straight ahead animation (if exist). int straight_frame = m_animation_frame[AF_STRAIGHT]>=0 ? m_animation_frame[AF_STRAIGHT] : 0; scene::IMesh* main_frame = m_mesh->getMesh(straight_frame); main_frame->setHardwareMappingHint(scene::EHM_STATIC); std::string debug_name; #ifdef DEBUG debug_name = m_model_filename + " (kart-model)"; #endif node = irr_driver->addMesh(main_frame, debug_name, NULL /*parent*/, getRenderInfo()); #ifdef DEBUG node->setName(debug_name.c_str()); #endif // Attach the wheels for(unsigned int i=0; i<4; i++) { if(!m_wheel_model[i]) continue; m_wheel_node[i] = irr_driver->addMesh(m_wheel_model[i], "wheel", node, getRenderInfo(), true/*all_parts_colorized*/); Vec3 wheel_min, wheel_max; MeshTools::minMax3D(m_wheel_model[i], &wheel_min, &wheel_max); m_wheel_graphics_radius[i] = 0.5f*(wheel_max.getY() - wheel_min.getY()); m_wheel_node[i]->grab(); ((scene::IMeshSceneNode *) m_wheel_node[i])->setReadOnlyMaterials(true); #ifdef DEBUG std::string debug_name = m_wheel_filename[i]+" (wheel)"; m_wheel_node[i]->setName(debug_name.c_str()); #endif m_wheel_node[i]->setPosition(m_wheel_graphics_position[i].toIrrVector()); } // Attach the speed weighted objects + set the animation state for(size_t i=0 ; i < m_speed_weighted_objects.size() ; i++) { SpeedWeightedObject& obj = m_speed_weighted_objects[i]; obj.m_node = NULL; if(obj.m_model) { obj.m_node = irr_driver->addAnimatedMesh(obj.m_model, "speedweighted", node, getRenderInfo(), true/*all_parts_colorized*/); obj.m_node->grab(); obj.m_node->setFrameLoop(m_animation_frame[AF_SPEED_WEIGHTED_START], m_animation_frame[AF_SPEED_WEIGHTED_END]); #ifdef DEBUG std::string debug_name = obj.m_name+" (speed-weighted)"; obj.m_node->setName(debug_name.c_str()); #endif obj.m_node->setPosition(obj.m_position.toIrrVector()); } } } return node; } // attachModel
CollectionListView::CollectionListView(QWidget *parent) : QListView(parent), m_currentCollectionId(0) { setAttribute(Qt::WA_MacShowFocusRect, 0); //on mac disable focus rect around borders setFocusPolicy(Qt::ClickFocus); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setItemDelegate(new CollectionViewDelegate(this)); setStyleSheet( "QListView { " "border: none; " "background-color: transparent;" "font-size: 13px;" "}" "QListView:item { " "padding-bottom: 3px;" "padding-top: 3px;" "padding-left: 15px;" "border: none;" //workaround qt stylesheet bug, border must be specificated "}" "QListView:item:selected { " "border-top: 1px solid #57A5DA;" "border-bottom: 1px solid #2B7CBD;" "background-color: qlineargradient(spread:pad, x1:0.506926, y1:1, x2:0.512, y2:0, stop:0 rgba(46, 137, 205, 255)," "stop:1 rgba(108, 186, 230, 255));" "color: white;" "}" #ifdef Q_OS_OSX "QListView:item:selected:!active { " "border-top: 1px solid #BBC5D5;" "border-bottom: 1px solid #92A0B8;" "background-color: qlineargradient(spread:pad, x1:0.506926, y1:1, x2:0.512, y2:0, stop:0 rgba(155, 170, 195, 255)," "stop:1 rgba(195, 204, 222, 255));" "color: white;" "}" #endif // Q_OS_OSX ); //set model attachModel(); //connections connect(this->itemDelegate(), SIGNAL(closeEditor(QWidget*)), this, SLOT(editingFinished())); //contect menu actions m_newCollectionAction = new QAction(tr("New"), this); m_deleteCollectionAction = new QAction(tr("Delete"), this); //context menu connections connect(m_deleteCollectionAction, SIGNAL(triggered()), this, SLOT(deleteCollectionActionTriggered())); connect(m_newCollectionAction, SIGNAL(triggered()), this, SLOT(newCollectionActionTriggered())); //connect collection change (if triggered from elsewhere) MetadataEngine *meta = &MetadataEngine::getInstance(); connect(meta, SIGNAL(currentCollectionIdChanged(int)), this, SLOT(currentCollectionIdChanged(int))); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); }