Second commit

This commit is contained in:
ThomasCharester committed 2026-09-20 15:26:03 +03:00
commit 36840f3ad4
999 files changed
+61364

No files matched your search

@@ -0,0 +1,138 @@
//
// This file is part of the Tremble package by Tiny Goose.
// Copyright (c) 2024-2026 TinyGoose Ltd., All Rights Reserved.
//
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace TinyGoose.Tremble.Editor
{
[ManualPage("Materials/Material Groups")]
public class MaterialGroupsPage : ManualPageBase
{
private TrembleSyncSettings m_SyncSettings;
private MaterialGroup m_DefaultMaterialGroup;
private Material[] m_UnexposedMaterials;
protected override void OnInit()
{
m_SyncSettings = TrembleSyncSettings.Get();
Material[] allMaterials = AssetDatabase
.FindAssets("t:material", new[] { "Assets" })
.Select(AssetDatabase.GUIDToAssetPath)
.Select(AssetDatabase.LoadAssetAtPath<Material>)
.ToArray();
m_DefaultMaterialGroup = MaterialGroup.CreateDefault();
m_UnexposedMaterials = allMaterials
.Where(m => !MaterialGroupUtil.IsMaterialPartOfAnyMaterialGroup(m))
.ToArray();
}
protected override void OnGUI()
{
Text(
"By default, Tremble will export all of the materials in your project into TrenchBroom.",
"If your project has a lot of materials though, this can take some time,",
"and there may be materials that you never want to use in TrenchBroom at all."
);
Text(
"By using material groups, you can decide which materials to export to TrenchBroom,",
"and even organise them into groups!"
);
H1("Assigning material groups");
Text("There are 2 ways to set up material groups:");
Bullet(
"Click an individual material (or a group of materials) in Unity's Project window,",
"and select a group from the dropdown at the top of the Inspector view."
);
Image("T_Manual_MaterialGroups");
Bullet(
"or, go into Tremble's settings (see Basics > Tremble's Settings), click 'Materials',",
"and add one or more groups. Now you can assign materials to each group."
);
H1("How is my project set up?");
if (m_SyncSettings.MaterialGroups is { Length: > 0 })
{
Text(
$"Your project is using material groups, and you have {m_SyncSettings.MaterialGroups.Length}",
"of them:"
);
foreach (MaterialGroup matGroup in m_SyncSettings.MaterialGroups)
{
Indent(() =>
{
Foldout($"{matGroup.Name}, {matGroup.Materials.Length} material(s)", () =>
{
foreach (Material mat in matGroup.Materials)
{
GUILayout.BeginHorizontal();
{
Bullet(mat.name);
Button($"select {mat.name}", width: 200f, action: () => Selection.activeObject = mat);
}
GUILayout.EndHorizontal();
}
});
});
}
if (m_UnexposedMaterials.Length == 0)
{
Text("...and that's all your materials!");
}
else
{
Text($"There are {m_UnexposedMaterials.Length} materials that are not exposed to TrenchBroom:");
Indent(() =>
{
Foldout($"Unavailable material(s)", () =>
{
foreach (Material mat in m_UnexposedMaterials)
{
GUILayout.BeginHorizontal();
{
Bullet(mat.name);
Button($"select {mat.name}", width: 200f, action: () => Selection.activeObject = mat);
}
GUILayout.EndHorizontal();
}
Text("To make a Material available for use, select it and use the Inspector to add it",
"to a Material Group.");
});
});
}
}
else
{
Text(
$"Your project is not using material groups, and you have {m_DefaultMaterialGroup.Materials.Length}",
"compatible material(s) in your project:"
);
Indent(() =>
{
Foldout("Show materials", () =>
{
foreach (Material material in m_DefaultMaterialGroup.Materials)
{
Bullet(material.name);
}
});
});
}
string trembleMaterialsPath = "Project/Tremble/3 Materials";
ActionBar_SingleAction("Edit Material Groups", () => SettingsService.OpenProjectSettings(trembleMaterialsPath));
}
}
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: fcdaf93099d84ea28783d12928ca5055
timeCreated: 1723448806
AssetOrigin:
serializedVersion: 1
productId: 277805
packageName: Tremble - Map Importer
packageVersion: 1.11.1
assetPath: Assets/Tremble/Editor/Manual/Pages/Materials/MaterialGroupsPage.cs
uploadId: 939664
@@ -0,0 +1,71 @@
//
// This file is part of the Tremble package by Tiny Goose.
// Copyright (c) 2024-2026 TinyGoose Ltd., All Rights Reserved.
//
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace TinyGoose.Tremble.Editor
{
[ManualPage("Materials/Render Settings")]
public class MaterialRenderDataPage : ManualPageBase
{
private TrembleSyncSettings m_SyncSettings;
private MaterialGroup m_DefaultMaterialGroup;
private Material[] m_UnexposedMaterials;
protected override void OnInit()
{
m_SyncSettings = TrembleSyncSettings.Get();
}
protected override void OnGUI()
{
Text(
"When Tremble exports materials, it can convert your materials in a few different ways.",
"You can choose a material's render settings by finding that material in the editor,",
"and changing the following settings:"
);
Image("T_Manual_RenderSettings");
H1("Render Mode");
Bold("Dynamic Mode (\"MainTex\")");
Bullet(
"Uses the main texture of the material as the texture exported to Trenchbroom.",
"This will work fine for most materials. Directly copies the texture to the export folder",
"if the resolution is unmodified."
);
Bullet(
"If you're using a custom shader, make sure your material either has a texture named _MainTex,",
"or a texture marked as Main Texture. This can be done through ShaderLab markup with [MainTexture]",
"for code shaders, or by marking the texture as a Main Texture in Shader Graph shaders.");
Bullet(
"If the renderer fails to find a matching main texture, it will try a few other texture names",
"like _Color, _BaseColor, or other misspellings of _MainTex (just in case).");
Bullet(
"If that also fails, the renderer will switch to Fixed Size Mode."
);
Bold("Fixed-Size Mode (\"Legacy\")");
Bullet(
"Renders the material using a camera system. ",
"This is useful for procedural materials, or any other material that doesn't have",
"a main texture parameter."
);
Bullet(
"Will be automatically used if MainTex mode fails."
);
H1("Resolution");
Text(
"You can use these settings to set the resolution of a texture.",
"This is useful for textures that don't have the same resolution on the X and Y axis.",
"Note that the resolution affects UV mapping - in Trenchbroom, one pixel is one unit by default."
);
}
}
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b87f0fb523a94356827025cd020dd8d3
timeCreated: 1752489026
AssetOrigin:
serializedVersion: 1
productId: 277805
packageName: Tremble - Map Importer
packageVersion: 1.11.1
assetPath: Assets/Tremble/Editor/Manual/Pages/Materials/MaterialRenderDataPage.cs
uploadId: 939664
@@ -0,0 +1,57 @@
//
// This file is part of the Tremble package by Tiny Goose.
// Copyright (c) 2024-2026 TinyGoose Ltd., All Rights Reserved.
//
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace TinyGoose.Tremble.Editor
{
[ManualPage("Materials/About")]
public class MaterialsAboutPage : ManualPageBase
{
protected override void OnGUI()
{
Text(
"Tremble uses a novel approach compared to other map import tools.",
"Many map import tools will allow users to create their own Textures folder for use",
"with TrenchBroom, and will try to create materials based on those on import."
);
Text(
"This results in materials in your project which use the built-in 'Standard'",
"(or URP/HDRP 'Lit') shader."
);
Text(
"Tremble does NOT work in this way. Tremble takes your existing Unity materials,",
"and generates a Textures folder for you with an accurate representation of each",
"Unity material as a texture."
);
H1("Why?!");
Text(
"Well, we believe that users don't want to spend time curating textures for",
"TrenchBroom when ultimately what they care about is the Material looking good",
"in Unity (where your players will see it). It's the same reason Tremble does",
"not support Quake®'s lightmapping tech. Your game will use Unity's lighting,",
"so this is where you should apply your scene's lighting setup."
);
H1("But really, what benefits does it give me?");
Bullet("Your materials and shaders appear exactly how you set them up in Unity, in your game!");
Bullet(
"You are not restricted to using Standard/Lit shaders for your map materials! You",
"can use custom shaders/Shader Graphs, including Unlit, bumpmapped, or entirely HLSL-driven",
"materials."
);
Bullet(
"There's no need to worry about how TrenchBroom handles textures - Tremble",
"keeps everything in sync automagically!"
);
}
}
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0eedd4cad37c4fdca5801d345f060473
timeCreated: 1724656293
AssetOrigin:
serializedVersion: 1
productId: 277805
packageName: Tremble - Map Importer
packageVersion: 1.11.1
assetPath: Assets/Tremble/Editor/Manual/Pages/Materials/MaterialsAboutPage.cs
uploadId: 939664