Ejemplo n.º 1
0
 public CoreOperator(Verkstan.CoreOperator coreOperator)
     : base()
 {
     this.bindedCoreOperator = coreOperator;
     isProcessable = coreOperator.GetNumberOfRequiredInputs() == 0;
     UniqueName = AllocateUniqueName(TypeName);
     inputs = new List<Operator>();
 }
Ejemplo n.º 2
0
 private int AddByteProperty(Verkstan.OperatorBindingProperty property, int row)
 {
     int index = property.Index;
     NumericUpDown numericUpDown = new NumericUpDown();
     numericUpDown.Margin = new Padding(0, 1, 0, 1);
     numericUpDown.Increment = 1;
     numericUpDown.Minimum = 0;
     numericUpDown.Maximum = 255;
     numericUpDown.Value = (int)op.GetByteProperty(index);
     numericUpDown.Width = 50;
     numericUpDown.ValueChanged += new EventHandler((object o, EventArgs e) => op.SetByteProperty(index, (byte)numericUpDown.Value));
     tableLayoutPanel1.Controls.Add(numericUpDown);
     tableLayoutPanel1.SetCellPosition(numericUpDown, new TableLayoutPanelCellPosition(1, row));
     return row + 1;
 }
Ejemplo n.º 3
0
        private int AddAnimationButton(Verkstan.CoreOperatorProperty property, int row)
        {
            Button button = new Button();
            button.Text = "A";
            button.Width = 1;
            button.AutoSize = true;
            button.Margin = new Padding(1, 1, 1, 1);
            button.BackColor = Color.LightGray;
            tableLayoutPanel1.Controls.Add(button);
            tableLayoutPanel1.SetCellPosition(button, new TableLayoutPanelCellPosition(2, row));
            Verkstan.CoreOperatorProperty prop = property;
            Operator oper = op;
            if (property.Type == Verkstan.Constants.OperatorPropertyTypes.Byte
                || property.Type == Verkstan.Constants.OperatorPropertyTypes.Int
                || property.Type == Verkstan.Constants.OperatorPropertyTypes.Float)
            {
                OperatorPropertyAnimationSettings animationSettings = new OperatorPropertyAnimationSettings();
                animationSettings.AutoSize = true;
                animationSettings.Visible = false;
                animationSettings.Channel = op.GetPropertyChannel(prop.Index, 0);
                animationSettings.Amplify = op.GetPropertyAmplify(prop.Index, 0);
                animationSettings.SettingsChanged += delegate(object o, EventArgs e)
                {
                    oper.SetPropertyChannel(prop.Index, 0, animationSettings.Channel);
                    oper.SetPropertyAmplify(prop.Index, 0, animationSettings.Amplify);
                };
                tableLayoutPanel1.Controls.Add(animationSettings);
                tableLayoutPanel1.SetCellPosition(animationSettings, new TableLayoutPanelCellPosition(1, row + 1));

                button.Click += delegate(object o, EventArgs e)
                {
                    animationSettings.Visible = !animationSettings.Visible;
                };
                row = row + 1;
            }

            if (property.Type == Verkstan.Constants.OperatorPropertyTypes.Color
                || property.Type == Verkstan.Constants.OperatorPropertyTypes.Vector)
            {
                OperatorPropertyAnimationSettings animationSettings1 = new OperatorPropertyAnimationSettings();
                animationSettings1.AutoSize = true;
                animationSettings1.Visible = false;
                animationSettings1.Channel = op.GetPropertyChannel(prop.Index, 0);
                animationSettings1.Amplify = op.GetPropertyAmplify(prop.Index, 0);
                animationSettings1.SettingsChanged += delegate(object o, EventArgs e)
                {
                    oper.SetPropertyChannel(prop.Index, 0, animationSettings1.Channel);
                    oper.SetPropertyAmplify(prop.Index, 0, animationSettings1.Amplify);
                };
                tableLayoutPanel1.Controls.Add(animationSettings1);
                tableLayoutPanel1.SetCellPosition(animationSettings1, new TableLayoutPanelCellPosition(1, row + 1));
                OperatorPropertyAnimationSettings animationSettings2 = new OperatorPropertyAnimationSettings();
                animationSettings2.AutoSize = true;
                animationSettings2.Visible = false;
                animationSettings2.Channel = op.GetPropertyChannel(prop.Index, 1);
                animationSettings2.Amplify = op.GetPropertyAmplify(prop.Index, 1);
                animationSettings2.SettingsChanged += delegate(object o, EventArgs e)
                {
                    oper.SetPropertyChannel(prop.Index, 1, animationSettings2.Channel);
                    oper.SetPropertyAmplify(prop.Index, 1, animationSettings2.Amplify);
                };
                tableLayoutPanel1.Controls.Add(animationSettings2);
                tableLayoutPanel1.SetCellPosition(animationSettings2, new TableLayoutPanelCellPosition(1, row + 2));
                OperatorPropertyAnimationSettings animationSettings3 = new OperatorPropertyAnimationSettings();
                animationSettings3.AutoSize = true;
                animationSettings3.Visible = false;
                animationSettings3.Channel = op.GetPropertyChannel(prop.Index, 2);
                animationSettings3.Amplify = op.GetPropertyAmplify(prop.Index, 2);
                animationSettings3.SettingsChanged += delegate(object o, EventArgs e)
                {
                    oper.SetPropertyChannel(prop.Index, 2, animationSettings3.Channel);
                    oper.SetPropertyAmplify(prop.Index, 2, animationSettings3.Amplify);
                };
                tableLayoutPanel1.Controls.Add(animationSettings3);
                tableLayoutPanel1.SetCellPosition(animationSettings3, new TableLayoutPanelCellPosition(1, row + 3));
                button.Click += delegate(object o, EventArgs e)
                {
                    tableLayoutPanel1.SuspendLayout();
                    animationSettings1.Visible = !animationSettings1.Visible;
                    animationSettings2.Visible = !animationSettings2.Visible;
                    animationSettings3.Visible = !animationSettings3.Visible;
                    tableLayoutPanel1.ResumeLayout();
                };
                row = row + 3;
            }

            return row + 1;
        }
