コード例 #1
0
 public void RemoveTransformationAt(int index)
 {
     Undo.RecordObjects(new Object[] { this, animation }, "Remove Transformation at " + index);
     SelectedFrame.DestroyTransformer(index);
     InvalidateOutputMeshes();
     selectedTransformationIndex = -1;
 }
コード例 #2
0
    public void SelectTransformation(int transformationIndex, bool noUndoRecord = false)
    {
        hiddenBonesMask = 0;
        if (currentTool == Tool.NONE)
        {
            SetCurrentTool(Tool.NONE);
        }
        if (!noUndoRecord)
        {
            Undo.RecordObjects(new Object[] { this }, "Select Transformation");
        }
        if (selectedTransformationIndex < 0)
        {
            selectedTransformationIndex += Transformers.Length;
        }
        if (selectedTransformationIndex >= Transformers.Length)
        {
            selectedTransformationIndex -= Transformers.Length;
        }
        selectedTransformationIndex = transformationIndex;

        if (SelectedFrame != null)
        {
            SelectedFrame.FixStuff();
        }
        // InvalidateOutputMeshes();
//        SceneView.RepaintAll();

        FireOnMeshChange();
    }
コード例 #3
0
    public void ProcessInvalidations(bool force = false)
    {
        if (force || (invalidationRequestedAt > 0 && EditorApplication.timeSinceStartup - invalidationRequestedAt > 0.1f))
        {
            frame = null;
            invalidationRequestedAt = 0;
            if (invalidatedTransformation != null)
            {
                if (editorModelFactorySource == invalidatedTransformation as NPVoxIModelFactory)
                {
                    EditorModelFactory.Invalidate();
                }

                SelectedFrame.InvalidateTransformation(invalidatedTransformation);
                invalidatedTransformation = null;
            }
            if (ModelMarker != null)
            {
                ModelMarker.Invalidate();
            }
            PreviewMeshOutput.Invalidate();
            invalidatePreviewMeshFactories();
            FireOnMeshChange();
        }
        else
        {
            if (invalidationRequestedAt > 0)
            {
                if (OnCheckForInvalidation != null)
                {
                    OnCheckForInvalidation();
                }
            }
        }
    }
コード例 #4
0
    public void SetPreviewFactoryForTargetSocket(string targetSocketName, NPVoxIMeshFactory meshFactory)
    {
        Undo.RecordObjects(new Object[] { this, animation }, "set preview socket factory enabled");
        NPVoxSocketAttachment p = SelectedFrame.GetPreviewAttachmentForTargetSocket(targetSocketName, true);

        p.meshFactory = meshFactory as NPVoxMeshOutput;
        wipePreviewMeshFactories(targetSocketName);
    }
コード例 #5
0
    public void SetPreviewSocketEnabled(string targetSocketName, bool val)
    {
        Undo.RecordObjects(new Object[] { this, animation }, "set preview socket enabled");
        NPVoxSocketAttachment p = SelectedFrame.GetPreviewAttachmentForTargetSocket(targetSocketName, true);

        p.visible = val;
        FireOnMeshChange();
    }
コード例 #6
0
    public void SetSourceSocketForTargetSocket(string targetSocketName, string sourceSocketName)
    {
        Undo.RecordObjects(new Object[] { this, animation }, "set preview source socket");
        NPVoxSocketAttachment p = SelectedFrame.GetPreviewAttachmentForTargetSocket(targetSocketName, true);

        p.sourceSocketName = sourceSocketName;
        FireOnMeshChange();
    }
コード例 #7
0
        private void dataGridStarted_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            dynamic Sissue = dataGridStarted.SelectedItem;

            id = Sissue.IssueId;

            SelectedFrame.Navigate(typeof(SelectedItemView), id);
            id = -1;
        }
コード例 #8
0
    public NPVoxIMeshFactory GetPreviewFactoryForTargetSocket(string targetSocketName)
    {
        NPVoxSocketAttachment p = SelectedFrame.GetPreviewAttachmentForTargetSocket(targetSocketName, false);

        if (p != null)
        {
            return(p.meshFactory);
        }
        return(null);
    }
コード例 #9
0
    public void AddSkeletonTransformer()
    {
        Undo.RecordObjects(new Object[] { this, animation }, "Add Skeleton Transformer");

        NPVoxSkeletonTransformer transformer = (NPVoxSkeletonTransformer)NPVoxSocketTransformer.CreateInstance(typeof(NPVoxSkeletonTransformer));
        int index = SelectedFrame.AddTransformerAt(transformer, selectedTransformationIndex);

        InvalidateOutputMeshes();
        SelectTransformation(index, true);
    }
