.. | .. |
---|
296 | 296 | client = inClient; |
---|
297 | 297 | copy = client; |
---|
298 | 298 | |
---|
299 | | - if (copy.versions == null) |
---|
| 299 | + if (copy.versionlist == null) |
---|
300 | 300 | { |
---|
301 | | - copy.versions = new byte[100][]; |
---|
| 301 | + copy.versionlist = new Object3D[100]; |
---|
302 | 302 | copy.versionindex = -1; |
---|
303 | 303 | } |
---|
304 | 304 | |
---|
.. | .. |
---|
315 | 315 | client = inClient; |
---|
316 | 316 | copy = client; |
---|
317 | 317 | |
---|
318 | | - if (copy.versions == null) |
---|
| 318 | + if (copy.versionlist == null) |
---|
319 | 319 | { |
---|
320 | | - copy.versions = new byte[100][]; |
---|
| 320 | + copy.versionlist = new Object3D[100]; |
---|
321 | 321 | copy.versionindex = -1; |
---|
322 | 322 | } |
---|
323 | 323 | |
---|
.. | .. |
---|
353 | 353 | copy = localCopy; |
---|
354 | 354 | copy.editWindow = this; |
---|
355 | 355 | |
---|
356 | | - if (copy.versions == null) |
---|
| 356 | + if (copy.versionlist == null) |
---|
357 | 357 | { |
---|
358 | 358 | // copy.versions = new byte[100][]; |
---|
359 | 359 | // copy.versionindex = -1; |
---|
.. | .. |
---|
467 | 467 | toolboxPanel = new cGridBag().setVertical(true); |
---|
468 | 468 | //toolboxPanel.setName("Toolbox"); |
---|
469 | 469 | |
---|
470 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 470 | + materialPanel = new cGridBag().setVertical(false); |
---|
471 | 471 | //materialPanel.setName("Material"); |
---|
472 | 472 | |
---|
473 | 473 | /*JTextPane*/ |
---|
.. | .. |
---|
848 | 848 | //frame.setVisible(true); |
---|
849 | 849 | } |
---|
850 | 850 | frame.validate(); |
---|
| 851 | + |
---|
| 852 | + cameraView.requestFocusInWindow(); |
---|
851 | 853 | } |
---|
852 | 854 | |
---|
853 | | - private byte[] CompressCopy() |
---|
| 855 | + private Object3D CompressCopy() |
---|
854 | 856 | { |
---|
855 | 857 | boolean temp = CameraPane.SWITCH; |
---|
856 | 858 | CameraPane.SWITCH = false; |
---|
.. | .. |
---|
858 | 860 | copy.ExtractBigData(versiontable); |
---|
859 | 861 | // if (copy == client) |
---|
860 | 862 | |
---|
861 | | - byte[] versions[] = copy.versions; |
---|
862 | | - copy.versions = null; |
---|
| 863 | + Object3D versions[] = copy.versionlist; |
---|
| 864 | + copy.versionlist = null; |
---|
863 | 865 | |
---|
864 | | - byte[] compress = Compress(copy); |
---|
| 866 | + //byte[] compress = Compress(copy); |
---|
| 867 | + Object3D compress = (Object3D)Grafreed.clone(copy); |
---|
865 | 868 | |
---|
866 | | - copy.versions = versions; |
---|
| 869 | + copy.versionlist = versions; |
---|
867 | 870 | |
---|
868 | 871 | copy.RestoreBigData(versiontable); |
---|
869 | 872 | |
---|
.. | .. |
---|
993 | 996 | { |
---|
994 | 997 | SetupMaterial(materialPanel); |
---|
995 | 998 | } |
---|
| 999 | + |
---|
996 | 1000 | //SetupName(); |
---|
997 | 1001 | //SetupViews(); |
---|
998 | 1002 | } |
---|
.. | .. |
---|
1550 | 1554 | //tmp.setName("Edit"); |
---|
1551 | 1555 | objectPanel.add(materialPanel); |
---|
1552 | 1556 | objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
1553 | | - objectPanel.setToolTipTextAt(0, "Material panel"); |
---|
| 1557 | + objectPanel.setToolTipTextAt(0, "Material"); |
---|
1554 | 1558 | |
---|
1555 | 1559 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1556 | 1560 | // north.setName("Edit"); |
---|
.. | .. |
---|
1558 | 1562 | // objectPanel.add(north); |
---|
1559 | 1563 | objectPanel.add(editPanel); |
---|
1560 | 1564 | objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
1561 | | - objectPanel.setToolTipTextAt(1, "Edit panel"); |
---|
| 1565 | + objectPanel.setToolTipTextAt(1, "Edit controls"); |
---|
1562 | 1566 | |
---|
1563 | 1567 | //if (Globals.ADVANCED) |
---|
1564 | 1568 | objectPanel.add(infoPanel); |
---|
1565 | 1569 | objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
1566 | | - objectPanel.setToolTipTextAt(2, "Info panel"); |
---|
| 1570 | + objectPanel.setToolTipTextAt(2, "Information"); |
---|
1567 | 1571 | |
---|
1568 | 1572 | objectPanel.add(XYZPanel); |
---|
1569 | 1573 | objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
1570 | | - objectPanel.setToolTipTextAt(3, "XYZ/RGB panel"); |
---|
| 1574 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB transform"); |
---|
1571 | 1575 | |
---|
1572 | 1576 | objectPanel.add(toolboxPanel); |
---|
1573 | 1577 | objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1574 | | - objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel"); |
---|
| 1578 | + objectPanel.setToolTipTextAt(4, "Objects & backgrounds"); |
---|
1575 | 1579 | |
---|
1576 | 1580 | /* |
---|
1577 | 1581 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1733 | 1737 | ctrlPanel.removeAll(); |
---|
1734 | 1738 | } |
---|
1735 | 1739 | |
---|
1736 | | - void SetupMaterial(cGridBag panel) |
---|
| 1740 | + void SetupMaterial(cGridBag materialpanel) |
---|
1737 | 1741 | { |
---|
1738 | | - /* |
---|
| 1742 | + cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
| 1743 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1744 | + skin.addMouseListener(new MouseAdapter() |
---|
| 1745 | + { |
---|
| 1746 | + public void mouseClicked(MouseEvent e) |
---|
| 1747 | + { |
---|
| 1748 | + Object3D object = Grafreed.materials.versionlist[0].get(0); |
---|
| 1749 | + cMaterial material = object.material; |
---|
| 1750 | + |
---|
| 1751 | + // Skin |
---|
| 1752 | + colorField.setFloat(material.color); |
---|
| 1753 | + saturationField.setFloat(material.modulation); |
---|
| 1754 | + subsurfaceField.setFloat(material.subsurface); |
---|
| 1755 | + selfshadowField.setFloat(material.diffuseness); |
---|
| 1756 | + diffusenessField.setFloat(material.factor); |
---|
| 1757 | + shininessField.setFloat(material.shininess); |
---|
| 1758 | + shadowbiasField.setFloat(material.shadowbias); |
---|
| 1759 | + diffuseField.setFloat(material.diffuse); |
---|
| 1760 | + specularField.setFloat(material.specular); |
---|
| 1761 | + |
---|
| 1762 | + bumpField.setFloat(object.projectedVertices[0].x / 1000.0); |
---|
| 1763 | + noiseField.setFloat(object.projectedVertices[0].y / 1000.0); |
---|
| 1764 | + powerField.setFloat(object.projectedVertices[2].x / 1000.0); |
---|
| 1765 | + |
---|
| 1766 | + materialtouched = true; |
---|
| 1767 | + applySelf(); |
---|
| 1768 | + } |
---|
| 1769 | + }); |
---|
| 1770 | + presetpanel.add(skin); |
---|
| 1771 | + |
---|
| 1772 | + cLabel rough2 = GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF); |
---|
| 1773 | + rough2.addMouseListener(new MouseAdapter() |
---|
| 1774 | + { |
---|
| 1775 | + public void mouseClicked(MouseEvent e) |
---|
| 1776 | + { |
---|
| 1777 | + Object3D object = Grafreed.materials.versionlist[1].get(0); |
---|
| 1778 | + cMaterial material = object.material; |
---|
| 1779 | + |
---|
| 1780 | + shininessField.setFloat(material.shininess); |
---|
| 1781 | + velvetField.setFloat(material.velvet); |
---|
| 1782 | + |
---|
| 1783 | + materialtouched = true; |
---|
| 1784 | + applySelf(); |
---|
| 1785 | + } |
---|
| 1786 | + }); |
---|
| 1787 | + presetpanel.add(rough2); |
---|
| 1788 | + |
---|
| 1789 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF)); |
---|
| 1790 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF)); |
---|
| 1791 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF)); |
---|
| 1792 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00005.png", !Grafreed.NIMBUSLAF)); |
---|
| 1793 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00006.png", !Grafreed.NIMBUSLAF)); |
---|
| 1794 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00007.png", !Grafreed.NIMBUSLAF)); |
---|
| 1795 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00008.png", !Grafreed.NIMBUSLAF)); |
---|
| 1796 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00009.png", !Grafreed.NIMBUSLAF)); |
---|
| 1797 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00010.png", !Grafreed.NIMBUSLAF)); |
---|
| 1798 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00011.png", !Grafreed.NIMBUSLAF)); |
---|
| 1799 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00012.png", !Grafreed.NIMBUSLAF)); |
---|
| 1800 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00013.png", !Grafreed.NIMBUSLAF)); |
---|
| 1801 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00014.png", !Grafreed.NIMBUSLAF)); |
---|
| 1802 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF)); |
---|
| 1803 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF)); |
---|
| 1804 | + presetpanel.add(GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF)); |
---|
| 1805 | + |
---|
| 1806 | + cGridBag panel = new cGridBag().setVertical(true); |
---|
| 1807 | + |
---|
| 1808 | + presetpanel.preferredWidth = 1; |
---|
| 1809 | + |
---|
| 1810 | + materialpanel.add(panel); |
---|
| 1811 | + materialpanel.add(presetpanel); |
---|
| 1812 | + |
---|
| 1813 | + panel.preferredWidth = 8; |
---|
| 1814 | + |
---|
| 1815 | + /* |
---|
1739 | 1816 | ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); |
---|
1740 | 1817 | materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1741 | | - */ |
---|
| 1818 | + */ |
---|
1742 | 1819 | |
---|
1743 | 1820 | cGridBag editBar = new cGridBag().setVertical(false); |
---|
1744 | 1821 | |
---|
.. | .. |
---|
1775 | 1852 | |
---|
1776 | 1853 | cGridBag huepanel = new cGridBag(); |
---|
1777 | 1854 | cGridBag huelabel = new cGridBag(); |
---|
1778 | | - huelabel.add(GetLabel("icons/hue.png", false)); |
---|
| 1855 | + skin = GetLabel("icons/hue.png", false); |
---|
| 1856 | + skin.fit = true; |
---|
| 1857 | + huelabel.add(skin); |
---|
1779 | 1858 | huelabel.preferredWidth = 20; |
---|
1780 | 1859 | huepanel.add(new cGridBag()); // Label |
---|
1781 | 1860 | huepanel.add(huelabel); // Field/slider |
---|
.. | .. |
---|
1796 | 1875 | cGridBag modulation = new cGridBag(); |
---|
1797 | 1876 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1798 | 1877 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1799 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1878 | + modulation.add(saturationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1800 | 1879 | colorSection.add(modulation); |
---|
1801 | 1880 | |
---|
1802 | 1881 | cGridBag opacity = new cGridBag(); |
---|
.. | .. |
---|
2989 | 3068 | |
---|
2990 | 3069 | freezematerial = true; |
---|
2991 | 3070 | colorField.setFloat(mat.color); |
---|
2992 | | - modulationField.setFloat(mat.modulation); |
---|
| 3071 | + saturationField.setFloat(mat.modulation); |
---|
2993 | 3072 | metalnessField.setFloat(mat.metalness); |
---|
2994 | 3073 | diffuseField.setFloat(mat.diffuse); |
---|
2995 | 3074 | specularField.setFloat(mat.specular); |
---|
.. | .. |
---|
3300 | 3379 | } else if (event.getSource() == liveCB) |
---|
3301 | 3380 | { |
---|
3302 | 3381 | copy.live ^= true; |
---|
| 3382 | + objEditor.refreshContents(true); // To show item colors |
---|
3303 | 3383 | return; |
---|
3304 | 3384 | } else if (event.getSource() == selectableCB) |
---|
3305 | 3385 | { |
---|
.. | .. |
---|
3309 | 3389 | { |
---|
3310 | 3390 | copy.hide ^= true; |
---|
3311 | 3391 | copy.Touch(); // display list issue |
---|
3312 | | - objEditor.refreshContents(); |
---|
| 3392 | + objEditor.refreshContents(true); // To show item colors |
---|
3313 | 3393 | return; |
---|
3314 | 3394 | } else if (event.getSource() == link2masterCB) |
---|
3315 | 3395 | { |
---|
.. | .. |
---|
3565 | 3645 | |
---|
3566 | 3646 | static public byte[] Compress(Object3D o) |
---|
3567 | 3647 | { |
---|
| 3648 | + // Slower to actually compress. |
---|
3568 | 3649 | try |
---|
3569 | 3650 | { |
---|
3570 | 3651 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
.. | .. |
---|
3666 | 3747 | { |
---|
3667 | 3748 | //Save(true); |
---|
3668 | 3749 | Replace(); |
---|
| 3750 | + SetUndoStates(); |
---|
3669 | 3751 | } |
---|
3670 | 3752 | |
---|
3671 | 3753 | private boolean Equal(byte[] compress, byte[] name) |
---|
.. | .. |
---|
3686 | 3768 | |
---|
3687 | 3769 | java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3688 | 3770 | |
---|
| 3771 | + void DeleteVersion() |
---|
| 3772 | + { |
---|
| 3773 | + for (int i = copy.versionindex; i < copy.versionlist.length-1; i++) |
---|
| 3774 | + { |
---|
| 3775 | + copy.versionlist[i] = copy.versionlist[i+1]; |
---|
| 3776 | + } |
---|
| 3777 | + |
---|
| 3778 | + CopyChanged(); |
---|
| 3779 | + |
---|
| 3780 | + SetUndoStates(); |
---|
| 3781 | + } |
---|
| 3782 | + |
---|
3689 | 3783 | public boolean Save(boolean user) |
---|
3690 | 3784 | { |
---|
3691 | 3785 | System.err.println("Save"); |
---|
| 3786 | + //Replace(); |
---|
3692 | 3787 | |
---|
3693 | 3788 | cRadio tab = GetCurrentTab(); |
---|
3694 | 3789 | |
---|
3695 | | - byte[] compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
| 3790 | + Object3D compress = CompressCopy(); // Saved version. No need for "Replace"? |
---|
3696 | 3791 | |
---|
3697 | 3792 | boolean thesame = false; |
---|
3698 | 3793 | |
---|
3699 | | - // Quick heuristic using length. Works only when stream is compressed. |
---|
3700 | | - if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
3701 | | - { |
---|
3702 | | - thesame = true; |
---|
3703 | | - } |
---|
| 3794 | +// if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3795 | +// { |
---|
| 3796 | +// thesame = true; |
---|
| 3797 | +// } |
---|
3704 | 3798 | |
---|
3705 | 3799 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3706 | 3800 | if (!thesame) |
---|
3707 | 3801 | { |
---|
| 3802 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 3803 | + { |
---|
| 3804 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 3805 | + } |
---|
| 3806 | + |
---|
3708 | 3807 | //tab.user[tab.versionindex] = user; |
---|
3709 | 3808 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3710 | 3809 | |
---|
3711 | | - copy.versions[++copy.versionindex] = compress; |
---|
| 3810 | + copy.versionlist[++copy.versionindex] = compress; |
---|
3712 | 3811 | |
---|
3713 | 3812 | // if (increment) |
---|
3714 | 3813 | // tab.versionindex++; |
---|
.. | .. |
---|
3718 | 3817 | |
---|
3719 | 3818 | //assert(hashtable.isEmpty()); |
---|
3720 | 3819 | |
---|
3721 | | - for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3722 | | - { |
---|
3723 | | - //tab.user[i] = false; |
---|
3724 | | - copy.versions[i] = null; |
---|
3725 | | - } |
---|
| 3820 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 3821 | +// { |
---|
| 3822 | +// //tab.user[i] = false; |
---|
| 3823 | +// copy.versionlist[i] = null; |
---|
| 3824 | +// } |
---|
3726 | 3825 | |
---|
3727 | 3826 | SetUndoStates(); |
---|
3728 | 3827 | |
---|
.. | .. |
---|
3747 | 3846 | |
---|
3748 | 3847 | return !thesame; |
---|
3749 | 3848 | } |
---|
3750 | | - |
---|
3751 | | - void CopyChanged(Object3D obj) |
---|
| 3849 | + |
---|
| 3850 | + boolean flashIt = true; |
---|
| 3851 | + |
---|
| 3852 | + void RefreshSelection() |
---|
3752 | 3853 | { |
---|
| 3854 | + Object3D selection = new Object3D(); |
---|
| 3855 | + |
---|
| 3856 | + for (int i = 0; i < copy.selection.size(); i++) |
---|
| 3857 | + { |
---|
| 3858 | + Object3D elem = copy.selection.elementAt(i); |
---|
| 3859 | + |
---|
| 3860 | + Object3D obj = copy.GetObject(elem.GetUUID()); |
---|
| 3861 | + |
---|
| 3862 | + if (obj == null) |
---|
| 3863 | + { |
---|
| 3864 | + copy.selection.remove(i--); |
---|
| 3865 | + } |
---|
| 3866 | + else |
---|
| 3867 | + { |
---|
| 3868 | + selection.add(obj); |
---|
| 3869 | + copy.selection.setElementAt(obj, i); |
---|
| 3870 | + } |
---|
| 3871 | + } |
---|
| 3872 | + |
---|
| 3873 | + flashIt = false; |
---|
| 3874 | + GetTree().clearSelection(); |
---|
| 3875 | + for (int i = 0; i < selection.size(); i++) |
---|
| 3876 | + GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
| 3877 | + flashIt = true; |
---|
| 3878 | + |
---|
| 3879 | + //refreshContents(false); |
---|
| 3880 | + } |
---|
| 3881 | + |
---|
| 3882 | + void CopyChanged() |
---|
| 3883 | + { |
---|
| 3884 | + Object3D obj = copy.versionlist[copy.versionindex]; |
---|
| 3885 | + |
---|
3753 | 3886 | SetUndoStates(); |
---|
3754 | 3887 | |
---|
3755 | 3888 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3771 | 3904 | |
---|
3772 | 3905 | CameraPane.SWITCH = temp; |
---|
3773 | 3906 | |
---|
| 3907 | + RefreshSelection(); |
---|
3774 | 3908 | //assert(hashtable.isEmpty()); |
---|
3775 | 3909 | |
---|
3776 | 3910 | copy.Touch(); |
---|
.. | .. |
---|
3791 | 3925 | } |
---|
3792 | 3926 | } |
---|
3793 | 3927 | |
---|
3794 | | - refreshContents(); |
---|
| 3928 | + refreshContents(true); |
---|
3795 | 3929 | } |
---|
3796 | 3930 | |
---|
3797 | | - cButton undoButton; |
---|
| 3931 | + cButton previousVersionButton; |
---|
3798 | 3932 | cButton restoreButton; |
---|
3799 | 3933 | cButton replaceButton; |
---|
3800 | | - cButton redoButton; |
---|
| 3934 | + cButton nextVersionButton; |
---|
| 3935 | + cButton saveVersionButton; |
---|
| 3936 | + cButton deleteVersionButton; |
---|
3801 | 3937 | |
---|
3802 | 3938 | boolean muteSlider; |
---|
3803 | 3939 | |
---|
.. | .. |
---|
3805 | 3941 | { |
---|
3806 | 3942 | int count = 0; |
---|
3807 | 3943 | |
---|
3808 | | - for (int i = copy.versions.length; --i >= 0;) |
---|
| 3944 | + for (int i = copy.versionlist.length; --i >= 0;) |
---|
3809 | 3945 | { |
---|
3810 | | - if (copy.versions[i] != null) |
---|
| 3946 | + if (copy.versionlist[i] != null) |
---|
3811 | 3947 | count++; |
---|
3812 | 3948 | } |
---|
3813 | 3949 | |
---|
.. | .. |
---|
3818 | 3954 | { |
---|
3819 | 3955 | cRadio tab = GetCurrentTab(); |
---|
3820 | 3956 | |
---|
3821 | | - restoreButton.setEnabled(copy.versionindex != -1); |
---|
3822 | | - replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3957 | + restoreButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 3958 | + replaceButton.setEnabled(true); // copy.versionindex != -1); |
---|
3823 | 3959 | |
---|
3824 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3825 | | - redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3960 | + previousVersionButton.setEnabled(copy.versionindex > 0); |
---|
| 3961 | + nextVersionButton.setEnabled(copy.versionlist[copy.versionindex + 1] != null); |
---|
| 3962 | + |
---|
| 3963 | + deleteVersionButton.setEnabled(//copy.versionindex > 0 && |
---|
| 3964 | + copy.versionlist[copy.versionindex + 1] != null); |
---|
3826 | 3965 | |
---|
3827 | 3966 | muteSlider = true; |
---|
3828 | 3967 | versionSlider.setMaximum(VersionCount() - 1); |
---|
.. | .. |
---|
3830 | 3969 | muteSlider = false; |
---|
3831 | 3970 | } |
---|
3832 | 3971 | |
---|
3833 | | - public boolean Undo() |
---|
| 3972 | + public boolean PreviousVersion() |
---|
3834 | 3973 | { |
---|
3835 | 3974 | // Option? |
---|
3836 | 3975 | Replace(); |
---|
.. | .. |
---|
3860 | 3999 | |
---|
3861 | 4000 | copy.versionindex -= 1; |
---|
3862 | 4001 | |
---|
3863 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4002 | + CopyChanged(); |
---|
3864 | 4003 | |
---|
3865 | 4004 | return true; |
---|
3866 | 4005 | } |
---|
.. | .. |
---|
3871 | 4010 | |
---|
3872 | 4011 | cRadio tab = GetCurrentTab(); |
---|
3873 | 4012 | |
---|
3874 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4013 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3875 | 4014 | { |
---|
3876 | 4015 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3877 | 4016 | return false; |
---|
3878 | 4017 | } |
---|
3879 | 4018 | |
---|
3880 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4019 | + //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4020 | + CopyChanged(); |
---|
3881 | 4021 | |
---|
3882 | 4022 | return true; |
---|
3883 | 4023 | } |
---|
.. | .. |
---|
3888 | 4028 | |
---|
3889 | 4029 | cRadio tab = GetCurrentTab(); |
---|
3890 | 4030 | |
---|
3891 | | - if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 4031 | + if (copy.versionindex == -1 || copy.versionlist[copy.versionindex] == null) |
---|
3892 | 4032 | { |
---|
3893 | 4033 | // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3894 | 4034 | return false; |
---|
3895 | 4035 | } |
---|
3896 | 4036 | |
---|
3897 | | - copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 4037 | + copy.versionlist[copy.versionindex] = CompressCopy(); |
---|
3898 | 4038 | |
---|
3899 | 4039 | return true; |
---|
3900 | 4040 | } |
---|
3901 | 4041 | |
---|
3902 | | - public void Redo() |
---|
| 4042 | + public void NextVersion() |
---|
3903 | 4043 | { |
---|
3904 | 4044 | // Option? |
---|
3905 | 4045 | Replace(); |
---|
3906 | 4046 | |
---|
3907 | 4047 | cRadio tab = GetCurrentTab(); |
---|
3908 | 4048 | |
---|
3909 | | - if (copy.versions[copy.versionindex + 1] == null) |
---|
| 4049 | + if (copy.versionlist[copy.versionindex + 1] == null) |
---|
3910 | 4050 | { |
---|
3911 | 4051 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3912 | 4052 | return; |
---|
.. | .. |
---|
3914 | 4054 | |
---|
3915 | 4055 | copy.versionindex += 1; |
---|
3916 | 4056 | |
---|
3917 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 4057 | + CopyChanged(); |
---|
3918 | 4058 | |
---|
3919 | 4059 | //if (!tab.user[tab.versionindex]) |
---|
3920 | 4060 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4128 | 4268 | //copy.material = new cMaterial(copy.GetMaterial()); |
---|
4129 | 4269 | |
---|
4130 | 4270 | current.color = (float) colorField.getFloat(); |
---|
4131 | | - current.modulation = (float) modulationField.getFloat(); |
---|
| 4271 | + current.modulation = (float) saturationField.getFloat(); |
---|
4132 | 4272 | current.metalness = (float) metalnessField.getFloat(); |
---|
4133 | 4273 | current.diffuse = (float) diffuseField.getFloat(); |
---|
4134 | 4274 | current.specular = (float) specularField.getFloat(); |
---|
.. | .. |
---|
4161 | 4301 | cMaterial mat = copy.material; |
---|
4162 | 4302 | |
---|
4163 | 4303 | colorField.SetToolTipValue((mat.color)); |
---|
4164 | | - modulationField.SetToolTipValue((mat.modulation)); |
---|
| 4304 | + saturationField.SetToolTipValue((mat.modulation)); |
---|
4165 | 4305 | metalnessField.SetToolTipValue((mat.metalness)); |
---|
4166 | 4306 | diffuseField.SetToolTipValue((mat.diffuse)); |
---|
4167 | 4307 | specularField.SetToolTipValue((mat.specular)); |
---|
.. | .. |
---|
4225 | 4365 | |
---|
4226 | 4366 | int version = versionSlider.getInteger(); |
---|
4227 | 4367 | |
---|
4228 | | - if (copy.versions[version] != null) |
---|
| 4368 | + if (copy.versionlist[version] != null) |
---|
4229 | 4369 | { |
---|
4230 | | - CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4370 | + copy.versionindex = version; |
---|
| 4371 | + CopyChanged(); |
---|
4231 | 4372 | } |
---|
4232 | 4373 | |
---|
4233 | 4374 | return; |
---|
.. | .. |
---|
4267 | 4408 | { |
---|
4268 | 4409 | //System.out.println("stateChanged = " + this); |
---|
4269 | 4410 | materialtouched = true; |
---|
| 4411 | + |
---|
| 4412 | + if (e.getSource() == colorField && saturationField.getFloat() == 0.001) |
---|
| 4413 | + { |
---|
| 4414 | + saturationField.setFloat(1); |
---|
| 4415 | + } |
---|
| 4416 | + |
---|
4270 | 4417 | applySelf(); |
---|
4271 | 4418 | //System.out.println("this = " + this); |
---|
4272 | 4419 | //System.out.println("PARENT = " + parent); |
---|
.. | .. |
---|
4566 | 4713 | { |
---|
4567 | 4714 | if (GetTree() != null) |
---|
4568 | 4715 | { |
---|
| 4716 | + GetTree().revalidate(); |
---|
4569 | 4717 | GetTree().repaint(); |
---|
4570 | 4718 | } |
---|
4571 | 4719 | |
---|
.. | .. |
---|
4574 | 4722 | ctrlPanel.validate(); // ? new |
---|
4575 | 4723 | ctrlPanel.repaint(); |
---|
4576 | 4724 | } |
---|
| 4725 | + |
---|
| 4726 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 4727 | + SetUndoStates(); |
---|
4577 | 4728 | } |
---|
4578 | 4729 | |
---|
4579 | 4730 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
4957 | 5108 | c.addChild(csg); |
---|
4958 | 5109 | } |
---|
4959 | 5110 | |
---|
4960 | | - copy.versions = readobj.versions; |
---|
| 5111 | + copy.versionlist = readobj.versionlist; |
---|
4961 | 5112 | copy.versionindex = readobj.versionindex; |
---|
4962 | 5113 | |
---|
4963 | | - if (copy.versions == null) |
---|
| 5114 | + if (copy.versionlist == null) |
---|
4964 | 5115 | { |
---|
4965 | | - copy.versions = new byte[100][]; |
---|
| 5116 | + copy.versionlist = new Object3D[100]; |
---|
4966 | 5117 | copy.versionindex = -1; |
---|
4967 | 5118 | } |
---|
4968 | 5119 | |
---|
.. | .. |
---|
4978 | 5129 | { |
---|
4979 | 5130 | if (Grafreed.standAlone) |
---|
4980 | 5131 | { |
---|
4981 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5132 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
4982 | 5133 | browser.show(); |
---|
4983 | 5134 | String filename = browser.getFile(); |
---|
4984 | 5135 | if (filename != null && filename.length() > 0) |
---|
.. | .. |
---|
5370 | 5521 | JLabel colorLabel; |
---|
5371 | 5522 | cNumberSlider colorField; |
---|
5372 | 5523 | JLabel modulationLabel; |
---|
5373 | | - cNumberSlider modulationField; |
---|
| 5524 | + cNumberSlider saturationField; |
---|
5374 | 5525 | JLabel metalnessLabel; |
---|
5375 | 5526 | cNumberSlider metalnessField; |
---|
5376 | 5527 | JLabel diffuseLabel; |
---|