Skip to content

Commit

Permalink
Merge pull request #996 from anatawa12/rollback-constraint-activeness…
Browse files Browse the repository at this point in the history
…-optimization

fix: rollback constraint activeness optimization
  • Loading branch information
anatawa12 authored Apr 9, 2024
2 parents e992ccf + 23f153e commit 961924c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The format is based on [Keep a Changelog].
### Deprecated

### Removed
- Activeness Optimization for Constraint component `#996`
- The constraint component is too complex to optimize correctly and reliably

### Fixed

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The format is based on [Keep a Changelog].
### Deprecated

### Removed
- Activeness Optimization for Constraint component `#996`
- The constraint component is too complex to optimize correctly and reliably

### Fixed

Expand Down
16 changes: 9 additions & 7 deletions Editor/APIInternal/ComponentInfos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,17 @@ protected override void CollectDependency(T component, ComponentDependencyCollec
.EvenIfDependantDisabled();
for (var i = 0; i < component.sourceCount; i++)
collector.AddDependency(component.GetSource(i).sourceTransform);
var isNestedConstraint =
component.GetComponentsInChildren<IConstraint>() != null &&
component.GetComponentsInParent<IConstraint>() != null;
//var isNestedConstraint =
// component.GetComponentsInChildren<IConstraint>() != null &&
// component.GetComponentsInParent<IConstraint>() != null;
// for nested constraint, our optimizer may breaks the constraint
// https://github.com/anatawa12/AvatarOptimizer/issues/856
if (isNestedConstraint)
collector.MarkBehaviour();
else
collector.MarkHeavyBehaviour();
//if (isNestedConstraint)
// collector.MarkBehaviour();
//else
// collector.MarkHeavyBehaviour();
// It's too buggy. the Constraint is too complex.
collector.MarkBehaviour();
}
}

Expand Down

0 comments on commit 961924c

Please sign in to comment.