|
12 | 12 | using UnityEngine; |
13 | 13 | using VSwift.Modules.Components; |
14 | 14 | using VSwift.Modules.Data; |
| 15 | +using VSwift.Modules.Extensions; |
15 | 16 | using VSwift.Modules.Logging; |
16 | 17 | using VSwift.Modules.Reverters; |
17 | 18 | using VSwift.Modules.Transformers; |
@@ -53,20 +54,27 @@ public override void OnInitialize() |
53 | 54 | private void HandleInOabInitialization() |
54 | 55 | { |
55 | 56 | _dataPartSwitch!.VariantSets.Aggregate(0, HandleVariantSetInOab); |
56 | | - ApplyInOab(true); |
57 | 57 | foreach (var predefinedNode in _dataPartSwitch.PredefinedDynamicNodes.Where(predefinedNode => OABPart.FindNodeWithTag(predefinedNode.nodeID) == null)) |
58 | 58 | { |
59 | | - OABPart.AddDynamicNode(OABPart, new ObjectAssemblyAvailablePartNode( |
60 | | - predefinedNode.size, |
61 | | - predefinedNode.position, |
62 | | - Quaternion.LookRotation(predefinedNode.orientation,Vector3.up), |
63 | | - predefinedNode.nodeID, |
64 | | - null, |
65 | | - predefinedNode.size, |
66 | | - AttachNodeType.Stack, |
67 | | - true |
68 | | - )); |
| 59 | + if (OABPart.FindNodeWithTag(predefinedNode.nodeID) is { } node) |
| 60 | + { |
| 61 | + OABPart.FixedSetNodeLocalPosition(node, predefinedNode.position); |
| 62 | + } |
| 63 | + else |
| 64 | + { |
| 65 | + OABPart.AddDynamicNode(OABPart, new ObjectAssemblyAvailablePartNode( |
| 66 | + predefinedNode.size, |
| 67 | + predefinedNode.position, |
| 68 | + Quaternion.LookRotation(predefinedNode.orientation, Vector3.up), |
| 69 | + predefinedNode.nodeID, |
| 70 | + null, |
| 71 | + predefinedNode.size, |
| 72 | + AttachNodeType.Stack, |
| 73 | + true |
| 74 | + )); |
| 75 | + } |
69 | 76 | } |
| 77 | + ApplyInOab(true); |
70 | 78 | } |
71 | 79 |
|
72 | 80 | private int HandleVariantSetInOab(int j, VariantSet variantSet) |
@@ -240,12 +248,21 @@ public void QueueUpdateColors() |
240 | 248 |
|
241 | 249 | private IEnumerator UpdateColors() |
242 | 250 | { |
243 | | - yield return new WaitForEndOfFrame(); |
244 | | - yield return new WaitForEndOfFrame(); |
245 | | - yield return new WaitForEndOfFrame(); |
246 | | - if (OABPart.TryGetModule(out Module_Color moduleColor)) |
| 251 | + yield return new WaitForSeconds(0.5f); |
| 252 | + if (PartBackingMode == PartBackingModes.OAB) |
247 | 253 | { |
248 | | - moduleColor.RefreshColors(); |
| 254 | + |
| 255 | + if (OABPart.TryGetModule(out Module_Color moduleColor)) |
| 256 | + { |
| 257 | + moduleColor.RefreshColors(); |
| 258 | + } |
| 259 | + } |
| 260 | + else |
| 261 | + { |
| 262 | + if (part.GetModule<Module_Color>() is { } moduleColor) |
| 263 | + { |
| 264 | + moduleColor.RefreshColors(); |
| 265 | + } |
249 | 266 | } |
250 | 267 | } |
251 | 268 |
|
|
0 commit comments