Prohibited duplication in importing proto data

This commit is contained in:
Gyedo Jeon 2010-01-26 01:20:15 +00:00
parent 26a8e60405
commit bf3daf54a1
1 changed files with 6 additions and 1 deletions

View File

@ -15,9 +15,14 @@ class FileDrop(wx.FileDropTarget):
def OnDropFiles(self, x, y, filenames):
for filename in filenames:
name = os.path.basename(filename)
if self.editor.protoPalette.findItem(name):
print 'This model already exists in ProtoPalette!'
return
modelname = Filename.fromOsSpecific(filename).getFullpath()
itemData = ObjectBase(name=name, model=modelname, actor=True)
base.le.protoPalette.add(itemData)
self.editor.protoPalette.add(itemData)
newItem = self.editor.ui.protoPaletteUI.tree.AppendItem(self.editor.ui.protoPaletteUI.root, name)
self.editor.ui.protoPaletteUI.tree.SetItemPyData(newItem, itemData)
self.editor.ui.protoPaletteUI.tree.ScrollTo(newItem)