cocos2d/cocos2d-x — pull request #2028 by dumganhar (2013-02-22 08:04:01+00:00)
Title: fixed #1743: Adding an additional transform for CCNode.

* The additional transform will be concatenated at the end of nodeToParentTransform.
It could be used to simulate `parent-child` relationship between two nodes (e.g. one is in BatchNode, another isn't).

// create a batchNode
CCSpriteBatchNode* batch= CCSpriteBatchNode::create("Icon-114.png");
this->addChild(batch);

// create two sprites, spriteA will be added to batchNode, they are using different textures.
CCSprite* spriteA = CCSprite::createWithTexture(batch->getTexture());
CCSprite* spriteB = CCSprite::create("Icon-72.png");

batch->addChild(spriteA);

// We can't make spriteB as spriteA's child since they use different textures. So just add it to layer.
// But we want to simulate `parent-child` relationship for these two node.
this->addChild(spriteB);

//position
spriteA->setPosition(ccp(200, 200));

// Gets the spriteA's transform.
CCAffineTransform t = spriteA->nodeToParentTransform();

// Sets the additional transform to spriteB, spriteB's postion will based on its pseudo parent i.e. spriteA.
spriteB->setAdditionalTransform(t);

//scale
spriteA->setScale(2);

// Gets the spriteA's transform.
t = spriteA->nodeToParentTransform();

// Sets the additional transform to spriteB, spriteB's scale will based on its pseudo parent i.e. spriteA.
spriteB->setAdditionalTransform(t);

//rotation
spriteA->setRotation(20);

// Gets the spriteA's transform.
t = spriteA->nodeToParentTransform();

// Sets the additional transform to spriteB, spriteB's rotation will based on its pseudo parent i.e. spriteA.
spriteB->setAdditionalTransform(t);