void IFXCharacter::GenerateBoneLinks(I32 defaultnumber) { ForEachNode(IFXCHILDFIRST,&IFXCharacter::CreateLinksOnNode,&defaultnumber); GetSkin()->RelinkWeights(); GetSkin()->FilterWeights(); RecalcLinks(); ForEachNodeTransformed(IFXPARENTFIRST|IFXSTORE_XFORM,NULL); ForEachNode(IFXCHILDFIRST,&IFXCharacter::CalcLinkReferencesOnNode); GetSkin()->ComputeVertexOffsets(); }
void ComboBox::UpdateColors() { if (!GetShouldDrawBackground()) { return SetTextColor(GetSkin()->Colors.Button.Normal); } Button::UpdateColors(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFViewModel::UpdateViewmodelAddon( const char *pszModelname ) { C_ViewmodelAttachmentModel *pAddon = m_hViewmodelAddon.Get(); if ( pAddon ) { if ( pAddon->GetModelIndex() == modelinfo->GetModelIndex( pszModelname ) ) { pAddon->m_nSkin = GetSkin(); if ( C_BasePlayer::GetLocalPlayer() != GetOwner() ) // Spectator fix { pAddon->FollowEntity( this ); pAddon->m_nRenderFX = m_nRenderFX; pAddon->UpdateVisibility(); pAddon->SetViewmodel( this ); } return; // we already have the correct add-on } else { RemoveViewmodelAddon(); } } pAddon = new class C_ViewmodelAttachmentModel; if ( !pAddon ) return; if ( pAddon->InitializeAsClientEntity( pszModelname, RENDER_GROUP_VIEW_MODEL_TRANSLUCENT ) == false ) { pAddon->Release(); return; } m_hViewmodelAddon = pAddon; pAddon->m_nSkin = GetSkin(); pAddon->FollowEntity( this ); pAddon->UpdatePartitionListEntry(); pAddon->CollisionProp()->MarkPartitionHandleDirty(); pAddon->UpdateVisibility(); pAddon->SetViewmodel( this ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFViewModel::UpdateViewmodelAddon( const char *pszModelname ) { C_ViewmodelAttachmentModel *pEnt = m_viewmodelAddon.Get(); if ( pEnt && pEnt->GetModelIndex() == modelinfo->GetModelIndex(pszModelname) ) { pEnt->m_nSkin = GetSkin(); if ( C_BasePlayer::GetLocalPlayer() != GetOwner() ) // Spectator fix { pEnt->SetParent(this); pEnt->AddEffects(EF_BONEMERGE); pEnt->UpdateVisibility(); pEnt->SetViewmodel(this); } return; // we already have the correct add-on } else if ( pEnt ) { RemoveViewmodelAddon(); } pEnt = new class C_ViewmodelAttachmentModel; if (!pEnt) return; if (pEnt->InitializeAsClientEntity(pszModelname, RENDER_GROUP_VIEW_MODEL_TRANSLUCENT) == false) return; m_viewmodelAddon = pEnt; V_strncpy(m_viewmodelAddonName, pszModelname, sizeof(m_viewmodelAddonName)); pEnt->m_nSkin = GetSkin(); pEnt->SetParent(this); pEnt->AddEffects(EF_BONEMERGE); pEnt->SetLocalOrigin(vec3_origin); pEnt->UpdatePartitionListEntry(); pEnt->CollisionProp()->MarkPartitionHandleDirty(); pEnt->UpdateVisibility(); pEnt->SetViewmodel(this); }
void CSkinView_ImgLst::OnPaint( CDCHandle dc ) { CRect rcWnd; GetClient(&rcWnd); CRect rcState=rcWnd; int nStates=GetSkin()->GetStates(); rcState.right=rcState.left+rcState.Width()/nStates; for(int i=0;i<nStates;i++) { GetSkin()->Draw(dc,rcState,i); rcState.OffsetRect(rcState.Width(),0); } //draw seperate line rcState=rcWnd; rcState.right=rcState.left+rcState.Width()/nStates; for(int i=0;i<nStates-1;i++) { CGdiAlpha::DrawLine(dc,rcState.right,rcState.top,rcState.right,rcState.bottom,m_crSep,PS_DASHDOTDOT); rcState.OffsetRect(rcState.Width(),0); } }
F32 IFXCharacter::CalcReachingLimit(void) { F32 max=0.0f; ResetToFullReach(); ForEachNodeTransformed(IFXPARENTFIRST|IFXSTORE_XFORM,NULL); // NOTE using potentially lowered res since higher data may not be loaded GetSkin()->DeformMesh(false,false); IFXMeshInterface *outmesh=GetSkin()->GetInputMesh(); IFXASSERT(outmesh); IFXVertexIndexer *indexer=outmesh->GetVertexIndexer(); IFXASSERT(indexer); I32 meshid,meshes=outmesh->GetNumberMeshes(); for(meshid=0;meshid<meshes;meshid++) { outmesh->ChooseMeshIndex(meshid); I32 index,vertices=outmesh->GetNumberVertices(); for(index=0;index<vertices;index++) { indexer->MoveToIndex(index); IFXVector3 *vertex=indexer->GetPosition(); F32 magnitude=vertex->CalcMagnitude(); if(max<magnitude) max=magnitude; } } ResetToReference(); ForEachNodeTransformed(IFXPARENTFIRST|IFXSTORE_XFORM,NULL); GetSkin()->DeformMesh(false,false); IFXTRACE_GENERIC(L"Reaching Limit is %.6G\n",max); return max; }
void cUITab::OnStateChange() { cUISelectButton::OnStateChange(); cUITabWidget * tTabW = GetTabWidget(); if ( NULL != tTabW ) { Size( mSize.Width(), GetSkinSize( GetSkin(), mSkinState->GetState() ).Height() ); if ( mSkinState->GetState() == cUISkinState::StateSelected ) { mTextBox->Color( tTabW->mFontSelectedColor ); } else if ( mSkinState->GetState() == cUISkinState::StateMouseEnter ) { mTextBox->Color( tTabW->mFontOverColor ); } else { mTextBox->Color( tTabW->mFontColor ); } } }
void CSkinView_ImgFrame::OnPaint( CDCHandle dc ) { __super::OnPaint(dc); CRect rcMargin=m_skin->GetMargin(); CRect rcWnd; GetClient(&rcWnd); CRect rcState=rcWnd; int nStates=GetSkin()->GetStates(); rcState.right=rcState.left+rcState.Width()/nStates; for(int i=0;i<nStates;i++) { if(rcMargin.left!=0) { CGdiAlpha::DrawLine(dc, rcState.left+rcMargin.left,rcState.top, rcState.left+rcMargin.left,rcState.bottom, m_crFrame,PS_DASHDOT); } if(rcMargin.right!=0) { CGdiAlpha::DrawLine(dc, rcState.right-rcMargin.right,rcState.top, rcState.right-rcMargin.right,rcState.bottom, m_crFrame,PS_DASHDOT); } if(rcMargin.top!=0) { CGdiAlpha::DrawLine(dc, rcState.left,rcState.top+rcMargin.top, rcState.right,rcState.top+rcMargin.top, m_crFrame,PS_DASHDOT); } if(rcMargin.bottom!=0) { CGdiAlpha::DrawLine(dc, rcState.left,rcState.bottom-rcMargin.bottom, rcState.right,rcState.bottom-rcMargin.bottom, m_crFrame,PS_DASHDOT); } rcState.OffsetRect(rcState.Width(),0); } }
void CBaseDoor::Spawn() { Precache(); SetMovedir( this ); if( GetSkin() == 0 ) {//normal door if( GetSpawnFlags().Any( SF_DOOR_PASSABLE ) ) SetSolidType( SOLID_NOT ); else SetSolidType( SOLID_BSP ); } else {// special contents SetSolidType( SOLID_NOT ); GetSpawnFlags().AddFlags( SF_DOOR_SILENT ); // water is silent for now } SetMoveType( MOVETYPE_PUSH ); SetAbsOrigin( GetAbsOrigin() ); SetModel( GetModelName() ); if( GetSpeed() == 0 ) SetSpeed( 100 ); m_vecPosition1 = GetAbsOrigin(); // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big m_vecPosition2 = m_vecPosition1 + ( GetMoveDir() * ( fabs( GetMoveDir().x * ( GetBounds().x - 2 ) ) + fabs( GetMoveDir().y * ( GetBounds().y - 2 ) ) + fabs( GetMoveDir().z * ( GetBounds().z - 2 ) ) - m_flLip ) ); ASSERTSZ( m_vecPosition1 != m_vecPosition2, "door start/end positions are equal" ); if( GetSpawnFlags().Any( SF_DOOR_START_OPEN ) ) { // swap pos1 and pos2, put door at pos2 SetAbsOrigin( m_vecPosition2 ); m_vecPosition2 = m_vecPosition1; m_vecPosition1 = GetAbsOrigin(); } m_toggle_state = TS_AT_BOTTOM; // if the door is flagged for USE button activation only, use NULL touch function if( GetSpawnFlags().Any( SF_DOOR_USE_ONLY ) ) { SetTouch( NULL ); } else // touchable button SetTouch( &CBaseDoor::DoorTouch ); }
vd::status Context::Reset(Skin::Base* skin) { Input::Base* old_input = m_Input; Canvas::Base* old_canvas = m_Canvas; ChangeSkin(skin ? skin : VD_NEW(Skin::Default, m_Renderer)); m_Canvas = VD_NEW(Canvas::Base, GetSkin() ); m_Canvas->Initialize(); // m_Canvas->SetDrawBackground( true ); // m_Canvas->SetBackgroundColor( Gwen::Color( 150, 170, 170, 255 ) ); m_Input = VD_NEW(Input::Base); m_Input->Initialize( m_Canvas ); VD_SAFE_DELETE(old_canvas); VD_SAFE_DELETE(old_input); return Status::Code::Success; }
GWEN_CONTROL_CONSTRUCTOR(ProgressBar, Label) { _bar_padding = Gwen::Padding(2, 2, 2, 2); _progress = 0; _maximum_progress = 100; _display_label = true; _as_percentage = true; SetAlignment(Position::CENTER); SetBounds(Rectangle(0, 0, 128, 32)); SetHorizontal(); SetMouseInputEnabled(true); SetTextPadding(Padding(3, 0, 3, 0)); Gwen::Skin::Base* skin = GetSkin(); assert(skin != nullptr); if (skin != nullptr) { SetColor(skin->Colors.ProgressBar.Bar); SetTextColor(skin->Colors.ProgressBar.Text); } }
bool Exporter::makeSkin(NiTriBasedGeomRef shape, INode *node, FaceGroup &grp, TimeValue t) { if (!mExportSkin) return false; if (grp.verts.empty()) return false; //get the skin modifier Modifier *mod = GetSkin(node); if (!mod) return false; ISkin *skin = (ISkin *) mod->GetInterface(I_SKIN); if (!skin) return false; ISkinContextData *skinData = skin->GetContextInterface(node); if (!skinData) return false; if (grp.strips.empty()) strippify(grp); // Create new call back to finish export SkinInstance* si = new SkinInstance(this); mPostExportCallbacks.push_back(si); skin->GetSkinInitTM(node, si->bone_init_tm, false); skin->GetSkinInitTM(node, si->node_init_tm, true); si->shape = shape; // Get bone references (may not actually exist in proper structure at this time) int totalBones = skin->GetNumBones(); si->boneWeights.resize(totalBones); si->boneList.resize(totalBones); for (int i=0; i<totalBones; ++i) { si->boneList[i] = getNode(skin->GetBone(i)); } vector<int>& vidx = grp.vidx; int nv = vidx.size(); for (int i=0; i<nv; ++i) { int vi = vidx[i]; int nbones = skinData->GetNumAssignedBones(vi); for (int j=0; j<nbones; ++j) { SkinWeight sw; sw.index = i; sw.weight = skinData->GetBoneWeight(vi,j); int boneIndex = skinData->GetAssignedBone(vi,j); SkinInstance::SkinWeightList& weights = si->boneWeights[boneIndex]; weights.push_back(sw); } } // remove unused bones vector<NiNodeRef>::iterator bitr = si->boneList.begin(); SkinInstance::BoneWeightList::iterator switr = si->boneWeights.begin(); for (int i=0; i<totalBones; ++i) { vector<SkinWeight> &weights = (*switr); if (weights.empty()) { bitr = si->boneList.erase(bitr); switr = si->boneWeights.erase(switr); } else { ++bitr, ++switr; } } // Check for dismemberment if (IsFallout3() || IsSkyrim()) { Modifier *dismemberSkinMod = GetBSDismemberSkin(node); if (dismemberSkinMod) { if (IBSDismemberSkinModifier *disSkin = (IBSDismemberSkinModifier *) dismemberSkinMod->GetInterface(I_BSDISMEMBERSKINMODIFIER)){ Tab<IBSDismemberSkinModifierData*> modData = disSkin->GetModifierData(); if (modData.Count() >= 1) { IBSDismemberSkinModifierData* bsdsmd = modData[0]; si->SkinInstConstructor = BSDismemberSkinInstance::Create; Tab<BSDSPartitionData> &flags = bsdsmd->GetPartitionFlags(); GenericNamedSelSetList &fselSet = bsdsmd->GetFaceSelList(); FaceMap fmap; NiTriBasedGeomDataRef data = DynamicCast<NiTriBasedGeomData>(shape->GetData()); vector<Triangle> tris = data->GetTriangles(); for (int i=0; i<tris.size(); ++i) { Triangle tri = tris[i]; fmap[ rotate(tri) ] = i; } // Build up list of partitions and face to partition map si->partitions.resize(flags.Count()); si->facePartList.resize( grp.faces.size(), -1 ); for (int i=0; i<flags.Count(); ++i) { BodyPartList& bp = si->partitions[i]; bp.bodyPart = (BSDismemberBodyPartType)flags[i].bodyPart; bp.partFlag = (BSPartFlag)(flags[i].partFlag | PF_START_NET_BONESET); BitArray& fSelect = fselSet[i]; for (int j=0; j<fSelect.GetSize(); ++j){ if ( fSelect[j] ) { Triangle tri = grp.faces[grp.fidx[j]]; FaceMap::iterator fitr = fmap.find( rotate(tri) ); if (fitr != fmap.end()) si->facePartList[ (*fitr).second ] = i; } } } } } } } return true; }
void MeasureNowPlaying::ReadOptions(ConfigParser& parser, const WCHAR* section) { Measure::ReadOptions(parser, section); // Data is stored in two structs: Measure and ParentMeasure. ParentMeasure is created for measures // with PlayerName=someplayer. Measure is created for all measures and points to ParentMeasure as // referenced in PlayerName=[section]. // Read settings from the ini-file LPCWSTR str = parser.ReadString(section, L"PlayerName", L"", false).c_str(); if (str[0] == L'[') { if (m_Parent) { // Don't let a measure measure change its parent } else { // PlayerName starts with [ so use referenced section ++str; size_t len = wcslen(str); if (len > 0 && str[len - 1] == L']') { --len; std::vector<ParentMeasure*>::iterator iter = g_ParentMeasures.begin(); for ( ; iter != g_ParentMeasures.end(); ++iter) { if (GetSkin() == (*iter)->owner->GetSkin() && _wcsnicmp(str, (*iter)->owner->GetName(), len) == 0) { // Use same ParentMeasure as referenced section m_Parent = (*iter); ++m_Parent->measureCount; break; } } if (!m_Parent) { // The referenced section doesn't exist LogWarningF(this, L"Invalid PlayerName=%s", str - 1); return; } } } } else { // ParentMeasure is created when PlayerName is an actual player (and not a reference) Player* oldPlayer = nullptr; if (m_Parent) { if (m_Parent->owner != this) { // Don't let a measure-only measure become a parent measure return; } oldPlayer = m_Parent->player; } else { m_Parent = new ParentMeasure; g_ParentMeasures.push_back(m_Parent); m_Parent->owner = this; } if (_wcsicmp(L"AIMP", str) == 0) { m_Parent->player = PlayerAIMP::Create(); } else if (_wcsicmp(L"CAD", str) == 0) { m_Parent->player = PlayerCAD::Create(); } else if (_wcsicmp(L"foobar2000", str) == 0) { HWND fooWindow = FindWindow(L"foo_rainmeter_class", nullptr); if (fooWindow) { const WCHAR* error = L"Your foobar2000 plugin is out of date.\n\nDo you want to update the plugin now?"; if (MessageBox(nullptr, error, L"Rainmeter", MB_YESNO | MB_ICONINFORMATION | MB_TOPMOST) == IDYES) { ShellExecute(nullptr, L"open", L"http://github.com/poiru/foo-cad#readme", nullptr, nullptr, SW_SHOWNORMAL); } } m_Parent->player = PlayerCAD::Create(); } else if (_wcsicmp(L"iTunes", str) == 0) { m_Parent->player = PlayerITunes::Create(); } else if (_wcsicmp(L"MediaMonkey", str) == 0) { m_Parent->player = PlayerWinamp::Create(WA_MEDIAMONKEY); } else if (_wcsicmp(L"Spotify", str) == 0) { m_Parent->player = PlayerSpotify::Create(); } else if (_wcsicmp(L"WinAmp", str) == 0) { m_Parent->player = PlayerWinamp::Create(WA_WINAMP); } else if (_wcsicmp(L"WMP", str) == 0) { m_Parent->player = PlayerWMP::Create(); } else { // Default to WLM m_Parent->player = PlayerWLM::Create(); if (_wcsicmp(L"WLM", str) != 0) { LogErrorF(this, L"Invalid PlayerName=%s", str); } } m_Parent->player->AddInstance(); m_Parent->playerPath = parser.ReadString(section, L"PlayerPath", L""); m_Parent->trackChangeAction = parser.ReadString(section, L"TrackChangeAction", L"", false); m_Parent->disableLeadingZero = parser.ReadBool(section, L"DisableLeadingZero", false); if (oldPlayer) { m_Parent->player->SetMeasures(oldPlayer->GetMeasures()); // Remove instance here so that player doesn't have to reinitialize if PlayerName was // not changed. oldPlayer->RemoveInstance(); } } str = parser.ReadString(section, L"PlayerType", L"").c_str(); if (_wcsicmp(L"ARTIST", str) == 0) { m_Type = MEASURE_ARTIST; } else if (_wcsicmp(L"TITLE", str) == 0) { m_Type = MEASURE_TITLE; } else if (_wcsicmp(L"ALBUM", str) == 0) { m_Type = MEASURE_ALBUM; } else if (_wcsicmp(L"COVER", str) == 0) { m_Type = MEASURE_COVER; } else if (_wcsicmp(L"DURATION", str) == 0) { m_Type = MEASURE_DURATION; } else if (_wcsicmp(L"POSITION", str) == 0) { m_Type = MEASURE_POSITION; } else if (_wcsicmp(L"PROGRESS", str) == 0) { m_Type = MEASURE_PROGRESS; m_MaxValue = 100.0; } else if (_wcsicmp(L"RATING", str) == 0) { m_Type = MEASURE_RATING; m_MaxValue = 5.0; } else if (_wcsicmp(L"STATE", str) == 0) { m_Type = MEASURE_STATE; } else if (_wcsicmp(L"STATUS", str) == 0) { m_Type = MEASURE_STATUS; } else if (_wcsicmp(L"VOLUME", str) == 0) { m_Type = MEASURE_VOLUME; m_MaxValue = 100.0; } else if (_wcsicmp(L"SHUFFLE", str) == 0) { m_Type = MEASURE_SHUFFLE; } else if (_wcsicmp(L"REPEAT", str) == 0) { m_Type = MEASURE_REPEAT; } else if (_wcsicmp(L"LYRICS", str) == 0) { LogWarningF(this, L"Using undocumented PlayerType=LYRICS!"); m_Type = MEASURE_LYRICS; } else if (_wcsicmp(L"FILE", str) == 0) { m_Type = MEASURE_FILE; } else if (_wcsicmp(L"NUMBER", str) == 0) { m_Type = MEASURE_NUMBER; } else if (_wcsicmp(L"YEAR", str) == 0) { m_Type = MEASURE_YEAR; } else if (_wcsicmp(L"GENRE", str) == 0) { m_Type = MEASURE_GENRE; } else { LogErrorF(this, L"Invalid PlayerType=%s", str); } m_Parent->player->AddMeasure(m_Type); }
void MeasureNowPlaying::UpdateValue() { m_Value = 0.0; if (!m_Parent) { return; } Player* player = m_Parent->player; // Only allow parent measure to update if (m_Parent->owner == this) { player->UpdateMeasure(); // Execute TrackChangeAction= if necessary if (!m_Parent->trackChangeAction.empty() && m_Parent->trackCount != player->GetTrackCount()) { GetRainmeter().DelayedExecuteCommand(m_Parent->trackChangeAction.c_str(), GetSkin()); m_Parent->trackCount = player->GetTrackCount(); } } switch (m_Type) { case MEASURE_DURATION: m_Value = player->GetDuration(); break; case MEASURE_POSITION: m_Value = player->GetPosition(); break; case MEASURE_PROGRESS: if (player->GetDuration()) { m_Value = ((double)player->GetPosition() * 100.0) / player->GetDuration(); } break; case MEASURE_RATING: m_Value = player->GetRating(); break; case MEASURE_VOLUME: m_Value = player->GetVolume(); break; case MEASURE_STATE: m_Value = player->GetState(); break; case MEASURE_STATUS: m_Value = player->IsInitialized(); break; case MEASURE_SHUFFLE: m_Value = player->GetShuffle(); break; case MEASURE_REPEAT: m_Value = player->GetRepeat(); break; case MEASURE_NUMBER: m_Value = player->GetNumber(); break; case MEASURE_YEAR: m_Value = player->GetYear(); break; } }
void Form::Render() { XAGUI::SetSkin(GetSkin()); PictureBox::Render(); }