Skip to content
This repository was archived by the owner on Dec 27, 2025. It is now read-only.

Commit 7001eb5

Browse files
committed
Broken examples and cinemachine impulse support
1 parent 853f8e1 commit 7001eb5

21 files changed

+767
-16040
lines changed

Editor/TweenPlayer/Binding/EditorBinding.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Juce.TweenComponent.Utils;
22
using System;
3+
using UnityEditor;
34

45
namespace Juce.TweenComponent.Bindings
56
{
@@ -11,6 +12,8 @@ public class EditorBinding
1112
public Binding Binding { get; }
1213
public string[] BindableFields { get; set; } = Array.Empty<string>();
1314

15+
public SerializedProperty SerializedProperty { get; set; }
16+
1417
public EditorBinding(
1518
Type type,
1619
string name,

Editor/TweenPlayer/Components/EditorTweenPlayerComponent.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using System;
1+
using Juce.TweenComponent.Bindings;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Reflection;
25
using UnityEngine;
36

47
namespace Juce.TweenComponent
@@ -12,6 +15,8 @@ public class EditorTweenPlayerComponent
1215
public bool UseColorAsBackground { get; }
1316
public string Documentation { get; }
1417

18+
public List<EditorBinding> EditorBindings { get; private set; } = new List<EditorBinding>();
19+
1520
public EditorTweenPlayerComponent(
1621
Type type,
1722
string name,

Editor/TweenPlayer/Drawers/BindingDrawer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ EditorBinding editorBinding
4646
{
4747
editorBinding.Binding.Binded = false;
4848

49-
SerializedProperty serializedProperty = parentSerializedProperty.FindPropertyRelative(editorBinding.Name);
49+
editorBinding.SerializedProperty = parentSerializedProperty.FindPropertyRelative(editorBinding.Name);
5050

5151
EditorGUILayout.BeginHorizontal();
5252
{
@@ -62,7 +62,7 @@ EditorBinding editorBinding
6262

6363
EditorGUILayout.Space();
6464

65-
SerializedPropertyUtils.DrawSerializedPropertyChildren(serializedProperty, showNames: false);
65+
SerializedPropertyUtils.DrawSerializedPropertyChildren(editorBinding.SerializedProperty, showNames: false);
6666
}
6767
GUILayout.FlexibleSpace();
6868
EditorGUILayout.EndHorizontal();

Editor/TweenPlayer/Drawers/ComponentDrawer.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,6 @@ public static void Draw(
2020
int componentIndex
2121
)
2222
{
23-
List<FieldInfo> fields = ReflectionUtils.GetFields(component.GetType(), typeof(Binding));
24-
25-
List<EditorBinding> componentEditorBindings = new List<EditorBinding>();
26-
27-
foreach (FieldInfo field in fields)
28-
{
29-
Binding bindingInstance = (Binding)field.GetValue(component);
30-
31-
componentEditorBindings.Add(new EditorBinding(
32-
bindingInstance.BindingType,
33-
field.Name,
34-
bindingInstance
35-
));
36-
}
37-
3823
bool found = EditorComponentUtils.TryGetCachedEditorPlayerComponent(
3924
editor,
4025
component.GetType(),
@@ -46,6 +31,22 @@ out EditorTweenPlayerComponent editorPlayerComponent
4631
return;
4732
}
4833

34+
if (editorPlayerComponent.EditorBindings.Count == 0)
35+
{
36+
List<FieldInfo> fields = ReflectionUtils.GetFields(component.GetType(), typeof(Binding));
37+
38+
foreach (FieldInfo field in fields)
39+
{
40+
Binding bindingInstance = (Binding)field.GetValue(component);
41+
42+
editorPlayerComponent.EditorBindings.Add(new EditorBinding(
43+
bindingInstance.BindingType,
44+
field.Name,
45+
bindingInstance
46+
));
47+
}
48+
}
49+
4950
bool hasColor = editorPlayerComponent.Color.a > 0.0f;
5051

5152
Color lastColor = GUI.backgroundColor;
@@ -113,7 +114,7 @@ out Rect reorderColorRect
113114

114115
ValidateComponentEditorBindings(
115116
editor.SerializedPropertiesData.BindingEnabledProperty.boolValue,
116-
componentEditorBindings,
117+
editorPlayerComponent.EditorBindings,
117118
validationBuilder
118119
);
119120

@@ -129,7 +130,7 @@ out Rect reorderColorRect
129130
EditorGUILayout.Space();
130131
}
131132

132-
foreach (EditorBinding editorBinding in componentEditorBindings)
133+
foreach (EditorBinding editorBinding in editorPlayerComponent.EditorBindings)
133134
{
134135
UpdateBindingDataLogic.Execute(
135136
editor,

0 commit comments

Comments
 (0)