Skip to content

Commit 6d0ccb5

Browse files
committed
renamed editing controls to painting controls.
1 parent 37879aa commit 6d0ccb5

14 files changed

+228
-226
lines changed

src/main/java/com/ss/editor/control/editing/EditingControl.java

Lines changed: 0 additions & 73 deletions
This file was deleted.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package com.ss.editor.control.painting;
2+
3+
import com.jme3.math.Vector3f;
4+
import com.jme3.scene.Spatial;
5+
import com.jme3.scene.control.Control;
6+
import com.ss.editor.annotation.JmeThread;
7+
import org.jetbrains.annotations.NotNull;
8+
import org.jetbrains.annotations.Nullable;
9+
10+
/**
11+
* The interface to implement a painting control.
12+
*
13+
* @author JavaSaBr
14+
*/
15+
public interface PaintingControl extends Control {
16+
17+
/**
18+
* Get the painted model.
19+
*
20+
* @return the painted model.
21+
*/
22+
@JmeThread
23+
default @Nullable Spatial getPaintedModel() {
24+
return null;
25+
}
26+
27+
/**
28+
* Start painting.
29+
*
30+
* @param paintingInput the type of input.
31+
* @param contactPoint the contact point.
32+
*/
33+
@JmeThread
34+
default void startPainting(@NotNull final PaintingInput paintingInput, @NotNull final Vector3f contactPoint) {
35+
}
36+
37+
/**
38+
* Get the current painting input.
39+
*
40+
* @return the current painting input.
41+
*/
42+
@JmeThread
43+
default @Nullable PaintingInput getCurrentInput() {
44+
return null;
45+
}
46+
47+
/**
48+
* Finish painting.
49+
*
50+
* @param contactPoint the contact point.
51+
*/
52+
@JmeThread
53+
default void finishPainting(@NotNull final Vector3f contactPoint) {
54+
}
55+
56+
/**
57+
* Update painting.
58+
*
59+
* @param contactPoint the contact point.
60+
*/
61+
@JmeThread
62+
default void updateEditing(@NotNull final Vector3f contactPoint) {
63+
}
64+
65+
/**
66+
* Return true of this control was started painting.
67+
*
68+
* @return true if this control started painting.
69+
*/
70+
@JmeThread
71+
default boolean isStartedPainting() {
72+
return false;
73+
}
74+
}

src/main/java/com/ss/editor/control/editing/EditingInput.java renamed to src/main/java/com/ss/editor/control/painting/PaintingInput.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package com.ss.editor.control.editing;
1+
package com.ss.editor.control.painting;
22

33
/**
4-
* The enum with list of editing inputs.
4+
* The enum with list of painting inputs.
55
*
66
* @author JavaSaBr
77
*/
8-
public enum EditingInput {
8+
public enum PaintingInput {
99
/**
1010
* Mouse primary editing input.
1111
*/

src/main/java/com/ss/editor/control/editing/impl/AbstractEditingControl.java renamed to src/main/java/com/ss/editor/control/painting/impl/AbstractPaintingControl.java

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.ss.editor.control.editing.impl;
1+
package com.ss.editor.control.painting.impl;
22

33
import com.jme3.material.Material;
44
import com.jme3.math.ColorRGBA;
@@ -9,32 +9,33 @@
99
import com.jme3.scene.Spatial;
1010
import com.jme3.scene.control.AbstractControl;
1111
import com.ss.editor.annotation.JmeThread;
12-
import com.ss.editor.control.editing.EditingControl;
13-
import com.ss.editor.control.editing.EditingInput;
12+
import com.ss.editor.control.painting.PaintingControl;
13+
import com.ss.editor.control.painting.PaintingInput;
1414
import com.ss.editor.util.EditorUtil;
1515
import org.jetbrains.annotations.NotNull;
1616
import org.jetbrains.annotations.Nullable;
1717

1818
/**
19-
* The base implementation of an editing control.
19+
* The base implementation of {@link PaintingControl}.
2020
*
2121
* @author JavaSaBr
2222
*/
23-
public class AbstractEditingControl extends AbstractControl implements EditingControl {
23+
public class AbstractPaintingControl extends AbstractControl implements PaintingControl {
2424

2525
/**
26-
* The current editing input.
26+
* The current painting input.
2727
*/
2828
@Nullable
29-
private EditingInput editingInput;
29+
private PaintingInput paintingInput;
3030

3131
/**
32-
* The flag of editing state.
32+
* The flag of painting state.
3333
*/
34-
private boolean editing;
34+
private boolean painting;
3535

3636
@Override
37-
public void setSpatial(final Spatial spatial) {
37+
@JmeThread
38+
public void setSpatial(@Nullable final Spatial spatial) {
3839

3940
final Spatial prev = getSpatial();
4041
if (prev instanceof Node) {
@@ -49,30 +50,28 @@ public void setSpatial(final Spatial spatial) {
4950
}
5051

5152
/**
52-
* Create wireframe material material.
53+
* Create a colored wireframe material.
5354
*
54-
* @param color the color
55-
* @return the material
55+
* @param color the color.
56+
* @return the colored wireframe material.
5657
*/
5758
@JmeThread
5859
protected @NotNull Material createWireframeMaterial(@NotNull final ColorRGBA color) {
59-
final Material material = createMaterial(color);
60+
final Material material = createColoredMaterial(color);
6061
material.getAdditionalRenderState().setWireframe(true);
6162
return material;
6263
}
6364

6465
/**
65-
* Create material material.
66+
* Create a colored material.
6667
*
67-
* @param color the color
68-
* @return the material
68+
* @param color the color.
69+
* @return the colored material.
6970
*/
7071
@JmeThread
71-
protected @NotNull Material createMaterial(@NotNull final ColorRGBA color) {
72-
72+
protected @NotNull Material createColoredMaterial(@NotNull final ColorRGBA color) {
7373
final Material material = new Material(EditorUtil.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
7474
material.setColor("Color", color);
75-
7675
return material;
7776
}
7877

@@ -88,51 +87,53 @@ protected void controlRender(@NotNull final RenderManager renderManager, @NotNul
8887

8988
@Override
9089
@JmeThread
91-
public boolean isStartedEditing() {
92-
return editing;
90+
public boolean isStartedPainting() {
91+
return painting;
9392
}
9493

9594
/**
96-
* Sets editing.
95+
* Set the painting state.
9796
*
98-
* @param editing the flag of editing state.
97+
* @param painting the flag of painting state.
9998
*/
10099
@JmeThread
101-
protected void setEditing(final boolean editing) {
102-
this.editing = editing;
100+
protected void setPainting(final boolean painting) {
101+
this.painting = painting;
103102
}
104103

105104
@Override
106105
@JmeThread
107-
public void startEditing(@NotNull final EditingInput editingInput, @NotNull final Vector3f contactPoint) {
108-
setEditing(true);
109-
setEditingInput(editingInput);
106+
public void startPainting(@NotNull final PaintingInput input, @NotNull final Vector3f contactPoint) {
107+
setPainting(true);
108+
setPaintingInput(input);
110109
}
111110

112111
@Override
113112
@JmeThread
114-
public void finishEditing(@NotNull final Vector3f contactPoint) {
115-
setEditing(false);
113+
public void finishPainting(@NotNull final Vector3f contactPoint) {
114+
setPainting(false);
116115
}
117116

118117
/**
119-
* @param editingInput the current editing input.
118+
* Set the painting input,
119+
*
120+
* @param input the current painting input.
120121
*/
121122
@JmeThread
122-
private void setEditingInput(@Nullable final EditingInput editingInput) {
123-
this.editingInput = editingInput;
123+
private void setPaintingInput(@Nullable final PaintingInput input) {
124+
this.paintingInput = input;
124125
}
125126

126127
@Override
127128
@JmeThread
128-
public @Nullable EditingInput getCurrentInput() {
129-
return editingInput;
129+
public @Nullable PaintingInput getCurrentInput() {
130+
return paintingInput;
130131
}
131132

132133
/**
133134
* Notify about that this control was attached.
134135
*
135-
* @param node the node
136+
* @param node the node.
136137
*/
137138
@JmeThread
138139
protected void onAttached(@NotNull final Node node) {
@@ -141,7 +142,7 @@ protected void onAttached(@NotNull final Node node) {
141142
/**
142143
* Notify about that this control was detached.
143144
*
144-
* @param node the node
145+
* @param node the node.
145146
*/
146147
@JmeThread
147148
protected void onDetached(@NotNull final Node node) {

0 commit comments

Comments
 (0)