Skip to content

Commit

Permalink
Merge branch 'master' into warn-smr-animations
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 authored Nov 5, 2023
2 parents 0c974ee + e423fff commit 4c768e4
Show file tree
Hide file tree
Showing 53 changed files with 1,426 additions and 232 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions .docs/content/docs/reference/remove-zero-sized-polygon/index.ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: Remove Zero Sized Polygon
weight: 100
---

# Remove Zero Sized Polygon

面積がゼロのポリゴンを削除します。

このコンポーネントは、SkinnedMeshRendererコンポーネントのあるGameObjectに追加してください。

{{< hint warning >}}

このコンポーネントはビルドの最後の方で実行されるため、[Modifying Edit Skinned Mesh Component](../../component-kind/edit-skinned-mesh-components#modifying-component) では**ありません**

このコンポーネントを[Merge Skinned Mesh](../merge-skinned-mesh)の統合対象となるSkinnedMeshRendererに追加しても効果がありません。

{{< /hint >}}

## 利点 {#benefits}

面積がゼロのポリゴンを削除することで、描画負荷を減らすことができます。
見た目に影響を与えることはほとんどありません。

## 備考 {#notes}

モデルファイルでのポリゴンの大きさがゼロであっても、シェーダーによって何かを描画していることがあるため、見た目に影響が出ることがあります。

## 設定 {#settings}

今のところ、このコンポーネントに設定項目はありません。

![component.png](component.png)

## 備考 {#notes}

このコンポーネントは[Trace and Optimize](../trace-and-optimize)コンポーネントによって自動的に追加されます。
このコンポーネントを手動で追加するよりも、Trace and Optimizeを使うことをお勧めします。
39 changes: 39 additions & 0 deletions .docs/content/docs/reference/remove-zero-sized-polygon/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Remove Zero Sized Polygon
weight: 100
---

# Remove Zero Sized Polygon

Remove polygons whose area are zero.

This component should be added to a GameObject which has a SkinnedMeshRenderer component.

{{< hint warning >}}

Since this component works very late in the build process, this component is **NOT** [Modifying Edit Skinned Mesh Component](../../component-kind/edit-skinned-mesh-components#modifying-component).

Adding this component to the SkinnedMeshRenderers to be merged by [Merge Skinned Mesh](../merge-skinned-mesh) component has no effect.

{{< /hint >}}

## Benefits

By removing polygons whose area are zero, you can reduce rendering cost.
This will have almost zero effect on the appearance.

## Notes

In some shaders, even if size of polygon in model file is zero, something can be rendered so
there may be effect on the appearance.

## Settings

This Component doesn't have any configuration for now.

![component.png](component.png)

## Notes

This component will be added by [Trace and Optimize](../trace-and-optimize) component.
I recommend you to use Trace and Optimize instead of adding this component manually.
Binary file modified .docs/content/docs/reference/trace-and-optimize/component.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions .docs/content/docs/reference/trace-and-optimize/index.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ aliases:
アニメーションなどを走査して、使われていないObject(GameObjectやコンポーネントなど)を自動的に削除します。
- `endボーンを残す`
親が削除されていないendボーン[^endbone]を削除しないようにします。
- `面積がゼロのポリゴンを自動的に削除する`
面積がゼロのポリゴンを削除します。

また、以下の設定で自動設定を調節できます。
- `MMDワールドとの互換性`
Expand Down
2 changes: 2 additions & 0 deletions .docs/content/docs/reference/trace-and-optimize/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Currently the following optimizations are applied automatically.
By scanning animation etc., automatically removes unused Objects (e.g. GameObjects, Components).
- `Preserve EndBone`
Prevents removing end bones[^endbone] whose parent is not removed.
- `Automatically Remove Zero Sized Polygons`
Removes polygons whose area are zero.

Also, You can adjust optimization with the following settings
- `MMD World Compatibility`
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ jobs:
hugo-version: '0.111.3'
extended: true

- name: Check release is public
if: github.event.inputs.release_kind == 'stable'
run:
if [[ "$(jq '.private == true' < package.json)" == "true" ]]; then
echo "package.json is private"
exit 255
fi

- name: Update Version Name
id: update-version
run: |
Expand Down
53 changes: 46 additions & 7 deletions API-Editor/ComponentInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internal sealed override void CollectMutationsInternal(Component component,
ComponentMutationsCollector collector) =>
CollectMutations((TComponent)component, collector);

internal override void ApplySpecialMappingInternal(Component component, MappingSource collector) =>
internal sealed override void ApplySpecialMappingInternal(Component component, MappingSource collector) =>
ApplySpecialMapping((TComponent)component, collector);

/// <summary>
Expand Down Expand Up @@ -207,23 +207,51 @@ internal ComponentMutationsCollector()
{
}

/// <summary>
/// Registers <paramref name="properties"/> of the <paramref name="component"/> will be changed by current component.
/// </summary>
/// <param name="component">The component current component will modifies</param>
/// <param name="properties">The list of properties current component will modifies</param>
[PublicAPI]
public abstract void ModifyProperties([NotNull] Component component, [NotNull] IEnumerable<string> properties);
public abstract void ModifyProperties([NotNull] Component component,
[NotNull] [ItemNotNull] IEnumerable<string> properties);

/// <inheritdoc cref="ModifyProperties(UnityEngine.Component,System.Collections.Generic.IEnumerable{string})"/>
[PublicAPI]
public void ModifyProperties([NotNull] Component component, [NotNull] string[] properties) =>
ModifyProperties(component, (IEnumerable<string>) properties);
public void ModifyProperties([NotNull] Component component,
[NotNull] [ItemNotNull] params string[] properties) =>
ModifyProperties(component, (IEnumerable<string>)properties);
}

/// <summary>
/// The class provides object and property replaced by Avatar Optimizer.
///
/// Avatar Optimizer may replaces or merges component to another component.
/// This class provide the information about the replacement.
/// In addition, Avatar Optimizer may replace or merges some properties of the component.
/// This class also provide the information about the property replacement.
/// </summary>
public abstract class MappingSource
{
internal MappingSource()
{
}

/// <summary>
/// Returns <see cref="MappedComponentInfo{T}"/> about the component instance.
/// The instance can be a missing component.
/// </summary>
/// <param name="component">The component to get information about</param>
/// <typeparam name="T">The type of component</typeparam>
[PublicAPI]
public abstract MappedComponentInfo<T> GetMappedComponent<T>(T component) where T : Component;

/// <summary>
/// Returns <see cref="MappedComponentInfo{T}"/> about the GameObject instance.
/// The instance can be a missing component.
/// </summary>
/// <param name="component">The component to get information about</param>
/// <typeparam name="T">The type of component</typeparam>
[PublicAPI]
public abstract MappedComponentInfo<GameObject> GetMappedGameObject(GameObject component);
}
Expand All @@ -237,10 +265,11 @@ internal MappedComponentInfo()
/// <summary>
/// The mapped component (or GameObject).
/// The component may be removed without mapped component.
/// If there are not mapped component, this will be null.
/// If there are no mapped component, this will be null.
///
/// Even if the component is removed without mapped component,
/// each animation property can be mapped to another component.
/// Even if the component is removed without mapped component, some animation property can be mapped
/// to a property on another component so you should use <see cref="TryMapProperty"/> if the component is highly related
/// to animation property, for example, blendShape related SkinnedMeshRenderer.
/// </summary>
[PublicAPI]
public abstract T MappedComponent { get; }
Expand All @@ -249,6 +278,10 @@ internal MappedComponentInfo()
/// Maps animation property name to component and MappedPropertyInfo.
/// If the property is not removed, returns true and <paramref name="found"/> is set.
/// If the property is removed, returns false and <paramref name="found"/> will be default.
///
/// To get mapped property probably, you must register the property as modified property by
/// <see cref="ComponentMutationsCollector.ModifyProperties(UnityEngine.Component,System.Collections.Generic.IEnumerable{string})"/>.
/// Unless that, renaming or moving the property may not be tracked by Avatar Optimizer.
/// </summary>
/// <param name="property">The name of property will be mapped</param>
/// <param name="found">The result parameter</param>
Expand All @@ -259,9 +292,15 @@ internal MappedComponentInfo()

public readonly struct MappedPropertyInfo
{
/// <summary>
/// The Component or GameObject the property is on.
/// </summary>
[PublicAPI]
public Object Component { get; }

/// <summary>
/// The name of the mapped property.
/// </summary>
[PublicAPI]
public string Property { get; }

Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The format is based on [Keep a Changelog].

## [Unreleased]
### Added
- Remove Zero Sized Polygons `#659`
- Add support for UniVRM components `#653`
- Support for Mesh Topologies other than Triangles `#692`

### Changed
- When you're animating activeness/enablement of source renderers, warning is shown since this release `#675`
Expand All @@ -17,6 +20,7 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- proxy animation can be modified `#678`

### Security

Expand All @@ -40,6 +44,10 @@ The format is based on [Keep a Changelog].
- Prefab blinks when we see editor of PrefabSafeSet of prefab asset [`#645`](https://github.com/anatawa12/AvatarOptimizer/pull/645) [`#664`](https://github.com/anatawa12/AvatarOptimizer/pull/664)
- Fixes in 1.5.9 [`#654`](https://github.com/anatawa12/AvatarOptimizer/pull/654)

## [1.5.10] - 2023-11-04
### Fixed
- RigidBody Joint can be broken [`#683`](https://github.com/anatawa12/AvatarOptimizer/pull/683)

## [1.5.9] - 2023-10-29
## [1.5.9-rc.1] - 2023-10-28
### Fixed
Expand Down Expand Up @@ -976,7 +984,8 @@ This release is mistake.

[Unreleased]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.6.0-beta.2...HEAD
[1.6.0-beta.2]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.6.0-beta.1...v1.6.0-beta.2
[1.6.0-beta.1]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.9...v1.6.0-beta.1
[1.6.0-beta.1]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.10...v1.6.0-beta.1
[1.5.10]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.9...v1.5.10
[1.5.9]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.9-rc.1...v1.5.9
[1.5.9-rc.1]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.8...v1.5.9-rc.1
[1.5.8]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.8-rc.1...v1.5.8
Expand Down
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ The format is based on [Keep a Changelog].

## [Unreleased]
### Added
- Public API for registering component information `#632`
- Public API for registering component information `#632` `#668`
- Disabling PhysBone animation based on mesh renderer enabled animation `#640`
- If you toggles your clothes with simple toggle, PhysBones on the your avatar will also be toggled automatically!
- Small performance improve `#641`
- Ability to prevent changing enablement of component `#668`
- Remove Zero Sized Polygons `#659`
- Add support for UniVRM components `#653`
- Support for Mesh Topologies other than Triangles `#692`

### Changed
- All logs passed to ErrorReport is now shown on the console log `#643`
- Improved Behaviour with multi-material multi pass rendering `#662`
- Previously, multi-material multi pass rendering are flattened.
- Since 1.6, flattened if component doesn't support that.
- BREAKING API CHANGES: Behaviour components are renamed to HeavyBehaviour `#668`
- When you're animating activeness/enablement of source renderers, warning is shown since this release `#675`

### Deprecated
Expand All @@ -36,6 +38,10 @@ The format is based on [Keep a Changelog].

### Security

## [1.5.10] - 2023-11-04
### Fixed
- RigidBody Joint can be broken [`#683`](https://github.com/anatawa12/AvatarOptimizer/pull/683)

## [1.5.9] - 2023-10-29
### Fixed
- Animation clip length can be changed [`#647`](https://github.com/anatawa12/AvatarOptimizer/pull/647)
Expand Down Expand Up @@ -641,7 +647,8 @@ The format is based on [Keep a Changelog].
- Merge Bone
- Clear Endpoint Position

[Unreleased]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.9...HEAD
[Unreleased]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.10...HEAD
[1.5.10]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.9...v1.5.10
[1.5.9]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.8...v1.5.9
[1.5.8]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.7...v1.5.8
[1.5.7]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.6...v1.5.7
Expand Down
2 changes: 1 addition & 1 deletion Editor/APIInternal/ComponentInfos.VRCSDK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected override void CollectMutations(T component, ComponentMutationsCollecto
case VRC_AvatarDescriptor.LipSyncStyle.JawFlapBlendShape when component.VisemeSkinnedMesh != null:
{
collector.ModifyProperties(component.VisemeSkinnedMesh,
new[] { $"blendShape.{component.MouthOpenBlendShapeName}" });
$"blendShape.{component.MouthOpenBlendShapeName}");
break;
}
case VRC_AvatarDescriptor.LipSyncStyle.VisemeBlendShape when component.VisemeSkinnedMesh != null:
Expand Down
Loading

0 comments on commit 4c768e4

Please sign in to comment.