# TheHybridUltimateMeshMaker

ZHAW CSharp school project (RG Libstalker)

### Plattforms  
----------------------  
Network (Will be implemented at a later stage, some requirements for paths etc are already set)
Win64  
ConnecterLibrary (Program)   
Blender  
3DsMax (C++ implementation to follow)
UE4  

### Function  
----------------------  
Communication with other programs e.g. Blender and initializing scripts --> asset actions  
Folder watch / control --> Is watching for changes / additions of files in a specific folder and lists these  
Starts automatically or via button press (for demonstration purposes via UI, real world application runs in background)
Multithreading (no UI freezes) --> Will be implemented at a later stage  
Files (move/delete/save)  
Convert to other file formats (fbx/gltf/etc.)  
Automatically create thumbnails --> Will be implemented at a later stage


### UI  
----------------------  
Rating system (stars, points, or the like) --> Will be implemented at a later stage  
To do list --> Output files are to do items  
Automatic information processing  
Statistics --> Will be implemented at a later stage
Browse 3D Processing Application (in our case Blender)
Browse asset input path
Browse asset output path  
Click Start to start automated scripting pipeline


### ZHAW instructions  
----------------------  
23.01.20 Project needs to be (Visual studio solution) handed in until 18:00
24.01.20 Presentation needs to be sent via mail until 12:00

---------------------
---------------------


## Project details

#### Issue:  
During asset conversion from our regular 3D Library (which is optimized for a static rendering workflow) we have a lot of time wasted during asset conversion from our Library (Connecter) into our real time applications.  
There are a lot of small repeating steps during this process which we would like to automate during our CAS project / case study.  

#### Status Quo:  
Open 3D Library (Connecter)  
Open asset from Connecter in 3ds Max  
Export asset from 3ds Max as .fbx / .datasmith / .gltf file --> Including textures for asset
Open newly saved asset within Blender 3D application  
Apply modifiers / Clean asset geometry / Apply transformation / Generate UV Maps / etc..  
Rename and Save asset from Blender  
Import asset into realtime engine  


#### Goal:  
New asset appears in Connecter -> Triggers automated process  
Process:  
Open T.H.U.M.M. program custom UI as per above description  
Open asset from Connecter in 3ds Max --> automated or manual process  
Export asset from 3ds Max as .fbx / .datasmith / .gltf file --> Including textures for asset
Open newly saved asset within Blender 3D application --> Automated C# function  
Apply modifiers / Clean asset geometry / Apply transformation / Generate UV Maps --> Blender script (Python)  
Rename and Save asset from Blender  --> Blender script (Python) save .fbx / .gltf / .blend files  
Save optimized asset in Connecter with different file ending or prefix  

#### Achieved for project:  
Newly copied or generated asset appears in watched folder -> User can triggers automated process  
Process:  
Open T.H.U.M.M. program custom UI as per above description  
Set path location for Blender application and set input / output paths
Click on Start
Open newly saved asset within Blender 3D application --> Automated C# and Python function  
Apply modifiers / Generate UV Maps / Apply Material --> Blender script (Python)  
Rename and Save asset from Blender  --> Blender script (Python) save .blend files  
Save optimized asset in Connecter with different file ending or prefix  

#### Languages:  
C# for main program and functionality  
Python for scripting in Blender  
C++ or MaxScript in 3ds Max --> Will be implemented at a later stage

#### Objects:  
Filewatcher (https://docs.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher?view=netframework-4.8) --> Lists all newly saved files from Connecter  
UI (MainWindow) class has been implemented for manual process
BlenderScript (could have many different scripts running after another / e.g. BlenderScriptModifiers, BlenderScriptUV, etc.) --> Renamed to AddPythonScript
Filewatcher --> Update status of file (is successfully through asset pipeline --> triggers quality control input for user)  
QualityControlUser --> asset needs to be checked manually for quality control purposes  
Filewatcher --> Update status of file (file finished --> remove from list)  

Filepicker opens file in any 3D application --> Removed from project as we can achieve same functionality from Python script
MaxScriptExport --> Will be implemented at a later stage

---------------------------------

``` plantuml
@startuml
title T.H.U.M.M.

package UI
{
  Class Filewatcher_UI
  Filewatcher_UI-->Filewatcher
}
package Filewatcher
{
  Class Filewatcher
  {
    Lists all newly saved files from Connecter
  }
  Class QualityControlUser
  {
    Rating system for user
    Covered through UI
  }
  Class Filewatcher_SomeState
  {
    Saves, moves, changes files
  }
}

Class UnitTest
{
  Unit Tests for Python file creation
  Unit Tests for path directory check
}

Class Multithreading #palered
{
  Not yet implemented
}
note bottom of Multithreading #yellow
  Implementation with 3Ds Max
  and multiple Blender executions
  on server
end note


Package Static
{
  Class PathsLocal
  {
    Localpaths, etc.
  }

  Class PathsNetwork
  {
    Networkpaths, etc.
    Not yet implemented
  }
  note bottom of PathsNetwork #yellow
    Implementation with 3Ds Max
    and multiple Blender executions
    on server
  end note
}


QualityControlUser-->Filewatcher
Filewatcher_SomeState--|>Filewatcher

package Application #LightGreen
{
  Class MainWindowUI
  {
    Start process of any 3D application implemented in code
    ..
    Contains only pure functions
  }
  MainWindowUI..>Filewatcher_SomeState
  MainWindowUI<--Filewatcher_SomeState
}

class BlenderPlugin <<(P,cyan)>>
  {
    Python
  }

  class MaxPlugin <<(P,cyan)>>
  {
    C++
    Will be implemented at later stage
  }


package Blender #Orange
{
  Class Blenderscript
  {
    Runs specific script (python)
  }
  Blenderscript-->BlenderPlugin
}
package 3dsMax #LightBlue
{
  Class MaxScript
  {
    Will be implemented at later stage
    Runs specific script (maxsscript)
  }
  MaxScript-->MaxPlugin
}
Blender<--MainWindowUI
3dsMax<--MainWindowUI



@enduml
```
