Skip to content

Commit 4feccea

Browse files
committed
реализация кеша превтю изображений, превью каналов текстур и скорсть зумирования камеры
1 parent 4236cd0 commit 4feccea

File tree

17 files changed

+502
-64
lines changed

17 files changed

+502
-64
lines changed

resources/messages/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ EditorBarComponent.settings.graphics=Graphics settings
6565

6666
GraphicsDialogTitle=Graphics settings
6767
GraphicsDialogFXAA=Enable FXAA
68+
GraphicsDialogFullscreen=Fullscreen
6869
GraphicsDialogScreenSize=Screen size
6970
GraphicsDialogAnisotropy=Anisotropy
7071
GraphicsDialogButtonOk=Apply

resources/messages/messages_ru.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ EditorBarComponent.settings.graphics=Настройки графики
6565

6666
GraphicsDialogTitle=Настройки графики
6767
GraphicsDialogFXAA=Включить FXAA
68+
GraphicsDialogFullscreen=Полноэкранный режим
6869
GraphicsDialogScreenSize=Разрешение экрана
6970
GraphicsDialogAnisotropy=Анизатропная фильтрация
7071
GraphicsDialogButtonOk=Применить

resources/ui/css/custom_ids.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,23 @@
398398
-fx-min-height: 25;
399399
-fx-pref-height: -fx-min-height;
400400
-fx-max-height: -fx-min-height;
401+
}
402+
403+
#ImageChannelPreview {
404+
-fx-background-color: -fx-color-panel-200;
405+
-fx-effect: -fx-material-shadow-panel;
406+
}
407+
408+
#ImageChannelPreviewImageContainer {
409+
-fx-alignment: center;
410+
-fx-min-width: 122;
411+
-fx-pref-width: -fx-min-width;
412+
-fx-max-width: -fx-min-width;
413+
-fx-min-height: 122;
414+
-fx-pref-height: -fx-min-height;
415+
-fx-max-height: -fx-min-height;
416+
-fx-border-color: -fx-color-panel-50;
417+
-fx-border-width: 1;
418+
-fx-fit-to-height: 122;
419+
-fx-fit-to-width: 122;
401420
}

src/com/ss/editor/Editor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public void simpleInitApp() {
280280
fxContainer = JmeFxContainer.install(this, guiNode, true, cursorDisplayProvider);
281281
scene = EditorFXSceneBuilder.build(fxContainer);
282282

283-
UIUtils.overrideTooltipBehavior(300, 2000, 500);
283+
UIUtils.overrideTooltipBehavior(1000, 3000, 500);
284284

285285
createProbe();
286286
}

