Repository navigation
Expand file tree
/
Copy pathSIM_PB2Geo.cpp
More file actions
66 lines (49 loc) · 1.59 KB
/
Copy pathSIM_PB2Geo.cpp
File metadata and controls
66 lines (49 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
////////////////////////////////
// PEBBLE 2 GEO CONVERTER
#include "include.h"
#include "SIM_Pebble.h"
#include "SIM_PB2Geo.h"
const SIM_DopDescription * SIM_PB2Geo::getDopDescription()
{
static PRM_Template theTemplates[] = {
PRM_Template(PRM_TOGGLE_J, 1, &theActivateName, PRMoneDefaults),
PRM_Template(PRM_STRING, 1, &theDataNameName, &theDataNameDef),
PRM_Template(PRM_STRING, 1, &theGeoDataNameName, &theGeoDataNameDef),
PRM_Template() };
static SIM_DopDescription theDopDescription(true, "sim_pb2geo", "Pebble2Geo", "PB2Geo", classname(), theTemplates);
return &theDopDescription;
};
SIM_Solver::SIM_Result SIM_PB2Geo::solveSingleObjectSubclass(SIM_Engine & engine, SIM_Object & object, SIM_ObjectArray & feedbacktoobjects, const SIM_Time & timestep, bool newobject)
{
UT_String dn = "";
getDataName(dn);
SIM_Data* isPebble = SIM_DATA_GET(object, "IsPebble", SIM_Data);
if (isPebble == NULL) return SIM_SOLVER_SUCCESS;
SIM_Pebble* pebble = SIM_DATA_GET(object, dn, SIM_Pebble);
if (pebble == NULL)
{
return SIM_SOLVER_FAIL;
};
UT_String gdn = "";
getGeoDataName(gdn);
//UT_String GDN = dn;
//GDN += "/";
//GDN += gdn;
SIM_GeometryCopy* geocp = SIM_DATA_GET(object, gdn, SIM_GeometryCopy);
if (geocp == NULL)
{
geocp = SIM_DATA_CREATE(object, gdn, SIM_GeometryCopy, 0);
if (geocp == NULL) return SIM_SOLVER_FAIL;
};
{
SIM_GeometryAutoWriteLock lock(geocp);
GU_Detail &gdp = lock.getGdp();
for (const Patch* pb : pebble->m_P)
{
pb2geo(&gdp, *pb);
int cnt = gdp.getNumPoints();
};
edges2geo(&gdp, pebble->m_edges);
};
return SIM_SOLVER_SUCCESS;
};