Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge pb config and merge config #105

Merged
merged 35 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8846c93
chore: remove merged property which is nonsense
anatawa12 Apr 20, 2023
4d81604
feat: initial commit for new MergePhysBone Editor
anatawa12 Apr 20, 2023
f8b1a0e
chore: revert removing SerializedProperties
anatawa12 Apr 21, 2023
d9bd5fb
chore: use cached SerializedProperty
anatawa12 Apr 21, 2023
b212d38
chore: do not show override settings if there's no source physbones
anatawa12 Apr 21, 2023
ac7ace2
chore: select Spring / Momentum+Stiffness based on integrationType
anatawa12 Apr 21, 2023
a3af2f1
fix: always value of merged is shown
anatawa12 Apr 21, 2023
aaaf6ef
chore: implement new editor for Limits
anatawa12 Apr 21, 2023
a124d67
chore: extract to function
anatawa12 Apr 21, 2023
a321e71
chore: implement new gui for Collision, Grab & Pose, and Others
anatawa12 Apr 21, 2023
16ef38f
chore: show error for each property
anatawa12 Apr 21, 2023
d101763
chore: reimplement CollectDifferentProps with hasMultipleDifferentValues
anatawa12 Apr 21, 2023
1cddef5
chore: fix Collider Property
anatawa12 Apr 21, 2023
a80cf3c
fix: missing immobileType
anatawa12 Apr 21, 2023
0068ee6
chore: add more around Options
anatawa12 Apr 21, 2023
75b4526
Revert "chore: remove merged property which is nonsense"
anatawa12 Apr 21, 2023
29064a9
chore: hide merged property
anatawa12 Apr 21, 2023
792b4cf
chore: add component on we added MergePhysBone component
anatawa12 Apr 21, 2023
75f1624
fix: missing immobileType
anatawa12 Apr 21, 2023
43b0439
feat: migrate immobileType field
anatawa12 Apr 21, 2023
43ed880
chore: do not see forces in pull, gravity and immobile
anatawa12 Apr 21, 2023
a1b3caf
chore: rename forces to integrationType
anatawa12 Apr 21, 2023
6b61a32
chore: set HideInInspector more
anatawa12 Apr 21, 2023
4b98e2b
chore: migrate force -> integrationType
anatawa12 Apr 21, 2023
b5f69e5
chore: show backend PhysBone
anatawa12 Apr 21, 2023
04f9f63
chore: add Transform section
anatawa12 Apr 21, 2023
c984d03
chore: move HorizontalLine to Utils.HorizontalLin
anatawa12 Apr 21, 2023
04320e6
chore: move components to top and add horizontal separator
anatawa12 Apr 21, 2023
283057a
fix: we cannot use AddComponent in OnValidate
anatawa12 Apr 21, 2023
24e5cb0
chore: mark dirty
anatawa12 Apr 21, 2023
8f2b2ff
chore: minimize toggle size
anatawa12 Apr 21, 2023
a12a896
docs(changelog): add changelog about #105
anatawa12 Apr 21, 2023
729927f
chore: change way to merge / draw editor
anatawa12 Apr 21, 2023
a08c33a
Merge branch 'master' into merge-pb-config-and-merge-config
anatawa12 Apr 21, 2023
520b87f
docs(readme): update about Merge PhysBone
anatawa12 Apr 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .readme/merge-physbone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ The format is based on [Keep a Changelog].
- **BREAKING** Dropped support for VRCSDK 3.1.12 or older `#101`
- Now, we require VRCSDK since 3.1.13 (including) until 3.2.0 (excluding)
- Use IEditorOnly instead of mokeypatching VRCSDK `#102`
- Move the toggle for Override and the setting of the value after Override closer together. `#105`
- With this changes, the merged PhysBone is now hidden.
- The merged PhysBone will be shown in Play mode.
- Now we can Copy (instead of Override) `Pull`, `Gravity`, `Immobile` properties even if `Integration Type` is overriden. `#105`
- During migration, if `Integration Type` (previously called `Force`) is configured to be Override, `Pull`, `Gravity`, `Immobile` will be configured to be Override.
- This is **BREAKING** changes.
- Now we can Copy / Override `Immobile Type` and `Immobile` (strength) separately. `#105`
- Previously, if you override `Immobile Type`, you also required to override `Immobile` but no longer required.
- This is **BREAKING** changes in the semantics of `immobile` property.

