Skip to content

Commit

Permalink
fixed up voxel, voxelview and default voxelset
Browse files Browse the repository at this point in the history
Clark was here :V
  • Loading branch information
ClarkThyLord committed Jan 23, 2020
1 parent 58ea885 commit 6de41de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
18 changes: 9 additions & 9 deletions addons/Voxel-Core/defaults/VoxelSet.default.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ extends "res://addons/Voxel-Core/src/VoxelSet.gd"

# The following will initialize the object as needed
func _load():
set_voxel(Voxel.colored(Color.black, {}, {'name': 'black'}), 'black')
set_voxel(Voxel.colored(Color.white, {}, {'name': 'white'}))
set_voxel(Voxel.colored(Color.red, {}, {'name': 'red'}))
set_voxel(Voxel.colored(Color.green, {}, {'name': 'green'}))
set_voxel(Voxel.colored(Color.blue, {}, {'name': 'blue'}))
set_voxel(Voxel.colored(Color.yellow, {}, {'name': 'yellow'}))
set_voxel(Voxel.colored(Color.cyan, {}, {'name': 'cyan'}))
set_voxel(Voxel.colored(Color.purple, {}, {'name': 'purple'}))
set_voxel(Voxel.colored(Color.magenta, {}, {'name': 'magenta'}))
set_voxel(Voxel.colored(Color.black), 'black')
set_voxel(Voxel.colored(Color.white), 'white')
set_voxel(Voxel.colored(Color.red), 'red')
set_voxel(Voxel.colored(Color.green), 'green')
set_voxel(Voxel.colored(Color.blue), 'blue')
set_voxel(Voxel.colored(Color.yellow), 'yellow')
set_voxel(Voxel.colored(Color.cyan), 'cyan')
set_voxel(Voxel.colored(Color.purple), 'purple')
set_voxel(Voxel.colored(Color.magenta), 'magenta')
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func setup(voxelsetview, id, voxel : Dictionary) -> void:
Represents = voxel
VoxelSetView = voxelsetview

hint_tooltip = 'ID: ' + str(id)
hint_tooltip = 'ID: ' + str(id) + str((' | Name: ' + voxel['data']['vsn']) if voxel.has('data') and voxel['data'].has('vsn') else '')

get_node('CenterContainer/Color').color = Voxel.get_color(voxel)

Expand Down
5 changes: 4 additions & 1 deletion addons/Voxel-Core/src/Voxel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ static func basic(data : Dictionary = {}) -> Dictionary:
# get_data({ ... }) -> { ... }
#
static func get_data(voxel : Dictionary) -> Dictionary:
return voxel['data'] if typeof(voxel.get('data')) == TYPE_DICTIONARY else {}
if typeof(voxel.get('data')) == TYPE_NIL:
voxel['data'] = {}
return voxel['data']
# return voxel['data'] if typeof(voxel.get('data')) == TYPE_DICTIONARY else {}

# Helper function for setting 'data' of given Voxel
# voxel : Dictionary - Voxel to modify
Expand Down

0 comments on commit 6de41de

Please sign in to comment.