Ejemplo n.º 4
0
        private int AddVectorProperty(Verkstan.CoreOperatorProperty property, int row)
        {
            int index = property.Index;
            VectorProperty vectorProperty = new VectorProperty();
            vectorProperty.Margin = new Padding(0, 1, 0, 1);
            Verkstan.Vector vector = op.GetVectorProperty(index);
            vectorProperty.X = vector.X;
            vectorProperty.Y = vector.Y;
            vectorProperty.Z = vector.Z;
            vectorProperty.ValueChanged += delegate(object o, EventArgs e)
            {
                op.SetVectorProperty(index, new Verkstan.Vector(vectorProperty.X, vectorProperty.Y, vectorProperty.Z));
            };

            tableLayoutPanel1.Controls.Add(vectorProperty);
            tableLayoutPanel1.SetCellPosition(vectorProperty, new TableLayoutPanelCellPosition(1, row));
            row = AddAnimationButton(property, row);
            return row + 1;
        }
Ejemplo n.º 5
0
 private int AddTextProperty(Verkstan.CoreOperatorProperty property, int row)
 {
     int index = property.Index;
     TextBox textBox = new TextBox();
     textBox.Margin = new Padding(0, 1, 0, 1);
     textBox.AcceptsReturn = true;
     textBox.AcceptsTab = true;
     textBox.Multiline = true;
     textBox.Height = 200;
     textBox.WordWrap = true;
     textBox.Dock = DockStyle.Fill;
     textBox.Text = op.GetStringProperty(index);
     textBox.TextChanged += new EventHandler((object o, EventArgs e) => op.SetStringProperty(index, textBox.Text));
     tableLayoutPanel1.Controls.Add(textBox);
     tableLayoutPanel1.SetCellPosition(textBox, new TableLayoutPanelCellPosition(1, row));
     return row + 1;
 }
Ejemplo n.º 6
0
 private int AddIntProperty(Verkstan.CoreOperatorProperty property, int row)
 {
     int index = property.Index;
     NumericUpDown numericUpDown = new NumericUpDown();
     numericUpDown.Margin = new Padding(0, 1, 0, 1);
     numericUpDown.Increment = 1;
     numericUpDown.Minimum = int.MinValue;
     numericUpDown.Maximum = int.MaxValue;
     numericUpDown.Value = op.GetIntProperty(index);
     numericUpDown.Width = 100;
     numericUpDown.ValueChanged += new EventHandler((object o, EventArgs e) => op.SetIntProperty(index, (int)numericUpDown.Value));
     tableLayoutPanel1.Controls.Add(numericUpDown);
     tableLayoutPanel1.SetCellPosition(numericUpDown, new TableLayoutPanelCellPosition(1, row));
     row = AddAnimationButton(property, row);
     return row + 1;
 }
