forked from cgvr/DeltaVR
pipeline script passes generated model filepath to Unity
This commit is contained in:
parent
f8ca8570af
commit
1b0d9fd0b0
@ -104,7 +104,8 @@ def main():
|
||||
print(f"Generated image file: {image_path}")
|
||||
model_path = pipeline_folder / "models" / timestamp
|
||||
image_to_3d(image_path, model_path)
|
||||
print(f"Generated 3D model file: {model_path}")
|
||||
model_file_path = model_path / "0" / "mesh.glb"
|
||||
print(f"Generated 3D model file: {model_file_path}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -45,15 +45,17 @@ public class ModelGenerationPipelineStarter : MonoBehaviour
|
||||
|
||||
private async void StartModeGenerationPipeline()
|
||||
{
|
||||
string modelPath = null;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
string inputPrompt = "Uhm I want I think an epic broadsword with a fancy golden pommel";
|
||||
|
||||
// Path to your virtual environment's python.exe
|
||||
string pythonExe = @"D:\users\henrisel\DeltaVR3DModelGeneration\3d-generation-pipeline\.venv\Scripts\python.exe";
|
||||
string pythonExe = @"D:\henrisel\DeltaVR3DModelGeneration\3d-generation-pipeline\.venv\Scripts\python.exe";
|
||||
|
||||
// Path to your Python script
|
||||
string scriptPath = @"D:\users\henrisel\DeltaVR3DModelGeneration\3d-generation-pipeline\start_pipeline.py";
|
||||
string scriptPath = @"D:\henrisel\DeltaVR3DModelGeneration\3d-generation-pipeline\start_pipeline.py";
|
||||
|
||||
// Arguments to pass to the script
|
||||
string arguments = $"{scriptPath} --prompt \"{inputPrompt}\"";
|
||||
@ -75,12 +77,38 @@ public class ModelGenerationPipelineStarter : MonoBehaviour
|
||||
process.ErrorDataReceived += (sender, e) => UnityEngine.Debug.LogError(e.Data);
|
||||
|
||||
process.Start();
|
||||
process.BeginOutputReadLine();
|
||||
process.BeginErrorReadLine();
|
||||
|
||||
string output = process.StandardOutput.ReadToEnd();
|
||||
string error = process.StandardError.ReadToEnd();
|
||||
|
||||
process.WaitForExit();
|
||||
|
||||
|
||||
// Extract model path from output
|
||||
foreach (string line in output.Split('\n'))
|
||||
{
|
||||
if (line.StartsWith("Generated 3D model file: "))
|
||||
{
|
||||
modelPath = line.Replace("Generated 3D model file: ", "").Trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(modelPath))
|
||||
{
|
||||
//LoadModel(modelPath);
|
||||
UnityEngine.Debug.Log("Got generated model path: " + modelPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.Debug.LogError("Model path not found in Python output.");
|
||||
}
|
||||
});
|
||||
|
||||
UnityEngine.Debug.Log("Python script finished!");
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user