Allow user plugins to tell when Plugin:StartDrag() is dropped into the viewport

As a Roblox developer, it is currently too hard to create more interactive plugins with Roblox Studio’s viewport.

A few months ago I was working on a potential feature for one of my plugins that involved dragging a lighting preset from my plugin into Roblox Studio’s viewport to apply said preset. The issue I ran into was that there was no way to tell for certain if a drag ended up being dropped into the viewport or not.

The video below is an example use case:

A month ago, ViewportDragDropped, ViewportDragEntered, and ViewportDragLeft were added to the API, but they are locked behind RobloxScriptSecurity and cannot be used by user plugins.

If Roblox is able to address this issue, it would improve my development experience because I could implement simple features for my plugins involving dragging into the viewport.

5 Likes

I dug into a 2019 Toolbox’s code to see how they detect the viewport asset drag and drop thing, but apparently that’s hardcoded:

local success, errorMessage = pcall(function()
	-- Mark the toolbox as using the C++ drag handler implementation
	-- That will insert the given asset and drag it in the 3d view
	options.plugin.UsesAssetInsertionDrag = true
	-- TODO CLIDEVSRVS-1246: This should use uri list or something
	local url = Urls.constructAssetGameAssetIdUrl(
		assetId,
		options.assetTypeId,
		Category.categoryIsPackage(options.categoryIndex)
	)
	if DebugFlags.shouldDebugUrls() then
		print(("Dragging asset url %s"):format(url))
	end
	options.plugin:StartDrag({
		Sender = "LuaToolbox",
		MimeType = "text/plain",
		Data = url,
	})
end)

So I support your request to the brim.