├── Unity ├── CMakeLists.txt ├── DazStudioPlugin │ ├── DzUnityBridge.rc │ ├── pluginmain.cpp │ ├── DzUnityBridge.aps │ ├── Resources │ │ ├── Images │ │ │ └── Icon.png │ │ └── ScriptFunctionFindSimulationSettingsProvider.dsa │ ├── DzUnityBridge.def │ ├── version.h │ ├── DzUnityAction.h │ ├── DzUnitySubdivisionDialog.h │ ├── README.md │ ├── DzUnityDialog.h │ ├── CMakeLists.txt │ └── DzUnityMorphSelectionDialog.h └── UnityPlugin │ ├── Resources │ ├── UnofficialDTU_Logo_TextOnly.png │ ├── ReadMe.txt.meta │ ├── G8F Collision Rig.prefab.meta │ └── UnofficialDTU_Logo_TextOnly.png.meta │ ├── Resources.meta │ ├── Scripts.meta │ ├── Shaders.meta │ ├── Vendors.meta │ ├── Scripts │ ├── Editor.meta │ ├── ClothTools.cs.meta │ ├── Utilities.cs.meta │ ├── Daz3DInstance.cs.meta │ ├── CollapsedVertexArray.cs.meta │ ├── Editor │ │ ├── DTUConverter.cs.meta │ │ ├── Daz3DBridge.cs.meta │ │ ├── DazCoroutine.cs.meta │ │ ├── DazJSONHelper.cs.meta │ │ ├── ClothToolsEditor.cs.meta │ │ ├── Daz3DDTUImporter.cs.meta │ │ ├── DetectRenderPipeline.cs.meta │ │ ├── ClothCollisionAssignerEditor.cs.meta │ │ ├── ClothCollisionAssignerEditor.cs │ │ ├── DazCoroutine.cs │ │ ├── DazJSONHelper.cs │ │ ├── DetectRenderPipeline.cs │ │ └── ClothToolsEditor.cs │ ├── ClothCollisionAssigner.cs.meta │ ├── Utilities.cs │ ├── Daz3DInstance.cs │ ├── ClothCollisionAssigner.cs │ └── CollapsedVertexArray.cs │ ├── Shaders │ ├── CGInc.meta │ ├── Helpers.meta │ ├── UnofficialDTU.meta │ ├── Invisible.shader.meta │ ├── Built-In Hair.shader.meta │ ├── Built-In Wet.shader.meta │ ├── CGInc │ │ ├── DazStandardCore.cginc.meta │ │ ├── DazStandardMeta.cginc.meta │ │ ├── DazStandardInput.cginc.meta │ │ ├── DazStandardShadow.cginc.meta │ │ ├── DazStandardCoreForward.cginc.meta │ │ ├── DazStandardCoreForward.cginc │ │ ├── DazStandardMeta.cginc │ │ ├── DazStandardShadow.cginc │ │ └── DazStandardInput.cginc │ ├── Built-In IrayUberMetal.shader.meta │ ├── Built-In IrayUberSkin.shader.meta │ ├── Built-In IrayUberSpec.shader.meta │ ├── Helpers │ │ ├── GetLightDirection.hlsl.meta │ │ ├── LightDirection.shadersubgraph.meta │ │ ├── GetLightDirection.hlsl │ │ └── LightDirection.shadersubgraph │ ├── UnofficialDTU │ │ ├── GetLightDirectionURP.hlsl.meta │ │ ├── uDTU HDRP.SSS.shadergraph.meta │ │ ├── uDTU URP.SSS.shadergraph.meta │ │ ├── LightDirectionURP.shadersubgraph.meta │ │ ├── uDTU HDRP.Metallic.shadergraph.meta │ │ ├── uDTU HDRP.Specular.shadergraph.meta │ │ ├── uDTU URP.Metallic.shadergraph.meta │ │ ├── uDTU URP.Specular.shadergraph.meta │ │ ├── uDTU URP.Transparent.shadergraph.meta │ │ ├── uDTU.Sub.Base.shadersubgraph.meta │ │ ├── uDTU.Sub.TopCoat.shadersubgraph.meta │ │ ├── uDTU.Sub.MetallicMix.shadersubgraph.meta │ │ ├── uDTU.Sub.SpecularMix.shadersubgraph.meta │ │ ├── uDTU.Sub.DualLobeSpecular.shadersubgraph.meta │ │ ├── uDTU.Sub.SubSurfaceScatter.shadersubgraph.meta │ │ ├── uDTU.Sub.TranslucencyMask.shadersubgraph.meta │ │ ├── uDTU.Sub.AlternativeSpecularMix.shadersubgraph.meta │ │ ├── uDTU.Sub.GlossyLayeredEffect.shadersubgraph.meta │ │ └── GetLightDirectionURP.hlsl │ ├── Hair.shadergraph.meta │ ├── Wet.shadergraph.meta │ ├── URP Hair.shadergraph.meta │ ├── URP Wet.shadergraph.meta │ ├── IrayUberMetal.shadergraph.meta │ ├── IrayUberSkin.shadergraph.meta │ ├── IrayUberSpec.shadergraph.meta │ ├── URP IrayUberMetal.shadergraph.meta │ ├── URP IrayUberSkin.shadergraph.meta │ ├── URP IrayUberSpec.shadergraph.meta │ └── Invisible.shader │ ├── DiffusionProfiles.meta │ ├── DiffusionProfiles │ ├── GenericDiffusionProfile.asset.meta │ ├── IrayUberSkinDiffusionProfile.asset.meta │ ├── GenericDiffusionProfile.asset │ └── IrayUberSkinDiffusionProfile.asset │ └── Vendors │ └── SimpleJSON.cs.meta ├── Unreal ├── CMakeLists.txt ├── DazStudioPlugin │ ├── icon.png │ ├── DzUnrealBridge.rc │ ├── DzUnrealBridge.def │ ├── version.h │ ├── pluginmain.cpp │ ├── DzUnrealAction.h │ ├── DzUnrealSubdivisionDialog.h │ ├── CMakeLists.txt │ ├── DzUnrealDialog.h │ ├── README.md │ ├── DzUnrealMorphSelectionDialog.h │ ├── DzUnrealSubdivisionDialog.cpp │ └── DzUnrealAction.cpp └── UnrealPlugin │ ├── DazToUnreal │ ├── Resources │ │ ├── Icon128.png │ │ ├── Logo-40px.png │ │ └── ButtonIcon-40px.png │ ├── Content │ │ ├── BoneMapping.uasset │ │ ├── BaseMaterial.uasset │ │ ├── DazParameters.uasset │ │ ├── BaseHairMaterial.uasset │ │ ├── BaseSkinMaterial.uasset │ │ ├── DSDBaseMaterial.uasset │ │ ├── NoDrawMaterial.uasset │ │ ├── omUberParameters.uasset │ │ ├── BaseAlphaMaterial.uasset │ │ ├── BaseMaskedMaterial.uasset │ │ ├── BaseScalpMaterial.uasset │ │ ├── IrayUberParameters.uasset │ │ ├── omUberBaseMaterial.uasset │ │ ├── omUberSkinMaterial.uasset │ │ ├── BaseSSSSkinMaterial.uasset │ │ ├── Genesis3BaseSkeleton.uasset │ │ ├── Genesis8BaseSkeleton.uasset │ │ ├── IrayUberBaseMaterial.uasset │ │ ├── IrayUberSkinMaterial.uasset │ │ ├── SkinSubsurfaceProfile.uasset │ │ ├── AoASubsurfaceParameters.uasset │ │ ├── BaseMaterialTessellated.uasset │ │ ├── Genesis3JCMPostProcess.uasset │ │ ├── Genesis3ToHumanoidPose.uasset │ │ ├── Genesis8JCMPostProcess.uasset │ │ ├── Genesis8ToHumanoidPose.uasset │ │ ├── AoASubsurfaceBaseMaterial.uasset │ │ ├── AoASubsurfaceSkinMaterial.uasset │ │ └── SSSTextures │ │ │ └── Genesis3Female │ │ │ └── FaceSSSTransparency.uasset │ ├── Source │ │ └── DazToUnreal │ │ │ ├── Public │ │ │ ├── DazToUnrealUtils.h │ │ │ ├── DazToUnrealEnums.h │ │ │ ├── DazToUnrealTextures.h │ │ │ ├── DazToUnrealStyle.h │ │ │ ├── DazToUnrealFactory.h │ │ │ ├── DazToUnrealCommands.h │ │ │ ├── DazToUnrealMaterials.h │ │ │ ├── DazToUnrealFbx.h │ │ │ └── DazToUnreal.h │ │ │ ├── Private │ │ │ ├── DazToUnrealUtils.cpp │ │ │ ├── DazToUnrealCommands.cpp │ │ │ ├── DazToUnrealFactory.cpp │ │ │ ├── DazToUnrealStyle.cpp │ │ │ ├── DazToUnrealFbx.cpp │ │ │ └── DazToUnrealTextures.cpp │ │ │ └── DazToUnreal.Build.cs │ └── DazToUnreal.uplugin │ └── README.md ├── LICENSE ├── Common ├── CMakeLists.txt ├── OpenFBXInterface.h ├── DzRuntimePluginAction.h ├── OpenSubdivInterface.h ├── OpenFBXInterface.cpp └── DzRuntimePluginAction.cpp └── CMakeLists.txt /Unity/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory("DazStudioPlugin") -------------------------------------------------------------------------------- /Unreal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory("DazStudioPlugin") -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/DazStudioPlugin/icon.png -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/DzUnityBridge.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unity/DazStudioPlugin/DzUnityBridge.rc -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/pluginmain.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unity/DazStudioPlugin/pluginmain.cpp -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/DzUnityBridge.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unity/DazStudioPlugin/DzUnityBridge.aps -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/DzUnrealBridge.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/DazStudioPlugin/DzUnrealBridge.rc -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/Resources/Images/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unity/DazStudioPlugin/Resources/Images/Icon.png -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Resources/Icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Resources/Icon128.png -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/DzUnityBridge.def: -------------------------------------------------------------------------------- 1 | LIBRARY dzunrealbridge 2 | EXPORTS 3 | getSDKVersion @1 4 | getPluginDefinition @2 5 | SECTIONS 6 | .data READ WRITE -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/DzUnrealBridge.def: -------------------------------------------------------------------------------- 1 | LIBRARY dzunrealbridge 2 | EXPORTS 3 | getSDKVersion @1 4 | getPluginDefinition @2 5 | SECTIONS 6 | .data READ WRITE -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Resources/Logo-40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Resources/Logo-40px.png -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/BoneMapping.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/BoneMapping.uasset -------------------------------------------------------------------------------- /Unity/UnityPlugin/Resources/UnofficialDTU_Logo_TextOnly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unity/UnityPlugin/Resources/UnofficialDTU_Logo_TextOnly.png -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/BaseMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/BaseMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/DazParameters.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/DazParameters.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/BaseHairMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/BaseHairMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/BaseSkinMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/BaseSkinMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/DSDBaseMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/DSDBaseMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/NoDrawMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/NoDrawMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/omUberParameters.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/omUberParameters.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Resources/ButtonIcon-40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Resources/ButtonIcon-40px.png -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/BaseAlphaMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/BaseAlphaMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/BaseMaskedMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/BaseMaskedMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/BaseScalpMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/BaseScalpMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/IrayUberParameters.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/IrayUberParameters.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/omUberBaseMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/omUberBaseMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/omUberSkinMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/omUberSkinMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/BaseSSSSkinMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/BaseSSSSkinMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/Genesis3BaseSkeleton.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/Genesis3BaseSkeleton.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/Genesis8BaseSkeleton.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/Genesis8BaseSkeleton.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/IrayUberBaseMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/IrayUberBaseMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/IrayUberSkinMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/IrayUberSkinMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/SkinSubsurfaceProfile.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/SkinSubsurfaceProfile.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/AoASubsurfaceParameters.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/AoASubsurfaceParameters.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/BaseMaterialTessellated.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/BaseMaterialTessellated.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/Genesis3JCMPostProcess.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/Genesis3JCMPostProcess.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/Genesis3ToHumanoidPose.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/Genesis3ToHumanoidPose.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/Genesis8JCMPostProcess.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/Genesis8JCMPostProcess.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/Genesis8ToHumanoidPose.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/Genesis8ToHumanoidPose.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/AoASubsurfaceBaseMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/AoASubsurfaceBaseMaterial.uasset -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/AoASubsurfaceSkinMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/AoASubsurfaceSkinMaterial.uasset -------------------------------------------------------------------------------- /Unity/UnityPlugin/Resources/ReadMe.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de4adb36be8419d4fb63f6bbde810978 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6de96c047b5124c4c887da9b6f70fb18 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b433a4696f536b04db23a9b74fd91757 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0706b9bc62d5e4c41ba6906acf313497 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Vendors.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8b39bf93458a32499961d014352435f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Content/SSSTextures/Genesis3Female/FaceSSSTransparency.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielbui78/UDTU/HEAD/Unreal/UnrealPlugin/DazToUnreal/Content/SSSTextures/Genesis3Female/FaceSSSTransparency.uasset -------------------------------------------------------------------------------- /Unity/UnityPlugin/Resources/G8F Collision Rig.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1152a6942b99664498eebf27b04fea67 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f570144dc392744592c526d6b96a19f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/CGInc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c705c45340b9cc4099d8319ef6f4dc8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Helpers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25ad288911486dc419b76429b97ac413 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/DiffusionProfiles.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 34c911f16fe68834fb5f40ab25e811b7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15a8e1dd39ed98f4284c52800324e098 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealUtils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | 5 | 6 | class FDazToUnrealUtils 7 | { 8 | public: 9 | static FString SanitizeName(FString OriginalName); 10 | }; -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealEnums.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum DazCharacterType 4 | { 5 | Genesis1, 6 | Genesis3Male, 7 | Genesis3Female, 8 | Genesis8Male, 9 | Genesis8Female, 10 | Unknown 11 | }; 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/DiffusionProfiles/GenericDiffusionProfile.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 552ebd10c98753b4892491a7040b8920 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Invisible.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c046d5f3ea74ec24c898eb60c5f939c3 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Built-In Hair.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9689360da2668e34f8660424559d2210 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Built-In Wet.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c6faf90b39d8214585ca29f35a1cf43 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/CGInc/DazStandardCore.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f74a285bed439ba44bbe5a674d629c34 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/CGInc/DazStandardMeta.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05ca7b66c0ba67c448ec76ea3e6061f3 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Built-In IrayUberMetal.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9c3afa2dfcc78b49b9bd35519d3414e 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Built-In IrayUberSkin.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f14b70b9bf6863640b3a8db1dc137ef2 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Built-In IrayUberSpec.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e85ed1c41c399e448a61e3da9fad9338 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/CGInc/DazStandardInput.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfc62c2a83c181c4fb912c4333abe28c 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/CGInc/DazStandardShadow.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0717ddc5c1f9e7449871fa444e709182 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Helpers/GetLightDirection.hlsl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d498a2cd0ac51b488428a5956eee76d 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/CGInc/DazStandardCoreForward.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5fe0dbd6a694cf48938d4c37b8622cd 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/GetLightDirectionURP.hlsl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f287064306441e742a05e0b3cfb7a4a6 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "dzversion.h" 3 | 4 | // Version number for UnofficialDTU 5 | #define PLUGIN_MAJOR 1 6 | #define PLUGIN_MINOR 2 7 | #define PLUGIN_REV 0 8 | #define PLUGIN_BUILD 7 9 | 10 | #define PLUGIN_VERSION DZ_MAKE_VERSION( PLUGIN_MAJOR, PLUGIN_MINOR, PLUGIN_REV, PLUGIN_BUILD ) 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/ClothTools.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca56b19cbb5048c469eb0727b9996e9f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Utilities.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 114898605ae403341b03ca36d541c740 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Vendors/SimpleJSON.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1473585defe6dd446b3e27502657221b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "dzversion.h" 3 | 4 | // Version number for DazToUnreal 5 | #define PLUGIN_MAJOR 1 6 | #define PLUGIN_MINOR 0 7 | #define PLUGIN_REV 0 8 | #define PLUGIN_BUILD 1 9 | 10 | #define PLUGIN_VERSION DZ_MAKE_VERSION( PLUGIN_MAJOR, PLUGIN_MINOR, PLUGIN_REV, PLUGIN_BUILD ) 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Daz3DInstance.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 67944b0ffc523774b82e212e3307657a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/CollapsedVertexArray.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62b7ba0c93dd725489c7ba1e1003f66f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/DTUConverter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 888a91250991c2446b0297ffe00a6e46 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/Daz3DBridge.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41b5f2cc26d29014982fba9f6fc29c3c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/DazCoroutine.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83ba3e1fe9d891d4aafd8b10601e51c9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/DazJSONHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf8bec82401c6eb47a5ef0128d134fc0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/ClothCollisionAssigner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f94c972f9cb764449bb5b8d87e72a9dd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/ClothToolsEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d931b53394f92c44ca2c1264a9dc9f88 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/Daz3DDTUImporter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9ffe7386ac495249a335184f579b2de 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealTextures.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "DazToUnrealEnums.h" 5 | 6 | 7 | 8 | class FDazToUnrealTextures 9 | { 10 | public: 11 | static FString GetSubSurfaceAlphaTexture(const DazCharacterType CharacterType, const FString& MaterialName); 12 | }; -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/DetectRenderPipeline.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c856d1a43f2b2643a6754fbb4e580d9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/ClothCollisionAssignerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c72016c772ee8d046bd0fb2333dbdd7d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Hair.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed6594a0dbb96cc42ae4bf8e9dba1784 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Wet.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fc7872334a31ba4e91ed973967cf3f9 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/URP Hair.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63d7be0835d1e324b8d4cb752ccb2b53 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/URP Wet.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f87ea70fecfb3154f92f67d0dbe53cb4 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/IrayUberMetal.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9793753ee9477c4bb2e37bf97e92272 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/IrayUberSkin.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ff647fecfd0ef24e82997c3606188d6 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/IrayUberSpec.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09280686f04c105459daf62fbe40bce6 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/URP IrayUberMetal.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5d46303fe94693489c534af4e8f1ebd 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/URP IrayUberSkin.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07bff71065145a247a6f1753eb588e34 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/URP IrayUberSpec.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b41c09bad8e323a45a23edea43224784 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Helpers/LightDirection.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40214558ca16f5048a1d754ba06c4a2c 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU HDRP.SSS.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a003f09bc8825a048839f5c00ce6be45 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU URP.SSS.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8956ca4dad2298409844f795adcc87a 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/LightDirectionURP.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 736dbbc5b50d971448241972ec6e8c4d 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU HDRP.Metallic.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6d20aba7cd04764687c737988e08a2c 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU HDRP.Specular.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63cc86936b4837044aa6b34c7c29d8e5 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU URP.Metallic.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7c269126325f424ea6e1c469b57b240 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU URP.Specular.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05d4c51f44017bb40b1d2a7a7951c4b3 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU URP.Transparent.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27bff13fafc66434e8033bf2e4d119f3 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU.Sub.Base.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02c03d236c64dfe4488e1d8153d2c141 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU.Sub.TopCoat.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 716e9ece6380cb940bc70d2f4617c8b1 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU.Sub.MetallicMix.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4eece1b4a7c58443a4d92c960d67abc 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU.Sub.SpecularMix.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: debc2f8325bebaa4b8e1b742727de6a6 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU.Sub.DualLobeSpecular.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 820ebec3841492f4b862e05bc9f8fe69 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU.Sub.SubSurfaceScatter.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff4238311ea3ad741b249ff31bf8b239 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU.Sub.TranslucencyMask.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fcdf7b528c75ed145b880ba7d1dd782c 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU.Sub.AlternativeSpecularMix.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6eeb53e97f023c48a8cb79b7158eca4 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/uDTU.Sub.GlossyLayeredEffect.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 365ce85fd3f3f814e874bc06c42137e2 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/pluginmain.cpp: -------------------------------------------------------------------------------- 1 | #include "dzplugin.h" 2 | #include "dzapp.h" 3 | 4 | #include "version.h" 5 | #include "DzUnrealAction.h" 6 | #include "DzUnrealDialog.h" 7 | 8 | DZ_PLUGIN_DEFINITION("DazToUnreal"); 9 | 10 | DZ_PLUGIN_AUTHOR("Daz 3D, Inc"); 11 | 12 | DZ_PLUGIN_VERSION(PLUGIN_MAJOR, PLUGIN_MINOR, PLUGIN_REV, PLUGIN_BUILD); 13 | 14 | DZ_PLUGIN_DESCRIPTION(QString( 15 | "Documentation

