Jump to content

LDD lua console


Tweesee
 Share

Recommended Posts

It was brought to my attention by @WillKirkby that LDD, in developer mode, has a lua console. 

 

If you want to participate in the digging yourself here's a list of commands that have been helpful to us:

Dump the keys of a table:

dumptable = function(foo) local stuff="" for key in pairs(foo) do stuff=stuff .. key .. "\n" end error(stuff) end

Dump the keys of an object/userdata

dumpmetatable = function(foo) dumptable(getmetatable(foo).__index) end

 

Quote

Why can't we use print()?

 

 

I hear your cries and we wish we could too. But the lua console has disabled print so we have to use error(). The issue with error is that it'll break loops. 

 

First poking around in the scripts in the assets.lif, we've found the global variable LDD. This is a table and its contents is as follows:

 

Edit: Recreated the print function sorta. This will terminate loops though.

 

print = function(...) local items = {...} local final = "" for pos, item in pairs (items) do if (pos ~= 1) then final = final .. " " end final = final .. tostring(item) end error(final) end

 

controls
commands
UserHasAccessToBrand
window
GetDeveloperMode
application
brickPalletControl
sceneManager
controlManager
tools
sceneControl
brickDatabase
webCommunicator

So far I've only taken a look at sceneControl. It has these functions:

ResetCamera()
ZoomInOut(number)
RotateUpDown(number Degrees) (Degrees in radians)
RotateLeftRight(number Degrees)
Create(?)
New(?)

There's also a Layout(string LayoutType) function that's not shown in the metatable for some reason.

Calling the function:

LDD.sceneControl:Layout("ViewModeToolbarLayout")	

Gives us a toolbar in the scene. This does allow you to explode models when in build mode.

aO5KrcU.png

 

 

Edit 1:

 

Been dumping the methods and properties of the classes in the tables LDD & ldd. A lot more has to dumped but starting to get somewhere with the LDD.controls.editMode table.

 

LDD
	controls
		editMode
			groupTreeViewControl (UiClass)
				frameAugmentation
				destroy
			infoControl
			templatePaletteContol
			infoControlContainer
			recentModelsContol
			filterControlBox
			materialGridContol
				b1
					tooltipAugmentation
					parent
					OnMouseClicked
					clickSoundAugmentation
					destroy
				b2
				destroy
				popParent
				SetFreebuildMode()
		bgAutomaticMode
			slider (Ui Class)
		viewMode [Empty table?]
		common [Empty table?]
	commands
		editMode
		bgAutomaticMode
		viewMode
		common
	UserHasAccessToBrand() [Possibly broken function]
	window
		IsModal()
		ModalStop()
		SetModal()
		ModalRun()
		Create()
		New()
	GetDeveloperMode()
		returns boolean
	application
		GetBrand()
		SetEditCommand(.?AVCommand@LEGO@@)
		SetBrand(string)
		Import(string, .?AVBrickConnectSceneControl@LEGO@@)
		Create()
		New()
	brickPaletteControl
		ClearFilter()
		GetNumberOfBags()
			returns int
		SetBrickFilterDescription(string)
	sceneManager
		SetDefaultTool(.?AVBrickConnectSceneContolTool@LEGO@@)
		SetCurrentTool(.?AVBrickConnectSceneContolTool@LEGO@@)
		GetCurrentTool(.?AVBrickConnectSceneContolTool@LEGO@@)
		Create()
		New()
	controlManager
		Create()
		New()
		GetModifiers()
		GetKeyboardFocus()
		IsKeyPressed()
		GetWindow()
			returns LDD.window
		GetBackground()
	tools [array of .?AVBrickConnectSceneContolTool@LEGO@@]
		clickPullTool
			Create()
			New()
		hingeTool
			Create()
			New()
		materialItemControl
			Create()
			New()
		materialTool
			Create()
			New()
		noneTool
			Create()
			New()
		sameColorSelectionTool
			Create()
			New()
		cloneTool
			Create()
			New()
		multipleSelectionTool
			Create()
			New()
		moveTool
			Create()
			New()
		sameShapeSelectionTool
			Create()
			New()
		sameColorAndShapeSelectionTool
			Create()
			New()
		decorationTool
			Create()
			New()
		paintBucketTool
			Create()
			New()
		hideTool
			Create()
			New()
		clickStickTool
			Create()
			New()
		colorPickerTool
			Create()
			New()
		singleSelectionTool
			Create()
			New()
		stringPullTool
			Create()
			New()
		deleteTool
			Create()
			New()
	sceneControl
		ResetCamera()
		ZoomInOut(number)
		RotateUpDown(number Degrees)
		RotateLeftRight(number Degrees)
		Layout(string LayoutType)
		Create(?)
		New(?)
	brickDatabase
		Create()
		New()
		GetBrickSetVersion()
	webCommunicator
		Create()
		New()

