Переглянути джерело

Only automatically close Glow info box on success, automatically set static model to lightmap when model has lightmap UV gen enabled

Josh Engebretson 8 роки тому
батько
коміт
3a7f28d339

+ 5 - 4
Script/AtomicEditor/ui/frames/inspector/SelectionSectionCoreUI.ts

@@ -150,14 +150,15 @@ class GlowComponentSectionUI extends SelectionSectionUI {
 
             var glowOutput:GlowOutput;
 
-            glow.subscribeToEvent(Editor.AtomicGlowBakeResultEvent((evData) => {
+            glow.subscribeToEvent(Editor.AtomicGlowBakeResultEvent((evData:Editor.AtomicGlowBakeResultEvent) => {
 
-                if (glowOutput) {
+                if (glowOutput && evData.success) {
                     glowOutput.hide();
-                    glowOutput.close();
-                    glowOutput = null;
+                    glowOutput.close();                    
                 }
 
+                glowOutput = null;
+
                 glow.unsubscribeFromEvent(Editor.AtomicGlowBakeResultEventType);
 
             }));

+ 4 - 1
Source/ToolCore/Assets/ModelImporter.cpp

@@ -85,6 +85,7 @@ bool ModelImporter::ImportModel()
     importer->SetImportNode(importNode_);
     importer->SetImportMaterials(importMaterials_);
     importer->SetIncludeNonSkinningBones(includeNonSkinningBones_);
+    importer->SetGenerateLightmapUV(genLightmapUV_);
 
     if (importer->Load(asset_->GetPath()))
     {
@@ -285,7 +286,9 @@ bool ModelImporter::Import()
 
         }
 
-        importNode_->CreateComponent<StaticModel>()->SetModel(mdl);
+        StaticModel* staticModel = importNode_->CreateComponent<StaticModel>();
+        staticModel->SetModel(mdl);
+        staticModel->SetLightmap(genLightmapUV_);
     }
     else
     {

+ 1 - 0
Source/ToolCore/Import/OpenAssetImporter.cpp

@@ -299,6 +299,7 @@ bool OpenAssetImporter::ExportModel(const String& outName, const String &animNam
     if (!mdl->GetSkeleton().GetNumBones())
     {
         modelComponent = importNode_->CreateComponent<StaticModel>();
+        modelComponent->SetLightmap(genLightmapUV_);
         modelComponent->SetModel(mdl);
     }
     else