Forums

OverviewV-Play 1 SupportLevelEditor: cant drag&drop/place BuildEntityButton › Reply To: LevelEditor: cant drag&drop/place BuildEntityButton

OverviewV-Play 1 SupportLevelEditor: cant drag&drop/place BuildEntityButton › Reply To: LevelEditor: cant drag&drop/place BuildEntityButton
#6431

V-Play User

ok i moved ItemEditor back to LevelEditorScene.qml and set up a property alias.

i found the issue.. the entityContainer is “scene” (id of GameScene) and the LevelEditorScene has the id “levelEditorScene

now i add another EntityManager in LevelEditorScene and now it works to drag & drop entities.

 

But if i want to save and export it to JSON, there comes an Error, and i didnt found any solution in the documentation…

NativeUtils: displayTextInput with the following default text: "Enter level name" 
2014-01-20 16:49:17.212 GrumpyDude[59011:507] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
ERROR: LevelEditorLogic: no LevelBase loaded - either no LevelLoader defined or the loaded level was not derived from LevelBase as it has no levelData property!?
EntityManager: found 1 entities to store

LevelEditor: to store entityData: {}

LevelEditor: to store editableComponentData: {}
LevelEditor: overwriting levelMetaData property levelName with value leveltest from before undefined
LevelEditor: overwriting levelMetaData property levelBaseName with value Package1 from before undefined

LevelEditor: to store levelData: {"entityData":{},"editableComponentData":{},"levelMetaData":{"levelName":"leveltest","levelBaseName":"Package1"},"customData":{}}
LevelStorage: save new level with name leveltest , created id for it: 9004
LevelStorage: stored a new level with the following data: {"entityData":{},"editableComponentData":{},"levelMetaData":{"levelName":"leveltest","levelBaseName":"Package1","lastModificationTime":"Mon, 20 Jan 2014 15:49:17 GMT","storageLocation":"authorGenerated","levelId":9004,"creationTime":"Mon, 20 Jan 2014 15:49:17 GMT"},"customData":{}}
LevelStorage: updated allLevels: [{"creationTime":"Sat, 18 Jan 2014 17:18:35 GMT","levelName":"phil1","storageLocation":"authorGenerated","lastModificationTime":"Sat, 18 Jan 2014 17:18:35 GMT","levelId":9303},{"creationTime":"Sat, 18 Jan 2014 20:42:46 GMT","levelName":"test3","storageLocation":"authorGenerated","lastModificationTime":"Sat, 18 Jan 2014 20:42:46 GMT","levelId":7653},{"creationTime":"Sun, 19 Jan 2014 23:39:59 GMT","levelName":"trynewone","storageLocation":"authorGenerated","lastModificationTime":"Sun, 19 Jan 2014 23:39:59 GMT","levelId":618},{"creationTime":"Mon, 20 Jan 2014 13:28:53 GMT","levelName":"level7","storageLocation":"authorGenerated","lastModificationTime":"Mon, 20 Jan 2014 13:28:53 GMT","levelId":5618},{"levelBaseName":"Package1","creationTime":"Mon, 20 Jan 2014 15:32:21 GMT","levelName":"8","storageLocation":"authorGenerated","lastModificationTime":"Mon, 20 Jan 2014 15:32:21 GMT","levelId":7007},{"levelBaseName":"Package1","creationTime":"Mon, 20 Jan 2014 15:34:42 GMT","levelName":"77","storageLocation":"authorGenerated","lastModificationTime":"Mon, 20 Jan 2014 15:34:42 GMT","levelId":8783},{"levelBaseName":"Package1","creationTime":"Mon, 20 Jan 2014 15:41:05 GMT","levelName":"88","storageLocation":"authorGenerated","lastModificationTime":"Mon, 20 Jan 2014 15:41:05 GMT","levelId":6213},{"levelBaseName":"Package1","creationTime":"Mon, 20 Jan 2014 15:43:58 GMT","levelName":"99","storageLocation":"authorGenerated","lastModificationTime":"Mon, 20 Jan 2014 15:43:58 GMT","levelId":7733},{"levelBaseName":"Package1","creationTime":"Mon, 20 Jan 2014 15:47:48 GMT","levelName":"888","storageLocation":"authorGenerated","lastModificationTime":"Mon, 20 Jan 2014 15:47:48 GMT","levelId":7187},{"levelName":"leveltest","levelBaseName":"Package1","lastModificationTime":"Mon, 20 Jan 2014 15:49:17 GMT","storageLocation":"authorGenerated","levelId":9004,"creationTime":"Mon, 20 Jan 2014 15:49:17 GMT"}]
ERROR: LevelEditorLogic: no LevelBase loaded - either no LevelLoader defined or the loaded level was not derived from LevelBase as it has no levelData property!?
LevelEditor: exportLevelAsFile is called for filename ' leveltest ' - storing the following levelData to json file: {"entityData":{},"editableComponentData":{},"levelMetaData":{"creationTime":"Mon, 20 Jan 2014 15:49:17 GMT","lastModificationTime":"Mon, 20 Jan 2014 15:49:17 GMT","levelBaseName":"Package1","levelId":9004,"levelName":"leveltest","storageLocation":"authorGenerated"},"customData":{}}
LevelEditor: writing levelData to file was successful: true

and the entityData is empty…

Code Snippet of my LevelEditorScene.qml

    ...
    property alias itemEditor: itemEditor
    ItemEditor {
        id: itemEditor
        opacity: 0.8
        z:1
        visible: false
    }

    property alias levelLoader: levelLoader
    LevelLoader {
        id: levelLoader
        LevelBase {

        }
    }
    // for creating & removing entities
    EntityManager {
        id: entityManager
        entityContainer: scene
        poolingEnabled: true // entity pooling works since version 0.9.4, so use it
        // required for LevelEditor, so the entities can be created by entityType
        dynamicCreationEntityList: [ Qt.resolvedUrl("entities/Platform.qml"), Qt.resolvedUrl("entities/PlatformGoal.qml"), Qt.resolvedUrl("entities/Star.qml")]
    }
    LevelEditor {
        id: levelEditor
        levelLoader: levelLoader
        applicationJSONLevelsDirectory: "JSONLevels/"
        toRemoveEntityTypes: [ "platform", "platformGoal", "stars" ]
        toStoreEntityTypes: [ "platform", "platformGoal", "stars" ]
        Component.onCompleted: {
            //            loadAllLevelsFromStorageLocation(applicationJSONLevelsLocation)
        }
    }
....

my save Button:

      SimpleButton{
            text: "Save Level"
            onClicked: nativeUtils.displayTextInput("Enter level name", "", levelEditor.currentLevelName)
            height: 20
            Connections{
                target: nativeUtils
                onTextInputFinished:{
                    if(accepted){
                        levelEditor.saveCurrentLevel({levelMetaData: {levelName: enteredText, levelBaseName: "Package1"}})
                        levelEditor.exportLevelAsFile(enteredText)
                    }
                }
            }
        }

 

EDIT:

the JSON file is generated, but entityData is empty

 

 

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support