static void set(UnalignedMatrix44<T>& mat, bpy::tuple indices, const T v) { if (bpy::len(indices) != 2) { PyErr_SetString(PyExc_RuntimeError, "Invalid tuple length given to appleseed.Matrix.__set_item__"); bpy::throw_error_already_set(); } int i, j; bpy::extract<int> ex0(indices[0]); if (!ex0.check()) { PyErr_SetString(PyExc_TypeError, "Incompatible index type. Only ints."); bpy::throw_error_already_set(); } else i = ex0(); bpy::extract<int> ex1(indices[1]); if (!ex1.check()) { PyErr_SetString(PyExc_TypeError, "Incompatible index type. Only ints."); bpy::throw_error_already_set(); } else j = ex1(); if (i < 0) i = 4 + i; if (j < 0) j = 4 + j; if (i >= 0 && i < 4 && j >= 0 && j < 4) mat(i, j) = v; else { PyErr_SetString(PyExc_IndexError, "Out of bounds access in appleseed.Matrix.__set_item__"); boost::python::throw_error_already_set(); } }
TEST( NamespaceTest, ExtraName ) { Namespace foo( "foo.bar" ); ASSERT_FALSE( foo.isExtra() ); string str0 = foo.extraName( 0 ); ASSERT_EQUALS( "foo.bar$extra", str0 ); Namespace ex0( str0 ); ASSERT_TRUE( ex0.isExtra() ); string str1 = foo.extraName( 1 ); ASSERT_EQUALS( "foo.bar$extrb", str1 ); Namespace ex1( str1 ); ASSERT_TRUE( ex1.isExtra() ); }