Skip to content

Create a custom editor mode

Nako Sung edited this page May 3, 2016 · 2 revisions

To create a custom editor mode:

const StyleSetName = 'JSEdmode'
const UMG = require('UMG')
const instantiator = require('instantiator')

module.exports = function () {
	console.log("HELLO")
	let edmode = new JavascriptEdMode()
	edmode.ModeId = "JSMode"
	edmode.ModeName = "JSMode"
	edmode.SlateIcon = {
		StyleSetName : 'UnrealJS',
		StyleName : 'SpiralGenerator.Purge',
	} 
	edmode.bVisible = true
	edmode.PriorityOrder = 999
	edmode.OnGetContent = _ => {
		var design = UMG.div({},
			UMG.text({},"Hello UMG 123"),
			UMG(Button,{OnClicked:_ => console.log("CLICK")},"Hello")
		)
		return instantiator(design)
	}
	edmode.Register()
	global.edmode = edmode
	console.log("HELLO")
	return _ => { 
		edmode.Unregister()
	}
}

Look at JavascriptEdMode.h and JavascriptEdMode.cpp to learn more about creating custom EdModes.

Clone this wiki locally