Added size

This commit is contained in:
andreja6
2018-10-23 21:38:53 -07:00
parent 77b7c3e62b
commit 6752c5da68

View File

@@ -213,6 +213,7 @@ PhysicalInstance::~PhysicalInstance(void)
{ {
} }
char pto[512]; char pto[512];
char pto2[512];
#include <sstream> #include <sstream>
void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item) void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
@@ -253,6 +254,35 @@ void PhysicalInstance::PropUpdate(LPPROPGRIDITEM &item)
setPosition(pos); setPosition(pos);
} }
} }
else if(strcmp(item->lpszPropName, "Size") == 0)
{
std::string str = (LPTSTR)item->lpCurValue;
std::vector<float> vect;
std::stringstream ss(str);
float i;
while (ss >> i)
{
vect.push_back(i);
if (ss.peek() == ',')
ss.ignore();
}
if(vect.size() != 3)
{
sprintf(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z, "what");
LPCSTR str = LPCSTR(pto);
item->lpCurValue = (LPARAM)str;
MessageBox(NULL, "NO","NO", MB_OK);
}
else
{
Vector3 size(vect.at(0),vect.at(1),vect.at(2));
setSize(size);
}
}
} }
std::vector<PROPGRIDITEM> PhysicalInstance::getProperties() std::vector<PROPGRIDITEM> PhysicalInstance::getProperties()
@@ -276,13 +306,20 @@ std::vector<PROPGRIDITEM> PhysicalInstance::getProperties()
PIT_COLOR PIT_COLOR
)); ));
sprintf(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z, "what"); sprintf(pto, "%g, %g, %g", cFrame.translation.x, cFrame.translation.y, cFrame.translation.z);
LPCSTR str = LPCSTR(pto);
properties.push_back(createPGI( properties.push_back(createPGI(
"Item", "Item",
"Offset", "Offset",
"The position of the object in the workspace", "The position of the object in the workspace",
(LPARAM)str, (LPARAM)pto,
PIT_EDIT
));
sprintf(pto2, "%g, %g, %g", size.x, size.y, size.z);
properties.push_back(createPGI(
"Item",
"Size",
"The position of the object in the workspace",
(LPARAM)pto2,
PIT_EDIT PIT_EDIT
)); ));
return properties; return properties;