UiClass:
	GetScale()
	SetPosition()
	SetVisible()
	SetRect()
	SetSize()
	SetLocText()
	ResizeHeightToFitText()
	GetSize()
	SetScale()
	ConnectUpdateObserver()
	SetEnable()
	FitToChildren()
	GetVisible()
	Create()
	Modal
	SetFocus()
	SetImage()
	SetText()
	GetPosition()
	DisconnectUpdateObserver()
	ResizeToFitText()
	SetParent()

ldd
	commands
		showHideCameraControl
			New()
			Do() [Toggles camera control ui]
			control (UiClass)
				keyboardstate
				resetCameraCommand
				controlManagerObserver
				rightButton
				DoControlAction
				isZoomingInOut
				zoomDir
				DoAction
				destroy
				controlState
				isRotatingUpDown
				leftButton
				isRotatingLeftRight
				bottomControlContainer
				cameraControl
				upButton
				saveRectAugmentation
				ActivateCameraControl
				OnUpdate
				rotationDir
				DoKeyboardAction
				lastTime
				StopControlAction
				moving
		about
			Do() [Opens the about window]
			SetEnable()
			Create()
			UpdateEnable()
			GetToggled()
			Toggle()
			GetToggleable()
			New()
			GetEnable()
	cameraContol (UiClass)

_G.BrickDatabase
	New()
	GetBrickSetSetVersion()
	Create()
	Destroy()
	CallMethod()
	FindMember()
	New()

 

There's manipulation of the UI that I would like to do but can't figure out right now.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Tweesee said:

It was brought to my attention by @WillKirkby that LDD, in developer mode, has a lua console. 

 

If you want to participate in the digging yourself here's a list of commands that have been helpful to us:

Dump the keys of a table:


dumptable = function(foo) local stuff="" for key in pairs(foo) do stuff=stuff .. key .. "\n" end error(stuff) end

Dump the keys of an object/userdata


dumpmetatable = function(foo) dumptable(getmetatable(foo).__index) end

 

 

I hear your cries and we wish we could too. But the lua console has disabled print so we have to use error(). The issue with error is that it'll break loops. 

 

First poking around in the scripts in the assets.lif, we've found the global variable LDD. This is a table and its contents is as follows:

 


controls
commands
UserHasAccessToBrand
window
GetDeveloperMode
application
brickPalletControl
sceneManager
controlManager
tools
sceneControl
brickDatabase
webCommunicator

So far I've only taken a look at sceneControl. It has these functions:


ResetCamera()
ZoomInOut(number)
RotateUpDown(number Degrees) (Degrees in radians)
RotateLeftRight(number Degrees)
Create(?)
New(?)

There's also a Layout(string LayoutType) function that's not shown in the metatable for some reason.

Calling the function:


LDD.sceneControl:Layout("ViewModeToolbarLayout")	

Gives us a toolbar in the scene. This does allow you to explode models when in build mode.

aO5KrcU.png

 

 

