Browse Source

Set Sprite2D's texture name before loading so that the texture is able to load a parameters file, if it exsists.

Lasse Öörni 11 years ago
parent
commit
dd5f1dbcc3
2 changed files with 2 additions and 2 deletions
  1. 1 1
      Source/Engine/Urho2D/Sprite2D.cpp
  2. 1 1
      Source/Engine/Urho2D/StaticSprite2D.cpp

+ 1 - 1
Source/Engine/Urho2D/Sprite2D.cpp

@@ -51,10 +51,10 @@ void Sprite2D::RegisterObject(Context* context)
 bool Sprite2D::Load(Deserializer& source)
 {
     SharedPtr<Texture2D> texture(new Texture2D(context_));
+    texture->SetName(GetName());
     if (!texture->Load(source))
         return false;
 
-    texture->SetName(GetName());
     SetTexture(texture);
 
     if (texture)

+ 1 - 1
Source/Engine/Urho2D/StaticSprite2D.cpp

@@ -166,7 +166,7 @@ void StaticSprite2D::UpdateVertices()
 
     float leftU = rectangle_.left_ * invTexW;
     float rightU = rectangle_.right_ * invTexW;
-    float topV = rectangle_.top_ * invTexH;    
+    float topV = rectangle_.top_ * invTexH;
     float bottomV = rectangle_.bottom_ * invTexH;
     vertex0.uv_ = Vector2(leftU, bottomV);
     vertex1.uv_ = Vector2(leftU, topV);