Ejemplo n.º 1
0
    void Awake()
    {
        modalPanel     = ModelPanel.Instance();
        displayManager = DisplayManager.Instance();

        myYesAction    = new UnityAction(TestYesFunction);
        myNoAction     = new UnityAction(TestNoFunction);
        myCancelAction = new UnityAction(TestCancelFunction);
    }
Ejemplo n.º 2
0
 private void modelPanel_RenderVisBoneBoxChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating             = true;
         chkBBVisBones.Checked = value;
         _updating             = false;
     }
 }
Ejemplo n.º 3
0
 private void ModelPanel_UseBindStateBoxesChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating         = true;
         UseBindStateBoxes = value;
         _updating         = false;
     }
 }
Ejemplo n.º 4
0
 private void ModelPanel_RenderVerticesChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating           = true;
         chkVertices.Checked = toggleVertices.Checked = value;
         _updating           = false;
     }
 }
Ejemplo n.º 5
0
 private void ModelPanel_RenderWireframeChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating = true;
         wireframeToolStripMenuItem.Checked = value;
         _updating = false;
     }
 }
Ejemplo n.º 6
0
 private void ModelPanel_RenderPolygonsChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating           = true;
         chkPolygons.Checked = togglePolygons.Checked = value;
         _updating           = false;
     }
 }
Ejemplo n.º 7
0
 private void modelPanel_RenderBonesChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating           = true;
         toggleBones.Checked = chkBones.Checked = value;
         _updating           = false;
     }
 }
Ejemplo n.º 8
0
 private void modelPanel_FirstPersonCameraChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating = true;
         firstPersonCameraToolStripMenuItem.Checked = value;
         _updating = false;
     }
 }
Ejemplo n.º 9
0
 private void modelPanel_RenderOffscreenChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating           = true;
         DontRenderOffscreen = value;
         _updating           = false;
     }
 }
Ejemplo n.º 10
0
 private void ModelPanel_RenderMetalsChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating            = true;
         toggleMetals.Checked = value;
         _updating            = false;
     }
 }
Ejemplo n.º 11
0
 private void ModelPanel_ScaleBonesChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating = true;
         //scaleBonesToolStripMenuItem.Checked = value;
         _updating = false;
     }
 }
Ejemplo n.º 12
0
 private void modelPanel_RenderFloorChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating        = true;
         chkFloor.Checked = toggleFloor.Checked = value;
         _updating        = false;
     }
 }
Ejemplo n.º 13
0
 private void ModelPanel_ApplyBillboardBonesChanged(ModelPanel panel, bool value)
 {
     if (ModelPanel == panel && !_updating)
     {
         _updating = true;
         chkBillboardBones.Checked = value;
         _updating = false;
     }
 }
Ejemplo n.º 14
0
 private void ModelPanel_RenderShadersChanged(ModelPanel panel, bool value)
 {
     //Only update if the focused panel triggered the event
     if (ModelPanel == panel && !_updating)
     {
         _updating = true;
         shadersToolStripMenuItem.Checked = value;
         _updating = false;
     }
 }
