[Closed] OBJ export: noprompt partly broken?
Hi,
I’m exporting geometry and materials to an obj-file in 2012. For this I want to use the #noprompt switch to skip editing the export settings. I’ve got an export-preset in place the user shouldn’t adjust. The export should also export the bitmaptextures, which is a normal feature of the exporter. Though for me the bitmaps don’t export when using the #noprompt switch.
--export selected objects to an obj. Make sure you also export maps
theDir = (getdir #temp) + @"/with prompt/"
makedir theDir
exportFile (theDir+ "testBitmapExport.obj") selectedOnly:true
This should work fine, now do the same without the prompt
--export again, now without promt. For me this skips the bitmaps
theDir = (getdir #temp) + @"/without prompt/"
makedir theDir
exportFile (theDir+ "testBitmapExport.obj") #noprompt selectedOnly:true
For me, no bitmaps are exported here. Can anybody confirm this? And does anybody know a workaround so I’m able to use the #noprompt and still export the bitmaps?
i can’t confirm the issue. or i’m missing something. What does export of bitmaptextures mean for you? Is it anything different than the filepath and texture type?
confirmed,
trying to figure out the reason…
*edit:
found it, but you can do noting about that
guruware
What I mean is the following: when exporting an obj-file you can choose to also export the bitmaptextures with it. The result is that you store the obj-file somewhere and all used bitmaptextures are copied to a path relative to the location of the obj-file. You can pick this path, but by default it’s .\maps. An export could be for instance:
[ul]
[li]C:\ emp heObject.obj[/li][li]C:\ emp heObject.mtl[/li][li]C:\ emp\maps\anImage.jpg[/li][/ul]When using #noprompt the images aren’t copied.
confirmed,
trying to figure out the reason…*edit:
found it, but you can do noting about thatguruware
I’m still interested to hear what you found!
what i found is:
a) there is some code inside the dialogs which is not called when using #noprompt, resulting in an empty output-path for maps
b) it is NOT using the current preset with #noprompt (same for import with #noprompt)
it’s a bug and is going to be fixed…
guruware
i see it now… well… but you can always parse .mtl file and copy all source maps to the destination folder.
That’s true Denis. But the mtl file lists the bitmaps on their destination-paths, not where they come from. I was hoping I could avoid that headache. But it’s definitely an option.
Thomas,
that’s interesting
what i found is:
a) there is some code inside the dialogs which is not called when using #noprompt, resulting in an empty output-path for maps
b) it is NOT using the current preset with #noprompt
Would this mean I can adjust another preset it is using? Or is the preset it’s using random?
its using no preset at all, its using default values
the map path will be still empty (undefined) until this thing is fixed
guruware
because the OBJ export/import seems like broken in #noprompt mode anyway i try to do make “NO PROMPT” fake mode using UIAccessor, DialogMonitorOPS, and timer…
tm = dotnetobject "Timer"
tm.Interval = 100
fn onTick s e =
(
if (uiaccessor.getwindowtext s.tag[2]) == undefined do
(
print "CANCEL"
s.Stop()
)
if (uiaccessor.getwindowtext s.tag[2]) == "-= DONE =-" do
(
uiaccessor.pressbutton s.tag[2]
print "DONE"
s.Stop()
)
if keyboard.escpressed do
(
print "ESCAPE"
s.Stop()
)
)
dotnet.addEventHandler tm "Tick" onTick
fn notification =
(
hwnd = DialogMonitorOPS.GetWindowHandle()
text = uiaccessor.getwindowtext hwnd
format ">> % '%'
" hwnd text
case text of
(
"Select File to Export":
(
uiaccessor.pressdefaultbutton()
)
"OBJ Export Options":
(
uiaccessor.pressdefaultbutton()
)
"Exporting OBJ":
(
bt = windows.getchildhwnd hwnd "Cancel Export"
tm.tag = #(hwnd, bt[1])
tm.Start()
)
)
true
)
DialogMonitorOPS.unRegisterNotification id:#exportOBJ
DialogMonitorOPS.RegisterNotification notification id:#exportOBJ
DialogMonitorOPS.Enabled = true
DialogMonitorOPS.ShowNotification()
theDir = (getdir #temp) + @"\with prompt\"
makedir theDir
exportFile (theDir + "testBitmapExport.obj")
tm.Stop()
DialogMonitorOPS.Enabled = off
DialogMonitorOPS.unRegisterNotification id:#exportOBJ
it’s a dirty code… of course every local has to be local, and any debug trace has to be removed.
Hi Denis,
I’ve completely overlooked your workaround. I’ve implemented it in my publisher and it works great.
Thanks for the work you’ve put into this!
Klaas