Skip to content

Commit 0ec08ec

Browse files
committed
обновление генерации тангентов
1 parent 28d4518 commit 0ec08ec

File tree

11 files changed

+260
-56
lines changed

11 files changed

+260
-56
lines changed

resources/messages/messages.properties

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ ModelFileEditorNodeTree=Structure
8484
ModelFileEditorProperties=Properties
8585
ModelFileEditorNodeMesh=Mesh
8686

87-
ModelNodeTreeActionMikktspaceTangentGenerator=Generate tangents using Mikktspace algorithm
8887
ModelNodeTreeActionRemove=Remove
8988
ModelNodeTreeActionRename=Rename
9089
ModelNodeTreeActionOptimizeGeometry=Optimize geometry
@@ -97,7 +96,7 @@ ModelNodeTreeActionCreatePrimitiveBox=Box
9796
ModelNodeTreeActionCreatePrimitiveSphere=Sphere
9897
ModelNodeTreeActionCreatePrimitiveQuad=Quad
9998
ModelNodeTreeActionLoadModel=Load model
100-
ModelNodeTreeActionTangentGenerator=Generate tangents using normal algorithm
99+
ModelNodeTreeActionTangentGenerator=Generate tangents
101100

102101
ModelPropertyCullHint=Cull Hint
103102
ModelPropertyShadowMode=Shadow mode
@@ -144,4 +143,10 @@ CreateSkyDialogBottomLabel=Bottom texture
144143
EmptyModelCreatorDescription=New model
145144
EmptyModelCreatorTitle=Create new model
146145

147-
GLSLFileEditorName=GLSL редактор
146+
GLSLFileEditorName=GLSL редактор
147+
148+
GenerateTangentsDialogTitle=Generate tangents
149+
GenerateTangentsDialogAlgorithmLabel=Type algorithm
150+
GenerateTangentsDialogSplitMirrored=Split vertices with mirrored UVs
151+
GenerateTangentsDialogButtonOk=Generate
152+
GenerateTangentsDialogButtonCancel=Cancel

resources/messages/messages_ru.properties

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ ModelFileEditorNodeTree=Структура
8484
ModelFileEditorProperties=Свойства
8585
ModelFileEditorNodeMesh=Сетка
8686

87-
ModelNodeTreeActionMikktspaceTangentGenerator=Сгенерировать тангенты используя алгоритм Mikktspace
8887
ModelNodeTreeActionRemove=Удалить
8988
ModelNodeTreeActionRename=Переименовать
9089
ModelNodeTreeActionOptimizeGeometry=Оптимизировать геометрию
@@ -97,7 +96,7 @@ ModelNodeTreeActionCreatePrimitiveBox=Куб
9796
ModelNodeTreeActionCreatePrimitiveSphere=Сфера
9897
ModelNodeTreeActionCreatePrimitiveQuad=Плоскость
9998
ModelNodeTreeActionLoadModel=Загрузить модель
100-
ModelNodeTreeActionTangentGenerator=Сгенерировать тангенты используя обычный алгоритм
99+
ModelNodeTreeActionTangentGenerator=Сгенерировать тангенты
101100

102101
ModelPropertyCullHint=Cull Hint
103102
ModelPropertyShadowMode=Режим теней
@@ -144,4 +143,10 @@ CreateSkyDialogBottomLabel=Нижняя текстура
144143
EmptyModelCreatorDescription=Новая модель
145144
EmptyModelCreatorTitle=Создание новой модели
146145

147-
GLSLFileEditorName=GLSL editor
146+
GLSLFileEditorName=GLSL editor
147+
148+
GenerateTangentsDialogTitle=Генерация тангентов
149+
GenerateTangentsDialogAlgorithmLabel=Тип алгоритма
150+
GenerateTangentsDialogSplitMirrored=Разделять вершины с зеркальным UVs
151+
GenerateTangentsDialogButtonOk=Сгенерировать
152+
GenerateTangentsDialogButtonCancel=Отмена

