Would StartDrag also work?
EDIT: A bunch of drag/drop events and functions were added in one of the previous releases: Release Notes for 366 - #2 by Maximum_ADHD
Would StartDrag also work?
EDIT: A bunch of drag/drop events and functions were added in one of the previous releases: Release Notes for 366 - #2 by Maximum_ADHD
Nope - the datatype is incorrect, so this function is unusable - I tested it with my plugin with no good results.
Not even sure what the drag function would be used for.
The toolbox uses StartDrag
when you drag and drop models from the catalog onto workspace:
function InsertAsset.dragInsertAsset(options)
local assetId = options.assetId
local assetName = options.assetName
if DebugFlags.shouldDebugWarnings() then
print(("Inserting asset %s %s"):format(tostring(assetId), tostring(assetName)))
end
ChangeHistoryService:SetWaypoint(("Before insert asset %d"):format(assetId))
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)
if success then
ChangeHistoryService:SetWaypoint(("After insert asset %d"):format(assetId))
sendInsertionAnalytics(options)
-- TODO CLIDEVSRVS-1689: For AssetInsertionTracker.trackInsert with dragged
-- asset, need to listen for dropped event on 3d view which
-- depends on viewports api
-- TODO CLIDEVSRVS-1246: If they cancel the drag, this probably shouldn't be called?
options.onSuccess(assetId)
else
warn(("Toolbox failed to drag asset %d %s: %s"):format(assetId, assetName, errorMessage or ""))
end
return success
end
StartDrag accepts a dictionary, so you should be able to do a whole lot with it.
Hopefully there will be some documentation available for this soon.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.