That's all I've had time to poke around in right now. I'll update this later.

 

(Replying for now because I can't edit)

 

Here's a dump of what I've found so far:

LDD
	controls
		editMode
			groupTreeViewControl
			infoControl
			templatePaletteContol
			infoControlContainer
			recentModelsContol
			filterControlBox
			materialGridContol
		bgAutomaticMode
		viewMode
		common
	commands
		editMode
		bgAutomaticMode
		viewMode
		common
	UserHasAccessToBrand
	window
		IsModal()
		ModalStop()
		SetModal()
		ModalRun()
		Create()
		New()
	GetDeveloperMode()
		returns boolean
	application
		GetBrand()
		SetEditCommand(.?AVCommand@LEGO@@)
		SetBrand(string)
		Import(string, .?AVBrickConnectSceneControl@LEGO@@)
		Create()
		New()
	brickPaletteControl
		ClearFilter()
		GetNumberOfBags()
			returns int
		SetBrickFilterDescription(string)
	sceneManager
		SetDefaultTool(.?AVBrickConnectSceneContolTool@LEGO@@)
		SetCurrentTool(.?AVBrickConnectSceneContolTool@LEGO@@)
		GetCurrentTool(.?AVBrickConnectSceneContolTool@LEGO@@)
		Create()
		New()
	controlManager
		Create()
		New()
		GetModifiers()
		GetKeyboardFocus()
		IsKeyPressed()
		GetWindow()
			returns LDD.window
		GetBackground()
	tools (.?AVBrickConnectSceneContolTool@LEGO@@)
		clickPullTool
			Create()
			New()
		hingeTool
			Create()
			New()
		materialItemControl
			Create()
			New()
		materialTool
			Create()
			New()
		noneTool
			Create()
			New()
		sameColorSelectionTool
			Create()
			New()
		cloneTool
			Create()
			New()
		multipleSelectionTool
			Create()
			New()
		moveTool
			Create()
			New()
		sameShapeSelectionTool
			Create()
			New()
		sameColorAndShapeSelectionTool
			Create()
			New()
		decorationTool
			Create()
			New()
		paintBucketTool
			Create()
			New()
		hideTool
			Create()
			New()
		clickStickTool
			Create()
			New()
		colorPickerTool
			Create()
			New()
		singleSelectionTool
			Create()
			New()
		stringPullTool
			Create()
			New()
		deleteTool
			Create()
			New()
	sceneControl
		ResetCamera()
		ZoomInOut(number)
		RotateUpDown(number Degrees)
		RotateLeftRight(number Degrees)
		Layout(string LayoutType)
		Create(?)
		New(?)
	brickDatabase
		Create()
		New()
		GetBrickSetVersion()
	webCommunicator
		Create()
		New()

UiClass:
	GetScale()
	SetPosition()
	SetVisible()
	SetRect()
	SetSize()
	SetLocText()
	ResizeHeightToFitText()
	GetSize()
	SetScale()
	ConnectUpdateObserver()
	SetEnable()
	FitToChildren()
	GetVisible()
	Create()
	Modal
	SetFocus()
	SetImage()
	SetText()
	GetPosition()
	DisconnectUpdateObserver()
	ResizeToFitText()
	SetParent()

ldd
	commands
		showHideCameraControl
			New()
			Do()
			controls
				keyboardstate
				resetCameraCommand()
	cameraContol (UiClass)

 

  • Like 2
Link to comment
Share on other sites

1 hour ago, Tweesee said:

Gives us a toolbar in the scene. This does allow you to explode models when in build mode.

Oh boy I can't wait to abuse this and potentially bug out LDD :af:

Link to comment
Share on other sites

1 minute ago, Terrev said:

Oh boy I can't wait to abuse this and potentially bug out LDD :af:

 

The exploding just causes the model to fly away, the object remains in the same space. Kinda disappointing because I wanted to drag around exploding parts.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.