I have a cmd line script to help me with mass exporting models into a folder for blender renders.
The script using PluginManager:ExportSelection(PATH) to achieve this, my issue is with file naming, my initial thought was that {PATH}/{model.Name} would auto fill the file manager window with a name for the .obj file and all I had to do was press Save. But for some reason doing this completely breaks the PATH and it defaults to Documents file.
I was wondering if my approach was incorrect or does this feature just not exist for auto filling file names. The sole reason I want to know this is because on massive exports it can be time consuming to check and name all the files.
So in short the expected behvaiour I was hoping for was that it correctly detect file PATH and auto fills the File Name with model.Name
local UserInputService = game:GetService("UserInputService")
local CAPSULE_MODELS = workspace:FindFirstChild("Capsules")
local EXPORT_PATH = "C:/Users/work/Documents/Renders/Capsules/Exports"
local VIEW_YAW = -36
local RENDER_CAMERA_YAW = 46.7
local VIEW_ANGLE = CFrame.Angles(0, math.rad(RENDER_CAMERA_YAW - VIEW_YAW), 0)
if not CAPSULE_MODELS then
warn("No Capsules folder in Workspace!")
return
end
local originalNames = {}
-- selene: allow(undefined_variable)
local pluginManager = PluginManager()
local capsules = {}
for _, child in CAPSULE_MODELS:GetChildren() do
if child:IsA("Model") then
table.insert(capsules, child)
end
end
table.sort(capsules, function(a, b)
return a.Name < b.Name
end)
local function exportCapsule(model: Model)
local originalCFrame = model:GetPivot()
local center = model:GetBoundingBox().Position
local pivotOffset = CFrame.new(center):ToObjectSpace(originalCFrame)
model:PivotTo(VIEW_ANGLE * pivotOffset)
for index, child in model:GetDescendants() do
if child:IsA("BasePart") then
originalNames[child] = child.Name
child.Name = model.Name .. tostring(index)
end
end
game.Selection:Set({ model })
pluginManager:ExportSelection(`{EXPORT_PATH}/{model.Name}`)
UserInputService.InputBegan:Wait()
for child, name in originalNames do
child.Name = name
originalNames[child] = nil
end
model:PivotTo(originalCFrame)
end
for index, capsule in capsules do
exportCapsule(capsule)
print(`Exported {index}/{#capsules} capsules ({capsule.Name})`)
end
print(`✅ Done! {#capsules} capsules exported as .obj files to {EXPORT_PATH}.`)
With model name.
Without model name.
I also tried {model.Name}.obj and it still does not work.

