Skip to content

Instantly share code, notes, and snippets.

@AndrewHazelden
Last active August 28, 2025 06:34
Show Gist options
  • Save AndrewHazelden/2d9db9f85ce8cedf6a7c042cfef24f66 to your computer and use it in GitHub Desktop.
Save AndrewHazelden/2d9db9f85ce8cedf6a7c042cfef24f66 to your computer and use it in GitHub Desktop.
Gaussian Splatting DragDrop.fu
--[[--
Gaussian Splatting DragDrop - 2025-08-27
Overview:
This Resolve/Fusion add-on allows you to drag and drop .ply files into the Fusion nodes view.
An Irrealix GaussianSplatting OFX node is then added to the comp automatically.
The PLY filepath information is then added to the "Model 1" section.
Installation:
1. Copy the "Gaussian Splatting DragDrop.fu" file into the Fusion user preferences "Config" PathMap folder.
Fusion Studio Install Location:
Windows:
%AppData%\Blackmagic Design\Fusion\Config\
Linux:
$HOME/.fusion/BlackmagicDesign/Fusion/Config\
MacOS:
$HOME/Library/Application Support/Blackmagic Design/Fusion/Config/
Resolve Studio Install Location:
Windows:
%AppData%\Blackmagic Design\DaVinci Resolve\Fusion\Config\
Linux:
$HOME/.fusion/BlackmagicDesign/DaVinci Resolve/Fusion/Config/
MacOS:
$HOME/Library/Application Support/Blackmagic Design/DaVinci Resolve/Fusion/Config/
2. Relaunch Resolve/Fusion.
--]]--
{
Event{
Action = 'Drag_Drop',
Targets = {
FuView = {
Execute = _Lua [=[
-- Check if the file extension matches
-- Example: isIFL = MatchExt('/Example.ply', '.ply')
function MatchExt(file, fileType)
-- Get the file extension
local ext = string.match(tostring(file), '^.+(%..+)$')
-- Compare the results
if (ext ~= nil) and (fileType ~= nil) and (string.lower(ext) == string.lower(tostring(fileType))) then
return true
else
return false
end
end
-- Get the current comp object
-- Example: comp = GetCompObject()
function GetCompObject()
local cmp = app:GetAttrs().FUSIONH_CurrentComp
return cmp
end
-- Process a file dropped into Fusion
-- Example: ProcessFile('/Example.ply', 1)
function ProcessFile(file, fileNum)
-- comp:Print('[GaussianSplatting]['.. fileNum .. '][File Drop] ', file, '\n')
-- Check if the file extension matches
if MatchExt(file, '.ply') then
-- Accept the Drag and Drop event
rets.handled = true
-- Get the current comp object
comp = GetCompObject()
if not comp then
-- The comp pointer is undefined
comp:Print('[GaussianSplatting] Please open a Fusion composite before dragging in a .ply file again.')
return
end
-- Lock the comp to suppress any file dialog opening for nodes that have empty filename fields.
comp:Lock()
-- Add the vTextFromFile node to the comp
local node = comp:AddTool('ofx.com.irrealix.GaussianSplatting', -32768, -32768)
-- Add a new undo history item
comp:StartUndo('Add GaussianSplatting')
-- Check for a nil on the node creation and the filename string
if node and file then
-- Add the PLY filename to the Model 1 section
node.Model1_model = tostring(file)
-- Expand the Model 1 collapsable section in the Inspector window
node.Model1 = 1
else
comp:Print('[GaussianSplatting] Warning: Failed to update the model1 filename.')
end
-- Unlock the comp to restore "normal" file dialog opening operations
comp:Unlock()
-- Close off the undo history item block
comp:EndUndo(True)
end
end
-- Where the magic begins
function Main()
-- Call other chained events and default action
rets = self:Default(ctx, args)
-- Debug print the args
-- dump(args)
-- Drop zone screen coordinates
mousex = args._sxpos
mousey = args._sypos
-- No one else handled this?
if not rets.handled then
-- Get the list of files dropped onto Fusion
files = args.urilist
-- Scan through each of the files
for i, file in ipairs(files) do
-- Process a .ply file dropped into Fusion
ProcessFile(file, i)
end
end
-- Debug print where the file was dropped onscreen in the window (using screen coordinates)
-- print('[Drop Zone Coords] [X] ' .. tostring(mousex) .. ' [Y] ' .. tostring(mousey) .. 'px')
-- print('\n')
end
-- Run the main function
Main()
]=],
},
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment