Skip to content

Commit 73062b6

Browse files
authored
Merge pull request #2448 from capdevon/capdevon-CameraEvent
CameraEvent: javadoc
2 parents 37ea339 + 7948d72 commit 73062b6

File tree

1 file changed

+51
-18
lines changed

1 file changed

+51
-18
lines changed

jme3-core/src/main/java/com/jme3/cinematic/events/CameraEvent.java

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2025 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -40,27 +40,37 @@
4040
import java.io.IOException;
4141

4242
/**
43+
* A `CameraEvent` is a cinematic event that instantly sets the active camera
44+
* within a `Cinematic` sequence.
4345
*
4446
* @author Rickard (neph1 @ github)
4547
*/
4648
public class CameraEvent extends AbstractCinematicEvent {
4749

50+
/**
51+
* The name of the camera to activate.
52+
*/
4853
private String cameraName;
54+
/**
55+
* The `Cinematic` instance to which this event belongs and on which the
56+
* camera will be set.
57+
*/
4958
private Cinematic cinematic;
5059

51-
public String getCameraName() {
52-
return cameraName;
53-
}
54-
55-
public void setCameraName(String cameraName) {
56-
this.cameraName = cameraName;
57-
}
58-
60+
/**
61+
* For serialization only. Do not use.
62+
*/
5963
public CameraEvent() {
6064
}
6165

62-
public CameraEvent(Cinematic parentEvent, String cameraName) {
63-
this.cinematic = parentEvent;
66+
/**
67+
* Constructs a new `CameraEvent` with the specified cinematic and camera name.
68+
*
69+
* @param cinematic The `Cinematic` instance this event belongs to (cannot be null).
70+
* @param cameraName The name of the camera to be activated by this event (cannot be null or empty).
71+
*/
72+
public CameraEvent(Cinematic cinematic, String cameraName) {
73+
this.cinematic = cinematic;
6474
this.cameraName = cameraName;
6575
}
6676

@@ -102,33 +112,56 @@ public void setTime(float time) {
102112
play();
103113
}
104114

115+
/**
116+
* Returns the `Cinematic` instance associated with this event.
117+
* @return The `Cinematic` instance.
118+
*/
105119
public Cinematic getCinematic() {
106120
return cinematic;
107121
}
108122

123+
/**
124+
* Sets the `Cinematic` instance for this event.
125+
* @param cinematic The `Cinematic` instance to set (cannot be null).
126+
*/
109127
public void setCinematic(Cinematic cinematic) {
110128
this.cinematic = cinematic;
111129
}
112130

113131
/**
114-
* used internally for serialization
132+
* Returns the name of the camera that this event will activate.
133+
* @return The camera name.
134+
*/
135+
public String getCameraName() {
136+
return cameraName;
137+
}
138+
139+
/**
140+
* Sets the name of the camera that this event will activate.
141+
* @param cameraName The new camera name (cannot be null or empty).
142+
*/
143+
public void setCameraName(String cameraName) {
144+
this.cameraName = cameraName;
145+
}
146+
147+
/**
148+
* Used internally for serialization.
115149
*
116-
* @param ex the exporter (not null)
117-
* @throws IOException from the exporter
150+
* @param ex The exporter (not null).
151+
* @throws IOException If an I/O error occurs during serialization.
118152
*/
119153
@Override
120154
public void write(JmeExporter ex) throws IOException {
121155
super.write(ex);
122156
OutputCapsule oc = ex.getCapsule(this);
123157
oc.write(cameraName, "cameraName", null);
124-
125158
}
126159

127160
/**
128-
* used internally for serialization
161+
* Used internally for deserialization.
129162
*
130-
* @param im the importer (not null)
131-
* @throws IOException from the importer
163+
* @param im The importer (not null).
164+
* @throws IOException If an I/O error occurs during deserialization.
132165
*/
133166
@Override
134167
public void read(JmeImporter im) throws IOException {

0 commit comments

Comments
 (0)