src/com/ss/editor/Messages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public class Messages {
7777

7878
public static final String GRAPHICS_DIALOG_TITLE;
7979
public static final String GRAPHICS_DIALOG_FXAA;
80+
public static final String GRAPHICS_DIALOG_FULLSCREEN;
8081
public static final String GRAPHICS_DIALOG_SCREEN_SIZE;
8182
public static final String GRAPHICS_DIALOG_ANISOTROPY;
8283
public static final String GRAPHICS_DIALOG_BUTTON_OK;
@@ -185,6 +186,7 @@ public class Messages {
185186

186187
GRAPHICS_DIALOG_TITLE = bundle.getString("GraphicsDialogTitle");
187188
GRAPHICS_DIALOG_FXAA = bundle.getString("GraphicsDialogFXAA");
189+
GRAPHICS_DIALOG_FULLSCREEN = bundle.getString("GraphicsDialogFullscreen");
188190
GRAPHICS_DIALOG_SCREEN_SIZE = bundle.getString("GraphicsDialogScreenSize");
189191
GRAPHICS_DIALOG_ANISOTROPY = bundle.getString("GraphicsDialogAnisotropy");
190192
GRAPHICS_DIALOG_BUTTON_OK = bundle.getString("GraphicsDialogButtonOk");

src/com/ss/editor/config/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public abstract class Config {
1717
public static final String CONFIG_RESOURCE_PATH = "/com/ss/editor/config/config.xml";
1818

1919
public static final String TITLE = "jME3 SpaceShift Editor";
20-
public static final String VERSION = "v.0.3.5";
20+
public static final String VERSION = "v.0.3.7";
2121

2222
/**
2323
* Путь к папке с программой.

src/com/ss/editor/config/EditorConfig.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public final class EditorConfig implements AssetEventListener {
3434
public static final String PREF_GRAPHIC_SCREEN_SIZE = GRAPHICS_ALIAS + "." + "screenSize";
3535
public static final String PREF_GRAPHIC_ANISOTROPY = GRAPHICS_ALIAS + "." + "anisotropy";
3636
public static final String PREF_GRAPHIC_FXAA = GRAPHICS_ALIAS + "." + "fxaa";
37+
public static final String PREF_GRAPHIC_FULLSCREEN = GRAPHICS_ALIAS + "." + "fullscreen";
3738

3839
public static final String PREF_CURRENT_ASSET = ASSET_ALIAS + "." + "currentAsset";
3940

@@ -67,6 +68,11 @@ public static EditorConfig getInstance() {
6768
*/
6869
private volatile boolean fxaa;
6970

71+
/**
72+
* Включен ли полноэкранный режим.
73+
*/
74+
private volatile boolean fullscreen;
75+
7076
/**
7177
* Текущий выбранный Asset.
7278
*/
@@ -143,6 +149,20 @@ public void setCurrentAsset(Path currentAsset) {
143149
this.currentAsset = currentAsset;
144150
}
145151

152+
/**
153+
* @param fullscreen включен ли полноэкранный режим.
154+
*/
155+
public void setFullscreen(final boolean fullscreen) {
156+
this.fullscreen = fullscreen;
157+
}
158+
159+
/**
160+
* @return включен ли полноэкранный режим.
161+
*/
162+
public boolean isFullscreen() {
163+
return fullscreen;
164+
}
165+
146166
/**
147167
* @return настройки движка.
148168
*/
@@ -155,7 +175,7 @@ public AppSettings getSettings() {
155175
final AppSettings settings = new AppSettings(true);
156176
settings.setRenderer("CUSTOM" + EditorContext.class.getName());
157177
settings.setTitle(Config.TITLE + " " + Config.VERSION);
158-
settings.setFullscreen(false);
178+
settings.setFullscreen(isFullscreen() && screenSize.isFullscreenSupported());
159179
settings.setResolution(screenSize.getWidth(), screenSize.getHeight());
160180
settings.setFrequency(displayMode.getRefreshRate());
161181
settings.setFrameRate(60);
@@ -174,6 +194,7 @@ private void init() {
174194
this.screenSize = ScreenSize.sizeOf(prefs.get(PREF_GRAPHIC_SCREEN_SIZE, "1244x700"));
175195
this.anisotropy = prefs.getInt(PREF_GRAPHIC_ANISOTROPY, 0);
176196
this.fxaa = prefs.getBoolean(PREF_GRAPHIC_FXAA, false);
197+
this.fullscreen = prefs.getBoolean(PREF_GRAPHIC_FULLSCREEN, false);
177198

178199
final String currentAssetURI = prefs.get(PREF_CURRENT_ASSET, null);
179200

@@ -196,6 +217,7 @@ public void save() {
196217
prefs.put(PREF_GRAPHIC_SCREEN_SIZE, getScreenSize().toString());
197218
prefs.putInt(PREF_GRAPHIC_ANISOTROPY, getAnisotropy());
198219
prefs.putBoolean(PREF_GRAPHIC_FXAA, isFXAA());
220+
prefs.putBoolean(PREF_GRAPHIC_FULLSCREEN, isFullscreen());
199221

200222
if (currentAsset != null) {
201223
prefs.put(PREF_CURRENT_ASSET, currentAsset.toUri().toString());

src/com/ss/editor/config/ScreenSize.java

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@ public class ScreenSize {
2121
public static final int SCREEN_SIZE_MIN_HEIGHT = 700;
2222
public static final int SCREEN_SIZE_MIN_WIDTH = 1244;
2323

24-
/**
25-
* Сортировщик размеров экрана.
26-
*/
27-
private static final ArrayComparator<ScreenSize> COMPARATOR = (first, second) -> {
28-
29-
final int firstTotal = first.getHeight() * first.getWidth();
30-
final int secondTotal = second.getHeight() * second.getWidth();
31-
32-
return -(firstTotal - secondTotal);
33-
};
34-
3524
/**
3625
* Таблица доступных расширений экрана.
3726
*/
@@ -42,27 +31,6 @@ public class ScreenSize {
4231
*/
4332
private static ScreenSize[] values;
4433

45-
/**
46-
* Строковый вид.
47-
*/
48-
private final String size;
49-
50-
/**
51-
* Ширина экрана.
52-
*/
53-
private final int width;
54-
55-
/**
56-
* Высота кэрана.
57-
*/
58-
private final int height;
59-
60-
private ScreenSize(final int width, final int height) {
61-
this.width = width;
62-
this.height = height;
63-
this.size = width + "x" + height;
64-
}
65-
6634
/**
6735
* Инициализация списка доступных разрешений экрана.
6836
*/
@@ -83,25 +51,27 @@ public static void init() {
8351

8452
if (mode.getWidth() < SCREEN_SIZE_MIN_WIDTH || mode.getHeight() < SCREEN_SIZE_MIN_HEIGHT) {
8553
continue;
86-
} else if (mode.getWidth() > SCREEN_SIZE_MAX_WIDTH) {
54+
}
55+
56+
if (mode.getWidth() > SCREEN_SIZE_MAX_WIDTH) {
8757
continue;
8858
}
8959

90-
container.add(new ScreenSize(mode.getWidth(), mode.getHeight()));
60+
container.add(new ScreenSize(mode.getWidth(), mode.getHeight(), device.isFullScreenSupported()));
9161
}
9262

93-
container.add(new ScreenSize(SCREEN_SIZE_MIN_WIDTH, SCREEN_SIZE_MIN_HEIGHT));
63+
container.add(new ScreenSize(SCREEN_SIZE_MIN_WIDTH, SCREEN_SIZE_MIN_HEIGHT, false));
9464

9565
if (maxWidth >= 1600 && maxHeight >= 900) {
96-
container.add(new ScreenSize(1600, 900));
66+
container.add(new ScreenSize(1600, 900, false));
9767
}
9868

9969
if (maxWidth >= 1850 && maxHeight >= 1000) {
100-
container.add(new ScreenSize(1850, 1000));
70+
container.add(new ScreenSize(1850, 1000, false));
10171
}
10272

10373
if (maxWidth >= 1366 && maxHeight >= 768) {
104-
container.add(new ScreenSize(1366, 768));
74+
container.add(new ScreenSize(1366, 768, false));
10575
}
10676

10777
container.sort(COMPARATOR);
@@ -119,7 +89,7 @@ public static void init() {
11989
*/
12090
public static ScreenSize sizeOf(final String size) {
12191
final ScreenSize screenSize = SCREEN_SIZE_TABLE.get(size);
122-
return screenSize == null ? new ScreenSize(SCREEN_SIZE_MIN_WIDTH, SCREEN_SIZE_MIN_HEIGHT) : screenSize;
92+
return screenSize == null ? new ScreenSize(SCREEN_SIZE_MIN_WIDTH, SCREEN_SIZE_MIN_HEIGHT, false) : screenSize;
12393
}
12494

12595
/**
@@ -129,6 +99,44 @@ public static ScreenSize[] values() {
12999
return values;
130100
}
131101

102+
/**
103+
* Строковый вид.
104+
*/
105+
private final String size;
106+
107+
/**
108+
* Ширина экрана.
109+
*/
110+
private final int width;
111+
112+
/**
113+
* Высота кэрана.
114+
*/
115+
private final int height;
116+
117+
/**
118+
* Сортировщик размеров экрана.
119+
*/
120+
private static final ArrayComparator<ScreenSize> COMPARATOR = (first, second) -> {
121+
122+
final int firstTotal = first.getHeight() * first.getWidth();
123+
final int secondTotal = second.getHeight() * second.getWidth();
124+
125+
return -(firstTotal - secondTotal);
126+
};
127+
128+
/**
129+
* Поддерживается ли полный экран.
130+
*/
131+
private final boolean fullscreenSupported;
132+
133+
private ScreenSize(final int width, final int height, final boolean fullscreenSupported) {
134+
this.width = width;
135+
this.height = height;
136+
this.size = width + "x" + height;
137+
this.fullscreenSupported = fullscreenSupported;
138+
}
139+
132140
@Override
133141
public boolean equals(final Object obj) {
134142

@@ -174,6 +182,13 @@ public int hashCode() {
174182
return result;
175183
}
176184

185+
/**
186+
* @return поддерживается ли полноэкранный режим.
187+
*/
188+
public boolean isFullscreenSupported() {
189+
return fullscreenSupported;
190+
}
191+
177192
@Override
178193
public String toString() {
179194
return size;

src/com/ss/editor/manager/FileIconManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ public class FileIconManager {
6666
EXTENSION_TO_CONTENT_TYPE.put("j3md", "jme3");
6767

6868
EXTENSION_TO_CONTENT_TYPE.put("obj", "application/x-tgif");
69+
EXTENSION_TO_CONTENT_TYPE.put("blend", "application-x-blender");
70+
EXTENSION_TO_CONTENT_TYPE.put("j3odata", "gnome-mime-text");
71+
EXTENSION_TO_CONTENT_TYPE.put("pfv", "gnome-mime-text");
6972
}
7073

7174
private static FileIconManager instance;

0 commit comments

Comments
 (0)