跳转至

AssetBreakEntity

格式

AssetBreakEntity(obj)

简介

删除资源对象,资源对象的创建详见AssetBuildEntity

参数

名称 类型 描述
obj 资源对象

实例

运行开始时创建资源对象A,按下鼠标左键删除资源对象A。

import fg
import wx
import vmath

asset = fg.AssetCreate()
asset.name = 'Main Scene'
asset.state = fg.STATE.VOXMODEL
asset.vmFile = 'mainScene'
asset.icon='icon.png'

fg.AssetRegister(asset)

A = fg.AssetCreate()
A.name = 'A'
A.state = fg.STATE.VOXMODEL
A.vmFile = 'A'
A.icon='icon.png'

def onStart(self):
    global a
    a=fg.AssetBuildEntity(fg.AssetRegister(A), self.id, vmath.Vec3(0, 25, 0))

def onmouse(self, stamp, button, action, mods):
    global a
    if button==wx.MOUSE_BUTTON.LEFT and action==wx.ACTION.PRESS:
        fg.AssetBreakEntity(a)

fg.AssetSetStartCBFunc(asset, onStart)
fg.AssetSetMouseButtonCBFunc(asset, onmouse)