# * TODO add action:event, handler to encapuslate action contribute
* DONE update action

refer to:  
https://cloud.tencent.com/document/product/1301/65931

https://cloud.tencent.com/document/product/1301/57912#handler-.E6.96.B9.E6.B3.95.E4.BD.BF.E7.94.A8.E4.BB.8B.E7.BB.8D


support:
- write handler functions bind to editor
through code editor(just copy and commit)

- or can load handler functions from action contribute


- trigger event with param



** DONE simplify action


# refactor dispatch:
# - rename to updateElementState
# - change to: updateElementState(uiState, (elementState) => new elementState)
# - remove reducer, directly update element state




# unify protocol to one protocol without config:
# - remove protocol config
# # - simplify ui control protocol config?


# remove getActions related code



# ** TODO enhance action


# # action get event+data+element state
# # action get event+element state
# action get event

# event.name: event name(e.g. "click")
# # event.target: current ui control(can get its data, e.g. rect, isDraw, ...)
# event.targetId: current ui control's id


# support:
# find any ui control's data(e.g. rect, isDraw, ...) by id

# # find any ui controls' id by tag


# add id:
# id not bind to element state
# id can be edit
#     check: id should be unique



## add tag:
## tag not bind to element state
## tag can be edit
##     # check: id should be unique



# get event


** DONE enhance action again


# trigger event with data:
# - data is json object
# - set data when set ui control's event handler



# action get event+data+element state



click event with action protocols:
define actionData

Inspector:
only show corresponding action select








** DONE refactor
# move ui control protocol->trigger event logic to ui control implement
#     check actionData type

refactor button protocol->generateHandleUIControlEventStr





# ** TODO 对扩展协议和贡献协议规范，整理出统一的格式



# 预先要发布协议；
# 装配时，选择一个协议，根据Config.ts生成inspector（like ui control protocol->Config）


# add ActionMRUtils

# support log,dispatch system action

# # get actionData


# # ** TODO remove protocol->Config.ts, move getActions to getContribute as actions; remove getActionName(protocol not define actionName!)


# # ** TODO read actions by parse getContribute instead of get from protocol config str!!!

# ** TODO action 能调用扩展（非贡献）的api

# ** TODO remove protocol->Config.ts, move them to action view data

# refer to element!

# ** TODO when switch to ui view, get selected actions' view data!


# ** TODO implement view


# ** TODO publish


# note:
# all actions use the same element protocol!
# (not define actionName in protocol)



# ** TODO import

# ** TODO future: support combine other actions
# left panel:
# Actions





# * TODO add 协作开发


* TODO editor export/import scene



** DONE export .glb

TODO add export scene extension:
    # download .glb
    invoke convertDataOrientedSceneToThreeScene

    //scene.add(camera)
        TODO handle camera


TODO add get three api extension:

TODO unify viewrect to pipeline-viewrect(update)



three-api
engine-scene
convert


scene-view1
whole



why disappear after download?


commit


run test



TODO update doc for fix:
viewrect
scene-view2



** DONE fix: children



** DONE fix: can support multiple implements of the same protocol(but one for different version) for action protocol







** DONE 加上代码框  更新扩展贡献的代码

每个selected extension,contribute(except pacakge) add selectArea to show and update its code


can't change protocol?
ans: no need to change it!



Debug
selectArea
commit button




  TODO add getGetExtensionFuncStr,getGetContributeFuncStr


TODO forbidden for PackageSelectedExtensions 


TODO contribute

commit




TODO not clean element assemble when switch between ap/element assemble



TODO reset(inspector current id) when switch to element assemble


** DONE add integration test


** DONE package support update its extensions and contributes

extension:

meta3d:
add getAllExtensionAndContributeFileDataOfPackage, 
//updateExtensionFuncDataOfPackage
//updatePackageWithAllExtensionAndContributeFileData = generatePackage

add bdd test



# TODO contribute:


TODO assemble-space

TODO add bdd test

extension

contribute



TODO pass run test



TODO commit





** DONE add integration test


# ** TODO pass bdd test


** DONE implement dispose

# ** TODO add dispose job


*** DONE run test for add cube

add a button to dispose a random cube

    add dispose job

add a button to add cube

use three.js to render









package:
engine-basic
engine-scene


contribute:

add-cube
dispose-cube
window
button

# meta3d-ui-control-webgpu-fullscreen-scene-view
meta3d-ui-control-scene-view


