Çözüldü Tweeny animation bugs

  • Konuyu açan Konuyu açan EnZi
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 8
  • Gösterim Gösterim 463
Bu konu çözüme ulaştırılmıştır. Çözüm için konuya yazılan tüm yorumları okumayı unutmayın. Eğer konudaki yorumlar sorununuzu çözmediyse yeni bir konu açabilirsiniz.
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.

EnZi

Üye
Üye
Mesaj
40
Çözümler
5
Beğeni
9
Puan
454
Ticaret Puanı
0
Hi,

I have a bug with Tweeny Animation.. nearly every window animation work smooth but only windows with items like shop, safebox, offlineshop are glitching.. (inventory works)
They should close smoothly like other windows but instead of smooth close it glitch like it open,close,open,close,open,close.. below is .gif with exact problem.
It may not be easy to see on that .gif, but if someone uses the system they know.

Linkleri görebilmek için giriş yap veya kayıt ol.

Linkleri görebilmek için giriş yap veya kayıt ol.


Second problem is with auto close windows as shop.. when you get far it wont close a window.
Linkleri görebilmek için giriş yap veya kayıt ol.


Decreasing or increasing this value do nothing.. bug will be still there..
PythonWindow.cpp:
Genişlet Daralt Kopyala
        if (IsFlag(FLAG_ANIMATED_BOARD))
        {
            if (m_bShow)
            {
                m_sizeAnimation = tweeny::from(1.0f)
                    .to(0.0f)
                    .during(120)

Anyone find some fix for any of these problems?

Thanks in advance
 
Çözüm
Hi, can you be a little more specific? or a mini-tutorial? thank
In PythonWindowManagerModule.cpp

Add (but check all flags cause we can have different flags, just delete flags you dont have)!!!

C++:
Genişlet Daralt Kopyala
PyObject* wndMgrRemoveFlag(PyObject* poSelf, PyObject* poArgs)
{
    UI::CWindow* pWin;
    if (!PyTuple_GetWindow(poArgs, 0, &pWin))
        return Py_BuildException();

    char* pszFlag;
    if (!PyTuple_GetString(poArgs, 1, &pszFlag))
        return Py_BuildException();

    if (pszFlag && *pszFlag)
    {
        if (!stricmp(pszFlag, "movable"))
            pWin->RemoveFlag(UI::CWindow::FLAG_MOVABLE);
        else if (!stricmp(pszFlag, "limit"))
            pWin->RemoveFlag(UI::CWindow::FLAG_LIMIT);
        else if...
Hi, can you be a little more specific? or a mini-tutorial? thank
In PythonWindowManagerModule.cpp

Add (but check all flags cause we can have different flags, just delete flags you dont have)!!!

C++:
Genişlet Daralt Kopyala
PyObject* wndMgrRemoveFlag(PyObject* poSelf, PyObject* poArgs)
{
    UI::CWindow* pWin;
    if (!PyTuple_GetWindow(poArgs, 0, &pWin))
        return Py_BuildException();

    char* pszFlag;
    if (!PyTuple_GetString(poArgs, 1, &pszFlag))
        return Py_BuildException();

    if (pszFlag && *pszFlag)
    {
        if (!stricmp(pszFlag, "movable"))
            pWin->RemoveFlag(UI::CWindow::FLAG_MOVABLE);
        else if (!stricmp(pszFlag, "limit"))
            pWin->RemoveFlag(UI::CWindow::FLAG_LIMIT);
        else if (!stricmp(pszFlag, "dragable"))
            pWin->RemoveFlag(UI::CWindow::FLAG_DRAGABLE);
        else if (!stricmp(pszFlag, "attach"))
            pWin->RemoveFlag(UI::CWindow::FLAG_ATTACH);
        else if (!stricmp(pszFlag, "restrict_x"))
            pWin->RemoveFlag(UI::CWindow::FLAG_RESTRICT_X);
        else if (!stricmp(pszFlag, "restrict_y"))
            pWin->RemoveFlag(UI::CWindow::FLAG_RESTRICT_Y);
        else if (!stricmp(pszFlag, "float"))
            pWin->RemoveFlag(UI::CWindow::FLAG_FLOAT);
        else if (!stricmp(pszFlag, "not_pick"))
            pWin->RemoveFlag(UI::CWindow::FLAG_NOT_PICK);
        else if (!stricmp(pszFlag, "ignore_size"))
            pWin->RemoveFlag(UI::CWindow::FLAG_IGNORE_SIZE);
        else if (!stricmp(pszFlag, "rtl"))
            pWin->RemoveFlag(UI::CWindow::FLAG_RTL);
        else if (!stricmp(pszFlag, "alpha_sensitive"))
            pWin->RemoveFlag(UI::CWindow::FLAG_ALPHA_SENSITIVE);
        else if (!stricmp(pszFlag, "remove_limit"))
            pWin->RemoveFlag(UI::CWindow::FLAG_REMOVE_LIMIT);
        else if (!stricmp(pszFlag, "window_without_alpha"))
            pWin->RemoveFlag(UI::CWindow::FLAG_IS_BOARD_WITHOUT_ALPHA);
#ifdef ENABLE_TWEENY_LIBRARY
        else if (!stricmp(pszFlag, "animate"))
            pWin->RemoveFlag(UI::CWindow::FLAG_ANIMATED_BOARD);
#endif
        else
            TraceError("Unknown window flag %s", pszFlag);
    }

    return Py_BuildNone();
}

register it too
C++:
Genişlet Daralt Kopyala
{ "RemoveFlag",                    wndMgrRemoveFlag,                    METH_VARARGS },

In ui.py

Under this
C++:
Genişlet Daralt Kopyala
    def AddFlag(self, style):
        wndMgr.AddFlag(self.hWnd, style)

Add this
C++:
Genişlet Daralt Kopyala
    def RemoveFlag(self, style):
        wndMgr.RemoveFlag(self.hWnd, style)

Now go in uishop.py and add

in def LoadDialog(self): right at start add
C++:
Genişlet Daralt Kopyala
 self.AddFlag("animate")

in def Open(self, vid): right at start add
C++:
Genişlet Daralt Kopyala
 self.AddFlag("animate")

and in def Close(self): under self.Hide()
C++:
Genişlet Daralt Kopyala
self.RemoveFlag("animate")

Thats all.. But if you have in uiscript/shopdialog.py animate flag, remove it..

EDIT: I forgot about second problem

In uishop.py

under imports add
Python:
Genişlet Daralt Kopyala
TEXT_TIME = 3

Search
Python:
Genişlet Daralt Kopyala
self.tooltipItem = 0

add under
Python:
Genişlet Daralt Kopyala
self.textCloseText = 0

Search
Python:
Genişlet Daralt Kopyala
self.ClearDictionary()

add under
Python:
Genişlet Daralt Kopyala
self.textCloseText = 0

Search
Python:
Genişlet Daralt Kopyala
def OnUpdate(self):

Replace with this
Python:
Genişlet Daralt Kopyala
    def OnUpdate(self):
        if app.GetTime() >= self.textCloseText:

            USE_SHOP_LIMIT_RANGE = 1000

            (x, y, z) = player.GetMainCharacterPosition()

            if abs(x - self.xShopStart) > USE_SHOP_LIMIT_RANGE or abs(y - self.yShopStart) > USE_SHOP_LIMIT_RANGE:
                self.textCloseText = app.GetTime() + TEXT_TIME
                self.Close()
 
Son düzenleme:
Çözüm
In PythonWindowManagerModule.cpp

Add (but check all flags cause we can have different flags, just delete flags you dont have)!!!

C++:
Genişlet Daralt Kopyala
PyObject* wndMgrRemoveFlag(PyObject* poSelf, PyObject* poArgs)
{
    UI::CWindow* pWin;
    if (!PyTuple_GetWindow(poArgs, 0, &pWin))
        return Py_BuildException();

    char* pszFlag;
    if (!PyTuple_GetString(poArgs, 1, &pszFlag))
        return Py_BuildException();

    if (pszFlag && *pszFlag)
    {
        if (!stricmp(pszFlag, "movable"))
            pWin->RemoveFlag(UI::CWindow::FLAG_MOVABLE);
        else if (!stricmp(pszFlag, "limit"))
            pWin->RemoveFlag(UI::CWindow::FLAG_LIMIT);
        else if (!stricmp(pszFlag, "dragable"))
            pWin->RemoveFlag(UI::CWindow::FLAG_DRAGABLE);
        else if (!stricmp(pszFlag, "attach"))
            pWin->RemoveFlag(UI::CWindow::FLAG_ATTACH);
        else if (!stricmp(pszFlag, "restrict_x"))
            pWin->RemoveFlag(UI::CWindow::FLAG_RESTRICT_X);
        else if (!stricmp(pszFlag, "restrict_y"))
            pWin->RemoveFlag(UI::CWindow::FLAG_RESTRICT_Y);
        else if (!stricmp(pszFlag, "float"))
            pWin->RemoveFlag(UI::CWindow::FLAG_FLOAT);
        else if (!stricmp(pszFlag, "not_pick"))
            pWin->RemoveFlag(UI::CWindow::FLAG_NOT_PICK);
        else if (!stricmp(pszFlag, "ignore_size"))
            pWin->RemoveFlag(UI::CWindow::FLAG_IGNORE_SIZE);
        else if (!stricmp(pszFlag, "rtl"))
            pWin->RemoveFlag(UI::CWindow::FLAG_RTL);
        else if (!stricmp(pszFlag, "alpha_sensitive"))
            pWin->RemoveFlag(UI::CWindow::FLAG_ALPHA_SENSITIVE);
        else if (!stricmp(pszFlag, "remove_limit"))
            pWin->RemoveFlag(UI::CWindow::FLAG_REMOVE_LIMIT);
        else if (!stricmp(pszFlag, "window_without_alpha"))
            pWin->RemoveFlag(UI::CWindow::FLAG_IS_BOARD_WITHOUT_ALPHA);
#ifdef ENABLE_TWEENY_LIBRARY
        else if (!stricmp(pszFlag, "animate"))
            pWin->RemoveFlag(UI::CWindow::FLAG_ANIMATED_BOARD);
#endif
        else
            TraceError("Unknown window flag %s", pszFlag);
    }

    return Py_BuildNone();
}

register it too
C++:
Genişlet Daralt Kopyala
{ "RemoveFlag",                    wndMgrRemoveFlag,                    METH_VARARGS },

In ui.py

Under this
C++:
Genişlet Daralt Kopyala
    def AddFlag(self, style):
        wndMgr.AddFlag(self.hWnd, style)

Add this
C++:
Genişlet Daralt Kopyala
    def RemoveFlag(self, style):
        wndMgr.RemoveFlag(self.hWnd, style)

Now go in uishop.py and add

in def LoadDialog(self): right at start add
C++:
Genişlet Daralt Kopyala
 self.AddFlag("animate")

in def Open(self, vid): right at start add
C++:
Genişlet Daralt Kopyala
 self.AddFlag("animate")

and in def Close(self): under self.Hide()
C++:
Genişlet Daralt Kopyala
self.RemoveFlag("animate")

Thats all.. But if you have in uiscript/shopdialog.py animate flag, remove it..
and why not solve " void CWindow::Hide() " for all windows instead of adding that flag to each window separately?
 
and why not solve " void CWindow::Hide() " for all windows instead of adding that flag to each window separately?
You cant do much about it but you can try.. I just made it simplier

C++:
Genişlet Daralt Kopyala
    void CWindow::Show()
    {
#ifdef ENABLE_TWEENY_LIBRARY
        if (IsFlag(FLAG_ANIMATED_BOARD))
        {
            if (!this->m_bShow)
            {
                this->m_bShow = true;

                m_sizeAnimation = tweeny::from(0.0f)
                    .to(1.0f)
                    .during(150)
                    .via(tweeny::easing::cubicOut)
                    .onStep([this](tweeny::tween<float>& t, float scale) {
                    SetScale(scale, scale);

                    if (t.progress() == 1.0f)
                    {
                        // Animation completed, set m_bShow to true
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                        });
                m_sizeAnimation.value().step(0.0f);
            }
        }
        else
        {
            m_bShow = true;
        }
#else
        m_bShow = true;
#endif
    }

    void CWindow::Hide()
    {
#ifdef ENABLE_TWEENY_LIBRARY
        if (IsFlag(FLAG_ANIMATED_BOARD))
        {
            if (m_bShow)
            {
                m_sizeAnimation = tweeny::from(1.0f)
                    .to(0.0f)
                    .during(120)
                    .via(tweeny::easing::cubicIn)
                    .onStep([this](tweeny::tween<float>& t, float scale) {
                    SetScale(scale, scale);

                    if (t.progress() == 1.0f)
                    {
                        // Animation completed, set m_bShow to false
                        m_bShow = false;
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                        });
                m_sizeAnimation.value().step(0.0f);
            }
        }
        else
        {
            m_bShow = false;
        }
#else

        m_bShow = false;
#endif
    }
 
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.
Üst