void CBaseMonster::PostLoad (LPCSTR section) { //------------------------------------ // Atack On Move (AOM) Parameters //------------------------------------ attack_on_move_params_t& aom = m_attack_on_move_params; aom.enabled = (READ_IF_EXISTS(pSettings, r_bool, section, "aom_enabled", FALSE)) != 0; aom.far_radius = READ_IF_EXISTS(pSettings, r_float, section, "aom_far_radius", detail::base_monster::aom_far_radius); aom.attack_radius = READ_IF_EXISTS(pSettings, r_float, section, "aom_attack_radius", detail::base_monster::aom_attack_radius); aom.update_side_period = READ_IF_EXISTS(pSettings, r_float, section, "aom_update_side_period", detail::base_monster::aom_update_side_period); aom.prediction_factor = READ_IF_EXISTS(pSettings, r_float, section, "aom_prediction_factor", detail::base_monster::aom_prediction_factor); aom.prepare_time = READ_IF_EXISTS(pSettings, r_float, section, "aom_prepare_time", detail::base_monster::aom_prepare_time); aom.prepare_radius = READ_IF_EXISTS(pSettings, r_float, section, "aom_prepare_radius", detail::base_monster::aom_prepare_radius); aom.max_go_close_time = READ_IF_EXISTS(pSettings, r_float, section, "aom_max_go_close_time", 8.f); if ( aom.enabled ) { SVelocityParam& velocity_run = move().get_velocity(MonsterMovement::eVelocityParameterRunNormal); pcstr attack_on_move_anim_l = READ_IF_EXISTS(pSettings, r_string, section, "aom_animation_left", "stand_attack_run_"); anim().AddAnim (eAnimAttackOnRunLeft, attack_on_move_anim_l, -1, &velocity_run, PS_STAND); pcstr attack_on_move_anim_r = READ_IF_EXISTS(pSettings, r_string, section, "aom_animation_right", "stand_attack_run_"); anim().AddAnim (eAnimAttackOnRunRight, attack_on_move_anim_r, -1, &velocity_run, PS_STAND); } //------------------------------------ // Anti-Aim ability //------------------------------------ if ( pSettings->line_exist(section, "anti_aim_effectors") ) { SVelocityParam& velocity_stand = move().get_velocity(MonsterMovement::eVelocityParameterStand); m_anti_aim = xr_new<anti_aim_ability>(this); control().add (m_anti_aim, ControlCom::eAntiAim); pcstr anti_aim_animation = READ_IF_EXISTS(pSettings, r_string, section, "anti_aim_animation", "stand_attack_"); anim().AddAnim (eAnimAntiAimAbility, anti_aim_animation, -1, &velocity_stand, PS_STAND); m_anti_aim->load_from_ini (pSettings, section); } }
void CAI_PseudoDog::CheckSpecParams(u32 spec_params) { if ((spec_params & ASP_PSI_ATTACK) == ASP_PSI_ATTACK) { com_man().seq_run(anim().get_motion_id(eAnimAttackPsi)); } if ((spec_params & ASP_THREATEN) == ASP_THREATEN) { anim().SetCurAnim(eAnimThreaten); } }
void CSnork::CheckSpecParams(u32 spec_params) { if ((spec_params & ASP_CHECK_CORPSE) == ASP_CHECK_CORPSE) { com_man().seq_run(anim().get_motion_id(eAnimCheckCorpse)); } if ((spec_params & ASP_STAND_SCARED) == ASP_STAND_SCARED) { anim().SetCurAnim(eAnimLookAround); return; } }
// возвращает true, если после выполнения этой функции необходимо прервать обработку // т.е. если активирована последовательность void CAI_Flesh::CheckSpecParams(u32 spec_params) { if ((spec_params & ASP_DRAG_CORPSE) == ASP_DRAG_CORPSE) anim().SetCurAnim(eAnimDragCorpse); if ((spec_params & ASP_CHECK_CORPSE) == ASP_CHECK_CORPSE) { com_man().seq_run(anim().get_motion_id(eAnimCheckCorpse)); } if ((spec_params & ASP_BACK_ATTACK) == ASP_BACK_ATTACK) { com_man().seq_run(anim().get_motion_id(eAnimAttackFromBack)); } if ((spec_params & ASP_THREATEN) == ASP_THREATEN) anim().SetCurAnim(eAnimThreaten); }
void CPseudoGigant::TranslateActionToPathParams() { if ((anim().m_tAction != ACT_RUN) && (anim().m_tAction != ACT_WALK_FWD)) { inherited::TranslateActionToPathParams(); return; } u32 vel_mask = (m_bDamaged ? MonsterMovement::eVelocityParamsWalkDamaged : MonsterMovement::eVelocityParamsWalk); u32 des_mask = (m_bDamaged ? MonsterMovement::eVelocityParameterWalkDamaged : MonsterMovement::eVelocityParameterWalkNormal); if (m_force_real_speed) vel_mask = des_mask; path().set_velocity_mask (vel_mask); path().set_desirable_mask (des_mask); path().enable_path (); }
void plMtlAnimProc::ILoadAnimCombo(HWND hWnd, IParamBlock2* pb) { HWND hAnim = GetDlgItem(hWnd, fAnimComboID); ComboBox_ResetContent(hAnim); int sel = ComboBox_AddString(hAnim, ENTIRE_ANIMATION_NAME); ComboBox_SetCurSel(hAnim, sel); const char* savedName = pb->GetStr(fAnimParamID); if (!savedName) savedName = ""; Mtl* mtl = IGetMtl(pb); if (mtl) { plNotetrackAnim anim(mtl, nil); plString animName; while (!(animName = anim.GetNextAnimName()).IsNull()) { int idx = ComboBox_AddString(hAnim, animName.c_str()); ComboBox_SetItemData(hAnim, idx, 1); if (!animName.Compare(savedName)) ComboBox_SetCurSel(hAnim, idx); } EnableWindow(hAnim, TRUE); } else EnableWindow(hAnim, FALSE); // Update the dependencies of this ILoadUser(hWnd, pb); }
void IInit(HWND hWnd, IParamBlock2* pb) { Mtl* mtl = pb->GetMtl(kMarkerMtl); if (mtl) { SetDlgItemText(hWnd, IDC_MTL_BUTTON, mtl->GetName()); plNotetrackAnim anim(mtl, nil); ILoadCombo(hWnd, IDC_ANIM_RED_COMBO, kMarkerRedAnim, pb, anim); ILoadCombo(hWnd, IDC_ANIM_GREEN_COMBO, kMarkerGreenAnim, pb, anim); ILoadCombo(hWnd, IDC_ANIM_OPEN_COMBO, kMarkerOpenAnim, pb, anim); } if (pb->GetINode(kMarkerMtlNode)) SetDlgItemText(hWnd, IDC_MTL_NODE_BUTTON, pb->GetINode(kMarkerMtlNode)->GetName()); else SetDlgItemText(hWnd, IDC_MTL_NODE_BUTTON, "(none)"); if (pb->GetINode(kMarkerBounceNode)) SetDlgItemText(hWnd, IDC_BOUNCE_BUTTON, pb->GetINode(kMarkerBounceNode)->GetName()); else SetDlgItemText(hWnd, IDC_BOUNCE_BUTTON, "(none)"); if (pb->GetINode(kMarkerSndPlace)) SetDlgItemText(hWnd, IDC_PLACE_BUTTON, pb->GetINode(kMarkerSndPlace)->GetName()); else SetDlgItemText(hWnd, IDC_PLACE_BUTTON, "(none)"); if (pb->GetINode(kMarkerSndHit)) SetDlgItemText(hWnd, IDC_HIT_BUTTON, pb->GetINode(kMarkerSndHit)->GetName()); else SetDlgItemText(hWnd, IDC_HIT_BUTTON, "(none)"); }
/** * \brief Answer to a click on the menu to change the duration of the frames. * \param event This event occured. */ void bf::main_frame::on_change_duration( wxCommandEvent& WXUNUSED(event) ) { frame_duration_dialog dlg(this); if ( dlg.ShowModal() == wxID_OK ) { animation anim( m_animation_edit->get_value() ); switch( dlg.get_mode() ) { case frame_duration_dialog::duration_replace: for (std::size_t i=0; i!=anim.frames_count(); ++i) anim.get_frame(i).set_duration(dlg.get_operand()); break; case frame_duration_dialog::duration_add: for (std::size_t i=0; i!=anim.frames_count(); ++i) anim.get_frame(i).set_duration ( dlg.get_operand() + anim.get_frame(i).get_duration() ); break; case frame_duration_dialog::duration_multiply: for (std::size_t i=0; i!=anim.frames_count(); ++i) anim.get_frame(i).set_duration ( dlg.get_operand() * anim.get_frame(i).get_duration() ); break; } m_animation_edit->set_value(anim); } } // main_frame::on_change_duration()
int main(int argc, char** argv){ // SSAO(); geDebugMode(GE_DEBUG_ALL); geInit(); geCreateMainWindow("LibGE !", 1024, 640, GE_WINDOW_RESIZABLE); geWaitVsync(false); while(1){ geClearScreen(); geSwapBuffers(); } anim(); ge_LuaScript* script = geLoadLuaScript("testsrc/test.lua"); printf("\n\n\n"); geLuaScriptStart(script, GE_LUA_EXECUTION_MODE_NORMAL); printf("\n\n\n"); geClearColor(RGBA(40, 40, 40, 255)); ge_Font* font = geLoadFont(""); geFontSize(font, 14); while(1){ geClearScreen(); geFontPrintfScreen(0, 0, font, RGBA(255, 255, 255, 255), "FPS : %d", geFps()); geSwapBuffers(); } geQuit(); return 0; }
void World::createScene(void) { mSceneMgr->setAmbientLight(Ogre::ColourValue(1.0f,1.0f,1.0f)); addAxesLines(50); int numRobots = 4; std::stringstream name; for (int i=0; i<numRobots; ++i) { name.str(""); name << "robot" << i; Ogre::Entity* entity = mSceneMgr->createEntity(name.str(), "robot.mesh"); name.str(""); name << "robotNode" << i; Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode(name.str()); node->attachObject(entity); node->setPosition(Utils::randomFlatVector3(500,0)); AnimatedShape anim(node, entity); for (int j=0; j<Utils::randomInt(4); ++j) { anim.addLocation(Utils::randomFlatVector3(200,0)); } anim.setAnimations("Walk", "Idle"); anim.startAnimation("Idle", true); mAnimatedShapes.push_back(anim); } }
void NodeAnim::initializeTableItems() { NodeGuiPtr nodeGui = _imp->nodeGui.lock(); KnobItemsTableGuiPtr table = nodeGui->getKnobItemsTable(); if (!table) { return; } KnobItemsTablePtr internalTable = table->getInternalTable(); if (!internalTable) { return; } connect(internalTable.get(), SIGNAL(itemRemoved(KnobTableItemPtr,TableChangeReasonEnum)), this, SLOT(onTableItemRemoved(KnobTableItemPtr,TableChangeReasonEnum))); connect(internalTable.get(), SIGNAL(itemInserted(int,KnobTableItemPtr,TableChangeReasonEnum)), this, SLOT(onTableItemInserted(int,KnobTableItemPtr,TableChangeReasonEnum))); NodeAnimPtr thisShared = shared_from_this(); std::vector<KnobTableItemPtr> allItems = internalTable->getTopLevelItems(); for (std::size_t i = 0; i < allItems.size(); ++i) { TableItemAnimPtr anim(TableItemAnim::create(getModel(), table, thisShared, allItems[i], _imp->nameItem)); _imp->topLevelTableItems.push_back(anim); } } // initializeTableItems
//Animate every object that has animations void object_anim() { Object *p; for(p = &object_head; (p != NULL); p = p->next) { if (p->type == player) { if (keys[KEY_UP]) { // FORWARD if (keys[KEY_LEFT]) { // LEFT p->img_i = F_L; } else if (keys[KEY_RIGHT]) { //RIGHT p->img_i = F_R; } else { // CENTER p->img_i = F_C; } } else if (keys[KEY_DOWN]) { // BREAKE if (keys[KEY_LEFT]) { // LEFT p->img_i = B_L; } else if (keys[KEY_RIGHT]) { // RIGHT p->img_i = B_R; } else { // CENTER p->img_i = B_C; } } else { // STAND if (keys[KEY_LEFT]) { // LEFT p->img_i = S_L; } else if (keys[KEY_RIGHT]) { // RIGHT p->img_i = S_R; } else { // CENTER p->img_i = S_C; } } } else if (p->type == player2) { if (keys2[KEY_UP]) { // FORWARD if (keys2[KEY_LEFT]) { // LEFT p->img_i = F_L; } else if (keys[KEY_RIGHT]) { //RIGHT p->img_i = F_R; } else { // CENTER p->img_i = F_C; } } else if (keys2[KEY_DOWN]) { // BREAKE if (keys2[KEY_LEFT]) { // LEFT p->img_i = B_L; } else if (keys[KEY_RIGHT]) { // RIGHT p->img_i = B_R; } else { // CENTER p->img_i = B_C; } } else { // STAND if (keys2[KEY_LEFT]) { // LEFT p->img_i = S_L; } else if (keys2[KEY_RIGHT]) { // RIGHT p->img_i = S_R; } else { // CENTER p->img_i = S_C; } } } else if (p != &object_head) { anim(p, p->frame_delay, p->vector_size); } } }
// *************************************************************************** bool CAnimationSet::loadFromFiles(const std::string &path, bool recurse /* = true*/, const char *ext /*= "anim"*/, bool wantWarningMessage /*= true*/) { bool everythingOk = true; std::vector<std::string> anims; NLMISC::CPath::getPathContent(path, recurse, false, true, anims); for (uint k = 0; k < anims.size(); ++k) { std::string fileExt = NLMISC::CFile::getExtension(anims[k]); if (fileExt == ext) // an animation file ? { try { NLMISC::CIFile iFile; iFile.open(anims[k]); std::auto_ptr<CAnimation> anim(new CAnimation); anim->serial(iFile); addAnimation(NLMISC::CFile::getFilenameWithoutExtension(anims[k]).c_str(), anim.release()); iFile.close(); } catch (NLMISC::EStream &e) { if (wantWarningMessage) { nlinfo("Unable to load an automatic animation : %s", e.what()); } everythingOk = false; } } } build(); return everythingOk; }
bool plMtlEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { if (!fCanExport) return false; plKey modKey = fLogicModKeys[node]; plAnimEventModifier* mod = plAnimEventModifier::ConvertNoRef(modKey->GetObjectPtr()); Mtl* mtl = fCompPB->GetMtl(kMtlMtl); plMaxNodeBase* mtlNode = (plMaxNodeBase*)fCompPB->GetINode(kMtlNode); ST::string mtlAnim = ST::string::from_utf8(fCompPB->GetStr(kMtlAnim)); // // Create and setup the callback message // hsTArray<plKey> animKeys; GetMatAnimModKey(mtl, mtlNode, mtlAnim, animKeys); plAnimCmdMsg *animMsg = new plAnimCmdMsg; animMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); animMsg->SetSender(modKey); animMsg->SetAnimName(mtlAnim); animMsg->AddReceivers(animKeys); if (fCompPB->GetInt(kMtlBegin)) { plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey); eventMsg->fEvent = kBegin; } if (fCompPB->GetInt(kMtlEnd)) { plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey); eventMsg->fEvent = kEnd; } if (fCompPB->Count(kMtlMarkers) > 0) { plNotetrackAnim anim(mtl, nil); plAnimInfo info = anim.GetAnimInfo(mtlAnim); int numMarkers = fCompPB->Count(kMtlMarkers); for (int i = 0; i < numMarkers; i++) { ST::string marker = ST::string::from_utf8(fCompPB->GetStr(kMtlMarkers, 0, i)); float time = info.GetMarkerTime(marker); plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey); eventMsg->fEvent = kTime; eventMsg->fEventTime = time; } } mod->SetCallback(animMsg); hsTArray<plKey> receivers; IGetReceivers(node, receivers); mod->SetReceivers(receivers); return true; }
void CBaseMonster::reinit() { inherited::reinit (); EnemyMemory.clear (); SoundMemory.clear (); CorpseMemory.clear (); HitMemory.clear (); EnemyMan.reinit (); CorpseMan.reinit (); StateMan->reinit (); Morale.reinit (); m_bDamaged = false; m_bAngry = false; m_bAggressive = false; m_bSleep = false; m_bRunTurnLeft = false; m_bRunTurnRight = false; state_invisible = false; m_force_real_speed = false; m_script_processing_active = false; if (m_controlled) m_controlled->on_reinit(); ignore_collision_hit = false; control().reinit (); m_anomaly_detector->reinit (); m_skip_transfer_enemy = false; MeleeChecker.init_attack (); time_berserk_start = 0; m_prev_sound_type = MonsterSound::eMonsterSoundIdle; #ifdef DEBUG m_show_debug_info = 0; #endif m_offset_from_leader_chosen_tick = 0; m_offset_from_leader = Fvector().set(0.f, 0.f, 0.f); m_action_target_node = u32(-1); m_first_tick_enemy_inaccessible = 0; m_last_tick_enemy_inaccessible = 0; m_first_tick_object_not_at_home = 0; anim().clear_override_animation (); }
//-------------------------------------------------------------------------------------------------------------------------------------- bool StateLogo::OnEngineInDone(UIGroup& sender) { UIAnimation anim(1000); anim.ColorAnimation( Color(1,1,1,1), Color(1,1,1,0) ); anim.SetDelay( 3000 ); m_pEngineLogo->SetUIAnimation(anim, MEMBER_FUNC_PTR( &StateLogo::OnEnginOutDone ) ); return true; }
void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool animated, bool allowLight) { insertBegin(ptr); std::auto_ptr<ObjectAnimation> anim (new ObjectAnimation(ptr, mesh, mResourceSystem, animated, allowLight)); mObjects.insert(std::make_pair(ptr, anim.release())); }
bool CBaseMonster::critical_wound_external_conditions_suitable () { if (!control().check_start_conditions(ControlCom::eControlSequencer)) return false; if (!anim().IsStandCurAnim()) return false; return true; }
void Objects::insertNPC(const MWWorld::Ptr &ptr) { insertBegin(ptr); ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor); std::auto_ptr<NpcAnimation> anim (new NpcAnimation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), mResourceSystem)); mObjects.insert(std::make_pair(ptr, anim.release())); }
// // Load a animation std::shared_ptr<Animation> AnimationManager::create_animation(std::string link) { std::shared_ptr<Animation> anim(std::make_shared<Animation>()); if(anim->load_from_file(link)) { m_animations.insert(std::make_pair(link, anim)); return anim; } return NULL; }
void Model::AddAnimationResource(Animation* animation) { if (!animation) return; SharedPtr<Animation> anim(animation); if (!animationsResources_.Contains(anim)) animationsResources_.Push(anim); }
void MenuState::draw(double dt){ auto renderer = m_game->renderer(); SDL_SetRenderTarget(renderer, m_drawtex); SDL_SetRenderDrawColor(renderer, 0, 100, 200, 0); SDL_RenderClear(renderer); //return; entityx::ComponentHandle<Position> position; // entityx::ComponentHandle<Drawable> drawable; for(entityx::Entity entity: m_entities.entities_with_components(position)){ (void) entity; glm::vec2 pos = position->position(); auto drawable = entity.component<Drawable>(); auto textitem = entity.component<TextItem>(); if(drawable){ SDL_Rect dest; dest.x = pos.x; dest.y = pos.y; dest.w = drawable->width(); dest.h = drawable->height(); SDL_Rect* src; AnimTemplate anim = drawable->anim(); if (anim.frame_width() == 0 || anim.frame_height() == 0) { src = nullptr; } else { SDL_Rect s; s.x = anim.frame_width() * drawable->animation_index(); s.y = anim.frame_height() * anim.y_index(); s.w = anim.frame_width(); s.h = anim.frame_height(); drawable->tick(dt); src = &s; } SDL_Texture* tex = m_game->res_manager().texture(drawable->texture_key()); (void)tex;(void)dest;(void)src; SDL_RenderCopyEx(m_game->renderer(), tex, src, &dest, 0, nullptr, SDL_FLIP_NONE); } if(textitem){ draw_text(m_game->renderer(), m_game->res_manager(), textitem->text(), textitem->font_key(), pos.x, pos.y, textitem->color()); } } SDL_SetRenderTarget(renderer, nullptr); SDL_RenderCopy(renderer, m_drawtex, &m_camera, nullptr); SDL_RenderPresent(renderer); }
EmptyAnimationPtr Object::loadAnimation(const Image& abase_image, Uint16 aframes, BasePointType abp_type, Uint16 aanimation_type, double afps, Uint16 astart_pos, AllignType aallign_type) { EmptyAnimationPtr anim(new Animation(abase_image,aframes,abp_type,aanimation_type,afps,astart_pos,aallign_type)); anim->setBasePos(&pos); return anim; }
void NodeAnimPrivate::insertItem(int index, const KnobTableItemPtr& item, TableChangeReasonEnum reason) { // The item already exists if (_publicInterface->findTableItem(item)) { return; } KnobTableItemPtr parentItem = item->getParent(); TableItemAnimPtr parentAnim; if (parentItem) { // If the parent item is not yet in the model, do not create item, the parent will create its children recursively if (parentItem->getIndexInParent() == -1) { return; } parentAnim = _publicInterface->findTableItem(parentItem); } KnobItemsTableGuiPtr table = _publicInterface->getNodeGui()->getKnobItemsTable(item->getModel()->getTableIdentifier()); assert(table); if (parentItem) { TableItemAnimPtr anim(TableItemAnim::create(_publicInterface->getModel(), table, _publicInterface->shared_from_this(), item, parentAnim->getRootItem())); parentAnim->insertChild(index, anim); } else { TableItemAnimPtr anim(TableItemAnim::create(_publicInterface->getModel(), table, _publicInterface->shared_from_this(), item, nameItem)); if (index < 0 || index >= (int)topLevelTableItems.size()) { topLevelTableItems.push_back(anim); } else { std::vector<TableItemAnimPtr>::iterator it = topLevelTableItems.begin(); std::advance(it, index); topLevelTableItems.insert(it, anim); } } // Create children recursively std::vector<KnobTableItemPtr> children = item->getChildren(); for (std::size_t i = 0; i < children.size(); ++i) { insertItem(i, children[i], reason); } }
void AnimationModule::addNode(const NodeGuiPtr& nodeGui) { // Check if it already exists for (std::list<NodeAnimPtr>::const_iterator it = _imp->nodes.begin(); it != _imp->nodes.end(); ++it) { if ((*it)->getNodeGui() == nodeGui) { (*it)->refreshVisibility(); return; } } // Determinate the node type // It will be useful to identify and sort tree items AnimatedItemTypeEnum nodeType = eAnimatedItemTypeCommon; NodePtr node = nodeGui->getNode(); assert(node && node->getGroup()); if ( !node || !node->getGroup() ) { return; } EffectInstancePtr effectInstance = node->getEffectInstance(); // Don't add an item for this node if it doesn't have any knob that may animate //if ( !getNodeCanAnimate(node) ) { // return; //} std::string pluginID = node->getPluginID(); NodeGroupPtr isGroup = toNodeGroup(effectInstance); if (effectInstance->isReader()) { nodeType = eAnimatedItemTypeReader; } else if (isGroup) { nodeType = eAnimatedItemTypeGroup; } else if (pluginID == PLUGINID_OFX_RETIME) { nodeType = eAnimatedItemTypeRetime; } else if (pluginID == PLUGINID_OFX_TIMEOFFSET) { nodeType = eAnimatedItemTypeTimeOffset; } else if (pluginID == PLUGINID_OFX_FRAMERANGE) { nodeType = eAnimatedItemTypeFrameRange; } // The NodeAnim should not be created if there's no settings panel. assert(nodeGui->getSettingPanel()); NodeAnimPtr anim(NodeAnim::create(toAnimationModule(shared_from_this()), nodeType, nodeGui) ); _imp->nodes.push_back(anim); Q_EMIT nodeAdded(anim); } // AnimationModule::addNode
void plMtlEventProc::ILoadUser(HWND hWnd, IParamBlock2* pb) { HWND hList = GetDlgItem(hWnd, IDC_EVENT_LIST); ListBox_ResetContent(hList); // // If we don't have a valid material, we should be disabled // Mtl* mtl = pb->GetMtl(kMtlMtl); if (!mtl) { EnableWindow(hList, FALSE); return; } else EnableWindow(hList, TRUE); // // Load the events // int idx; idx = ListBox_AddStringData(hList, "(Begin)", kAnimEventBegin); if (pb->GetInt(kMtlBegin)) ListBox_SetSel(hList, TRUE, idx); idx = ListBox_AddStringData(hList, "(End)", kAnimEventEnd); if (pb->GetInt(kMtlEnd)) ListBox_SetSel(hList, TRUE, idx); if (mtl) { ST::string mtlAnim = ST::string::from_utf8(pb->GetStr(kMtlAnim)); // Get the shared animations for all the nodes this component is applied to plNotetrackAnim anim(mtl, nil); plAnimInfo info = anim.GetAnimInfo(mtlAnim); RemoveDeadMarkers(pb, kMtlMarkers, info); // Get all the markers in this animation ST::string marker; while (!(marker = info.GetNextMarkerName()).is_empty()) { idx = ListBox_AddStringData(hList, marker.c_str(), kAnimEventMarker); if (IsMarkerSelected(pb, kMtlMarkers, marker)) ListBox_SetSel(hList, TRUE, idx); } } }
void plAnimEventProc::ILoadUser(HWND hWnd, IParamBlock2* pb) { HWND hList = GetDlgItem(hWnd, IDC_EVENT_LIST); ListBox_ResetContent(hList); plAnimComponentBase* comp; plMaxNode* node; // // If we don't have a valid comp and node, we should be disabled // if (!GetCompAndNode(pb, (plComponentBase*&)comp, node)) { EnableWindow(hList, FALSE); return; } else EnableWindow(hList, TRUE); // // Load the events // int idx; idx = ListBox_AddStringData(hList, "(Begin)", kAnimEventBegin); if (pb->GetInt(kAnimBegin)) ListBox_SetSel(hList, TRUE, idx); idx = ListBox_AddStringData(hList, "(End)", kAnimEventEnd); if (pb->GetInt(kAnimEnd)) ListBox_SetSel(hList, TRUE, idx); if (comp) { // Get the shared animations for all the nodes this component is applied to plNotetrackAnim anim(comp, nil); plAnimInfo info = anim.GetAnimInfo(comp->GetAnimName()); RemoveDeadMarkers(pb, kAnimMarkers, info); // Get all the markers in this animation ST::string marker; while (!(marker = info.GetNextMarkerName()).is_empty()) { idx = ListBox_AddStringData(hList, marker.c_str(), kAnimEventMarker); if (IsMarkerSelected(pb, kAnimMarkers, marker)) ListBox_SetSel(hList, TRUE, idx); } } }
void PickupObject::create_animation() { std::unique_ptr<ga::Animation<DotAnimation>> anim(new ga::Animation<DotAnimation>(Entity::sprite, sf::seconds(0.2f), DotAnimation::unique)); if (type == Pickup::BigDot) { anim->addFrame(DotAnimation::unique, sf::IntRect(0, 0, 12, 12)); anim->addFrame(DotAnimation::unique, sf::IntRect(12, 0, 12, 12)); anim->addFrame(DotAnimation::unique, sf::IntRect(24, 0, 12, 12)); anim->play(); } animation = std::move(anim); }
void NodeAnim::onTableItemInserted(int index, const KnobTableItemPtr& item, TableChangeReasonEnum) { KnobTableItemPtr parentItem = item->getParent(); TableItemAnimPtr parentAnim; if (parentItem) { parentAnim = findTableItem(parentItem); } KnobItemsTableGuiPtr table = getNodeGui()->getKnobItemsTable(); if (parentItem) { TableItemAnimPtr anim(TableItemAnim::create(getModel(), table, shared_from_this(), item, parentAnim->getRootItem())); parentAnim->insertChild(index, anim); } else { TableItemAnimPtr anim(TableItemAnim::create(getModel(), table, shared_from_this(), item, _imp->nameItem)); if (index < 0 || index >= (int)_imp->topLevelTableItems.size()) { _imp->topLevelTableItems.push_back(anim); } else { std::vector<TableItemAnimPtr>::iterator it = _imp->topLevelTableItems.begin(); std::advance(it, index); _imp->topLevelTableItems.insert(it, anim); } } }
void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool animated, bool allowLight) { insertBegin(ptr); std::auto_ptr<ObjectAnimation> anim (new ObjectAnimation(ptr, mesh, mResourceSystem, animated, allowLight)); if (!allowLight) { RemoveParticlesVisitor visitor; anim->getObjectRoot()->accept(visitor); visitor.remove(); } mObjects.insert(std::make_pair(ptr, anim.release())); }