resources/ui/css/custom_ids.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,4 +484,23 @@
484484
-fx-min-width: 24;
485485
-fx-pref-width: -fx-min-width;
486486
-fx-max-width: -fx-min-width;
487+
}
488+
489+
#GenerateTangentsDialogLabel {
490+
-fx-min-height: 24;
491+
-fx-pref-height: -fx-min-height;
492+
-fx-max-height: -fx-min-height;
493+
-fx-min-width: 200;
494+
-fx-pref-width: -fx-min-width;
495+
-fx-max-width: -fx-min-width;
496+
-fx-alignment: center-right;
497+
}
498+
499+
#GenerateTangentsDialogComboBox {
500+
-fx-min-height: 24;
501+
-fx-pref-height: -fx-min-height;
502+
-fx-max-height: -fx-min-height;
503+
-fx-min-width: 350;
504+
-fx-pref-width: -fx-min-width;
505+
-fx-max-width: -fx-min-width;
487506
}

src/com/ss/editor/Messages.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public class Messages {
9696
public static final String MODEL_FILE_EDITOR_PROPERTIES;
9797
public static final String MODEL_FILE_EDITOR_NODE_MESH;
9898

99-
public static final String MODEL_NODE_TREE_ACTION_MIKKTSPACE_TANGENT_GENERATOR;
10099
public static final String MODEL_NODE_TREE_ACTION_REMOVE;
101100
public static final String MODEL_NODE_TREE_ACTION_RENAME;
102101
public static final String MODEL_NODE_TREE_ACTION_OPTIMIZE_GEOMETRY;
@@ -157,7 +156,12 @@ public class Messages {
157156
public static final String EMPTY_MODEL_CREATOR_TITLE;
158157

159158
public static final String GLSL_FILE_EDITOR_NAME;
160-
;
159+
160+
public static final String GENERATE_TANGENTS_DIALOG_SPLIT_MIRRORED;
161+
public static final String GENERATE_TANGENTS_DIALOG_ALGORITHM_LABEL;
162+
public static final String GENERATE_TANGENTS_DIALOG_TITLE;
163+
public static final String GENERATE_TANGENTS_DIALOG_BUTTON_OK;
164+
public static final String GENERATE_TANGENTS_DIALOG_BUTTON_CANCEL;
161165

162166
static {
163167

@@ -248,7 +252,6 @@ public class Messages {
248252
MODEL_FILE_EDITOR_PROPERTIES = bundle.getString("ModelFileEditorProperties");
249253
MODEL_FILE_EDITOR_NODE_MESH = bundle.getString("ModelFileEditorNodeMesh");
250254

251-
MODEL_NODE_TREE_ACTION_MIKKTSPACE_TANGENT_GENERATOR = bundle.getString("ModelNodeTreeActionMikktspaceTangentGenerator");
252255
MODEL_NODE_TREE_ACTION_REMOVE = bundle.getString("ModelNodeTreeActionRemove");
253256
MODEL_NODE_TREE_ACTION_RENAME = bundle.getString("ModelNodeTreeActionRename");
254257
MODEL_NODE_TREE_ACTION_OPTIMIZE_GEOMETRY = bundle.getString("ModelNodeTreeActionOptimizeGeometry");
@@ -309,5 +312,11 @@ public class Messages {
309312
EMPTY_MODEL_CREATOR_TITLE = bundle.getString("EmptyModelCreatorTitle");
310313

311314
GLSL_FILE_EDITOR_NAME = bundle.getString("GLSLFileEditorName");
315+
316+
GENERATE_TANGENTS_DIALOG_TITLE = bundle.getString("GenerateTangentsDialogTitle");
317+
GENERATE_TANGENTS_DIALOG_ALGORITHM_LABEL = bundle.getString("GenerateTangentsDialogAlgorithmLabel");
318+
GENERATE_TANGENTS_DIALOG_SPLIT_MIRRORED = bundle.getString("GenerateTangentsDialogSplitMirrored");
319+
GENERATE_TANGENTS_DIALOG_BUTTON_OK = bundle.getString("GenerateTangentsDialogButtonOk");
320+
GENERATE_TANGENTS_DIALOG_BUTTON_CANCEL = bundle.getString("GenerateTangentsDialogButtonCancel");
312321
}
313322
}

src/com/ss/editor/state/editor/impl/model/ModelEditorState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ public ModelEditorState(final ModelFileEditor fileEditor) {
203203
stateNode.attachChild(getCameraNode());
204204
stateNode.attachChild(getCustomSkyNode());
205205

206-
createToolElements();
207206
createCollisionPlane();
207+
createToolElements();
208208
createManipulators();
209209

210210
final EditorCamera editorCamera = getEditorCamera();

src/com/ss/editor/ui/component/editor/impl/model/ModelFileEditor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,11 @@ public void notifyTransformed(final Spatial spatial) {
682682
}
683683

684684
private void notifyTransformedImpl(final Spatial spatial) {
685+
685686
final ModelPropertyEditor modelPropertyEditor = getModelPropertyEditor();
686687
modelPropertyEditor.buildFor(null);
687688
modelPropertyEditor.buildFor(spatial);
689+
690+
changeHandler.run();
688691
}
689692
}

src/com/ss/editor/ui/control/model/tree/action/MikktspaceTangetGeneratorAction.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/com/ss/editor/ui/control/model/tree/action/TangentGeneratorAction.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.ss.editor.ui.control.model.tree.action;
22

3-
import com.jme3.scene.Geometry;
43
import com.ss.editor.Messages;
5-
import com.ss.editor.model.tool.TangentGenerator;
64
import com.ss.editor.ui.control.model.tree.ModelNodeTree;
75
import com.ss.editor.ui.control.model.tree.node.ModelNode;
6+
import com.ss.editor.ui.dialog.model.GenerateTangentsDialog;
7+
import com.ss.editor.ui.scene.EditorFXScene;
88

99
/**
1010
* Реализация действия по генерации тангетов используя старый алгоритм.
@@ -25,12 +25,9 @@ protected String getName() {
2525
@Override
2626
protected void process() {
2727

28-
final ModelNode<?> node = getNode();
29-
final Geometry element = (Geometry) node.getElement();
28+
final EditorFXScene scene = EDITOR.getScene();
3029

31-
TangentGenerator.useStandardGenerator(element, false);
32-
33-
final ModelNodeTree nodeTree = getNodeTree();
34-
nodeTree.notifyChanged(node);
30+
final GenerateTangentsDialog dialog = new GenerateTangentsDialog(getNodeTree(), getNode());
31+
dialog.show(scene.getWindow());
3532
}
3633
}

src/com/ss/editor/ui/control/model/tree/node/GeometryModelNode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.ss.editor.Messages;
66
import com.ss.editor.ui.Icons;
77
import com.ss.editor.ui.control.model.tree.ModelNodeTree;
8-
import com.ss.editor.ui.control.model.tree.action.MikktspaceTangetGeneratorAction;
98
import com.ss.editor.ui.control.model.tree.action.RenameNodeAction;
109
import com.ss.editor.ui.control.model.tree.action.TangentGeneratorAction;
1110

@@ -58,7 +57,7 @@ public Array<ModelNode<?>> getChildren() {
5857
public void fillContextMenu(final ModelNodeTree nodeTree, final ObservableList<MenuItem> items) {
5958

6059
final Menu toolActions = new Menu(Messages.MODEL_NODE_TREE_ACTION_TOOLS);
61-
toolActions.getItems().addAll(new TangentGeneratorAction(nodeTree, this), new MikktspaceTangetGeneratorAction(nodeTree, this));
60+
toolActions.getItems().addAll(new TangentGeneratorAction(nodeTree, this));
6261

6362
items.add(toolActions);
6463
items.add(new RenameNodeAction(nodeTree, this));

src/com/ss/editor/ui/css/CSSIds.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,7 @@ public interface CSSIds {
8686
public static final String CREATE_SKY_DIALOG_COMBO_BOX = "CreateSkyDialogComboBox";
8787
public static final String CREATE_SKY_DIALOG_SPINNER = "CreateSkyDialogSpinner";
8888
public static final String CREATE_SKY_DIALOG_BUTTON = "CreateSkyDialogButton";
89+
90+
public static final String GENERATE_TANGENTS_DIALOG_LABEL = "GenerateTangentsDialogLabel";
91+
public static final String GENERATE_TANGENTS_DIALOG_COMBO_BOX = "GenerateTangentsDialogComboBox";
8992
}

0 commit comments

Comments
 (0)