Esempio n. 1
0
 void DiEditorManager::SetK2ResourcePack(const DiString& resPack, const DiString& texturePack)
 {
     if (texturePack.empty())
         DiK2Configs::SetK2ResourcePack(resPack);
     else
         DiK2Configs::SetK2ResourcePack(resPack, texturePack);
 }
Esempio n. 2
0
 void HonFxerApp::SetResourceLocation(const DiString& resPack, const DiString& texPack)
 {
     if (!texPack.empty())
         DiEditorManager::Get()->SetK2ResourcePack(resPack, texPack);
     else
         DiEditorManager::Get()->SetK2ResourcePack(resPack);
 }
Esempio n. 3
0
 void DiEditorManager::SetCurrentFileName(const DiString& name)
 {
     mFxFileName = name;
     
     DiString title = "Hon Fxer";
     if(!name.empty())
         title.Format("Hon Fxer - %s",name.ExtractFileName().c_str());
     
     DiBase::Driver->GetMainRenderWindow()->GetWindow()->SetTitle(title.c_str());
 }
Esempio n. 4
0
void DiAnimationPose::RemoveAdditPoseBlender( const DiString& strAdditAni )
{
    if(strAdditAni.empty())
    {
        return ;
    }

    AniBlenderMap::iterator itAdditBlender = mMapAdditBlenders.find(strAdditAni);
    if(itAdditBlender == mMapAdditBlenders.end())
    {
        DI_WARNING("Cannot find and delete the animation %s", strAdditAni.c_str());
        return;
    }

    DiClipController * pkClip = mClipSet->GetClipController(strAdditAni);
    pkClip->SetTimeRatio(1.0f);
    mMapAdditBlenders.erase(itAdditBlender);
    pkClip->SetWeight(1.0f);

}
Esempio n. 5
0
    void DiCommandManager::InitConsoleLogger(bool createWnd, const DiString& consoleFile)
    {
        if (!sConsoleLogger)
        {
            if (consoleFile.empty())
                sConsoleLogger = DI_NEW DiConsoleLogger(createWnd);
            else
                sConsoleLogger = DI_NEW DiConsoleLogger(createWnd, consoleFile);

            sConsoleLogger->OutputLog("Init console window", "", "", 0);
            DiLogManager::GetInstance().RegisterLogger(sConsoleLogger);

            DI_INFO("New external console window created");
        }
        else
        {
            if (createWnd)
            {
                sConsoleLogger->CreateConsoleWindow();
            }
        }
    }
Esempio n. 6
0
    bool DiMotion::RenameAnimation( const DiString& name,const DiString& strNewName )
    {
        if(strNewName.empty())
        {
            DI_WARNING("Empty name will not be accepted");
            return false;
        }

        AnimationList::iterator it = mAnimationList.find(name);
        if(it != mAnimationList.end())
        {
            DiAnimation * pkAnim = (*it).second;
            mAnimationList.erase(name);

            pkAnim->SetName(strNewName);
            mAnimationList[strNewName] = pkAnim;

            return true;
        }

        DI_WARNING("Cannot locate the animation: %s",name.c_str());
        return false;
    }
Esempio n. 7
0
    DiTexturePtr DiK2Configs::GetTexture(const DiString& relPath)
    {
        DiString baseName = relPath.ExtractFileName();
        if (baseName.empty() || baseName[0] == '$')
            return DiK2Configs::GetSpecialTexture(baseName);

        DiTexturePtr ret = DiAssetManager::GetInstance().FindAsset<DiTexture>(relPath);
        if (ret)
            return ret;
        
        bool needprefix = !TEXTURE_PACK_PREFIX_FOLDER.empty();
        if(DiString::StartsWith(relPath, TEXTURE_PACK_PREFIX_FOLDER))
        {
            needprefix = false;
        }

        DiString full = GetK2MediaPath(relPath, true);
        if(full.empty())
        {
            DI_WARNING("Empty texture file!, using default texture instead");
            return DiTexture::GetDefaultTexture();
        }
        
#if 0
        if (TEXTURE_PACK && full[0] != '\\' && full[0] != '/')
        {
            full = "/"+full;
        }
#endif

        DiString tgaExt = ".tga";
#if DEMI_PLATFORM == DEMI_PLATFORM_IOS
        DiString compExt = ".pvr";
#else
        DiString compExt = ".dds";
#endif

        DiString tgaFile = full + tgaExt;
        DiString ddsFile = full + compExt;
        bool useTga = false;

        if (TEXTURE_PACK)
        {
            DiDataStreamPtr data;
            
            /// TODO read the descriptor file
            if(needprefix)
            {
                tgaFile = DiK2Configs::TEXTURE_PACK_PREFIX_FOLDER + tgaFile;
                ddsFile = DiK2Configs::TEXTURE_PACK_PREFIX_FOLDER + ddsFile;
            }

            if (TEXTURE_PACK->HasFile(ddsFile))
                data = TEXTURE_PACK->Open(ddsFile);
            else
            {
                data = TEXTURE_PACK->Open(tgaFile);
                useTga = true;
            }

            if (!data)
            {
                DI_WARNING("Cannot open the texture file: %s, using default texture", ddsFile.c_str());
                return DiTexture::GetDefaultTexture();
            }

#ifdef _K2_RECORD_USED_RESOURCE
            sUsedResources.insert(relPath + (useTga ? tgaExt : compExt));
#endif
            ret = DiAssetManager::GetInstance().CreateOrReplaceAsset<DiTexture>(relPath);
            ret->Load(data);
            return ret;
        }
        else
        {
            FILE* fp = nullptr;

            // try dds
            fp = fopen(ddsFile.c_str(), "rb");

            // try tga
            if (!fp)
            {
                fp = fopen(tgaFile.c_str(), "rb");
                useTga = true;
            }

            if (!fp)
            {
                DI_WARNING("Cannot open the texture file: %s, using default texture", ddsFile.c_str());
                return DiTexture::GetDefaultTexture();
            }

#ifdef _K2_RECORD_USED_RESOURCE
            sUsedResources.insert(relPath + (useTga ? tgaExt : compExt));
#endif
            DiDataStreamPtr texData(DI_NEW DiFileHandleDataStream(relPath, fp));

            ret = DiAssetManager::GetInstance().CreateOrReplaceAsset<DiTexture>(relPath);
            ret->Load(texData);
            return ret;
        }
    }