Skip to content

Commit 603eb79

Browse files
committed
- add the report two sided materials example
1 parent 3bed2f3 commit 603eb79

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# _
2+
# (_)
3+
# _ __ ___ __ _ _ __ ___ ___ _ __ _ ___ _ __ ___
4+
# | '_ ` _ \ / _` | '_ ` _ \ / _ \| '_ \| |/ _ \ '_ ` _ \
5+
# | | | | | | (_| | | | | | | (_) | | | | | __/ | | | | |
6+
# |_| |_| |_|\__,_|_| |_| |_|\___/|_| |_|_|\___|_| |_| |_|
7+
# www.mamoniem.com
8+
# www.ue4u.xyz
9+
#Copyright 2021 Muhammad A.Moniem (@_mamoniem). All Rights Reserved.
10+
#
11+
12+
import unreal
13+
14+
workingPath = "/Game/"
15+
16+
@unreal.uclass()
17+
class GetEditorAssetLibrary(unreal.EditorAssetLibrary):
18+
pass
19+
20+
editorAssetLib = GetEditorAssetLibrary()
21+
22+
allAssets = editorAssetLib.list_assets(workingPath, True, False)
23+
24+
if (len(allAssets) > 0):
25+
for asset in allAssets:
26+
assetData = editorAssetLib.find_asset_data(asset)
27+
if(assetData.get_asset().get_class().get_name() == "Material"):
28+
if(assetData.get_asset().get_editor_property("two_sided") == True):
29+
unreal.log_warning("Master material [%s] is TWO-SIDED" % assetData.asset_name)
30+
else:
31+
unreal.log("Master material [%s] OK" % assetData.asset_name)
32+
elif (assetData.get_asset().get_class().get_name() == "MaterialInstance" or assetData.get_asset().get_class().get_name() == "MaterialInstanceConstant"):
33+
baseOverrides = assetData.get_asset().get_editor_property("base_property_overrides")
34+
if (baseOverrides.get_editor_property("override_two_sided") == True):
35+
unreal.log_warning("Material Instance [%s] is TWO-SIDED" % assetData.asset_name)
36+
else:
37+
unreal.log("Material Instance [%s] OK" % assetData.asset_name)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Don't forget to follow this repo, [YouTube](http://www.youtube.com/channel/UCBBc
4646
## Materials ##
4747
- **[CreateInstancesOfSelectedMaterial.py](https://github.com/mamoniem/UnrealEditorPythonScripts/blob/master/Materials/CreateInstancesOfSelectedMaterial.py)** Run on a selected single or multiple Material file(s) in order to generate material instances of it/them. The number of the final generated instances count can be set within the script before running, by changing the value of the variable *totalRequiredInstances*
4848
- **[AssignMaterialToAllSimilarNamedMeshes.py](https://github.com/mamoniem/UnrealEditorPythonScripts/blob/master/Materials/AssignMaterialToAllSimilarNamedMeshes.py)** Select a static mesh and then a material *(Yup, has to be in that order)* and run the script in order to run through the project looking for similar static meshes, and then assign the selected material to all of found clones of that mesh. The script can be extended easily to add more materials in case of the mesh is not using a single material slot.
49+
- **[ReportTwoSidedMaterials.py](https://github.com/mamoniem/UnrealEditorPythonScripts/blob/master/Materials/ReportTwoSidedMaterials.py)** When run this script, it will go through the entire project searching for materials and material instances, and eventually report fully to the log if there are ones that is using Two-Sided shading.
4950

5051
## Sequencer ##
5152
- **[CreateAndEditCineCameraActor.py](https://github.com/mamoniem/UnrealEditorPythonScripts/blob/master/Sequencer/CreateAndEditCineCameraActor.py)** An example on how you can create cinematic camera in the current world/map, and start modifying some of it's focus settings (Keep in mind you **MUST enable the Scripting python sequencer plugin** for that, **python plugin only is not enough**).

0 commit comments

Comments
 (0)