8 #ifndef __SIM_Utils_h__
9 #define __SIM_Utils_h__
28 #define SIM_DATA_CAST(Data, DataClass) \
29 ((DataClass *)(SIM_Data::castPointerToType( \
30 static_cast<SIM_Data *>(Data), #DataClass)))
34 #define SIM_DATA_CASTCONST(Data, DataClass) \
35 ((const DataClass *)(SIM_Data::castConstPointerToType( \
36 static_cast<const SIM_Data *>(Data), #DataClass)))
40 #define SIM_DATA_GET(Parent, DataName, DataClass) \
41 SIM_DATA_CAST((Parent).getNamedSubData(DataName), DataClass)
45 #define SIM_DATA_GETCONST(Parent, DataName, DataClass) \
46 SIM_DATA_CASTCONST((Parent).getConstNamedSubData(DataName), DataClass)
50 #define SIM_DATA_GETNTH(Parent, DataClass, N, StartFrom, RecurseFilter) \
51 SIM_DATA_CAST((Parent).getNthSubData( \
52 NULL, SIM_DataFilterByType(#DataClass), N, \
53 StartFrom, RecurseFilter), DataClass)
57 #define SIM_DATA_GETNTHCONST(Parent, DataClass, N, StartFrom, RecurseFilter) \
58 SIM_DATA_CASTCONST((Parent).getNthConstSubData( \
59 NULL, SIM_DataFilterByType(#DataClass), N, \
60 StartFrom, RecurseFilter), DataClass)
63 #define SIM_DATA_CREATE(Parent, DataName, DataClass, Flags) \
64 ((DataClass *)(static_cast<SIM_Data &>(Parent)). \
65 createNamedSubData(DataName, #DataClass, Flags))
69 #define SIM_DATA_GETORCREATE_ALT(Parent, DataName, DataClass) \
70 SIM_DATA_CAST((Parent).getOrCreateAlternateRepresentation( \
71 DataName, #DataClass), DataClass)
76 template <
class DataClass>
80 const char *DataClassName,
81 bool includenulls =
false)
83 const DataClass *converted;
86 for(
int i = 0; i < src.
entries(); i++ )
89 (
const DataClass *)
src(i)->
92 if( converted || includenulls )
100 template <
class DataClass>
104 const char *DataClassName,
105 bool includenulls =
false)
107 DataClass *converted;
111 for( i = 0; i < src.
entries(); i++ )
114 (DataClass *)
src(i)->getPointerToType(DataClassName) :
116 if( converted || includenulls )
162 int pid_f0,
int pid_f1)
163 : myPidE0(pid_e0), myPidE1(pid_e1),
164 myFid0(fid0), myFid1(fid1),
165 myPidF0(pid_f0), myPidF1(pid_f1)
GLdouble GLdouble GLint GLint const GLdouble * points
SIM_API void SIMgetPositionTransform(UT_DMatrix4 &result, const SIM_Object &)
#define SYS_VISIBILITY_EXPORT
**But if you need a result
SYS_VISIBILITY_EXPORT void initializeSIM(void *data)
SIM_API void SIMgetObjectProperties(const SIM_Object &obj, const UT_Vector3 &pos, const GA_Index ptnum, fpreal &friction, fpreal &bounce, fpreal &dynamicfriction, fpreal &bounceforward)
Returns object properties at the given point (if non-negative) or position.
SIM_API void SIMcalcEdgeData(SIM_EdgeData &edgeData, const GU_Detail &gdp)
SIM_API bool SIMisTri(const GEO_Primitive &prim)
void SIMconvertArray(const SIM_DataArray &src, UT_ValArray< DataClass * > &dest, const char *DataClassName, bool includenulls=false)
GA_API const UT_StringHolder scale
SIM_API void SIMbuildAnchorGuideObjectLink(GU_Detail *gdp, GA_Offset ptoff, const SIM_Object &object, const SIM_Options &options, const SIM_Relationship &rel)
Constructs guide geometry to illustrate connection between an anchored.
const void * getConstPointerToType(const UT_StringRef &datatype) const
SIM_API bool SIMtryCachePointList(UT_IntArray &points, const char *pattern)
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
void SIMconvertConstArray(const SIM_ConstDataArray &src, UT_ValArray< const DataClass * > &dest, const char *DataClassName, bool includenulls=false)
exint entries() const
Alias of size(). size() is preferred.
SIM_API void SIMgetGeometryTransform(UT_DMatrix4 &result, const SIM_Object &)
sim_EdgeDataEntry(int pid_e0, int pid_e1, int fid0, int fid1, int pid_f0, int pid_f1)
Information about a single edge.
UT_Array< sim_EdgeDataEntry > SIM_EdgeData