Skip to content

Commit

Permalink
fix for #30 (same name for each tile)
Browse files Browse the repository at this point in the history
  • Loading branch information
puppetmaster- committed Mar 17, 2018
1 parent 53b1432 commit 90dbfd2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion addons/ch.fischspiele.tilesethelper/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name="Tileset Helper"
description="Tilesethelper dock to help creating or changing tileset scene."
author="Christian Fisch"
version="3.0.0"
version="3.0.1"
script="tilesethelper.gd"


Expand Down
13 changes: 6 additions & 7 deletions addons/ch.fischspiele.tilesethelper/tilesethelper.gd
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ func addImageNodes():
if dock.get_node(mainGuiPath+"HBoxImageFrame/frame1").is_editable():
for _imagePath in imagesPath:
var _newTexture = null
print(_imagePath)
_newTexture = ResourceLoader.load(_imagePath,"ImageTexture")
_newTexture.set_flags(0)
var _startFrame = int(dock.get_node(mainGuiPath+"HBoxImageFrame/frame1").text)
Expand All @@ -243,7 +242,6 @@ func addImageNodes():
var tilesWide = int((_newTexture.get_size().x + offsetX) / (int(tileSize) + offsetX))
var tilesTall = int((_newTexture.get_size().y + offsetY) / (int(tileSize) + offsetY))
for _frame in range(_startFrame,_endFrame):
#var _imageName = getFileName(_imagePath)+str(_frame)
var _imageName = dock.get_node(mainGuiPath+"HBoxImage/VBoxImage/name/lblName").get_text()+str(_frame)
var _newSpriteNode
if !_root.has_node(_imageName):
Expand All @@ -254,7 +252,6 @@ func addImageNodes():

if (int(tileSize) < _newTexture.get_size().x):
_newSpriteNode.set_region(true)

var tmpX = offsetX
if _frame % tilesWide == 0:
tmpX = 0
Expand All @@ -266,6 +263,7 @@ func addImageNodes():
_newSpriteNode.position = _position
else:
_newSpriteNode.position = Vector2(0,0)

_newSpriteNode.set_frame(_frame)
_root.add_child(_newSpriteNode)
_newSpriteNode.set_owner(_root)
Expand All @@ -283,19 +281,20 @@ func addImageNodes():
if checkOccluder:
setOccluder(_newSpriteNode)
else:
for _imagePath in imagesPath:
for i in range(imagesPath.size()):
var _imagePath = imagesPath[i]
print(_imagePath)
var _newTexture = null
_newTexture = ResourceLoader.load(_imagePath,"ImageTexture")
_newTexture.set_flags(0)
tileSize = _newTexture.get_width()
#var _imageName = getFileName(_imagePath)
var _imageName = dock.get_node(mainGuiPath+"HBoxImage/VBoxImage/name/lblName").get_text()
var _imageName = getFileName(_imagePath)
var _newSpriteNode
if !_root.has_node(_imageName):
_newSpriteNode = Sprite.new()
_newSpriteNode.texture = _newTexture
_root.add_child(_newSpriteNode)
_newSpriteNode.position = Vector2(0,0)
_newSpriteNode.position = Vector2(tileSize*i,0)
_newSpriteNode.set_owner(_root)
_newSpriteNode.set_name(_imageName)
else:
Expand Down

0 comments on commit 90dbfd2

Please sign in to comment.