From 20c1a07b76c39462594aedfedfe6e6adb17cd552 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Wed, 01 May 2019 14:27:01 -0400 Subject: [PATCH] Fix animation and fast mode. --- ObjEditor.java | 2 +- CameraPane.java | 18 +++++++++++------- GroupEditor.java | 22 +++++++--------------- ParticleNode.java | 2 ++ Mocap.java | 5 +++-- Wav.java | 2 +- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/CameraPane.java b/CameraPane.java index f5d934c..15994b6 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -56,8 +56,6 @@ static int CURRENTANTIALIAS = 0; // 1; /*static*/ boolean RENDERSHADOW = true; /*static*/ int RENDERPROGRAM = 2; // 0 == none, 1 == fast, 2 == normal - static boolean ANIMATION = false; - static String filename; boolean DISPLAYTEXT = false; //boolean REDUCETEXTURE = true; @@ -86,7 +84,7 @@ static boolean FULLSCREEN = false; static boolean SUPPORT = true; static boolean INERTIA = true; -static boolean FAST = true; // false; +static boolean FAST = false; static boolean SLOWPOSE = false; static boolean FOOTCONTACT = true; @@ -9395,7 +9393,7 @@ //gl.glFlush(); gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE); - if (ANIMATION && ABORTED) + if (Globals.ANIMATION && ABORTED) { System.err.println(" ABORTED FRAME"); break; @@ -9425,7 +9423,7 @@ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); // save image - if (ANIMATION && !ABORTED) + if (Globals.ANIMATION && !ABORTED) { VPwidth = viewport[2]; VPheight = viewport[3]; @@ -9536,7 +9534,7 @@ // imagecount++; - String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; + String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; if (!BOXMODE) { @@ -11260,8 +11258,14 @@ { renderpass++; // System.out.println("Draw object... "); + STEP = 1; if (FAST) // in case there is no script - STEP = 16; + STEP = 8; + + if (CURRENTANTIALIAS == 0 || ACSIZE == 1) + { + STEP *= 4; + } //object.FullInvariants(); diff --git a/GroupEditor.java b/GroupEditor.java index 93258aa..9679b9d 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -440,6 +440,10 @@ liveCB.setToolTipText("Enabled animation"); liveCB.addItemListener(this); + oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints); + fastCB.setToolTipText("Fast mode"); + fastCB.addItemListener(this); + oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints); trackCB.setToolTipText("Enable tracking"); trackCB.addItemListener(this); @@ -587,39 +591,29 @@ void AddOptions(cGridBag panel) //, GridBagConstraints constraints) { - //constraints.gridx = 0; - //constraints.gridy = 0; - panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints); - fastCB.setToolTipText("Fast mode"); - fastCB.addItemListener(this); - //constraints.gridy += 1; panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); supportCB.setToolTipText("Enabled rigging"); supportCB.addItemListener(this); - // constraints.gridy += 1; // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints); // localCB.addItemListener(this); - //constraints.gridy += 1; panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints); crowdCB.setToolTipText("Used for crowds"); crowdCB.addItemListener(this); - //constraints.gridy += 1; panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints); smoothCB.setToolTipText("Snapping delay"); smoothCB.addItemListener(this); - //constraints.gridy += 1; panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints); slowCB.setToolTipText("Smooth interpolation"); slowCB.addItemListener(this); - //constraints.gridy += 1; + panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints); boxCB.setToolTipText("Display bounding boxes"); boxCB.addItemListener(this); - //constraints.gridy += 1; + panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints); zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel"); zoomBoxCB.addItemListener(this); @@ -648,11 +642,9 @@ //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints); // debugCB.addItemListener(this); - //constraints.gridy += 1; panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints); oeilCB.addItemListener(this); - //constraints.gridy += 1; panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints); lookAtCB.setToolTipText("Look-at target"); lookAtCB.addItemListener(this); @@ -1110,7 +1102,7 @@ { menu.add(animationItem = new CheckboxMenuItem("Animation...")); animationItem.addItemListener(this); - animationItem.setState(CameraPane.ANIMATION); + animationItem.setState(Globals.ANIMATION); menu.add("-"); parseverticesItem = menu.add(new MenuItem("Multiplicity")); diff --git a/Mocap.java b/Mocap.java index 82ff7f8..0bbe7d9 100644 --- a/Mocap.java +++ b/Mocap.java @@ -2267,7 +2267,7 @@ } if (!smoothed) - for (int i=1; --i>=0;) + for (int i=10; --i>=0;) SmoothAnimData(); // much reduces shakiness smoothed = true; @@ -3252,12 +3252,13 @@ int step = 1; + // patch for running hare if (speedup) // fev 2014 step *= 2; // 4; if (rewind) // mars 2014 step *= 4; - if (CameraPane.FAST) // && !CameraPane.HOLD) + //if (CameraPane.FAST) // && !CameraPane.HOLD) step *= CameraPane.STEP; //System.err.println("Step Mocap frame # " + frame); diff --git a/ObjEditor.java b/ObjEditor.java index 565390e..177b5d2 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -3205,7 +3205,7 @@ if (!Globals.ANIMATION) { FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); - browser.show(); + browser.setVisible(true); String filename = browser.getFile(); if (filename != null && filename.length() > 0) { diff --git a/ParticleNode.java b/ParticleNode.java index dcf5821..9977719 100644 --- a/ParticleNode.java +++ b/ParticleNode.java @@ -327,7 +327,9 @@ int step = 1; if (CameraPane.FAST) + { step *= CameraPane.STEP; + } getParticleController().update(step); for (int i = 0; i < particles.length; i++) diff --git a/Wav.java b/Wav.java index 6ba3212..d548db5 100644 --- a/Wav.java +++ b/Wav.java @@ -220,7 +220,7 @@ // write out the wav file public Wav save() { - if (loop == 0 || !CameraPane.ANIMATION) + if (loop == 0 || !Globals.ANIMATION) return this; Object[] options = {"Yes", -- Gitblit v1.6.2