コード例 #10
0
    public void AddTransformer(System.Type type)
    {
        Undo.RecordObjects(new Object[] { this, animation }, "Add Misc Transformer ");

        NPVoxCompositeProcessorBase <NPVoxIModelFactory, NPVoxModel> transformer = UnityEngine.ScriptableObject.CreateInstance(type) as NPVoxCompositeProcessorBase <NPVoxIModelFactory, NPVoxModel>;
        int index = SelectedFrame.AddTransformerAt(transformer, selectedTransformationIndex);

        InvalidateOutputMeshes();
        SelectTransformation(index, true);
    }
コード例 #11
0
    public string GetSourceSocketForTargetSocket(string targetSocketName)
    {
        NPVoxSocketAttachment p = SelectedFrame.GetPreviewAttachmentForTargetSocket(targetSocketName, false);

        if (p != null)
        {
            return(p.sourceSocketName);
        }
        return(null);
    }
コード例 #12
0
        private void SetDelayItem_Click(object sender, EventArgs e)
        {
            StringInputForm frm = new StringInputForm("Set Frame Delay");

            frm.Input   = SelectedFrame.Delay.ToString();
            frm.NumOnly = true;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                SelectedFrame.Delay = short.Parse(frm.Input);
            }
            SelectedFrame.Refresh();
        }
コード例 #13
0
    public NPVoxIMeshFactory GetSocketPreviewMeshFactoryForCurrentFrame(string targetSocketName)
    {
        NPVoxSocketAttachment p = SelectedFrame.GetPreviewAttachmentForTargetSocket(targetSocketName);

        if (this.selectedFrameIndex < 0 || p == null)
        {
            return(null);
        }

        NPVoxIModelFactory modelFactory = GetPreviewModelFactoryForTargetSocket(targetSocketName);

        string inputSocketName = p.sourceSocketName;

        if (p.outputMeshFactory == null)
        {
            NPVoxIMeshFactory meshFactory = GetPreviewFactoryForTargetSocket(targetSocketName);

            if (meshFactory == null)
            {
                return(null);
            }

            NPVoxModelSocketCombiner combiner = NPVoxModelCombiner.CreateInstance <NPVoxModelSocketCombiner>();
            combiner.Input                 = modelFactory;
            combiner.InputSocketName       = inputSocketName;
            combiner.TargetSocketName      = targetSocketName;
            combiner.ResolveConflictMethod = NPVoxModelTransformationUtil.ResolveConflictMethodType.FILL_GAPS;
            combiner.Target                = (UnityEngine.Object)SelectedFrame.PreOutput.Input;
            combiner.StorageMode           = NPipeStorageMode.MEMORY;

            NPVoxMeshOutput previewFactory = (NPVoxMeshOutput)meshFactory.Clone();
            previewFactory.StorageMode = NPipeStorageMode.MEMORY;
            previewFactory.Input       = combiner;

            p.outputMeshFactory = previewFactory;
        }
        else
        {
            NPVoxModelSocketCombiner combiner = ((NPVoxModelSocketCombiner)((NPVoxMeshOutput)p.outputMeshFactory).Input);
            // check if something changed in the meanwhipe
            if (combiner.Target != TotalModelFactory as UnityEngine.Object || combiner.InputSocketName != inputSocketName)
            {
                p.outputMeshFactory.Invalidate();
                combiner.Target          = (UnityEngine.Object)TotalModelFactory;
                combiner.InputSocketName = inputSocketName;
                combiner.Invalidate();
            }
        }

        return(p.outputMeshFactory);
    }
コード例 #14
0
    //======================================================================================================================================
    // Tools
    //======================================================================================================================================

    public void AddMirrorTransformators()
    {
        Undo.RecordObjects(new Object[] { this, animation }, "Add Mirror Transformations ");
        NPVoxModelFlipper transformer;

        // flip
        transformer       = (NPVoxModelFlipper)NPVoxModelTransformer.CreateInstance(typeof(NPVoxModelFlipper));
        transformer.XAxis = new NPVoxCoord(-1, 0, 0);
        SelectedFrame.PrependTransformer(transformer);

        // flip back
        transformer       = (NPVoxModelFlipper)NPVoxModelTransformer.CreateInstance(typeof(NPVoxModelFlipper));
        transformer.XAxis = new NPVoxCoord(-1, 0, 0);
        SelectedFrame.AppendTransformer(transformer);

        InvalidateOutputMeshes();
    }
