FbxDouble3 GetMaterialProperty(const FbxSurfaceMaterial * pMaterial, const char * pPropertyName, const char * pFactorPropertyName, std::string & pTextureName) { FbxDouble3 lResult(0, 0, 0); const FbxProperty lProperty = pMaterial->FindProperty(pPropertyName); const FbxProperty lFactorProperty = pMaterial->FindProperty(pFactorPropertyName); if (lProperty.IsValid() && lFactorProperty.IsValid()) { lResult = lProperty.Get<FbxDouble3>(); double lFactor = lFactorProperty.Get<FbxDouble>(); if (lFactor != 1) { lResult[0] *= lFactor; lResult[1] *= lFactor; lResult[2] *= lFactor; } } if (lProperty.IsValid()) { const int lTextureCount = lProperty.GetSrcObjectCount<FbxFileTexture>(); if (lTextureCount) { const FbxFileTexture* lTexture = lProperty.GetSrcObject<FbxFileTexture>(); if (lTexture) { pTextureName = lTexture->GetFileName(); } } } return lResult; }
LRESULT CEmbedComboBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { LRESULT lResult(0); lResult = CComboBox::WindowProc(message, wParam, lParam); switch (message) { case WM_DESTROY: if (mEmbedEditControl != NULL) { delete mEmbedEditControl; mEmbedEditControl = NULL; } break; case WM_SHOWWINDOW: if (!mEmbedEditControl) { CWnd *pChild(GetWindow(GW_CHILD)); if (pChild) { mEmbedEditControl = new CEmbedEditControl(); mEmbedEditControl->SubclassWindow(pChild->m_hWnd); } } if (wParam) ShowDropDown(); break; case WM_KILLFOCUS: { CWnd *pChild(GetWindow(GW_CHILD)); if (!pChild || pChild->m_hWnd != (HWND)wParam) GetParent()->SendMessage(WM_ENABLE_EMBED_CONTROL, 0, 0); } break; case WM_ENABLE_EMBED_CONTROL: GetParent()->SendMessage(WM_ENABLE_EMBED_CONTROL, wParam, lParam); break; case WM_KEYDOWN: { int commit(0); switch (wParam) { case VK_ESCAPE: case VK_CLEAR: commit = ECF_DONOT_COMMIT; // No commit case VK_ACCEPT: case VK_RETURN: GetParent()->SendMessage(WM_ENABLE_EMBED_CONTROL, commit, 0); } } break; } return lResult; }
/* <FIELD NAME='STATUS' VALUE=''> </FIELD>STATUS/LOCK/CLOSE */ int __fastcall ASEditSvr::exeRestfulCommand(WideString asOperation,WideString asParams,WideString &asResult) { PCPtr<PCXML> lParam(new PCXML(asParams)); PCPtr<PCXML> lResult(new PCXML("<DATASETS/>")); String lsID,lsAction,lsField,lsValue; _di_IXMLNode lParentNode; //<ACTION>DEFAULT</ACTION> lParentNode = lParam->SubNode["ACTION"]; if(lParentNode) lsAction = BLNODETEXT(lParentNode).Trim(); if(lsAction.IsEmpty()) lsAction = "DEFAULT"; Action = lsAction; lParentNode = lParam->SubNode["PARAM"]; if(lParentNode) lsID = BLNODETEXT(lParentNode).Trim(); if((!BLSAMESTR(asOperation,"add")) && lsID.IsEmpty()) throw Exception("必须提供ID参数"); if(BLSAMESTR(asOperation,"add")){ Retrieve("-1"); lParentNode = lParam->SubNode["DATASETS"]; fromXML(lParentNode,true); Save(); lParentNode = lResult->SubNode[""]; BLNODEATTSET(lParentNode,"ERI",ERI); toXML(lParentNode); } else if(BLSAMESTR(asOperation,"get")){ Retrieve(lsID); lParentNode = lResult->SubNode[""]; BLNODEATTSET(lParentNode,"ERI",ERI); toXML(lParentNode); } else if(BLSAMESTR(asOperation,"set")){ Retrieve(lsID); lParentNode = lParam->SubNode["DATASETS"]; fromXML(lParentNode,false,true); Save(); lParentNode = lResult->SubNode[""]; BLNODEATTSET(lParentNode,"ERI",ERI); toXML(lParentNode); } else throw Exception("错误操作命令" + asOperation); asResult = lResult->XML->Text; return 1; }
// マテリアルプロパティ獲得 FbxDouble3 GetMaterialProperty( const FbxSurfaceMaterial * pMaterial, const char * pPropertyName, const char * pFactorPropertyName) { FbxDouble3 lResult(0, 0, 0); const FbxProperty lProperty = pMaterial->FindProperty(pPropertyName); const FbxProperty lFactorProperty = pMaterial->FindProperty(pFactorPropertyName); if(lProperty.IsValid() && lFactorProperty.IsValid()) { lResult = lProperty.Get<FbxDouble3>(); double lFactor = lFactorProperty.Get<FbxDouble>(); if(lFactor != 1) { lResult[0] *= lFactor; lResult[1] *= lFactor; lResult[2] *= lFactor; } } if(lProperty.IsValid()) { printf("テクスチャ\n"); const int lTextureCount = lProperty.GetSrcObjectCount<FbxFileTexture>(); for(int i = 0; i<lTextureCount; i++) { FbxFileTexture* lFileTexture = lProperty.GetSrcObject<FbxFileTexture>(i); if(lFileTexture) { FbxString uvsetName = lFileTexture->UVSet.Get(); std::string uvSetString = uvsetName.Buffer(); std::string filepath = lFileTexture->GetFileName(); printf("UVSet名=%s\n", uvSetString.c_str()); printf("テクスチャ名=%s\n", filepath.c_str()); } } puts(""); printf("レイヤードテクスチャ\n"); const int lLayeredTextureCount = lProperty.GetSrcObjectCount<FbxLayeredTexture>(); for(int i = 0; i<lLayeredTextureCount; i++) { FbxLayeredTexture* lLayeredTexture = lProperty.GetSrcObject<FbxLayeredTexture>(i); const int lTextureFileCount = lLayeredTexture->GetSrcObjectCount<FbxFileTexture>(); for(int j = 0; j<lTextureFileCount; j++) { FbxFileTexture* lFileTexture = lLayeredTexture->GetSrcObject<FbxFileTexture>(j); if(lFileTexture) { FbxString uvsetName = lFileTexture->UVSet.Get(); std::string uvSetString = uvsetName.Buffer(); std::string filepath = lFileTexture->GetFileName(); printf("UVSet名=%s\n", uvSetString.c_str()); printf("テクスチャ名=%s\n", filepath.c_str()); } } } puts(""); } return lResult; }
FbxDouble3 CFBXLoader::GetMaterialProperty( const FbxSurfaceMaterial * pMaterial, const char * pPropertyName, const char * pFactorPropertyName, FBX_MATRIAL_ELEMENT* pElement) { pElement->type = FBX_MATRIAL_ELEMENT::ELEMENT_NONE; FbxDouble3 lResult(0, 0, 0); const FbxProperty lProperty = pMaterial->FindProperty(pPropertyName); const FbxProperty lFactorProperty = pMaterial->FindProperty(pFactorPropertyName); if (lProperty.IsValid() && lFactorProperty.IsValid()) { lResult = lProperty.Get<FbxDouble3>(); double lFactor = lFactorProperty.Get<FbxDouble>(); if (lFactor != 1) { lResult[0] *= lFactor; lResult[1] *= lFactor; lResult[2] *= lFactor; } pElement->type = FBX_MATRIAL_ELEMENT::ELEMENT_COLOR; } if (lProperty.IsValid()) { int existTextureCount = 0; const int lTextureCount = lProperty.GetSrcObjectCount<FbxFileTexture>(); for(int i=0;i<lTextureCount;i++) { FbxFileTexture* lFileTexture = lProperty.GetSrcObject<FbxFileTexture>(i); if(!lFileTexture) continue; FbxString uvsetName = lFileTexture->UVSet.Get(); std::string uvSetString = uvsetName.Buffer(); std::string filepath = lFileTexture->GetFileName(); pElement->textureSetArray[uvSetString].push_back(filepath); existTextureCount++; } const int lLayeredTextureCount = lProperty.GetSrcObjectCount<FbxLayeredTexture>(); for(int i=0;i<lLayeredTextureCount;i++) { FbxLayeredTexture* lLayeredTexture = lProperty.GetSrcObject<FbxLayeredTexture>(i); const int lTextureFileCount = lLayeredTexture->GetSrcObjectCount<FbxFileTexture>(); for(int j=0;j<lTextureFileCount;j++) { FbxFileTexture* lFileTexture = lLayeredTexture->GetSrcObject<FbxFileTexture>(j); if(!lFileTexture) continue; FbxString uvsetName = lFileTexture->UVSet.Get(); std::string uvSetString = uvsetName.Buffer(); std::string filepath = lFileTexture->GetFileName(); pElement->textureSetArray[uvSetString].push_back(filepath); existTextureCount++; } } if(existTextureCount > 0) { if(pElement->type == FBX_MATRIAL_ELEMENT::ELEMENT_COLOR) pElement->type = FBX_MATRIAL_ELEMENT::ELEMENT_BOTH; else pElement->type = FBX_MATRIAL_ELEMENT::ELEMENT_TEXTURE; } } return lResult; }