" 16 | ).arg(dzApp->getDocumentationPath())); 17 | 18 | DZ_PLUGIN_CLASS_GUID(DzUnrealAction, 99F42CAE-CD02-49BC-A7CE-C0CF4EDD7609); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Daz Productions, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this project except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnrealUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "DazToUnrealUtils.h" 2 | 3 | FString FDazToUnrealUtils::SanitizeName(FString OriginalName) 4 | { 5 | return OriginalName.Replace(TEXT(" "), TEXT("_")) 6 | .Replace(TEXT("("), TEXT("_")) 7 | .Replace(TEXT(")"), TEXT("_")) 8 | .Replace(TEXT("."), TEXT("_")) 9 | .Replace(TEXT("&"), TEXT("_")) 10 | .Replace(TEXT("!"), TEXT("_")) 11 | .Replace(TEXT("*"), TEXT("_")) 12 | .Replace(TEXT("<"), TEXT("_")) 13 | .Replace(TEXT(">"), TEXT("_")) 14 | .Replace(TEXT("?"), TEXT("_")) 15 | .Replace(TEXT("\\"), TEXT("_")); 16 | } -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/DzUnrealAction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "DzUnrealSubdivisionDialog.h" 9 | 10 | class DzUnrealAction : public DzRuntimePluginAction { 11 | Q_OBJECT 12 | public: 13 | DzUnrealAction(); 14 | 15 | protected: 16 | int Port; 17 | DzUnrealSubdivisionDialog* SubdivisionDialog; 18 | 19 | void executeAction(); 20 | void WriteMaterials(DzNode* Node, DzJsonWriter& Stream); 21 | void WriteConfiguration(); 22 | void SetExportOptions(DzFileIOSettings& ExportOptions); 23 | }; -------------------------------------------------------------------------------- /Common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_AUTOMOC ON) 2 | 3 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 4 | 5 | set(COMMON_LIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 6 | set(COMMON_LIB_INCLUDE_DIR 7 | ${COMMON_LIB_INCLUDE_DIR} 8 | ${FBX_SDK_INCLUDE} 9 | ${OPENSUBDIV_INCLUDE} 10 | PARENT_SCOPE) 11 | 12 | include_directories(${COMMON_LIB_INCLUDE_DIR}) 13 | set(LIB_SRCS 14 | "DzRuntimePluginAction.cpp" 15 | "OpenFBXInterface.cpp" 16 | "OpenSubdivInterface.cpp") 17 | 18 | add_library(common STATIC ${LIB_SRCS}) 19 | 20 | target_link_libraries(common 21 | PRIVATE 22 | dzcore 23 | ${DZSDK_QT_CORE_TARGET} 24 | ${DZSDK_QT_GUI_TARGET} 25 | ${DZSDK_QT_SCRIPT_TARGET} 26 | ${DZSDK_QT_NETWORK_TARGET} 27 | ) 28 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/README.md: -------------------------------------------------------------------------------- 1 | # Daz To Unreal - Unreal Engine Plugin 2 | This is the Unreal Engine side plugin for the Daz To Unreal tool. 3 | ## Building the Plugin for Windows 4 | To build the plugin with the Unreal Engine source you should first have the Unreal Engine building on your system. You can get it at https://github.com/EpicGames 5 | 1) Copy the DazToUnreal folder found next to this README to either 6 | a) the Engine/Plugins folder of your Engine project 7 | b) the Games/Plugins folder of your Game project (you might have to make this folder) 8 | 2) Run GenerateProjectFiles.bat to update your Visual Studio Solution. 9 | 3) Now when you build the project, the plugin should build with it. 10 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealStyle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "Styling/SlateStyle.h" 5 | 6 | /** */ 7 | class FDazToUnrealStyle 8 | { 9 | public: 10 | 11 | static void Initialize(); 12 | 13 | static void Shutdown(); 14 | 15 | /** reloads textures used by slate renderer */ 16 | static void ReloadTextures(); 17 | 18 | /** @return The Slate style set for the DazToUnrealPlugin game */ 19 | static const ISlateStyle& Get(); 20 | 21 | static FName GetStyleSetName(); 22 | 23 | private: 24 | 25 | static TSharedRef< class FSlateStyleSet > Create(); 26 | 27 | private: 28 | 29 | static TSharedPtr< class FSlateStyleSet > StyleInstance; 30 | }; -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/UnofficialDTU/GetLightDirectionURP.hlsl: -------------------------------------------------------------------------------- 1 | ////////////////////////////// 2 | // 3 | // Code based on tutorial by Daniel Ilett 4 | // https://danielilett.com/2020-03-21-tut5-urp-cel-shading/ 5 | // 6 | ////////////////////////////// 7 | 8 | void MainLight_half(float3 WorldPos, out half3 Direction) 9 | { 10 | #if SHADERGRAPH_PREVIEW 11 | Direction = half3(0.5, 0.5, 0); 12 | #else 13 | #if SHADOWS_SCREEN 14 | half4 clipPos = TransformWorldToHClip(WorldPos); 15 | half4 shadowCoord = ComputeScreenPos(clipPos); 16 | #else 17 | half4 shadowCoord = TransformWorldToShadowCoord(WorldPos); 18 | #endif 19 | Light mainLight = GetMainLight(shadowCoord); 20 | Direction = mainLight.direction; 21 | #endif 22 | } 23 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/DiffusionProfiles/IrayUberSkinDiffusionProfile.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa782a3dd8776f44bbc91337fee870b0 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: '{"assetGUIDs":["26bdddf49760c61438938733f07fa2a2","78322c7f82657514ebe48203160e3f39","281c25de6076ef84297a335f40a8c119","c1e7f4528bb09e34ca01538655427a8b","d4a5161c8e3489f4fb60d30b8e06e5f5","937679514dbefd145abc76148bf15517","e0312643efbd7a2419cb4815ee52a11b","8e632b6865f53f64a9404c196227555d","113e422f16482af43aaaa4eff2a995fe","7c45518c02969ee45ae57acd86f137c8","b06170c1b53f12241a9b66d45b9c3c97","ecc4f9e147bd02c42aeae7ce472723b2","8873ac82b5cbedf46a234cb2659b5a6a","1f93bde2ea771ba43846d76a503a4188","8aa10fe29cd44f24f925f418494ad12e",""]}' 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/DiffusionProfiles/GenericDiffusionProfile.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: b2686e09ec7aef44bad2843e4416f057, type: 3} 13 | m_Name: GenericDiffusionProfile 14 | m_EditorClassIdentifier: 15 | m_Version: 1 16 | profile: 17 | scatteringDistance: {r: 1, g: 1, b: 1, a: 1} 18 | transmissionTint: {r: 4, g: 4, b: 4, a: 1} 19 | texturingMode: 0 20 | transmissionMode: 0 21 | thicknessRemap: {x: 0, y: 5} 22 | worldScale: 1 23 | ior: 1.4 24 | hash: 1075913041 25 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealFactory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "UObject/ObjectMacros.h" 5 | #include "Factories/Factory.h" 6 | #include "DazToUnrealFactory.generated.h" 7 | 8 | // The Daz Studio plugin creates a dtu file with the same string that's send over the network. This factory allows that file to be imported to start the same process. 9 | UCLASS() 10 | class UDazToUnrealFactory : public UFactory 11 | { 12 | GENERATED_UCLASS_BODY() 13 | 14 | public: 15 | 16 | // UFactory interface 17 | virtual UObject* FactoryCreateFile(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, const FString& Filename, const TCHAR* Parms, FFeedbackContext* Warn, bool& bOutOperationCanceled) override; 18 | // End of UFactory interface 19 | }; 20 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Helpers/GetLightDirection.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef GETLIGHT_INCLUDED 2 | #define GETLIGHT_INCLUDED 3 | 4 | #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" 5 | #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs.hlsl" 6 | 7 | void GetLightDirection_float(out float3 lightDir, out float3 lightColor) 8 | { 9 | #if SHADERGRAPH_PREVIEW 10 | lightDir = float3(0.707, 0.707, 0); 11 | lightColor = 1; 12 | #else 13 | if (_DirectionalLightCount > 0) 14 | { 15 | DirectionalLightData light = _DirectionalLightDatas[0]; 16 | lightDir = light.forward.xyz; 17 | lightColor = light.color; 18 | } 19 | else 20 | { 21 | lightDir = float3(1, 0, 0); 22 | lightColor = 0; 23 | } 24 | #endif 25 | } 26 | 27 | #endif -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealCommands.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "Framework/Commands/Commands.h" 5 | #include "DazToUnrealStyle.h" 6 | 7 | class FDazToUnrealCommands : public TCommands 8 | { 9 | public: 10 | 11 | FDazToUnrealCommands() 12 | : TCommands(TEXT("DazToUnreal"), NSLOCTEXT("Contexts", "DazToUnreal", "DazToUnreal Plugin"), NAME_None, FDazToUnrealStyle::GetStyleSetName()) 13 | { 14 | } 15 | 16 | // TCommands<> interface 17 | virtual void RegisterCommands() override; 18 | 19 | public: 20 | TSharedPtr< FUICommandInfo > OpenPluginWindow; 21 | TSharedPtr< FUICommandInfo > InstallDazStudioPlugin; 22 | TSharedPtr< FUICommandInfo > InstallSkeletonAssets; 23 | TSharedPtr< FUICommandInfo > InstallMaterialAssets; 24 | }; -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/DazToUnreal.uplugin: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion": 3, 3 | "Version": 3, 4 | "VersionName": "3.0", 5 | "FriendlyName": "DazToUnreal", 6 | "Description": "", 7 | "Category": "Importers", 8 | "CreatedBy": "Daz 3D", 9 | "CreatedByURL": "http://www.daz3d.com/daz-to-unreal-bridge", 10 | "DocsURL": "http://docs.daz3d.com/doku.php/public/read_me/index/72003/start", 11 | "MarketplaceURL": "", 12 | "SupportURL": "https://www.daz3d.com/help/", 13 | "EngineVersion": "4.25.0", 14 | "CanContainContent": true, 15 | "Installed": true, 16 | "Modules": [ 17 | { 18 | "Name": "DazToUnreal", 19 | "Type": "Editor", 20 | "LoadingPhase": "Default", 21 | "WhitelistPlatforms": [ 22 | "Win64" 23 | ] 24 | } 25 | ], 26 | "Plugins": [ 27 | { 28 | "Name": "EditorScriptingUtilities", 29 | "Enabled": true 30 | } 31 | ] 32 | } -------------------------------------------------------------------------------- /Unity/UnityPlugin/DiffusionProfiles/IrayUberSkinDiffusionProfile.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: b2686e09ec7aef44bad2843e4416f057, type: 3} 13 | m_Name: IrayUberSkinDiffusionProfile 14 | m_EditorClassIdentifier: 15 | m_Version: 1 16 | profile: 17 | scatteringDistance: {r: 0.7568628, g: 0.32156864, b: 0.20000002, a: 1} 18 | transmissionTint: {r: 0.75686276, g: 0.32156864, b: 0.2, a: 1} 19 | texturingMode: 0 20 | transmissionMode: 0 21 | thicknessRemap: {x: 0, y: 25} 22 | worldScale: 1 23 | ior: 1.36 24 | hash: 1075135919 25 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnrealCommands.cpp: -------------------------------------------------------------------------------- 1 | #include "DazToUnrealCommands.h" 2 | 3 | #define LOCTEXT_NAMESPACE "FDazToUnrealModule" 4 | 5 | void FDazToUnrealCommands::RegisterCommands() 6 | { 7 | UI_COMMAND(OpenPluginWindow, "DazToUnreal", "Bring up DazToUnreal window", EUserInterfaceActionType::Button, FInputGesture()); 8 | UI_COMMAND(InstallDazStudioPlugin, "Install Daz Studio Plugin", "Install the Daz Studio plugin", EUserInterfaceActionType::Button, FInputGesture()); 9 | UI_COMMAND(InstallSkeletonAssets, "Install Skeleton Assets", "Install the Skeleton Assets to your project", EUserInterfaceActionType::Button, FInputGesture()); 10 | UI_COMMAND(InstallMaterialAssets, "Install Material Assets", "Install the Material Assets to your project", EUserInterfaceActionType::Button, FInputGesture()); 11 | } 12 | 13 | #undef LOCTEXT_NAMESPACE 14 | -------------------------------------------------------------------------------- /Common/OpenFBXInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #ifdef __APPLE__ 6 | #define USING_LIBSTDCPP 1 7 | #endif 8 | #include 9 | 10 | 11 | // FBX Interface class based upon AutoDesk FBX SDK 12 | class OpenFBXInterface 13 | { 14 | public: 15 | static OpenFBXInterface* GetInterface() 16 | { 17 | if (singleton == nullptr) 18 | { 19 | singleton = new OpenFBXInterface(); 20 | } 21 | return singleton; 22 | } 23 | 24 | OpenFBXInterface(); 25 | ~OpenFBXInterface(); 26 | 27 | bool LoadScene(FbxScene* pScene, QString sFilename); 28 | bool SaveScene(FbxScene* pScene, QString sFilename, int nFileFormat = -1, bool bEmbedMedia = false); 29 | FbxScene* CreateScene(QString sSceneName); 30 | 31 | FbxManager* GetManager() { return m_fbxManager; } 32 | FbxIOSettings* GetSettigns() { return m_fbxIOSettings; } 33 | QString GetErrorString() { return m_ErrorString; } 34 | int GetErrorCode() { return m_ErrorCode; } 35 | 36 | protected: 37 | static OpenFBXInterface* singleton; 38 | 39 | FbxManager* m_fbxManager; 40 | FbxIOSettings* m_fbxIOSettings; 41 | 42 | QString m_ErrorString; 43 | int m_ErrorCode; 44 | 45 | }; -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Invisible.shader: -------------------------------------------------------------------------------- 1 | Shader "Daz3D/Invisible" 2 | { 3 | Properties 4 | { 5 | } 6 | SubShader 7 | { 8 | Tags { "RenderType"="Opaque" } 9 | LOD 100 10 | 11 | Pass 12 | { 13 | CGPROGRAM 14 | #pragma vertex vert 15 | #pragma fragment frag 16 | 17 | #include "UnityCG.cginc" 18 | 19 | struct appdata 20 | { 21 | float4 vertex : POSITION; 22 | float2 uv : TEXCOORD0; 23 | }; 24 | 25 | struct v2f 26 | { 27 | float2 uv : TEXCOORD0; 28 | float4 vertex : SV_POSITION; 29 | }; 30 | 31 | sampler2D _MainTex; 32 | float4 _MainTex_ST; 33 | 34 | v2f vert (appdata v) 35 | { 36 | v2f o; 37 | o.vertex = UnityObjectToClipPos(v.vertex); 38 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 39 | return o; 40 | } 41 | 42 | fixed4 frag (v2f i) : SV_Target 43 | { 44 | discard; 45 | return fixed4(0,0,0,0); 46 | } 47 | ENDCG 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/DazToUnreal.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2019 David Vodhanel. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class DazToUnreal : ModuleRules 6 | { 7 | public DazToUnreal(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; 10 | 11 | 12 | PublicDependencyModuleNames.AddRange( 13 | new string[] 14 | { 15 | "Core", 16 | "Sockets", 17 | "Networking", 18 | "Json", 19 | // ... add other public dependencies that you statically link with here ... 20 | } 21 | ); 22 | 23 | 24 | PrivateDependencyModuleNames.AddRange( 25 | new string[] 26 | { 27 | "Projects", 28 | "InputCore", 29 | "UnrealEd", 30 | "LevelEditor", 31 | "CoreUObject", 32 | "Engine", 33 | "Slate", 34 | "SlateCore", 35 | "EditorScriptingUtilities", 36 | // ... add private dependencies that you statically link with here ... 37 | } 38 | ); 39 | 40 | 41 | DynamicallyLoadedModuleNames.AddRange( 42 | new string[] 43 | { 44 | // ... add any modules that your module loads dynamically here ... 45 | } 46 | ); 47 | 48 | AddEngineThirdPartyPrivateStaticDependencies(Target, 49 | "FBX" 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Utilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | using UnityEngine; 4 | 5 | namespace Daz3D 6 | { 7 | /// 8 | /// Misc helpers methods, such as file handling 9 | /// 10 | public class Utilities 11 | { 12 | protected static Regex nameScrub = new Regex("[^a-zA-Z0-9_-]+"); 13 | public static string ScrubKey(string src) 14 | { 15 | src = src.Replace(" ", "_"); 16 | src = src.Replace(":", "_"); 17 | src = nameScrub.Replace(src, ""); 18 | return src; 19 | } 20 | 21 | protected static Regex directoryScrub = new Regex(@"[^a-zA-Z0-9-._/]+"); 22 | public static string ScrubPath(string src) 23 | { 24 | src = src.Replace("\\", "/"); 25 | src = src.Replace(" ", "_"); 26 | src = directoryScrub.Replace(src, ""); 27 | return src; 28 | } 29 | 30 | public static byte[] MD5AsBytes(string path) 31 | { 32 | var md5 = System.Security.Cryptography.MD5.Create(); 33 | var stream = System.IO.File.OpenRead(path); 34 | var bytes = md5.ComputeHash(stream); 35 | return bytes; 36 | } 37 | 38 | public static string MD5(string path) 39 | { 40 | var bytes = MD5AsBytes(path); 41 | return BitConverter.ToString(bytes).Replace("-","").ToLowerInvariant(); 42 | } 43 | 44 | public static float GetStrengthFromColor(Color color) 45 | { 46 | return color.grayscale; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/CGInc/DazStandardCoreForward.cginc: -------------------------------------------------------------------------------- 1 | // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) 2 | 3 | #ifndef UNITY_STANDARD_CORE_FORWARD_INCLUDED 4 | #define UNITY_STANDARD_CORE_FORWARD_INCLUDED 5 | 6 | #if defined(UNITY_NO_FULL_STANDARD_SHADER) 7 | # define UNITY_STANDARD_SIMPLE 1 8 | #endif 9 | 10 | #include "UnityStandardConfig.cginc" 11 | 12 | //#if UNITY_STANDARD_SIMPLE 13 | #if 0 14 | #include "UnityStandardCoreForwardSimple.cginc" 15 | VertexOutputBaseSimple vertBase (VertexInput v) { return vertForwardBaseSimple(v); } 16 | VertexOutputForwardAddSimple vertAdd (VertexInput v) { return vertForwardAddSimple(v); } 17 | half4 fragBase (VertexOutputBaseSimple i) : SV_Target { return fragForwardBaseSimpleInternal(i); } 18 | half4 fragAdd (VertexOutputForwardAddSimple i) : SV_Target { return fragForwardAddSimpleInternal(i); } 19 | #else 20 | #include "DazStandardCore.cginc" 21 | VertexOutputForwardBase vertBase (VertexInput v) { return vertForwardBase(v); } 22 | VertexOutputForwardAdd vertAdd (VertexInput v) { return vertForwardAdd(v); } 23 | half4 fragBase (VertexOutputForwardBase i) : SV_Target { return fragForwardBaseInternal(i); } 24 | half4 fragAdd (VertexOutputForwardAdd i) : SV_Target { return fragForwardAddInternal(i); } 25 | #endif 26 | 27 | #endif // UNITY_STANDARD_CORE_FORWARD_INCLUDED 28 | -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/DzUnrealSubdivisionDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "dzbasicdialog.h" 3 | #include 4 | #include 5 | #include 6 | #include "dznode.h" 7 | #include 8 | 9 | class QListWidget; 10 | class QListWidgetItem; 11 | class QTreeWidget; 12 | class QTreeWidgetItem; 13 | class QLineEdit; 14 | class QComboBox; 15 | class QGridLayout; 16 | 17 | 18 | class DzUnrealSubdivisionDialog : public DzBasicDialog { 19 | Q_OBJECT 20 | public: 21 | 22 | /** Constructor **/ 23 | DzUnrealSubdivisionDialog(QWidget *parent); 24 | 25 | void PrepareDialog(); 26 | 27 | /** Destructor **/ 28 | virtual ~DzUnrealSubdivisionDialog() {} 29 | 30 | static DzUnrealSubdivisionDialog* Get(QWidget* Parent) 31 | { 32 | if (singleton == nullptr) 33 | { 34 | singleton = new DzUnrealSubdivisionDialog(Parent); 35 | } 36 | singleton->PrepareDialog(); 37 | return singleton; 38 | } 39 | 40 | QGridLayout* subdivisionItemsGrid; 41 | 42 | void LockSubdivisionProperties(bool subdivisionEnabled); 43 | void WriteSubdivisions(DzJsonWriter& Writer); 44 | DzNode* FindObject(DzNode* Node, QString Name); 45 | 46 | public slots: 47 | void HandleSubdivisionLevelChanged(const QString& text); 48 | 49 | private: 50 | void CreateList(DzNode* Node); 51 | 52 | void SavePresetFile(QString filePath); 53 | 54 | QSize minimumSizeHint() const override; 55 | 56 | QString presetsFolder; 57 | 58 | QList SubdivisionCombos; 59 | 60 | QMap SubdivisionLevels; 61 | 62 | static DzUnrealSubdivisionDialog* singleton; 63 | }; 64 | -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/DzUnityAction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "DzUnitySubdivisionDialog.h" 9 | 10 | #include "dzweightmap.h" 11 | 12 | class UnofficialDzUnityAction : public UnofficialDzRuntimePluginAction { 13 | Q_OBJECT 14 | public: 15 | UnofficialDzUnityAction(); 16 | 17 | class MaterialGroupExportOrderMetaData 18 | { 19 | public: 20 | int materialIndex; 21 | int vertex_offset; 22 | int vertex_count; 23 | 24 | MaterialGroupExportOrderMetaData(int a_index, int a_offset) 25 | { 26 | materialIndex = a_index; 27 | vertex_offset = a_offset; 28 | vertex_count = -1; 29 | } 30 | 31 | bool operator< (MaterialGroupExportOrderMetaData b) const 32 | { 33 | if (vertex_offset < b.vertex_offset) 34 | { 35 | return true; 36 | } 37 | else 38 | { 39 | return false; 40 | } 41 | } 42 | 43 | }; 44 | 45 | protected: 46 | DzUnitySubdivisionDialog* SubdivisionDialog; 47 | bool InstallUnityFiles; 48 | 49 | void executeAction(); 50 | void WriteMaterials(DzNode* Node, DzJsonWriter& Stream); 51 | void WriteWeightMaps(DzNode* Node, DzJsonWriter& Stream); 52 | void WriteConfiguration(); 53 | void SetExportOptions(DzFileIOSettings& ExportOptions); 54 | void CreateUnityFiles(bool replace = true); 55 | 56 | bool metaInvokeMethod(QObject* object, const char* methodSig, void** returnPtr); 57 | DzWeightMapPtr getWeightMapPtr(DzNode* Node); 58 | 59 | bool CopyFile(QFile *file, QString *dst, bool replace = true, bool compareFiles = true); 60 | QString GetMD5(const QString &path); 61 | }; 62 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnrealFactory.cpp: -------------------------------------------------------------------------------- 1 | #include "DazToUnrealFactory.h" 2 | #include "DazToUnreal.h" 3 | #include "Modules/ModuleManager.h" 4 | #include "Misc/PackageName.h" 5 | #include "AssetData.h" 6 | #include "AssetRegistryModule.h" 7 | #include "PackageTools.h" 8 | #include "Misc/FileHelper.h" 9 | #include "Engine/SkeletalMesh.h" 10 | #include "Serialization/JsonReader.h" 11 | #include "Dom/JsonObject.h" 12 | #include "Serialization/JsonSerializer.h" 13 | 14 | #define LOCTEXT_NAMESPACE "DazToUnreal" 15 | 16 | ///////////////////////////////////////////////////// 17 | // UDazToUnrealFactory 18 | 19 | UDazToUnrealFactory::UDazToUnrealFactory(const FObjectInitializer& ObjectInitializer) 20 | : Super(ObjectInitializer) 21 | { 22 | bCreateNew = false; 23 | bEditorImport = true; 24 | Formats.Add(TEXT("dtu;DazToUnreal description file")); 25 | SupportedClass = USkeletalMesh::StaticClass(); 26 | } 27 | 28 | 29 | UObject* UDazToUnrealFactory::FactoryCreateFile(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, const FString& Filename, const TCHAR* Parms, FFeedbackContext* Warn, bool& bOutOperationCanceled) 30 | { 31 | if (FPaths::FileExists(Filename)) 32 | { 33 | FString Json; 34 | FFileHelper::LoadFileToString(Json, *Filename); 35 | TSharedRef> JsonReader = TJsonReaderFactory::Create(Json); 36 | TSharedPtr JsonObject = MakeShareable(new FJsonObject); 37 | if (FJsonSerializer::Deserialize(JsonReader, JsonObject) && JsonObject.IsValid()) 38 | { 39 | return FDazToUnrealModule::Get().ImportFromDaz(JsonObject); 40 | } 41 | } 42 | 43 | return 0; 44 | } 45 | 46 | #undef LOCTEXT_NAMESPACE 47 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/ClothCollisionAssignerEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | [CustomEditor (typeof (ClothCollisionAssigner))] 7 | [CanEditMultipleObjects] 8 | public class ClothCollisionAssignerEditor : Editor 9 | { 10 | private SerializedObject m_Object; 11 | 12 | public void OnEnable() 13 | { 14 | m_Object = new SerializedObject(target); 15 | } 16 | 17 | public override void OnInspectorGUI() 18 | { 19 | m_Object.Update(); 20 | 21 | GUILayout.Label("**Cloth Collision Assigner**", EditorStyles.boldLabel); 22 | 23 | GUILayout.Space(10); 24 | base.OnInspectorGUI(); 25 | GUILayout.Space(10); 26 | 27 | 28 | 29 | GUILayout.Space(10); 30 | GUILayout.Label("When this script is enabled, Cloth Collision Rigs are assigned during Runtime. Click \"Assign Cloth Collision Rigs\" to assign the rigs in editor mode.", EditorStyles.wordWrappedLabel ); 31 | 32 | GUILayout.BeginHorizontal(); 33 | if (GUILayout.Button("Assign Cloth Collision Rigs")) 34 | { 35 | ClothCollisionAssigner assigner = (ClothCollisionAssigner)target; 36 | assigner.AssignClothCollisionRigs(); 37 | Debug.Log("Assigned Cloth Collision Rigs"); 38 | } 39 | 40 | if (GUILayout.Button("Clear All Assignments")) 41 | { 42 | ClothCollisionAssigner assigner = (ClothCollisionAssigner)target; 43 | assigner.ClearAllAssignments(); 44 | Debug.Log("Cleared All Assignments"); 45 | } 46 | 47 | GUILayout.EndHorizontal(); 48 | GUILayout.Space(10); 49 | 50 | m_Object.ApplyModifiedProperties(); 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/DzUnitySubdivisionDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "dzbasicdialog.h" 3 | #include 4 | #include 5 | #include 6 | #include "dznode.h" 7 | #include 8 | 9 | class QListWidget; 10 | class QListWidgetItem; 11 | class QTreeWidget; 12 | class QTreeWidgetItem; 13 | class QLineEdit; 14 | class QComboBox; 15 | class QGridLayout; 16 | 17 | 18 | class DzUnitySubdivisionDialog : public DzBasicDialog { 19 | Q_OBJECT 20 | public: 21 | 22 | /** Constructor **/ 23 | DzUnitySubdivisionDialog(QWidget *parent); 24 | 25 | void PrepareDialog(); 26 | 27 | /** Destructor **/ 28 | virtual ~DzUnitySubdivisionDialog() {} 29 | 30 | static DzUnitySubdivisionDialog* Get(QWidget* Parent) 31 | { 32 | if (singleton == nullptr) 33 | { 34 | singleton = new DzUnitySubdivisionDialog(Parent); 35 | } 36 | singleton->PrepareDialog(); 37 | return singleton; 38 | } 39 | 40 | QGridLayout* subdivisionItemsGrid; 41 | 42 | void LockSubdivisionProperties(bool subdivisionEnabled); 43 | void UnlockSubdivisionProperties(); 44 | 45 | void WriteSubdivisions(DzJsonWriter& Writer); 46 | DzNode* FindObject(DzNode* Node, QString Name); 47 | std::map* GetLookupTable(); 48 | 49 | public slots: 50 | void HandleSubdivisionLevelChanged(const QString& text); 51 | 52 | private: 53 | void CreateList(DzNode* Node); 54 | 55 | void SavePresetFile(QString filePath); 56 | 57 | QSize minimumSizeHint() const override; 58 | 59 | QString presetsFolder; 60 | 61 | QList SubdivisionCombos; 62 | 63 | QMap SubdivisionLevels; 64 | 65 | struct UndoData 66 | { 67 | bool originalLockState; 68 | double originalValue; 69 | }; 70 | QMap UndoSubdivisionOverrides; 71 | 72 | static DzUnitySubdivisionDialog* singleton; 73 | }; 74 | -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_AUTOMOC ON) 2 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 3 | 4 | set(DZ_PLUGIN_TGT_NAME dzunrealbridge) 5 | set(DZ_PLUGIN_PROJECT_NAME "DzUnrealBridge") 6 | 7 | # if building a plugin and you want the compiled result placed in the Daz Studio ./plugins directory 8 | if(DAZ_STUDIO_EXE_DIR) 9 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${DAZ_STUDIO_EXE_DIR}/plugins) 10 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${DAZ_STUDIO_EXE_DIR}/plugins) 11 | endif() 12 | 13 | if(WIN32) 14 | set(OS_SOURCES 15 | DzUnrealBridge.rc 16 | DzUnrealBridge.def 17 | ) 18 | elseif(APPLE) 19 | set(OS_SOURCES "") 20 | endif() 21 | 22 | set(DPC_IMAGES_CPP "${CMAKE_CURRENT_BINARY_DIR}/DzUnrealIcon.cpp" ) 23 | set(DPC_SRC_IMAGES 24 | icon.png 25 | ) 26 | 27 | add_custom_command(OUTPUT ${DPC_IMAGES_CPP} 28 | COMMAND ${DAZ_SDK_DPC_EXE} -mode image -o ${DPC_IMAGES_CPP} ${DPC_SRC_IMAGES} 29 | DEPENDS ${DPC_SRC_IMAGES} 30 | WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} 31 | ) 32 | 33 | add_library( ${DZ_PLUGIN_TGT_NAME} SHARED 34 | DzUnrealAction.cpp 35 | DzUnrealAction.h 36 | DzUnrealDialog.cpp 37 | DzUnrealDialog.h 38 | DzUnrealMorphSelectionDialog.cpp 39 | DzUnrealMorphSelectionDialog.h 40 | pluginmain.cpp 41 | DzUnrealSubdivisionDialog.cpp 42 | DzUnrealSubdivisionDialog.h 43 | version.h 44 | ${DPC_IMAGES_CPP} 45 | ${OS_SOURCES} 46 | ) 47 | 48 | target_include_directories(common PUBLIC ${COMMON_LIB_INCLUDE_DIR}) 49 | 50 | target_link_libraries(${DZ_PLUGIN_TGT_NAME} 51 | PRIVATE 52 | dzcore 53 | common 54 | ${DZSDK_QT_CORE_TARGET} 55 | ${DZSDK_QT_GUI_TARGET} 56 | ${DZSDK_QT_SCRIPT_TARGET} 57 | ${DZSDK_QT_NETWORK_TARGET} 58 | ) 59 | 60 | set_target_properties (${DZ_PLUGIN_TGT_NAME} 61 | PROPERTIES 62 | FOLDER "" 63 | PROJECT_LABEL ${DZ_PLUGIN_PROJECT_NAME} 64 | ) 65 | 66 | set_property(SOURCE ${DPC_IMAGES_CPP} PROPERTY SKIP_AUTOMOC ON) -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/DzUnrealDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "dzbasicdialog.h" 3 | #include 4 | #include 5 | 6 | class QPushButton; 7 | class QLineEdit; 8 | class QCheckBox; 9 | class QComboBox; 10 | class QGroupBox; 11 | 12 | class DzUnrealDialog : public DzBasicDialog { 13 | Q_OBJECT 14 | public: 15 | 16 | /** Constructor **/ 17 | DzUnrealDialog(QWidget *parent); 18 | 19 | /** Destructor **/ 20 | virtual ~DzUnrealDialog() {} 21 | 22 | QLineEdit* assetNameEdit; 23 | QLineEdit* projectEdit; 24 | QPushButton* projectButton; 25 | QComboBox* assetTypeCombo; 26 | QLineEdit* portEdit; 27 | QLineEdit* intermediateFolderEdit; 28 | QPushButton* intermediateFolderButton; 29 | QPushButton* morphsButton; 30 | QCheckBox* morphsEnabledCheckBox; 31 | QPushButton* subdivisionButton; 32 | QCheckBox* subdivisionEnabledCheckBox; 33 | QGroupBox* advancedSettingsGroupBox; 34 | QComboBox* fbxVersionCombo; 35 | QCheckBox* showFbxDialogCheckBox; 36 | 37 | // Pass so the DazTRoUnrealAction can access it from the morph dialog 38 | QString GetMorphString(); 39 | 40 | // Pass so the DazTRoUnrealAction can access it from the morph dialog 41 | QMap GetMorphMapping() { return morphMapping; } 42 | 43 | void Accepted(); 44 | private slots: 45 | void HandleSelectIntermediateFolderButton(); 46 | void HandlePortChanged(const QString& port); 47 | void HandleChooseMorphsButton(); 48 | void HandleMorphsCheckBoxChange(int state); 49 | void HandleChooseSubdivisionsButton(); 50 | void HandleSubdivisionCheckBoxChange(int state); 51 | void HandleFBXVersionChange(const QString& fbxVersion); 52 | void HandleShowFbxDialogCheckBoxChange(int state); 53 | 54 | private: 55 | QSettings* settings; 56 | 57 | // These are clumsy leftovers from before the dialog were singletons 58 | QString morphString; 59 | QMap morphMapping; 60 | }; 61 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealMaterials.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "DazToUnrealEnums.h" 5 | 6 | class UMaterialInstanceConstant; 7 | // struct for holding material override settings 8 | struct FDUFTextureProperty 9 | { 10 | FString Name; 11 | FString Type; 12 | FString Value; 13 | FString ObjectName; 14 | FString ShaderName; 15 | 16 | inline bool operator==(const FDUFTextureProperty& rhs) const 17 | { 18 | return Name == rhs.Name && Type == rhs.Type && Value == rhs.Value && ObjectName == rhs.ObjectName; 19 | } 20 | }; 21 | 22 | class FDazToUnrealMaterials 23 | { 24 | public: 25 | static FSoftObjectPath GetBaseMaterial(FString MaterialName, TArray MaterialProperties); 26 | static UMaterialInstanceConstant* CreateMaterial(const FString CharacterMaterialFolder, const FString CharacterTexturesFolder, FString& MaterialName, TMap> MaterialProperties, const DazCharacterType CharacterType, UMaterialInstanceConstant* ParentMaterial); 27 | static void SetMaterialProperty(const FString& MaterialName, const FString& PropertyName, const FString& PropertyType, const FString& PropertyValue, TMap>& MaterialProperties); 28 | 29 | 30 | static FSoftObjectPath GetMostCommonBaseMaterial(TArray MaterialNames, TMap> MaterialProperties); 31 | static TArray GetMostCommonProperties(TArray MaterialNames, TMap> MaterialProperties); 32 | static FDUFTextureProperty GetMostCommonProperty(FString PropertyName, TArray MaterialNames, TMap> MaterialProperties); 33 | 34 | static FSoftObjectPath GetBaseMaterialForShader(FString ShaderName); 35 | static FSoftObjectPath GetSkinMaterialForShader(FString ShaderName); 36 | }; -------------------------------------------------------------------------------- /Common/DzRuntimePluginAction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #include "QtCore/qfile.h" 7 | #include "QtCore/qtextstream.h" 8 | 9 | class UnofficialDzRuntimePluginAction : public DzAction { 10 | Q_OBJECT 11 | public: 12 | 13 | UnofficialDzRuntimePluginAction(const QString& text = QString::null, const QString& desc = QString::null); 14 | virtual ~UnofficialDzRuntimePluginAction(); 15 | 16 | // DB (2021-05-24): hybrid C++/script system 17 | signals: 18 | void ScriptReturn(QObject* obj); 19 | void ScriptReturn(bool result); 20 | 21 | protected: 22 | QString CharacterName; 23 | QString ImportFolder; 24 | QString CharacterFolder; 25 | QString CharacterFBX; 26 | QString AssetType; 27 | QString MorphString; 28 | QString FBXVersion; 29 | QMap MorphMapping; 30 | 31 | bool ExportMorphs; 32 | bool ExportSubdivisions; 33 | bool ExportBaseMesh; 34 | bool ShowFbxDialog; 35 | DzNode* Selection; 36 | 37 | virtual QString getActionGroup() const { return tr("Bridges"); } 38 | virtual QString getDefaultMenuPath() const { return tr("&File/Send To"); } 39 | 40 | virtual void Export(); 41 | 42 | virtual void WriteConfiguration() = 0; 43 | virtual void SetExportOptions(DzFileIOSettings &ExportOptions) = 0; 44 | 45 | // Need to temporarily rename surfaces if there is a name collision 46 | void RenameDuplicateMaterials(DzNode* Node, QList& MaterialNames, QMap& OriginalMaterialNames); 47 | void UndoRenameDuplicateMaterials(DzNode* Node, QList& MaterialNames, QMap& OriginalMaterialNames); 48 | 49 | // DB (2021-05-24): hybrid C++/script system 50 | static QObject* m_ScriptReturn_Object; 51 | static int m_ScriptReturn_ReturnCode; 52 | private slots: 53 | void HandleScriptReturn(QObject* obj); 54 | void HandleScriptReturn(bool result); 55 | 56 | }; -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/DazCoroutine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEditor; 5 | 6 | namespace Daz3D 7 | { 8 | /// 9 | /// A compact coroutine manager for executing coroutines in the unity editor 10 | /// without the need for the optional editor coroutine package to be installed 11 | /// 12 | public static class DazCoroutine 13 | { 14 | private static List s_activeCoroutines = new List(); 15 | private static int s_activeCoroutineIndex = 0; 16 | 17 | static DazCoroutine() 18 | { 19 | if (!IsEditorCoroutineActive()) 20 | EditorApplication.update += ExecuteCoroutines; 21 | } 22 | 23 | public static IEnumerator StartCoroutine(IEnumerator coroutine) 24 | { 25 | s_activeCoroutines.Add(coroutine); 26 | return coroutine; 27 | } 28 | 29 | public static void StopCoroutine(IEnumerator coroutine) 30 | { 31 | if (s_activeCoroutines.Contains(coroutine)) 32 | s_activeCoroutines.Remove(coroutine); 33 | } 34 | 35 | private static void ExecuteCoroutines() 36 | { 37 | if (s_activeCoroutines.Count > 0) 38 | { 39 | s_activeCoroutineIndex++; 40 | s_activeCoroutineIndex %= s_activeCoroutines.Count; 41 | 42 | if (!s_activeCoroutines[s_activeCoroutineIndex].MoveNext()) 43 | s_activeCoroutines.RemoveAt(s_activeCoroutineIndex); 44 | } 45 | } 46 | 47 | private static bool IsEditorCoroutineActive() 48 | { 49 | var list = EditorApplication.update.GetInvocationList(); 50 | return Array.Exists(list, element => element.Method.Name == "ExecuteCoroutines"); 51 | } 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/README.md: -------------------------------------------------------------------------------- 1 | # Daz To Unity - Daz Studio Plugin 2 | This is the Daz Studio side plugin for the Daz To Unity tool. 3 | ## Building the Plugin for Windows 4 | To build this plugin you need the Daz Studio SDK https://www.daz3d.com/daz-studio-4-5-sdk 5 | 6 | 1) This project requires cmake to build. You can download cmake at https://cmake.org/download/ or you can use Visual Studio 2017+ or other IDEs that support cmake. 7 | 2) If using Cmake-GUI instructions: 8 | a) Click "Browse Source" and browse to DazToRuntime folder location. 9 | b) Click "Browse Build" and select where you would like your output build location to be. 10 | c) Click "Configure" and choose what generation you would like. Then click "Finish". This should start the generation and eventually fail. 11 | d) Select "DAZ_SDK_DIR" and browse to the location that you install the Daz Studio 4.5 SDK. IE: "C:\Daz 3D\Applications\Data\DAZ 3D\My DAZ 3D Library\DAZStudio4.5+ SDK" 12 | e) Optional: Select "DAZ_STUDIO_EXE_DIR" to be the location that you install Daz Studio. IE: "C:\Daz 3D\Applications\64-bit\DAZ 3D\DAZStudio4". This will copy the .DLL output into the Daz Studio\plugins folder for you when you build. 13 | e) Select "Generate". You should now have your project setup for building. 14 | 3) If using VS2019 instructions: 15 | a) Open VS2019 and click on File->Open->CMake and browse to DazToRuntime folder location. 16 | b) Right click CMakeList.txt and select "CMake settings for DazRuntimePlugins". 17 | c) Select "DAZ_SDK_DIR" and browse to the location that you install the Daz Studio 4.5 SDK. IE: "C:\Daz 3D\Applications\Data\DAZ 3D\My DAZ 3D Library\DAZStudio4.5+ SDK" 18 | d) Optional: Select "DAZ_STUDIO_EXE_DIR" to be the location that you install Daz Studio. IE: "C:\Daz 3D\Applications\64-bit\DAZ 3D\DAZStudio4". This will copy the .DLL output into the Daz Studio\plugins folder for you when you build. 19 | e) In VS2019 Change build output from "Current Document" up at the top to be "dzunitybridge.dll". -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/README.md: -------------------------------------------------------------------------------- 1 | # Daz To Unreal - Daz Studio Plugin 2 | This is the Daz Studio side plugin for the Daz To Unreal tool. 3 | ## Building the Plugin for Windows 4 | To buid this plugin you need the Daz Studio SDK https://www.daz3d.com/daz-studio-4-5-sdk 5 | 6 | 1) This project requires cmake to build. You can download cmake at https://cmake.org/download/ or you can use Visual Studio 2017+ or other IDEs that support cmake. 7 | 2) If using Cmake-GUI instructions: 8 | a) Click "Browse Source" and browse to DazToRuntime folder location. 9 | b) Click "Browse Build" and select where you would like your output build location to be. 10 | c) Click "Configure" and choose what generation you would like. Then click "Finish". This should start the generation and eventually fail. 11 | d) Select "DAZ_SDK_DIR" and browse to the location that you install the Daz Studio 4.5 SDK. IE: "C:\Daz 3D\Applications\Data\DAZ 3D\My DAZ 3D Library\DAZStudio4.5+ SDK" 12 | e) Optional: Select "DAZ_STUDIO_EXE_DIR" to be the location that you install Daz Studio. IE: "C:\Daz 3D\Applications\64-bit\DAZ 3D\DAZStudio4". This will copy the .DLL output into the Daz Studio\plugins folder for you when you build. 13 | e) Select "Generate". You should now have your project setup for building. 14 | 3) If using VS2019 instructions: 15 | a) Open VS2019 and click on File->Open->CMake and browse to DazToRuntime folder location. 16 | b) Right click CMakeList.txt and select "CMake settings for DazRuntimePlugins". 17 | c) Select "DAZ_SDK_DIR" and browse to the location that you install the Daz Studio 4.5 SDK. IE: "C:\Daz 3D\Applications\Data\DAZ 3D\My DAZ 3D Library\DAZStudio4.5+ SDK" 18 | d) Optional: Select "DAZ_STUDIO_EXE_DIR" to be the location that you install Daz Studio. IE: "C:\Daz 3D\Applications\64-bit\DAZ 3D\DAZStudio4". This will copy the .DLL output into the Daz Studio\plugins folder for you when you build. 19 | e) In VS2019 Change build output from "Current Document" up at the top to be "dzunrealbridge.dll". -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/DzUnityDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "dzbasicdialog.h" 3 | #include 4 | #include 5 | 6 | class QPushButton; 7 | class QLineEdit; 8 | class QCheckBox; 9 | class QComboBox; 10 | class QGroupBox; 11 | class QLabel; 12 | 13 | class UnofficialDzUnityDialog : public DzBasicDialog { 14 | Q_OBJECT 15 | public: 16 | 17 | /** Constructor **/ 18 | UnofficialDzUnityDialog(QWidget *parent); 19 | 20 | /** Destructor **/ 21 | virtual ~UnofficialDzUnityDialog() {} 22 | 23 | QLineEdit* assetNameEdit; 24 | QLineEdit* projectEdit; 25 | QPushButton* projectButton; 26 | QComboBox* assetTypeCombo; 27 | QLineEdit* assetsFolderEdit; 28 | QPushButton* assetsFolderButton; 29 | QPushButton* morphsButton; 30 | QCheckBox* morphsEnabledCheckBox; 31 | QPushButton* subdivisionButton; 32 | QCheckBox* subdivisionEnabledCheckBox; 33 | QGroupBox* advancedSettingsGroupBox; 34 | #ifdef FBXOPTIONS 35 | QCheckBox* showFbxDialogCheckBox; 36 | #endif 37 | QLabel* installOrOverwriteUnityFilesLabel; 38 | QCheckBox* installUnityFilesCheckBox; 39 | 40 | // Pass so the DazTRoUnityAction can access it from the morph dialog 41 | QString GetMorphString(); 42 | 43 | // Pass so the DazTRoUnityAction can access it from the morph dialog 44 | QMap GetMorphMapping() { return morphMapping; } 45 | 46 | void Accepted(); 47 | private slots: 48 | void HandleSelectAssetsFolderButton(); 49 | void HandleChooseMorphsButton(); 50 | void HandleMorphsCheckBoxChange(int state); 51 | void HandleChooseSubdivisionsButton(); 52 | void HandleSubdivisionCheckBoxChange(int state); 53 | #ifdef FBXOPTIONS 54 | void HandleShowFbxDialogCheckBoxChange(int state); 55 | #endif 56 | void HandleInstallUnityFilesCheckBoxChange(int state); 57 | void HandleAssetTypeComboChange(int state); 58 | 59 | private: 60 | QSettings* settings; 61 | 62 | // These are clumsy leftovers from before the dialog were singletons 63 | QString morphString; 64 | QMap morphMapping; 65 | }; 66 | -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/Resources/ScriptFunctionFindSimulationSettingsProvider.dsa: -------------------------------------------------------------------------------- 1 | // DAZ Studio version 4.15.0.2 filetype DAZ Script 2 | function ScriptedFindSimulationSettingsProvider() 3 | { 4 | var oNode = arguments[0]; 5 | var sMaterial = arguments[1]; 6 | 7 | // Error Checking 8 | if (!oNode) 9 | { 10 | print("ERROR: ScriptedFindSimulationSettingsProvider(): oNode is null"); 11 | UnofficialDzUnityAction().ScriptReturn(false); 12 | return false; 13 | } 14 | if (!sMaterial) 15 | { 16 | print("ERROR: ScriptedFindSimulationSettingsProvider(): material name is null"); 17 | UnofficialDzUnityAction().ScriptReturn(false); 18 | return false; 19 | } 20 | 21 | var nodeIndex = Scene.findNodeIndex(oNode); 22 | if (nodeIndex != -1) 23 | { 24 | var newNode = Scene.getNode(nodeIndex); 25 | } 26 | else 27 | { 28 | print("ERROR: ScriptedFindSimulationSettingsProvider(): FindNodeIndex: FAIL"); 29 | UnofficialDzUnityAction().ScriptReturn(false); 30 | return false; 31 | } 32 | 33 | var oObject = newNode.getObject(); 34 | if (!oObject) 35 | { 36 | print("ERROR: ScriptedFindSimulationSettingsProvider(): could not retrieve Object class from Node"); 37 | UnofficialDzUnityAction().scriptReturn(false); 38 | return false; 39 | } 40 | var oShape = oObject.getCurrentShape(); 41 | if (!oShape) 42 | { 43 | print("ERROR: ScriptedFindSimulationSettingsProvider(): could not retrieve Shape class from Object"); 44 | UnofficialDzUnityAction().ScriptReturn(false); 45 | return false; 46 | } 47 | 48 | var oProvider = oShape.findSimulationSettingsProvider( sMaterial ); 49 | 50 | if (oProvider) 51 | { 52 | UnofficialDzUnityAction().ScriptReturn(oProvider); 53 | print("ScriptedFindSimulationSettingsProvider(): SUCCESS:" + oProvider.getName() + ", from: " + sMaterial); 54 | return true; 55 | 56 | } 57 | else 58 | { 59 | print ("ERROR: ScriptedFindSimulationSettingsProvider(): simulation settings provider for material name could not be found"); 60 | UnofficialDzUnityAction().ScriptReturn(false); 61 | return false; 62 | } 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_AUTOMOC ON) 2 | set(CMAKE_AUTORCC ON) 3 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 4 | 5 | set(DZ_PLUGIN_TGT_NAME unofficialdzunitybridge) 6 | set(DZ_PLUGIN_PROJECT_NAME "UnofficialDzUnityBridge") 7 | 8 | option(FBXOPTIONS "Show FBX Export Dialog" OFF) 9 | if(FBXOPTIONS) 10 | add_compile_definitions(FBXOPTIONS) 11 | endif() 12 | 13 | # if building a plugin and you want the compiled result placed in the Daz Studio ./plugins directory 14 | if(DAZ_STUDIO_EXE_DIR) 15 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${DAZ_STUDIO_EXE_DIR}/plugins) 16 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${DAZ_STUDIO_EXE_DIR}/plugins) 17 | endif() 18 | 19 | if(WIN32) 20 | set(OS_SOURCES 21 | DzUnityBridge.rc 22 | DzUnityBridge.def 23 | ) 24 | elseif(APPLE) 25 | set(OS_SOURCES "") 26 | endif() 27 | 28 | #set(DPC_IMAGES_CPP "${CMAKE_CURRENT_BINARY_DIR}/DzUnityIcon.cpp" ) 29 | #set(DPC_SRC_IMAGES 30 | # icon.png 31 | #) 32 | # 33 | #add_custom_command(OUTPUT ${DPC_IMAGES_CPP} 34 | # COMMAND ${DAZ_SDK_DPC_EXE} -mode image -o ${DPC_IMAGES_CPP} ${DPC_SRC_IMAGES} 35 | # DEPENDS ${DPC_SRC_IMAGES} 36 | # WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} 37 | #) 38 | #set_property(SOURCE ${DPC_IMAGES_CPP} PROPERTY SKIP_AUTOMOC ON) 39 | 40 | add_library( ${DZ_PLUGIN_TGT_NAME} SHARED 41 | DzUnityAction.cpp 42 | DzUnityAction.h 43 | DzUnityDialog.cpp 44 | DzUnityDialog.h 45 | DzUnityMorphSelectionDialog.cpp 46 | DzUnityMorphSelectionDialog.h 47 | pluginmain.cpp 48 | DzUnitySubdivisionDialog.cpp 49 | DzUnitySubdivisionDialog.h 50 | version.h 51 | Resources/resources.qrc 52 | # ${DPC_IMAGES_CPP} 53 | ${OS_SOURCES} 54 | ) 55 | 56 | target_include_directories(common 57 | PUBLIC 58 | ${COMMON_LIB_INCLUDE_DIR} 59 | ${FBX_SDK_INCLUDE} 60 | ${OPENSUBDIV_INCLUDE} 61 | ) 62 | 63 | target_include_directories(${DZ_PLUGIN_TGT_NAME} 64 | PUBLIC 65 | ${FBX_SDK_INCLUDE} 66 | ${OPENSUBDIV_INCLUDE} 67 | ) 68 | 69 | target_link_libraries(${DZ_PLUGIN_TGT_NAME} 70 | PRIVATE 71 | dzcore 72 | common 73 | ${DZSDK_QT_CORE_TARGET} 74 | ${DZSDK_QT_GUI_TARGET} 75 | ${DZSDK_QT_SCRIPT_TARGET} 76 | ${DZSDK_QT_NETWORK_TARGET} 77 | ${FBX_IMPORT_LIBS} 78 | ${OPENSUBDIV_LIB} 79 | ) 80 | 81 | set_target_properties (${DZ_PLUGIN_TGT_NAME} 82 | PROPERTIES 83 | FOLDER "" 84 | PROJECT_LABEL ${DZ_PLUGIN_PROJECT_NAME} 85 | ) -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnrealStyle.cpp: -------------------------------------------------------------------------------- 1 | #include "DazToUnrealStyle.h" 2 | #include "Styling/SlateStyleRegistry.h" 3 | #include "Framework/Application/SlateApplication.h" 4 | #include "Slate/SlateGameResources.h" 5 | #include "Interfaces/IPluginManager.h" 6 | 7 | TSharedPtr< FSlateStyleSet > FDazToUnrealStyle::StyleInstance = NULL; 8 | 9 | void FDazToUnrealStyle::Initialize() 10 | { 11 | if (!StyleInstance.IsValid()) 12 | { 13 | StyleInstance = Create(); 14 | FSlateStyleRegistry::RegisterSlateStyle(*StyleInstance); 15 | } 16 | } 17 | 18 | void FDazToUnrealStyle::Shutdown() 19 | { 20 | FSlateStyleRegistry::UnRegisterSlateStyle(*StyleInstance); 21 | ensure(StyleInstance.IsUnique()); 22 | StyleInstance.Reset(); 23 | } 24 | 25 | FName FDazToUnrealStyle::GetStyleSetName() 26 | { 27 | static FName StyleSetName(TEXT("DazToUnrealStyle")); 28 | return StyleSetName; 29 | } 30 | 31 | #define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) 32 | #define BOX_BRUSH( RelativePath, ... ) FSlateBoxBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) 33 | #define BORDER_BRUSH( RelativePath, ... ) FSlateBorderBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) 34 | #define TTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".ttf") ), __VA_ARGS__ ) 35 | #define OTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".otf") ), __VA_ARGS__ ) 36 | 37 | const FVector2D Icon16x16(16.0f, 16.0f); 38 | const FVector2D Icon20x20(20.0f, 20.0f); 39 | const FVector2D Icon40x40(40.0f, 40.0f); 40 | 41 | TSharedRef< FSlateStyleSet > FDazToUnrealStyle::Create() 42 | { 43 | TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("DazToUnrealStyle")); 44 | Style->SetContentRoot(IPluginManager::Get().FindPlugin("DazToUnreal")->GetBaseDir() / TEXT("Resources")); 45 | 46 | Style->Set("DazToUnreal.ToolBar", new IMAGE_BRUSH(TEXT("Logo-40px"), Icon40x40)); 47 | 48 | return Style; 49 | } 50 | 51 | #undef IMAGE_BRUSH 52 | #undef BOX_BRUSH 53 | #undef BORDER_BRUSH 54 | #undef TTF_FONT 55 | #undef OTF_FONT 56 | 57 | void FDazToUnrealStyle::ReloadTextures() 58 | { 59 | if (FSlateApplication::IsInitialized()) 60 | { 61 | FSlateApplication::Get().GetRenderer()->ReloadTextureResources(); 62 | } 63 | } 64 | 65 | const ISlateStyle& FDazToUnrealStyle::Get() 66 | { 67 | return *StyleInstance; 68 | } 69 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnrealFbx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "DazToUnrealEnums.h" 5 | 6 | // NOTE: This FBX include code was copied from FbxImporter.h 7 | // Temporarily disable a few warnings due to virtual function abuse in FBX source files 8 | #pragma warning( push ) 9 | 10 | #pragma warning( disable : 4263 ) // 'function' : member function does not override any base class virtual member function 11 | #pragma warning( disable : 4264 ) // 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden 12 | 13 | // Include the fbx sdk header 14 | // temp undef/redef of _O_RDONLY because kfbxcache.h (included by fbxsdk.h) does 15 | // a weird use of these identifiers inside an enum. 16 | #ifdef _O_RDONLY 17 | #define TMP_UNFBX_BACKUP_O_RDONLY _O_RDONLY 18 | #define TMP_UNFBX_BACKUP_O_WRONLY _O_WRONLY 19 | #undef _O_RDONLY 20 | #undef _O_WRONLY 21 | #endif 22 | 23 | //Robert G. : Packing was only set for the 64bits platform, but we also need it for 32bits. 24 | //This was found while trying to trace a loop that iterate through all character links. 25 | //The memory didn't match what the debugger displayed, obviously since the packing was not right. 26 | #pragma pack(push,8) 27 | 28 | #if PLATFORM_WINDOWS 29 | // _CRT_SECURE_NO_DEPRECATE is defined but is not enough to suppress the deprecation 30 | // warning for vsprintf and stricmp in VS2010. Since FBX is able to properly handle the non-deprecated 31 | // versions on the appropriate platforms, _CRT_SECURE_NO_DEPRECATE is temporarily undefined before 32 | // including the FBX headers 33 | 34 | // The following is a hack to make the FBX header files compile correctly under Visual Studio 2012 and Visual Studio 2013 35 | #if _MSC_VER >= 1700 36 | #define FBX_DLL_MSC_VER 1600 37 | #endif 38 | 39 | 40 | #endif // PLATFORM_WINDOWS 41 | 42 | // FBX casts null pointer to a reference 43 | THIRD_PARTY_INCLUDES_START 44 | #include 45 | THIRD_PARTY_INCLUDES_END 46 | 47 | #pragma pack(pop) 48 | 49 | #ifdef TMP_UNFBX_BACKUP_O_RDONLY 50 | #define _O_RDONLY TMP_FBX_BACKUP_O_RDONLY 51 | #define _O_WRONLY TMP_FBX_BACKUP_O_WRONLY 52 | #undef TMP_UNFBX_BACKUP_O_RDONLY 53 | #undef TMP_UNFBX_BACKUP_O_WRONLY 54 | #endif 55 | 56 | #pragma warning( pop ) 57 | // end of fbx include 58 | 59 | class FDazToUnrealFbx 60 | { 61 | public: 62 | static void RenameDuplicateBones(FbxNode* RootNode); 63 | static void FixBoneRotations(FbxNode* RootNode); 64 | static void FixBindPose(FbxScene* Scene, FbxNode* RootNode); 65 | 66 | private: 67 | static void RenameDuplicateBones(FbxNode* RootNode, TMap& ExistingBones); 68 | }; -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/CGInc/DazStandardMeta.cginc: -------------------------------------------------------------------------------- 1 | // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) 2 | 3 | #ifndef UNITY_STANDARD_META_INCLUDED 4 | #define UNITY_STANDARD_META_INCLUDED 5 | 6 | // Functionality for Standard shader "meta" pass 7 | // (extracts albedo/emission for lightmapper etc.) 8 | 9 | #include "UnityCG.cginc" 10 | #include "UnityStandardInput.cginc" 11 | #include "UnityMetaPass.cginc" 12 | #include "UnityStandardCore.cginc" 13 | 14 | struct v2f_meta 15 | { 16 | float4 pos : SV_POSITION; 17 | float4 uv : TEXCOORD0; 18 | #ifdef EDITOR_VISUALIZATION 19 | float2 vizUV : TEXCOORD1; 20 | float4 lightCoord : TEXCOORD2; 21 | #endif 22 | }; 23 | 24 | v2f_meta vert_meta (VertexInput v) 25 | { 26 | v2f_meta o; 27 | o.pos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST); 28 | o.uv = TexCoords(v); 29 | #ifdef EDITOR_VISUALIZATION 30 | o.vizUV = 0; 31 | o.lightCoord = 0; 32 | if (unity_VisualizationMode == EDITORVIZ_TEXTURE) 33 | o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.uv0.xy, v.uv1.xy, v.uv2.xy, unity_EditorViz_Texture_ST); 34 | else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK) 35 | { 36 | o.vizUV = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; 37 | o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1))); 38 | } 39 | #endif 40 | return o; 41 | } 42 | 43 | // Albedo for lightmapping should basically be diffuse color. 44 | // But rough metals (black diffuse) still scatter quite a lot of light around, so 45 | // we want to take some of that into account too. 46 | half3 UnityLightmappingAlbedo (half3 diffuse, half3 specular, half smoothness) 47 | { 48 | half roughness = SmoothnessToRoughness(smoothness); 49 | half3 res = diffuse; 50 | res += specular * roughness * 0.5; 51 | return res; 52 | } 53 | 54 | float4 frag_meta (v2f_meta i) : SV_Target 55 | { 56 | // we're interested in diffuse & specular colors, 57 | // and surface roughness to produce final albedo. 58 | FragmentCommonData data = UNITY_SETUP_BRDF_INPUT (i.uv); 59 | 60 | UnityMetaInput o; 61 | UNITY_INITIALIZE_OUTPUT(UnityMetaInput, o); 62 | 63 | #ifdef EDITOR_VISUALIZATION 64 | o.Albedo = data.diffColor; 65 | o.VizUV = i.vizUV; 66 | o.LightCoord = i.lightCoord; 67 | #else 68 | o.Albedo = UnityLightmappingAlbedo (data.diffColor, data.specColor, data.smoothness); 69 | #endif 70 | o.SpecularColor = data.specColor; 71 | o.Emission = Emission(i.uv.xy); 72 | 73 | return UnityMetaFragment(o); 74 | } 75 | 76 | #endif // UNITY_STANDARD_META_INCLUDED 77 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnrealFbx.cpp: -------------------------------------------------------------------------------- 1 | #include "DazToUnrealFbx.h" 2 | 3 | 4 | 5 | void FDazToUnrealFbx::RenameDuplicateBones(FbxNode* RootNode) 6 | { 7 | TMap ExistingBones; 8 | RenameDuplicateBones(RootNode, ExistingBones); 9 | } 10 | 11 | void FDazToUnrealFbx::RenameDuplicateBones(FbxNode* RootNode, TMap& ExistingBones) 12 | { 13 | if (RootNode == nullptr) return; 14 | 15 | FbxNodeAttribute* Attr = RootNode->GetNodeAttribute(); 16 | if (Attr && Attr->GetAttributeType() == FbxNodeAttribute::eSkeleton) 17 | { 18 | FString BoneName = UTF8_TO_TCHAR(RootNode->GetName()); 19 | if (ExistingBones.Contains(BoneName)) 20 | { 21 | ExistingBones[BoneName] += 1; 22 | BoneName = FString::Printf(TEXT("%s_RENAMED_%d"), *BoneName, ExistingBones[BoneName]); 23 | RootNode->SetName(TCHAR_TO_UTF8(*BoneName)); 24 | } 25 | else 26 | { 27 | ExistingBones.Add(BoneName, 1); 28 | } 29 | } 30 | 31 | for (int ChildIndex = 0; ChildIndex < RootNode->GetChildCount(); ++ChildIndex) 32 | { 33 | FbxNode * ChildNode = RootNode->GetChild(ChildIndex); 34 | RenameDuplicateBones(ChildNode, ExistingBones); 35 | } 36 | } 37 | 38 | void FDazToUnrealFbx::FixBoneRotations(FbxNode* RootNode) 39 | { 40 | if (RootNode == nullptr) return; 41 | 42 | 43 | RootNode->LclRotation.Set(RootNode->PostRotation.Get()); 44 | 45 | 46 | for (int ChildIndex = 0; ChildIndex < RootNode->GetChildCount(); ++ChildIndex) 47 | { 48 | FbxNode * ChildNode = RootNode->GetChild(ChildIndex); 49 | FixBoneRotations(ChildNode); 50 | } 51 | } 52 | 53 | void FDazToUnrealFbx::FixBindPose(FbxScene* Scene, FbxNode* RootNode) 54 | { 55 | if (RootNode == nullptr) return; 56 | 57 | for (int PoseIndex = 0; PoseIndex < Scene->GetPoseCount(); PoseIndex++) 58 | { 59 | FbxPose* Pose = Scene->GetPose(PoseIndex); 60 | int PoseNodeIndex = Pose->Find(RootNode); 61 | if (PoseNodeIndex != -1) 62 | { 63 | FbxMatrix Matrix = Pose->GetMatrix(PoseNodeIndex); 64 | 65 | FbxVector4 TargetPosition; 66 | FbxVector4 TargetRotation; 67 | FbxVector4 TargetShearing; 68 | FbxVector4 TargetScale; 69 | double Sign; 70 | Matrix.GetElements(TargetPosition, TargetRotation, TargetShearing, TargetScale, Sign); 71 | 72 | FbxDouble3 Rotation = RootNode->PostRotation.Get(); 73 | 74 | TargetRotation.Set(Rotation[0], Rotation[1], Rotation[2]); 75 | Matrix.SetTRS(TargetPosition, TargetRotation, TargetScale); 76 | 77 | Pose->Remove(PoseNodeIndex); 78 | Pose->Add(RootNode, Matrix, true); 79 | } 80 | /*for (int PoseNodeIndex = 0; PoseNodeIndex < Pose->GetCount(); PoseNodeIndex++) 81 | { 82 | FbxNode* PoseNode = Pose->GetNode(PoseIndex); 83 | if (PoseNode == RootNode) 84 | { 85 | 86 | } 87 | }*/ 88 | } 89 | //RootNode->LclRotation.Set(RootNode->PostRotation.Get()); 90 | 91 | 92 | for (int ChildIndex = 0; ChildIndex < RootNode->GetChildCount(); ++ChildIndex) 93 | { 94 | FbxNode * ChildNode = RootNode->GetChild(ChildIndex); 95 | FixBindPose(Scene, ChildNode); 96 | } 97 | } -------------------------------------------------------------------------------- /Unity/UnityPlugin/Resources/UnofficialDTU_Logo_TextOnly.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e76680616d764e649b0fad435df8ffce 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: 1 36 | mipBias: 0 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: 1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 2048 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | - serializedVersion: 3 87 | buildTarget: WebGL 88 | maxTextureSize: 2048 89 | resizeAlgorithm: 0 90 | textureFormat: -1 91 | textureCompression: 1 92 | compressionQuality: 50 93 | crunchedCompression: 0 94 | allowsAlphaSplitting: 0 95 | overridden: 0 96 | androidETC2FallbackOverride: 0 97 | forceMaximumCompressionQuality_BC6H_BC7: 0 98 | spriteSheet: 99 | serializedVersion: 2 100 | sprites: [] 101 | outline: [] 102 | physicsShape: [] 103 | bones: [] 104 | spriteID: 105 | internalID: 0 106 | vertices: [] 107 | indices: 108 | edges: [] 109 | weights: [] 110 | secondaryTextures: [] 111 | spritePackingTag: 112 | pSDRemoveMatte: 0 113 | pSDShowRemoveMatteOption: 0 114 | userData: 115 | assetBundleName: 116 | assetBundleVariant: 117 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Daz3DInstance.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace Daz3D 5 | { 6 | /// 7 | /// A component to attach to the scene instance of the prefab created by the DTUImporter 8 | /// allows the instance to be "refreshed" with the newer prefab, between successive import sessions 9 | /// If the scene containing the instance is open and the fbx is fresher than the scene, then 10 | /// a instance of the new prefab will replace the old 11 | /// TODO add a switch in the DTU JSON to override this behavior 12 | /// 13 | public class Daz3DInstance : MonoBehaviour 14 | { 15 | /// 16 | /// The FBX modelPrefab is used as the unifying key between the import session 17 | /// and the instance in the scene. 18 | /// 19 | public GameObject SourceFBX; 20 | 21 | [Tooltip("If true, future bridge imports will replace this instance in the scene, including any prefab overrides.")] 22 | public bool ReplaceOnImport = true; 23 | 24 | // // // // // // // // 25 | 26 | 27 | //adds rightclick menu to project view 28 | //[MenuItem("Assets/MUNKEE/DoSomething")] 29 | //public static void Init() 30 | //{ 31 | // var file = Selection.activeObject.name; 32 | // Debug.LogWarning(file); 33 | //} 34 | 35 | 36 | //// Add a menu item named "Do Something" to MyMenu in the menu bar. 37 | //[MenuItem("MyMenu/Do Something M U N K E E _____________")] 38 | //static void DoSomething() 39 | //{ 40 | // Debug.Log("Doing Something..."); 41 | //} 42 | 43 | 44 | 45 | // Add a menu item named "Do Something with a Shortcut Key" to MyMenu in the menu bar 46 | // and give it a shortcut (ctrl-g on Windows, cmd-g on macOS). 47 | //[MenuItem("MyMenu/Do Something with a Shortcut Key %g M U N K E E _____________")] 48 | //static void DoSomethingWithAShortcutKey() 49 | //{ 50 | // Debug.Log("Doing something with a Shortcut Key..."); 51 | //} 52 | 53 | // Add a menu item called "Double Mass" to a Rigidbody's context menu. 54 | //[MenuItem("CONTEXT/Rigidbody/Double Mass M U N K E E _____________")] 55 | //static void DoubleMass(MenuCommand command) 56 | //{ 57 | // Rigidbody body = (Rigidbody)command.context; 58 | // body.mass = body.mass * 2; 59 | // Debug.Log("Doubled Rigidbody's Mass to " + body.mass + " from Context Menu."); 60 | //} 61 | 62 | // Add a menu item to create custom GameObjects. 63 | // Priority 1 ensures it is grouped with the other menu items of the same kind 64 | // and propagated to the hierarchy dropdown and hierarchy context menus. 65 | //[MenuItem("GameObject/M U N K E E _____________/Custom Game Object", false, 10)] 66 | //static void CreateCustomGameObject(MenuCommand menuCommand) 67 | //{ 68 | // // Create a custom game object 69 | // GameObject go = new GameObject("Custom Game Object"); 70 | // // Ensure it gets reparented if this was a context click (otherwise does nothing) 71 | // GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); 72 | // // Register the creation in the undo system 73 | // Undo.RegisterCreatedObjectUndo(go, "Create " + go.name); 74 | // Selection.activeObject = go; 75 | //} 76 | 77 | 78 | 79 | 80 | 81 | 82 | } 83 | } -------------------------------------------------------------------------------- /Common/OpenSubdivInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class OpenSubdivInterface 6 | { 7 | 8 | }; 9 | 10 | // utility class for subdividing FbxScene 11 | class SubdivideFbxScene 12 | { 13 | public: 14 | SubdivideFbxScene(FbxScene* pScene, std::map* pLookupTable) 15 | { 16 | m_Scene = pScene; 17 | m_SubDLevel_NameLookup = pLookupTable; 18 | } 19 | virtual ~SubdivideFbxScene() {}; 20 | 21 | bool ProcessScene(); 22 | bool SaveClustersToScene(FbxScene* pDestScene); 23 | 24 | protected: 25 | bool ProcessNode(FbxNode* pNode); 26 | FbxMesh* SubdivideMesh(FbxNode* pNode, FbxMesh* pMesh, int subdLevel); 27 | bool SaveClustersToNode(FbxScene* pDestScene, FbxNode* pNode); 28 | FbxMesh* SaveClustersToMesh(FbxScene* pDestScene, FbxNode* pNode, FbxMesh* pMesh); 29 | 30 | FbxScene* m_Scene; 31 | std::map* m_SubDLevel_NameLookup; 32 | std::map m_FbxMesh_NameLookup; 33 | 34 | struct Vertex { 35 | 36 | // Minimal required interface ---------------------- 37 | Vertex() { } 38 | 39 | Vertex(Vertex const& src) { 40 | _position[0] = src._position[0]; 41 | _position[1] = src._position[1]; 42 | _position[2] = src._position[2]; 43 | } 44 | 45 | void Clear(void* = 0) { 46 | _position[0] = _position[1] = _position[2] = 0.0f; 47 | } 48 | 49 | void AddWithWeight(Vertex const& src, float weight) { 50 | _position[0] += weight * src._position[0]; 51 | _position[1] += weight * src._position[1]; 52 | _position[2] += weight * src._position[2]; 53 | } 54 | 55 | // Public interface ------------------------------------ 56 | void SetPosition(float x, float y, float z) { 57 | _position[0] = x; 58 | _position[1] = y; 59 | _position[2] = z; 60 | } 61 | 62 | void SetPosition(double x, double y, double z) { 63 | _position[0] = (float)x; 64 | _position[1] = (float)y; 65 | _position[2] = (float)z; 66 | } 67 | 68 | void SetVector(FbxVector4 vec) { 69 | _position[0] = (float)vec[0]; 70 | _position[1] = (float)vec[1]; 71 | _position[2] = (float)vec[2]; 72 | } 73 | 74 | const float* GetPosition() const { 75 | return _position; 76 | } 77 | 78 | FbxVector4 GetVector() { 79 | return FbxVector4(_position[0], _position[1], _position[2], 1.0f); 80 | } 81 | 82 | private: 83 | float _position[3]; 84 | }; 85 | 86 | typedef Vertex VertexPosition; 87 | 88 | struct SkinWeight { 89 | 90 | // Minimal required interface ---------------------- 91 | SkinWeight() { 92 | _weight = 0.0f; 93 | } 94 | 95 | SkinWeight(SkinWeight const& src) { 96 | _weight = src._weight; 97 | } 98 | 99 | void Clear(void* = 0) { 100 | _weight = 0.0f; 101 | } 102 | 103 | void AddWithWeight(SkinWeight const& src, float weight) { 104 | _weight += weight * src._weight; 105 | } 106 | 107 | // Public interface ------------------------------------ 108 | void SetWeight(float weight) { 109 | _weight = weight; 110 | } 111 | 112 | const float GetWeight() const { 113 | return _weight; 114 | } 115 | 116 | private: 117 | float _weight; 118 | }; 119 | 120 | }; 121 | 122 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/DazJSONHelper.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | 6 | namespace Daz3D 7 | { 8 | // [Serializable] 9 | // public class DTUData 10 | // { 11 | // //public string AssetName = "|||||||||||||||||"; //are these cruft from unreal dtu? 12 | // //public string AssetType = "|||||||||||||||||"; 13 | // //public string FBXFile = "|||||||||||||||||"; 14 | // //public string ImportFolder = "|||||||||||||||||"; 15 | 16 | // public List Materials = new List(); 17 | // public List Morphs = new List(); 18 | 19 | // [Serializable] 20 | // public class Material 21 | // { 22 | // public int Version = -999; 23 | // public string AssetName = "~~~~~~~~"; 24 | // public string MaterialName = "~~~~~~~~"; 25 | // public string MaterialType = "~~~~~~~~"; 26 | // public string Value = "~~~~~~~~"; 27 | // public List Properties = new List(); 28 | 29 | 30 | // [Serializable] 31 | // public class Property 32 | // { 33 | // public string Name = "@@@@@"; 34 | // public string Value = "@@@@@"; 35 | // public string DataType = "@@@@@"; 36 | // public string Texture = "@@@@@"; 37 | // } 38 | 39 | // } 40 | 41 | // [Serializable] 42 | // public class Morph 43 | // { 44 | // public string CTRLBodyBuilder; 45 | // } 46 | // } 47 | 48 | 49 | 50 | //} 51 | public static class DazJSONHelper 52 | { 53 | // public static string FixKeySpaces(string input) 54 | // { 55 | // var output = input.Replace("Asset Name", "AssetName"); 56 | // output = output.Replace("Asset Type", "AssetType"); 57 | // output = output.Replace("Import Folder", "ImportFolder"); 58 | // output = output.Replace("FBX File", "FBXFile"); 59 | 60 | // output = output.Replace("Material Name", "MaterialName"); 61 | // output = output.Replace("Material Type", "MaterialType"); 62 | // output = output.Replace("Data Type", "DataType"); 63 | 64 | // return output; 65 | 66 | // } 67 | 68 | public static string BuildUnityPath(string path, string subDir) 69 | { 70 | var result = Path.Combine(path, subDir).Replace("\\", "/"); //unity likes forward slashes in asset database paths; 71 | 72 | return result; 73 | } 74 | 75 | // // public static T[] FromJson(string json) 76 | // // { 77 | // // Wrapper wrapper = JsonUtility.FromJson>(json); 78 | // // return wrapper.Items; 79 | // // } 80 | 81 | // // public static string ToJson(T[] array) 82 | // // { 83 | // // Wrapper wrapper = new Wrapper(); 84 | // // wrapper.Items = array; 85 | // // return JsonUtility.ToJson(wrapper); 86 | // // } 87 | 88 | // // public static string ToJson(T[] array, bool prettyPrint) 89 | // // { 90 | // // Wrapper wrapper = new Wrapper(); 91 | // // wrapper.Items = array; 92 | // // return JsonUtility.ToJson(wrapper, prettyPrint); 93 | // // } 94 | 95 | // // [Serializable] 96 | // // private class Wrapper 97 | // // { 98 | // // public T[] Items; 99 | // // } 100 | } 101 | } 102 | 103 | 104 | -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Private/DazToUnrealTextures.cpp: -------------------------------------------------------------------------------- 1 | #include "DazToUnrealTextures.h" 2 | #include "DazToUnrealSettings.h" 3 | 4 | // Gets a texture specified in the settings for sub sarface aplha for a specified character and body part. 5 | FString FDazToUnrealTextures::GetSubSurfaceAlphaTexture(const DazCharacterType CharacterType, const FString& MaterialName) 6 | { 7 | const UDazToUnrealSettings* CachedSettings = GetDefault(); 8 | if (CharacterType == DazCharacterType::Genesis8Male) 9 | { 10 | if (MaterialName.EndsWith(TEXT("_Arms")) || 11 | MaterialName.EndsWith(TEXT("_Fingernails"))) 12 | { 13 | return CachedSettings->ArmsSubSurfaceOpacityGenesis8MaleTexture.ToString(); 14 | } 15 | if (MaterialName.EndsWith(TEXT("_Face")) || 16 | MaterialName.EndsWith(TEXT("_Lips")) || 17 | MaterialName.EndsWith(TEXT("_Ears"))) 18 | { 19 | return CachedSettings->FaceSubSurfaceOpacityGenesis8MaleTexture.ToString(); 20 | } 21 | if (MaterialName.EndsWith(TEXT("_Torso")) || 22 | MaterialName.EndsWith(TEXT("_Genitalia"))) 23 | { 24 | return CachedSettings->TorsoSubSurfaceOpacityGenesis8MaleTexture.ToString(); 25 | } 26 | if (MaterialName.EndsWith(TEXT("_Legs")) || 27 | MaterialName.EndsWith(TEXT("_ToeNails"))) 28 | { 29 | return CachedSettings->LegsSubSurfaceOpacityGenesis8MaleTexture.ToString(); 30 | } 31 | } 32 | 33 | if (CharacterType == DazCharacterType::Genesis8Female) 34 | { 35 | if (MaterialName.EndsWith(TEXT("_Arms")) || 36 | MaterialName.EndsWith(TEXT("_Fingernails"))) 37 | { 38 | return CachedSettings->ArmsSubSurfaceOpacityGenesis8FemaleTexture.ToString(); 39 | } 40 | if (MaterialName.EndsWith(TEXT("_Face")) || 41 | MaterialName.EndsWith(TEXT("_Lips")) || 42 | MaterialName.EndsWith(TEXT("_Ears"))) 43 | { 44 | return CachedSettings->FaceSubSurfaceOpacityGenesis8FemaleTexture.ToString(); 45 | } 46 | if (MaterialName.EndsWith(TEXT("_Torso")) || 47 | MaterialName.EndsWith(TEXT("_Genitalia"))) 48 | { 49 | return CachedSettings->TorsoSubSurfaceOpacityGenesis8FemaleTexture.ToString(); 50 | } 51 | if (MaterialName.EndsWith(TEXT("_Legs")) || 52 | MaterialName.EndsWith(TEXT("_ToeNails"))) 53 | { 54 | return CachedSettings->LegsSubSurfaceOpacityGenesis8FemaleTexture.ToString(); 55 | } 56 | } 57 | 58 | if (CharacterType == DazCharacterType::Genesis3Male) 59 | { 60 | if (MaterialName.EndsWith(TEXT("_Arms")) || 61 | MaterialName.EndsWith(TEXT("_Fingernails"))) 62 | { 63 | return CachedSettings->ArmsSubSurfaceOpacityGenesis3MaleTexture.ToString(); 64 | } 65 | if (MaterialName.EndsWith(TEXT("_Face")) || 66 | MaterialName.EndsWith(TEXT("_Lips")) || 67 | MaterialName.EndsWith(TEXT("_Ears"))) 68 | { 69 | return CachedSettings->FaceSubSurfaceOpacityGenesis3MaleTexture.ToString(); 70 | } 71 | if (MaterialName.EndsWith(TEXT("_Torso")) || 72 | MaterialName.EndsWith(TEXT("_Genitalia"))) 73 | { 74 | return CachedSettings->TorsoSubSurfaceOpacityGenesis3MaleTexture.ToString(); 75 | } 76 | if (MaterialName.EndsWith(TEXT("_Legs")) || 77 | MaterialName.EndsWith(TEXT("_ToeNails"))) 78 | { 79 | return CachedSettings->LegsSubSurfaceOpacityGenesis3MaleTexture.ToString(); 80 | } 81 | } 82 | 83 | if (CharacterType == DazCharacterType::Genesis3Female) 84 | { 85 | if (MaterialName.EndsWith(TEXT("_Arms")) || 86 | MaterialName.EndsWith(TEXT("_Fingernails"))) 87 | { 88 | return CachedSettings->ArmsSubSurfaceOpacityGenesis3FemaleTexture.ToString(); 89 | } 90 | if (MaterialName.EndsWith(TEXT("_Face")) || 91 | MaterialName.EndsWith(TEXT("_Lips")) || 92 | MaterialName.EndsWith(TEXT("_Ears"))) 93 | { 94 | return CachedSettings->FaceSubSurfaceOpacityGenesis3FemaleTexture.ToString(); 95 | } 96 | if (MaterialName.EndsWith(TEXT("_Torso")) || 97 | MaterialName.EndsWith(TEXT("_Genitalia"))) 98 | { 99 | return CachedSettings->TorsoSubSurfaceOpacityGenesis3FemaleTexture.ToString(); 100 | } 101 | if (MaterialName.EndsWith(TEXT("_Legs")) || 102 | MaterialName.EndsWith(TEXT("_ToeNails"))) 103 | { 104 | return CachedSettings->LegsSubSurfaceOpacityGenesis3FemaleTexture.ToString(); 105 | } 106 | } 107 | return TEXT(""); 108 | } -------------------------------------------------------------------------------- /Unreal/UnrealPlugin/DazToUnreal/Source/DazToUnreal/Public/DazToUnreal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "Modules/ModuleManager.h" 5 | #include "Common/UdpSocketBuilder.h" 6 | #include "Containers/Ticker.h" 7 | #include "Widgets/SWidget.h" 8 | #include "Framework/Commands/UICommandList.h" 9 | 10 | #include "DazToUnrealEnums.h" 11 | 12 | class FToolBarBuilder; 13 | class FMenuBuilder; 14 | struct FDUFTextureProperty; 15 | //class FbxNode; 16 | 17 | 18 | enum DazAssetType 19 | { 20 | SkeletalMesh, 21 | StaticMesh, 22 | Animation 23 | }; 24 | 25 | 26 | class FDazToUnrealModule : public IModuleInterface 27 | { 28 | public: 29 | 30 | /** IModuleInterface implementation */ 31 | virtual void StartupModule() override; 32 | virtual void ShutdownModule() override; 33 | 34 | static inline FDazToUnrealModule& Get() 35 | { 36 | return FModuleManager::LoadModuleChecked< FDazToUnrealModule >("DazToUnreal"); 37 | } 38 | 39 | /** This function will be bound to Command (by default it will bring up plugin window) */ 40 | //void PluginButtonClicked(); 41 | 42 | //** Runs the installer to install the Daz Studio plugin*/ 43 | void InstallDazStudioPlugin(); 44 | 45 | //** Copies the skeleton assets and redirects any references to them*/ 46 | void InstallSkeletonAssetsToProject(); 47 | 48 | //** Copies the material assets and redirects and references to them*/ 49 | void InstallMaterialAssetsToProject(); 50 | 51 | /** Function to start the import process*/ 52 | UObject* ImportFromDaz(TSharedPtr JsonObject); 53 | 54 | private: 55 | 56 | void AddToolbarExtension(FToolBarBuilder& Builder); 57 | void AddMenuExtension(FMenuBuilder& Builder); 58 | TSharedRef MakeDazToUnrealToolbarMenu(TSharedPtr DazToUnrealCommandList); 59 | 60 | //TSharedRef OnSpawnPluginTab(const class FSpawnTabArgs& SpawnTabArgs); 61 | 62 | private: 63 | TSharedPtr PluginCommands; 64 | 65 | // Network listener functions 66 | private: 67 | /** Starts the UDP listener for receiving messages from Daz3D*/ 68 | void StartupUDPListener(); 69 | 70 | /** Stops the listener*/ 71 | void ShutdownUDPListener(); 72 | 73 | /** Socket for the listener*/ 74 | FSocket* ServerSocket = nullptr; 75 | 76 | /** Delegate for the tick function. Incomming messages are checked on tick*/ 77 | FTickerDelegate TickDelegate; 78 | 79 | /** DelegateHandle for the tick function*/ 80 | FDelegateHandle TickDelegateHandle; 81 | 82 | /** Tick function for handling incomming messages from Daz3D*/ 83 | bool Tick(float DeltaTime); 84 | 85 | //void GetWeights(FbxNode *SceneNode, TMap>& VertexPolygons, TMap& ClusterWeights, FVector TargetPosition, int SearchFromVertex, TArray& TouchedPolygons, TArray& TouchedVertices, double& WeightsOut, double& DistancesOut, int32 Depth); 86 | 87 | private: 88 | 89 | /** Helper function to create a directory and return true if the directory exists*/ 90 | bool MakeDirectoryAndCheck(FString& Directory); 91 | 92 | /** Imports the textures for the model*/ 93 | bool ImportTextureAssets(TArray& SourcePaths, FString& ImportLocation); 94 | 95 | /** Imports the modified FBX file*/ 96 | UObject* ImportFBXAsset(const FString& SourcePath, const FString& ImportLocation, const DazAssetType& AssetType, const DazCharacterType& CharacterType, const FString& CharacterTypeName); 97 | 98 | /** Function for creating the Material Instances for the model*/ 99 | bool CreateMaterials(const FString CharacterMaterialFolder, const FString CharacterTexturesFolder, const TArray& MaterialNames, TMap> MaterialProperties, const DazCharacterType CharacterType); 100 | 101 | /** Set material properties that will be set on the Material Instances*/ 102 | void SetMaterialProperty(const FString& MaterialName, const FString& PropertyName, const FString& PropertyType, const FString& PropertyValue, TMap>& MaterialProperties); 103 | FString GetSubSurfaceAlphaTexture(const DazCharacterType CharacterType, const FString& MaterialName); 104 | 105 | /** Converts a hex string to a Linear color.*/ 106 | FLinearColor FromHex(const FString& HexString); 107 | }; -------------------------------------------------------------------------------- /Unity/DazStudioPlugin/DzUnityMorphSelectionDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "dzbasicdialog.h" 3 | #include 4 | #include 5 | #include 6 | #include "dznode.h" 7 | 8 | class QListWidget; 9 | class QListWidgetItem; 10 | class QTreeWidget; 11 | class QTreeWidgetItem; 12 | class QLineEdit; 13 | class QComboBox; 14 | 15 | struct MorphInfo { 16 | QString Name; 17 | QString Label; 18 | QString Type; 19 | QString Path; 20 | 21 | inline bool operator==(MorphInfo other) 22 | { 23 | if (Name == other.Name) 24 | { 25 | return true; 26 | } 27 | return false; 28 | } 29 | 30 | MorphInfo() 31 | { 32 | Name = QString(); 33 | Label = QString(); 34 | Type = QString(); 35 | Path = QString(); 36 | } 37 | }; 38 | 39 | class DzUnityMorphSelectionDialog : public DzBasicDialog { 40 | Q_OBJECT 41 | public: 42 | 43 | DzUnityMorphSelectionDialog(QWidget* parent); 44 | virtual ~DzUnityMorphSelectionDialog() {} 45 | 46 | // Setup the dialog 47 | void PrepareDialog(); 48 | 49 | // Singleton access 50 | static DzUnityMorphSelectionDialog* Get(QWidget* Parent) 51 | { 52 | if (singleton == nullptr) 53 | { 54 | singleton = new DzUnityMorphSelectionDialog(Parent); 55 | } 56 | singleton->PrepareDialog(); 57 | return singleton; 58 | } 59 | 60 | // Get the morph string in the format for the Daz FBX Export 61 | QString GetMorphString(); 62 | 63 | // Get the morph string in the format used for presets 64 | QString GetMorphCSVString(); 65 | 66 | // Get the morph string in an internal name = friendly name format 67 | // Used to rename them to the friendly name in Unity 68 | QMap GetMorphRenaming(); 69 | 70 | 71 | public slots: 72 | void FilterChanged(const QString& filter); 73 | void ItemSelectionChanged(); 74 | void HandleAddMorphsButton(); 75 | void HandleRemoveMorphsButton(); 76 | void HandleSavePreset(); 77 | void HandlePresetChanged(const QString& presetName); 78 | void HandleArmJCMMorphsButton(); 79 | void HandleLegJCMMorphsButton(); 80 | void HandleTorsoJCMMorphsButton(); 81 | 82 | private: 83 | 84 | // Refresh the list of possible presets from disk 85 | void RefreshPresetsCombo(); 86 | 87 | // Recursive function for finding all morphs for a node 88 | QStringList GetAvailableMorphs(DzNode* Node); 89 | 90 | void UpdateMorphsTree(); 91 | 92 | // Returns the tree node for the morph name (with path) 93 | // Builds out the structure of the tree as needed. 94 | QTreeWidgetItem* FindTreeItem(QTreeWidgetItem* parent, QString name); 95 | 96 | void SavePresetFile(QString filePath); 97 | 98 | // Updates selectedInTree to have all the morphs for the nodes 99 | // selected in the left tree 100 | void SelectMorphsInNode(QTreeWidgetItem* item); 101 | 102 | // Rebuild the right box that lists all the morphs that will export. 103 | void RefreshExportMorphList(); 104 | 105 | // Morphs currently selected in the left tree box 106 | QList selectedInTree; 107 | 108 | // List of morphs moved to the export box 109 | QList morphsToExport; 110 | 111 | // Store off the presetsFolder path at dialog setup 112 | QString presetsFolder; 113 | 114 | static DzUnityMorphSelectionDialog* singleton; 115 | 116 | // A list of all found morphs. 117 | QStringList morphList; 118 | 119 | // Mapping of morph name to label 120 | QMap morphNameMapping; 121 | 122 | // Mapping of morph name to MorphInfo 123 | //TODO: morphNameMapping (and others) should be replaced by this 124 | QMap morphs; 125 | 126 | // List of morphs (recursive) under each tree node 127 | // For convenience populating the middle box. 128 | QMap> morphsForNode; 129 | 130 | // Force the size of the dialog 131 | QSize minimumSizeHint() const override; 132 | 133 | // Widgets the dialog will access after construction 134 | QListWidget* morphListWidget; 135 | QListWidget* morphExportListWidget; 136 | QTreeWidget* morphTreeWidget; 137 | QLineEdit* filterEdit; 138 | QComboBox* presetCombo; 139 | 140 | QTreeWidgetItem* fullBodyMorphTreeItem; 141 | QTreeWidgetItem* charactersTreeItem; 142 | }; 143 | -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/DzUnrealMorphSelectionDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "dzbasicdialog.h" 3 | #include 4 | #include 5 | #include 6 | #include "dznode.h" 7 | 8 | class QListWidget; 9 | class QListWidgetItem; 10 | class QTreeWidget; 11 | class QTreeWidgetItem; 12 | class QLineEdit; 13 | class QComboBox; 14 | 15 | struct MorphInfo { 16 | QString Name; 17 | QString Label; 18 | QString Type; 19 | QString Path; 20 | 21 | inline bool operator==(MorphInfo other) 22 | { 23 | if (Name == other.Name) 24 | { 25 | return true; 26 | } 27 | return false; 28 | } 29 | 30 | MorphInfo() 31 | { 32 | Name = QString(); 33 | Label = QString(); 34 | Type = QString(); 35 | Path = QString(); 36 | } 37 | }; 38 | 39 | class DzUnrealMorphSelectionDialog : public DzBasicDialog { 40 | Q_OBJECT 41 | public: 42 | 43 | DzUnrealMorphSelectionDialog(QWidget* parent); 44 | virtual ~DzUnrealMorphSelectionDialog() {} 45 | 46 | // Setup the dialog 47 | void PrepareDialog(); 48 | 49 | // Singleton access 50 | static DzUnrealMorphSelectionDialog* Get(QWidget* Parent) 51 | { 52 | if (singleton == nullptr) 53 | { 54 | singleton = new DzUnrealMorphSelectionDialog(Parent); 55 | } 56 | singleton->PrepareDialog(); 57 | return singleton; 58 | } 59 | 60 | // Get the morph string in the format for the Daz FBX Export 61 | QString GetMorphString(); 62 | 63 | // Get the morph string in the format used for presets 64 | QString GetMorphCSVString(); 65 | 66 | // Get the morph string in an internal name = friendly name format 67 | // Used to rename them to the friendly name in Unreal 68 | QMap GetMorphRenaming(); 69 | 70 | 71 | public slots: 72 | void FilterChanged(const QString& filter); 73 | void ItemSelectionChanged(); 74 | void HandleAddMorphsButton(); 75 | void HandleRemoveMorphsButton(); 76 | void HandleSavePreset(); 77 | void HandlePresetChanged(const QString& presetName); 78 | void HandleArmJCMMorphsButton(); 79 | void HandleLegJCMMorphsButton(); 80 | void HandleTorsoJCMMorphsButton(); 81 | 82 | private: 83 | 84 | // Refresh the list of possible presets from disk 85 | void RefreshPresetsCombo(); 86 | 87 | // Recursive function for finding all morphs for a node 88 | QStringList GetAvailableMorphs(DzNode* Node); 89 | 90 | void UpdateMorphsTree(); 91 | 92 | // Returns the tree node for the morph name (with path) 93 | // Builds out the structure of the tree as needed. 94 | QTreeWidgetItem* FindTreeItem(QTreeWidgetItem* parent, QString name); 95 | 96 | void SavePresetFile(QString filePath); 97 | 98 | // Updates selectedInTree to have all the morphs for the nodes 99 | // selected in the left tree 100 | void SelectMorphsInNode(QTreeWidgetItem* item); 101 | 102 | // Rebuild the right box that lists all the morphs that will export. 103 | void RefreshExportMorphList(); 104 | 105 | // Morphs currently selected in the left tree box 106 | QList selectedInTree; 107 | 108 | // List of morphs moved to the export box 109 | QList morphsToExport; 110 | 111 | // Store off the presetsFolder path at dialog setup 112 | QString presetsFolder; 113 | 114 | static DzUnrealMorphSelectionDialog* singleton; 115 | 116 | // A list of all found morphs. 117 | QStringList morphList; 118 | 119 | // Mapping of morph name to label 120 | QMap morphNameMapping; 121 | 122 | // Mapping of morph name to MorphInfo 123 | //TODO: morphNameMapping (and others) should be replaced by this 124 | QMap morphs; 125 | 126 | // List of morphs (recursive) under each tree node 127 | // For convenience populating the middle box. 128 | QMap> morphsForNode; 129 | 130 | // Force the size of the dialog 131 | QSize minimumSizeHint() const override; 132 | 133 | // Widgets the dialog will access after construction 134 | QListWidget* morphListWidget; 135 | QListWidget* morphExportListWidget; 136 | QTreeWidget* morphTreeWidget; 137 | QLineEdit* filterEdit; 138 | QComboBox* presetCombo; 139 | 140 | QTreeWidgetItem* fullBodyMorphTreeItem; 141 | QTreeWidgetItem* charactersTreeItem; 142 | }; 143 | -------------------------------------------------------------------------------- /Common/OpenFBXInterface.cpp: -------------------------------------------------------------------------------- 1 | 2 | /**************************************************************************************** 3 | Portions of this file is based on source code from Autodesk, 4 | and is used under license below: 5 | 6 | Copyright (C) 2015 Autodesk, Inc. 7 | All rights reserved. 8 | Use of this software is subject to the terms of the Autodesk license agreement 9 | provided at the time of installation or download, or which otherwise accompanies 10 | this software in either electronic or hard copy form. 11 | ****************************************************************************************/ 12 | 13 | #include 14 | 15 | #ifdef __APPLE__ 16 | #define USING_LIBSTDCPP 1 17 | #endif 18 | #include 19 | 20 | #include "OpenFBXInterface.h" 21 | 22 | OpenFBXInterface* OpenFBXInterface::singleton = nullptr; 23 | 24 | // Constructor 25 | OpenFBXInterface::OpenFBXInterface() 26 | { 27 | // Create FbxManager 28 | m_fbxManager = FbxManager::Create(); 29 | if (!m_fbxManager) 30 | { 31 | throw (std::runtime_error("OpenFBXInterface: could not create FbxManager")); 32 | } 33 | 34 | // Create FbxIOSettings 35 | m_fbxIOSettings = FbxIOSettings::Create(m_fbxManager, IOSROOT); 36 | m_fbxManager->SetIOSettings(m_fbxIOSettings); 37 | 38 | // Initialize Fbx Plugin folder 39 | FbxString appPath = FbxGetApplicationDirectory(); 40 | m_fbxManager->LoadPluginsDirectory(appPath.Buffer()); 41 | 42 | m_ErrorCode = 0; 43 | m_ErrorString = ""; 44 | 45 | } 46 | 47 | // Destructor 48 | OpenFBXInterface::~OpenFBXInterface() 49 | { 50 | if (m_fbxManager) m_fbxManager->Destroy(); 51 | } 52 | 53 | bool OpenFBXInterface::SaveScene(FbxScene* pScene, QString sFilename, int nFileFormat, bool bEmbedMedia) 54 | { 55 | bool bStatus = true; 56 | 57 | // Create FbxExporter 58 | FbxExporter* pExporter = FbxExporter::Create(m_fbxManager, ""); 59 | 60 | // Check if fileformat is invalid 61 | if (nFileFormat < 0 || nFileFormat >= m_fbxManager->GetIOPluginRegistry()->GetWriterFormatCount()) 62 | { 63 | // replace with valid format 64 | nFileFormat = m_fbxManager->GetIOPluginRegistry()->GetNativeWriterFormat(); 65 | } 66 | 67 | m_fbxIOSettings->SetBoolProp(EXP_FBX_MATERIAL, true); 68 | m_fbxIOSettings->SetBoolProp(EXP_FBX_TEXTURE, true); 69 | m_fbxIOSettings->SetBoolProp(EXP_FBX_EMBEDDED, bEmbedMedia); 70 | m_fbxIOSettings->SetBoolProp(EXP_FBX_SHAPE, true); 71 | m_fbxIOSettings->SetBoolProp(EXP_FBX_GOBO, true); 72 | m_fbxIOSettings->SetBoolProp(EXP_FBX_ANIMATION, true); 73 | m_fbxIOSettings->SetBoolProp(EXP_FBX_GLOBAL_SETTINGS, true); 74 | 75 | if (pExporter->Initialize(sFilename.toLocal8Bit().data(), nFileFormat, m_fbxIOSettings) == false) 76 | { 77 | m_ErrorString = QString(pExporter->GetStatus().GetErrorString()); 78 | m_ErrorCode = pExporter->GetStatus().GetCode(); 79 | pExporter->Destroy(); 80 | return false; 81 | } 82 | 83 | bStatus = pExporter->Export(pScene); 84 | if (!bStatus) 85 | { 86 | m_ErrorString = QString(pExporter->GetStatus().GetErrorString()); 87 | m_ErrorCode = pExporter->GetStatus().GetCode(); 88 | } 89 | 90 | pExporter->Destroy(); 91 | 92 | return bStatus; 93 | 94 | } 95 | 96 | bool OpenFBXInterface::LoadScene(FbxScene* pScene, QString sFilename) 97 | { 98 | bool bStatus = true; 99 | 100 | FbxImporter* pImporter = FbxImporter::Create(m_fbxManager, ""); 101 | 102 | if (pImporter->Initialize(sFilename.toLocal8Bit().data(), -1, m_fbxIOSettings) == false) 103 | { 104 | m_ErrorString = QString(pImporter->GetStatus().GetErrorString()); 105 | m_ErrorCode = pImporter->GetStatus().GetCode(); 106 | pImporter->Destroy(); 107 | return false; 108 | } 109 | 110 | if (pImporter->IsFBX() == false) 111 | { 112 | m_ErrorCode = -1; 113 | m_ErrorString = QString("OpenFBXInterface: loaded scene file has unrecognized FBX file format."); 114 | pImporter->Destroy(); 115 | return false; 116 | } 117 | 118 | bStatus = pImporter->Import(pScene); 119 | if (!bStatus) 120 | { 121 | m_ErrorString = QString(pImporter->GetStatus().GetErrorString()); 122 | m_ErrorCode = pImporter->GetStatus().GetCode(); 123 | } 124 | 125 | pImporter->Destroy(); 126 | return bStatus; 127 | 128 | } 129 | 130 | 131 | FbxScene* OpenFBXInterface::CreateScene(QString sSceneName) 132 | { 133 | FbxScene* pNewScene = FbxScene::Create(m_fbxManager, sSceneName.toLocal8Bit().data()); 134 | 135 | return pNewScene; 136 | } 137 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/ClothCollisionAssigner.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.Serialization; 5 | using System; 6 | 7 | 8 | public class ClothCollisionAssigner : MonoBehaviour 9 | { 10 | [Header("Paired Sphere Colliders")] 11 | public SphereCollider[] m_UpperbodyColliders; 12 | public SphereCollider[] m_LowerbodyColliders; 13 | 14 | [Serializable] 15 | public class ClothConfig 16 | { 17 | public Cloth m_ClothToManage; 18 | public bool m_UpperBody; 19 | public bool m_LowerBody; 20 | } 21 | 22 | [Header("Cloth Collision Assignments")] 23 | public ClothConfig[] m_ClothConfigurationList; 24 | 25 | private void addCollidersToCloth(SphereCollider[] collider_list, Cloth cloth_component) 26 | { 27 | int collider_size = 0; 28 | foreach (SphereCollider sphere_collider in collider_list) 29 | { 30 | if (sphere_collider != null) 31 | { 32 | collider_size++; 33 | } 34 | } 35 | if (collider_size % 2 != 0) 36 | { 37 | collider_size += 1; 38 | } 39 | int original_size = 0; 40 | if (cloth_component.sphereColliders != null) 41 | { 42 | original_size = cloth_component.sphereColliders.Length; 43 | } 44 | ClothSphereColliderPair[] colliderpair_list = new ClothSphereColliderPair[original_size + (collider_size / 2)]; 45 | if (original_size > 0) 46 | { 47 | Array.Copy(cloth_component.sphereColliders, colliderpair_list, original_size); 48 | } 49 | for (int i = 0; i < collider_size / 2; i++) 50 | { 51 | 52 | colliderpair_list[original_size + i].first = collider_list[i * 2]; 53 | colliderpair_list[original_size + i].second = collider_list[i * 2 + 1]; 54 | } 55 | cloth_component.sphereColliders = colliderpair_list; 56 | 57 | } 58 | 59 | public void addClothConfig(ClothConfig newConfig) 60 | { 61 | int new_size = m_ClothConfigurationList.Length + 1; 62 | Array.Resize(ref m_ClothConfigurationList, new_size); 63 | m_ClothConfigurationList[new_size - 1] = newConfig; 64 | } 65 | 66 | 67 | // merge cloth collision rig into rootnode of main figure rig 68 | public void mergeRig(Transform destination_rootTransform) 69 | { 70 | Transform source_rootTransform = this.transform.Find("hip"); 71 | List childTransform_stack = new List(); 72 | childTransform_stack.Add(source_rootTransform); 73 | 74 | while (childTransform_stack.Count > 0) 75 | { 76 | int next_Index = childTransform_stack.Count - 1; 77 | Transform child = childTransform_stack[next_Index]; 78 | childTransform_stack.RemoveAt(next_Index); 79 | 80 | if (child == null) continue; 81 | 82 | // add all children to stack 83 | for (int i = 0; i < child.childCount; i++) 84 | { 85 | Transform grandchild = child.GetChild(i); 86 | if (grandchild != null) 87 | childTransform_stack.Add(grandchild); 88 | } 89 | 90 | // check if child is a dforce collider 91 | if (child.CompareTag("dForceCollider")) 92 | { 93 | // 1. unroll parent tree to get full path 94 | Transform parent = child.parent; 95 | String path_name = parent.name; 96 | while (parent != null && parent.parent != source_rootTransform) 97 | { 98 | if (parent.parent == null) break; 99 | parent = parent.parent; 100 | path_name = parent.name + "/" + path_name; 101 | } 102 | // 2. find destination parent node 103 | var dest_parent = destination_rootTransform.Find(path_name); 104 | if (dest_parent != null) 105 | { 106 | // 3. move child to destination parent, worldspace = false 107 | child.transform.SetParent(dest_parent, false); 108 | } 109 | } 110 | 111 | } 112 | 113 | } 114 | 115 | public void ClearAllAssignments() 116 | { 117 | foreach (ClothConfig cloth_config in m_ClothConfigurationList) 118 | { 119 | if (cloth_config == null) 120 | continue; 121 | // delete existing cloth collisions 122 | if (cloth_config.m_ClothToManage != null && cloth_config.m_ClothToManage.sphereColliders != null) 123 | cloth_config.m_ClothToManage.sphereColliders = null; 124 | } 125 | } 126 | 127 | public void AssignClothCollisionRigs() 128 | { 129 | foreach (ClothConfig cloth_config in m_ClothConfigurationList) 130 | { 131 | if (cloth_config == null) 132 | continue; 133 | if (cloth_config.m_UpperBody) 134 | addCollidersToCloth(m_UpperbodyColliders, cloth_config.m_ClothToManage); 135 | if (cloth_config.m_LowerBody) 136 | addCollidersToCloth(m_LowerbodyColliders, cloth_config.m_ClothToManage); 137 | } 138 | } 139 | 140 | // Start is called before the first frame update 141 | void Start() 142 | { 143 | ClearAllAssignments(); 144 | 145 | AssignClothCollisionRigs(); 146 | 147 | } 148 | 149 | // Update is called once per frame 150 | void Update() 151 | { 152 | 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/CollapsedVertexArray.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | ///////////////////////////////////////////////////////////////// 6 | // SkinnedMesh vertex index TO Cloth vertex index 7 | ///////////////////////////////////////////////////////////////// 8 | [System.Serializable] 9 | public class CollapsedVertexArray 10 | { 11 | private Dictionary m_LookupTable; 12 | private Dictionary> m_CollapsedVertices; 13 | private int m_UniqueVertexCount; 14 | 15 | public class CollapsedVertex 16 | { 17 | public Vector3 vertex; 18 | public int unique_index; 19 | public List indexes; 20 | 21 | public CollapsedVertex(Vector3 a_vertex, int index, int a_unique_index) 22 | { 23 | vertex = a_vertex; 24 | indexes = new List(1) { index }; 25 | unique_index = a_unique_index; 26 | } 27 | 28 | public void AddIndex(int index) 29 | { 30 | indexes.Add(index); 31 | } 32 | 33 | public static bool operator ==(CollapsedVertex a, Vector3 b) => a.vertex == b; 34 | public static bool operator !=(CollapsedVertex a, Vector3 b) => a.vertex != b; 35 | 36 | public static bool operator ==(CollapsedVertex a, CollapsedVertex b) => a.vertex == b.vertex; 37 | public static bool operator !=(CollapsedVertex a, CollapsedVertex b) => a.vertex != b.vertex; 38 | public override bool Equals(object obj) => this.vertex.Equals(obj); 39 | public override int GetHashCode() => this.vertex.GetHashCode(); 40 | 41 | } 42 | 43 | public int Length 44 | { 45 | get 46 | { 47 | if (m_LookupTable == null || m_LookupTable.Count == 0) 48 | { 49 | //Debug.LogError("CollapsedVertexArray.Length: m_LookupTable is null"); 50 | return -1; 51 | } 52 | 53 | if (m_LookupTable.Count < m_UniqueVertexCount) 54 | { 55 | Debug.LogWarning("mLookupTable.Count[" + m_LookupTable.Count + "] may not contain all unique vertices [" + m_UniqueVertexCount + "]"); 56 | } 57 | 58 | return m_UniqueVertexCount; 59 | } 60 | } 61 | 62 | public int LookupIndex(int a_index) 63 | { 64 | if (m_LookupTable != null) 65 | { 66 | if (m_LookupTable.ContainsKey(a_index)) 67 | return m_LookupTable[a_index]; 68 | } 69 | 70 | return -1; 71 | 72 | } 73 | 74 | public CollapsedVertexArray(Vector3[] a_vertices) 75 | { 76 | if (a_vertices.Length <= 0) 77 | { 78 | m_UniqueVertexCount = -1; 79 | return; 80 | } 81 | 82 | m_CollapsedVertices = new Dictionary>(a_vertices.Length); 83 | for (int i = 0; i < a_vertices.Length; i++) 84 | { 85 | Vector3 a_vert = a_vertices[i]; 86 | bool vert_is_unique = true; 87 | if (m_CollapsedVertices.ContainsKey(a_vert.GetHashCode())) 88 | { 89 | // get optimized (hashcode filtered) list of verts, check against each one for uniqueness 90 | List cvert_list = m_CollapsedVertices[a_vert.GetHashCode()]; 91 | foreach (CollapsedVertex cvert in cvert_list) 92 | { 93 | if (cvert == a_vert) 94 | { 95 | vert_is_unique = false; 96 | cvert.AddIndex(i); 97 | break; 98 | } 99 | } 100 | if (vert_is_unique) 101 | { 102 | // add to end of unqiue verts array 103 | //m_CollapsedVertices[m_UniqueVertexCount++] = new CollapsedVertex(a_vert, i); 104 | cvert_list.Add(new CollapsedVertex(a_vert, i, m_UniqueVertexCount++)); 105 | } 106 | 107 | } 108 | else 109 | { 110 | // assume unqiue 111 | m_CollapsedVertices.Add(a_vert.GetHashCode(), new List(1) { new CollapsedVertex(a_vert, i, m_UniqueVertexCount++) }); 112 | } 113 | 114 | } 115 | 116 | // build lookup tables / Dictionaries 117 | m_LookupTable = new Dictionary(a_vertices.Length); 118 | foreach (List cvert_list in m_CollapsedVertices.Values) 119 | { 120 | foreach (CollapsedVertex cvert in cvert_list) 121 | { 122 | foreach (int key in cvert.indexes) 123 | { 124 | if (m_LookupTable.ContainsKey(key)) 125 | { 126 | if (m_LookupTable[key] != cvert.unique_index) 127 | { 128 | Debug.LogWarning("CollapsedVertexArray: lookup table generator is overwriting unique index with another value"); 129 | m_LookupTable[key] = cvert.unique_index; 130 | } 131 | } 132 | else 133 | { 134 | m_LookupTable.Add(key, cvert.unique_index); 135 | } 136 | } 137 | 138 | } 139 | } 140 | 141 | //Debug.Log("Finished CollapsedVertexArray: original Verts=" + a_vertices.Length + ", unique Verts=" + m_UniqueVertexCount); 142 | return; 143 | 144 | } 145 | 146 | } 147 | ///////////////////////////////////////////////////////////////// 148 | // End: SkinnedMesh vertex index TO Cloth vertex index 149 | ///////////////////////////////////////////////////////////////// 150 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/DetectRenderPipeline.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using System.Linq; 6 | 7 | #if UNITY_EDITOR 8 | //[InitializeOnLoad] 9 | public static class DetectRenderPipeline 10 | { 11 | 12 | public static readonly string[] usingRPSymbols = new string[] { 13 | "USING_HDRP", 14 | "USING_URP", 15 | "USING_BUILTIN", 16 | "USING_2019", 17 | }; 18 | 19 | static string CleanPreprocessorDirectives(string definedSymbolsString) 20 | { 21 | List allDefinedSymbols = definedSymbolsString.Split(';').ToList(); 22 | 23 | foreach (string removeSymbol in usingRPSymbols) 24 | { 25 | if (allDefinedSymbols.Contains(removeSymbol)) 26 | { 27 | allDefinedSymbols.Remove(removeSymbol); 28 | if (!allDefinedSymbols.Contains(removeSymbol)) 29 | { 30 | // Debug.Log("Defined Symbol removed: " + removeSymbol); 31 | } 32 | else 33 | { 34 | // Debug.LogError("Defined Symbol could not be removed: " + removeSymbol); 35 | } 36 | } 37 | else 38 | { 39 | // Debug.Log("Defined Symbol not detected: " + removeSymbol); 40 | } 41 | } 42 | 43 | return string.Join(";", allDefinedSymbols.ToArray()); 44 | } 45 | 46 | static string DetectAndSetSymbolString(string definedSymbols) 47 | { 48 | string newSymbolString = ""; 49 | 50 | if (definedSymbols != "") 51 | { 52 | newSymbolString = definedSymbols + ";"; 53 | } 54 | if (IsHDRPInstalled()) 55 | { 56 | newSymbolString += "USING_HDRP"; 57 | } 58 | else if (IsURPInstalled()) 59 | { 60 | newSymbolString += "USING_URP"; 61 | // check for 2019 62 | if (Application.unityVersion.Contains("2019")) 63 | { 64 | newSymbolString += ";USING_2019"; 65 | } 66 | } 67 | else 68 | { 69 | newSymbolString += "USING_BUILTIN"; 70 | } 71 | 72 | return newSymbolString; 73 | } 74 | 75 | //[UnityEditor.Callbacks.DidReloadScripts] 76 | static void CommitDefinedSymbols(string newSymbolsString) 77 | { 78 | Debug.Log("Attempting to write new PreprocessorDirectives: " + newSymbolsString); 79 | PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, newSymbolsString); 80 | } 81 | 82 | static bool IsHDRPInstalled() 83 | { 84 | if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline != null) 85 | { 86 | string renderAssetType = "dummy string"; 87 | renderAssetType = UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset.GetType().ToString(); 88 | if (renderAssetType.Contains("HDRenderPipeline")) 89 | { 90 | return true; 91 | } 92 | } 93 | 94 | return false; 95 | } 96 | 97 | static bool IsURPInstalled() 98 | { 99 | if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline != null) 100 | { 101 | string renderAssetType = "dummy string"; 102 | renderAssetType = UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset.GetType().ToString(); 103 | if (renderAssetType.Contains("UniversalRenderPipeline")) 104 | { 105 | return true; 106 | } 107 | } 108 | 109 | return false; 110 | } 111 | 112 | public static void RunOnce() 113 | { 114 | string oldSymbolsString = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); 115 | 116 | string newSymbolsString = oldSymbolsString; 117 | 118 | newSymbolsString = CleanPreprocessorDirectives(newSymbolsString); 119 | newSymbolsString = DetectAndSetSymbolString(newSymbolsString); 120 | 121 | string renderPipelineString = "Built-In Pipeline"; 122 | if (IsHDRPInstalled()) 123 | renderPipelineString = "HDRP"; 124 | else if (IsURPInstalled()) 125 | renderPipelineString = "URP"; 126 | 127 | // Debug.Log("OldString=" + oldSymbolsString + ", NewString=" + newSymbolsString); 128 | if (oldSymbolsString != newSymbolsString) 129 | { 130 | // DB: 2021-08-31, showmodal to ask to change defined symbols, warn that it will take time (minutes) 131 | // 1. DISPLAY DETECTED RP, ASK TO COMMIT, WARN OPERATION WILL TAKE TIME (MINUTES) 132 | // 2. IF YES, DO COMMIT 133 | // 3. IF NO, RESET VALUES SO DETECTION CAN BE RUN LATER... 134 | // OPTIONAL: IMPORT ASSETS WITH DEFAULT SHADER? 135 | Daz3D.Daz3DBridge.CurrentToolbarMode = Daz3D.Daz3DBridge.ToolbarMode.Options; 136 | string dtu_detectrp_message = "Detected [" + renderPipelineString + "]\n\nDTU Bridge must update symbol definitions to continue the Import Procedure. This may take a few minutes. " + 137 | "You may Cancel now, and rerun the renderpipeline detection process from the DTU Bridge at another time."; 138 | bool bUpdateSymbols = EditorUtility.DisplayDialog("Unofficial DTU RenderPipeline Detection", dtu_detectrp_message, "Update Symbol Definitions Now", "Cancel and Redetect RenderPipeline Later"); 139 | if (bUpdateSymbols) 140 | { 141 | Daz3D.Daz3DBridge.CurrentToolbarMode = Daz3D.Daz3DBridge.ToolbarMode.History; 142 | CommitDefinedSymbols(newSymbolsString); 143 | Daz3D.Daz3DDTUImporter.ImportEventRecord record = new Daz3D.Daz3DDTUImporter.ImportEventRecord(); 144 | Daz3D.Daz3DDTUImporter.EventQueue.Enqueue(record); 145 | record.AddToken("Updating Symbol Definitions.\nThis will trigger Unity Editor to recompile all scripts and may take several minutes..."); 146 | } 147 | else 148 | { 149 | Daz3D.Daz3DDTUImporter.ImportEventRecord record = new Daz3D.Daz3DDTUImporter.ImportEventRecord(); 150 | Daz3D.Daz3DDTUImporter.EventQueue.Enqueue(record); 151 | record.AddToken("Autodetection cancelled.\nPlease click the \"Detect RenderPipeline\" button \nin the Options tab to continue import procedure."); 152 | } 153 | 154 | } 155 | else 156 | { 157 | string dtu_detectrp_message = "Detected [" + renderPipelineString + "]\n\nNo changes need to be made to Symbol Definitions."; 158 | EditorUtility.DisplayDialog("Unofficial DTU RenderPipeline Detection", dtu_detectrp_message, "OK"); 159 | } 160 | 161 | } 162 | } 163 | #endif // UNITY_EDITOR -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/Helpers/LightDirection.shadersubgraph: -------------------------------------------------------------------------------- 1 | { 2 | "m_SerializedProperties": [], 3 | "m_SerializedKeywords": [], 4 | "m_SerializableNodes": [ 5 | { 6 | "typeInfo": { 7 | "fullName": "UnityEditor.ShaderGraph.CustomFunctionNode" 8 | }, 9 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"1bf0aa00-186e-4623-83d3-478dfed940e8\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Custom Function\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 432.0,\n \"y\": -120.0,\n \"width\": 208.0,\n \"height\": 302.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector3MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"lightDir\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"lightDir\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector3MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"lightColor\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"lightColor\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ]\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_SourceType\": 0,\n \"m_FunctionName\": \"GetLightDirection\",\n \"m_FunctionSource\": \"0d498a2cd0ac51b488428a5956eee76d\",\n \"m_FunctionBody\": \"Enter function body here...\"\n}" 10 | }, 11 | { 12 | "typeInfo": { 13 | "fullName": "UnityEditor.ShaderGraph.SubGraphOutputNode" 14 | }, 15 | "JSONnodeData": "{\n \"m_GuidSerialized\": \"aab49526-1979-4441-9092-63cde7c820af\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Out_Vector4\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 674.0000610351563,\n \"y\": -121.00006866455078,\n \"width\": 141.0,\n \"height\": 101.00000762939453\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector3MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"LightDirection\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"LightDirection\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector3MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"LightColor\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"LightColor\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ]\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n }\n}" 16 | } 17 | ], 18 | "m_Groups": [], 19 | "m_StickyNotes": [], 20 | "m_SerializableEdges": [ 21 | { 22 | "typeInfo": { 23 | "fullName": "UnityEditor.Graphing.Edge" 24 | }, 25 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"1bf0aa00-186e-4623-83d3-478dfed940e8\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"aab49526-1979-4441-9092-63cde7c820af\"\n }\n}" 26 | }, 27 | { 28 | "typeInfo": { 29 | "fullName": "UnityEditor.Graphing.Edge" 30 | }, 31 | "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"1bf0aa00-186e-4623-83d3-478dfed940e8\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"aab49526-1979-4441-9092-63cde7c820af\"\n }\n}" 32 | } 33 | ], 34 | "m_PreviewData": { 35 | "serializedMesh": { 36 | "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", 37 | "m_Guid": "" 38 | } 39 | }, 40 | "m_Path": "Daz3D", 41 | "m_ConcretePrecision": 0, 42 | "m_ActiveOutputNodeGuidSerialized": "" 43 | } -------------------------------------------------------------------------------- /Unity/UnityPlugin/Scripts/Editor/ClothToolsEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | [CustomEditor(typeof(ClothTools))] 7 | [CanEditMultipleObjects] 8 | 9 | public class ClothToolsEditor : Editor 10 | { 11 | private SerializedObject m_Object; 12 | private float[] floatArray; 13 | 14 | public void OnEnable() 15 | { 16 | m_Object = new SerializedObject(target); 17 | } 18 | 19 | public override void OnInspectorGUI() 20 | { 21 | //ClothTools clothtools = (ClothTools)target; 22 | ClothTools clothtools = (ClothTools) m_Object.targetObject; 23 | 24 | m_Object.Update(); 25 | 26 | GUILayout.Space(10); 27 | GUILayout.Label("Set Max Distance for Material Group:", EditorStyles.whiteLargeLabel); 28 | 29 | //DrawDefaultInspector(); 30 | 31 | SkinnedMeshRenderer skinned = clothtools.gameObject.GetComponent(); 32 | int numMaterials = skinned.sharedMaterials.Length; 33 | if (floatArray == null) 34 | { 35 | floatArray = new float[numMaterials]; 36 | } 37 | else if (floatArray.Length != numMaterials) 38 | { 39 | System.Array.Resize(ref floatArray, numMaterials); 40 | } 41 | foreach (Material mat in skinned.sharedMaterials) 42 | { 43 | if (mat) 44 | { 45 | int matIndex = System.Array.IndexOf(skinned.sharedMaterials, mat); 46 | 47 | // GUILayout.Space(10); 48 | GUILayout.BeginHorizontal(); 49 | //GUILayout.Label(mat.name); 50 | floatArray[matIndex] = EditorGUILayout.Slider(mat.name,floatArray[matIndex], 0f, 0.2f); 51 | 52 | //if (GUILayout.Button("Zero")) 53 | //{ 54 | // clothtools.SetSubMeshWeights(matIndex, 0.0f); 55 | // //Debug.Log("Zero Material Weights: " + mat.name); 56 | //} 57 | //if (GUILayout.Button("One")) 58 | //{ 59 | // clothtools.SetSubMeshWeights(matIndex, 1.0f); 60 | // //Debug.Log("Set Material Weights to 1.0: " + mat.name); 61 | //} 62 | if (GUILayout.Button("Set")) 63 | { 64 | clothtools.SetSubMeshWeights(matIndex, floatArray[matIndex]); 65 | floatArray[matIndex] = 0f; 66 | //Debug.Log("Clear Material Weights: " + mat.name); 67 | } 68 | if (GUILayout.Button("Clear")) 69 | { 70 | clothtools.ClearSubMeshWeights(matIndex); 71 | floatArray[matIndex] = 0f; 72 | //Debug.Log("Clear Material Weights: " + mat.name); 73 | } 74 | //floatArray[matIndex] = EditorGUILayout.TextField(floatArray[matIndex]); 75 | 76 | GUILayout.EndHorizontal(); 77 | 78 | //GUILayout.Space(5); 79 | } 80 | } 81 | 82 | GUILayout.Space(10); 83 | if (GUILayout.Button("Load Weightmap data")) 84 | { 85 | string path = EditorUtility.OpenFilePanelWithFilters( 86 | "Load Weightmap data", 87 | "Assets/Daz3D", 88 | new string[] { "Unity Weight Maps", "unity_weightmap.bytes", "DForce Weight maps", "dforce_weightmap.bytes", "All files", "*"}); 89 | if (path.Length != 0) 90 | { 91 | if (path.Contains(".unity_weightmap.bytes")) 92 | { 93 | //Debug.Log("DEBUG: load from file: " + path); 94 | clothtools.LoadWeightMap(path); 95 | } 96 | 97 | if (path.Contains("dforce_weightmap.bytes")) 98 | { 99 | //Debug.Log("DEBUG: import from file: " + path); 100 | clothtools.ImportWeightMap(path); 101 | } 102 | 103 | } 104 | 105 | //clothtools.LoadRawWeightMap(); 106 | ////Debug.Log("Load Weightmap data."); 107 | } 108 | 109 | //GUILayout.Space(10); 110 | if (GUILayout.Button("Save Weightmap data")) 111 | { 112 | var path = EditorUtility.SaveFilePanel( 113 | "Save Weightmap data", 114 | "Assets/Daz3D", 115 | clothtools.gameObject.name, 116 | "unity_weightmap.bytes"); 117 | 118 | if (path.Length != 0) 119 | { 120 | path = path.Replace(".unity_weightmap.bytes", "") + ".unity_weightmap.bytes"; 121 | //Debug.Log("DEBUG: write to file: " + path); 122 | clothtools.SaveWeightMap(path); 123 | } 124 | 125 | } 126 | 127 | //GUILayout.Space(10); 128 | if (GUILayout.Button("Load Gradient Pattern")) 129 | { 130 | clothtools.LoadGradientPattern(); 131 | //Debug.Log("Load Gradient Pattern."); 132 | } 133 | 134 | //GUILayout.Space(10); 135 | if (GUILayout.Button("Zero All Weights")) 136 | { 137 | for (int i=0; i < skinned.sharedMaterials.Length; i++) 138 | { 139 | clothtools.SetSubMeshWeights(i, 0f); 140 | } 141 | } 142 | 143 | //GUILayout.Space(10); 144 | if (GUILayout.Button("Clear All Weights")) 145 | { 146 | //Undo.RecordObject(clothtools.m_Cloth, "Clear All Weights"); 147 | clothtools.ClearWeightMap(); 148 | //Debug.Log("Clear Weights."); 149 | } 150 | 151 | //GUILayout.Space(10); 152 | //if (GUILayout.Button("Load Stepped Gradient")) 153 | //{ 154 | // clothtools.LoadSteppedGradient(); 155 | // //Debug.Log("Load Stepped Gradient."); 156 | //} 157 | 158 | //GUILayout.Space(10); 159 | //if (GUILayout.Button("Generate Lookup Tables")) 160 | //{ 161 | // clothtools.GenerateLookupTables(); 162 | // //Debug.Log("Generate Lookup Tables Called...."); 163 | //} 164 | 165 | //GUILayout.Space(10); 166 | //if (GUILayout.Button("Run Vertex Data Test")) 167 | //{ 168 | // clothtools.TestVertData(); 169 | // //Debug.Log("Running Vertex Data Test...."); 170 | //} 171 | 172 | m_Object.ApplyModifiedProperties(); 173 | } 174 | 175 | } 176 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/CGInc/DazStandardShadow.cginc: -------------------------------------------------------------------------------- 1 | // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) 2 | 3 | #ifndef UNITY_STANDARD_SHADOW_INCLUDED 4 | #define UNITY_STANDARD_SHADOW_INCLUDED 5 | 6 | // NOTE: had to split shadow functions into separate file, 7 | // otherwise compiler gives trouble with LIGHTING_COORDS macro (in UnityStandardCore.cginc) 8 | 9 | 10 | #include "UnityCG.cginc" 11 | #include "UnityShaderVariables.cginc" 12 | #include "UnityStandardConfig.cginc" 13 | #include "UnityStandardUtils.cginc" 14 | 15 | #if (defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON)) && defined(UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS) 16 | #define UNITY_STANDARD_USE_DITHER_MASK 1 17 | #endif 18 | 19 | // Need to output UVs in shadow caster, since we need to sample texture and do clip/dithering based on it 20 | #if defined(_ALPHATEST_ON) || defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON) 21 | #define UNITY_STANDARD_USE_SHADOW_UVS 1 22 | #endif 23 | 24 | // Has a non-empty shadow caster output struct (it's an error to have empty structs on some platforms...) 25 | #if !defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) || defined(UNITY_STANDARD_USE_SHADOW_UVS) 26 | #define UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT 1 27 | #endif 28 | 29 | #ifdef UNITY_STEREO_INSTANCING_ENABLED 30 | #define UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT 1 31 | #endif 32 | 33 | 34 | half4 _Color; 35 | half _Cutoff; 36 | sampler2D _MainTex; 37 | float4 _MainTex_ST; 38 | #ifdef UNITY_STANDARD_USE_DITHER_MASK 39 | sampler3D _DitherMaskLOD; 40 | #endif 41 | 42 | // Handle PremultipliedAlpha from Fade or Transparent shading mode 43 | half4 _SpecColor; 44 | half _Metallic; 45 | #ifdef _SPECGLOSSMAP 46 | sampler2D _SpecGlossMap; 47 | #endif 48 | #ifdef _METALLICGLOSSMAP 49 | sampler2D _MetallicGlossMap; 50 | #endif 51 | 52 | #if defined(UNITY_STANDARD_USE_SHADOW_UVS) && defined(_PARALLAXMAP) 53 | sampler2D _ParallaxMap; 54 | half _Parallax; 55 | #endif 56 | 57 | half MetallicSetup_ShadowGetOneMinusReflectivity(half2 uv) 58 | { 59 | half metallicity = _Metallic; 60 | #ifdef _METALLICGLOSSMAP 61 | metallicity = tex2D(_MetallicGlossMap, uv).r; 62 | #endif 63 | return OneMinusReflectivityFromMetallic(metallicity); 64 | } 65 | 66 | half RoughnessSetup_ShadowGetOneMinusReflectivity(half2 uv) 67 | { 68 | half metallicity = _Metallic; 69 | #ifdef _METALLICGLOSSMAP 70 | metallicity = tex2D(_MetallicGlossMap, uv).r; 71 | #endif 72 | return OneMinusReflectivityFromMetallic(metallicity); 73 | } 74 | 75 | half SpecularSetup_ShadowGetOneMinusReflectivity(half2 uv) 76 | { 77 | half3 specColor = _SpecColor.rgb; 78 | #ifdef _SPECGLOSSMAP 79 | specColor = tex2D(_SpecGlossMap, uv).rgb; 80 | #endif 81 | return (1 - SpecularStrength(specColor)); 82 | } 83 | 84 | // SHADOW_ONEMINUSREFLECTIVITY(): workaround to get one minus reflectivity based on UNITY_SETUP_BRDF_INPUT 85 | #define SHADOW_JOIN2(a, b) a##b 86 | #define SHADOW_JOIN(a, b) SHADOW_JOIN2(a,b) 87 | #define SHADOW_ONEMINUSREFLECTIVITY SHADOW_JOIN(UNITY_SETUP_BRDF_INPUT, _ShadowGetOneMinusReflectivity) 88 | 89 | struct VertexInput 90 | { 91 | float4 vertex : POSITION; 92 | float3 normal : NORMAL; 93 | float2 uv0 : TEXCOORD0; 94 | #if defined(UNITY_STANDARD_USE_SHADOW_UVS) && defined(_PARALLAXMAP) 95 | half4 tangent : TANGENT; 96 | #endif 97 | UNITY_VERTEX_INPUT_INSTANCE_ID 98 | }; 99 | 100 | #ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT 101 | struct VertexOutputShadowCaster 102 | { 103 | V2F_SHADOW_CASTER_NOPOS 104 | #if defined(UNITY_STANDARD_USE_SHADOW_UVS) 105 | float2 tex : TEXCOORD1; 106 | 107 | #if defined(_PARALLAXMAP) 108 | half3 viewDirForParallax : TEXCOORD2; 109 | #endif 110 | #endif 111 | }; 112 | #endif 113 | 114 | #ifdef UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT 115 | struct VertexOutputStereoShadowCaster 116 | { 117 | UNITY_VERTEX_OUTPUT_STEREO 118 | }; 119 | #endif 120 | 121 | // We have to do these dances of outputting SV_POSITION separately from the vertex shader, 122 | // and inputting VPOS in the pixel shader, since they both map to "POSITION" semantic on 123 | // some platforms, and then things don't go well. 124 | 125 | 126 | void vertShadowCaster (VertexInput v 127 | , out float4 opos : SV_POSITION 128 | #ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT 129 | , out VertexOutputShadowCaster o 130 | #endif 131 | #ifdef UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT 132 | , out VertexOutputStereoShadowCaster os 133 | #endif 134 | ) 135 | { 136 | UNITY_SETUP_INSTANCE_ID(v); 137 | #ifdef UNITY_STANDARD_USE_STEREO_SHADOW_OUTPUT_STRUCT 138 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(os); 139 | #endif 140 | TRANSFER_SHADOW_CASTER_NOPOS(o,opos) 141 | #if defined(UNITY_STANDARD_USE_SHADOW_UVS) 142 | o.tex = TRANSFORM_TEX(v.uv0, _MainTex); 143 | 144 | #ifdef _PARALLAXMAP 145 | TANGENT_SPACE_ROTATION; 146 | o.viewDirForParallax = mul (rotation, ObjSpaceViewDir(v.vertex)); 147 | #endif 148 | #endif 149 | } 150 | 151 | half4 fragShadowCaster (UNITY_POSITION(vpos) 152 | #ifdef UNITY_STANDARD_USE_SHADOW_OUTPUT_STRUCT 153 | , VertexOutputShadowCaster i 154 | #endif 155 | ) : SV_Target 156 | { 157 | #if defined(UNITY_STANDARD_USE_SHADOW_UVS) 158 | #if defined(_PARALLAXMAP) && (SHADER_TARGET >= 30) 159 | half3 viewDirForParallax = normalize(i.viewDirForParallax); 160 | fixed h = tex2D (_ParallaxMap, i.tex.xy).g; 161 | half2 offset = ParallaxOffset1Step (h, _Parallax, viewDirForParallax); 162 | i.tex.xy += offset; 163 | #endif 164 | 165 | #if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) 166 | half alpha = _Color.a; 167 | #else 168 | half alpha = tex2D(_MainTex, i.tex.xy).a * _Color.a; 169 | #endif 170 | #if defined(_ALPHATEST_ON) 171 | clip (alpha - _Cutoff); 172 | #endif 173 | #if defined(_ALPHABLEND_ON) || defined(_ALPHAPREMULTIPLY_ON) 174 | #if defined(_ALPHAPREMULTIPLY_ON) 175 | half outModifiedAlpha; 176 | PreMultiplyAlpha(half3(0, 0, 0), alpha, SHADOW_ONEMINUSREFLECTIVITY(i.tex), outModifiedAlpha); 177 | alpha = outModifiedAlpha; 178 | #endif 179 | #if defined(UNITY_STANDARD_USE_DITHER_MASK) 180 | // Use dither mask for alpha blended shadows, based on pixel position xy 181 | // and alpha level. Our dither texture is 4x4x16. 182 | #ifdef LOD_FADE_CROSSFADE 183 | #define _LOD_FADE_ON_ALPHA 184 | alpha *= unity_LODFade.y; 185 | #endif 186 | half alphaRef = tex3D(_DitherMaskLOD, float3(vpos.xy*0.25,alpha*0.9375)).a; 187 | clip (alphaRef - 0.01); 188 | #else 189 | clip (alpha - _Cutoff); 190 | #endif 191 | #endif 192 | #endif // #if defined(UNITY_STANDARD_USE_SHADOW_UVS) 193 | 194 | #ifdef LOD_FADE_CROSSFADE 195 | #ifdef _LOD_FADE_ON_ALPHA 196 | #undef _LOD_FADE_ON_ALPHA 197 | #else 198 | UnityApplyDitherCrossFade(vpos.xy); 199 | #endif 200 | #endif 201 | 202 | SHADOW_CASTER_FRAGMENT(i) 203 | } 204 | 205 | #endif // UNITY_STANDARD_SHADOW_INCLUDED 206 | -------------------------------------------------------------------------------- /Unity/UnityPlugin/Shaders/CGInc/DazStandardInput.cginc: -------------------------------------------------------------------------------- 1 | // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) 2 | 3 | #ifndef UNITY_STANDARD_INPUT_INCLUDED 4 | #define UNITY_STANDARD_INPUT_INCLUDED 5 | 6 | #include "UnityCG.cginc" 7 | #include "UnityStandardConfig.cginc" 8 | #include "UnityPBSLighting.cginc" // TBD: remove 9 | #include "UnityStandardUtils.cginc" 10 | 11 | //--------------------------------------- 12 | // Directional lightmaps & Parallax require tangent space too 13 | #if (_NORMALMAP || DIRLIGHTMAP_COMBINED || _PARALLAXMAP) 14 | #define _TANGENT_TO_WORLD 1 15 | #endif 16 | 17 | #if (_DETAIL_MULX2 || _DETAIL_MUL || _DETAIL_ADD || _DETAIL_LERP) 18 | #define _DETAIL 1 19 | #endif 20 | 21 | //--------------------------------------- 22 | //half4 _Color; 23 | //half _Cutoff; 24 | half4 _Diffuse; 25 | half _AlphaClipThreshold; 26 | 27 | //sampler2D _MainTex; 28 | //float4 _MainTex_ST; 29 | sampler2D _DiffuseMap; 30 | float4 _DiffuseMap_ST; 31 | 32 | sampler2D _DetailAlbedoMap; 33 | float4 _DetailAlbedoMap_ST; 34 | 35 | //sampler2D _BumpMap; 36 | //half _BumpScale; 37 | sampler2D _NormalMap; 38 | half _Normal; 39 | 40 | sampler2D _DetailMask; 41 | sampler2D _DetailNormalMap; 42 | half _DetailNormalMapScale; 43 | 44 | half4 _SpecularColor; 45 | //sampler2D _SpecGlossMap; 46 | sampler2D _SpecularColorMap; 47 | //sampler2D _MetallicGlossMap; 48 | sampler2D _MetallicMap; 49 | half _Metallic; 50 | //float _Glossiness; 51 | //float _GlossMapScale; 52 | 53 | float _Roughness; 54 | sampler2D _RoughnessMap; 55 | 56 | sampler2D _OcclusionMap; 57 | half _OcclusionStrength; 58 | 59 | //sampler2D _ParallaxMap; 60 | //half _Parallax; 61 | sampler2D _HeightMap; 62 | half _Height; 63 | half _UVSec; 64 | 65 | half4 _Emission; 66 | sampler2D _EmissionMap; 67 | 68 | float _Alpha; 69 | sampler2D _AlphaMap; 70 | 71 | 72 | //------------------------------------------------------------------------------------- 73 | // Input functions 74 | 75 | struct VertexInput 76 | { 77 | float4 vertex : POSITION; 78 | half3 normal : NORMAL; 79 | float2 uv0 : TEXCOORD0; 80 | float2 uv1 : TEXCOORD1; 81 | #if defined(DYNAMICLIGHTMAP_ON) || defined(UNITY_PASS_META) 82 | float2 uv2 : TEXCOORD2; 83 | #endif 84 | #ifdef _TANGENT_TO_WORLD 85 | half4 tangent : TANGENT; 86 | #endif 87 | UNITY_VERTEX_INPUT_INSTANCE_ID 88 | }; 89 | 90 | float4 TexCoords(VertexInput v) 91 | { 92 | float4 texcoord; 93 | texcoord.xy = TRANSFORM_TEX(v.uv0, _DiffuseMap); // Always source from uv0 94 | texcoord.zw = TRANSFORM_TEX(((_UVSec == 0) ? v.uv0 : v.uv1), _DetailAlbedoMap); 95 | return texcoord; 96 | } 97 | 98 | half DetailMask(float2 uv) 99 | { 100 | return tex2D (_DetailMask, uv).a; 101 | } 102 | 103 | half3 Albedo(float4 texcoords) 104 | { 105 | half3 albedo = _Diffuse.rgb * tex2D (_DiffuseMap, texcoords.xy).rgb; 106 | #if _DETAIL 107 | #if (SHADER_TARGET < 30) 108 | // SM20: instruction count limitation 109 | // SM20: no detail mask 110 | half mask = 1; 111 | #else 112 | half mask = DetailMask(texcoords.xy); 113 | #endif 114 | half3 detailAlbedo = tex2D (_DetailAlbedoMap, texcoords.zw).rgb; 115 | #if _DETAIL_MULX2 116 | albedo *= LerpWhiteTo (detailAlbedo * unity_DiffuseSpaceDouble.rgb, mask); 117 | #elif _DETAIL_MUL 118 | albedo *= LerpWhiteTo (detailAlbedo, mask); 119 | #elif _DETAIL_ADD 120 | albedo += detailAlbedo * mask; 121 | #elif _DETAIL_LERP 122 | albedo = lerp (albedo, detailAlbedo, mask); 123 | #endif 124 | #endif 125 | return albedo; 126 | } 127 | 128 | half Alpha(float2 uv) 129 | { 130 | #if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) 131 | return _Diffuse.a; 132 | #else 133 | 134 | #ifdef _ALPHAMAP 135 | return tex2D(_AlphaMap, uv).r * _Alpha; 136 | #else 137 | return tex2D(_DiffuseMap, uv).a * _Diffuse.a; 138 | #endif 139 | 140 | #endif 141 | } 142 | 143 | half Occlusion(float2 uv) 144 | { 145 | #if (SHADER_TARGET < 30) 146 | // SM20: instruction count limitation 147 | // SM20: simpler occlusion 148 | return tex2D(_OcclusionMap, uv).g; 149 | #else 150 | half occ = tex2D(_OcclusionMap, uv).g; 151 | return LerpOneTo (occ, _OcclusionStrength); 152 | #endif 153 | } 154 | 155 | half4 SpecularGloss(float2 uv) 156 | { 157 | half4 sg; 158 | //#ifdef _SPECGLOSSMAP 159 | #ifdef _SPECULARCOLORMAP 160 | #if defined(_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A) 161 | sg.rgb = tex2D(_SpecularColorMap, uv).rgb; 162 | //added 163 | sg.rgb *= _SpecularColor.rgb; 164 | sg.a = tex2D(_DiffuseMap, uv).a; 165 | #else 166 | sg = tex2D(_SpecularColorMap, uv); 167 | //added 168 | sg *= 0.5f * _SpecularColor; 169 | #endif 170 | // sg.a *= _GlossMapScale; 171 | sg.a *= 1.0f - _Roughness; 172 | #else 173 | // sg.rgb = _SpecColor.rgb; 174 | sg.rgb = _SpecularColor.rgb; 175 | #ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A 176 | // sg.a = tex2D(_DiffuseMap, uv).a * _GlossMapScale; 177 | sg.a = tex2D(_DiffuseMap, uv).a * _Roughness; 178 | #else 179 | // sg.a = _Glossiness; 180 | sg.a = 1.0f - _Roughness; 181 | #endif 182 | #endif 183 | return sg; 184 | } 185 | 186 | half2 MetallicGloss(float2 uv) 187 | { 188 | half2 mg; 189 | 190 | //#ifdef _METALLICGLOSSMAP 191 | #ifdef _METALLICMAP 192 | #ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A 193 | mg.r = tex2D(_MetallicMap, uv).r; 194 | mg.g = tex2D(_DiffuseMap, uv).a; 195 | #else 196 | mg = tex2D(_MetallicMap, uv).ra; 197 | // added 198 | mg.r *= _Metallic; 199 | #endif 200 | // mg.g *= _GlossMapScale; 201 | mg.g *= 1.0f - _Roughness; 202 | #else 203 | mg.r = _Metallic; 204 | #ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A 205 | // mg.g = tex2D(_DiffuseMap, uv).a * _GlossMapScale; 206 | mg.g = tex2D(_DiffuseMap, uv).a * _Roughness; 207 | #else 208 | // mg.g = _Glossiness; 209 | mg.g = 1.0f - _Roughness; 210 | #endif 211 | #endif 212 | return mg; 213 | } 214 | 215 | half2 MetallicRough(float2 uv) 216 | { 217 | half2 mg; 218 | //#ifdef _METALLICGLOSSMAP 219 | #ifdef _METALLICMAP 220 | mg.r = tex2D(_MetallicMap, uv).r; 221 | // added 222 | mg.r *= _Metallic; 223 | #else 224 | mg.r = _Metallic; 225 | #endif 226 | 227 | //#ifdef _SPECGLOSSMAP 228 | #ifdef _SPECULARCOLORMAP 229 | mg.g = 1.0f - tex2D(_SpecularColorMap, uv).r; 230 | //added 231 | mg.g *= _SpecularColor.r; 232 | #else 233 | // mg.g = 1.0f - _Glossiness; 234 | mg.g = 1.0f - _Roughness; 235 | #endif 236 | return mg; 237 | } 238 | 239 | half3 Emission(float2 uv) 240 | { 241 | #ifndef _EMISSION 242 | return 0; 243 | #else 244 | return tex2D(_EmissionMap, uv).rgb * _Emission.rgb; 245 | #endif 246 | } 247 | 248 | #ifdef _NORMALMAP 249 | half3 NormalInTangentSpace(float4 texcoords) 250 | { 251 | half3 normalTangent = UnpackScaleNormal(tex2D (_NormalMap, texcoords.xy), _Normal); 252 | 253 | #if _DETAIL && defined(UNITY_ENABLE_DETAIL_NORMALMAP) 254 | half mask = DetailMask(texcoords.xy); 255 | half3 detailNormalTangent = UnpackScaleNormal(tex2D (_DetailNormalMap, texcoords.zw), _DetailNormalMapScale); 256 | #if _DETAIL_LERP 257 | normalTangent = lerp( 258 | normalTangent, 259 | detailNormalTangent, 260 | mask); 261 | #else 262 | normalTangent = lerp( 263 | normalTangent, 264 | BlendNormals(normalTangent, detailNormalTangent), 265 | mask); 266 | #endif 267 | #endif 268 | 269 | return normalTangent; 270 | } 271 | #endif 272 | 273 | float4 Parallax (float4 texcoords, half3 viewDir) 274 | { 275 | #if !defined(_PARALLAXMAP) || (SHADER_TARGET < 30) 276 | // Disable parallax on pre-SM3.0 shader target models 277 | return texcoords; 278 | #else 279 | half h = tex2D (_HeightMap, texcoords.xy).g; 280 | float2 offset = ParallaxOffset1Step (h, _Height, viewDir); 281 | return float4(texcoords.xy + offset, texcoords.zw + offset); 282 | #endif 283 | 284 | } 285 | 286 | #endif // UNITY_STANDARD_INPUT_INCLUDED 287 | -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/DzUnrealSubdivisionDialog.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "QtCore/qfile.h" 20 | #include "QtCore/qtextstream.h" 21 | 22 | #include "dzapp.h" 23 | #include "dzscene.h" 24 | #include "dzstyle.h" 25 | #include "dzmainwindow.h" 26 | #include "dzactionmgr.h" 27 | #include "dzaction.h" 28 | #include "dzskeleton.h" 29 | #include "dzobject.h" 30 | #include "dzshape.h" 31 | #include "dzmodifier.h" 32 | #include "dzpresentation.h" 33 | #include "dzassetmgr.h" 34 | #include "dzproperty.h" 35 | #include "dznumericnodeproperty.h" 36 | #include "dzsettings.h" 37 | #include "dzmorph.h" 38 | #include "dzgeometry.h" 39 | 40 | #include "DzUnrealSubdivisionDialog.h" 41 | 42 | #include "QtGui/qlayout.h" 43 | #include "QtGui/qlineedit.h" 44 | 45 | #include 46 | 47 | /***************************** 48 | Local definitions 49 | *****************************/ 50 | #define DAZ_TO_UNREAL_PLUGIN_NAME "DazToUnreal" 51 | 52 | 53 | DzUnrealSubdivisionDialog* DzUnrealSubdivisionDialog::singleton = nullptr; 54 | 55 | 56 | DzUnrealSubdivisionDialog::DzUnrealSubdivisionDialog(QWidget *parent) : 57 | DzBasicDialog(parent, DAZ_TO_UNREAL_PLUGIN_NAME) 58 | { 59 | subdivisionItemsGrid = NULL; 60 | //settings = new QSettings("Code Wizards", "DazToUnreal"); 61 | 62 | 63 | 64 | // Set the dialog title 65 | setWindowTitle(tr("Choose Subdivision Levels")); 66 | 67 | // Setup folder 68 | presetsFolder = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation) + QDir::separator() + "DazToUnreal" + QDir::separator() + "Presets"; 69 | 70 | 71 | QVBoxLayout* mainLayout = new QVBoxLayout(this); 72 | mainLayout->addWidget(new QLabel("Subdivision can greatly increase transfer time.")); 73 | 74 | subdivisionItemsGrid = new QGridLayout(this); 75 | subdivisionItemsGrid->addWidget(new QLabel("Object Name"), 0, 0); 76 | subdivisionItemsGrid->addWidget(new QLabel("Subdivision Level"), 0, 1); 77 | subdivisionItemsGrid->addWidget(new QLabel("Base Vert Count"), 0, 2); 78 | mainLayout->addLayout(subdivisionItemsGrid); 79 | mainLayout->addStretch(); 80 | 81 | this->addLayout(mainLayout); 82 | resize(QSize(800, 800));//.expandedTo(minimumSizeHint())); 83 | setFixedWidth(width()); 84 | setFixedHeight(height()); 85 | 86 | 87 | } 88 | 89 | QSize DzUnrealSubdivisionDialog::minimumSizeHint() const 90 | { 91 | return QSize(800, 800); 92 | } 93 | 94 | 95 | void DzUnrealSubdivisionDialog::PrepareDialog() 96 | { 97 | /*foreach(QObject* object, this->children()) 98 | { 99 | delete object; 100 | }*/ 101 | 102 | /*if (this->layout()) 103 | { 104 | delete this->layout(); 105 | } 106 | 107 | 108 | QVBoxLayout* mainLayout = new QVBoxLayout(this); 109 | mainLayout->addWidget(new QLabel("Subdivision can greatly increase transfer time."));*/ 110 | 111 | int itemCount = subdivisionItemsGrid->count(); 112 | while(QLayoutItem* item = subdivisionItemsGrid->takeAt(0)) 113 | { 114 | if (QWidget* widget = item->widget()) 115 | { 116 | delete widget; 117 | //delete item; 118 | } 119 | } 120 | 121 | //subdivisionItemsGrid = new QGridLayout(this); 122 | subdivisionItemsGrid->addWidget(new QLabel("Object Name"), 0, 0); 123 | subdivisionItemsGrid->addWidget(new QLabel("Subdivision Level"), 0, 1); 124 | subdivisionItemsGrid->addWidget(new QLabel("Base Vert Count"), 0, 2); 125 | //mainLayout->addLayout(subdivisionItemsGrid); 126 | //mainLayout->addStretch(); 127 | 128 | //this->addLayout(mainLayout); 129 | //resize(QSize(800, 800));//.expandedTo(minimumSizeHint())); 130 | //setFixedWidth(width()); 131 | //setFixedHeight(height()); 132 | 133 | SubdivisionCombos.clear(); 134 | DzNode* Selection = dzScene->getPrimarySelection(); 135 | CreateList(Selection); 136 | } 137 | 138 | void DzUnrealSubdivisionDialog::CreateList(DzNode* Node) 139 | { 140 | DzObject* Object = Node->getObject(); 141 | if (Object) 142 | { 143 | DzShape* Shape = Object ? Object->getCurrentShape() : NULL; 144 | DzGeometry* Geo = Shape ? Shape->getGeometry() : NULL; 145 | 146 | int row = subdivisionItemsGrid->rowCount(); 147 | subdivisionItemsGrid->addWidget(new QLabel(Node->getLabel()), row, 0); 148 | QComboBox* subdivisionLevelCombo = new QComboBox(this); 149 | subdivisionLevelCombo->setProperty("Object", QVariant(Node->getName())); 150 | subdivisionLevelCombo->addItem("0"); 151 | subdivisionLevelCombo->addItem("1"); 152 | SubdivisionCombos.append(subdivisionLevelCombo); 153 | subdivisionItemsGrid->addWidget(subdivisionLevelCombo, row, 1); 154 | if (SubdivisionLevels.contains(Node->getName())) 155 | { 156 | subdivisionLevelCombo->setCurrentIndex(SubdivisionLevels[Node->getName()]); 157 | } 158 | connect(subdivisionLevelCombo, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(HandleSubdivisionLevelChanged(const QString &))); 159 | 160 | if (Geo) 161 | { 162 | int VertCount = Geo->getNumVertices(); 163 | subdivisionItemsGrid->addWidget(new QLabel(QString::number(VertCount)), row, 2); 164 | 165 | /*for (int index = 0; index < Shape->getNumProperties(); index++) 166 | { 167 | DzProperty* property = Shape->getProperty(index); 168 | QString propName = property->getName();//property->getName(); 169 | QString propLabel = property->getLabel(); 170 | qDebug() << propName << " " << propLabel; 171 | }*/ 172 | } 173 | } 174 | 175 | for (int ChildIndex = 0; ChildIndex < Node->getNumNodeChildren(); ChildIndex++) 176 | { 177 | DzNode* ChildNode = Node->getNodeChild(ChildIndex); 178 | CreateList(ChildNode); 179 | } 180 | } 181 | 182 | void DzUnrealSubdivisionDialog::HandleSubdivisionLevelChanged(const QString& text) 183 | { 184 | foreach(QComboBox* combo, SubdivisionCombos) 185 | { 186 | QString name = combo->property("Object").toString(); 187 | int targetValue = combo->currentText().toInt(); 188 | SubdivisionLevels[name] = targetValue; 189 | } 190 | } 191 | 192 | DzNode* DzUnrealSubdivisionDialog::FindObject(DzNode* Node, QString Name) 193 | { 194 | DzObject* Object = Node->getObject(); 195 | if (Object) 196 | { 197 | if (Node->getName() == Name) return Node; 198 | } 199 | 200 | for (int ChildIndex = 0; ChildIndex < Node->getNumNodeChildren(); ChildIndex++) 201 | { 202 | DzNode* ChildNode = Node->getNodeChild(ChildIndex); 203 | DzNode* FoundNode = FindObject(ChildNode, Name); 204 | if (FoundNode) return FoundNode; 205 | } 206 | return NULL; 207 | } 208 | 209 | void DzUnrealSubdivisionDialog::LockSubdivisionProperties(bool subdivisionEnabled) 210 | { 211 | DzNode* Selection = dzScene->getPrimarySelection(); 212 | foreach(QComboBox* combo, SubdivisionCombos) 213 | { 214 | QString Name = combo->property("Object").toString(); 215 | DzNode* ObjectNode = FindObject(Selection, Name); 216 | if (ObjectNode) 217 | { 218 | DzObject* Object = ObjectNode->getObject(); 219 | DzShape* Shape = Object ? Object->getCurrentShape() : NULL; 220 | DzGeometry* Geo = Shape ? Shape->getGeometry() : NULL; 221 | if (Geo) 222 | { 223 | int VertCount = Geo->getNumVertices(); 224 | 225 | for (int index = 0; index < Shape->getNumProperties(); index++) 226 | { 227 | DzProperty* property = Shape->getProperty(index); 228 | DzNumericProperty* numericProperty = qobject_cast(property); 229 | QString propName = property->getName(); 230 | if (propName == "SubDIALevel" && numericProperty) 231 | { 232 | numericProperty->lock(false); 233 | if (subdivisionEnabled) 234 | { 235 | double targetValue = combo->currentText().toDouble(); 236 | numericProperty->setDoubleValue(targetValue); 237 | } 238 | else 239 | { 240 | numericProperty->setDoubleValue(0.0f); 241 | } 242 | numericProperty->lock(true); 243 | } 244 | //QString propLabel = property->getLabel(); 245 | //qDebug() << propName << " " << propLabel; 246 | } 247 | } 248 | } 249 | } 250 | } 251 | 252 | void DzUnrealSubdivisionDialog::WriteSubdivisions(DzJsonWriter& Writer) 253 | { 254 | DzNode* Selection = dzScene->getPrimarySelection(); 255 | 256 | //stream << "Version, Object, Subdivision" << endl; 257 | foreach(QComboBox* combo, SubdivisionCombos) 258 | { 259 | QString Name = combo->property("Object").toString() + ".Shape"; 260 | //DzNode* ObjectNode = FindObject(Selection, Name); 261 | 262 | int targetValue = combo->currentText().toInt(); 263 | Writer.startObject(true); 264 | Writer.addMember("Version", 1); 265 | Writer.addMember("Asset Name", Name); 266 | Writer.addMember("Value", targetValue); 267 | Writer.finishObject(); 268 | //stream << "1, " << Name << ", " << targetValue << endl; 269 | } 270 | } 271 | 272 | #include "moc_DzUnrealSubdivisionDialog.cpp" 273 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #********************************************************************** 2 | # Copyright (C) 2002-2020 Daz 3D, Inc. All Rights Reserved. 3 | # 4 | # This file is part of the DAZ Studio SDK. 5 | # 6 | # This file may be used only in accordance with the DAZ Studio SDK 7 | # license provided with the DAZ Studio SDK. 8 | # 9 | # The contents of this file may not be disclosed to third parties, 10 | # copied or duplicated in any form, in whole or in part, without the 11 | # prior written permission of Daz 3D, Inc, except as explicitly 12 | # allowed in the DAZ Studio SDK license. 13 | # 14 | # See http://www.daz3d.com to contact DAZ 3D or for more 15 | # information about the DAZ Studio SDK. 16 | #********************************************************************** 17 | 18 | cmake_minimum_required(VERSION 3.4.0) 19 | 20 | if(APPLE) 21 | if(NOT CMAKE_OSX_ARCHITECTURES) 22 | message( FATAL_ERROR "Mac needs CMAKE_OSX_ARCHITECTURES, set to i386 or x86_64" ) 23 | return() 24 | endif() 25 | endif(APPLE) 26 | 27 | project("DazRunTimePlugins") 28 | 29 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 30 | 31 | set(DAZ_STUDIO_EXE_DIR "" CACHE PATH "Path to DAZ Studio, needs to be installed to a writeable location" ) 32 | if(NOT DAZ_STUDIO_EXE_DIR ) 33 | message("Location to DAZ Studio not provided. Projects will build locally.") 34 | endif() 35 | 36 | if(WIN32) 37 | set(DZ_LIB_SUFFIX ".lib") 38 | set(DZ_BIN_SUFFIX ".dll") 39 | set(DZ_LIB_PREFIX "") 40 | set(UTIL_EXT ".exe") 41 | if(CMAKE_SIZEOF_VOID_P EQUAL 4) 42 | set(DZ_PLATFORM x86) 43 | set(DZ_MIXED_PLATFORM Win32) 44 | set(DZ_OS_PLATFORM Win32) 45 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) 46 | set(DZ_PLATFORM x64) 47 | set(DZ_MIXED_PLATFORM x64) 48 | set(DZ_OS_PLATFORM Win64) 49 | else() 50 | message(FATAL_ERROR "Unknown architecture") 51 | endif() 52 | elseif(APPLE) 53 | set(DZ_LIB_SUFFIX ".dylib") 54 | set(DZ_BIN_SUFFIX ".dylib") 55 | set(DZ_LIB_PREFIX "lib") 56 | set(UTIL_EXT "") 57 | if(CMAKE_SIZEOF_VOID_P EQUAL 4) 58 | set(DZ_PLATFORM x86) 59 | set(DZ_MIXED_PLATFORM Mac32) 60 | set(DZ_OS_PLATFORM Mac32) 61 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) 62 | set(DZ_PLATFORM x64) 63 | set(DZ_MIXED_PLATFORM Mac64) 64 | set(DZ_OS_PLATFORM Mac64) 65 | else() 66 | message(FATAL_ERROR "Unknown architecture") 67 | endif() 68 | set(CMAKE_MACOSX_RPATH TRUE) 69 | set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 70 | else() 71 | message(FATAL_ERROR "Unknown architecture") 72 | endif(WIN32) 73 | 74 | set(DAZ_SDK_DIR_DEFAULT "") 75 | set(DAZ_SDK_CORE_RELATIVE_PATH "lib/${DZ_MIXED_PLATFORM}/${DZ_LIB_PREFIX}dzcore${DZ_LIB_SUFFIX}") 76 | if(NOT DAZ_SDK_DIR) 77 | if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/DAZStudio4.5+ SDK/${DAZ_SDK_CORE_RELATIVE_PATH}") 78 | set( DAZ_SDK_DIR_DEFAULT "${CMAKE_CURRENT_LIST_DIR}/DAZStudio4.5+ SDK" ) 79 | endif() 80 | endif() 81 | 82 | set(DAZ_SDK_DIR ${DAZ_SDK_DIR_DEFAULT} CACHE PATH "Path to root of the DAZ Studio SDK" ) 83 | 84 | if(NOT DAZ_SDK_DIR) 85 | message(FATAL_ERROR "Missing path to DAZ Studio SDK") 86 | return() 87 | endif() 88 | 89 | set(QT_BINARY_DIR_DEFAULT "" CACHE PATH "Path to directory with QT binaries") 90 | if(NOT QT_BINARY_DIR_DEFAULT) 91 | if(EXISTS "${DAZ_SDK_DIR}/bin/${DZ_MIXED_PLATFORM}/qmake${UTIL_EXT}") 92 | set( QT_BINARY_DIR_DEFAULT "${DAZ_SDK_DIR}/bin/${DZ_MIXED_PLATFORM}" ) 93 | endif() 94 | endif() 95 | 96 | if(NOT QT_BINARY_DIR_DEFAULT) 97 | message(FATAL_ERROR "Missing path QT binaries. Check QT_BINARY_DIR_DEFAULT path") 98 | return() 99 | endif() 100 | 101 | find_package(OpenGL REQUIRED) 102 | 103 | #we only have release libraries for dzcore/qt so make sure even in debug they we use MD and undef debug 104 | if(WIN32) 105 | add_compile_options( "/MD" "/U_DEBUG" ) 106 | endif() 107 | 108 | # Set dzcore as import target 109 | set(DZ_SDK_INCLUDE "${DAZ_SDK_DIR}/include" CACHE FILEPATH "path to daz sdk includes" ) 110 | set(DAZ_SDK_LIB "${DAZ_SDK_DIR}/${DAZ_SDK_CORE_RELATIVE_PATH}" CACHE FILEPATH "path to dzcore" ) 111 | if(NOT EXISTS ${DAZ_SDK_LIB}) 112 | message(FATAL_ERROR "The library dzcore could not be located. Check the path for DAZ_SDK_DIR.") 113 | return() 114 | endif() 115 | 116 | add_library(dzcore SHARED IMPORTED) 117 | if(WIN32) 118 | set_property(TARGET dzcore APPEND PROPERTY IMPORTED_IMPLIB ${DAZ_SDK_LIB}) 119 | else() 120 | set_property(TARGET dzcore APPEND PROPERTY IMPORTED_LOCATION ${DAZ_SDK_LIB}) 121 | endif(WIN32) 122 | set_property(TARGET dzcore APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${DZ_SDK_INCLUDE}" ) 123 | 124 | # Set dpc as import target 125 | set(DAZ_SDK_DPC_EXE "${DAZ_SDK_DIR}/bin/${DZ_MIXED_PLATFORM}/dpc${UTIL_EXT}" CACHE FILEPATH "path to sdk dpc" ) 126 | if(NOT EXISTS ${DAZ_SDK_DPC_EXE}) 127 | message(FATAL_ERROR "The executable dpc could not be located. Check the path for DAZ_SDK_DIR.") 128 | return() 129 | endif() 130 | add_executable(dpc IMPORTED) 131 | set_property(TARGET dpc APPEND PROPERTY IMPORTED_LOCATION ${DAZ_SDK_DPC_EXE}) 132 | 133 | # Setup Qt from the DAZ SDK 134 | if(WIN32) 135 | set(DAZ_SDK_QTCORE_LIBRARY "${DAZ_SDK_DIR}/lib/${DZ_MIXED_PLATFORM}/QtCore4.lib") 136 | elseif(APPLE) 137 | set(DAZ_SDK_QTCORE_LIBRARY "${DAZ_SDK_DIR}/lib/${DZ_MIXED_PLATFORM}/QtCore.framework") 138 | endif() 139 | 140 | set(QT_QTCORE_LIBRARY_RELEASE ${DAZ_SDK_QTCORE_LIBRARY}) 141 | set(QT_BINARY_DIR "${QT_BINARY_DIR_DEFAULT}") 142 | set(QT_QMAKE_EXECUTABLE "${QT_BINARY_DIR_DEFAULT}/qmake${UTIL_EXT}") 143 | #set(QT_QMAKE_EXECUTABLE "${DAZ_SDK_DIR}/bin/${DZ_MIXED_PLATFORM}/qmake${UTIL_EXT}") 144 | #set(QT_BINARY_DIR "${DAZ_SDK_DIR}/bin/${DZ_MIXED_PLATFORM}") 145 | set(QT_HEADERS_DIR "${DAZ_SDK_DIR}/include") 146 | set(QT_QTCORE_INCLUDE_DIR "${DAZ_SDK_DIR}/include/QtCore") 147 | 148 | # the qt find module needs this folder but our build does not so just fake it 149 | file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/DUMMY_MKSPECS/default" ) 150 | set(QT_MKSPECS_DIR "${CMAKE_CURRENT_BINARY_DIR}/DUMMY_MKSPECS") 151 | 152 | find_package(Qt4 4.8.1 REQUIRED QtCore QtGui QtScript QtOpenGL QtNetwork QtSql QtXml) 153 | 154 | set(DZSDK_QT_CORE_TARGET Qt4::QtCore) 155 | set(DZSDK_QT_GUI_TARGET Qt4::QtGui) 156 | set(DZSDK_QT_SCRIPT_TARGET Qt4::QtScript) 157 | set(DZSDK_QT_OPENGL_TARGET Qt4::QtOpenGL) 158 | set(DZSDK_QT_NETWORK_TARGET Qt4::QtNetwork) 159 | set(DZSDK_QT_SQL_TARGET Qt4::QtSql) 160 | set(DZSDK_QT_XML_TARGET Qt4::QtXml) 161 | 162 | ############################ 163 | # FBX SETTINGS 164 | ############################ 165 | IF(NOT WIN32) 166 | set(FBX_ARCH "x64") 167 | SET(CMAKE_CXX_FLAGS "-m64 ${CMAKE_CXX_FLAGS}") 168 | SET(CMAKE_C_FLAGS "-m64 ${CMAKE_C_FLAGS}") 169 | SET(FBX_TMP_TARGET_LIBS ${FBX_TMP_TARGET_LIBS} dl pthread) 170 | SET(CMAKE_CXX_FLAGS "-D_NDEBUG -Os ${CMAKE_CXX_FLAGS}") 171 | SET(CMAKE_C_FLAGS "-D_NDEBUG -Os ${CMAKE_C_FLAGS}") 172 | SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall") 173 | SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall") 174 | 175 | IF(APPLE) 176 | set(FBX_LINKER_FLAGS "-lz -lxml2 -liconv") 177 | IF(NOT FBX_CLANG) 178 | SET(FBX_LINKER_FLAGS "-framework Carbon -framework SystemConfiguration ${FBX_LINKER_FLAGS}") 179 | ELSE(NOT FBX_CLANG) 180 | SET(FBX_LINKER_FLAGS "-framework CoreFoundation -framework SystemConfiguration ${FBX_LINKER_FLAGS}") 181 | ENDIF(NOT FBX_CLANG) 182 | SET(FBX_TMP_TARGET_LIBS ${FBX_TMP_TARGET_LIBS} iconv) 183 | ENDIF() 184 | 185 | # SET(CMAKE_CXX_FLAGS "-std=c++11 -stdlib\=libstdc++ ${CMAKE_CXX_FLAGS}") 186 | SET(CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}") 187 | 188 | ENDIF(NOT WIN32) 189 | 190 | set(FBX_SDK_DIR "" CACHE PATH "Path to FBX SDK" ) 191 | if(NOT FBX_SDK_DIR) 192 | message(FATAL_ERROR "Missing path to FBX SDK folder") 193 | return() 194 | endif() 195 | 196 | set(FBX_SDK_INCLUDE "${FBX_SDK_DIR}/include" CACHE PATH "Path to FBX SDK Includes" ) 197 | if(WIN32) 198 | set(FBX_PLATFORM "vs2017/x64/release") 199 | set(FBX_SDK_LIB "${FBX_SDK_DIR}/lib/${FBX_PLATFORM}/libfbxsdk-md.lib" CACHE FILEPATH "Path to FBX SDK static library (libfbx-md.lib)" ) 200 | set(FBX_SDK_XMLLIB "${FBX_SDK_DIR}/lib/${FBX_PLATFORM}/libxml2-md.lib" CACHE FILEPATH "Path to FBX SDK XML library (libxml2-md.lib)" ) 201 | set(FBX_IMPORT_LIBS 202 | ${FBX_SDK_LIB} 203 | ${FBX_SDK_XMLLIB} 204 | ${FBX_LINKER_FLAGS}) 205 | elseif(APPLE) 206 | # set(FBX_PLATFORM "clang/libstdcpp/release") 207 | set(FBX_PLATFORM "clang/release") 208 | set(FBX_SDK_LIB "${FBX_SDK_DIR}/lib/${FBX_PLATFORM}/libfbxsdk.a" CACHE FILEPATH "Path to FBX SDK static library (libfbxsdk.a)" ) 209 | set(FBX_IMPORT_LIBS 210 | ${FBX_SDK_LIB} 211 | ${FBX_LINKER_FLAGS}) 212 | endif() 213 | 214 | ############################ 215 | # Opensubdiv SETTINGS 216 | ############################ 217 | set(OPENSUBDIV_DIR "" CACHE PATH "Path to Opensubdiv folder" ) 218 | if(NOT OPENSUBDIV_DIR) 219 | message(FATAL_ERROR "Missing path to Opensubdiv folder") 220 | return() 221 | endif() 222 | set(OPENSUBDIV_INCLUDE "${OPENSUBDIV_DIR}" CACHE PATH "Path to Opensubdiv include folder (usually same as root folder)" ) 223 | if(WIN32) 224 | set(OPENSUBDIV_LIB "${OPENSUBDIV_DIR}/build/lib/Release/osdCPU.lib" CACHE FILEPATH "Path to Opensubdiv CPU static library (osdCPU.lib)" ) 225 | elseif(APPLE) 226 | set(OPENSUBDIV_LIB "${OPENSUBDIV_DIR}/build/lib/Release/libosdCPU.a" CACHE FILEPATH "Path to Opensubdiv CPU static library (libosdCPU.a)" ) 227 | endif() 228 | 229 | 230 | list(APPEND CMAKE_AUTOMOC_MOC_OPTIONS -i) 231 | 232 | add_subdirectory("Common") 233 | add_subdirectory("Unity") 234 | add_subdirectory("Unreal") 235 | -------------------------------------------------------------------------------- /Unreal/DazStudioPlugin/DzUnrealAction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "DzUnrealDialog.h" 19 | #include "DzUnrealAction.h" 20 | 21 | DzUnrealAction::DzUnrealAction() : 22 | DzRuntimePluginAction(tr("&Daz to Unreal"), tr("Send the selected node to Unreal.")) 23 | { 24 | Port = 0; 25 | SubdivisionDialog = nullptr; 26 | 27 | //Setup Icon 28 | QString iconName = "icon"; 29 | QPixmap basePixmap = QPixmap::fromImage(getEmbeddedImage(iconName.toLatin1())); 30 | QIcon icon; 31 | icon.addPixmap(basePixmap, QIcon::Normal, QIcon::Off); 32 | QAction::setIcon(icon); 33 | } 34 | 35 | void DzUnrealAction::executeAction() 36 | { 37 | // Check if the main window has been created yet. 38 | // If it hasn't, alert the user and exit early. 39 | DzMainWindow* mw = dzApp->getInterface(); 40 | if (!mw) 41 | { 42 | QMessageBox::warning(0, tr("Error"), 43 | tr("The main window has not been created yet."), QMessageBox::Ok); 44 | 45 | return; 46 | } 47 | 48 | // Create and show the dialog. If the user cancels, exit early, 49 | // otherwise continue on and do the thing that required modal 50 | // input from the user. 51 | 52 | if (dzScene->getNumSelectedNodes() != 1) 53 | { 54 | QMessageBox::warning(0, tr("Error"), 55 | tr("Please select one Character or Prop to send."), QMessageBox::Ok); 56 | return; 57 | } 58 | 59 | // Create the dialog 60 | DzUnrealDialog* dlg = new DzUnrealDialog(mw); 61 | 62 | // If the Accept button was pressed, start the export 63 | if (dlg->exec() == QDialog::Accepted) 64 | { 65 | // Collect the values from the dialog fields 66 | CharacterName = dlg->assetNameEdit->text(); 67 | ImportFolder = dlg->intermediateFolderEdit->text(); 68 | CharacterFolder = ImportFolder + "\\" + CharacterName + "\\"; 69 | CharacterFBX = CharacterFolder + CharacterName + ".fbx"; 70 | AssetType = dlg->assetTypeCombo->currentText().replace(" ", ""); 71 | MorphString = dlg->GetMorphString(); 72 | Port = dlg->portEdit->text().toInt(); 73 | ExportMorphs = dlg->morphsEnabledCheckBox->isChecked(); 74 | ExportSubdivisions = dlg->subdivisionEnabledCheckBox->isChecked(); 75 | MorphMapping = dlg->GetMorphMapping(); 76 | ShowFbxDialog = dlg->showFbxDialogCheckBox->isChecked(); 77 | SubdivisionDialog = DzUnrealSubdivisionDialog::Get(dlg); 78 | SubdivisionDialog->LockSubdivisionProperties(ExportSubdivisions); 79 | FBXVersion = dlg->fbxVersionCombo->currentText(); 80 | 81 | Export(); 82 | } 83 | } 84 | 85 | void DzUnrealAction::WriteConfiguration() 86 | { 87 | QString DTUfilename = CharacterFolder + CharacterName + ".dtu"; 88 | QFile DTUfile(DTUfilename); 89 | DTUfile.open(QIODevice::WriteOnly); 90 | DzJsonWriter writer(&DTUfile); 91 | writer.startObject(true); 92 | writer.addMember("Asset Name", CharacterName); 93 | writer.addMember("Asset Type", AssetType); 94 | writer.addMember("FBX File", CharacterFBX); 95 | writer.addMember("Import Folder", CharacterFolder); 96 | 97 | writer.startMemberArray("Materials", true); 98 | WriteMaterials(Selection, writer); 99 | writer.finishArray(); 100 | 101 | writer.startMemberArray("Morphs", true); 102 | if (ExportMorphs) 103 | { 104 | for (QMap::iterator i = MorphMapping.begin(); i != MorphMapping.end(); ++i) 105 | { 106 | writer.startObject(true); 107 | writer.addMember("Name", i.key()); 108 | writer.addMember("Label", i.value()); 109 | writer.finishObject(); 110 | } 111 | } 112 | 113 | writer.finishArray(); 114 | 115 | writer.startMemberArray("Subdivisions", true); 116 | if (ExportSubdivisions) 117 | SubdivisionDialog->WriteSubdivisions(writer); 118 | 119 | writer.finishArray(); 120 | writer.finishObject(); 121 | 122 | DTUfile.close(); 123 | 124 | // Send a message to Unreal telling it to start an import 125 | QUdpSocket* sendSocket = new QUdpSocket(this); 126 | QHostAddress* sendAddress = new QHostAddress("127.0.0.1"); 127 | 128 | sendSocket->connectToHost(*sendAddress, Port); 129 | sendSocket->write(DTUfilename.toUtf8()); 130 | } 131 | 132 | // Setup custom FBX export options 133 | void DzUnrealAction::SetExportOptions(DzFileIOSettings& ExportOptions) 134 | { 135 | 136 | } 137 | 138 | // Write out all the surface properties 139 | void DzUnrealAction::WriteMaterials(DzNode* Node, DzJsonWriter& Writer) 140 | { 141 | DzObject* Object = Node->getObject(); 142 | DzShape* Shape = Object ? Object->getCurrentShape() : NULL; 143 | 144 | if (Shape) 145 | { 146 | for (int i = 0; i < Shape->getNumMaterials(); i++) 147 | { 148 | DzMaterial* Material = Shape->getMaterial(i); 149 | if (Material) 150 | { 151 | DzPresentation* presentation = Node->getPresentation(); 152 | if (presentation) 153 | { 154 | const QString presentationType = presentation->getType(); 155 | Writer.startObject(true); 156 | Writer.addMember("Version", 2); 157 | Writer.addMember("Asset Name", Node->getLabel()); 158 | Writer.addMember("Material Name", Material->getName()); 159 | Writer.addMember("Material Type", Material->getMaterialName()); 160 | Writer.addMember("Name", QString("Asset Type")); 161 | Writer.addMember("Value", presentationType); 162 | Writer.addMember("Data Type", QString("String")); 163 | Writer.addMember("Texture", QString("")); 164 | Writer.finishObject(); 165 | //Stream << "2, " << Node->getLabel() << ", " << Material->getName() << ", " << Material->getMaterialName() << ", " << "Asset Type" << ", " << presentationType << ", " << "String" << ", " << "" << endl; 166 | } 167 | 168 | for (int propertyIndex = 0; propertyIndex < Material->getNumProperties(); propertyIndex++) 169 | { 170 | DzProperty* Property = Material->getProperty(propertyIndex); 171 | DzImageProperty* ImageProperty = qobject_cast(Property); 172 | if (ImageProperty) 173 | { 174 | QString Name = Property->getName(); 175 | QString TextureName = ""; 176 | 177 | if (ImageProperty->getValue()) 178 | { 179 | TextureName = ImageProperty->getValue()->getFilename(); 180 | } 181 | 182 | Writer.startObject(true); 183 | Writer.addMember("Version", 2); 184 | Writer.addMember("Asset Name", Node->getLabel()); 185 | Writer.addMember("Material Name", Material->getName()); 186 | Writer.addMember("Material Type", Material->getMaterialName()); 187 | Writer.addMember("Name", Name); 188 | Writer.addMember("Value", Material->getDiffuseColor().name()); 189 | Writer.addMember("Data Type", QString("Texture")); 190 | Writer.addMember("Texture", TextureName); 191 | Writer.finishObject(); 192 | continue; 193 | //Stream << "2, " << Node->getLabel() << ", " << Material->getName() << ", " << Material->getMaterialName() << ", " << Name << ", " << Material->getDiffuseColor().name() << ", " << "Texture" << ", " << TextureName << endl; 194 | } 195 | 196 | DzColorProperty* ColorProperty = qobject_cast(Property); 197 | if (ColorProperty) 198 | { 199 | QString Name = Property->getName(); 200 | QString TextureName = ""; 201 | 202 | if (ColorProperty->getMapValue()) 203 | { 204 | TextureName = ColorProperty->getMapValue()->getFilename(); 205 | } 206 | 207 | Writer.startObject(true); 208 | Writer.addMember("Version", 2); 209 | Writer.addMember("Asset Name", Node->getLabel()); 210 | Writer.addMember("Material Name", Material->getName()); 211 | Writer.addMember("Material Type", Material->getMaterialName()); 212 | Writer.addMember("Name", Name); 213 | Writer.addMember("Value", ColorProperty->getColorValue().name()); 214 | Writer.addMember("Data Type", QString("Color")); 215 | Writer.addMember("Texture", TextureName); 216 | Writer.finishObject(); 217 | //Stream << "2, " << Node->getLabel() << ", " << Material->getName() << ", " << Material->getMaterialName() << ", " << Name << ", " << ColorProperty->getColorValue().name() << ", " << "Color" << ", " << TextureName << endl; 218 | continue; 219 | } 220 | 221 | DzNumericProperty* NumericProperty = qobject_cast(Property); 222 | if (NumericProperty) 223 | { 224 | QString Name = Property->getName(); 225 | QString TextureName = ""; 226 | 227 | if (NumericProperty->getMapValue()) 228 | { 229 | TextureName = NumericProperty->getMapValue()->getFilename(); 230 | } 231 | 232 | Writer.startObject(true); 233 | Writer.addMember("Version", 2); 234 | Writer.addMember("Asset Name", Node->getLabel()); 235 | Writer.addMember("Material Name", Material->getName()); 236 | Writer.addMember("Material Type", Material->getMaterialName()); 237 | Writer.addMember("Name", Name); 238 | Writer.addMember("Value", QString::number(NumericProperty->getDoubleValue())); 239 | Writer.addMember("Data Type", QString("Double")); 240 | Writer.addMember("Texture", TextureName); 241 | Writer.finishObject(); 242 | //Stream << "2, " << Node->getLabel() << ", " << Material->getName() << ", " << Material->getMaterialName() << ", " << Name << ", " << NumericProperty->getDoubleValue() << ", " << "Double" << ", " << TextureName << endl; 243 | } 244 | } 245 | } 246 | } 247 | } 248 | 249 | DzNodeListIterator Iterator = Node->nodeChildrenIterator(); 250 | while (Iterator.hasNext()) 251 | { 252 | DzNode* Child = Iterator.next(); 253 | WriteMaterials(Child, Writer); 254 | } 255 | } 256 | 257 | 258 | #include "moc_DzUnrealAction.cpp" 259 | -------------------------------------------------------------------------------- /Common/DzRuntimePluginAction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | 36 | #include "DzRuntimePluginAction.h" 37 | 38 | QObject* UnofficialDzRuntimePluginAction::m_ScriptReturn_Object; 39 | int UnofficialDzRuntimePluginAction::m_ScriptReturn_ReturnCode; 40 | 41 | 42 | UnofficialDzRuntimePluginAction::UnofficialDzRuntimePluginAction(const QString& text, const QString& desc) : 43 | DzAction(text, desc) 44 | { 45 | ExportMorphs = false; 46 | ExportSubdivisions = false; 47 | ShowFbxDialog = false; 48 | 49 | connect(this, SIGNAL(ScriptReturn(QObject*)), this, SLOT(HandleScriptReturn(QObject*))); 50 | connect(this, SIGNAL(ScriptReturn(bool)), this, SLOT(HandleScriptReturn(bool))); 51 | 52 | } 53 | 54 | UnofficialDzRuntimePluginAction::~UnofficialDzRuntimePluginAction() 55 | { 56 | } 57 | 58 | void UnofficialDzRuntimePluginAction::Export() 59 | { 60 | // FBX Export 61 | Selection = dzScene->getPrimarySelection(); 62 | if (!Selection) 63 | return; 64 | 65 | DzExportMgr* ExportManager = dzApp->getExportMgr(); 66 | DzExporter* Exporter = ExportManager->findExporterByClassName("DzFbxExporter"); 67 | 68 | if (Exporter) 69 | { 70 | bool bDoMaterials = false; 71 | bool bDoAnimation = false; 72 | 73 | 74 | DzFileIOSettings ExportOptions; 75 | ExportOptions.setBoolValue("doSelected", true); 76 | ExportOptions.setBoolValue("doVisible", false); 77 | if (AssetType == "SkeletalMesh" || AssetType == "StaticMesh") 78 | { 79 | ExportOptions.setBoolValue("doFigures", true); 80 | ExportOptions.setBoolValue("doProps", true); 81 | bDoMaterials = true; 82 | } 83 | else 84 | { 85 | ExportOptions.setBoolValue("doFigures", true); 86 | ExportOptions.setBoolValue("doProps", false); 87 | } 88 | if (AssetType == "Animation") 89 | { 90 | bDoAnimation = true; 91 | } 92 | ExportOptions.setBoolValue("doLights", false); 93 | ExportOptions.setBoolValue("doCameras", false); 94 | ExportOptions.setBoolValue("doAnims", false); 95 | if (AssetType == "SkeletalMesh" && ExportMorphs && MorphString != "") 96 | { 97 | ExportOptions.setBoolValue("doMorphs", true); 98 | ExportOptions.setStringValue("rules", MorphString); 99 | } 100 | else 101 | { 102 | ExportOptions.setBoolValue("doMorphs", false); 103 | ExportOptions.setStringValue("rules", ""); 104 | } 105 | 106 | ExportOptions.setStringValue("format", FBXVersion); 107 | ExportOptions.setIntValue("RunSilent", !ShowFbxDialog); 108 | 109 | ExportOptions.setBoolValue("doEmbed", false); 110 | ExportOptions.setBoolValue("doCopyTextures", false); 111 | ExportOptions.setBoolValue("doDiffuseOpacity", false); 112 | ExportOptions.setBoolValue("doMergeClothing", true); 113 | ExportOptions.setBoolValue("doStaticClothing", false); 114 | ExportOptions.setBoolValue("degradedSkinning", true); 115 | ExportOptions.setBoolValue("degradedScaling", true); 116 | ExportOptions.setBoolValue("doSubD", false); 117 | ExportOptions.setBoolValue("doCollapseUVTiles", false); 118 | //ExportOptions.setBoolValue("doLocks", true); 119 | //ExportOptions.setBoolValue("doLimits", true); 120 | 121 | //////////// 122 | // Prepare for Material exports (Skeleton and Static Mesh) 123 | //////////// 124 | DzNode* Parent = Selection; 125 | QList MaterialNames; 126 | QMap OriginalMaterialNames; 127 | if (bDoMaterials) 128 | { 129 | // get the top level node for things like clothing so we don't get dupe material names 130 | while (Parent->getNodeParent() != NULL) 131 | { 132 | Parent = Parent->getNodeParent(); 133 | } 134 | // rename duplicate material names 135 | RenameDuplicateMaterials(Parent, MaterialNames, OriginalMaterialNames); 136 | } 137 | 138 | /////////////// 139 | // Prepare Animation exports 140 | /////////////// 141 | DzNodeList undoHideList; 142 | if (bDoAnimation) 143 | { 144 | // correct CharacterFolder 145 | CharacterFolder = ImportFolder + QDir::separator() + CharacterName.left(CharacterName.indexOf("@")) + QDir::separator(); 146 | // correct animation filename 147 | CharacterFBX = CharacterFolder + CharacterName + ".fbx"; 148 | // correct export options 149 | ExportOptions.setBoolValue("doAnims", true); 150 | // disable props, morphs, subD, textures, etc 151 | ExportOptions.setBoolValue("doVisible", true); 152 | ExportOptions.setBoolValue("doMergeClothing", false); 153 | ExportOptions.setBoolValue("doEmbed", false); 154 | ExportOptions.setBoolValue("doCopyTextures", false); 155 | ExportOptions.setBoolValue("doDiffuseOpacity", false); 156 | ExportOptions.setBoolValue("doSubD", false); 157 | ExportOptions.setBoolValue("doCollapseUVTiles", false); 158 | ExportOptions.setBoolValue("doLocks", false); 159 | ExportOptions.setBoolValue("doLimits", false); 160 | 161 | // Loop through and Hide all visible geometry, putting it into list to unhide 162 | DzNodeListIterator nodeIterator = dzScene->nodeListIterator(); 163 | nodeIterator.toFront(); 164 | while (nodeIterator.hasNext()) 165 | { 166 | DzNode *node = nodeIterator.next(); 167 | if (node == Selection) 168 | continue; 169 | if (node->isVisible()) 170 | { 171 | undoHideList.append(node); 172 | node->setVisible(false); 173 | } 174 | } 175 | } 176 | 177 | 178 | ///////////////////// 179 | // START: Export FBX 180 | /////////////////////// 181 | QDir dir; 182 | dir.mkpath(CharacterFolder); 183 | 184 | // Unnecessary, all code is already done above 185 | // SetExportOptions(ExportOptions); 186 | 187 | if (ExportSubdivisions && ExportBaseMesh) 188 | { 189 | //if (ExportBaseMesh) 190 | //{ 191 | // Create Base FBX in addition to main subdivided FBX 192 | QString CharacterBaseFBX = CharacterFBX; 193 | CharacterBaseFBX.replace(".fbx", "_base.fbx"); 194 | Exporter->writeFile(CharacterBaseFBX, &ExportOptions); 195 | //} 196 | //else 197 | //{ 198 | // QString CharacterHDFBX = CharacterFBX; 199 | // CharacterHDFBX.replace(".fbx", "_HD.fbx"); 200 | // Exporter->writeFile(CharacterHDFBX, &ExportOptions); 201 | 202 | // WriteConfiguration(); 203 | //} 204 | } 205 | else 206 | { 207 | Exporter->writeFile(CharacterFBX, &ExportOptions); 208 | WriteConfiguration(); 209 | } 210 | 211 | //////////////////////// 212 | // DONE: Export FBX 213 | //////////////////////// 214 | 215 | ////////////////////// 216 | // Undo Export Preparations 217 | ////////////////////// 218 | if (bDoAnimation) 219 | { 220 | // loop through list to undo hidden geometry 221 | while (undoHideList.isEmpty() == false) 222 | { 223 | DzNode *node = undoHideList.first(); 224 | node->setVisible(true); 225 | undoHideList.pop_front(); 226 | } 227 | 228 | } 229 | if (bDoMaterials) 230 | { 231 | // Change back material names 232 | UndoRenameDuplicateMaterials(Parent, MaterialNames, OriginalMaterialNames); 233 | } 234 | 235 | } // if (Exporter) 236 | } 237 | 238 | // If there are duplicate material names, save off the original and rename one 239 | void UnofficialDzRuntimePluginAction::RenameDuplicateMaterials(DzNode* Node, QList& MaterialNames, QMap& OriginalMaterialNames) 240 | { 241 | DzObject* Object = Node->getObject(); 242 | DzShape* Shape = Object ? Object->getCurrentShape() : NULL; 243 | 244 | if (Shape) 245 | { 246 | for (int i = 0; i < Shape->getNumMaterials(); i++) 247 | { 248 | DzMaterial* Material = Shape->getMaterial(i); 249 | if (Material) 250 | { 251 | OriginalMaterialNames.insert(Material, Material->getName()); 252 | while (MaterialNames.contains(Material->getName())) 253 | { 254 | Material->setName(Material->getName() + "_1"); 255 | } 256 | MaterialNames.append(Material->getName()); 257 | } 258 | } 259 | } 260 | DzNodeListIterator Iterator = Node->nodeChildrenIterator(); 261 | while (Iterator.hasNext()) 262 | { 263 | DzNode* Child = Iterator.next(); 264 | RenameDuplicateMaterials(Child, MaterialNames, OriginalMaterialNames); 265 | } 266 | } 267 | 268 | // Restore the original material names 269 | void UnofficialDzRuntimePluginAction::UndoRenameDuplicateMaterials(DzNode* Node, QList& MaterialNames, QMap& OriginalMaterialNames) 270 | { 271 | QMap::iterator iter; 272 | for (iter = OriginalMaterialNames.begin(); iter != OriginalMaterialNames.end(); ++iter) 273 | { 274 | iter.key()->setName(iter.value()); 275 | } 276 | } 277 | 278 | 279 | // DB (2021-05-24): hybrid C++/script system 280 | void UnofficialDzRuntimePluginAction::HandleScriptReturn(bool result) 281 | { 282 | m_ScriptReturn_Object = NULL; 283 | if (result == false) 284 | { 285 | m_ScriptReturn_ReturnCode = -1; 286 | } 287 | else 288 | { 289 | m_ScriptReturn_ReturnCode = 1; 290 | } 291 | } 292 | 293 | // DB (2021-05-24): hybrid C++/script system 294 | void UnofficialDzRuntimePluginAction::HandleScriptReturn(QObject* object) 295 | { 296 | if (object == NULL) 297 | { 298 | m_ScriptReturn_Object = NULL; 299 | m_ScriptReturn_ReturnCode = -1; 300 | } 301 | else 302 | { 303 | m_ScriptReturn_Object = object; 304 | m_ScriptReturn_ReturnCode = 1; 305 | } 306 | } 307 | 308 | #include "moc_DzRuntimePluginAction.cpp" 309 | --------------------------------------------------------------------------------