Attribute.java
.. .. @@ -22,9 +22,9 @@ 22 22 return csg; 23 23 } 24 24 25  - protected void deepCopySelf(Object3D other)25  + protected void deepCopyNode(Object3D other)26 26 { 27  - super.deepCopySelf(other);27  + super.deepCopyNode(other);28 28 Attribute c = (Attribute) other; 29 29 30 30 c.cleardepth = cleardepth; BezierPatch.java
.. .. @@ -43,9 +43,9 @@ 43 43 return l; 44 44 } 45 45 46  - protected void deepCopySelf(Object3D other)46  + protected void deepCopyNode(Object3D other)47 47 { 48  - super.deepCopySelf(other);48  + super.deepCopyNode(other);49 49 BezierPatch bp = (BezierPatch)other; 50 50 bp.depth = depth; 51 51 int count = ctrlPnts.size(); Biparam.java
.. .. @@ -40,9 +40,9 @@ 40 40 super.DrawNode(display, root, selected); 41 41 } 42 42 43  - protected void deepCopySelf(Object3D other)43  + protected void deepCopyNode(Object3D other)44 44 { 45  - super.deepCopySelf(other);45  + super.deepCopyNode(other);46 46 Biparam bp = (Biparam)other; 47 47 bp.uDivs = uDivs; 48 48 bp.vDivs = vDivs; Blob.java
.. .. @@ -21,9 +21,9 @@ 21 21 return blob; 22 22 } 23 23 24  - protected void deepCopySelf(Object3D other)24  + protected void deepCopyNode(Object3D other)25 25 { 26  - super.deepCopySelf(other);26  + super.deepCopyNode(other);27 27 Blob b = (Blob)other; 28 28 b.threshold = threshold; 29 29 b.cellSize = cellSize; BlobComponent.java
.. .. @@ -20,9 +20,9 @@ 20 20 return comp; 21 21 } 22 22 23  - protected void deepCopySelf(Object3D other)23  + protected void deepCopyNode(Object3D other)24 24 { 25  - super.deepCopySelf(other);25  + super.deepCopyNode(other);26 26 BlobComponent b = (BlobComponent)other; 27 27 //b.center = new cVector(); 28 28 //LA.vecCopy(center, b.center); Box.java
.. .. @@ -23,9 +23,9 @@ 23 23 return rec; 24 24 } 25 25 26  - protected void deepCopySelf(Object3D other)26  + protected void deepCopyNode(Object3D other)27 27 { 28  - super.deepCopySelf(other);28  + super.deepCopyNode(other);29 29 // Box rec = (Box)other; 30 30 // rec.minima = new cVector(); 31 31 // LA.vecCopy(minima, rec.minima); CSG.java
.. .. @@ -31,9 +31,9 @@ 31 31 return csg; 32 32 } 33 33 34  - protected void deepCopySelf(Object3D other)34  + protected void deepCopyNode(Object3D other)35 35 { 36  - super.deepCopySelf(other);36  + super.deepCopyNode(other);37 37 CSG c = (CSG) other; 38 38 c.csgType = csgType; 39 39 c.genType = genType; Composite.java
.. .. @@ -293,9 +293,9 @@ 293 293 return compo; 294 294 } 295 295 296  - protected void deepCopySelf(Object3D other)296  + protected void deepCopyNode(Object3D other)297 297 { 298  - super.deepCopySelf(other);298  + super.deepCopyNode(other);299 299 300 300 if (false) 301 301 { Cone.java
.. .. @@ -86,9 +86,9 @@ 86 86 return cone; 87 87 } 88 88 89  - protected void deepCopySelf(Object3D other)89  + protected void deepCopyNode(Object3D other)90 90 { 91  - super.deepCopySelf(other);91  + super.deepCopyNode(other);92 92 Cone c = (Cone)other; 93 93 LA.vecCopy(base, c.base); 94 94 c.baseRadius = baseRadius; FileObject.java
.. .. @@ -101,9 +101,9 @@ 101 101 return e; 102 102 } 103 103 104  - protected void deepCopySelf(Object3D other)104  + protected void deepCopyNode(Object3D other)105 105 { 106  - super.deepCopySelf(other);106  + super.deepCopyNode(other);107 107 } 108 108 109 109 // void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected) FrameSelector.java
.. .. @@ -47,9 +47,9 @@ 47 47 return e; 48 48 } 49 49 50  - protected void deepCopySelf(Object3D other)50  + protected void deepCopyNode(Object3D other)51 51 { 52  - super.deepCopySelf(other);52  + super.deepCopyNode(other);53 53 FrameSelector bp = (FrameSelector)other; 54 54 // bp.frame = (int)(Math.random()*(getNumFrames() - mocap.offset)); 55 55 } Grid.java
.. .. @@ -37,9 +37,9 @@ 37 37 return e; 38 38 } 39 39 40  - protected void deepCopySelf(Object3D other)40  + protected void deepCopyNode(Object3D other)41 41 { 42  - super.deepCopySelf(other);42  + super.deepCopyNode(other);43 43 Grid e = (Grid)other; 44 44 e.center = new cVector(); 45 45 LA.vecCopy(center, e.center); JpegLoader.java
.. .. @@ -0,0 +1,16 @@ 1  +/*2  + * To change this template, choose Tools | Templates3  + * and open the template in the editor.4  + */5  +6  +/**7  + *8  + * @author nbriere9  + */10  +public class JpegLoader11  +{12  + static java.awt.image.BufferedImage load(String name)13  + {14  + return new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage();15  + }16  +}Klein.java
.. .. @@ -74,9 +74,9 @@ 74 74 return e; 75 75 } 76 76 77  - protected void deepCopySelf(Object3D other)77  + protected void deepCopyNode(Object3D other)78 78 { 79  - super.deepCopySelf(other);79  + super.deepCopyNode(other);80 80 Klein e = (Klein) other; 81 81 if (center != null) 82 82 { Lathe.java
.. .. @@ -22,9 +22,9 @@ 22 22 return l; 23 23 } 24 24 25  - protected void deepCopySelf(Object3D other)25  + protected void deepCopyNode(Object3D other)26 26 { 27  - super.deepCopySelf(other);27  + super.deepCopyNode(other);28 28 Lathe l = (Lathe)other; 29 29 l.spline = (Spline)spline.deepCopy(); 30 30 } MorphNode.java
.. .. @@ -107,9 +107,9 @@ 107 107 return e; 108 108 } 109 109 110  - protected void deepCopySelf(Object3D other)110  + protected void deepCopyNode(Object3D other)111 111 { 112  - super.deepCopySelf(other);112  + super.deepCopyNode(other);113 113 MorphNode bp = (MorphNode)other; 114 114 115 115 bp.morphweights = (double[]) Grafreed.clone(morphweights); ObjEditor.java
.. .. @@ -24,6 +24,7 @@ 24 24 matrix.Matrix; 25 25 26 26 import grafeme.ui.*; 27  +import org.xj3d.ui.swt.widgets.ImageLoader;27 28 28 29 class ObjEditor /*extends JFrame*/ implements iCallBack, ObjectUI, 29 30 ActionListener, ChangeListener, .. .. @@ -141,7 +142,7 @@ 141 142 try 142 143 { 143 144 // Much faster! 144  - image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage();145  + image = JpegLoader.load(name);145 146 } 146 147 catch (Exception e) 147 148 { .. .. @@ -4662,9 +4663,8 @@ 4662 4663 changed.ExtractBigData(Grafreed.grafreed.universe.versiontable); 4663 4664 4664 4665 changed.clear(); 4665  -4666  - changed.skyboxname = obj.skyboxname;4667  - changed.skyboxext = obj.skyboxext;4666  +4667  + obj.deepCopyNode(changed);4668 4668 4669 4669 for (int i=0; i<obj.Size(); i++) 4670 4670 { .. .. @@ -4860,11 +4860,14 @@ 4860 4860 4861 4861 void SetCameras() 4862 4862 { 4863  - Camera neweye = (Camera)copy.GetObject(cameraView.cameras[0].GetUUID());4864  - Camera newlight = (Camera)copy.GetObject(cameraView.LightCamera().GetUUID());4865  -4866  - cameraView.SetCamera(neweye);4867  - cameraView.SetLight(newlight);4863  + if (copy == Grafreed.grafreed.universe)4864  + {4865  + Camera neweye = (Camera)copy.GetObject(cameraView.cameras[0].GetUUID());4866  + Camera newlight = (Camera)copy.GetObject(cameraView.LightCamera().GetUUID());4867  +4868  + cameraView.SetCamera(neweye);4869  + cameraView.SetLight(newlight);4870  + }4868 4871 } 4869 4872 4870 4873 void ImportGFD() Object3D.java
.. .. @@ -40,6 +40,78 @@ 40 40 41 41 ScriptNode scriptnode; 42 42 43  + void deepCopyNode(Object3D other)44  + {45  + other.skyboxname = skyboxname;46  + other.skyboxext = skyboxext;47  +48  + if (toParent != null)49  + {50  + other.toParent = LA.newMatrix();51  + other.fromParent = LA.newMatrix();52  + LA.matCopy(toParent, other.toParent);53  + LA.matCopy(fromParent, other.fromParent);54  + if (toParentMarked != null)55  + {56  + other.toParentMarked = LA.newMatrix();57  + other.fromParentMarked = LA.newMatrix();58  + LA.matCopy(toParentMarked, other.toParentMarked);59  + LA.matCopy(fromParentMarked, other.fromParentMarked);60  + }61  + }62  + else63  + {64  + if (other.toParent == null)65  +// assert(other.toParent == null);66  +// new Exception().printStackTrace();67  + System.err.println("null parent: " + other);68  + }69  +70  + /*71  + double ident[][] = LA.newMatrix();72  + if (bRep == null)73  + other.bRep = null;74  + else75  + other.bRep = new BoundaryRep(bRep, ident);76  + */77  + // Really new...78  + //other.editWindow = null;79  + if (name == null)80  + other.name = null;81  + else82  + other.name = new String(name);83  +84  + if (material != null)85  + {86  + other.material = new cMaterial(material);87  + } else88  + {89  + other.material = null;90  + }91  +92  + other.GetTextures().name = GetTextures().name;93  +94  + CopyExtraMaterial(other);95  +96  + other.touched = touched;97  + other.softtouched = softtouched;98  +99  + other.random = random;100  + other.link2master = link2master;101  + other.transformcount = transformcount;102  + other.marked = marked;103  + other.skip = skip;104  + other.count = count;105  + other.flipV = flipV;106  + other.live = live;107  + other.rewind = rewind;108  + other.hide = hide;109  + other.texres = texres;110  + other.speedup = speedup;111  + other.height = height;112  + other.depth = depth;113  + }114  +43 115 int VersionCount() 44 116 { 45 117 int count = 0; .. .. @@ -1310,78 +1382,16 @@ 1310 1382 return; 1311 1383 1312 1384 blockloop = true; 1385  +1386  + other.parent = parent;1387  +1313 1388 //System.out.println("COPY " + this + " to " + other); 1314 1389 //new Exception().printStackTrace(); 1390  + deepCopyNode(other);1315 1391 1316  - other.parent = parent;1317  - if (toParent != null)1318  - {1319  - other.toParent = LA.newMatrix();1320  - other.fromParent = LA.newMatrix();1321  - LA.matCopy(toParent, other.toParent);1322  - LA.matCopy(fromParent, other.fromParent);1323  - if (toParentMarked != null)1324  - {1325  - other.toParentMarked = LA.newMatrix();1326  - other.fromParentMarked = LA.newMatrix();1327  - LA.matCopy(toParentMarked, other.toParentMarked);1328  - LA.matCopy(fromParentMarked, other.fromParentMarked);1329  - }1330  - }1331  - else1332  - {1333  - if (other.toParent == null)1334  -// assert(other.toParent == null);1335  -// new Exception().printStackTrace();1336  - System.err.println("null parent: " + other);1337  - }1338  - /*1339  - double ident[][] = LA.newMatrix();1340  - if (bRep == null)1341  - other.bRep = null;1342  - else1343  - other.bRep = new BoundaryRep(bRep, ident);1344  - */1345  - // Really new...1346 1392 other.bRep = bRep; // Share the geometry 1347 1393 1348 1394 other.support = support; // Share the support 1349  -1350  - //other.editWindow = null;1351  - if (name == null)1352  - other.name = null;1353  - else1354  - other.name = new String(name);1355  -1356  - if (material != null)1357  - {1358  - other.material = new cMaterial(material);1359  - } else1360  - {1361  - other.material = null;1362  - }1363  -1364  - other.GetTextures().name = GetTextures().name;1365  -1366  - CopyExtraMaterial(other);1367  -1368  - other.touched = touched;1369  - other.softtouched = softtouched;1370  -1371  - other.random = random;1372  - other.link2master = link2master;1373  - other.transformcount = transformcount;1374  - other.marked = marked;1375  - other.skip = skip;1376  - other.count = count;1377  - other.flipV = flipV;1378  - other.live = live;1379  - other.rewind = rewind;1380  - other.hide = hide;1381  - other.texres = texres;1382  - other.speedup = speedup;1383  - other.height = height;1384  - other.depth = depth;1385 1395 1386 1396 // aout 2013 if (/*displaylist != -1 &&*/other.displaylist != displaylist) 1387 1397 // { .. .. @@ -1437,17 +1447,24 @@ 1437 1447 if ((mask & GEOMETRY) != 0) 1438 1448 { 1439 1449 if (bRep != null) 1440  - bRep.overwriteThis(other.bRep==null?other.transientrep:other.bRep);1441  - else1442  - assert(other.bRep == null);1443  -1444  - if (bRep != null)1445 1450 { 1451  + bRep.overwriteThis(other.bRep==null?other.transientrep:other.bRep);1446 1452 CameraPane.RemoveList(bRep.displaylist); 1447 1453 bRep.displaylist = 0; // june 2013 -1; 1448 1454 } 1449 1455 else 1450  - bRep = bRep;1456  + {1457  + //assert(other.bRep == null);1458  + bRep = other.bRep;1459  + }1460  +1461  +// if (bRep != null)1462  +// {1463  +// CameraPane.RemoveList(bRep.displaylist);1464  +// bRep.displaylist = 0; // june 2013 -1;1465  +// }1466  +// else1467  +// bRep = bRep;1451 1468 } 1452 1469 1453 1470 /* Use a MASK = GEO/MAT .. .. @@ -4260,9 +4277,9 @@ 4260 4277 max = new cVector(); 4261 4278 } 4262 4279 4263  - for (int i = 0; i<size(); i++)4280  + for (int i = 0; i<Size(); i++)4264 4281 { 4265  - Object3D child = (Object3D) reserve(i);4282  + Object3D child = (Object3D) get(i); //reserve(i);4266 4283 if (child == null) 4267 4284 continue; 4268 4285 .. .. @@ -4281,14 +4298,14 @@ 4281 4298 if (child.hide && !(child instanceof Merge) || child.skip) 4282 4299 //if (child.hide) 4283 4300 { 4284  - release(i);4301  + //release(i);4285 4302 continue; 4286 4303 } 4287 4304 4288 4305 blockloop = true; 4289 4306 child.getBounds(min, max, true); // xform); 4290 4307 blockloop = false; 4291  - release(i);4308  + //release(i);4292 4309 4293 4310 MinMax(minima, maxima); 4294 4311 } .. .. @@ -6357,6 +6374,20 @@ 6357 6374 { 6358 6375 drawSelf(display, root, selected, blocked); 6359 6376 } 6377  +6378  +// if (!(this instanceof Composite))6379  +// {6380  +// for (int i = 0; i < size(); i++)6381  +// {6382  +// Object3D child = (Object3D) reserve(i);6383  +// if (child == null)6384  +// continue;6385  +//6386  +// child.draw(display, root, selected, blocked);6387  +//6388  +// release(i);6389  +// }6390  +// }6360 6391 } else 6361 6392 { 6362 6393 /* .. .. @@ -6427,6 +6458,20 @@ 6427 6458 // june 2013 drawSelf(display, root, selected); 6428 6459 } 6429 6460 } 6461  +6462  + assert (!(this instanceof Composite));6463  + {6464  + for (int i = 0; i < size(); i++)6465  + {6466  + Object3D child = (Object3D) reserve(i);6467  + if (child == null)6468  + continue;6469  +6470  + child.draw(display, root, selected, blocked);6471  +6472  + release(i);6473  + }6474  + }6430 6475 } 6431 6476 6432 6477 if (!failedBump) .. .. @@ -6479,16 +6524,17 @@ 6479 6524 6480 6525 void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) 6481 6526 { 6482  - if (GetBRep() == null)6483  - {6484  - drawSelf(display, root, selected, blocked);6485  - } else6527  + if (GetBRep() != null)6486 6528 { 6487 6529 DrawNode(display, root, selected); 6488 6530 if (this instanceof BezierPatch) 6489 6531 { 6490 6532 //drawSelf(display, root, selected); 6491 6533 } 6534  + }6535  + else6536  + {6537  + drawSelf(display, root, selected, blocked);6492 6538 } 6493 6539 } 6494 6540 .. .. @@ -8237,7 +8283,7 @@ 8237 8283 // if (!Globals.ADVANCED) 8238 8284 // return objname; 8239 8285 8240  - return objname + " " + System.identityHashCode(this); // + GetUUID()8286  + return objname; // + " " + System.identityHashCode(this); // + GetUUID()8241 8287 } 8242 8288 8243 8289 public int hashCode() RandomEditor.java
.. .. @@ -136,9 +136,14 @@ 136 136 return objEditor; 137 137 } 138 138 139  - void refreshContents2()139  + void refreshContents()140 140 { 141  - objEditor.refreshContents();141  + itemField.setMinimum(0);142  + itemField.setMaximum(randomnode.Size() - 1);143  + itemField.setInteger(randomnode.rndIndex);144  +145  + itemField.validate();146  + // objEditor.refreshContents();142 147 } 143 148 144 149 RandomNode randomnode; RandomNode.java
.. .. @@ -20,6 +20,15 @@ 20 20 return comp; 21 21 } 22 22 23  + protected void deepCopyNode(Object3D other)24  + {25  + super.deepCopyNode(other);26  + RandomNode bp = (RandomNode)other;27  + bp.rndIndex = rndIndex;28  + bp.damp = damp;29  + bp.firstchoice = firstchoice;30  + }31  +23 32 // public int Size() 24 33 // { 25 34 // return 1; .. .. @@ -43,6 +52,18 @@ 43 52 return super.size(); 44 53 } 45 54 55  + void addChild(Object3D child)56  + {57  + super.addChild(child);58  +59  + this.rndIndex = Size() - 1;60  +61  + if (this.editWindow != null)62  + {63  + ((RandomEditor)this.objectUI).refreshContents();64  + }65  + }66  +46 67 int rndIndex = -1; 47 68 48 69 static int globalseed = 0; ScriptNode.java
.. .. @@ -1821,9 +1821,9 @@ 1821 1821 return e; 1822 1822 } 1823 1823 1824  - protected void deepCopySelf(Object3D other)1824  + protected void deepCopyNode(Object3D other)1825 1825 { 1826  - super.deepCopySelf(other);1826  + super.deepCopyNode(other);1827 1827 // FrameSelector bp = (FrameSelector)other; 1828 1828 // bp.frame = (int)(Math.random()*(getNumFrames() - mocap.offset)); 1829 1829 } Skybox.java
.. .. @@ -24,9 +24,9 @@ 24 24 return rec; 25 25 } 26 26 27  - protected void deepCopySelf(Object3D other)27  + protected void deepCopyNode(Object3D other)28 28 { 29  - super.deepCopySelf(other);29  + super.deepCopyNode(other);30 30 Skybox rec = (Skybox)other; 31 31 rec.minima = new cVector(); 32 32 LA.vecCopy(minima, rec.minima); Sphere.java
.. .. @@ -95,9 +95,9 @@ 95 95 return e; 96 96 } 97 97 98  - protected void deepCopySelf(Object3D other)98  + protected void deepCopyNode(Object3D other)99 99 { 100  - super.deepCopySelf(other);100  + super.deepCopyNode(other);101 101 Sphere e = (Sphere) other; 102 102 if (center != null) 103 103 { Spline.java
.. .. @@ -19,9 +19,9 @@ 19 19 return spline; 20 20 } 21 21 22  - protected void deepCopySelf(Object3D other)22  + protected void deepCopyNode(Object3D other)23 23 { 24  - super.deepCopySelf(other);24  + super.deepCopyNode(other);25 25 Spline spline = (Spline)other; 26 26 spline.type = type; 27 27 int count = ctrlPnts.size(); Superellipsoid.java
.. .. @@ -30,9 +30,9 @@ 30 30 return s; 31 31 } 32 32 33  - protected void deepCopySelf(Object3D other)33  + protected void deepCopyNode(Object3D other)34 34 { 35  - super.deepCopySelf(other);35  + super.deepCopyNode(other);36 36 Superellipsoid s = (Superellipsoid)other; 37 37 s.east = east; 38 38 s.north = north; SwitchNode.java
.. .. @@ -138,9 +138,9 @@ 138 138 return e; 139 139 } 140 140 141  - protected void deepCopySelf(Object3D other)141  + protected void deepCopyNode(Object3D other)142 142 { 143  - super.deepCopySelf(other);143  + super.deepCopyNode(other);144 144 SwitchNode bp = (SwitchNode)other; 145 145 bp.child = child; 146 146 } TextureNode.java
.. .. @@ -124,9 +124,9 @@ 124 124 // else 125 125 // return 1; 126 126 // } 127  - protected void deepCopySelf(Object3D other)127  + protected void deepCopyNode(Object3D other)128 128 { 129  - super.deepCopySelf(other);129  + super.deepCopyNode(other);130 130 131 131 other.maxcount = maxcount; 132 132 other.transformcount = transformcount; Torus.java
.. .. @@ -25,9 +25,9 @@ 25 25 return t; 26 26 } 27 27 28  - protected void deepCopySelf(Object3D other)28  + protected void deepCopyNode(Object3D other)29 29 { 30  - super.deepCopySelf(other);30  + super.deepCopyNode(other);31 31 Torus t = (Torus)other; 32 32 t.major = major; 33 33 t.minor = minor;