Editing Custom Blocks Problem



  • Hi,

    I am working on a set of custom blocks that can be used to control a Robosapien and have come across a problem in editing custom blocks.

    I create my custom blocks in the online block maker and then download the .m5b file. My blocks are all 'Execute' type. When I open the .m5b file in UIFlow the blocks appear and can be used quite happily.

    I wanted to add some more blocks so I went to the Block Maker and loaded in my original .mb5 file. I noticed that the block statements had changed in that the "previousStatement": null, "nextStatement": null was missing from all but one of the blocks. Also the blocks label type had been changed from "field_label" to "label" and a new 'name' attribute had been added in args. Obviously, if you download this file then all your blocks are now broken in UIFlow.

    However, the Block Maker interface appeared to have all the original information for each block. So it I click on each block in turn the code is regenerated correctly. It seems that when reading in the .m5b file into Block Maker something is going wrong.

    As an example here is the original code that works in UIFlow.

    // Block __Robosapien_Forward
    var __Robosapien_Forward_json = {
    "previousStatement": null,
    "nextStatement": null,
    "message0": "%1",
    "args0": [
    {
    "type": "field_label",
    "text": "Forward"
    }
    ],
    "colour": "#eb94e5"
    };

    window['Blockly'].Blocks['__Robosapien_Forward'] = {
    init: function() {
    this.jsonInit(__Robosapien_Forward_json);
    }
    };

    window['Blockly'].Python['__Robosapien_Forward'] = function(block) {
    return espnow.send(id=1, data=str(101)) + "\n";
    };

    Here is the same block's code immediately after the .m5b file is re-opened in Block Maker

    // Block __Robosapien_Forward
    var __Robosapien_Forward_json = {
    "args0": [
    {
    "type": "label",
    "text": "Forward",
    "name": "Forward"
    }
    ],
    "message0": "%1",
    "colour": "#eb94e5"
    };

    window['Blockly'].Blocks['__Robosapien_Forward'] = {
    init: function() {
    this.jsonInit(__Robosapien_Forward_json);
    }
    };

    window['Blockly'].Python['__Robosapien_Forward'] = function(block) {
    return espnow.send(id=1, data=str(101)) + "\n";
    };

    Thank you for all the hard work you put in to developing these tools .



  • This problem i realized with the desktop version of UIFlow, therefore i used only the online version.