Example #1
0
        public void Initialize(NodeData data)
        {
            Name     = data.Name;
            ID       = data.ID;
            Position = data.Position;

            InputPins.Clear();  // TEMP!
            OutputPins.Clear(); // TEMP!
            OnInitialize();
        }
        protected override void OnSourceVariableChanged()
        {
            OutputPins.Clear();

            Name = "Get " + SourceVariable.Name;

            COutputPin output = new COutputPin(SourceVariable.Name, SourceVariable.Type);

            OutputPins.Add(output);
        }
        protected override void OnSourceVariableChanged()
        {
            OutputPins.Clear();
            InputPins.Clear();

            Name = "Set " + SourceVariable.Name;

            CInputPin input = new CInputPin(SourceVariable.Name, SourceVariable.Type);

            InputPins.Add(input);

            COutputPin output = new COutputPin("NewValue", SourceVariable.Type);

            OutputPins.Add(output);
        }
Example #4
0
        protected override void OnTargetFieldChanged()
        {
            if (TargetField == null)
            {
                throw new NullReferenceException("Target Field cannot be null as this would make the node invalid");
            }
            InputPins.Clear();
            OutputPins.Clear();

            CInputPin targetObjectInput = new CInputPin("Target", TargetField.DeclaringType);

            InputPins.Add(targetObjectInput);

            Name = "Get " + TargetField.Name;

            COutputPin outputPin = new COutputPin(TargetField.Name, TargetField.FieldType);

            OutputPins.Add(outputPin);
        }
Example #5
0
        protected override void OnTargetPropertyChanged()
        {
            if (TargetProperty == null)
            {
                throw new NullReferenceException("Target Property cannot be null as this would make the node invalid");
            }
            InputPins.Clear();
            OutputPins.Clear();

            Name = "Set " + TargetProperty.Name;

            CInputPin targetObjectInput = new CInputPin("Target", TargetProperty.DeclaringType);

            InputPins.Add(targetObjectInput);

            CInputPin setValueInput = new CInputPin("Value", TargetProperty.PropertyType);

            InputPins.Add(setValueInput);

            COutputPin newValueOutput = new COutputPin("NewValue", TargetProperty.PropertyType);

            OutputPins.Add(newValueOutput);
        }
        public void Load(WorkAreaSerialization ser)
        {
            #region Clear

            ConnectionList.Clear();
            GateList.Clear();

            InputPins.Clear();
            OutputPins.Clear();

            SelectedInputPin  = null;
            SelectedOutputPin = null;

            #endregion

            foreach (WorkAreaSerialization.GateModelWithCoordinates g in ser.GateList)
            {
                AddGate(new GateViewModelWithCoordinates(new GateViewModel(g.gate), g.X, g.Y));
            }

            GatesLoaded();

            RestoreConnections();
        }
        private void OnTargetMethodChanged()
        {
            OutputPins.Clear();
            InputPins.Clear();

            CKlaxScriptRegistry registry = CKlaxScriptRegistry.Instance;

            registry.TryGetFunctionInfo(TargetMethod, out CKlaxScriptFunctionInfo outFunctionInfo);

            Name = outFunctionInfo.displayName;

            if (TargetMethod.ReturnType != typeof(void))
            {
                COutputPin returnOutput = new COutputPin()
                {
                    Name = "Return",
                    Type = TargetMethod.ReturnType,
                };
                OutputPins.Add(returnOutput);
            }

            if (!TargetMethod.IsStatic)
            {
                CInputPin targetObjectInput = new CInputPin()
                {
                    Name                 = "Target",
                    Type                 = TargetMethod.DeclaringType,
                    Literal              = null,
                    SourceNode           = null,
                    SourceParameterIndex = -1,
                    StackIndex           = -1,
                };
                InputPins.Add(targetObjectInput);
            }

            ParameterInfo[] methodParameters = TargetMethod.GetParameters();
            for (var index = 0; index < methodParameters.Length; index++)
            {
                ParameterInfo parameter   = methodParameters[index];
                Type          elementType = parameter.ParameterType;
                if (parameter.ParameterType.IsByRef)
                {
                    elementType = parameter.ParameterType.GetElementType();
                    if (!parameter.IsIn)
                    {
                        m_additionalReturns.Add(index);
                        COutputPin output = new COutputPin()
                        {
                            Name = parameter.Name,
                            Type = elementType,
                        };
                        OutputPins.Add(output);
                    }
                }

                if (parameter.IsOut)
                {
                    continue;
                }

                CInputPin input = new CInputPin()
                {
                    Name                 = outFunctionInfo.inputParameterNames[index],
                    Type                 = elementType,
                    SourceNode           = null,
                    SourceParameterIndex = -1,
                    StackIndex           = -1,
                };

                input.Literal = input.Type.IsValueType ? Activator.CreateInstance(input.Type) : null;
                InputPins.Add(input);

                m_functionProxy = new SKlaxScriptFunctionProxy(outFunctionInfo);
            }
        }