Ejemplo n.º 7
0
 private int AddFloatProperty(Verkstan.CoreOperatorProperty property, int row)
 {
     int index = property.Index;
     NumericUpDown numericUpDown = new NumericUpDown();
     numericUpDown.Margin = new Padding(0, 1, 0, 1);
     numericUpDown.Increment = 0.001M;
     numericUpDown.DecimalPlaces = 3;
     numericUpDown.Minimum = decimal.MinValue;
     numericUpDown.Maximum = decimal.MaxValue;
     numericUpDown.Value = Convert.ToDecimal(op.GetFloatProperty(index));
     numericUpDown.Width = 100;
     numericUpDown.ValueChanged += new EventHandler((object o, EventArgs e) => op.SetFloatProperty(index, Convert.ToSingle(numericUpDown.Value)));
     tableLayoutPanel1.Controls.Add(numericUpDown);
     tableLayoutPanel1.SetCellPosition(numericUpDown, new TableLayoutPanelCellPosition(1, row));
     row = AddAnimationButton(property, row);
     return row + 1;
 }
Ejemplo n.º 8
0
        private int AddEnumProperty(Verkstan.CoreOperatorProperty property, int row)
        {
            int index = property.Index;
            List<String> enumValues = property.EnumValues;
            ComboBox comboBox = new ComboBox();
            comboBox.Margin = new Padding(0, 1, 0, 1);
            comboBox.DropDownStyle = ComboBoxStyle.DropDownList;

            foreach (String value in enumValues)
                comboBox.Items.Add(value);

            int enumValueIndex = op.GetByteProperty(index);
            comboBox.Text = enumValues[enumValueIndex];

            comboBox.SelectedValueChanged += delegate(object o, EventArgs e)
            {
                op.SetByteProperty(index, (byte)comboBox.SelectedIndex);
            };

            tableLayoutPanel1.Controls.Add(comboBox);
            tableLayoutPanel1.SetCellPosition(comboBox, new TableLayoutPanelCellPosition(1, row));
            return row + 1;
        }
Ejemplo n.º 9
0
        private int AddColorProperty(Verkstan.CoreOperatorProperty property, int row)
        {
            int index = property.Index;
            ColorProperty colorProperty = new ColorProperty();
            colorProperty.Margin = new Padding(0, 1, 0, 1);
            colorProperty.Color = op.GetColorProperty(index);
            colorProperty.ColorChanged += delegate(object o, EventArgs e)
            {
                op.SetColorProperty(index, colorProperty.Color);
            };

            tableLayoutPanel1.Controls.Add(colorProperty);
            tableLayoutPanel1.SetCellPosition(colorProperty, new TableLayoutPanelCellPosition(1, row));
            row = AddAnimationButton(property, row);
            return row + 1;
        }
Ejemplo n.º 10
0
 public void SetVectorProperty(int index, Verkstan.Vector value)
 {
     BindedCoreOperator.SetVectorProperty(index, value);
 }
Ejemplo n.º 11
0
 public void SetBindedCoreClip(Verkstan.CoreClip bindedCoreClip)
 {
     this.bindedCoreClip = bindedCoreClip;
 }
Ejemplo n.º 12
0
 private static void AddToData(Verkstan.Vector v)
 {
     AddToData(v.X);
     AddToData(v.Y);
     AddToData(v.Z);
 }
Ejemplo n.º 13
0
 private int AddStringProperty(Verkstan.OperatorBindingProperty property, int row)
 {
     int index = property.Index;
     TextBox textBox = new TextBox();
     textBox.Margin = new Padding(0, 1, 0, 1);
     textBox.Dock = DockStyle.Fill;
     textBox.Text = op.GetStringProperty(index);
     textBox.TextChanged += new EventHandler((object o, EventArgs e) => op.SetStringProperty(index, textBox.Text));
     tableLayoutPanel1.Controls.Add(textBox);
     tableLayoutPanel1.SetCellPosition(textBox, new TableLayoutPanelCellPosition(1, row));
     return row + 1;
 }