14#ifndef PYTHONLOADERFILETYPE_H
15#define PYTHONLOADERFILETYPE_H
33 PythonLoaderFileType();
34 PythonLoaderFileType(std::string extension, PyObject *entry_point);
35 ~PythonLoaderFileType();
37 bool init(PyObject *loader);
38 bool ensure_loaded()
const;
40 virtual std::string get_name()
const override;
41 virtual std::string get_extension()
const override;
48 virtual PT(PandaNode) load_file(
const Filename &path,
const LoaderOptions &options,
49 BamCacheRecord *record)
const override;
50 virtual bool save_file(
const Filename &path,
const LoaderOptions &options,
51 PandaNode *node)
const override;
54 std::string _extension;
55 std::string _additional_extensions;
56 PyObject *_entry_point =
nullptr;
57 PyObject *_load_func =
nullptr;
58 PyObject *_save_func =
nullptr;
59 bool _supports_compressed =
false;
61 friend class Extension<LoaderFileTypeRegistry>;
64 static TypeHandle get_class_type() {
67 static void init_type() {
68 LoaderFileType::init_type();
70 LoaderFileType::get_class_type());
72 virtual TypeHandle get_type()
const override {
73 return get_class_type();
75 virtual TypeHandle force_init_type()
override {
77 return get_class_type();
81 static TypeHandle _type_handle;
This is the base class for a family of scene-graph file types that the Loader supports.
virtual bool supports_compressed() const
Returns true if this file type can transparently load compressed files (with a .pz or ....
virtual bool supports_save() const
Returns true if the file type can be used to save files, and save_file() is supported.
virtual bool supports_load() const
Returns true if the file type can be used to load files, and load_file() is supported.
virtual std::string get_additional_extensions() const
Returns a space-separated list of extension, in addition to the one returned by get_extension(),...
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(),...