Jump to content

How to resize texture of WidgetSpriteViewport? setTextureWidth & setTextureHeight cause engine crash


photo

Recommended Posts

See attached test scene. Uncomment lines 33 & 34 to view problem.

 

WidgetSpriteViewport is a child of hpaned and can be resized. When WidgetSpriteViewport is resized, I want to also resize its texture to avoid scaling artifacts. After I call setTextureWidth or setTextureHeight on WidgetSpriteViewport object, I get a crash in engine in WidgetSprite::render(), WidgetSprite.cpp:332

 

What am I doing incorrectly?

test.cpp

test.ui

test.world

Link to comment

Hi, Adam,

 

Thanks for your post, there was a bug in WidgetSpriteViewport, it will be fixed in next release. If you can rebuild engine, add "setRender(NULL);"  to the end of methods void WidgetSpriteViewport::setTextureWidth() and void WidgetSpriteViewport::setTextureHeight() to fix this.

 

As for your code: remove "viewportHolder.widget.addChild(gViewport.m_viewport, ALIGN_EXPAND)",  because you have already done this in "m_parent.addChild(m_viewport,...)".

Link to comment

Thank you maxi. I removed the superfluous addChild call (thanks for catching that!), and the engine no longer crashes with the setRender(NULL) C++ calls in place.

 

I may still need help getting this to behave the way I need. I will experiment with it some more and post again if I need further assistance.

Link to comment
×
×
  • Create New...