コード例 #15
0
    public void MoveTransformation(int transformationIndex, int deltaIndex)
    {
        if (SelectedFrame == null)
        {
            Debug.LogError("No Frame selected");
            return;
        }

        Undo.RecordObjects(new Object[] { this, animation }, "Move Transformation " + transformationIndex + " Up");
        SelectedFrame.MoveTransformer(transformationIndex, deltaIndex);
        EditorUtility.SetDirty(animation);

        if (selectedTransformationIndex == transformationIndex)
        {
            SelectTransformation(transformationIndex + deltaIndex, true);
        }
        else if (selectedTransformationIndex > -1)
        {
            SelectTransformation(-1, true);
        }
    }
コード例 #16
0
        private void ScrollPanelItem_Selected(object sender, bool e)
        {
            if (sender is ScrollPanelItem scrollPanelItem)
            {
                if (e == true)
                {
                    if (Keyboard.Modifiers != ModifierKeys.Shift)
                    {
                        foreach (UIElement uIElement in this.FrameStack.Children)
                        {
                            if (uIElement != sender && uIElement is ScrollPanelItem panelItem)
                            {
                                panelItem.IsSelected = false;
                            }
                        }
                    }
                }

                SelectedFrame?.Invoke(scrollPanelItem.cadObject, e);
            }
        }
コード例 #17
0
        public void Add(bool Clear, GCCollection Objects, string Filepath, bool show = true)
        {
            if (Clear)
            {
                Dispatcher.Invoke(() =>
                {
                    FrameStack.Children.Clear();
                });
            }
            CadObjectsGroup cadObjectsGroup = new CadObjectsGroup(Objects, Filepath.Split('\\').Last());

            foreach (ScrollPanelItem panelItem in this.FrameStack.Children)
            {
                if (panelItem.FileName == Filepath.Split('\\').Last())
                {
                    panelItem.DataContext = cadObjectsGroup;
                    if (panelItem.IsSelected == true)
                    {
                        SelectedFrame?.Invoke(panelItem.cadObject, true);
                    }
                    return;
                }
            }

            ScrollPanelItem scrollPanelItem = new ScrollPanelItem(cadObjectsGroup, Filepath);

            scrollPanelItem.Selected += ScrollPanelItem_Selected;
            scrollPanelItem.Removed  += ScrollPanelItem_Removed;
            Dispatcher.Invoke(() =>
            {
                this.FrameStack.Children.Add(scrollPanelItem);
                if (show == true)
                {
                    scrollPanelItem.IsSelected = true;
                }
            });
        }
コード例 #18
0
    public void AddTransformation(NPVoxCompositeProcessorBase <NPVoxIModelFactory, NPVoxModel> template = null)
    {
        Undo.RecordObjects(new Object[] { this, animation }, "Add Transformation ");
        NPVoxCompositeProcessorBase <NPVoxIModelFactory, NPVoxModel> transformer;

        if (template != null)
        {
            transformer = (NPVoxCompositeProcessorBase <NPVoxIModelFactory, NPVoxModel>)template.Clone();
        }
        else
        {
            transformer = (NPVoxModelTransformer)NPVoxModelTransformer.CreateInstance(typeof(NPVoxModelTransformer));
            if (this.CurrentModelFactory != null && ((NPVoxModelTransformer)transformer))
            {
                NPVoxModel model = this.CurrentModelFactory.GetProduct();
                UnityEngine.Assertions.Assert.IsNotNull(model);
                ((NPVoxModelTransformer)transformer).AffectedArea = NPVoxBox.FromCenterSize(model.BoundingBox.RoundedCenter, new NPVoxCoord(3, 3, 3));
            }
        }
        SelectedFrame.AppendTransformer(transformer);
        InvalidateOutputMeshes();
        SelectTransformation(Transformers.Length - 1, true);
        this.SetCurrentTool(Tool.AREA);
    }
コード例 #19
0
    public void SelectFrame(int frameIndex, bool noUndoRecord = false)
    {
        if (!noUndoRecord)
        {
            Undo.RecordObjects(new Object[] { this }, "Select Frame");
        }
        if (frameIndex < 0)
        {
            frameIndex += Frames.Length;
        }
        if (frameIndex >= Frames.Length)
        {
            frameIndex -= Frames.Length;
        }
        selectedFrameIndex = frameIndex;
        if (SelectedFrame != null)
        {
            SelectedFrame.FixStuff();
        }
        // InvalidateOutputMeshes();
        selectedTransformationIndex = -1;

        FireOnMeshChange();
    }
コード例 #20
0
    public bool GetPreviewSocketEnabled(string targetSocketName)
    {
        NPVoxSocketAttachment p = SelectedFrame.GetPreviewAttachmentForTargetSocket(targetSocketName, false);

        return(p == null || p.visible);
    }