Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Resolves the error "The truth value of an array with more than one el…
…ement is ambiguous"
  • Loading branch information
lebarsfa committed Dec 30, 2020
commit 5467f41118d3dd3e15ec7f2d3b3656eda1a2b71e
5 changes: 4 additions & 1 deletion site-packages/vis/materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ class raw_texture(cvisual.texture):
def __init__(self, **kwargs):
cvisual.texture.__init__(self)
for key, value in kwargs.items():
self.__setattr__(key, value)
if key=='data' and value is None:
raise RuntimeError, "Cannot nullify a texture by assigning its data to None"
else:
self.__setattr__(key, value)

class shader_material(cvisual.material):
def __init__(self, **kwargs):
Expand Down
8 changes: 4 additions & 4 deletions src/python/numeric_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ void
numeric_texture::set_data( boost::python::numeric::array data)
{
namespace py = boost::python;
if (data == py::object() && texdata != py::object()) {
throw std::invalid_argument(
"Cannot nullify a texture by assigning its data to None");
}
//if (data == py::object() && texdata != py::object()) {
// throw std::invalid_argument(
// "Cannot nullify a texture by assigning its data to None");
//}

NPY_TYPES t = type(data);
if (t == NPY_CFLOAT || t == NPY_CDOUBLE || t == NPY_OBJECT || t == NPY_NOTYPE)
Expand Down