[about-root-transform]: https://github.com/anatawa12/AvatarOptimizer/issues/62#issuecomment-1512586282

Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ The format is based on [Keep a Changelog].
- **BREAKING** Dropped support for VRCSDK 3.1.12 or older `#101`
- Now, we require VRCSDK since 3.1.13 (including) until 3.2.0 (excluding)
- Use IEditorOnly instead of mokeypatching VRCSDK `#102`
- Move the toggle for Override and the setting of the value after Override closer together. `#105`
- With this changes, the merged PhysBone is now hidden.
- The merged PhysBone will be shown in Play mode.
- Now we can Copy (instead of Override) `Pull`, `Gravity`, `Immobile` properties even if `Integration Type` is overriden. `#105`
- During migration, if `Integration Type` (previously called `Force`) is configured to be Override, `Pull`, `Gravity`, `Immobile` will be configured to be Override.
- This is **BREAKING** changes.
- Now we can Copy / Override `Immobile Type` and `Immobile` (strength) separately. `#105`
- Previously, if you override `Immobile Type`, you also required to override `Immobile` but no longer required.
- This is **BREAKING** changes in the semantics of `immobile` property.

[about-root-transform]: https://github.com/anatawa12/AvatarOptimizer/issues/62#issuecomment-1512586282

Expand Down
656 changes: 541 additions & 115 deletions Editor/MergePhysBoneEditor.cs

Large diffs are not rendered by default.

24 changes: 2 additions & 22 deletions Editor/MergeToonLitMaterialEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ protected override void OnInspectorGUIInner()
var preview = _generatedPreviews != null ? _generatedPreviews[i] : Utils.PreviewHereTex;
EditorGUILayout.LabelField(new GUIContent(preview), GUILayout.MaxHeight(256), GUILayout.MaxHeight(256));

HorizontalLine();
Utils.HorizontalLine();
},
_candidateMaterials.Length != 0 ? _createNewMergeInfo : null,
postButtons: () => HorizontalLine(),
postButtons: () => Utils.HorizontalLine(),
onMoved: OnChanged,
onAdded: _ => OnChanged(),
onRemoved: _ => OnChanged()
Expand All @@ -157,26 +157,6 @@ private void OnChanged(bool dirty)
_candidateNames = new []{""}.Concat(_candidateMaterials.Select(x => x.mat.name)).ToArray();
}

private void HorizontalLine(bool marginTop = true, bool marginBottom = true)
{
const float margin = 17f / 2;
var maxHeight = 1f;
if (marginTop) maxHeight += margin;
if (marginBottom) maxHeight += margin;

var rect = GUILayoutUtility.GetRect(
EditorGUIUtility.fieldWidth, float.MaxValue,
1, maxHeight, GUIStyle.none);
if (marginTop && marginBottom)
rect.y += rect.height / 2 - 0.5f;
else if (marginTop)
rect.y += rect.height - 1f;
else if (marginBottom)
rect.y += 0;
rect.height = 1;
EditorGUI.DrawRect(rect, new Color(0.5f, 0.5f, 0.5f, 1));
}

private void OnEnable()
{
var component = (MergeToonLitMaterial)target;
Expand Down
21 changes: 19 additions & 2 deletions Editor/Migration/Migration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,9 @@ SerializedProperty[] GetContainers()
{
// might be incompatible changes.
var parent = (Transform)root.objectReferenceValue;
var components = EditorUtil<VRCPhysBoneBase>.Create(serialized.FindProperty(nameof(MergePhysBone.componentsSet)), nestCount,
x => (VRCPhysBoneBase)x.objectReferenceValue, (x, y) => x.objectReferenceValue = y)
var components = EditorUtil<VRCPhysBoneBase>.Create(
serialized.FindProperty(nameof(MergePhysBone.componentsSet)), nestCount,
x => (VRCPhysBoneBase)x.objectReferenceValue, (x, y) => x.objectReferenceValue = y)
.Values.ToList();

if (components.Count != 0)
Expand All @@ -485,6 +486,22 @@ SerializedProperty[] GetContainers()
serialized.targetObject);
}
}

serialized.FindProperty(nameof(MergePhysBone.immobileType)).boolValue
= serialized.FindProperty(nameof(MergePhysBone.immobile)).boolValue;

// integrationType was previously force
if (serialized.FindProperty(nameof(MergePhysBone.integrationType)).boolValue)
{
serialized.FindProperty(nameof(MergePhysBone.pull)).boolValue = true;
// They are force overriden by integrationType so there's no need to override
//serialized.FindProperty(nameof(MergePhysBone.spring)).boolValue = true;
//serialized.FindProperty(nameof(MergePhysBone.stiffness)).boolValue = true;
serialized.FindProperty(nameof(MergePhysBone.gravity)).boolValue = true;
serialized.FindProperty(nameof(MergePhysBone.gravityFalloff)).boolValue = true;
serialized.FindProperty(nameof(MergePhysBone.immobileType)).boolValue = true;
serialized.FindProperty(nameof(MergePhysBone.immobile)).boolValue = true;
}
break;
}
}
Expand Down
Loading