Ejemplo n.º 15
0
        private bool HotkeyResetCamera()
        {
            if (Ctrl)
            {
                ModelPanel.ResetCamera();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 16
0
        public override void AppendTarget(IModel model)
        {
            if (!_targetModels.Contains(model))
            {
                _targetModels.Add(model);
            }

            ModelPanel.AddTarget(model, false);
            model.ResetToBindState();
        }
Ejemplo n.º 17
0
        private bool HotkeyRefreshReferences()
        {
            if (ModelPanel.Focused)
            {
                ModelPanel.RefreshReferences();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 18
0
        private bool HotkeyCaptureScreenshot()
        {
            if (ModelPanel.Focused)
            {
                SaveBitmap(ModelPanel.GetScreenshot(ModelPanel.ClientRectangle, false), ScreenCaptureFolder,
                           "." + ScreenCaptureType);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 19
0
        private bool HotkeyRenderDepthPressed()
        {
            if (ModelPanel.Focused && !_renderDepth)
            {
                _renderDepth = true;
                ModelPanel.Invalidate();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 20
0
    void Awake()
    {
        _GameState = GameObject.Find("GameFlow").GetComponent <GameState> ();


        modelPanel = ModelPanel.Instance();

        //		myYesAction = new UnityAction (ZombieYesFunction);
        //		myNoAction = new UnityAction (ZombieNoFunction);
        //		myCancelAction = new UnityAction (ZombieCancelFunction);
    }
Ejemplo n.º 21
0
        private bool HotkeyRenderDepthReleased()
        {
            if (ModelPanel.Focused && _renderDepth)
            {
                _renderDepth = false;
                ModelPanel.Invalidate();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 22
0
        public void Render(TKContext ctx, ModelPanel mainWindow)
        {
            GL.Disable(EnableCap.Lighting);
            GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Front);

            foreach (CollisionObject obj in _objects)
            {
                obj.Render(ctx);
            }
        }
Ejemplo n.º 23
0
    IEnumerator LoadObject(string path, string viewer)
    {
        AssetBundleCreateRequest bundle = AssetBundle.LoadFromFileAsync(path);

        yield return(bundle);

        AssetBundle myLoadedAssetBundle = bundle.assetBundle;

        if (myLoadedAssetBundle == null)
        {
            Debug.Log("Failed to load AssetBundle!");
            yield break;
        }

        var names = myLoadedAssetBundle.GetAllAssetNames();
        //  AssetBundleRequest request = myLoadedAssetBundle.LoadAsset();
        //yield return request;

        AssetBundleRequest objreq = myLoadedAssetBundle.LoadAssetAsync(names[0]);

        yield return(objreq);

        //obj.transform.position = new Vector3(0.08f, -2.345f, 297.54f);
        // obj.transform.Rotate(350.41f, 400f, 20f);
        // obj.transform.localScale = new Vector3(1.0518f, 0.998f, 1.1793f);

        if (viewer.Equals("model"))
        {
            LoadedModel = Instantiate((GameObject)objreq.asset, Model.transform);
            LoadedModel.transform.parent = Model.transform;
            LoadingPanal.SetActive(false);
            ProjectsPanal.SetActive(false);
            ModelPanel.SetActive(true);
            ModelView.SetActive(true);
        }
        else
        {
            if (PlaceOnPlane.AssatObj != null)
            {
                PlaceOnPlane.AssatObj = null;
            }
            PlaceOnPlane.AssatObj            = (GameObject)objreq.asset;
            Projects[projectIndex].LoadedObj = (GameObject)objreq.asset;
            Projects[projectIndex].isloaded  = true;
            LoadingPanal.SetActive(false);
            // ARCanvas.SetActive(true);
            ArSession.SetActive(true);
            ArModePanel.SetActive(true);
            ProjectsPanal.SetActive(false);
            ArExitpanel.SetActive(true);
        }
        myLoadedAssetBundle.Unload(false);
    }
Ejemplo n.º 24
0
    public static ModelPanel Instance()
    {
        if (!modalPanel)
        {
            modalPanel = FindObjectOfType(typeof(ModelPanel)) as ModelPanel;
            if (!modalPanel)
            {
                Debug.LogError("There needs to be one active ModalPanel script on a GameObject in your scene.");
            }
        }

        return(modalPanel);
    }
Ejemplo n.º 25
0
        public ElementPanel(ModelPanel modelPanel, PivotPosition position)
        {
            _modelPanel = modelPanel;
            Position = position;

            BackColor = Color.White;
            DragEnter += new DragEventHandler(onDragEnter);
            DragOver += new DragEventHandler(onDragOver);
            DragDrop += new DragEventHandler(onDragDrop);
            Paint += new PaintEventHandler(ElementPanel_Paint);
            AutoScroll = true;
            AllowDrop = true;
        }
Ejemplo n.º 26
0
        private bool HotkeyOverlays()
        {
            if (ModelPanel.Focused)
            {
                chkAllOverlays.Checked = !chkAllOverlays.Checked;
                chkItems.Checked       = chkAllOverlays.Checked;
                chkSpawns.Checked      = chkAllOverlays.Checked;
                chkBoundaries.Checked  = chkAllOverlays.Checked;
                ModelPanel.Invalidate();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 27
0
        protected virtual void modelPanel1_MouseUp(object sender, MouseEventArgs e)
        {
            if (_createdNewBone && SelectedBone != null)
            {
                SelectedBone.BindState = SelectedBone.FrameState;
                SelectedBone.RecalcBindState(false, false, false);
            }

            _createdNewBone = false;

            bool temp = TargetModel is MDL0Node;

            if (temp)
            {
                MDL0Node m = TargetModel as MDL0Node;
                m._dontUpdateMesh = false;
            }

            if (e.Button == MouseButtons.Left)
            {
                ModelPanel panel = sender as ModelPanel;

                panel.CurrentViewport.AllowSelection = true;

                if (_vertexSelection.IsMoving() && VertexLoc.HasValue)
                {
                    VertexChange(_selectedVertices);
                }

                if (_boneSelection.IsMoving() && SelectedBone != null)
                {
                    if (temp &&
                        CHR0Editor.chkUpdateBindPose.Checked &&
                        TargetAnimType == NW4RAnimType.CHR &&
                        CurrentFrame == 0 &&
                        SelectedBone != null)
                    {
                        SelectedBone.RecalcBindState(true, !CHR0Editor.chkMoveBoneOnly.Checked);
                        UpdateModel(TargetModel, CurrentFrame);
                    }

                    BoneChange(SelectedBone);
                }

                _boneSelection.ResetAll();
                _vertexSelection.ResetAll();
            }
        }
Ejemplo n.º 28
0
        public void SelectedPolygonChanged()
        {
            //We can't return here if the selected polygon is set to null.
            //If the target model is changed or the selected object is cleared,
            //things relying on the selected object must be updated to reflect that.
            //if (leftPanel.SelectedPolygon == null) return;

            //This sets the selected object index internally in the model.
            //This determines the target object for focus editing vertices, normals, etc in the viewer
            //If the selected object is set to null, the poly index will be set to -1 by IndexOf.
            //This means vertices, normals etc will be drawn for all objects, if enabled.
            _targetModel.SelectedObjectIndex = _targetModel.Objects.IndexOf(leftPanel.SelectedObject);

            //If this setting is enabled, we need to show the user what textures only this object uses.
            //If the polygon is set to null, all of the model's texture references will be shown.
            if (SyncTexturesToObjectList)
            {
                leftPanel.UpdateTextures();
            }

            //Update the VIS editor to show the entries for the selected object
            if (TargetAnimType == NW4RAnimType.VIS &&
                leftPanel.SelectedObject != null &&
                vis0Editor.listBox1.Items.Count != 0 &&
                leftPanel.SelectedObject is MDL0ObjectNode)
            {
                MDL0ObjectNode o = (MDL0ObjectNode)leftPanel.SelectedObject;

                int x = 0;
                foreach (object i in vis0Editor.listBox1.Items)
                {
                    if (o._drawCalls.Count > 0 && i.ToString() == o._drawCalls[0].VisibilityBone)
                    {
                        vis0Editor.listBox1.SelectedIndex = x;
                        break;
                    }

                    x++;
                }

                if (x == vis0Editor.listBox1.Items.Count)
                {
                    vis0Editor.listBox1.SelectedIndex = -1;
                }
            }

            ModelPanel.Invalidate();
        }
Ejemplo n.º 29
0
        private void MouseMoveTargetBone(
            ModelPanel panel,
            MouseEventArgs e,
            float depth,
            ModelPanelViewport v)
        {
            if (SelectedBone != null)
            {
                MouseMoveTarget(
                    panel, e, depth, v,
                    GetBoneWorldMtx(),
                    GetBoneInvWorldMtx(),
                    _boneSelection);
            }

            GetBone(panel, e, depth, v);
        }
Ejemplo n.º 30
0
    //Rewrites local json file to include new downloaded cloud model
    public void updateLocalJSON(ModelData modelData, ModelPanel modelPanel)
    {
        localModels.Models.Add(modelData);
        string jsonString = JsonUtility.ToJson(localModels); //Serialize json objects to json string

        File.WriteAllText(localJsonFilePath, jsonString);    //Save json file
        modelPanel.icon.texture = localIcon;                 //Show that model has been downloaded
        for (int i = 0; i < localScrollArea.childCount; i++) //Destroy old model panels
        {
            GameObject panel = localScrollArea.GetChild(i).gameObject;
            panel.SetActive(false); //Disabling it first is necessary, otherwise the layout group doesn't allow object to be deleted
            Destroy(panel);
        }
        rightTabClicked(); //Switch to local browser
        modelPanelsLoaded = false;
        readLocalJSON();   //Update local model browser
    }
Ejemplo n.º 31
0
        private void MouseMoveTargetVertex(
            ModelPanel panel,
            MouseEventArgs e,
            float depth,
            ModelPanelViewport v)
        {
            if (VertexLoc.HasValue /* && v._renderAttrib._renderVertices*/)
            {
                Vector3 center = VertexLoc.Value;
                MouseMoveTarget(
                    panel, e, depth, v,
                    Matrix.TranslationMatrix(center),
                    Matrix.TranslationMatrix(-center),
                    _vertexSelection);
            }

            GetVertex(panel, e, depth, v);
        }
Ejemplo n.º 32
0
        public void Init(ModelPanel modelPanel)
        {
            ModelPanel = modelPanel;
            ModelToRestrictionText();

        }