GL Studio C++ Runtime API
gls_path_manager.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::GlsPathManager class and global enumerations.
3
4 \par Copyright Information
5
6 Copyright (c) 2017 by The DiSTI Corporation.<br>
7 11301 Corporate Blvd; Suite 100<br>
8 Orlando, Florida 32817<br>
9 USA<br>
10 <br>
11 All rights reserved.<br>
12
13 This Software contains proprietary trade secrets of DiSTI and may not be
14reproduced, in whole or part, in any form, or by any means of electronic,
15mechanical, or otherwise, without the written permission of DiSTI. Said
16permission may be derived through the purchase of applicable DiSTI product
17licenses which detail the distribution rights of this content and any
18Derivative Works based on this or other copyrighted DiSTI Software.
19
20 NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26
27 LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34EXCEED FIVE DOLLARS (US$5.00).
35
36 The aforementioned terms and restrictions are governed by the laws of the
37State of Florida and the United States of America.
38
39*/
40#ifndef INCLUDED_GLS_PATH_MANAGER_H
41#define INCLUDED_GLS_PATH_MANAGER_H
42
44#include "gls_dynamic_path.h"
45#include "group.h"
46
47// Windows #defines this symbol which we use
48#if defined( WIN32 ) && defined( GetObject )
49# undef GetObject
50#endif
51
52namespace disti
53{
54// SetValue enumerations
55enum
56{
57 GLS_PATHMANAGER_FIRST_VALUE = GLS_LAST_INITIALIZER + 1,
58 GLS_PATHMANAGER_PATHOBJPAIR_COUNT,
59 GLS_PATHMANAGER_PATHOBJPAIR,
60 GLS_PATHMANAGER_STRINGPATHOBJPAIR
61};
62
63/** Runtime implementation of a GlsPathManager */
65{
66 friend class GlsPathManagerEditor;
67
68private:
71
72public:
73 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
74 typedef DisplayObject _BaseClass; ///< Deprecated typedef for the base class.
75 typedef DisplayObject BaseClass; ///< Typedef for the base class.
76
77 /// Constructor
78 /// \param generateInstanceName Whether or not to generate an instance name for this object.
79 GLSGEN_GLSDYNAMICPATH_EXPORT GlsPathManager( bool generateInstanceName = false );
80
81 /// Copy constructor
82 /// \param that The object to copy from.
83 /// \param generateNames Whether or not to generate an instance name for this object.
84 GLSGEN_GLSDYNAMICPATH_EXPORT GlsPathManager( const GlsPathManager& that, const bool generateNames );
85
86 /** Destructs a GlsPathManager object */
88
89 /// \return A pointer to a new GlsPathManager object.
91
95
96#ifndef GLES
99#endif
100
102 virtual GLSGEN_GLSDYNAMICPATH_EXPORT bool Hit( float x, float y, float z, float scale, const Vector& directionVector, Vector* collisionPoint ) DISTI_METHOD_OVERRIDE;
103 virtual GLSGEN_GLSDYNAMICPATH_EXPORT void SetValue( int spec, va_list& args ) DISTI_METHOD_OVERRIDE;
106
107 //////////////////////////////////////////////////
108 // GlsPathManager specific operations
109 //////////////////////////////////////////////////
110
111 /// \details The PathObjectPair class. Contains a dynamic path and the object that path animates.
113 {
114 public:
115 /// Constructor
117
118 /// Copy constructor
120
121 /// Destructor
123
124 /// Copy assignment
125 /// \return The resulting object (this).
127
128 /// Populates the attribute dictionary for this object.
129 /// \note Not normally called by users.
131
132 /// \return A reference to the attribute dictionary for this object.
134 {
135 if( !_attribDict )
136 MakeAttribDict();
137 return *_attribDict;
138 };
139
140 /// Assign a new GlsDynamicPath to this pair by name.
141 /// \param name The name of the new path to set.
142 void SetDynamicPathByName( const std::string& name )
143 {
144 _pathName = name;
145 }
146
147 /// \return The name of the path in this pair.
148 std::string GetDynamicPathName() const
149 {
150 return _path ? _path->InstanceName() : _pathName;
151 }
152
153 /// Assign a new GlsDynamicPath to this pair.
154 /// \param path The new path to set.
156 {
157 _path = path;
158 }
159
160 /// \return The path in this pair.
162 {
163 return _path;
164 }
165
166 /// Set the target object of this pair's animation.
167 /// \param object The new target object to set.
168 void SetObject( DisplayObject* object )
169 {
170 _object = object;
171 }
172
173 /// \return The target object of this pair.
175 {
176 return _object;
177 }
178#if !defined( GLES )
179 /// Assign a new GlsDynamicPath to this pair.
180 /// \deprecated Use single-pointer functions instead.
181 /// \param path The new path to set.
182 DISTI_DEPRECATED( "Use single-pointer functions instead." )
183 void SetDynamicPath( GlsDynamicPath** path )
184 {
185 _path = path ? *path : NULL;
186 }
187
188 /// Set the target object of this pair's animation.
189 /// \deprecated Use single-pointer functions instead.
190 /// \param object The new target object to set.
191 DISTI_DEPRECATED( "Use single-pointer functions instead." )
192 void SetObject( DisplayObject** object )
193 {
194 _object = object ? *object : NULL;
195 }
196#endif
197 /// Set the target object of this pair's animation by name.
198 /// \param name The name of the new target object to set.
199 void SetObjectByName( const std::string& name )
200 {
201 _objectName = name;
202 }
203
204 /// \return The name of the target object.
205 std::string GetObjectName() const
206 {
207 return _object ? _object->InstanceName() : _objectName;
208 }
209
210 protected:
211 // The *'s are for runtime (faster).
212 GlsDynamicPath* _path; ///< The path containing the animation data.
213 DisplayObject* _object; ///< The object to be animated by the path.
214
215 // the std::strings are for the editor (slower)
216 std::string _pathName; ///< The name of the path object.
217 std::string _objectName; ///< The name of the animation target object.
218
219 DistiAttribDict* _attribDict; ///< The attribute dictionary for the members of this object.
220 };
221
222 typedef DynamicArray<PathObjectPair> PathObjectPairArrayType; ///< Shorthand typedef for a list of path pairs.
223
224 /// Use this array to set which path goes with what object.
225 /// \return A modifiable reference to the PathObjectPairArray associated with this object.
227
228 /// \return A const reference to the PathObjectPairArray associated with this object.
230
231 /// Sets the animation value as a ratio of MinAnimationValue, MaxAnimationValue.
232 /// \param pct percent of animation (0.0 -> 1.0).
234
235 /// Move all of the objects in the PathObjectPairArray to the given value on the associated path.
236 /// \param value The value used to position the object on the path (see GlsDynamicPath::MoveObject).
238
239 /// Backwards compatibility method.
240 /// \see SetAnimationValue
241 /// \param value The animation value to set.
242 DISTI_DEPRECATED( "Renamed for clarity, use SetAnimationValue instead." )
243 void CurrentTimeValue( float value ) { SetAnimationValue( value ); }
244
245 /** Causes the MinAnimationValue and MaxAnimationValue to be recalculated using
246 * the paths in the PathObjectPairArray.
247 */
249
250 /** Returns the stored minimum animation value from the PathObjectPairArray.
251 * \see RecalcMinMaxValue
252 * \return The minimum animation value
253 */
255
256 /// Backwards compatibility method.
257 /// \see MinAnimationValue
258 /// \return The minimum animation value.
259 DISTI_DEPRECATED( "Renamed for clarity, use MinAnimationValue instead." )
260 float MinTimeValue() { return MinAnimationValue(); }
261
262 /** Returns the stored maximum animation value from the PathObjectPairArray.
263 * \see RecalcMinMaxValue
264 * \return The maximum animation value
265 */
267
268 /// Backwards compatibility method.
269 /// \see MaxAnimationValue
270 /// \return The maximum animation value.
271 DISTI_DEPRECATED( "Renamed for clarity, use MaxAnimationValue instead." )
272 float MaxTimeValue() { return MaxAnimationValue(); }
273
274protected:
275 PathObjectPairArrayType _pathObjectPairArray; ///< List of animation pairs to manage.
276
277 float _minValue; ///< The minimum animation key value.
278 float _maxValue; ///< The maximum animation key value.
279 bool _recalcValueBounds; ///< If true, _minValue and _maxValue will be recalculated.
280
281 /// Calculate the min and max value based on the animation pairs.
282 /// \note Not normally called by users.
284#ifdef GLES
285 /** Set a single attribute from the GLO file.
286 * \param data The attribute to set and its associated data.
287 */
288 virtual GLS_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
289#endif
290};
291
292} // namespace disti
293
294#endif
Definition: display.h:96
Definition: disti_metadata.h:734
Definition: disti_metadata.h:220
Definition: dynamic_array.h:79
Definition: gls_dynamic_path.h:86
Definition: gls_glo_file.h:1243
Definition: gls_path_manager.h:113
DisplayObject * GetObject() const
Definition: gls_path_manager.h:174
std::string _pathName
The name of the path object.
Definition: gls_path_manager.h:216
std::string GetObjectName() const
Definition: gls_path_manager.h:205
const PathObjectPair & operator=(const PathObjectPair &)
GlsDynamicPath * GetDynamicPath() const
Definition: gls_path_manager.h:161
void SetDynamicPath(GlsDynamicPath *path)
Definition: gls_path_manager.h:155
GlsDynamicPath * _path
The path containing the animation data.
Definition: gls_path_manager.h:212
void SetDynamicPathByName(const std::string &name)
Definition: gls_path_manager.h:142
void SetObject(DisplayObject *object)
Definition: gls_path_manager.h:168
std::string GetDynamicPathName() const
Definition: gls_path_manager.h:148
DisplayObject * _object
The object to be animated by the path.
Definition: gls_path_manager.h:213
PathObjectPair(const PathObjectPair &)
Copy constructor.
DistiAttribDict & Attributes()
Definition: gls_path_manager.h:133
std::string _objectName
The name of the animation target object.
Definition: gls_path_manager.h:217
DistiAttribDict * _attribDict
The attribute dictionary for the members of this object.
Definition: gls_path_manager.h:219
void SetObjectByName(const std::string &name)
Definition: gls_path_manager.h:199
Definition: gls_path_manager.h:65
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
void CurrentTimeValue(float value)
Definition: gls_path_manager.h:243
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
virtual void Draw() DISTI_METHOD_OVERRIDE
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
void SetAnimationValue(float value)
float MinTimeValue()
Definition: gls_path_manager.h:260
PathObjectPairArrayType & PathObjectPairArray()
Definition: gls_path_manager.h:226
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
virtual bool Hit(float x, float y, float z, float scale, const Vector &directionVector, Vector *collisionPoint) DISTI_METHOD_OVERRIDE
virtual void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
virtual void GetResources(std::ostream &outstr, GlsResourceFilter *filter) DISTI_METHOD_OVERRIDE
void AnimationPct(double pct)
float _maxValue
The maximum animation key value.
Definition: gls_path_manager.h:278
static DisplayObject * CreateInstance()
DynamicArray< PathObjectPair > PathObjectPairArrayType
Shorthand typedef for a list of path pairs.
Definition: gls_path_manager.h:222
float MaxTimeValue()
Definition: gls_path_manager.h:272
virtual DistiAttributeBase & Resource(const char *name) DISTI_METHOD_OVERRIDE
bool _recalcValueBounds
If true, _minValue and _maxValue will be recalculated.
Definition: gls_path_manager.h:279
const PathObjectPairArrayType & PathObjectPairArray() const
Definition: gls_path_manager.h:229
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
float _minValue
The minimum animation key value.
Definition: gls_path_manager.h:277
PathObjectPairArrayType _pathObjectPairArray
List of animation pairs to manage.
Definition: gls_path_manager.h:275
Definition: gls_resources.h:51
Definition: vertex.h:85
Macros and helper code to determine what subset of C++11/14/17 is available.
#define DISTI_SPECIAL_MEM_FUN_DELETE
Macro to wrap function deletion, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:235
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:457
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:214
The disti::GlsDynamicPath class and global enumerations.
#define GLSGEN_GLSDYNAMICPATH_EXPORT
Provides support for creating DLLs.
Definition: gls_dynamic_path.h:55
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
The disti::Group class. Implements groups of objects.
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47