Skip to content

Commit

Permalink
chore: Skip Initially Disabled -> Skip Enablement Mismatched
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 committed Oct 31, 2023
1 parent cb6398f commit 2a1c107
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
Binary file modified .docs/content/docs/reference/merge-skinned-mesh/component.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions .docs/content/docs/reference/merge-skinned-mesh/index.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ BlendShapeは、頂点とBlendShapeの数に比例して負荷が大きくなる

統合対象のSkinnedMeshRendererが属しているGameObjectにSkinnedMeshRenderer以外のコンポーネントが無い場合、そのGameObjectをヒエラルキーから取り除くオプションです。

### 無効なレンダラーをスキップする {#skip-initially-disabled-renderers}
### 有効無効が統合先と等しくないレンダラーを統合しない {#skip-initially-disabled-renderers}

このオプションが有効で、マージ先レンダラーがビルド時に有効な場合、
統合対象のSkinnedMeshRendererやMeshRendererがビルド時に無効になっている場合、統合対象から除外されます。
このオプションが有効なばあい、有効無効が統合先と等しくないSkinnedMeshRendererやMeshRendererがビルド時に無効になっている場合、統合対象から除外されます。

### マテリアルの統合 {#merge-materials}

Expand Down
6 changes: 3 additions & 3 deletions .docs/content/docs/reference/merge-skinned-mesh/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ Drop to None element at the bottom to add renderer and reset to None to remove f
If this checkbox is checked and the GameObject SkinnedMeshRenderer belongs to does not have
any other components than SkinnedMeshRenderer, the GameObject will be removed from Hierarchy.

### Skip Initially Disabled Renderers
### Skip Enabled Mismatched Renderers

If this checkbox is checked and merge target SkinnedMeshRenderer is enabled,
SkinnedMeshRenderer and MeshRenderer will not be merged if they are disabled on the build time.
If this checkbox is checked, SkinnedMeshRenderer and MeshRenderer will not be merged
if enablement is different than target renderer the on the build time.

### Merge Materials

Expand Down
8 changes: 4 additions & 4 deletions Editor/MergeSkinnedMeshEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ static MergeSkinnedMeshEditor()
SerializedProperty _renderersSetProp;
SerializedProperty _staticRenderersSetProp;
SerializedProperty _removeEmptyRendererObjectProp;
SerializedProperty _skipInitiallyDisabledRenderers;
SerializedProperty _skipEnabledMismatchedRenderers;
PrefabSafeSet.EditorUtil<Material> _doNotMergeMaterials;

private void OnEnable()
{
_renderersSetProp = serializedObject.FindProperty("renderersSet");
_staticRenderersSetProp = serializedObject.FindProperty("staticRenderersSet");
_removeEmptyRendererObjectProp = serializedObject.FindProperty("removeEmptyRendererObject");
_skipInitiallyDisabledRenderers =
serializedObject.FindProperty(nameof(MergeSkinnedMesh.skipInitiallyDisabledRenderers));
_skipEnabledMismatchedRenderers =
serializedObject.FindProperty(nameof(MergeSkinnedMesh.skipEnabledMismatchedRenderers));
var nestCount = PrefabSafeSet.PrefabSafeSetUtil.PrefabNestCount(serializedObject.targetObject);
_doNotMergeMaterials = PrefabSafeSet.EditorUtil<Material>.Create(
serializedObject.FindProperty("doNotMergeMaterials"),
Expand All @@ -74,7 +74,7 @@ protected override void OnInspectorGUIInner()
EditorGUILayout.PropertyField(_renderersSetProp);
EditorGUILayout.PropertyField(_staticRenderersSetProp);
EditorGUILayout.PropertyField(_removeEmptyRendererObjectProp);
EditorGUILayout.PropertyField(_skipInitiallyDisabledRenderers);
EditorGUILayout.PropertyField(_skipEnabledMismatchedRenderers);

serializedObject.ApplyModifiedProperties();

Expand Down
9 changes: 5 additions & 4 deletions Editor/Processors/SkinnedMeshes/MergeSkinnedMeshProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ public override void Process(BuildContext context, MeshInfo2 target)
{
List<SkinnedMeshRenderer> skinnedMeshRenderers;
List<MeshRenderer> staticMeshRenderers;
Func<Renderer, bool> enabledFilter = x => x.enabled && x.gameObject.activeSelf;
if (Component.skipInitiallyDisabledRenderers && enabledFilter(Target))
if (Component.skipEnabledMismatchedRenderers)
{
skinnedMeshRenderers = SkinnedMeshRenderers.Where<SkinnedMeshRenderer>(enabledFilter).ToList();
staticMeshRenderers = StaticMeshRenderers.Where<MeshRenderer>(enabledFilter).ToList();
bool RendererEnabled(Renderer x) => x.enabled && x.gameObject.activeSelf;
var enabledSelf = RendererEnabled(Target);
skinnedMeshRenderers = SkinnedMeshRenderers.Where(x => RendererEnabled(x) != enabledSelf).ToList();
staticMeshRenderers = StaticMeshRenderers.Where(x => RendererEnabled(x) != enabledSelf).ToList();
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions Localization/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ msgstr "Static Renderers"
msgid "MergeSkinnedMesh:prop:removeEmptyRendererObject"
msgstr "Remove Empty Renderer Object"

msgid "MergeSkinnedMesh:prop:skipInitiallyDisabledRenderers"
msgstr "Skip Initially Disabled Renderers"
msgid "MergeSkinnedMesh:prop:skipEnabledMismatchedRenderers"
msgstr "Skip Enabled Mismatched Renderers"

msgid "MergeSkinnedMesh:label:Merge Materials"
msgstr "Merge Materials"
Expand Down
4 changes: 2 additions & 2 deletions Localization/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ msgstr "静的レンダラー"
msgid "MergeSkinnedMesh:prop:removeEmptyRendererObject"
msgstr "空のレンダラーオブジェクトを削除する"

msgid "MergeSkinnedMesh:prop:skipInitiallyDisabledRenderers"
msgstr "無効なレンダラーをスキップする"
msgid "MergeSkinnedMesh:prop:skipEnabledMismatchedRenderers"
msgstr "有効無効が統合先と等しくないレンダラーを統合しない"

msgid "MergeSkinnedMesh:label:Merge Materials"
msgstr "マテリアルの統合"
Expand Down
6 changes: 3 additions & 3 deletions Runtime/MergeSkinnedMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ internal class MergeSkinnedMesh : EditSkinnedMeshComponent, IStaticValidated
[NotKeyable, CL4EELocalized("MergeSkinnedMesh:prop:removeEmptyRendererObject")]
[ToggleLeft]
public bool removeEmptyRendererObject = true;
[CL4EELocalized("MergeSkinnedMesh:prop:skipInitiallyDisabledRenderers")]
[CL4EELocalized("MergeSkinnedMesh:prop:skipEnabledMismatchedRenderers")]
[NotKeyable]
[ToggleLeft]
public bool skipInitiallyDisabledRenderers;
public bool skipEnabledMismatchedRenderers;

private void Reset()
{
skipInitiallyDisabledRenderers = true;
skipEnabledMismatchedRenderers = true;
}

public MergeSkinnedMesh()
Expand Down

0 comments on commit 2a1c107

Please sign in to comment.