跳转至

AssetSetMouseButtonCBFunc 鼠标按键交互

格式

AssetSetMouseButtonCBFunc(asset, callback)

简介

针对资源类的资源对象进行鼠标按键操作时执行回调函数,鼠标的按键操作及对应按键详见ACTIONMOUSE_BUTTON

参数

名称 类型 描述
asset 资源类
callback 回调函数

实例

按下鼠标左键时打印123。

import fg
import wx

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

fg.AssetRegister(asset)

def onMouseButton(self, stamp, button, action, mods):
    if action == wx.ACTION.PRESS and button == wx.MOUSE_BUTTON.LEFT:
        print(123)

fg.AssetSetMouseButtonCBFunc(asset, onMouseButton)