Skip to content

Commit 256d701

Browse files
authored
CameraEvent: javadoc
1 parent 389d91a commit 256d701

File tree

1 file changed

+46
-12
lines changed

1 file changed

+46
-12
lines changed

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

Lines changed: 46 additions & 12 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,38 @@
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+
* This constructor is suitable for programmatic creation of the event.
69+
*
70+
* @param cinematic The `Cinematic` instance this event belongs to (cannot be null).
71+
* @param cameraName The name of the camera to be activated by this event (cannot be null or empty).
72+
*/
73+
public CameraEvent(Cinematic cinematic, String cameraName) {
74+
this.cinematic = cinematic;
6475
this.cameraName = cameraName;
6576
}
6677

@@ -102,14 +113,38 @@ public void setTime(float time) {
102113
play();
103114
}
104115

116+
/**
117+
* Returns the `Cinematic` instance associated with this event.
118+
* @return The `Cinematic` instance.
119+
*/
105120
public Cinematic getCinematic() {
106121
return cinematic;
107122
}
108123

124+
/**
125+
* Sets the `Cinematic` instance for this event.
126+
* @param cinematic The `Cinematic` instance to set (cannot be null).
127+
*/
109128
public void setCinematic(Cinematic cinematic) {
110129
this.cinematic = cinematic;
111130
}
112131

132+
/**
133+
* Returns the name of the camera that this event will activate.
134+
* @return The camera name.
135+
*/
136+
public String getCameraName() {
137+
return cameraName;
138+
}
139+
140+
/**
141+
* Sets the name of the camera that this event will activate.
142+
* @param cameraName The new camera name (cannot be null or empty).
143+
*/
144+
public void setCameraName(String cameraName) {
145+
this.cameraName = cameraName;
146+
}
147+
113148
/**
114149
* used internally for serialization
115150
*
@@ -121,7 +156,6 @@ public void write(JmeExporter ex) throws IOException {
121156
super.write(ex);
122157
OutputCapsule oc = ex.getCapsule(this);
123158
oc.write(cameraName, "cameraName", null);
124-
125159
}
126160

127161
/**

0 commit comments

Comments
 (0)