Beispiel #1
0
 /// <summary>
 /// Creates a controller and initializes the patch fields.
 /// </summary>
 public void InitializeEditor(ProcessingData data, bool isEditable)
 {
     _renderViewportReferenceRect = GetNode <ReferenceRect>("RenderViewportReferenceRect");
     Sfc2dEditorControl           = new Sfc2dEditorControl(_renderViewportReferenceRect, data, isEditable);
     Connect("resized", this, nameof(MarkForResizeOffsetRestore));
     _currentScale = new Vector2(1f, 1f);
 }
 /// <summary>
 /// Updates the visible nodes according to the given step type.
 /// </summary>
 public void UpdateStep(PatchEntity data, Sfc2dEditorControl context)
 {
     if (data.SfcStepType != _currentStepType || _stepNode == null)
     {
         ShowStepAs(data.SfcStepType);
         _currentStepType = data.SfcStepType;
     }
     _stepNode.SetEditorText(data.StepName, context);
 }
        /// <summary>
        /// Displays the text as a multi line string in the editor if possible.
        /// </summary>
        public override void SetEditorText(string text, Sfc2dEditorControl context)
        {
            TextEdit node = GetNode <TextEdit>("StepNameEditor");

            node.Text = text;
            bool  validReference = context.Data.StepMaster.ContainsStep(text);
            Color background     = validReference ? new Color(1, 0, 0, 0f) : new Color(1, 0, 0, 0.2f);

            node.AddColorOverride("background_color", background);
        }
        /// <summary>
        /// Constructor. It will add the patch to the 2d editor.
        /// </summary>
        public SfcPatchControl(PatchEntity data, Sfc2dEditorControl control, bool isEditable)
        {
            Data         = data;
            Master       = control;
            SfcPatchMeta = new SfcPatchMeta();
            Node node = ((PackedScene)GD.Load(_patchReferencePath)).Instance();

            SfcPatchNode = (SfcPatchNode)node;
            SfcPatchNode.InitializeWith(this, data, isEditable);
            control.ReferenceRect.AddChild(SfcPatchNode);
        }
Beispiel #5
0
 /// <summary>
 /// Called when the model has changed or is initialized.
 /// </summary>
 public void UpdateTransition(string transitionText, Sfc2dEditorControl contex)
 {
     if (_textEdit != null)
     {
         TransitionMaster.UpdateColorKeys(_textEdit, contex.Data);
         _textEdit.Text = transitionText;
         UpdateVisualRepresentation();
         if (!string.IsNullOrEmpty(transitionText))
         {
             BooleanExpression expression = TransitionMaster.InterpretTransitionText(transitionText, contex.Data);
             _textEdit.HintTooltip = expression == null ? "???" : expression.ToString();
             bool  validExpression = expression != null && expression.IsValid();
             Color background      = validExpression ? new Color(1, 0, 0, 0f) : new Color(1, 0, 0, 0.2f);
             _textEdit.AddColorOverride("background_color", background);
         }
     }
 }
Beispiel #6
0
 /// <summary>
 /// Displays the text as a multi line string in the editor if possible.
 /// </summary>
 public override void SetEditorText(string text, Sfc2dEditorControl context)
 {
     GetNode <TextEdit>("StepNameEditor").Text = text;
 }
 /// <summary>
 /// Displays the text as a multi line string in the editor if possible.
 /// </summary>
 public virtual void SetEditorText(string text, Sfc2dEditorControl context)
 {
 }