tooll3 / t3

Tooll 3 is an open source software to create realtime motion graphics.
MIT License
3.48k stars 193 forks source link

Exception after changing input type of c# operator on MAIN #480

Open pixtur opened 1 month ago

pixtur commented 1 month ago

Describe the bug After

Please complete the following information):

To Reproduce There might be simpler methods to reproduce this issue:

  1. Create [Modulo]
  2. Duplicate as new type [IntModulo]
  3. In Rider open IntModulo.cs
  4. Change type of inputs and outputs from float to int
  5. Change GUIDs for inputs and outputs
  6. Save cs file

-> T3 fails to run after loading the new type.

    public Symbol.Child.Input Input
    {
        get => _input;
        set
        {
            _input = value;
            TypedInputValue = (InputValue<T>)value.Value;
            TypedDefaultValue = (InputValue<T>)value.DefaultValue;  // <-- CAST EXCEPTION

            if (_input.IsDefault && TypedDefaultValue.IsEditableInputReferenceType)
            {
                TypedInputValue.AssignClone(TypedDefaultValue);
            }
        }
    }
System.InvalidCastException: Unable to cast object of type 'T3.Core.Operator.Slots.InputValue`1[System.Single]' to type 'T3.Core.Operator.Slots.InputValue`1[System.Int32]'.
   at T3.Core.Operator.Slots.InputSlot`1.set_Input(Input value) in C:\Users\pixtur\dev\tooll\t3-main\Core\Operator\Slots\InputSlot.cs:line 40
   at T3.Core.Operator.SymbolInstantiation.TryCreateNewInstance(Child symbolChild, Instance parentInstance, Instance& newInstance) in C:\Users\pixtur\dev\tooll\t3-main\Core\Operator\Symbol.Child.Instantiation.cs:line 55
   at T3.Core.Operator.SymbolInstantiation.<TryCreateNewInstance>g__TryCreateInstance|0_0(Instance parent, Child symbolChild, Instance& newInstance, String& reason) in C:\Users\pixtur\dev\tooll\t3-main\Core\Operator\Symbol.Child.Instantiation.cs:line 128
   at T3.Core.Operator.SymbolInstantiation.TryCreateNewInstance(Child symbolChild, Instance parentInstance, Instance& newInstance) in C:\Users\pixtur\dev\tooll\t3-main\Core\Operator\Symbol.Child.Instantiation.cs:line 15
   at T3.Core.Operator.SymbolInstantiation.<TryCreateNewInstance>g__TryCreateInstance|0_0(Instance parent, Child symbolChild, Instance& newInstance, String& reason) in C:\Users\pixtur\dev\tooll\t3-main\Core\Operator\Symbol.Child.Instantiation.cs:line 128
   at T3.Core.Operator.SymbolInstantiation.TryCreateNewInstance(Child symbolChild, Instance parentInstance, Instance& newInstance) in C:\Users\pixtur\dev\tooll\t3-main\Core\Operator\Symbol.Child.Instantiation.cs:line 15
   at T3.Core.Operator.Symbol.UpdateInstanceType() in C:\Users\pixtur\dev\tooll\t3-main\Core\Operator\Symbol.TypeUpdating.cs:line 47
   at T3.Core.Model.SymbolPackage.UpdateSymbolInstances(Symbol symbol) in C:\Users\pixtur\dev\tooll\t3-main\Core\Model\SymbolPackage.cs:line 279
   at T3.Core.Model.SymbolPackage.LoadSymbols(Boolean parallel, List`1& newlyRead, List`1& allNewSymbols) in C:\Users\pixtur\dev\tooll\t3-main\Core\Model\SymbolPackage.cs:line 173
   at T3.Editor.Compilation.ProjectSetup.UpdateSymbolPackages(PackageWithReleaseInfo[] packages)
   at T3.Editor.Compilation.ProjectSetup.UpdateSymbolPackage[T](T project)
   at T3.Editor.UiModel.EditableSymbolProject.RecompileChangedProjects(Boolean async)
   at T3.Editor.Gui.WindowsUiContentDrawer.RenderCallback()
   at T3.Editor.App.AppWindow.<>c__DisplayClass38_0.<RunRenderLoop>b__0()
   at SharpDX.Windows.RenderLoop.Run(Control form, RenderCallback renderCallback, Boolean useApplicationDoEvents)
   at T3.Editor.App.AppWindow.RunRenderLoop(Action callback)
   at T3.Editor.Program.Main(String[] args)
pixtur commented 1 month ago

This exception appeared also after deleting an input node from a graph.