Example #1
0
        private void UpdateMetaInput()
        {
            var opPartDefinition = BasicMetaTypes.GetMetaOperatorPartOf((FunctionType)TypeComboBox.SelectedIndex);

            _metaInput.Name         = NameTextBox.Text;
            _metaInput.OpPart       = opPartDefinition;
            _metaInput.DefaultValue = _defaultValue;
            _metaInput.IsMultiInput = IsMultiInputComboBox.SelectedIndex == 1 ? true : false;

            OperatorPart newOpPart = _metaInput.CreateInstance();

            if (_operatorPart.Type != newOpPart.Type)
            {
                _operatorPart.Type = newOpPart.Type;
                _operatorPart.Func = newOpPart.Func;
            }
            if (_operatorPart.Name != newOpPart.Name)
            {
                _operatorPart.Name = newOpPart.Name;
            }

            if (_operatorPart.IsMultiInput != newOpPart.IsMultiInput)
            {
                _operatorPart.IsMultiInput = newOpPart.IsMultiInput;
            }

            App.Current.UpdateRequiredAfterUserInteraction = true;
        }
        private void AddRestoredInputToMetaOp()
        {
            var metaOp        = MetaManager.Instance.GetMetaOperator(_metaOpID);
            var restoredInput = new MetaInput(_metaInputID, _metaInputName, BasicMetaTypes.GetMetaOperatorPartOf(_metaOpPartType), _metaInputDefaultValue, _metaInputIsMultiInput)
            {
                Relevance = _metaInputRelevance
            };

            metaOp.InsertInput(_metaInputIndex, restoredInput);
        }
Example #3
0
        private void UpdateMetaOutput()
        {
            var opPartDefinition = BasicMetaTypes.GetMetaOperatorPartOf((FunctionType)TypeComboBox.SelectedIndex);

            var metaOutput = _operator.GetMetaOutput(_operatorPart);

            metaOutput.Name   = NameTextBox.Text;
            metaOutput.OpPart = opPartDefinition;

            _operator.Definition.RemoveOutput(metaOutput.ID);
            _operator.Definition.InsertOutput(_outputIndex, metaOutput);
            _operatorPart = _operator.Outputs[_outputIndex];
        }
Example #4
0
        private void TypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SetDefaultValue();

            int idx           = _operator.Inputs.IndexOf(_operatorPart);
            var removeCommand = new RemoveInputCommand(_operator, _operatorPart);

            _metaInput.OpPart = BasicMetaTypes.GetMetaOperatorPartOf((FunctionType)TypeComboBox.SelectedIndex);

            // set default value
            switch ((FunctionType)TypeComboBox.SelectedIndex)
            {
            case FunctionType.Float:
                _defaultValue = new Float(0.0f);
                break;

            case FunctionType.Text:
                _defaultValue = new Text(String.Empty);
                break;

            case FunctionType.Scene:
                _defaultValue = new Core.Scene();
                break;

            case FunctionType.Generic:
                _defaultValue = new Generic();
                break;

            case FunctionType.Dynamic:
                _defaultValue = new Dynamic();
                break;

            case FunctionType.Mesh:
                _defaultValue = new Core.MeshValue();
                break;

            default:
                Logger.Error("InputParameterView.TypeComboBox_SelectionChanged: Unknown 'FunctionType' with value {0}", TypeComboBox.SelectedIndex);
                break;
            }
            _metaInput.DefaultValue = _defaultValue;
            var command = new AddInputCommand(_operator, _metaInput);

            ICommand[] commands = { removeCommand, command };

            App.Current.UndoRedoStack.AddAndExecute(new MacroCommand("Changed Input Type", commands));
            App.Current.UpdateRequiredAfterUserInteraction = true;
        }
Example #5
0
        private void ApplyEntryToInput(Entry entry)
        {
            MetaInput inputToUpdate = GetInputToUpdate();

            inputToUpdate.OpPart       = BasicMetaTypes.GetMetaOperatorPartOf(entry.FunctionType);
            inputToUpdate.Name         = entry.Name;
            inputToUpdate.DefaultValue = entry.DefaultValue;
            inputToUpdate.Relevance    = entry.Relevance;
            inputToUpdate.IsMultiInput = entry.IsMultiInput;

            if (entry.FunctionType == FunctionType.Float)
            {
                ApplyFloatEntriesToInput(entry);
            }

            MetaOp.UpdateInput(inputToUpdate);
        }