Panda3D

Loading...
Searching...
No Matches
Functions
load_prc_file.h File Reference

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. More...

`#include "pandabase.h"`
`#include "filename.h"`

Go to the source code of this file.

## Functions
BEGIN_PUBLISH EXPCL_PANDA_PUTIL ConfigPage * | load_prc_file (const Filename &filename)
| A convenience function for loading explicit prc files from a disk file or from within a multifile (via the virtual file system).
EXPCL_PANDA_PUTIL ConfigPage * | load_prc_file_data (const std::string &name, const std::string &data)
| Another convenience function to load a prc file from an explicit string, which represents the contents of the prc file.
EXPCL_PANDA_PUTIL bool | unload_prc_file (ConfigPage *page)
| Unloads (and deletes) a ConfigPage that represents a prc file that was previously loaded by load_prc_file().

## Detailed Description

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.

All rights reserved.

All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."

Author
  drose

Date
  2004-10-22

Definition in file load_prc_file.h.

## Function Documentation

## ◆ load_prc_file()

BEGIN_PUBLISH EXPCL_PANDA_PUTIL ConfigPage * load_prc_file | ( | const Filename & | filename | ) |

A convenience function for loading explicit prc files from a disk file or from within a multifile (via the virtual file system).

Save the return value and pass it to unload_prc_file() if you ever want to unload this file later.

The filename is first searched along the default prc search path, and then also along the model path, for convenience.

This function is defined in putil instead of in dtool with the read of the prc stuff, so that it can take advantage of the virtual file system (which is defined in express), and the model path (which is in putil).

Definition at line 36 of file load_prc_file.cxx.

References ConfigPageManager::delete_explicit_page(), VirtualFileSystem::get_global_ptr(), ConfigPageManager::get_search_path, ConfigPageManager::make_explicit_page(), ConfigPage::read_prc(), and Filename::set_text().

## ◆ load_prc_file_data()

EXPCL_PANDA_PUTIL ConfigPage * load_prc_file_data | ( | const std::string & | name,
|  | const std::string & | data )

Another convenience function to load a prc file from an explicit string, which represents the contents of the prc file.

The first parameter is an arbitrary name to assign to this in-memory prc file. Supply a filename if the data was read from a file, or use any other name that is meaningful to you. The name is only used when the set of loaded prc files is listed.

Definition at line 81 of file load_prc_file.cxx.

References ConfigPageManager::delete_explicit_page(), ConfigPageManager::make_explicit_page(), ConfigPage::read_prc(), and ConfigPage::set_trust_level.

## ◆ unload_prc_file()

EXPCL_PANDA_PUTIL bool unload_prc_file | ( | ConfigPage * | page | ) |

Unloads (and deletes) a ConfigPage that represents a prc file that was previously loaded by load_prc_file().

Returns true if successful, false if the file was unknown.

After this function has been called, the ConfigPage pointer is no longer valid and should not be used again.

Definition at line 110 of file load_prc_file.cxx.

References ConfigPageManager::delete_explicit_page().