Commit 9defc3a0 authored by CAMP C++ Builder's avatar CAMP C++ Builder

core API improvement: fixed matrix processor, removed camera property

parent 53765b39
......@@ -51,7 +51,6 @@ namespace campvis {
, p_matrixBString("MatrixB_String", "Matrix B String", "identity")
, p_matrixBModifiers("MatrixBModifiers", "Matrix B Modifiers")
, p_targetMatrixID("TargetMatrixID", "Target Matrix ID", "ProbeToReference", DataNameProperty::WRITE)
, p_cameraProperty("Camera", "Exported Camera")
, _lastdc(nullptr)
{
addProperty(p_parserMode, INVALID_PROPERTIES);
......@@ -68,9 +67,7 @@ namespace campvis {
addProperty(p_matrixBModifiers, INVALID_RESULT);
addProperty(p_targetMatrixID, INVALID_RESULT);
addProperty(p_cameraProperty, VALID);
invalidate(INVALID_PROPERTIES);
}
......@@ -184,10 +181,23 @@ namespace campvis {
//update the data name dependencies
_dataDependencies.clear();
//first, obtain a list of matrices that are generated by this formula
std::vector<std::string> lines = StringUtils::split(p_parserInputString.getValue(), "\n");
std::vector<std::string> assignees;
for(size_t i = 0, s = lines.size(); i < s; i++) {
auto parts = StringUtils::split(lines[i], "=");
if(parts.size() > 1) {
assignees.push_back(parts[0]);
LDEBUG("Ignoring " << parts[0]);
}
}
// then, obtain all matrices that this formula depends on (basically all strings in brackets [...])
// ignore those that are generated by the formula itself
auto l1 = StringUtils::split(p_parserInputString.getValue(), "[");
for (size_t i = 1, s = l1.size(); i < s; ++i) {
auto l2 = StringUtils::split(l1[i], "]");
//LDEBUG("Data Name: " << l2[0]);
if(std::find(assignees.begin(), assignees.end(), l2[0]) == assignees.end())
_dataDependencies.insert(l2[0]);
}
}
......@@ -368,18 +378,12 @@ namespace campvis {
// put all results into the data container
// matrix names beginning with an underscore are skipped
// _camera matrix is used to modify m_cameraProperty
for (auto it = results.begin(), end = results.end(); it != end; ++it) {
if (it->first[0] != '_') {
dc.addData(it->first, new TransformData(it->second));
}
if (it->first == "_camera") {
tgt::Camera cam = p_cameraProperty.getValue();
cam.setViewMatrix(it->second);
p_cameraProperty.setValue(cam);
}
}
}
void MatrixProcessor::DataContainerDataAdded(std::string name, DataHandle data) {
if (p_parserMode.getValue()) {
......
......@@ -101,8 +101,6 @@ namespace campvis {
DataNameProperty p_targetMatrixID; ///< name for the output matrix
CameraProperty p_cameraProperty;
void DataContainerDataAdded(std::string name, DataHandle data);
protected:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment