.. | .. |
---|
848 | 848 | //frame.setVisible(true); |
---|
849 | 849 | } |
---|
850 | 850 | frame.validate(); |
---|
| 851 | + |
---|
| 852 | + cameraView.requestFocusInWindow(); |
---|
851 | 853 | } |
---|
852 | 854 | |
---|
853 | 855 | private Object3D CompressCopy() |
---|
.. | .. |
---|
1738 | 1740 | void SetupMaterial(cGridBag materialpanel) |
---|
1739 | 1741 | { |
---|
1740 | 1742 | cGridBag presetpanel = new cGridBag().setVertical(true); |
---|
1741 | | - cLabel label = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
1742 | | - label.addMouseListener(new MouseAdapter() |
---|
| 1743 | + cLabel skin = GetLabel("icons/shadericons/shadericon00000.png", !Grafreed.NIMBUSLAF); |
---|
| 1744 | + skin.addMouseListener(new MouseAdapter() |
---|
1743 | 1745 | { |
---|
1744 | 1746 | public void mouseClicked(MouseEvent e) |
---|
1745 | 1747 | { |
---|
1746 | | - colorField.setFloat(0); |
---|
1747 | | - saturationField.setFloat(1); |
---|
| 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 | + |
---|
1748 | 1766 | materialtouched = true; |
---|
1749 | 1767 | applySelf(); |
---|
1750 | 1768 | } |
---|
1751 | 1769 | }); |
---|
1752 | | - presetpanel.add(label); |
---|
| 1770 | + presetpanel.add(skin); |
---|
1753 | 1771 | |
---|
1754 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00001.png", !Grafreed.NIMBUSLAF)); |
---|
| 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 | + |
---|
1755 | 1789 | presetpanel.add(GetLabel("icons/shadericons/shadericon00002.png", !Grafreed.NIMBUSLAF)); |
---|
1756 | 1790 | presetpanel.add(GetLabel("icons/shadericons/shadericon00003.png", !Grafreed.NIMBUSLAF)); |
---|
1757 | 1791 | presetpanel.add(GetLabel("icons/shadericons/shadericon00004.png", !Grafreed.NIMBUSLAF)); |
---|
.. | .. |
---|
1768 | 1802 | presetpanel.add(GetLabel("icons/shadericons/shadericon00015.png", !Grafreed.NIMBUSLAF)); |
---|
1769 | 1803 | presetpanel.add(GetLabel("icons/shadericons/shadericon00016.png", !Grafreed.NIMBUSLAF)); |
---|
1770 | 1804 | presetpanel.add(GetLabel("icons/shadericons/shadericon00017.png", !Grafreed.NIMBUSLAF)); |
---|
1771 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00018.png", !Grafreed.NIMBUSLAF)); |
---|
1772 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00019.png", !Grafreed.NIMBUSLAF)); |
---|
1773 | | - presetpanel.add(GetLabel("icons/shadericons/shadericon00020.png", !Grafreed.NIMBUSLAF)); |
---|
1774 | 1805 | |
---|
1775 | 1806 | cGridBag panel = new cGridBag().setVertical(true); |
---|
1776 | 1807 | |
---|
.. | .. |
---|
1821 | 1852 | |
---|
1822 | 1853 | cGridBag huepanel = new cGridBag(); |
---|
1823 | 1854 | cGridBag huelabel = new cGridBag(); |
---|
1824 | | - label = GetLabel("icons/hue.png", false); |
---|
1825 | | - label.fit = true; |
---|
1826 | | - huelabel.add(label); |
---|
| 1855 | + skin = GetLabel("icons/hue.png", false); |
---|
| 1856 | + skin.fit = true; |
---|
| 1857 | + huelabel.add(skin); |
---|
1827 | 1858 | huelabel.preferredWidth = 20; |
---|
1828 | 1859 | huepanel.add(new cGridBag()); // Label |
---|
1829 | 1860 | huepanel.add(huelabel); // Field/slider |
---|
.. | .. |
---|
3737 | 3768 | |
---|
3738 | 3769 | java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3739 | 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 | + |
---|
3740 | 3783 | public boolean Save(boolean user) |
---|
3741 | 3784 | { |
---|
3742 | 3785 | System.err.println("Save"); |
---|
3743 | | - Replace(); |
---|
| 3786 | + //Replace(); |
---|
3744 | 3787 | |
---|
3745 | 3788 | cRadio tab = GetCurrentTab(); |
---|
3746 | 3789 | |
---|
3747 | | - Object3D compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
| 3790 | + Object3D compress = CompressCopy(); // Saved version. No need for "Replace"? |
---|
3748 | 3791 | |
---|
3749 | 3792 | boolean thesame = false; |
---|
3750 | 3793 | |
---|
.. | .. |
---|
3756 | 3799 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3757 | 3800 | if (!thesame) |
---|
3758 | 3801 | { |
---|
| 3802 | + for (int i = copy.versionlist.length; --i > copy.versionindex+1;) |
---|
| 3803 | + { |
---|
| 3804 | + copy.versionlist[i] = copy.versionlist[i-1]; |
---|
| 3805 | + } |
---|
| 3806 | + |
---|
3759 | 3807 | //tab.user[tab.versionindex] = user; |
---|
3760 | 3808 | //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
3761 | 3809 | |
---|
.. | .. |
---|
3769 | 3817 | |
---|
3770 | 3818 | //assert(hashtable.isEmpty()); |
---|
3771 | 3819 | |
---|
3772 | | - for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
3773 | | - { |
---|
3774 | | - //tab.user[i] = false; |
---|
3775 | | - copy.versionlist[i] = null; |
---|
3776 | | - } |
---|
| 3820 | +// for (int i = copy.versionindex+1; i < copy.versionlist.length; i++) |
---|
| 3821 | +// { |
---|
| 3822 | +// //tab.user[i] = false; |
---|
| 3823 | +// copy.versionlist[i] = null; |
---|
| 3824 | +// } |
---|
3777 | 3825 | |
---|
3778 | 3826 | SetUndoStates(); |
---|
3779 | 3827 | |
---|
.. | .. |
---|
3828 | 3876 | GetTree().addSelectionPath(selection.elementAt(i).GetTreePath().GetTreePath()); |
---|
3829 | 3877 | flashIt = true; |
---|
3830 | 3878 | |
---|
3831 | | - refreshContents(false); |
---|
| 3879 | + //refreshContents(false); |
---|
3832 | 3880 | } |
---|
3833 | 3881 | |
---|
3834 | | - void CopyChanged(Object3D obj) |
---|
| 3882 | + void CopyChanged() |
---|
3835 | 3883 | { |
---|
| 3884 | + Object3D obj = copy.versionlist[copy.versionindex]; |
---|
| 3885 | + |
---|
3836 | 3886 | SetUndoStates(); |
---|
3837 | 3887 | |
---|
3838 | 3888 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3875 | 3925 | } |
---|
3876 | 3926 | } |
---|
3877 | 3927 | |
---|
3878 | | - refreshContents(); |
---|
| 3928 | + refreshContents(true); |
---|
3879 | 3929 | } |
---|
3880 | 3930 | |
---|
3881 | | - cButton undoButton; |
---|
| 3931 | + cButton previousVersionButton; |
---|
3882 | 3932 | cButton restoreButton; |
---|
3883 | 3933 | cButton replaceButton; |
---|
3884 | | - cButton redoButton; |
---|
| 3934 | + cButton nextVersionButton; |
---|
| 3935 | + cButton saveVersionButton; |
---|
| 3936 | + cButton deleteVersionButton; |
---|
3885 | 3937 | |
---|
3886 | 3938 | boolean muteSlider; |
---|
3887 | 3939 | |
---|
.. | .. |
---|
3902 | 3954 | { |
---|
3903 | 3955 | cRadio tab = GetCurrentTab(); |
---|
3904 | 3956 | |
---|
3905 | | - restoreButton.setEnabled(copy.versionindex != -1); |
---|
3906 | | - replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3957 | + restoreButton.setEnabled(true); // copy.versionindex != -1); |
---|
| 3958 | + replaceButton.setEnabled(true); // copy.versionindex != -1); |
---|
3907 | 3959 | |
---|
3908 | | - undoButton.setEnabled(copy.versionindex > 0); |
---|
3909 | | - redoButton.setEnabled(copy.versionlist[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); |
---|
3910 | 3965 | |
---|
3911 | 3966 | muteSlider = true; |
---|
3912 | 3967 | versionSlider.setMaximum(VersionCount() - 1); |
---|
.. | .. |
---|
3914 | 3969 | muteSlider = false; |
---|
3915 | 3970 | } |
---|
3916 | 3971 | |
---|
3917 | | - public boolean Undo() |
---|
| 3972 | + public boolean PreviousVersion() |
---|
3918 | 3973 | { |
---|
3919 | 3974 | // Option? |
---|
3920 | 3975 | Replace(); |
---|
.. | .. |
---|
3944 | 3999 | |
---|
3945 | 4000 | copy.versionindex -= 1; |
---|
3946 | 4001 | |
---|
3947 | | - CopyChanged((Object3D)copy.versionlist[copy.versionindex]); |
---|
| 4002 | + CopyChanged(); |
---|
3948 | 4003 | |
---|
3949 | 4004 | return true; |
---|
3950 | 4005 | } |
---|
.. | .. |
---|
3962 | 4017 | } |
---|
3963 | 4018 | |
---|
3964 | 4019 | //CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
3965 | | - CopyChanged(copy.versionlist[copy.versionindex]); |
---|
| 4020 | + CopyChanged(); |
---|
3966 | 4021 | |
---|
3967 | 4022 | return true; |
---|
3968 | 4023 | } |
---|
.. | .. |
---|
3984 | 4039 | return true; |
---|
3985 | 4040 | } |
---|
3986 | 4041 | |
---|
3987 | | - public void Redo() |
---|
| 4042 | + public void NextVersion() |
---|
3988 | 4043 | { |
---|
3989 | 4044 | // Option? |
---|
3990 | 4045 | Replace(); |
---|
.. | .. |
---|
3999 | 4054 | |
---|
4000 | 4055 | copy.versionindex += 1; |
---|
4001 | 4056 | |
---|
4002 | | - CopyChanged(copy.versionlist[copy.versionindex]); |
---|
| 4057 | + CopyChanged(); |
---|
4003 | 4058 | |
---|
4004 | 4059 | //if (!tab.user[tab.versionindex]) |
---|
4005 | 4060 | // tab.graphs[tab.versionindex] = null; |
---|
.. | .. |
---|
4312 | 4367 | |
---|
4313 | 4368 | if (copy.versionlist[version] != null) |
---|
4314 | 4369 | { |
---|
4315 | | - CopyChanged(copy.versionlist[copy.versionindex = version]); |
---|
| 4370 | + copy.versionindex = version; |
---|
| 4371 | + CopyChanged(); |
---|
4316 | 4372 | } |
---|
4317 | 4373 | |
---|
4318 | 4374 | return; |
---|
.. | .. |
---|
4666 | 4722 | ctrlPanel.validate(); // ? new |
---|
4667 | 4723 | ctrlPanel.repaint(); |
---|
4668 | 4724 | } |
---|
| 4725 | + |
---|
| 4726 | + if (previousVersionButton != null && copy.versionlist != null) |
---|
| 4727 | + SetUndoStates(); |
---|
4669 | 4728 | } |
---|
4670 | 4729 | |
---|
4671 | 4730 | static TweenManager tweenManager = new TweenManager(); |
---|
.. | .. |
---|
5070 | 5129 | { |
---|
5071 | 5130 | if (Grafreed.standAlone) |
---|
5072 | 5131 | { |
---|
5073 | | - FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD); |
---|
| 5132 | + FileDialog browser = new FileDialog(frame, "Open", FileDialog.LOAD); |
---|
5074 | 5133 | browser.show(); |
---|
5075 | 5134 | String filename = browser.getFile(); |
---|
5076 | 5135 | if (filename != null && filename.length() > 0) |
---|