cocos2d / cocos2d-html5

Cocos2d for Web Browsers. Built using JavaScript.
https://www.cocos.com
3.07k stars 902 forks source link

CCNodeWebGLRenderCmd resets transform dirty before child nodes access it #2854

Open collinhover opened 9 years ago

collinhover commented 9 years ago
  1. Node._renderCmd.visit is called
  2. Node._renderCmd._syncStatus is called
  3. Node._renderCmd.transform is called
  4. Node._renderCmd resets transform dirty
  5. Node._renderCmd visits all child nodes
  6. Child nodes thinks parent node is never transform dirty

Is this intended or a bug? If a bug, the fix appears to be to remove https://github.com/cocos2d/cocos2d-html5/blob/develop/cocos2d/core/base-nodes/CCNodeWebGLRenderCmd.js#L200

dingpinglv commented 9 years ago

Yes, This is a problem, but you can see the code: https://github.com/cocos2d/cocos2d-html5/blob/develop/cocos2d/core/base-nodes/CCNodeWebGLRenderCmd.js#L141

I think we should to remove these codes:

        if(parentCmd && (parentCmd._dirtyFlag & flags.transformDirty))
            locFlag |= flags.transformDirty;

We'll review the dirty status management, Thanks for your notice. David

collinhover commented 9 years ago

If you remove the code you suggest, how will the child nodes know when their parent transform has changed and caused their own transform to change?

eanticev commented 9 years ago

Any update or timeline on this issue?