meta3d-pipeline-viewrect-sceneview

meta3d-pipeline-three

meta3d-pipeline-dispose-sceneview

meta3d-pipeline-editor-event-sceneview
meta3d-pipeline-editor-webgl1-scene-view1
meta3d-pipeline-editor-webgl1-scene-view2


meta3d-pipeline-editor-webgl1-scene-view1-three


extension:


imgui-webgl1-renderer
# meta3d-imgui-webgl1-three-renderer

webgl1



most（实现的协议名：most protocol）
immutable（实现的协议名：immutable protocol）
meta3d-engine-core-sceneview

event

ui

meta3d-use-editor



meta3d-editor-engine-webgl1-three-render-sceneview

meta3d-editor-webgl1-three-engine-whole-sceneview
meta3d-editor-webgl1-three-run-engine-sceneview

scenegraph-converter-three

meta3d-three-api


# TODO fix error:  treeDataList.length should be 1

TODO fix: one frame after clear
////canvas error:
imgui and renderer's canvas should be different

should set Clear Color in each frame
bind frame buffer->draw program error?

    three->renderToTarget?
    use pass???
    add scene-view-three: renderer.render empty to reset clearColor and program?
        reset currentProgram
        reset clearColor



TODO need publish and reselect:
# pipeline-dispose
# engine-core




commit

# TODO add:
# scene-view1-three
# scene-view2-three



# TODO need repackage:
# engine-scene(with directionlight)



# *** TODO run test for dispose cube


*** DONE fix add cube color bug




*** DONE pass bdd test



*** DONE fix bug: ap assemble, package assemble->Contributes: should show all implements for actions




# TODO need reselect:
# meta3d-editor-engine-webgl1-three-render-sceneview
# converter



*** DONE study


*** DONE run test for dispose cube


TODO need update
action-dispose-cube
gameobject(engine-scene package)


TODO need publish and update
meta3d-scenegraph-converter-three-sceneview-protocol and implement
meta3d-event(implement and protocol)
meta3d-pipeline-webgl1-three-sceneview
meta3d-editor-webgl1-three-engine-whole-sceneview

engine-scene:
    meta3d-engine-scene-sceneview



# should error



*** DONE handle converter for three

trigger dispose event when dispose e+c?


*** DONE pass run test


** DONE import .glb



TODO add three.js -> ec
    meta3d-scenegraph-converter-three-sceneview:
        # rename convert to convertDataOrientedSceneToThreeScene
        # add convertThreeSceneToDataOrientedScene
        add import


# TODO add import scene extension:
TODO add import glb extension:
    # upload .glb
    invoke convertThreeSceneToDataOrientedScene

TODO add import action
- h5 input file load + file reader
# - imgui file loader(ui control)?


TODO finish three-api


TODO add protocols



TODO run test: export->import
    TODO import scene should after dispose scene
        # invoke DisposeJob
        move dispose job utils logic to whole scene api, then invoke it


    # init new scene?
    # why stop loop after click?
    fov is 0?
    set arcball data


TODO publish

    publish meta3d-pipeline-editor-webgl1-scene-view1(implement and protocol)



# ** TODO add to editor


# TODO add import scene ui control
# event:
# onProgress
# onFinish
# onError


# TODO add export scene ui control
# onFinish
# onError


# # TODO add export/import scene action
# TODO add actions
# - handle error 
# - download
# - show progress


# ** TODO refactor: extract handle error event and action









# * TODO editor export/import package

# package = scene




* DONE platform import package

can edit package assemble


TODO draft(pass compile, bdd test):

id?

protocolVersion versionRange?
version, account?

backend add: batch get protocol iconbase64, config by name, version?

    TODO bdd test

isSelect change: judge by name, version instead of id?



    TODO pass compile
        TODO handle package data add version, account
        TODO pass compile



TODO pass run test

    TODO check is select





# TODO refactor: remove id?



TODO feat: change to 已导入(can't click)


TODO fix: click cancel select e/c



* DONE platform import app

can edit ap/element assemble


add two button:
运行
    remove "click name to run"
导入



load app->handle it like handle package



TODO implement 已导入




**  DONE refactor with import package


* DONE fix Inspector(E) not refresh bug


# * TODO refactor: assemble-space, frontend: add "xxxFunc" postfix

* DONE refactor: .ts: change function to let xxx = () => xxx



* DONE publish

TODO pass ci

TODO tencent cloud recharge

TODO publish