Skip to content

Commit

Permalink
Fixup input parameter types, automatic conversion from Python int to …
Browse files Browse the repository at this point in the history
…C++ bool doesn't seem to work in pybind11.
  • Loading branch information
codereader committed Jul 21, 2017
1 parent f4588ac commit 26ab95e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions plugins/script/interfaces/PatchInterface.cpp
Expand Up @@ -95,20 +95,20 @@ void ScriptPatchNode::insertRows(std::size_t rowIndex)
return patchNode->getPatch().insertRows(rowIndex);
}

void ScriptPatchNode::removePoints(bool columns, std::size_t index)
void ScriptPatchNode::removePoints(int columns, std::size_t index)
{
IPatchNodePtr patchNode = std::dynamic_pointer_cast<IPatchNode>(_node.lock());
if (patchNode == NULL) return;

return patchNode->getPatch().removePoints(columns, index);
return patchNode->getPatch().removePoints(static_cast<bool>(columns), index);
}

void ScriptPatchNode::appendPoints(bool columns, bool beginning)
void ScriptPatchNode::appendPoints(int columns, int beginning)
{
IPatchNodePtr patchNode = std::dynamic_pointer_cast<IPatchNode>(_node.lock());
if (patchNode == NULL) return;

return patchNode->getPatch().appendPoints(columns, beginning);
return patchNode->getPatch().appendPoints(static_cast<bool>(columns), static_cast<bool>(beginning));
}

bool ScriptPatchNode::isValid() const
Expand Down Expand Up @@ -175,12 +175,12 @@ Subdivisions ScriptPatchNode::getSubdivisions() const
return patchNode->getPatch().getSubdivisions();
}

void ScriptPatchNode::setFixedSubdivisions(bool isFixed, const Subdivisions& divisions)
void ScriptPatchNode::setFixedSubdivisions(int isFixed, const Subdivisions& divisions)
{
IPatchNodePtr patchNode = std::dynamic_pointer_cast<IPatchNode>(_node.lock());
if (patchNode == NULL) return;

patchNode->getPatch().setFixedSubdivisions(isFixed, divisions);
patchNode->getPatch().setFixedSubdivisions(static_cast<bool>(isFixed), divisions);
}

// Initialise static members
Expand Down
6 changes: 3 additions & 3 deletions plugins/script/interfaces/PatchInterface.h
Expand Up @@ -38,8 +38,8 @@ class ScriptPatchNode :
void insertColumns(std::size_t colIndex);
void insertRows(std::size_t rowIndex);

void removePoints(bool columns, std::size_t index);
void appendPoints(bool columns, bool beginning);
void removePoints(int columns, std::size_t index);
void appendPoints(int columns, int beginning);

// Check if the patch has invalid control points or width/height are zero
bool isValid() const;
Expand All @@ -57,7 +57,7 @@ class ScriptPatchNode :

bool subdivisionsFixed() const;
Subdivisions getSubdivisions() const;
void setFixedSubdivisions(bool isFixed, const Subdivisions& divisions);
void setFixedSubdivisions(int isFixed, const Subdivisions& divisions);
};

class PatchInterface :
Expand Down
4 changes: 2 additions & 2 deletions plugins/script/interfaces/SceneGraphInterface.cpp
Expand Up @@ -90,15 +90,15 @@ bool ScriptSceneNode::isSelected()
return (selectable != NULL) ? selectable->isSelected() : false;
}

void ScriptSceneNode::setSelected(bool selected)
void ScriptSceneNode::setSelected(int selected)
{
scene::INodePtr node = _node.lock();
if (node == NULL) return;

ISelectablePtr selectable = Node_getSelectable(node);

if (selectable != NULL) {
selectable->setSelected(selected);
selectable->setSelected(static_cast<bool>(selected));
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/script/interfaces/SceneGraphInterface.h
Expand Up @@ -40,7 +40,7 @@ class ScriptSceneNode

bool isSelected();

void setSelected(bool selected);
void setSelected(int selected);

void invertSelected();
};
Expand Down
8 changes: 4 additions & 4 deletions plugins/script/interfaces/SelectionInterface.cpp
Expand Up @@ -18,14 +18,14 @@ void SelectionInterface::foreachSelectedComponent(const SelectionSystem::Visitor
GlobalSelectionSystem().foreachSelectedComponent(visitor);
}

void SelectionInterface::setSelectedAll(bool selected)
void SelectionInterface::setSelectedAll(int selected)
{
GlobalSelectionSystem().setSelectedAll(selected);
GlobalSelectionSystem().setSelectedAll(static_cast<bool>(selected));
}

void SelectionInterface::setSelectedAllComponents(bool selected)
void SelectionInterface::setSelectedAllComponents(int selected)
{
GlobalSelectionSystem().setSelectedAllComponents(selected);
GlobalSelectionSystem().setSelectedAllComponents(static_cast<bool>(selected));
}

ScriptSceneNode SelectionInterface::ultimateSelected()
Expand Down

0 comments on commit 26ab95e

Please sign in to comment.