@@ -36,6 +36,7 @@ Obj::Obj() : loadObjName("Load Obj"),
3636 errorBuilding(false ),
3737 errorExtracting(false ),
3838 extractingAlocsOrPrims(false ),
39+ blendFileOnlyExtract(false ),
3940 doneExtractingAlocsOrPrims(false ),
4041 doObjHitTest(false ),
4142 meshTypeForBuild(ALOC),
@@ -168,7 +169,12 @@ void Obj::buildObj() {
168169 command += scene.lastLoadSceneFile ;
169170 command += " \" \" " ;
170171 command += settings.outputFolder ;
171- command += " \\ output.obj\" " ;
172+ if (!blendFileOnlyExtract) {
173+ command += " \\ output.obj\" " ;
174+ }
175+ else {
176+ command += " \\ output.blend\" " ;
177+ }
172178 if (meshTypeForBuild == ALOC) {
173179 command += " ALOC " ;
174180 } else {
@@ -284,12 +290,13 @@ void Obj::finalizeObjBuild() {
284290 startedObjGeneration = false ;
285291 objToLoad = settings.outputFolder ;
286292 objToLoad += " \\ " + generatedObjName;
287- loadObj = true ;
293+ loadObj = !blendFileOnlyExtract ;
288294 lastObjFileName = settings.outputFolder ;
289295 lastObjFileName += generatedObjName;
290296 blenderObjStarted = false ;
291297 blenderObjGenerationDone = false ;
292298 sceneExtract.alsoBuildObj = false ;
299+ blendFileOnlyExtract = false ;
293300 }
294301 if (errorBuilding) {
295302 errorBuilding = false ;
@@ -299,6 +306,7 @@ void Obj::finalizeObjBuild() {
299306 objLoaded = false ;
300307 sceneExtract.alsoBuildAll = false ;
301308 sceneExtract.alsoBuildObj = false ;
309+ blendFileOnlyExtract = false ;
302310 }
303311 Menu::updateMenuState ();
304312}
@@ -437,10 +445,21 @@ bool Obj::canBuildObjFromScene() const {
437445 scene.sceneLoaded && !blenderObjStarted && !blenderObjGenerationDone;
438446}
439447
448+ bool Obj::canBuildBlendFromScene () const {
449+ // Currently this is the same as Obj::canBuildObjFromScene.
450+ // Its expected this may change if the blend export includes features OBJ can't handle - like lights.
451+ return Obj::canBuildObjFromScene ();
452+ }
453+
440454void Obj::handleBuildObjFromSceneClicked () {
441455 backgroundWorker.emplace (&Obj::extractAlocsOrPrims, this );
442456}
443457
458+ void Obj::handleBuildBlendFromSceneClicked () {
459+ blendFileOnlyExtract = true ;
460+ backgroundWorker.emplace (&Obj::extractAlocsOrPrims, this );
461+ }
462+
444463void Obj::handleBuildObjFromNavpClicked () {
445464 return buildObjFromNavp (true );
446465}
0 commit comments