-
Notifications
You must be signed in to change notification settings - Fork 24
/
ms_Init.py
77 lines (52 loc) · 8.57 KB
/
ms_Init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# ███╗ ███╗███████╗ ██████╗ █████╗ ███████╗ ██████╗ █████╗ ███╗ ██╗███████╗ ██╗███╗ ██╗████████╗███████╗ ██████╗ ██████╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗
# ████╗ ████║██╔════╝██╔════╝ ██╔══██╗██╔════╝██╔════╝██╔══██╗████╗ ██║██╔════╝ ██║████╗ ██║╚══██╔══╝██╔════╝██╔════╝ ██╔══██╗██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║
# ██╔████╔██║█████╗ ██║ ███╗███████║███████╗██║ ███████║██╔██╗ ██║███████╗ ██║██╔██╗ ██║ ██║ █████╗ ██║ ███╗██████╔╝███████║ ██║ ██║██║ ██║██╔██╗ ██║
# ██║╚██╔╝██║██╔══╝ ██║ ██║██╔══██║╚════██║██║ ██╔══██║██║╚██╗██║╚════██║ ██║██║╚██╗██║ ██║ ██╔══╝ ██║ ██║██╔══██╗██╔══██║ ██║ ██║██║ ██║██║╚██╗██║
# ██║ ╚═╝ ██║███████╗╚██████╔╝██║ ██║███████║╚██████╗██║ ██║██║ ╚████║███████║ ██║██║ ╚████║ ██║ ███████╗╚██████╔╝██║ ██║██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║
# ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# Quixel AB - Megascans Project
# The Megascans Integration for Unreal Engine 4 was written in Python, using the UnrealEnginePython plugin
# by 20Tab : https://github.com/20tab/UnrealEnginePython
# Megascans : https://megascans.se
# This integration gives you a LiveLink between Megascans Bridge and Unreal Engine 4. The source code is all exposed
# and documented for you to use it as you wish (within the Megascans EULA limits, that is).
# We provide a set of useful functions for importing data inside the engine, but you can use the default
# functions (of UnrealEnginePython) instead of Megascans modules if you want.
# We've tried to document the code as much as we could within a short timeframe, so if you're having any issues
# please send me an email ([email protected]) for support.
# ms_Init is the main function used to call the modules we might be in need of during the plugin's execution.
# This file is called on editor start and is a requirement as a first-line import command when working with the integration API.
import unreal_engine as ue
import json, re, os, sys, asyncio, traceback, ctypes, time, clipboard, webbrowser, inspect
from pprint import pprint
from unreal_engine.enums import EMaterialSamplerType, EHorizontalAlignment, EVerticalAlignment
from unreal_engine import SWindow, SVerticalBox, SHorizontalBox, SButton, STextBlock, SBorder, FLinearColor, FMaterialEditorUtilities, FSlateIcon, FSlateStyleSet
from pprint import pprint
from unreal_engine.structs import SlateBrush, SlateColor, Vector2D, SkeletalMaterial, MeshUVChannelInfo, ColorMaterialInput, VectorMaterialInput, ScalarMaterialInput, ExpressionInput
from unreal_engine.classes import MaterialInstanceConstant, MaterialInstance, StaticMeshActor, FoliageType
from unreal_engine.classes import StaticMesh, PyFbxFactory, MaterialExpressionTextureSample, MaterialFactoryNew, Material, TextureFactory, Texture2D
custom_path = None
print('#'*20 + '-'*10 + 'Python Integration for Megascans Initialized' + '-'*10 + '#'*20)
custom_path = (r"CUSTOMPROJECTPATH" + "/")
if not os.path.exists(custom_path):
path_ = (os.path.dirname(os.path.realpath('ms_Init')))
path_ = os.path.split(os.path.split(path_)[0])[0]
custom_path = os.path.join(path_, 'Plugins', 'UnrealEnginePython', '')
def ms_return_path():
return (custom_path)
print(custom_path)
try:
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
except:
ue.message_dialog_open(0, "C++ project detected, the integration UI is currently only available in a blueprint project.\n\
You can still use the plugin as normal, and expect C++ compatibility soon !")
print('C++ Project Detected, UI not available in the current version.')
pass