SpriterData2D.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. //
  2. // Copyright (c) 2008-2016 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #include "../Precompiled.h"
  23. #include "../Math/MathDefs.h"
  24. #include "../Urho2D/SpriterData2D.h"
  25. #include <PugiXml/pugixml.hpp>
  26. #include <cstring>
  27. using namespace pugi;
  28. namespace Urho3D
  29. {
  30. namespace Spriter
  31. {
  32. SpriterData::SpriterData()
  33. {
  34. }
  35. SpriterData::~SpriterData()
  36. {
  37. Reset();
  38. }
  39. void SpriterData::Reset()
  40. {
  41. if (!folders_.Empty())
  42. {
  43. for (size_t i = 0; i < folders_.Size(); ++i)
  44. delete folders_[i];
  45. folders_.Clear();
  46. }
  47. if (!entities_.Empty())
  48. {
  49. for (size_t i = 0; i < entities_.Size(); ++i)
  50. delete entities_[i];
  51. entities_.Clear();
  52. }
  53. }
  54. bool SpriterData::Load(const pugi::xml_node& node)
  55. {
  56. Reset();
  57. if (strcmp(node.name(), "spriter_data"))
  58. return false;
  59. scmlVersion_ = node.attribute("scml_version").as_int();
  60. generator_ = node.attribute("generator").as_string();
  61. generatorVersion_ = node.attribute("scml_version").as_string();
  62. for (xml_node folderNode = node.child("folder"); !folderNode.empty(); folderNode = folderNode.next_sibling("folder"))
  63. {
  64. folders_.Push(new Folder());
  65. if (!folders_.Back()->Load(folderNode))
  66. return false;
  67. }
  68. for (xml_node entityNode = node.child("entity"); !entityNode.empty(); entityNode = entityNode.next_sibling("entity"))
  69. {
  70. entities_.Push(new Entity());
  71. if (!entities_.Back()->Load(entityNode))
  72. return false;
  73. }
  74. return true;
  75. }
  76. bool SpriterData::Load(const void* data, size_t size)
  77. {
  78. xml_document document;
  79. if (!document.load_buffer(data, size))
  80. return false;
  81. return Load(document.child("spriter_data"));
  82. }
  83. Folder::Folder()
  84. {
  85. }
  86. Folder::~Folder()
  87. {
  88. Reset();
  89. }
  90. void Folder::Reset()
  91. {
  92. for (size_t i = 0; i < files_.Size(); ++i)
  93. delete files_[i];
  94. files_.Clear();
  95. }
  96. bool Folder::Load(const pugi::xml_node& node)
  97. {
  98. Reset();
  99. if (strcmp(node.name(), "folder"))
  100. return false;
  101. id_ = node.attribute("id").as_int();
  102. name_ = node.attribute("name").as_string();
  103. for (xml_node fileNode = node.child("file"); !fileNode.empty(); fileNode = fileNode.next_sibling("file"))
  104. {
  105. files_.Push(new File(this));
  106. if (!files_.Back()->Load(fileNode))
  107. return false;
  108. }
  109. return true;
  110. }
  111. File::File(Folder* folder) :
  112. folder_(folder)
  113. {
  114. }
  115. File::~File()
  116. {
  117. }
  118. bool File::Load(const pugi::xml_node& node)
  119. {
  120. if (strcmp(node.name(), "file"))
  121. return false;
  122. id_ = node.attribute("id").as_int();
  123. name_ = node.attribute("name").as_string();
  124. width_ = node.attribute("width").as_float();
  125. height_ = node.attribute("height").as_float();
  126. pivotX_ = node.attribute("pivot_x").as_float(0.0f);
  127. pivotY_ = node.attribute("pivot_y").as_float(1.0f);
  128. return true;
  129. }
  130. Entity::Entity()
  131. {
  132. }
  133. Entity::~Entity()
  134. {
  135. Reset();
  136. }
  137. void Entity::Reset()
  138. {
  139. for (size_t i = 0; i < characterMaps_.Size(); ++i)
  140. delete characterMaps_[i];
  141. characterMaps_.Clear();
  142. for (size_t i = 0; i < animations_.Size(); ++i)
  143. delete animations_[i];
  144. animations_.Clear();
  145. }
  146. bool Entity::Load(const pugi::xml_node& node)
  147. {
  148. Reset();
  149. if (strcmp(node.name(), "entity"))
  150. return false;
  151. id_ = node.attribute("id").as_int();
  152. name_ = node.attribute("name").as_string();
  153. for (xml_node characterMapNode = node.child("character_map"); !characterMapNode.empty(); characterMapNode = characterMapNode.next_sibling("character_map"))
  154. {
  155. characterMaps_.Push(new CharacterMap());
  156. if (!characterMaps_.Back()->Load(characterMapNode))
  157. return false;
  158. }
  159. for (xml_node animationNode = node.child("animation"); !animationNode.empty(); animationNode = animationNode.next_sibling("animation"))
  160. {
  161. animations_.Push(new Animation());
  162. if (!animations_.Back()->Load(animationNode))
  163. return false;
  164. }
  165. return true;
  166. }
  167. CharacterMap::CharacterMap()
  168. {
  169. }
  170. CharacterMap::~CharacterMap()
  171. {
  172. }
  173. void CharacterMap::Reset()
  174. {
  175. for (size_t i = 0; i < maps_.Size(); ++i)
  176. delete maps_[i];
  177. maps_.Clear();
  178. }
  179. bool CharacterMap::Load(const pugi::xml_node& node)
  180. {
  181. Reset();
  182. if (strcmp(node.name(), "character_map"))
  183. return false;
  184. id_ = node.attribute("id").as_int();
  185. name_ = node.attribute("name").as_string();
  186. for (xml_node mapNode = node.child("map"); !mapNode.empty(); mapNode = mapNode.next_sibling("map"))
  187. {
  188. maps_.Push(new MapInstruction());
  189. if (!maps_.Back()->Load(mapNode))
  190. return false;
  191. }
  192. return false;
  193. }
  194. MapInstruction::MapInstruction()
  195. {
  196. }
  197. MapInstruction::~MapInstruction()
  198. {
  199. }
  200. bool MapInstruction::Load(const pugi::xml_node& node)
  201. {
  202. if (strcmp(node.name(), "map"))
  203. return false;
  204. folder_ = node.attribute("folder").as_int();
  205. file_ = node.attribute("file").as_int();
  206. targetFolder_ = node.attribute("target_folder").as_int(-1);
  207. targetFile_ = node.attribute("target_file").as_int(-1);
  208. return true;
  209. }
  210. Animation::Animation()
  211. {
  212. }
  213. Animation::~Animation()
  214. {
  215. Reset();
  216. }
  217. void Animation::Reset()
  218. {
  219. if (!mainlineKeys_.Empty())
  220. {
  221. for (size_t i = 0; i < mainlineKeys_.Size(); ++i)
  222. delete mainlineKeys_[i];
  223. mainlineKeys_.Clear();
  224. }
  225. for (size_t i = 0; i < timelines_.Size(); ++i)
  226. delete timelines_[i];
  227. timelines_.Clear();
  228. }
  229. bool Animation::Load(const pugi::xml_node& node)
  230. {
  231. Reset();
  232. if (strcmp(node.name(), "animation"))
  233. return false;
  234. id_ = node.attribute("id").as_int();
  235. name_ = node.attribute("name").as_string();
  236. length_ = node.attribute("length").as_float() * 0.001f;
  237. looping_ = node.attribute("looping").as_bool(true);
  238. xml_node mainlineNode = node.child("mainline");
  239. for (xml_node keyNode = mainlineNode.child("key"); !keyNode.empty(); keyNode = keyNode.next_sibling("key"))
  240. {
  241. mainlineKeys_.Push(new MainlineKey());
  242. if (!mainlineKeys_.Back()->Load(keyNode))
  243. return false;
  244. }
  245. for (xml_node timelineNode = node.child("timeline"); !timelineNode.empty(); timelineNode = timelineNode.next_sibling("timeline"))
  246. {
  247. timelines_.Push(new Timeline());
  248. if (!timelines_.Back()->Load(timelineNode))
  249. return false;
  250. }
  251. return true;
  252. }
  253. MainlineKey::MainlineKey()
  254. {
  255. }
  256. MainlineKey::~MainlineKey()
  257. {
  258. Reset();
  259. }
  260. void MainlineKey::Reset()
  261. {
  262. for (size_t i = 0; i < boneRefs_.Size(); ++i)
  263. delete boneRefs_[i];
  264. boneRefs_.Clear();
  265. for (size_t i = 0; i < objectRefs_.Size(); ++i)
  266. delete objectRefs_[i];
  267. objectRefs_.Clear();
  268. }
  269. bool MainlineKey::Load(const pugi::xml_node& node)
  270. {
  271. id_ = node.attribute("id").as_int();
  272. time_ = node.attribute("time").as_float() * 0.001f;
  273. for (xml_node boneRefNode = node.child("bone_ref"); !boneRefNode.empty(); boneRefNode = boneRefNode.next_sibling("bone_ref"))
  274. {
  275. boneRefs_.Push(new Ref());
  276. if (!boneRefs_.Back()->Load(boneRefNode))
  277. return false;
  278. }
  279. for (xml_node objectRefNode = node.child("object_ref"); !objectRefNode.empty(); objectRefNode = objectRefNode.next_sibling("object_ref"))
  280. {
  281. objectRefs_.Push(new Ref());
  282. if (!objectRefs_.Back()->Load(objectRefNode))
  283. return false;
  284. }
  285. return true;
  286. }
  287. Ref::Ref()
  288. {
  289. }
  290. Ref::~Ref()
  291. {
  292. }
  293. bool Ref::Load(const pugi::xml_node& node)
  294. {
  295. if (strcmp(node.name(), "bone_ref") && strcmp(node.name(), "object_ref"))
  296. return false;
  297. id_ = node.attribute("id").as_int();
  298. parent_ = node.attribute("parent").as_int(-1);
  299. timeline_ = node.attribute("timeline").as_int();
  300. key_ = node.attribute("key").as_int();
  301. zIndex_ = node.attribute("z_index").as_int();
  302. return true;
  303. }
  304. Timeline::Timeline()
  305. {
  306. }
  307. Timeline::~Timeline()
  308. {
  309. Reset();
  310. }
  311. void Timeline::Reset()
  312. {
  313. for (size_t i = 0; i < keys_.Size(); ++i)
  314. delete keys_[i];
  315. keys_.Clear();
  316. }
  317. bool Timeline::Load(const pugi::xml_node& node)
  318. {
  319. Reset();
  320. if (strcmp(node.name(), "timeline"))
  321. return false;
  322. id_ = node.attribute("id").as_int();
  323. name_ = node.attribute("name").as_string();
  324. String typeString;
  325. xml_attribute typeAttr = node.attribute("type");
  326. if (typeAttr.empty())
  327. typeString = node.attribute("object_type").as_string("sprite");
  328. else
  329. typeString = typeAttr.as_string("sprite");
  330. if (typeString == "bone")
  331. {
  332. objectType_ = BONE;
  333. for (xml_node keyNode = node.child("key"); !keyNode.empty(); keyNode = keyNode.next_sibling("key"))
  334. {
  335. keys_.Push(new BoneTimelineKey(this));
  336. if (!keys_.Back()->Load(keyNode))
  337. return false;
  338. }
  339. }
  340. else if (typeString == "sprite")
  341. {
  342. objectType_ = SPRITE;
  343. for (xml_node keyNode = node.child("key"); !keyNode.empty(); keyNode = keyNode.next_sibling("key"))
  344. {
  345. keys_.Push(new SpriteTimelineKey(this));
  346. if (!keys_.Back()->Load(keyNode))
  347. return false;
  348. }
  349. }
  350. else
  351. {
  352. // Unsupported object type now.
  353. return false;
  354. }
  355. return true;
  356. }
  357. TimelineKey::TimelineKey(Timeline* timeline)
  358. {
  359. this->timeline_ = timeline;
  360. }
  361. TimelineKey::~TimelineKey()
  362. {
  363. }
  364. bool TimelineKey::Load(const pugi::xml_node& node)
  365. {
  366. if (strcmp(node.name(), "key"))
  367. return false;
  368. id_ = node.attribute("id").as_int();
  369. time_ = node.attribute("time").as_float() * 0.001f;
  370. String curveType = node.attribute("curve_type").as_string("linear");
  371. if (curveType == "instant")
  372. curveType_ = INSTANT;
  373. else if (curveType == "linear")
  374. curveType_ = LINEAR;
  375. else if (curveType == "quadratic")
  376. curveType_ = QUADRATIC;
  377. else if (curveType == "cubic")
  378. curveType_ = CUBIC;
  379. else
  380. curveType_ = LINEAR;
  381. c1_ = node.attribute("c1").as_float();
  382. c2_ = node.attribute("c2").as_float();
  383. return true;
  384. }
  385. TimelineKey& TimelineKey::operator=(const TimelineKey& rhs)
  386. {
  387. id_ = rhs.id_;
  388. time_ = rhs.time_;
  389. curveType_ = rhs.curveType_;
  390. c1_ = rhs.c1_;
  391. c2_ = rhs.c2_;
  392. return *this;
  393. }
  394. // From http://www.brashmonkey.com/ScmlDocs/ScmlReference.html
  395. inline float Linear(float a, float b, float t)
  396. {
  397. return a + (b - a) * t;
  398. }
  399. inline float Quadratic(float a, float b, float c, float t)
  400. {
  401. return Linear(Linear(a, b, t), Linear(b, c, t), t);
  402. }
  403. inline float Cubic(float a, float b, float c, float d, float t)
  404. {
  405. return Linear(Quadratic(a, b, c, t), Quadratic(b, c, d, t), t);
  406. }
  407. float TimelineKey::GetTByCurveType(float currentTime, float nextTimelineTime) const
  408. {
  409. if (curveType_ == INSTANT)
  410. return 0.0f;
  411. float t = (currentTime - time_) / (nextTimelineTime - time_);
  412. switch (curveType_)
  413. {
  414. case LINEAR:
  415. return t;
  416. case QUADRATIC:
  417. return Quadratic(0.0f, c1_, 1.0f, t);
  418. case CUBIC:
  419. return Cubic(0.0f, c1_, c2_, 1.0f, t);
  420. default:
  421. return 0.0f;
  422. }
  423. }
  424. SpatialInfo::SpatialInfo(float x, float y, float angle, float scale_x, float scale_y, float a, int spin)
  425. {
  426. this->x_ = x;
  427. this->y_ = y;
  428. this->angle_ = angle;
  429. this->scaleX_ = scale_x;
  430. this->scaleY_ = scale_y;
  431. this->alpha_ = a;
  432. this->spin = spin;
  433. }
  434. SpatialInfo SpatialInfo::UnmapFromParent(const SpatialInfo& parentInfo) const
  435. {
  436. float unmappedX;
  437. float unmappedY;
  438. float unmappedAngle = angle_ + parentInfo.angle_;
  439. float unmappedScaleX = scaleX_ * parentInfo.scaleX_;
  440. float unmappedScaleY = scaleY_ * parentInfo.scaleY_;
  441. float unmappedAlpha = alpha_ * parentInfo.alpha_;
  442. if (x_ != 0.0f || y_ != 0.0f)
  443. {
  444. float preMultX = x_ * parentInfo.scaleX_;
  445. float preMultY = y_ * parentInfo.scaleY_;
  446. float s = Sin(parentInfo.angle_);
  447. float c = Cos(parentInfo.angle_);
  448. unmappedX = (preMultX * c) - (preMultY * s) + parentInfo.x_;
  449. unmappedY = (preMultX * s) + (preMultY * c) + parentInfo.y_;
  450. }
  451. else
  452. {
  453. unmappedX = parentInfo.x_;
  454. unmappedY = parentInfo.y_;
  455. }
  456. return SpatialInfo(unmappedX, unmappedY, unmappedAngle, unmappedScaleX, unmappedScaleY, unmappedAlpha, spin);
  457. }
  458. void SpatialInfo::Interpolate(const SpatialInfo& other, float t)
  459. {
  460. x_ = Linear(x_, other.x_, t);
  461. y_ = Linear(y_, other.y_, t);
  462. if (spin > 0.0f && (other.angle_ - angle_ < 0.0f))
  463. {
  464. angle_ = Linear(angle_, other.angle_ + 360.0f, t);
  465. }
  466. else if (spin < 0.0f && (other.angle_ - angle_ > 0.0f))
  467. {
  468. angle_ = Linear(angle_, other.angle_ - 360.0f, t);
  469. }
  470. else
  471. {
  472. angle_ = Linear(angle_, other.angle_, t);
  473. }
  474. scaleX_ = Linear(scaleX_, other.scaleX_, t);
  475. scaleY_ = Linear(scaleY_, other.scaleY_, t);
  476. alpha_ = Linear(alpha_, other.alpha_, t);
  477. }
  478. SpatialTimelineKey::SpatialTimelineKey(Timeline* timeline) :
  479. TimelineKey(timeline)
  480. {
  481. }
  482. SpatialTimelineKey::~SpatialTimelineKey()
  483. {
  484. }
  485. bool SpatialTimelineKey::Load(const xml_node& node)
  486. {
  487. if (!TimelineKey::Load(node))
  488. return false;
  489. xml_node childNode = node.child("bone");
  490. if (childNode.empty())
  491. childNode = node.child("object");
  492. info_.x_ = childNode.attribute("x").as_float();
  493. info_.y_ = childNode.attribute("y").as_float();
  494. info_.angle_ = childNode.attribute("angle").as_float();
  495. info_.scaleX_ = childNode.attribute("scale_x").as_float(1.0f);
  496. info_.scaleY_ = childNode.attribute("scale_y").as_float(1.0f);
  497. info_.alpha_ = childNode.attribute("a").as_float(1.0f);
  498. info_.spin = node.attribute("spin").as_int(1);
  499. return true;
  500. }
  501. SpatialTimelineKey& SpatialTimelineKey::operator=(const SpatialTimelineKey& rhs)
  502. {
  503. TimelineKey::operator=(rhs);
  504. info_ = rhs.info_;
  505. return *this;
  506. }
  507. void SpatialTimelineKey::Interpolate(const TimelineKey& other, float t)
  508. {
  509. const SpatialTimelineKey& o = (const SpatialTimelineKey&)other;
  510. info_.Interpolate(o.info_, t);
  511. }
  512. BoneTimelineKey::BoneTimelineKey(Timeline* timeline) :
  513. SpatialTimelineKey(timeline)
  514. {
  515. }
  516. BoneTimelineKey::~BoneTimelineKey()
  517. {
  518. }
  519. TimelineKey* BoneTimelineKey::Clone() const
  520. {
  521. BoneTimelineKey* result = new BoneTimelineKey(timeline_);
  522. *result = *this;
  523. return result;
  524. }
  525. bool BoneTimelineKey::Load(const xml_node& node)
  526. {
  527. if (!SpatialTimelineKey::Load(node))
  528. return false;
  529. xml_node boneNode = node.child("bone");
  530. length_ = boneNode.attribute("length").as_float(200.0f);
  531. width_ = boneNode.attribute("width").as_float(10.0f);
  532. return true;
  533. }
  534. BoneTimelineKey& BoneTimelineKey::operator=(const BoneTimelineKey& rhs)
  535. {
  536. SpatialTimelineKey::operator=(rhs);
  537. length_ = rhs.length_;
  538. width_ = rhs.width_;
  539. return *this;
  540. }
  541. void BoneTimelineKey::Interpolate(const TimelineKey& other, float t)
  542. {
  543. SpatialTimelineKey::Interpolate(other, t);
  544. const BoneTimelineKey& o = (const BoneTimelineKey&)other;
  545. length_ = Linear(length_, o.length_, t);
  546. width_ = Linear(width_, o.width_, t);
  547. }
  548. TimelineKey* SpriteTimelineKey::Clone() const
  549. {
  550. SpriteTimelineKey* result = new SpriteTimelineKey(timeline_);
  551. *result = *this;
  552. return result;
  553. }
  554. SpriteTimelineKey::SpriteTimelineKey(Timeline* timeline) :
  555. SpatialTimelineKey(timeline)
  556. {
  557. }
  558. SpriteTimelineKey::~SpriteTimelineKey()
  559. {
  560. }
  561. bool SpriteTimelineKey::Load(const pugi::xml_node& node)
  562. {
  563. if (!SpatialTimelineKey::Load(node))
  564. return false;
  565. xml_node objectNode = node.child("object");
  566. folderId_ = objectNode.attribute("folder").as_int(-1);
  567. fileId_ = objectNode.attribute("file").as_int(-1);
  568. xml_attribute pivotXAttr = objectNode.attribute("pivot_x");
  569. xml_attribute pivotYAttr = objectNode.attribute("pivot_y");
  570. if (pivotXAttr.empty() && pivotYAttr.empty())
  571. useDefaultPivot_ = true;
  572. else
  573. {
  574. useDefaultPivot_ = false;
  575. pivotX_ = pivotXAttr.as_float(0.0f);
  576. pivotY_ = pivotYAttr.as_float(1.0f);
  577. }
  578. return true;
  579. }
  580. void SpriteTimelineKey::Interpolate(const TimelineKey& other, float t)
  581. {
  582. SpatialTimelineKey::Interpolate(other, t);
  583. const SpriteTimelineKey& o = (const SpriteTimelineKey&)other;
  584. pivotX_ = Linear(pivotX_, o.pivotX_, t);
  585. pivotY_ = Linear(pivotY_, o.pivotY_, t);
  586. }
  587. SpriteTimelineKey& SpriteTimelineKey::operator=(const SpriteTimelineKey& rhs)
  588. {
  589. SpatialTimelineKey::operator=(rhs);
  590. folderId_ = rhs.folderId_;
  591. fileId_ = rhs.fileId_;
  592. useDefaultPivot_ = rhs.useDefaultPivot_;
  593. pivotX_ = rhs.pivotX_;
  594. pivotY_ = rhs.pivotY_;
  595. return *this;
  596. }
  597. }
  598. }