Return to Cocos2dx Playback Library

Problems with setting GlobalZOrder

Questions related to Cocos2dx playback library should be asked here.

Problems with setting GlobalZOrder

Postby Mike Derevyannykh » July 20th, 2016, 9:37 am

Hello. I have some problems with setting GlobalZOrder for GAFObjects. It doesn't work for GAF-Objects, the Z-Index isn't changed.
So, I have tried to fix it..
For a start, I have tried to change global Z-Order of all objects in some gaf-object by this code:
Code: Select all
void Insect::setGlobalZOrderForChildren(cocos2d::Node *parent, float z)
{
   if (parent == nullptr)
      return;
   parent->setGlobalZOrder(z);

   // adjust every child menu item
   const cocos2d::Vector<cocos2d::Node*> &children = parent->getChildren();

   for (int i = 0; i < children.size(); ++i)
   {
      Node* child = children.at(i);
      setGlobalZOrderForChildren(child, z);
   }
}

It has helped me.. and now I see this gaf-object in the position which i want, but after I have got some new bugs :) The graphic bugs
All elements of the flash object have been confused.
What can I do for fixing it?
Thanks for helping )
(sorry for my english)
User avatar
Mike Derevyannykh
 
Posts: 7
Joined: November 17th, 2015, 4:20 am

Re: Problems with setting GlobalZOrder

Postby Dmitry Bushtets » July 20th, 2016, 10:46 am

Hello!

For now, setting GlobalZOrder is not supported for children.
Every frame playback logic reset zOrder for all children to exact value for current frame.
Maybe you can decompose your animation to several parts and set zOrder to root object?
Or can you provide sample animation? We'll try to investigate and check are workarounds possible
User avatar
Dmitry Bushtets
 
Posts: 86
Joined: August 11th, 2014, 1:31 am

Re: Problems with setting GlobalZOrder

Postby Mike Derevyannykh » July 21st, 2016, 1:53 pm

Thanks for helping.
I have replied to you by a private message.
User avatar
Mike Derevyannykh
 
Posts: 7
Joined: November 17th, 2015, 4:20 am

Return to Cocos2dx Playback Library

Who is online

Users browsing this forum: No registered users and 1 guest