23
23
from ..renderer .opengl_renderer import OpenGLCamera
24
24
from ..scene .scene import Scene
25
25
from ..utils .config_ops import merge_dicts_recursively
26
+ from ..utils .deprecation import deprecated_params
26
27
27
28
28
29
class ThreeDScene (Scene ):
@@ -49,14 +50,21 @@ def __init__(
49
50
)
50
51
super ().__init__ (camera_class = camera_class , ** kwargs )
51
52
53
+ @deprecated_params (
54
+ params = "distance" ,
55
+ since = "v0.11.0" ,
56
+ until = "v0.12.0" ,
57
+ message = "Use focal_distance instead." ,
58
+ )
52
59
def set_camera_orientation (
53
60
self ,
54
61
phi : Optional [float ] = None ,
55
62
theta : Optional [float ] = None ,
56
63
gamma : Optional [float ] = None ,
57
64
zoom : Optional [float ] = None ,
58
- distance : Optional [float ] = None ,
65
+ focal_distance : Optional [float ] = None ,
59
66
frame_center : Optional [Union ["Mobject" , Sequence [float ]]] = None ,
67
+ ** kwargs ,
60
68
):
61
69
"""
62
70
This method sets the orientation of the camera in the scene.
@@ -69,8 +77,8 @@ def set_camera_orientation(
69
77
theta : int or float, optional
70
78
The azimuthal angle i.e the angle that spins the camera around the Z_AXIS.
71
79
72
- distance : int or float, optional
73
- The radial distance between ORIGIN and Camera.
80
+ focal_distance : int or float, optional
81
+ The focal_distance of the Camera.
74
82
75
83
gamma : int or float, optional
76
84
The rotation of the camera about the vector from the ORIGIN to the Camera.
@@ -82,12 +90,13 @@ def set_camera_orientation(
82
90
The new center of the camera frame in cartesian coordinates.
83
91
84
92
"""
93
+ focal_distance = kwargs .pop ("distance" , focal_distance )
85
94
if phi is not None :
86
95
self .renderer .camera .set_phi (phi )
87
96
if theta is not None :
88
97
self .renderer .camera .set_theta (theta )
89
- if distance is not None :
90
- self .renderer .camera .set_distance ( distance )
98
+ if focal_distance is not None :
99
+ self .renderer .camera .set_focal_distance ( focal_distance )
91
100
if gamma is not None :
92
101
self .renderer .camera .set_gamma (gamma )
93
102
if zoom is not None :
@@ -188,13 +197,19 @@ def stop_3dillusion_camera_rotation(self):
188
197
self .renderer .camera .phi_tracker .clear_updaters ()
189
198
self .remove (self .renderer .camera .phi_tracker )
190
199
200
+ @deprecated_params (
201
+ params = "distance" ,
202
+ since = "v0.11.0" ,
203
+ until = "v0.12.0" ,
204
+ message = "Use focal_distance instead." ,
205
+ )
191
206
def move_camera (
192
207
self ,
193
208
phi : Optional [float ] = None ,
194
209
theta : Optional [float ] = None ,
195
210
gamma : Optional [float ] = None ,
196
211
zoom : Optional [float ] = None ,
197
- distance : Optional [float ] = None ,
212
+ focal_distance : Optional [float ] = None ,
198
213
frame_center : Optional [Union ["Mobject" , Sequence [float ]]] = None ,
199
214
added_anims : Iterable ["Animation" ] = [],
200
215
** kwargs ,
@@ -211,8 +226,8 @@ def move_camera(
211
226
theta : int or float, optional
212
227
The azimuthal angle i.e the angle that spins the camera around the Z_AXIS.
213
228
214
- distance : int or float, optional
215
- The radial distance between ORIGIN and Camera.
229
+ focal_distance : int or float, optional
230
+ The radial focal_distance between ORIGIN and Camera.
216
231
217
232
gamma : int or float, optional
218
233
The rotation of the camera about the vector from the ORIGIN to the Camera.
@@ -228,13 +243,14 @@ def move_camera(
228
243
229
244
"""
230
245
anims = []
246
+ focal_distance = kwargs .pop ("distance" , focal_distance )
231
247
232
248
if config .renderer != "opengl" :
233
249
self .camera : ThreeDCamera
234
250
value_tracker_pairs = [
235
251
(phi , self .camera .phi_tracker ),
236
252
(theta , self .camera .theta_tracker ),
237
- (distance , self .camera .distance_tracker ),
253
+ (focal_distance , self .camera .focal_distance_tracker ),
238
254
(gamma , self .camera .gamma_tracker ),
239
255
(zoom , self .camera .zoom_tracker ),
240
256
]
@@ -273,7 +289,7 @@ def move_camera(
273
289
if value is not None :
274
290
methods [method ](value )
275
291
276
- if distance is not None :
292
+ if focal_distance is not None :
277
293
warnings .warn (
278
294
"focal distance of OpenGLCamera can not be adjusted." ,
279
295
stacklevel = 2 ,
@@ -380,7 +396,7 @@ def set_to_default_angled_camera_orientation(self, **kwargs):
380
396
Parameters
381
397
----------
382
398
**kwargs
383
- Some recognised kwargs are phi, theta, distance , gamma,
399
+ Some recognised kwargs are phi, theta, focal_distance , gamma,
384
400
which have the same meaning as the parameters in set_camera_orientation.
385
401
"""
386
402
config = dict (
@@ -491,7 +507,7 @@ def get_default_camera_position(self):
491
507
Returns
492
508
-------
493
509
dict
494
- Dictionary of phi, theta, distance , and gamma.
510
+ Dictionary of phi, theta, focal_distance , and gamma.
495
511
"""
496
512
return self .default_angled_camera_position
497
513
0 commit comments