3ds Max Plugins
-
class DataBlock
- #include <datablk.h>
DataBlock class for reading and writing hierarchically structured data.
Class for reading and writing hierarchically structured data.
DataBlock itself is a node of the tree that has a name and hosts typified named parameters and named sub-nodes.
For clarity, names are restricted to C indentifier rules.
Actual names are stored in NameMap that is shared by all DataBlocks in the tree. Blocks and parameters use integer ids to address names in the NameMap, so there are methods that take name ids and those that take character strings. You can use name ids when you look for blocks or parameters for performance gain.
DataBlock tree contents can be serialized in text form.
Text files of this format usually have extension “.blk”.
Public Types
-
enum class ParamType
Values:
-
enumerator TYPE_NONE
-
enumerator TYPE_STRING
Text string.
-
enumerator TYPE_INT
Integer.
-
enumerator TYPE_REAL
real (float).
-
enumerator TYPE_POINT2
Point2.
-
enumerator TYPE_POINT3
Point3.
-
enumerator TYPE_POINT4
Point4.
-
enumerator TYPE_IPOINT2
IPoint2.
-
enumerator TYPE_IPOINT3
IPoint3.
-
enumerator TYPE_BOOL
Boolean.
-
enumerator TYPE_E3DCOLOR
E3DCOLOR.
-
enumerator TYPE_NONE
Public Functions
-
~DataBlock() = default
-
void clearData()
Delete all sub-blocks.
-
bool loadText(const char *text, int text_length, const char *filename = NULL)
Load DataBlock tree from specified text. Filename is for error output only.
-
bool loadText(std::string &text, const char *filename = NULL)
Load DataBlock tree from specified text. Filename is for error output only.
Note
This method will modify text when including files.
-
bool loadFromStream(std::ifstream &is, const char *fname = NULL)
Load DataBlock tree from arbitrary stream Data may be presented like text, binary or stream data created by function beginTaggedBlock(_MAKE4C(‘blk’)) fname uses if loading from text file to right parse include directives
-
bool saveToTextFile(const std::filesystem::path &filename) const
Save this DataBlock (and its sub-tree) to the specified file (text form)
-
int getNameId(const char *name) const
Returns name id from NameMap, or -1 if there’s no such name in the NameMap.
-
const char *getName(int name_id) const
Returns name by name id, uses NameMap. Returns NULL if name id is not valid.
-
DataBlock *getBlockByName(int name_id, int start_after = -1) const
Returns pointer to sub-block with specified name id, or NULL if not found.
-
inline DataBlock *getBlockByName(const char *name, int start_after = -1) const
Returns pointer to sub-block with specified name, or NULL if not found.
-
int getParamNameId(int param_number) const
Returns i-th parameter name id. See getNameId().
-
inline const char *getParamName(int param_number) const
Returns i-th parameter name. Uses getName().
-
int findParam(int name_id, int start_after = -1) const
Find parameter by name id. Returns parameter index or -1 if not found.
-
inline int findParam(const char *name, int start_after = -1) const
Find parameter by name. Uses getNameId(). Returns parameter index or -1 if not found.
-
inline bool paramExists(const char *name, int start_after = -1) const
Returns true if there is parameter with specified name in this DataBlock.
-
const char *getStr(int param_number, const char *def = "") const
-
bool getBool(int param_number, bool def = false) const
-
int getInt(int param_number, int def = 0) const
-
real getReal(int param_number, real def = 0.f) const
-
Point3 getPoint3(int param_number, const Point3 &def = Point3(0, 0, 0)) const
-
const char *getStr(const char *name, const char *def) const
-
bool getBool(const char *name, bool def) const
-
int getInt(const char *name, int def) const
-
real getReal(const char *name, real def) const
-
Point3 getPoint3(const char *name, const Point3 &def) const
-
int setStr(const char *name, const char *value)
-
int setBool(const char *name, bool value)
-
int setInt(const char *name, int value)
-
int setReal(const char *name, real value)
-
int setPoint3(const char *name, const Point3 &value)
-
int addStr(const char *name, const char *value)
-
int addBool(const char *name, bool value)
-
int addInt(const char *name, int value)
-
int addReal(const char *name, real value)
-
int addPoint3(const char *name, const Point3 &value)
Protected Functions
-
void setBlockName(const char *name)
Friends
- friend class DataBlockParser
-
enum class ParamType
Warning
doxygenfile: Cannot find file “e3DCOLOR.H
common classes and functions for 2D, 3D and 4D math
-
class Matrix33
- #include <math3d.h>
-
class TMatrix
- #include <math3d.h>
4x3 transformation matrix. last column (3rd, counting from zero) is translation
See also
Matrix3 TMatrix4 Point3 Point2 Point4
-
class BBox2
- #include <math3d.h>
-
class BBox3
- #include <math3d.h>
-
class StaticMeshRayTracer
- #include <math3d.h>
Subclassed by StaticMeshRTracer
-
class NameMap
- #include <namemap.h>
Public Functions
-
NameMap() = default
-
void clear()
Clear name list.
-
inline int nameCount() const
Number of names in list. You can get them all by iterating from 0 to nameCount()-1.
-
const char *getName(int i) const
Returns NULL when name_id is invalid.
-
int getNameId(const char *name) const
Returns -1 if not found.
-
int addNameId(const char *name)
Returns -1 if NULL. Adds name to the list if not found.
-
NameMap() = default
Warning
doxygenfile: Cannot find file “str.H