Panda3D
Loading...
Searching...
No Matches
modelSaveRequest.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file modelSaveRequest.h
10 * @author drose
11 * @date 2012-12-19
12 */
13
14#ifndef MODELSAVEREQUEST_H
15#define MODELSAVEREQUEST_H
16
17#include "pandabase.h"
18
19#include "asyncTask.h"
20#include "filename.h"
21#include "loaderOptions.h"
22#include "pandaNode.h"
23#include "pointerTo.h"
24#include "loader.h"
25
26/**
27 * A class object that manages a single asynchronous model save request.
28 * Create a new ModelSaveRequest, and add it to the loader via save_async(),
29 * to begin an asynchronous save.
30 */
31class EXPCL_PANDA_PGRAPH ModelSaveRequest : public AsyncTask {
32public:
33 ALLOC_DELETED_CHAIN(ModelSaveRequest);
34
35PUBLISHED:
36 explicit ModelSaveRequest(const std::string &name,
37 const Filename &filename,
38 const LoaderOptions &options,
39 PandaNode *node, Loader *loader);
40
41 INLINE const Filename &get_filename() const;
42 INLINE const LoaderOptions &get_options() const;
43 INLINE PandaNode *get_node() const;
44 INLINE Loader *get_loader() const;
45
46 INLINE bool is_ready() const;
47 INLINE bool get_success() const;
48
49 MAKE_PROPERTY(filename, get_filename);
50 MAKE_PROPERTY(options, get_options);
51 MAKE_PROPERTY(node, get_node);
52 MAKE_PROPERTY(loader, get_loader);
53
54protected:
55 virtual DoneStatus do_task();
56
57private:
58 Filename _filename;
59 LoaderOptions _options;
60 PT(PandaNode) _node;
61 PT(Loader) _loader;
62 bool _success;
63
64public:
65 static TypeHandle get_class_type() {
66 return _type_handle;
67 }
68 static void init_type() {
69 AsyncTask::init_type();
70 register_type(_type_handle, "ModelSaveRequest",
71 AsyncTask::get_class_type());
72 }
73 virtual TypeHandle get_type() const {
74 return get_class_type();
75 }
76 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
77
78private:
79 static TypeHandle _type_handle;
80};
81
82#include "modelSaveRequest.I"
83
84#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
Specifies parameters that may be passed to the loader.
A convenient class for loading models from disk, in bam or egg format (or any of a number of other fo...
Definition loader.h:42
get_options
Returns the LoaderOptions associated with this asynchronous ModelSaveRequest.
get_node
Returns the node that was passed to the constructor.
bool get_success() const
Returns the true if the model was saved successfully, false otherwise.
get_loader
Returns the Loader object associated with this asynchronous ModelSaveRequest.
bool is_ready() const
Returns true if this request has completed, false if it is still pending.
ModelSaveRequest(const std::string &name, const Filename &filename, const LoaderOptions &options, PandaNode *node, Loader *loader)
Create a new ModelSaveRequest, and add it to the loader via save_async(), to begin an asynchronous sa...
get_filename
Returns the filename associated with this asynchronous ModelSaveRequest.
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...